From 355d1d91b76e933fb7a3373148188514ddbe5023 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 08:28:23 +0000 Subject: [PATCH] Bump k8s.io/kubernetes from 1.27.9 to 1.29.14 Bumps [k8s.io/kubernetes](https://github.com/kubernetes/kubernetes) from 1.27.9 to 1.29.14. - [Release notes](https://github.com/kubernetes/kubernetes/releases) - [Commits](https://github.com/kubernetes/kubernetes/compare/v1.27.9...v1.29.14) --- updated-dependencies: - dependency-name: k8s.io/kubernetes dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 85 +- go.sum | 191 +- .../Masterminds/goutils/.travis.yml | 18 - .../Masterminds/goutils/CHANGELOG.md | 8 - .../Masterminds/goutils/LICENSE.txt | 202 - .../github.com/Masterminds/goutils/README.md | 70 - .../Masterminds/goutils/appveyor.yml | 21 - .../goutils/cryptorandomstringutils.go | 230 - .../Masterminds/goutils/randomstringutils.go | 248 - .../Masterminds/goutils/stringutils.go | 240 - .../Masterminds/goutils/wordutils.go | 357 - .../github.com/Masterminds/semver/.travis.yml | 29 - .../Masterminds/semver/CHANGELOG.md | 109 - .../github.com/Masterminds/semver/LICENSE.txt | 19 - vendor/github.com/Masterminds/semver/Makefile | 36 - .../github.com/Masterminds/semver/README.md | 194 - .../Masterminds/semver/appveyor.yml | 44 - .../Masterminds/semver/collection.go | 24 - .../Masterminds/semver/constraints.go | 423 - vendor/github.com/Masterminds/semver/doc.go | 115 - .../github.com/Masterminds/semver/version.go | 425 - .../Masterminds/semver/version_fuzz.go | 10 - .../github.com/cenkalti/backoff/v4/README.md | 4 +- .../cenkalti/backoff/v4/exponential.go | 57 +- vendor/github.com/cespare/xxhash/v2/README.md | 2 + vendor/github.com/cespare/xxhash/v2/xxhash.go | 29 +- .../cespare/xxhash/v2/xxhash_asm.go | 2 +- .../cespare/xxhash/v2/xxhash_other.go | 2 +- .../cespare/xxhash/v2/xxhash_safe.go | 2 +- .../cespare/xxhash/v2/xxhash_unsafe.go | 2 +- vendor/github.com/go-logr/logr/README.md | 1 + vendor/github.com/go-logr/logr/funcr/funcr.go | 169 +- .../go-openapi/jsonpointer/.golangci.yml | 61 + .../go-openapi/jsonpointer/README.md | 8 +- .../go-openapi/jsonpointer/pointer.go | 191 +- vendor/github.com/go-openapi/swag/.gitignore | 1 + .../github.com/go-openapi/swag/.golangci.yml | 54 +- .../github.com/go-openapi/swag/BENCHMARK.md | 52 + vendor/github.com/go-openapi/swag/README.md | 8 +- .../go-openapi/swag/initialism_index.go | 202 + vendor/github.com/go-openapi/swag/loading.go | 105 +- .../github.com/go-openapi/swag/name_lexem.go | 70 +- .../github.com/go-openapi/swag/post_go18.go | 24 - .../github.com/go-openapi/swag/post_go19.go | 68 - vendor/github.com/go-openapi/swag/pre_go18.go | 24 - vendor/github.com/go-openapi/swag/pre_go19.go | 70 - vendor/github.com/go-openapi/swag/split.go | 470 +- .../go-openapi/swag/string_bytes.go | 8 + vendor/github.com/go-openapi/swag/util.go | 224 +- vendor/github.com/go-openapi/swag/yaml.go | 39 +- .../github.com/go-task/slim-sprig/.travis.yml | 24 - vendor/github.com/go-task/slim-sprig/Makefile | 13 - .../go-task/slim-sprig/appveyor.yml | 26 - .../github.com/go-task/slim-sprig/crypto.go | 441 - .../github.com/go-task/slim-sprig/glide.lock | 31 - .../github.com/go-task/slim-sprig/glide.yaml | 16 - vendor/github.com/go-task/slim-sprig/regex.go | 35 - .../github.com/go-task/slim-sprig/semver.go | 23 - .../go-task/slim-sprig/v3/.editorconfig | 14 + .../go-task/slim-sprig/v3/.gitattributes | 1 + .../go-task/slim-sprig/{ => v3}/.gitignore | 0 .../go-task/slim-sprig/{ => v3}/CHANGELOG.md | 132 + .../go-task/slim-sprig/{ => v3}/LICENSE.txt | 3 +- .../go-task/slim-sprig/{ => v3}/README.md | 33 +- .../go-task/slim-sprig/v3/Taskfile.yml | 12 + .../go-task/slim-sprig/v3/crypto.go | 24 + .../go-task/slim-sprig/{ => v3}/date.go | 69 + .../go-task/slim-sprig/{ => v3}/defaults.go | 82 +- .../go-task/slim-sprig/{ => v3}/dict.go | 53 +- .../go-task/slim-sprig/{ => v3}/doc.go | 2 +- .../go-task/slim-sprig/{ => v3}/functions.go | 230 +- .../go-task/slim-sprig/{ => v3}/list.go | 232 +- .../go-task/slim-sprig/v3/network.go | 12 + .../go-task/slim-sprig/{ => v3}/numeric.go | 79 +- .../go-task/slim-sprig/{ => v3}/reflect.go | 0 .../github.com/go-task/slim-sprig/v3/regex.go | 83 + .../go-task/slim-sprig/{ => v3}/strings.go | 60 +- .../github.com/go-task/slim-sprig/v3/url.go | 66 + .../golang/protobuf/jsonpb/decode.go | 530 - .../golang/protobuf/jsonpb/encode.go | 559 - .../github.com/golang/protobuf/jsonpb/json.go | 69 - .../github.com/golang/protobuf/ptypes/any.go | 7 +- .../go-tpm-tools/.github/workflows/ci.yml | 126 - .../.github/workflows/releaser.yaml | 52 - .../github.com/google/go-tpm-tools/.gitignore | 13 - .../google/go-tpm-tools/.goreleaser.yaml | 39 - .../google/go-tpm-tools/CONTRIBUTING.md | 33 - .../github.com/google/go-tpm-tools/README.md | 128 - .../google/go-tpm-tools/RELEASING.md | 96 - .../go-tpm-tools/cel/canonical_eventlog.go | 413 - .../cel/canonical_eventlog_test.go | 175 - .../google/go-tpm-tools/cel/cos_tlv.go | 126 - .../google/go-tpm-tools/cel/cos_tlv_test.go | 128 - .../google/go-tpm-tools/client/attest.go | 326 - .../client/attest_network_test.go | 36 - .../google/go-tpm-tools/client/attest_test.go | 371 - .../google/go-tpm-tools/client/close.go | 29 - .../google/go-tpm-tools/client/eventlog.go | 19 - .../go-tpm-tools/client/eventlog_linux.go | 7 - .../go-tpm-tools/client/eventlog_other.go | 10 - .../go-tpm-tools/client/example_test.go | 274 - .../google/go-tpm-tools/client/handles.go | 72 - .../go-tpm-tools/client/handles_test.go | 41 - .../google/go-tpm-tools/client/import.go | 83 - .../google/go-tpm-tools/client/keys.go | 522 - .../google/go-tpm-tools/client/keys_test.go | 302 - .../google/go-tpm-tools/client/pcr.go | 170 - .../google/go-tpm-tools/client/pcr_test.go | 127 - .../google/go-tpm-tools/client/quote_test.go | 154 - .../google/go-tpm-tools/client/seal_test.go | 460 - .../google/go-tpm-tools/client/session.go | 101 - .../google/go-tpm-tools/client/signer.go | 146 - .../google/go-tpm-tools/client/signer_test.go | 317 - .../google/go-tpm-tools/client/template.go | 143 - .../google/go-tpm-tools/cloudbuild.yaml | 177 - .../google/go-tpm-tools/cmd/attest.go | 197 - .../google/go-tpm-tools/cmd/attest_test.go | 397 - .../google/go-tpm-tools/cmd/fake_metadata.go | 72 - .../google/go-tpm-tools/cmd/flags.go | 224 - .../google/go-tpm-tools/cmd/flush.go | 87 - .../google/go-tpm-tools/cmd/flush_test.go | 48 - .../github.com/google/go-tpm-tools/cmd/go.mod | 31 - .../github.com/google/go-tpm-tools/cmd/go.sum | 1382 --- .../google/go-tpm-tools/cmd/gotpm/main.go | 14 - .../google/go-tpm-tools/cmd/open.go | 44 - .../google/go-tpm-tools/cmd/open_other.go | 30 - .../google/go-tpm-tools/cmd/open_windows.go | 12 - .../google/go-tpm-tools/cmd/pubkey.go | 100 - .../google/go-tpm-tools/cmd/read.go | 108 - .../google/go-tpm-tools/cmd/root.go | 61 - .../google/go-tpm-tools/cmd/seal.go | 146 - .../google/go-tpm-tools/cmd/seal_test.go | 147 - .../google/go-tpm-tools/cmd/verify.go | 96 - .../google/go-tpm-tools/cmd/verify_test.go | 145 - .../google/go-tpm-tools/files/PKGBUILD | 35 - .../google/go-tpm-tools/files/boot-unseal.sh | 39 - .../google/go-tpm-tools/files/initcpio.hooks | 7 - .../go-tpm-tools/files/initcpio.install | 23 - vendor/github.com/google/go-tpm-tools/go.mod | 26 - vendor/github.com/google/go-tpm-tools/go.sum | 1252 --- vendor/github.com/google/go-tpm-tools/go.work | 9 - .../google/go-tpm-tools/go.work.sum | 251 - .../google/go-tpm-tools/internal/pcrs.go | 132 - .../google/go-tpm-tools/internal/pcrs_test.go | 33 - .../google/go-tpm-tools/internal/public.go | 49 - .../google/go-tpm-tools/internal/quote.go | 135 - .../test/attestations/gce-cos-85-no-nonce.pb | Bin 29596 -> 0 bytes .../test/attestations/gce-cos-85-nonce9009.pb | Bin 29602 -> 0 bytes .../certificates/pca_tpm_ecc_enc_cert.pem | 30 - .../certificates/pca_tpm_ecc_sign_cert.pem | 30 - .../certificates/pca_tpm_rsa_enc_cert.pem | 35 - .../certificates/pca_tpm_rsa_sign_cert.pem | 35 - .../certificates/uca_tpm_ecc_enc_cert.pem | 26 - .../certificates/uca_tpm_ecc_sign_cert.pem | 26 - .../certificates/uca_tpm_rsa_enc_cert.pem | 30 - .../certificates/uca_tpm_rsa_sign_cert.pem | 30 - .../test/eventlogs/arch-linux-workstation.bin | Bin 15579 -> 0 bytes .../test/eventlogs/cos-101-amd-sev.bin | Bin 23050 -> 0 bytes .../test/eventlogs/cos-85-amd-sev.bin | Bin 24122 -> 0 bytes .../test/eventlogs/cos-93-amd-sev.bin | Bin 24158 -> 0 bytes .../internal/test/eventlogs/debian-10.bin | Bin 22220 -> 0 bytes .../internal/test/eventlogs/glinux-alex.bin | Bin 15881 -> 0 bytes .../internal/test/eventlogs/rhel8-uefi.bin | Bin 34034 -> 0 bytes .../test/eventlogs/ubuntu-1804-amd-sev.bin | Bin 26013 -> 0 bytes .../test/eventlogs/ubuntu-2104-no-dbx.bin | Bin 33824 -> 0 bytes .../eventlogs/ubuntu-2104-no-secure-boot.bin | Bin 38268 -> 0 bytes .../internal/test/load_random_external_key.go | 47 - .../go-tpm-tools/internal/test/test_data.go | 72 - .../go-tpm-tools/internal/test/test_other.go | 23 - .../go-tpm-tools/internal/test/test_tpm.go | 147 - .../internal/test/test_windows.go | 18 - .../go-tpm-tools/launcher/.gcloudignore | 4 - .../go-tpm-tools/launcher/agent/agent.go | 162 - .../go-tpm-tools/launcher/agent/agent_test.go | 257 - .../google/go-tpm-tools/launcher/auth.go | 45 - .../go-tpm-tools/launcher/container_runner.go | 647 -- .../launcher/container_runner_test.go | 500 - .../google/go-tpm-tools/launcher/errors.go | 21 - .../google/go-tpm-tools/launcher/go.mod | 67 - .../google/go-tpm-tools/launcher/go.sum | 1789 ---- .../launcher/image/cloudbuild.yaml | 59 - .../launcher/image/container-runner.service | 14 - .../go-tpm-tools/launcher/image/debug.conf | 3 - .../go-tpm-tools/launcher/image/entrypoint.sh | 16 - .../launcher/image/exit_script.sh | 14 - .../go-tpm-tools/launcher/image/fixup_oem.sh | 31 - .../launcher/image/fluent-bit-cs.conf | 65 - .../go-tpm-tools/launcher/image/hardened.conf | 5 - .../go-tpm-tools/launcher/image/preload.sh | 122 - .../launcher/image/test/README.md | 66 - .../launcher/image/test/check_failure.sh | 16 - .../launcher/image/test/cleanup.sh | 12 - .../launcher/image/test/create_vm.sh | 63 - .../image/test/data/cloud-init-config.yaml | 6 - .../image/test/data/echo_startupscript.sh | 4 - .../test_cloud_init_userdata_disabled.sh | 18 - .../test/scripts/test_experiment_value.sh | 21 - .../test/scripts/test_launcher_workload.sh | 111 - .../test_launcher_workload_cloudlogging.sh | 114 - .../test/scripts/test_launchpolicy_cmd.sh | 16 - .../test_launchpolicy_cmd_cloudlogging.sh | 16 - .../test/scripts/test_launchpolicy_env.sh | 16 - .../test_launchpolicy_env_cloudlogging.sh | 16 - .../scripts/test_launchpolicy_log_debug.sh | 16 - ...est_launchpolicy_log_debug_cloudlogging.sh | 16 - .../scripts/test_launchpolicy_log_never.sh | 16 - ...est_launchpolicy_log_never_cloudlogging.sh | 16 - .../image/test/scripts/test_log_redirect.sh | 30 - .../image/test/scripts/test_mds_var_change.sh | 13 - .../scripts/test_multiwriterpd_disabled.sh | 25 - .../test/scripts/test_os_config_os_policy.sh | 66 - .../image/test/scripts/test_ssh_manual.sh | 76 - .../scripts/test_startupscript_disabled.sh | 13 - .../image/test/test_debug_cloudbuild.yaml | 58 - .../test/test_debug_unstable_cloudbuild.yaml | 40 - .../image/test/test_experiments_client.yaml | 40 - .../image/test/test_hardened_cloudbuild.yaml | 77 - .../test_hardened_unstable_cloudbuild.yaml | 40 - .../image/test/test_ingress_network.yaml | 67 - .../test/test_launchpolicy_cloudbuild.yaml | 154 - .../image/test/test_log_redirection.yaml | 143 - .../image/test/util/change_metadata_vars.sh | 66 - .../image/test/util/read_cloud_logging.sh | 10 - .../launcher/image/test/util/read_serial.sh | 39 - .../image/testworkloads/basic/Dockerfile | 17 - .../image/testworkloads/basic/main.go | 46 - .../testworkloads/launchpolicycmd/Dockerfile | 14 - .../launchpolicylogdebug/Dockerfile | 14 - .../launchpolicylognever/Dockerfile | 14 - .../internal/experiments/experiments.go | 42 - .../internal/experiments/experiments_test.go | 52 - .../internal/oci/cosign/fakesignature.go | 43 - .../launcher/internal/oci/cosign/signature.go | 81 - .../internal/oci/cosign/signature_test.go | 180 - .../launcher/internal/oci/interface.go | 45 - .../internal/signaturediscovery/client.go | 97 - .../signaturediscovery/client_test.go | 106 - .../internal/signaturediscovery/fakeclient.go | 54 - .../go-tpm-tools/launcher/launcher/main.go | 253 - .../launcher/launcher/main_test.go | 132 - .../launcher/launcherfile/launcherfile.go | 12 - .../launcher/spec/launch_policy.go | 109 - .../launcher/spec/launch_policy_test.go | 435 - .../go-tpm-tools/launcher/spec/launch_spec.go | 220 - .../launcher/spec/launch_spec_test.go | 152 - .../go-tpm-tools/launcher/verifier/client.go | 43 - .../launcher/verifier/fake/fakeclaims.go | 25 - .../launcher/verifier/fake/fakeverifier.go | 111 - .../launcher/verifier/rest/rest.go | 211 - .../verifier/rest/rest_network_test.go | 58 - .../launcher/verifier/rest/rest_test.go | 19 - .../google/go-tpm-tools/proto/attest.proto | 252 - .../go-tpm-tools/proto/attest/attest.pb.go | 2125 ---- .../google/go-tpm-tools/proto/doc.go | 31 - .../google/go-tpm-tools/proto/gen_attest.sh | 3 - .../google/go-tpm-tools/proto/tpm.proto | 54 - .../google/go-tpm-tools/proto/tpm/tpm.pb.go | 595 -- .../google/go-tpm-tools/run_cloudbuild.sh | 23 - .../server/ca-certs/tpm_ek_intermediate_2.crt | Bin 1560 -> 0 bytes .../server/ca-certs/tpm_ek_root_1.cer | Bin 1667 -> 0 bytes .../go-tpm-tools/server/certificate_test.go | 59 - .../google/go-tpm-tools/server/ecc_utils.go | 47 - .../google/go-tpm-tools/server/eventlog.go | 594 -- .../go-tpm-tools/server/eventlog_test.go | 935 -- .../go-tpm-tools/server/example_test.go | 47 - .../go-tpm-tools/server/grouped_error.go | 77 - .../go-tpm-tools/server/grouped_error_test.go | 126 - .../google/go-tpm-tools/server/import.go | 246 - .../google/go-tpm-tools/server/import_test.go | 249 - .../go-tpm-tools/server/instance_info.go | 19 - .../go-tpm-tools/server/key_conversion.go | 108 - .../server/key_conversion_test.go | 103 - .../google/go-tpm-tools/server/policy.go | 58 - .../go-tpm-tools/server/policy_constants.go | 179 - .../server/policy_constants_test.go | 56 - .../google/go-tpm-tools/server/policy_test.go | 153 - .../go-tpm-tools/server/secure-boot/GcePk.crt | Bin 762 -> 0 bytes .../MicCorKEKCA2011_2011-06-24.crt | Bin 1516 -> 0 bytes .../MicCorUEFCA2011_2011-06-27.crt | Bin 1556 -> 0 bytes .../MicWinProPCA2011_2011-10-19.crt | Bin 1499 -> 0 bytes .../server/secure-boot/canonical-boothole.crt | Bin 1060 -> 0 bytes .../server/secure-boot/cisco-boothole.crt | Bin 1164 -> 0 bytes .../secure-boot/dbxupdate-2014-08-11.bin | Bin 4011 -> 0 bytes .../secure-boot/dbxupdate_x64-2020-10-12.bin | Bin 15281 -> 0 bytes .../secure-boot/dbxupdate_x64-2021-04-29.bin | Bin 13501 -> 0 bytes .../server/secure-boot/debian-boothole.crt | Bin 768 -> 0 bytes .../google/go-tpm-tools/server/verify.go | 374 - .../google/go-tpm-tools/server/verify_sev.go | 58 - .../google/go-tpm-tools/server/verify_tdx.go | 25 - .../google/go-tpm-tools/server/verify_test.go | 1255 --- .../simulator/ms-tpm-20-ref/CONTRIBUTING.md | 42 - .../simulator/ms-tpm-20-ref/LICENSE | 17 - .../simulator/ms-tpm-20-ref/README.md | 49 - .../ms-tpm-20-ref/Samples/Google/Clock.c | 174 - .../ms-tpm-20-ref/Samples/Google/Entropy.c | 11 - .../ms-tpm-20-ref/Samples/Google/NVMem.c | 81 - .../ms-tpm-20-ref/Samples/Google/Platform.h | 71 - .../Samples/Google/PlatformData.h | 86 - .../Samples/Google/Platform_fp.h | 197 - .../ms-tpm-20-ref/Samples/Google/Run.c | 78 - .../ms-tpm-20-ref/TPMCmd/Makefile.am | 62 - .../ms-tpm-20-ref/TPMCmd/configure.ac | 89 - .../simulator/ms-tpm-20-ref/TPMCmd/flags.m4 | 84 - .../TPMCmd/tpm/include/BaseTypes.h | 60 - .../TPMCmd/tpm/include/BnValues.h | 320 - .../TPMCmd/tpm/include/Capabilities.h | 49 - .../TPMCmd/tpm/include/CommandAttributeData.h | 916 -- .../TPMCmd/tpm/include/CommandAttributes.h | 66 - .../TPMCmd/tpm/include/CommandDispatchData.h | 5167 ---------- .../TPMCmd/tpm/include/CommandDispatcher.h | 2051 ---- .../TPMCmd/tpm/include/Commands.h | 451 - .../TPMCmd/tpm/include/CompilerDependencies.h | 132 - .../TPMCmd/tpm/include/CryptEcc.h | 71 - .../TPMCmd/tpm/include/CryptHash.h | 303 - .../TPMCmd/tpm/include/CryptRand.h | 199 - .../TPMCmd/tpm/include/CryptRsa.h | 69 - .../TPMCmd/tpm/include/CryptSym.h | 143 - .../TPMCmd/tpm/include/CryptTest.h | 70 - .../TPMCmd/tpm/include/EccTestData.h | 158 - .../ms-tpm-20-ref/TPMCmd/tpm/include/Global.h | 1439 --- .../TPMCmd/tpm/include/GpMacros.h | 332 - .../TPMCmd/tpm/include/HandleProcess.h | 1008 -- .../TPMCmd/tpm/include/HashTestData.h | 104 - .../TPMCmd/tpm/include/InternalRoutines.h | 127 - .../TPMCmd/tpm/include/KdfTestData.h | 83 - .../TPMCmd/tpm/include/LibSupport.h | 69 - .../TPMCmd/tpm/include/Ltc/LtcSettings.h | 84 - .../TPMCmd/tpm/include/Ltc/TpmToLtcHash.h | 172 - .../TPMCmd/tpm/include/Ltc/TpmToLtcMath.h | 89 - .../TPMCmd/tpm/include/Ltc/TpmToLtcSym.h | 110 - .../ms-tpm-20-ref/TPMCmd/tpm/include/MinMax.h | 46 - .../ms-tpm-20-ref/TPMCmd/tpm/include/NV.h | 165 - .../ms-tpm-20-ref/TPMCmd/tpm/include/OIDs.h | 275 - .../TPMCmd/tpm/include/Ossl/TpmToOsslHash.h | 180 - .../TPMCmd/tpm/include/Ossl/TpmToOsslMath.h | 127 - .../TPMCmd/tpm/include/Ossl/TpmToOsslSym.h | 120 - .../TPMCmd/tpm/include/PRNG_TestVectors.h | 140 - .../TPMCmd/tpm/include/RsaTestData.h | 423 - .../TPMCmd/tpm/include/SelfTest.h | 105 - .../SupportLibraryFunctionPrototypes_fp.h | 137 - .../TPMCmd/tpm/include/SymmetricTest.h | 76 - .../TPMCmd/tpm/include/SymmetricTestData.h | 178 - .../ms-tpm-20-ref/TPMCmd/tpm/include/TPMB.h | 73 - .../ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h | 55 - .../TPMCmd/tpm/include/TpmASN1.h | 127 - .../TPMCmd/tpm/include/TpmAlgorithmDefines.h | 423 - .../TPMCmd/tpm/include/TpmBuildSwitches.h | 341 - .../TPMCmd/tpm/include/TpmError.h | 56 - .../TPMCmd/tpm/include/TpmProfile.h | 789 -- .../TPMCmd/tpm/include/TpmTypes.h | 2374 ----- .../TPMCmd/tpm/include/VendorString.h | 88 - .../TPMCmd/tpm/include/Wolf/TpmToWolfHash.h | 191 - .../TPMCmd/tpm/include/Wolf/TpmToWolfMath.h | 91 - .../TPMCmd/tpm/include/Wolf/TpmToWolfSym.h | 115 - .../TPMCmd/tpm/include/Wolf/user_settings.h | 106 - .../ms-tpm-20-ref/TPMCmd/tpm/include/X509.h | 134 - .../include/prototypes/AC_GetCapability_fp.h | 71 - .../tpm/include/prototypes/AC_Send_fp.h | 72 - .../TPMCmd/tpm/include/prototypes/AC_spt_fp.h | 80 - .../prototypes/ActivateCredential_fp.h | 72 - .../tpm/include/prototypes/AlgorithmCap_fp.h | 64 - .../include/prototypes/AlgorithmTests_fp.h | 72 - .../tpm/include/prototypes/Attest_spt_fp.h | 88 - .../TPMCmd/tpm/include/prototypes/Bits_fp.h | 73 - .../tpm/include/prototypes/BnConvert_fp.h | 130 - .../TPMCmd/tpm/include/prototypes/BnMath_fp.h | 238 - .../tpm/include/prototypes/BnMemory_fp.h | 110 - .../include/prototypes/CertifyCreation_fp.h | 77 - .../tpm/include/prototypes/CertifyX509_fp.h | 76 - .../tpm/include/prototypes/Certify_fp.h | 73 - .../tpm/include/prototypes/ChangeEPS_fp.h | 60 - .../tpm/include/prototypes/ChangePPS_fp.h | 60 - .../tpm/include/prototypes/ClearControl_fp.h | 62 - .../TPMCmd/tpm/include/prototypes/Clear_fp.h | 60 - .../include/prototypes/ClockRateAdjust_fp.h | 62 - .../tpm/include/prototypes/ClockSet_fp.h | 62 - .../tpm/include/prototypes/CommandAudit_fp.h | 131 - .../prototypes/CommandCodeAttributes_fp.h | 182 - .../include/prototypes/CommandDispatcher_fp.h | 58 - .../TPMCmd/tpm/include/prototypes/Commit_fp.h | 75 - .../tpm/include/prototypes/ContextLoad_fp.h | 66 - .../tpm/include/prototypes/ContextSave_fp.h | 66 - .../tpm/include/prototypes/Context_spt_fp.h | 96 - .../tpm/include/prototypes/CreateLoaded_fp.h | 73 - .../tpm/include/prototypes/CreatePrimary_fp.h | 79 - .../TPMCmd/tpm/include/prototypes/Create_fp.h | 78 - .../tpm/include/prototypes/CryptCmac_fp.h | 84 - .../tpm/include/prototypes/CryptDes_fp.h | 76 - .../prototypes/CryptEccKeyExchange_fp.h | 88 - .../tpm/include/prototypes/CryptEccMain_fp.h | 374 - .../include/prototypes/CryptEccSignature_fp.h | 139 - .../tpm/include/prototypes/CryptHash_fp.h | 408 - .../include/prototypes/CryptPrimeSieve_fp.h | 158 - .../tpm/include/prototypes/CryptPrime_fp.h | 137 - .../tpm/include/prototypes/CryptRand_fp.h | 204 - .../tpm/include/prototypes/CryptRsa_fp.h | 210 - .../tpm/include/prototypes/CryptSelfTest_fp.h | 108 - .../tpm/include/prototypes/CryptSmac_fp.h | 84 - .../tpm/include/prototypes/CryptSym_fp.h | 126 - .../tpm/include/prototypes/CryptUtil_fp.h | 488 - .../TPMCmd/tpm/include/prototypes/DA_fp.h | 88 - .../prototypes/DictionaryAttackLockReset_fp.h | 60 - .../DictionaryAttackParameters_fp.h | 66 - .../tpm/include/prototypes/Duplicate_fp.h | 74 - .../include/prototypes/ECC_Parameters_fp.h | 66 - .../tpm/include/prototypes/ECDH_KeyGen_fp.h | 67 - .../tpm/include/prototypes/ECDH_ZGen_fp.h | 68 - .../tpm/include/prototypes/EC_Ephemeral_fp.h | 67 - .../include/prototypes/EncryptDecrypt2_fp.h | 75 - .../include/prototypes/EncryptDecrypt_fp.h | 75 - .../prototypes/EncryptDecrypt_spt_fp.h | 64 - .../TPMCmd/tpm/include/prototypes/Entity_fp.h | 108 - .../prototypes/EventSequenceComplete_fp.h | 70 - .../tpm/include/prototypes/EvictControl_fp.h | 64 - .../tpm/include/prototypes/ExecCommand_fp.h | 88 - .../include/prototypes/FieldUpgradeData_fp.h | 67 - .../include/prototypes/FieldUpgradeStart_fp.h | 66 - .../tpm/include/prototypes/FirmwareRead_fp.h | 66 - .../tpm/include/prototypes/FlushContext_fp.h | 60 - .../tpm/include/prototypes/GetCapability_fp.h | 71 - .../prototypes/GetCommandAuditDigest_fp.h | 73 - .../tpm/include/prototypes/GetRandom_fp.h | 66 - .../prototypes/GetSessionAuditDigest_fp.h | 75 - .../tpm/include/prototypes/GetTestResult_fp.h | 59 - .../tpm/include/prototypes/GetTime_fp.h | 73 - .../tpm/include/prototypes/HMAC_Start_fp.h | 70 - .../TPMCmd/tpm/include/prototypes/HMAC_fp.h | 70 - .../TPMCmd/tpm/include/prototypes/Handle_fp.h | 87 - .../include/prototypes/HashSequenceStart_fp.h | 68 - .../TPMCmd/tpm/include/prototypes/Hash_fp.h | 71 - .../prototypes/HierarchyChangeAuth_fp.h | 62 - .../include/prototypes/HierarchyControl_fp.h | 64 - .../tpm/include/prototypes/Hierarchy_fp.h | 87 - .../TPMCmd/tpm/include/prototypes/Import_fp.h | 76 - .../prototypes/IncrementalSelfTest_fp.h | 66 - .../tpm/include/prototypes/IoBuffers_fp.h | 87 - .../tpm/include/prototypes/LoadExternal_fp.h | 71 - .../TPMCmd/tpm/include/prototypes/Load_fp.h | 71 - .../tpm/include/prototypes/Locality_fp.h | 53 - .../tpm/include/prototypes/MAC_Start_fp.h | 70 - .../TPMCmd/tpm/include/prototypes/MAC_fp.h | 70 - .../include/prototypes/MakeCredential_fp.h | 71 - .../tpm/include/prototypes/Manufacture_fp.h | 79 - .../tpm/include/prototypes/Marshal_fp.h | 2408 ----- .../include/prototypes/MathOnByteBuffers_fp.h | 147 - .../TPMCmd/tpm/include/prototypes/Memory_fp.h | 179 - .../tpm/include/prototypes/NV_Certify_fp.h | 79 - .../tpm/include/prototypes/NV_ChangeAuth_fp.h | 62 - .../include/prototypes/NV_DefineSpace_fp.h | 64 - .../tpm/include/prototypes/NV_Extend_fp.h | 64 - .../prototypes/NV_GlobalWriteLock_fp.h | 60 - .../tpm/include/prototypes/NV_Increment_fp.h | 62 - .../tpm/include/prototypes/NV_ReadLock_fp.h | 62 - .../tpm/include/prototypes/NV_ReadPublic_fp.h | 67 - .../tpm/include/prototypes/NV_Read_fp.h | 72 - .../tpm/include/prototypes/NV_SetBits_fp.h | 64 - .../prototypes/NV_UndefineSpaceSpecial_fp.h | 62 - .../include/prototypes/NV_UndefineSpace_fp.h | 62 - .../tpm/include/prototypes/NV_WriteLock_fp.h | 62 - .../tpm/include/prototypes/NV_Write_fp.h | 66 - .../TPMCmd/tpm/include/prototypes/NV_spt_fp.h | 93 - .../tpm/include/prototypes/NvDynamic_fp.h | 474 - .../tpm/include/prototypes/NvReserved_fp.h | 130 - .../include/prototypes/ObjectChangeAuth_fp.h | 70 - .../TPMCmd/tpm/include/prototypes/Object_fp.h | 355 - .../tpm/include/prototypes/Object_spt_fp.h | 393 - .../tpm/include/prototypes/PCR_Allocate_fp.h | 71 - .../tpm/include/prototypes/PCR_Event_fp.h | 68 - .../tpm/include/prototypes/PCR_Extend_fp.h | 62 - .../tpm/include/prototypes/PCR_Read_fp.h | 68 - .../tpm/include/prototypes/PCR_Reset_fp.h | 60 - .../include/prototypes/PCR_SetAuthPolicy_fp.h | 66 - .../include/prototypes/PCR_SetAuthValue_fp.h | 62 - .../TPMCmd/tpm/include/prototypes/PCR_fp.h | 318 - .../tpm/include/prototypes/PP_Commands_fp.h | 64 - .../TPMCmd/tpm/include/prototypes/PP_fp.h | 98 - .../include/prototypes/PolicyAuthValue_fp.h | 60 - .../include/prototypes/PolicyAuthorizeNV_fp.h | 64 - .../include/prototypes/PolicyAuthorize_fp.h | 68 - .../include/prototypes/PolicyCommandCode_fp.h | 62 - .../prototypes/PolicyCounterTimer_fp.h | 66 - .../tpm/include/prototypes/PolicyCpHash_fp.h | 62 - .../prototypes/PolicyDuplicationSelect_fp.h | 66 - .../include/prototypes/PolicyGetDigest_fp.h | 66 - .../include/prototypes/PolicyLocality_fp.h | 62 - .../tpm/include/prototypes/PolicyNV_fp.h | 70 - .../include/prototypes/PolicyNameHash_fp.h | 62 - .../include/prototypes/PolicyNvWritten_fp.h | 62 - .../tpm/include/prototypes/PolicyOR_fp.h | 62 - .../tpm/include/prototypes/PolicyPCR_fp.h | 64 - .../include/prototypes/PolicyPassword_fp.h | 60 - .../prototypes/PolicyPhysicalPresence_fp.h | 60 - .../tpm/include/prototypes/PolicyRestart_fp.h | 60 - .../tpm/include/prototypes/PolicySecret_fp.h | 77 - .../tpm/include/prototypes/PolicySigned_fp.h | 79 - .../include/prototypes/PolicyTemplate_fp.h | 62 - .../tpm/include/prototypes/PolicyTicket_fp.h | 70 - .../prototypes/Policy_AC_SendSelect_fp.h | 68 - .../tpm/include/prototypes/Policy_spt_fp.h | 102 - .../TPMCmd/tpm/include/prototypes/Power_fp.h | 69 - .../tpm/include/prototypes/PropertyCap_fp.h | 59 - .../TPMCmd/tpm/include/prototypes/Quote_fp.h | 73 - .../tpm/include/prototypes/RSA_Decrypt_fp.h | 72 - .../tpm/include/prototypes/RSA_Encrypt_fp.h | 72 - .../tpm/include/prototypes/ReadClock_fp.h | 58 - .../tpm/include/prototypes/ReadPublic_fp.h | 68 - .../prototypes/ResponseCodeProcessing_fp.h | 52 - .../tpm/include/prototypes/Response_fp.h | 53 - .../TPMCmd/tpm/include/prototypes/Rewrap_fp.h | 75 - .../tpm/include/prototypes/RsaKeyCache_fp.h | 65 - .../tpm/include/prototypes/SelfTest_fp.h | 60 - .../include/prototypes/SequenceComplete_fp.h | 71 - .../include/prototypes/SequenceUpdate_fp.h | 62 - .../include/prototypes/SessionProcess_fp.h | 123 - .../tpm/include/prototypes/Session_fp.h | 287 - .../include/prototypes/SetAlgorithmSet_fp.h | 62 - .../prototypes/SetCommandCodeAuditStatus_fp.h | 66 - .../include/prototypes/SetPrimaryPolicy_fp.h | 64 - .../tpm/include/prototypes/Shutdown_fp.h | 60 - .../TPMCmd/tpm/include/prototypes/Sign_fp.h | 72 - .../include/prototypes/StartAuthSession_fp.h | 79 - .../tpm/include/prototypes/Startup_fp.h | 60 - .../tpm/include/prototypes/StirRandom_fp.h | 60 - .../tpm/include/prototypes/TestParms_fp.h | 60 - .../TPMCmd/tpm/include/prototypes/Ticket_fp.h | 101 - .../TPMCmd/tpm/include/prototypes/Time_fp.h | 139 - .../tpm/include/prototypes/TpmASN1_fp.h | 234 - .../tpm/include/prototypes/TpmFail_fp.h | 98 - .../tpm/include/prototypes/TpmSizeChecks_fp.h | 56 - .../prototypes/TpmToLtcDesSupport_fp.h | 58 - .../tpm/include/prototypes/TpmToLtcMath_fp.h | 150 - .../include/prototypes/TpmToLtcSupport_fp.h | 73 - .../prototypes/TpmToOsslDesSupport_fp.h | 78 - .../tpm/include/prototypes/TpmToOsslMath_fp.h | 223 - .../include/prototypes/TpmToOsslSupport_fp.h | 84 - .../prototypes/TpmToWolfDesSupport_fp.h | 90 - .../tpm/include/prototypes/TpmToWolfMath_fp.h | 209 - .../include/prototypes/TpmToWolfSupport_fp.h | 56 - .../TPMCmd/tpm/include/prototypes/Unseal_fp.h | 66 - .../include/prototypes/Vendor_TCG_Test_fp.h | 66 - .../include/prototypes/VerifySignature_fp.h | 70 - .../tpm/include/prototypes/X509_ECC_fp.h | 79 - .../tpm/include/prototypes/X509_RSA_fp.h | 71 - .../tpm/include/prototypes/X509_spt_fp.h | 118 - .../tpm/include/prototypes/ZGen_2Phase_fp.h | 75 - .../include/prototypes/_TPM_Hash_Data_fp.h | 50 - .../tpm/include/prototypes/_TPM_Hash_End_fp.h | 49 - .../include/prototypes/_TPM_Hash_Start_fp.h | 49 - .../tpm/include/prototypes/_TPM_Init_fp.h | 49 - .../ms-tpm-20-ref/TPMCmd/tpm/include/swap.h | 106 - .../TPMCmd/tpm/src/X509/TpmASN1.c | 514 - .../TPMCmd/tpm/src/X509/X509_ECC.c | 146 - .../TPMCmd/tpm/src/X509/X509_RSA.c | 234 - .../TPMCmd/tpm/src/X509/X509_spt.c | 295 - .../src/command/Asymmetric/ECC_Parameters.c | 61 - .../tpm/src/command/Asymmetric/ECDH_KeyGen.c | 92 - .../tpm/src/command/Asymmetric/ECDH_ZGen.c | 86 - .../tpm/src/command/Asymmetric/EC_Ephemeral.c | 73 - .../tpm/src/command/Asymmetric/RSA_Decrypt.c | 106 - .../tpm/src/command/Asymmetric/RSA_Encrypt.c | 90 - .../tpm/src/command/Asymmetric/ZGen_2Phase.c | 121 - .../AttachedComponent/AC_GetCapability.c | 56 - .../src/command/AttachedComponent/AC_Send.c | 102 - .../src/command/AttachedComponent/AC_spt.c | 149 - .../AttachedComponent/Policy_AC_SendSelect.c | 115 - .../tpm/src/command/Attestation/Attest_spt.c | 198 - .../tpm/src/command/Attestation/Certify.c | 94 - .../src/command/Attestation/CertifyCreation.c | 98 - .../tpm/src/command/Attestation/CertifyX509.c | 276 - .../Attestation/GetCommandAuditDigest.c | 99 - .../Attestation/GetSessionAuditDigest.c | 95 - .../tpm/src/command/Attestation/GetTime.c | 88 - .../tpm/src/command/Attestation/Quote.c | 98 - .../src/command/Capability/GetCapability.c | 180 - .../tpm/src/command/Capability/TestParms.c | 56 - .../src/command/ClockTimer/ClockRateAdjust.c | 55 - .../tpm/src/command/ClockTimer/ClockSet.c | 66 - .../tpm/src/command/ClockTimer/ReadClock.c | 56 - .../CommandAudit/SetCommandCodeAuditStatus.c | 103 - .../tpm/src/command/Context/ContextLoad.c | 193 - .../tpm/src/command/Context/ContextSave.c | 232 - .../tpm/src/command/Context/Context_spt.c | 244 - .../tpm/src/command/Context/EvictControl.c | 131 - .../tpm/src/command/Context/FlushContext.c | 86 - .../command/DA/DictionaryAttackLockReset.c | 67 - .../command/DA/DictionaryAttackParameters.c | 76 - .../tpm/src/command/Duplication/Duplicate.c | 160 - .../tpm/src/command/Duplication/Import.c | 209 - .../tpm/src/command/Duplication/Rewrap.c | 160 - .../tpm/src/command/EA/PolicyAuthValue.c | 81 - .../tpm/src/command/EA/PolicyAuthorize.c | 125 - .../tpm/src/command/EA/PolicyAuthorizeNV.c | 117 - .../tpm/src/command/EA/PolicyCommandCode.c | 90 - .../tpm/src/command/EA/PolicyCounterTimer.c | 129 - .../TPMCmd/tpm/src/command/EA/PolicyCpHash.c | 103 - .../src/command/EA/PolicyDuplicationSelect.c | 113 - .../tpm/src/command/EA/PolicyGetDigest.c | 61 - .../tpm/src/command/EA/PolicyLocality.c | 138 - .../TPMCmd/tpm/src/command/EA/PolicyNV.c | 143 - .../tpm/src/command/EA/PolicyNameHash.c | 99 - .../tpm/src/command/EA/PolicyNvWritten.c | 95 - .../TPMCmd/tpm/src/command/EA/PolicyOR.c | 99 - .../TPMCmd/tpm/src/command/EA/PolicyPCR.c | 125 - .../tpm/src/command/EA/PolicyPassword.c | 81 - .../src/command/EA/PolicyPhysicalPresence.c | 78 - .../TPMCmd/tpm/src/command/EA/PolicySecret.c | 128 - .../TPMCmd/tpm/src/command/EA/PolicySigned.c | 180 - .../tpm/src/command/EA/PolicyTemplate.c | 103 - .../TPMCmd/tpm/src/command/EA/PolicyTicket.c | 128 - .../TPMCmd/tpm/src/command/EA/Policy_spt.c | 290 - .../TPMCmd/tpm/src/command/Ecdaa/Commit.c | 169 - .../command/FieldUpgrade/FieldUpgradeData.c | 53 - .../command/FieldUpgrade/FieldUpgradeStart.c | 51 - .../src/command/FieldUpgrade/FirmwareRead.c | 55 - .../command/HashHMAC/EventSequenceComplete.c | 109 - .../tpm/src/command/HashHMAC/HMAC_Start.c | 105 - .../src/command/HashHMAC/HashSequenceStart.c | 63 - .../tpm/src/command/HashHMAC/MAC_Start.c | 92 - .../src/command/HashHMAC/SequenceComplete.c | 131 - .../tpm/src/command/HashHMAC/SequenceUpdate.c | 106 - .../tpm/src/command/Hierarchy/ChangeEPS.c | 95 - .../tpm/src/command/Hierarchy/ChangePPS.c | 96 - .../TPMCmd/tpm/src/command/Hierarchy/Clear.c | 125 - .../tpm/src/command/Hierarchy/ClearControl.c | 72 - .../tpm/src/command/Hierarchy/CreatePrimary.c | 143 - .../command/Hierarchy/HierarchyChangeAuth.c | 91 - .../src/command/Hierarchy/HierarchyControl.c | 144 - .../src/command/Hierarchy/SetPrimaryPolicy.c | 102 - .../TPMCmd/tpm/src/command/Misc/PP_Commands.c | 80 - .../tpm/src/command/Misc/SetAlgorithmSet.c | 62 - .../tpm/src/command/NVStorage/NV_Certify.c | 141 - .../tpm/src/command/NVStorage/NV_ChangeAuth.c | 68 - .../src/command/NVStorage/NV_DefineSpace.c | 226 - .../tpm/src/command/NVStorage/NV_Extend.c | 109 - .../command/NVStorage/NV_GlobalWriteLock.c | 57 - .../tpm/src/command/NVStorage/NV_Increment.c | 102 - .../tpm/src/command/NVStorage/NV_Read.c | 97 - .../tpm/src/command/NVStorage/NV_ReadLock.c | 93 - .../tpm/src/command/NVStorage/NV_ReadPublic.c | 62 - .../tpm/src/command/NVStorage/NV_SetBits.c | 91 - .../src/command/NVStorage/NV_UndefineSpace.c | 76 - .../NVStorage/NV_UndefineSpaceSpecial.c | 71 - .../tpm/src/command/NVStorage/NV_Write.c | 109 - .../tpm/src/command/NVStorage/NV_WriteLock.c | 91 - .../TPMCmd/tpm/src/command/NVStorage/NV_spt.c | 163 - .../src/command/Object/ActivateCredential.c | 107 - .../TPMCmd/tpm/src/command/Object/Create.c | 155 - .../tpm/src/command/Object/CreateLoaded.c | 221 - .../TPMCmd/tpm/src/command/Object/Load.c | 121 - .../tpm/src/command/Object/LoadExternal.c | 132 - .../tpm/src/command/Object/MakeCredential.c | 96 - .../tpm/src/command/Object/ObjectChangeAuth.c | 93 - .../tpm/src/command/Object/Object_spt.c | 1584 --- .../tpm/src/command/Object/ReadPublic.c | 67 - .../TPMCmd/tpm/src/command/Object/Unseal.c | 70 - .../TPMCmd/tpm/src/command/PCR/PCR_Allocate.c | 83 - .../TPMCmd/tpm/src/command/PCR/PCR_Event.c | 92 - .../TPMCmd/tpm/src/command/PCR/PCR_Extend.c | 89 - .../TPMCmd/tpm/src/command/PCR/PCR_Read.c | 60 - .../TPMCmd/tpm/src/command/PCR/PCR_Reset.c | 74 - .../tpm/src/command/PCR/PCR_SetAuthPolicy.c | 82 - .../tpm/src/command/PCR/PCR_SetAuthValue.c | 73 - .../TPMCmd/tpm/src/command/Random/GetRandom.c | 63 - .../tpm/src/command/Random/StirRandom.c | 54 - .../tpm/src/command/Session/PolicyRestart.c | 54 - .../src/command/Session/StartAuthSession.c | 165 - .../TPMCmd/tpm/src/command/Signature/Sign.c | 112 - .../src/command/Signature/VerifySignature.c | 93 - .../TPMCmd/tpm/src/command/Startup/Shutdown.c | 101 - .../TPMCmd/tpm/src/command/Startup/Startup.c | 244 - .../src/command/Symmetric/EncryptDecrypt.c | 163 - .../src/command/Symmetric/EncryptDecrypt2.c | 83 - .../command/Symmetric/EncryptDecrypt_spt.c | 163 - .../TPMCmd/tpm/src/command/Symmetric/HMAC.c | 108 - .../TPMCmd/tpm/src/command/Symmetric/Hash.c | 88 - .../TPMCmd/tpm/src/command/Symmetric/MAC.c | 94 - .../tpm/src/command/Testing/GetTestResult.c | 61 - .../src/command/Testing/IncrementalSelfTest.c | 65 - .../TPMCmd/tpm/src/command/Testing/SelfTest.c | 58 - .../tpm/src/command/Vendor/Vendor_TCG_Test.c | 50 - .../TPMCmd/tpm/src/crypt/AlgorithmTests.c | 963 -- .../TPMCmd/tpm/src/crypt/BnConvert.c | 295 - .../TPMCmd/tpm/src/crypt/BnMath.c | 597 -- .../TPMCmd/tpm/src/crypt/BnMemory.c | 187 - .../TPMCmd/tpm/src/crypt/CryptCmac.c | 176 - .../TPMCmd/tpm/src/crypt/CryptDes.c | 188 - .../TPMCmd/tpm/src/crypt/CryptEccData.c | 657 -- .../tpm/src/crypt/CryptEccKeyExchange.c | 383 - .../TPMCmd/tpm/src/crypt/CryptEccMain.c | 820 -- .../TPMCmd/tpm/src/crypt/CryptEccSignature.c | 931 -- .../TPMCmd/tpm/src/crypt/CryptHash.c | 938 -- .../TPMCmd/tpm/src/crypt/CryptPrime.c | 385 - .../TPMCmd/tpm/src/crypt/CryptPrimeSieve.c | 571 -- .../TPMCmd/tpm/src/crypt/CryptRand.c | 950 -- .../TPMCmd/tpm/src/crypt/CryptRsa.c | 1489 --- .../TPMCmd/tpm/src/crypt/CryptSelfTest.c | 222 - .../TPMCmd/tpm/src/crypt/CryptSmac.c | 132 - .../TPMCmd/tpm/src/crypt/CryptSym.c | 478 - .../TPMCmd/tpm/src/crypt/CryptUtil.c | 1901 ---- .../TPMCmd/tpm/src/crypt/PrimeData.c | 422 - .../TPMCmd/tpm/src/crypt/RsaKeyCache.c | 255 - .../TPMCmd/tpm/src/crypt/Ticket.c | 277 - .../tpm/src/crypt/ltc/TpmToLtcDesSupport.c | 75 - .../TPMCmd/tpm/src/crypt/ltc/TpmToLtcMath.c | 286 - .../tpm/src/crypt/ltc/TpmToLtcSupport.c | 96 - .../tpm/src/crypt/ossl/TpmToOsslDesSupport.c | 100 - .../TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c | 638 -- .../tpm/src/crypt/ossl/TpmToOsslSupport.c | 112 - .../tpm/src/crypt/wolf/TpmToWolfDesSupport.c | 117 - .../TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c | 521 - .../tpm/src/crypt/wolf/TpmToWolfSupport.c | 60 - .../TPMCmd/tpm/src/crypt/wolf/wolfssl.vcxproj | 194 - .../TPMCmd/tpm/src/events/_TPM_Hash_Data.c | 70 - .../TPMCmd/tpm/src/events/_TPM_Hash_End.c | 102 - .../TPMCmd/tpm/src/events/_TPM_Hash_Start.c | 92 - .../TPMCmd/tpm/src/events/_TPM_Init.c | 90 - .../TPMCmd/tpm/src/main/CommandDispatcher.c | 430 - .../TPMCmd/tpm/src/main/ExecCommand.c | 317 - .../TPMCmd/tpm/src/main/SessionProcess.c | 2242 ---- .../TPMCmd/tpm/src/subsystem/CommandAudit.c | 268 - .../TPMCmd/tpm/src/subsystem/DA.c | 235 - .../TPMCmd/tpm/src/subsystem/Hierarchy.c | 237 - .../TPMCmd/tpm/src/subsystem/NvDynamic.c | 1932 ---- .../TPMCmd/tpm/src/subsystem/NvReserved.c | 263 - .../TPMCmd/tpm/src/subsystem/Object.c | 989 -- .../TPMCmd/tpm/src/subsystem/PCR.c | 1314 --- .../TPMCmd/tpm/src/subsystem/PP.c | 179 - .../TPMCmd/tpm/src/subsystem/Session.c | 1068 -- .../TPMCmd/tpm/src/subsystem/Time.c | 276 - .../TPMCmd/tpm/src/support/AlgorithmCap.c | 234 - .../TPMCmd/tpm/src/support/Bits.c | 92 - .../tpm/src/support/CommandCodeAttributes.c | 553 - .../TPMCmd/tpm/src/support/Entity.c | 478 - .../TPMCmd/tpm/src/support/Global.c | 59 - .../TPMCmd/tpm/src/support/Handle.c | 195 - .../TPMCmd/tpm/src/support/IoBuffers.c | 125 - .../TPMCmd/tpm/src/support/Locality.c | 75 - .../TPMCmd/tpm/src/support/Manufacture.c | 177 - .../TPMCmd/tpm/src/support/Marshal.c | 5811 ----------- .../tpm/src/support/MathOnByteBuffers.c | 265 - .../TPMCmd/tpm/src/support/Memory.c | 269 - .../TPMCmd/tpm/src/support/Power.c | 82 - .../TPMCmd/tpm/src/support/PropertyCap.c | 597 -- .../TPMCmd/tpm/src/support/Response.c | 81 - .../tpm/src/support/ResponseCodeProcessing.c | 57 - .../TPMCmd/tpm/src/support/TpmFail.c | 454 - .../TPMCmd/tpm/src/support/TpmSizeChecks.c | 171 - .../go-tpm-tools/simulator/simulator_test.go | 119 - .../github.com/google/pprof/profile/encode.go | 8 + .../pprof/profile/legacy_java_profile.go | 4 +- .../github.com/google/pprof/profile/merge.go | 9 +- .../google/pprof/profile/profile.go | 23 +- .../grpc-gateway/v2/{LICENSE.txt => LICENSE} | 0 .../v2/internal/httprule/BUILD.bazel | 2 +- .../grpc-gateway/v2/runtime/BUILD.bazel | 8 +- .../grpc-gateway/v2/runtime/context.go | 17 +- .../grpc-gateway/v2/runtime/errors.go | 14 +- .../grpc-gateway/v2/runtime/fieldmask.go | 6 +- .../grpc-gateway/v2/runtime/handler.go | 72 +- .../v2/runtime/marshal_httpbodyproto.go | 2 +- .../grpc-gateway/v2/runtime/marshal_json.go | 5 + .../grpc-gateway/v2/runtime/marshal_jsonpb.go | 15 +- .../v2/runtime/marshaler_registry.go | 2 +- .../grpc-gateway/v2/runtime/mux.go | 34 +- .../grpc-gateway/v2/runtime/pattern.go | 18 +- .../grpc-gateway/v2/runtime/query.go | 38 +- vendor/github.com/huandu/xstrings/.gitignore | 24 - .../huandu/xstrings/CONTRIBUTING.md | 23 - vendor/github.com/huandu/xstrings/LICENSE | 22 - vendor/github.com/huandu/xstrings/README.md | 117 - vendor/github.com/huandu/xstrings/common.go | 21 - vendor/github.com/huandu/xstrings/convert.go | 593 -- vendor/github.com/huandu/xstrings/count.go | 120 - vendor/github.com/huandu/xstrings/doc.go | 8 - vendor/github.com/huandu/xstrings/format.go | 173 - .../github.com/huandu/xstrings/manipulate.go | 220 - .../huandu/xstrings/stringbuilder.go | 8 - .../huandu/xstrings/stringbuilder_go110.go | 10 - .../github.com/huandu/xstrings/translate.go | 552 - .../golang_protobuf_extensions/v2/LICENSE | 201 - .../golang_protobuf_extensions/v2/NOTICE | 1 - .../v2/pbutil/.gitignore | 1 - .../v2/pbutil/Makefile | 7 - .../v2/pbutil/decode.go | 81 - .../v2/pbutil/doc.go | 16 - .../v2/pbutil/encode.go | 49 - vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md | 97 + .../github.com/onsi/ginkgo/v2/CONTRIBUTING.md | 10 +- vendor/github.com/onsi/ginkgo/v2/Makefile | 16 + .../onsi/ginkgo/v2/formatter/formatter.go | 4 + .../ginkgo/v2/ginkgo/build/build_command.go | 15 +- .../v2/ginkgo/generators/bootstrap_command.go | 2 +- .../v2/ginkgo/generators/generate_command.go | 3 +- .../onsi/ginkgo/v2/ginkgo/internal/compile.go | 14 +- .../ginkgo/internal/profiles_and_reports.go | 2 + .../ginkgo/v2/ginkgo/watch/package_hash.go | 9 + .../onsi/ginkgo/v2/internal/suite.go | 7 +- .../ginkgo/v2/reporters/default_reporter.go | 16 +- .../onsi/ginkgo/v2/reporters/junit_report.go | 2 + vendor/github.com/onsi/ginkgo/v2/table_dsl.go | 8 +- .../github.com/onsi/ginkgo/v2/types/config.go | 25 +- .../github.com/onsi/ginkgo/v2/types/flags.go | 15 +- .../onsi/ginkgo/v2/types/label_filter.go | 229 +- .../github.com/onsi/ginkgo/v2/types/types.go | 10 +- .../onsi/ginkgo/v2/types/version.go | 2 +- vendor/github.com/onsi/gomega/CHANGELOG.md | 69 + vendor/github.com/onsi/gomega/gomega_dsl.go | 30 +- .../onsi/gomega/internal/async_assertion.go | 12 +- .../onsi/gomega/internal/duration_bundle.go | 17 +- .../github.com/onsi/gomega/internal/gomega.go | 8 + .../gomega/internal/polling_signal_error.go | 11 + vendor/github.com/onsi/gomega/matchers.go | 15 +- .../gomega/matchers/have_exact_elements.go | 7 +- .../onsi/gomega/matchers/have_field.go | 36 +- .../onsi/gomega/matchers/receive_matcher.go | 70 +- .../bipartitegraph/bipartitegraphmatching.go | 7 + vendor/github.com/onsi/gomega/types/types.go | 2 + .../prometheus/client_model/go/metrics.pb.go | 195 +- .../prometheus/common/expfmt/decode.go | 31 +- .../prometheus/common/expfmt/encode.go | 87 +- .../prometheus/common/expfmt/expfmt.go | 154 +- .../common/expfmt/openmetrics_create.go | 283 +- .../prometheus/common/expfmt/text_create.go | 118 +- .../prometheus/common/expfmt/text_parse.go | 8 +- .../bitbucket.org/ww/goautoneg/README.txt | 67 - .../bitbucket.org/ww/goautoneg/autoneg.go | 160 - .../prometheus/common/model/alert.go | 31 +- .../prometheus/common/model/labels.go | 22 +- .../prometheus/common/model/labelset.go | 11 - .../common/model/labelset_string.go | 45 + .../common/model/labelset_string_go120.go | 39 + .../prometheus/common/model/metadata.go | 28 + .../prometheus/common/model/metric.go | 369 +- .../prometheus/common/model/signature.go | 6 +- .../prometheus/common/model/silence.go | 2 +- .../prometheus/common/model/value.go | 16 +- .../prometheus/common/model/value_float.go | 14 +- .../prometheus/procfs/.golangci.yml | 7 + .../prometheus/procfs/MAINTAINERS.md | 3 +- .../prometheus/procfs/Makefile.common | 26 +- vendor/github.com/prometheus/procfs/arp.go | 6 +- .../github.com/prometheus/procfs/buddyinfo.go | 6 +- .../github.com/prometheus/procfs/cpuinfo.go | 4 +- vendor/github.com/prometheus/procfs/crypto.go | 6 +- .../github.com/prometheus/procfs/fscache.go | 4 +- vendor/github.com/prometheus/procfs/ipvs.go | 6 +- .../github.com/prometheus/procfs/loadavg.go | 2 +- vendor/github.com/prometheus/procfs/mdstat.go | 60 +- .../github.com/prometheus/procfs/meminfo.go | 220 +- .../github.com/prometheus/procfs/mountinfo.go | 2 +- .../prometheus/procfs/mountstats.go | 11 +- .../prometheus/procfs/net_conntrackstat.go | 4 +- .../prometheus/procfs/net_ip_socket.go | 46 +- .../prometheus/procfs/net_sockstat.go | 4 +- .../prometheus/procfs/net_softnet.go | 2 +- .../prometheus/procfs/net_tls_stat.go | 119 + .../github.com/prometheus/procfs/net_unix.go | 14 +- .../prometheus/procfs/net_wireless.go | 22 +- vendor/github.com/prometheus/procfs/proc.go | 8 +- .../prometheus/procfs/proc_limits.go | 2 +- .../github.com/prometheus/procfs/proc_ns.go | 4 +- .../github.com/prometheus/procfs/proc_psi.go | 2 +- .../prometheus/procfs/proc_smaps.go | 2 +- .../github.com/prometheus/procfs/proc_stat.go | 7 + .../prometheus/procfs/proc_status.go | 29 +- .../github.com/prometheus/procfs/proc_sys.go | 2 +- .../github.com/prometheus/procfs/softirqs.go | 22 +- vendor/github.com/prometheus/procfs/stat.go | 22 +- vendor/github.com/prometheus/procfs/swaps.go | 6 +- vendor/github.com/prometheus/procfs/thread.go | 2 +- .../github.com/prometheus/procfs/zoneinfo.go | 4 +- vendor/github.com/spf13/cobra/.golangci.yml | 21 +- vendor/github.com/spf13/cobra/active_help.go | 13 +- vendor/github.com/spf13/cobra/args.go | 4 +- .../spf13/cobra/bash_completions.go | 25 +- vendor/github.com/spf13/cobra/cobra.go | 2 - vendor/github.com/spf13/cobra/command.go | 51 +- vendor/github.com/spf13/cobra/completions.go | 62 +- vendor/github.com/spf13/cobra/flag_groups.go | 34 +- .../spf13/cobra/powershell_completions.go | 4 +- .../net/http/otelhttp/client.go | 15 +- .../net/http/otelhttp/common.go | 27 +- .../net/http/otelhttp/config.go | 15 +- .../instrumentation/net/http/otelhttp/doc.go | 13 +- .../net/http/otelhttp/handler.go | 113 +- .../net/http/otelhttp/internal/semconv/env.go | 82 + .../http/otelhttp/internal/semconv/util.go | 91 + .../http/otelhttp/internal/semconv/v1.20.0.go | 74 + .../http/otelhttp/internal/semconv/v1.24.0.go | 197 + .../http/otelhttp/internal/semconvutil/gen.go | 13 +- .../otelhttp/internal/semconvutil/httpconv.go | 309 +- .../otelhttp/internal/semconvutil/netconv.go | 191 +- .../net/http/otelhttp/labeler.go | 21 +- .../net/http/otelhttp/transport.go | 124 +- .../net/http/otelhttp/version.go | 15 +- .../instrumentation/net/http/otelhttp/wrap.go | 28 +- .../go.opentelemetry.io/otel/.codespellignore | 4 + vendor/go.opentelemetry.io/otel/.codespellrc | 2 +- vendor/go.opentelemetry.io/otel/.gitignore | 4 - vendor/go.opentelemetry.io/otel/.gitmodules | 3 - vendor/go.opentelemetry.io/otel/.golangci.yml | 6 + vendor/go.opentelemetry.io/otel/CHANGELOG.md | 310 +- vendor/go.opentelemetry.io/otel/CODEOWNERS | 4 +- .../go.opentelemetry.io/otel/CONTRIBUTING.md | 48 +- vendor/go.opentelemetry.io/otel/Makefile | 87 +- vendor/go.opentelemetry.io/otel/README.md | 41 +- vendor/go.opentelemetry.io/otel/RELEASING.md | 12 +- .../otel/attribute/README.md | 3 + .../go.opentelemetry.io/otel/attribute/doc.go | 13 +- .../otel/attribute/encoder.go | 13 +- .../otel/attribute/filter.go | 13 +- .../otel/attribute/iterator.go | 13 +- .../go.opentelemetry.io/otel/attribute/key.go | 13 +- .../go.opentelemetry.io/otel/attribute/kv.go | 13 +- .../go.opentelemetry.io/otel/attribute/set.go | 222 +- .../otel/attribute/value.go | 31 +- .../otel/baggage/README.md | 3 + .../otel/baggage/baggage.go | 522 +- .../otel/baggage/context.go | 13 +- .../go.opentelemetry.io/otel/baggage/doc.go | 13 +- .../go.opentelemetry.io/otel/codes/README.md | 3 + .../go.opentelemetry.io/otel/codes/codes.go | 13 +- vendor/go.opentelemetry.io/otel/codes/doc.go | 13 +- vendor/go.opentelemetry.io/otel/doc.go | 15 +- .../go.opentelemetry.io/otel/error_handler.go | 13 +- .../otel/exporters/otlp/otlptrace/README.md | 3 + .../otel/exporters/otlp/otlptrace/clients.go | 13 +- .../otel/exporters/otlp/otlptrace/doc.go | 13 +- .../otel/exporters/otlp/otlptrace/exporter.go | 15 +- .../internal/tracetransform/attribute.go | 13 +- .../tracetransform/instrumentation.go | 13 +- .../internal/tracetransform/resource.go | 13 +- .../otlptrace/internal/tracetransform/span.go | 26 +- .../otlp/otlptrace/otlptracegrpc/README.md | 3 + .../otlp/otlptrace/otlptracegrpc/client.go | 17 +- .../otlp/otlptrace/otlptracegrpc/doc.go | 21 +- .../otlp/otlptrace/otlptracegrpc/exporter.go | 13 +- .../internal/envconfig/envconfig.go | 13 +- .../otlptrace/otlptracegrpc/internal/gen.go | 13 +- .../internal/otlpconfig/envconfig.go | 13 +- .../internal/otlpconfig/options.go | 52 +- .../internal/otlpconfig/optiontypes.go | 13 +- .../otlptracegrpc/internal/otlpconfig/tls.go | 13 +- .../otlptracegrpc/internal/partialsuccess.go | 13 +- .../otlptracegrpc/internal/retry/retry.go | 13 +- .../otlp/otlptrace/otlptracegrpc/options.go | 53 +- .../otel/exporters/otlp/otlptrace/version.go | 15 +- .../go.opentelemetry.io/otel/get_main_pkgs.sh | 13 +- vendor/go.opentelemetry.io/otel/handler.go | 25 +- .../otel/internal/attribute/attribute.go | 37 +- .../otel/internal/baggage/baggage.go | 13 +- .../otel/internal/baggage/context.go | 13 +- .../go.opentelemetry.io/otel/internal/gen.go | 13 +- .../otel/internal/global/handler.go | 84 +- .../otel/internal/global/instruments.go | 65 +- .../otel/internal/global/internal_logging.go | 39 +- .../otel/internal/global/meter.go | 40 +- .../otel/internal/global/propagator.go | 13 +- .../otel/internal/global/state.go | 73 +- .../otel/internal/global/trace.go | 22 +- .../otel/internal/rawhelpers.go | 13 +- .../otel/internal_logging.go | 13 +- vendor/go.opentelemetry.io/otel/metric.go | 13 +- .../go.opentelemetry.io/otel/metric/README.md | 3 + .../otel/metric/asyncfloat64.go | 19 +- .../otel/metric/asyncint64.go | 13 +- .../go.opentelemetry.io/otel/metric/config.go | 13 +- vendor/go.opentelemetry.io/otel/metric/doc.go | 31 +- .../otel/metric/embedded/README.md | 3 + .../otel/metric/embedded/embedded.go | 33 +- .../otel/metric/instrument.go | 35 +- .../go.opentelemetry.io/otel/metric/meter.go | 77 +- .../otel/metric/syncfloat64.go | 73 +- .../otel/metric/syncint64.go | 67 +- .../go.opentelemetry.io/otel/propagation.go | 13 +- .../otel/propagation/README.md | 3 + .../otel/propagation/baggage.go | 13 +- .../otel/propagation/doc.go | 13 +- .../otel/propagation/propagation.go | 13 +- .../otel/propagation/trace_context.go | 109 +- vendor/go.opentelemetry.io/otel/renovate.json | 24 + .../go.opentelemetry.io/otel/requirements.txt | 2 +- vendor/go.opentelemetry.io/otel/sdk/README.md | 3 + .../otel/sdk/instrumentation/README.md | 3 + .../otel/sdk/instrumentation/doc.go | 13 +- .../otel/sdk/instrumentation/library.go | 13 +- .../otel/sdk/instrumentation/scope.go | 13 +- .../otel/sdk/internal/env/env.go | 15 +- .../otel/sdk/internal/gen.go | 29 - .../otel/sdk/internal/internal.go | 28 - .../otel/sdk/internal/x/README.md | 46 + .../otel/sdk/internal/x/x.go | 66 + .../otel/sdk/resource/README.md | 3 + .../otel/sdk/resource/auto.go | 38 +- .../otel/sdk/resource/builtin.go | 36 +- .../otel/sdk/resource/config.go | 13 +- .../otel/sdk/resource/container.go | 17 +- .../otel/sdk/resource/doc.go | 13 +- .../otel/sdk/resource/env.go | 15 +- .../otel/sdk/resource/host_id.go | 15 +- .../otel/sdk/resource/host_id_bsd.go | 13 +- .../otel/sdk/resource/host_id_darwin.go | 13 +- .../otel/sdk/resource/host_id_exec.go | 13 +- .../otel/sdk/resource/host_id_linux.go | 13 +- .../otel/sdk/resource/host_id_readfile.go | 13 +- .../otel/sdk/resource/host_id_unsupported.go | 23 +- .../otel/sdk/resource/host_id_windows.go | 13 +- .../otel/sdk/resource/os.go | 15 +- .../otel/sdk/resource/os_release_darwin.go | 13 +- .../otel/sdk/resource/os_release_unix.go | 13 +- .../otel/sdk/resource/os_unix.go | 13 +- .../otel/sdk/resource/os_unsupported.go | 25 +- .../otel/sdk/resource/os_windows.go | 13 +- .../otel/sdk/resource/process.go | 15 +- .../otel/sdk/resource/resource.go | 103 +- .../otel/sdk/trace/README.md | 3 + .../otel/sdk/trace/batch_span_processor.go | 17 +- .../go.opentelemetry.io/otel/sdk/trace/doc.go | 13 +- .../otel/sdk/trace/event.go | 13 +- .../otel/sdk/trace/evictedqueue.go | 49 +- .../otel/sdk/trace/id_generator.go | 34 +- .../otel/sdk/trace/link.go | 13 +- .../otel/sdk/trace/provider.go | 17 +- .../otel/sdk/trace/sampler_env.go | 13 +- .../otel/sdk/trace/sampling.go | 13 +- .../otel/sdk/trace/simple_span_processor.go | 50 +- .../otel/sdk/trace/snapshot.go | 13 +- .../otel/sdk/trace/span.go | 97 +- .../otel/sdk/trace/span_exporter.go | 13 +- .../otel/sdk/trace/span_limits.go | 13 +- .../otel/sdk/trace/span_processor.go | 13 +- .../otel/sdk/trace/tracer.go | 19 +- .../otel/sdk/trace/version.go | 13 +- .../go.opentelemetry.io/otel/sdk/version.go | 15 +- .../otel/semconv/v1.17.0/README.md | 3 + .../otel/semconv/v1.17.0/doc.go | 13 +- .../otel/semconv/v1.17.0/event.go | 13 +- .../otel/semconv/v1.17.0/exception.go | 13 +- .../otel/semconv/v1.17.0/http.go | 13 +- .../otel/semconv/v1.17.0/resource.go | 13 +- .../otel/semconv/v1.17.0/schema.go | 13 +- .../otel/semconv/v1.17.0/trace.go | 13 +- .../otel/semconv/v1.20.0/README.md | 3 + .../otel/semconv/v1.20.0/attribute_group.go | 1198 +++ .../otel/semconv/v1.20.0/doc.go | 9 + .../semconv/{v1.21.0 => v1.20.0}/event.go | 15 +- .../otel/semconv/v1.20.0/exception.go | 9 + .../otel/semconv/v1.20.0/http.go | 10 + .../semconv/{v1.21.0 => v1.20.0}/resource.go | 314 +- .../otel/semconv/v1.20.0/schema.go | 9 + .../semconv/{v1.21.0 => v1.20.0}/trace.go | 176 +- .../otel/semconv/v1.21.0/attribute_group.go | 1877 ---- .../otel/semconv/v1.21.0/doc.go | 20 - .../otel/semconv/v1.21.0/exception.go | 20 - .../otel/semconv/v1.21.0/schema.go | 20 - .../otel/semconv/v1.24.0/README.md | 3 + .../otel/semconv/v1.24.0/attribute_group.go | 4387 ++++++++ .../otel/semconv/v1.24.0/doc.go | 9 + .../otel/semconv/v1.24.0/event.go | 200 + .../otel/semconv/v1.24.0/exception.go | 9 + .../otel/semconv/v1.24.0/metric.go | 1071 ++ .../otel/semconv/v1.24.0/resource.go | 2545 +++++ .../otel/semconv/v1.24.0/schema.go | 9 + .../otel/semconv/v1.24.0/trace.go | 1323 +++ .../otel/semconv/v1.26.0/README.md | 3 + .../otel/semconv/v1.26.0/attribute_group.go | 8996 +++++++++++++++++ .../otel/semconv/v1.26.0/doc.go | 9 + .../otel/semconv/v1.26.0/exception.go | 9 + .../otel/semconv/v1.26.0/metric.go | 1307 +++ .../otel/semconv/v1.26.0/schema.go | 9 + vendor/go.opentelemetry.io/otel/trace.go | 13 +- .../go.opentelemetry.io/otel/trace/README.md | 3 + .../go.opentelemetry.io/otel/trace/config.go | 13 +- .../go.opentelemetry.io/otel/trace/context.go | 17 +- vendor/go.opentelemetry.io/otel/trace/doc.go | 13 +- .../otel/trace/embedded/README.md | 3 + .../otel/trace/embedded/embedded.go | 13 +- .../otel/trace/nonrecording.go | 13 +- vendor/go.opentelemetry.io/otel/trace/noop.go | 20 +- .../otel/trace/noop/README.md | 3 + .../otel/trace/noop/noop.go | 20 +- .../go.opentelemetry.io/otel/trace/trace.go | 19 +- .../otel/trace/tracestate.go | 210 +- .../otel/verify_examples.sh | 13 +- .../otel/verify_readmes.sh | 21 + vendor/go.opentelemetry.io/otel/version.go | 15 +- vendor/go.opentelemetry.io/otel/versions.yaml | 42 +- .../proto/otlp/trace/v1/trace.pb.go | 397 +- vendor/go.uber.org/zap/.golangci.yml | 2 +- vendor/go.uber.org/zap/.readme.tmpl | 10 +- vendor/go.uber.org/zap/CHANGELOG.md | 54 +- .../go.uber.org/zap/{LICENSE.txt => LICENSE} | 0 vendor/go.uber.org/zap/README.md | 66 +- vendor/go.uber.org/zap/buffer/buffer.go | 2 +- vendor/go.uber.org/zap/field.go | 2 + vendor/go.uber.org/zap/logger.go | 39 +- vendor/go.uber.org/zap/options.go | 15 + vendor/go.uber.org/zap/sugar.go | 39 + .../zap/zapcore/console_encoder.go | 2 +- vendor/go.uber.org/zap/zapcore/encoder.go | 15 + vendor/go.uber.org/zap/zapcore/field.go | 2 +- .../go.uber.org/zap/zapcore/json_encoder.go | 2 +- vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go | 77 - vendor/golang.org/x/crypto/scrypt/scrypt.go | 212 - vendor/golang.org/x/exp/LICENSE | 4 +- vendor/golang.org/x/exp/slices/slices.go | 44 +- vendor/golang.org/x/exp/slices/sort.go | 4 +- vendor/golang.org/x/exp/slog/handler.go | 18 + vendor/golang.org/x/oauth2/LICENSE | 4 +- .../x/oauth2/internal/client_appengine.go | 13 - .../golang.org/x/oauth2/internal/transport.go | 5 - vendor/golang.org/x/oauth2/oauth2.go | 2 +- vendor/golang.org/x/oauth2/token.go | 7 + vendor/golang.org/x/time/LICENSE | 4 +- vendor/golang.org/x/time/rate/rate.go | 17 +- vendor/golang.org/x/tools/LICENSE | 4 +- .../x/tools/go/ast/inspector/inspector.go | 9 + .../x/tools/go/ast/inspector/iter.go | 85 + vendor/google.golang.org/appengine/LICENSE | 202 - .../appengine/internal/api.go | 653 -- .../appengine/internal/api_classic.go | 170 - .../appengine/internal/api_common.go | 141 - .../appengine/internal/app_id.go | 28 - .../appengine/internal/base/api_base.pb.go | 308 - .../appengine/internal/base/api_base.proto | 33 - .../internal/datastore/datastore_v3.pb.go | 4367 -------- .../internal/datastore/datastore_v3.proto | 551 - .../appengine/internal/identity.go | 54 - .../appengine/internal/identity_classic.go | 62 - .../appengine/internal/identity_flex.go | 12 - .../appengine/internal/identity_vm.go | 134 - .../appengine/internal/internal.go | 110 - .../appengine/internal/log/log_service.pb.go | 1313 --- .../appengine/internal/log/log_service.proto | 150 - .../appengine/internal/main.go | 17 - .../appengine/internal/main_common.go | 7 - .../appengine/internal/main_vm.go | 70 - .../appengine/internal/metadata.go | 60 - .../appengine/internal/net.go | 56 - .../appengine/internal/regen.sh | 40 - .../internal/remote_api/remote_api.pb.go | 361 - .../internal/remote_api/remote_api.proto | 44 - .../appengine/internal/transaction.go | 115 - .../internal/urlfetch/urlfetch_service.pb.go | 527 - .../internal/urlfetch/urlfetch_service.proto | 64 - .../appengine/urlfetch/urlfetch.go | 209 - .../googleapis/api/httpbody/httpbody.pb.go | 4 +- .../rpc/errdetails/error_details.pb.go | 4 +- .../googleapis/rpc/status/status.pb.go | 4 +- vendor/google.golang.org/grpc/CONTRIBUTING.md | 2 +- vendor/google.golang.org/grpc/MAINTAINERS.md | 1 + vendor/google.golang.org/grpc/Makefile | 7 +- vendor/google.golang.org/grpc/README.md | 2 +- .../grpc/balancer/balancer.go | 9 +- .../{ => balancer/pickfirst}/pickfirst.go | 98 +- .../grpc/balancer/roundrobin/roundrobin.go | 4 +- .../grpc/balancer_conn_wrappers.go | 454 - .../grpc/balancer_wrapper.go | 341 + .../grpc_binarylog_v1/binarylog.pb.go | 6 +- vendor/google.golang.org/grpc/clientconn.go | 785 +- vendor/google.golang.org/grpc/codegen.sh | 17 - vendor/google.golang.org/grpc/codes/codes.go | 10 +- .../grpc/credentials/credentials.go | 4 +- .../google.golang.org/grpc/credentials/tls.go | 109 +- vendor/google.golang.org/grpc/dialoptions.go | 150 +- .../grpc/encoding/proto/proto.go | 24 +- .../grpc/health/grpc_health_v1/health.pb.go | 4 +- .../health/grpc_health_v1/health_grpc.pb.go | 26 +- .../grpc/internal/backoff/backoff.go | 4 +- .../balancer/gracefulswitch/config.go | 82 + .../balancer/gracefulswitch/gracefulswitch.go | 44 +- .../grpc/internal/binarylog/method_logger.go | 15 +- .../grpc/internal/binarylog/sink.go | 2 +- .../grpc/internal/buffer/unbounded.go | 41 +- .../grpc/internal/channelz/channel.go | 255 + .../grpc/internal/channelz/channelmap.go | 402 + .../grpc/internal/channelz/funcs.go | 702 +- .../grpc/internal/channelz/id.go | 75 - .../grpc/internal/channelz/logging.go | 28 +- .../grpc/internal/channelz/server.go | 119 + .../grpc/internal/channelz/socket.go | 130 + .../grpc/internal/channelz/subchannel.go | 151 + .../{types_linux.go => syscall_linux.go} | 14 + ...{types_nonlinux.go => syscall_nonlinux.go} | 6 +- .../grpc/internal/channelz/trace.go | 204 + .../grpc/internal/channelz/types.go | 727 -- .../grpc/internal/envconfig/envconfig.go | 12 +- .../grpc/internal/envconfig/xds.go | 39 - .../grpc/internal/experimental.go | 28 + .../grpc/internal/grpcrand/grpcrand.go | 95 - .../internal/grpcsync/callback_serializer.go | 51 +- .../grpc/internal/grpcutil/compressor.go | 5 - .../grpc/internal/idle/idle.go | 175 +- .../grpc/internal/internal.go | 46 +- .../grpc/internal/pretty/pretty.go | 35 +- .../internal/resolver/dns/dns_resolver.go | 116 +- .../resolver/dns/internal/internal.go | 77 + .../grpc/internal/resolver/unix/unix.go | 4 + .../grpc/internal/status/status.go | 15 +- ...il_nonlinux.go => tcp_keepalive_others.go} | 18 +- .../grpc/internal/tcp_keepalive_unix.go | 54 + .../grpc/internal/tcp_keepalive_windows.go | 54 + .../grpc/internal/transport/controlbuf.go | 38 +- .../grpc/internal/transport/handler_server.go | 82 +- .../grpc/internal/transport/http2_client.go | 170 +- .../grpc/internal/transport/http2_server.go | 232 +- .../grpc/internal/transport/http_util.go | 3 +- .../grpc/internal/transport/proxy.go | 14 +- .../grpc/internal/transport/transport.go | 63 +- .../grpc/internal/xds_handshake_cluster.go | 40 - .../grpc/metadata/metadata.go | 31 +- vendor/google.golang.org/grpc/peer/peer.go | 32 + .../google.golang.org/grpc/picker_wrapper.go | 103 +- vendor/google.golang.org/grpc/regenerate.sh | 6 +- .../grpc/resolver/dns/dns_resolver.go | 60 + vendor/google.golang.org/grpc/resolver/map.go | 113 + .../grpc/resolver/resolver.go | 30 +- .../grpc/resolver_conn_wrapper.go | 247 - .../grpc/resolver_wrapper.go | 198 + vendor/google.golang.org/grpc/rpc_util.go | 93 +- vendor/google.golang.org/grpc/server.go | 393 +- .../google.golang.org/grpc/service_config.go | 69 +- vendor/google.golang.org/grpc/stats/stats.go | 10 +- vendor/google.golang.org/grpc/stream.go | 18 +- .../grpc/stream_interfaces.go | 152 + vendor/google.golang.org/grpc/trace.go | 26 +- .../google.golang.org/grpc/trace_notrace.go | 52 + .../util_linux.go => trace_withtrace.go} | 32 +- vendor/google.golang.org/grpc/version.go | 2 +- vendor/google.golang.org/grpc/vet.sh | 212 - .../encoding/protodelim/protodelim.go | 160 + .../protobuf/encoding/protojson/decode.go | 6 +- .../protobuf/encoding/protojson/encode.go | 24 +- .../protobuf/encoding/prototext/decode.go | 4 +- .../protobuf/encoding/prototext/encode.go | 20 +- .../protobuf/internal/descfmt/stringer.go | 1 + .../protobuf/internal/descopts/options.go | 20 +- .../editiondefaults/editions_defaults.binpb | Bin 63 -> 93 bytes .../internal/editionssupport/editions.go | 13 + .../protobuf/internal/encoding/json/decode.go | 2 +- .../protobuf/internal/encoding/tag/tag.go | 4 +- .../protobuf/internal/encoding/text/decode.go | 2 +- .../protobuf/internal/errors/errors.go | 21 +- .../protobuf/internal/filedesc/desc.go | 92 +- .../protobuf/internal/filedesc/desc_init.go | 45 +- .../protobuf/internal/filedesc/desc_lazy.go | 51 +- .../internal/filedesc/desc_list_gen.go | 11 + .../protobuf/internal/filedesc/editions.go | 24 +- .../protobuf/internal/filedesc/placeholder.go | 1 + .../protobuf/internal/filetype/build.go | 4 +- .../protobuf/internal/genid/descriptor_gen.go | 49 +- .../protobuf/internal/genid/doc.go | 2 +- .../internal/genid/go_features_gen.go | 17 +- .../protobuf/internal/genid/map_entry.go | 2 +- .../protobuf/internal/genid/wrappers.go | 2 +- .../protobuf/internal/impl/api_export.go | 6 +- .../protobuf/internal/impl/checkinit.go | 2 +- .../protobuf/internal/impl/codec_extension.go | 33 +- .../protobuf/internal/impl/codec_field.go | 67 +- .../protobuf/internal/impl/codec_map.go | 15 +- .../protobuf/internal/impl/codec_message.go | 3 + .../internal/impl/codec_messageset.go | 22 + .../protobuf/internal/impl/codec_reflect.go | 210 - .../protobuf/internal/impl/codec_unsafe.go | 3 - .../protobuf/internal/impl/convert.go | 4 +- .../protobuf/internal/impl/convert_list.go | 2 +- .../protobuf/internal/impl/convert_map.go | 2 +- .../protobuf/internal/impl/encode.go | 50 +- .../protobuf/internal/impl/equal.go | 224 + .../protobuf/internal/impl/extension.go | 8 +- .../protobuf/internal/impl/legacy_enum.go | 3 +- .../internal/impl/legacy_extension.go | 3 +- .../protobuf/internal/impl/legacy_file.go | 4 +- .../protobuf/internal/impl/legacy_message.go | 14 +- .../protobuf/internal/impl/message.go | 12 +- .../protobuf/internal/impl/message_reflect.go | 45 +- .../internal/impl/message_reflect_gen.go | 146 +- .../protobuf/internal/impl/pointer_reflect.go | 215 - .../protobuf/internal/impl/pointer_unsafe.go | 7 +- .../protobuf/internal/order/range.go | 4 +- .../protobuf/internal/strs/strings_pure.go | 28 - .../internal/strs/strings_unsafe_go120.go | 3 +- .../internal/strs/strings_unsafe_go121.go | 3 +- .../protobuf/internal/version/version.go | 4 +- .../protobuf/proto/decode.go | 2 + .../protobuf/proto/encode.go | 44 +- .../google.golang.org/protobuf/proto/equal.go | 9 + .../protobuf/proto/extension.go | 88 +- .../protobuf/proto/messageset.go | 7 +- .../google.golang.org/protobuf/proto/size.go | 2 + .../protobuf/protoadapt/convert.go | 31 + .../protobuf/reflect/protodesc/desc.go | 13 +- .../protobuf/reflect/protodesc/desc_init.go | 53 +- .../reflect/protodesc/desc_resolve.go | 5 + .../reflect/protodesc/desc_validate.go | 73 +- .../protobuf/reflect/protodesc/editions.go | 13 +- .../protobuf/reflect/protodesc/proto.go | 22 + .../protobuf/reflect/protoreflect/methods.go | 10 + .../protobuf/reflect/protoreflect/proto.go | 2 +- .../reflect/protoreflect/source_gen.go | 21 + .../protobuf/reflect/protoreflect/type.go | 12 +- .../reflect/protoreflect/value_pure.go | 60 - .../reflect/protoreflect/value_union.go | 14 +- .../protoreflect/value_unsafe_go120.go | 9 +- .../protoreflect/value_unsafe_go121.go | 11 +- .../reflect/protoregistry/registry.go | 14 +- .../protobuf/runtime/protoiface/methods.go | 18 + .../types/descriptorpb/descriptor.pb.go | 1781 ++-- .../types/gofeaturespb/go_features.pb.go | 142 +- .../types/gofeaturespb/go_features.proto | 28 - .../protobuf/types/known/anypb/any.pb.go | 26 +- .../types/known/durationpb/duration.pb.go | 26 +- .../types/known/fieldmaskpb/field_mask.pb.go | 26 +- .../types/known/structpb/struct.pb.go | 150 +- .../types/known/timestamppb/timestamp.pb.go | 26 +- .../types/known/wrapperspb/wrappers.pb.go | 202 +- vendor/k8s.io/klog/v2/OWNERS | 4 +- vendor/k8s.io/klog/v2/contextual_slog.go | 31 + vendor/k8s.io/klog/v2/klog.go | 99 +- vendor/k8s.io/klog/v2/klogr_slog.go | 10 +- vendor/k8s.io/klog/v2/safeptr.go | 34 + vendor/k8s.io/klog/v2/textlogger/options.go | 21 + .../k8s.io/klog/v2/textlogger/textlogger.go | 28 +- .../klog/v2/textlogger/textlogger_slog.go | 8 +- .../k8s.io/kube-openapi/pkg/common/common.go | 3 + .../k8s.io/kube-openapi/pkg/schemaconv/smd.go | 3 - .../kube-openapi/pkg/util/proto/document.go | 2 +- vendor/k8s.io/utils/integer/integer.go | 26 +- vendor/k8s.io/utils/lru/lru.go | 10 + vendor/k8s.io/utils/net/multi_listen.go | 195 + vendor/k8s.io/utils/trace/trace.go | 2 +- vendor/modules.txt | 175 +- .../proto/client/client.pb.go | 147 +- .../proto/client/client.proto | 7 + .../proto/client/client_grpc.pb.go | 2 +- vendor/sigs.k8s.io/json/Makefile | 2 +- vendor/sigs.k8s.io/json/OWNERS | 2 +- .../internal/golang/encoding/json/decode.go | 140 +- .../internal/golang/encoding/json/encode.go | 490 +- .../internal/golang/encoding/json/fold.go | 150 +- .../internal/golang/encoding/json/indent.go | 119 +- .../internal/golang/encoding/json/scanner.go | 4 +- .../internal/golang/encoding/json/stream.go | 41 +- .../structured-merge-diff/v4/fieldpath/set.go | 277 + .../structured-merge-diff/v4/merge/update.go | 34 +- .../structured-merge-diff/v4/typed/compare.go | 10 + .../structured-merge-diff/v4/typed/parser.go | 2 +- .../v4/value/reflectcache.go | 63 +- .../structured-merge-diff/v4/value/value.go | 2 +- 1349 files changed, 37969 insertions(+), 152426 deletions(-) delete mode 100644 vendor/github.com/Masterminds/goutils/.travis.yml delete mode 100644 vendor/github.com/Masterminds/goutils/CHANGELOG.md delete mode 100644 vendor/github.com/Masterminds/goutils/LICENSE.txt delete mode 100644 vendor/github.com/Masterminds/goutils/README.md delete mode 100644 vendor/github.com/Masterminds/goutils/appveyor.yml delete mode 100644 vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go delete mode 100644 vendor/github.com/Masterminds/goutils/randomstringutils.go delete mode 100644 vendor/github.com/Masterminds/goutils/stringutils.go delete mode 100644 vendor/github.com/Masterminds/goutils/wordutils.go delete mode 100644 vendor/github.com/Masterminds/semver/.travis.yml delete mode 100644 vendor/github.com/Masterminds/semver/CHANGELOG.md delete mode 100644 vendor/github.com/Masterminds/semver/LICENSE.txt delete mode 100644 vendor/github.com/Masterminds/semver/Makefile delete mode 100644 vendor/github.com/Masterminds/semver/README.md delete mode 100644 vendor/github.com/Masterminds/semver/appveyor.yml delete mode 100644 vendor/github.com/Masterminds/semver/collection.go delete mode 100644 vendor/github.com/Masterminds/semver/constraints.go delete mode 100644 vendor/github.com/Masterminds/semver/doc.go delete mode 100644 vendor/github.com/Masterminds/semver/version.go delete mode 100644 vendor/github.com/Masterminds/semver/version_fuzz.go create mode 100644 vendor/github.com/go-openapi/jsonpointer/.golangci.yml create mode 100644 vendor/github.com/go-openapi/swag/BENCHMARK.md create mode 100644 vendor/github.com/go-openapi/swag/initialism_index.go delete mode 100644 vendor/github.com/go-openapi/swag/post_go18.go delete mode 100644 vendor/github.com/go-openapi/swag/post_go19.go delete mode 100644 vendor/github.com/go-openapi/swag/pre_go18.go delete mode 100644 vendor/github.com/go-openapi/swag/pre_go19.go create mode 100644 vendor/github.com/go-openapi/swag/string_bytes.go delete mode 100644 vendor/github.com/go-task/slim-sprig/.travis.yml delete mode 100644 vendor/github.com/go-task/slim-sprig/Makefile delete mode 100644 vendor/github.com/go-task/slim-sprig/appveyor.yml delete mode 100644 vendor/github.com/go-task/slim-sprig/crypto.go delete mode 100644 vendor/github.com/go-task/slim-sprig/glide.lock delete mode 100644 vendor/github.com/go-task/slim-sprig/glide.yaml delete mode 100644 vendor/github.com/go-task/slim-sprig/regex.go delete mode 100644 vendor/github.com/go-task/slim-sprig/semver.go create mode 100644 vendor/github.com/go-task/slim-sprig/v3/.editorconfig create mode 100644 vendor/github.com/go-task/slim-sprig/v3/.gitattributes rename vendor/github.com/go-task/slim-sprig/{ => v3}/.gitignore (100%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/CHANGELOG.md (67%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/LICENSE.txt (96%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/README.md (62%) create mode 100644 vendor/github.com/go-task/slim-sprig/v3/Taskfile.yml create mode 100644 vendor/github.com/go-task/slim-sprig/v3/crypto.go rename vendor/github.com/go-task/slim-sprig/{ => v3}/date.go (52%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/defaults.go (53%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/dict.go (69%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/doc.go (92%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/functions.go (51%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/list.go (54%) create mode 100644 vendor/github.com/go-task/slim-sprig/v3/network.go rename vendor/github.com/go-task/slim-sprig/{ => v3}/numeric.go (65%) rename vendor/github.com/go-task/slim-sprig/{ => v3}/reflect.go (100%) create mode 100644 vendor/github.com/go-task/slim-sprig/v3/regex.go rename vendor/github.com/go-task/slim-sprig/{ => v3}/strings.go (77%) create mode 100644 vendor/github.com/go-task/slim-sprig/v3/url.go delete mode 100644 vendor/github.com/golang/protobuf/jsonpb/decode.go delete mode 100644 vendor/github.com/golang/protobuf/jsonpb/encode.go delete mode 100644 vendor/github.com/golang/protobuf/jsonpb/json.go delete mode 100644 vendor/github.com/google/go-tpm-tools/.github/workflows/ci.yml delete mode 100644 vendor/github.com/google/go-tpm-tools/.github/workflows/releaser.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/.gitignore delete mode 100644 vendor/github.com/google/go-tpm-tools/.goreleaser.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/CONTRIBUTING.md delete mode 100644 vendor/github.com/google/go-tpm-tools/README.md delete mode 100644 vendor/github.com/google/go-tpm-tools/RELEASING.md delete mode 100644 vendor/github.com/google/go-tpm-tools/cel/canonical_eventlog.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cel/canonical_eventlog_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cel/cos_tlv.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cel/cos_tlv_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/attest.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/attest_network_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/attest_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/close.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/eventlog.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/eventlog_linux.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/eventlog_other.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/example_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/handles.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/handles_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/import.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/keys.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/keys_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/pcr.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/pcr_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/quote_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/seal_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/session.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/signer.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/signer_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/client/template.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cloudbuild.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/attest.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/attest_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/fake_metadata.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/flags.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/flush.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/flush_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/go.mod delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/go.sum delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/gotpm/main.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/open.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/open_other.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/open_windows.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/pubkey.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/read.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/root.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/seal.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/seal_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/verify.go delete mode 100644 vendor/github.com/google/go-tpm-tools/cmd/verify_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/files/PKGBUILD delete mode 100755 vendor/github.com/google/go-tpm-tools/files/boot-unseal.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/files/initcpio.hooks delete mode 100644 vendor/github.com/google/go-tpm-tools/files/initcpio.install delete mode 100644 vendor/github.com/google/go-tpm-tools/go.mod delete mode 100644 vendor/github.com/google/go-tpm-tools/go.sum delete mode 100644 vendor/github.com/google/go-tpm-tools/go.work delete mode 100644 vendor/github.com/google/go-tpm-tools/go.work.sum delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/pcrs.go delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/pcrs_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/public.go delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/quote.go delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/attestations/gce-cos-85-no-nonce.pb delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/attestations/gce-cos-85-nonce9009.pb delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/certificates/pca_tpm_ecc_enc_cert.pem delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/certificates/pca_tpm_ecc_sign_cert.pem delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/certificates/pca_tpm_rsa_enc_cert.pem delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/certificates/pca_tpm_rsa_sign_cert.pem delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/certificates/uca_tpm_ecc_enc_cert.pem delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/certificates/uca_tpm_ecc_sign_cert.pem delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/certificates/uca_tpm_rsa_enc_cert.pem delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/certificates/uca_tpm_rsa_sign_cert.pem delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/arch-linux-workstation.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/cos-101-amd-sev.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/cos-85-amd-sev.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/cos-93-amd-sev.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/debian-10.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/glinux-alex.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/rhel8-uefi.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-1804-amd-sev.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-2104-no-dbx.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-2104-no-secure-boot.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/load_random_external_key.go delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/test_data.go delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/test_other.go delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/test_tpm.go delete mode 100644 vendor/github.com/google/go-tpm-tools/internal/test/test_windows.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/.gcloudignore delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/agent/agent.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/agent/agent_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/auth.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/container_runner.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/container_runner_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/errors.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/go.mod delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/go.sum delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/cloudbuild.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/container-runner.service delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/debug.conf delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/entrypoint.sh delete mode 100755 vendor/github.com/google/go-tpm-tools/launcher/image/exit_script.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/fixup_oem.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/fluent-bit-cs.conf delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/hardened.conf delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/preload.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/README.md delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/check_failure.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/cleanup.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/create_vm.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/data/cloud-init-config.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/data/echo_startupscript.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_cloud_init_userdata_disabled.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_experiment_value.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launcher_workload.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launcher_workload_cloudlogging.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_cmd.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_cmd_cloudlogging.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_env.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_env_cloudlogging.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_debug.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_debug_cloudlogging.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_never.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_never_cloudlogging.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_log_redirect.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_mds_var_change.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_multiwriterpd_disabled.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_os_config_os_policy.sh delete mode 100755 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_ssh_manual.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_startupscript_disabled.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/test_debug_cloudbuild.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/test_debug_unstable_cloudbuild.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/test_experiments_client.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/test_hardened_cloudbuild.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/test_hardened_unstable_cloudbuild.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/test_ingress_network.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/test_launchpolicy_cloudbuild.yaml delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/test_log_redirection.yaml delete mode 100755 vendor/github.com/google/go-tpm-tools/launcher/image/test/util/change_metadata_vars.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/util/read_cloud_logging.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/test/util/read_serial.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/basic/Dockerfile delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/basic/main.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicycmd/Dockerfile delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicylogdebug/Dockerfile delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicylognever/Dockerfile delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/experiments/experiments.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/experiments/experiments_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/fakesignature.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/signature.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/signature_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/oci/interface.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/client.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/client_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/fakeclient.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/launcher/main.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/launcher/main_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/launcherfile/launcherfile.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/spec/launch_policy.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/spec/launch_policy_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/spec/launch_spec.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/spec/launch_spec_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/verifier/client.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/verifier/fake/fakeclaims.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/verifier/fake/fakeverifier.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest_network_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/proto/attest.proto delete mode 100644 vendor/github.com/google/go-tpm-tools/proto/attest/attest.pb.go delete mode 100644 vendor/github.com/google/go-tpm-tools/proto/doc.go delete mode 100755 vendor/github.com/google/go-tpm-tools/proto/gen_attest.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/proto/tpm.proto delete mode 100644 vendor/github.com/google/go-tpm-tools/proto/tpm/tpm.pb.go delete mode 100755 vendor/github.com/google/go-tpm-tools/run_cloudbuild.sh delete mode 100644 vendor/github.com/google/go-tpm-tools/server/ca-certs/tpm_ek_intermediate_2.crt delete mode 100644 vendor/github.com/google/go-tpm-tools/server/ca-certs/tpm_ek_root_1.cer delete mode 100644 vendor/github.com/google/go-tpm-tools/server/certificate_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/ecc_utils.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/eventlog.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/eventlog_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/example_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/grouped_error.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/grouped_error_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/import.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/import_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/instance_info.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/key_conversion.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/key_conversion_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/policy.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/policy_constants.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/policy_constants_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/policy_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/GcePk.crt delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/MicCorKEKCA2011_2011-06-24.crt delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/MicCorUEFCA2011_2011-06-27.crt delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/MicWinProPCA2011_2011-10-19.crt delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/canonical-boothole.crt delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/cisco-boothole.crt delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate-2014-08-11.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate_x64-2020-10-12.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate_x64-2021-04-29.bin delete mode 100644 vendor/github.com/google/go-tpm-tools/server/secure-boot/debian-boothole.crt delete mode 100644 vendor/github.com/google/go-tpm-tools/server/verify.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/verify_sev.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/verify_tdx.go delete mode 100644 vendor/github.com/google/go-tpm-tools/server/verify_test.go delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/CONTRIBUTING.md delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/LICENSE delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/README.md delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Clock.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Entropy.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/NVMem.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Platform.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/PlatformData.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Platform_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Run.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/Makefile.am delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/configure.ac delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/flags.m4 delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BaseTypes.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Capabilities.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandAttributeData.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandAttributes.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandDispatchData.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandDispatcher.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Commands.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CompilerDependencies.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptEcc.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptHash.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRand.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRsa.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptSym.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptTest.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/EccTestData.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Global.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/GpMacros.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/HandleProcess.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/HashTestData.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/InternalRoutines.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/KdfTestData.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/LibSupport.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/LtcSettings.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcHash.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcMath.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcSym.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/MinMax.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/NV.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/OIDs.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslHash.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslSym.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/PRNG_TestVectors.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/RsaTestData.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SelfTest.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SupportLibraryFunctionPrototypes_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SymmetricTest.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SymmetricTestData.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TPMB.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmASN1.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmAlgorithmDefines.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmBuildSwitches.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmError.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmProfile.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmTypes.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/VendorString.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfHash.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfMath.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfSym.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/user_settings.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/X509.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_GetCapability_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_Send_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_spt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ActivateCredential_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AlgorithmCap_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AlgorithmTests_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Attest_spt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Bits_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnConvert_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnMath_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnMemory_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CertifyCreation_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CertifyX509_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Certify_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ChangeEPS_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ChangePPS_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClearControl_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Clear_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClockRateAdjust_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClockSet_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandAudit_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandCodeAttributes_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandDispatcher_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Commit_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ContextLoad_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ContextSave_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Context_spt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CreateLoaded_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CreatePrimary_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Create_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptCmac_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptDes_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccKeyExchange_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccMain_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccSignature_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptHash_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptPrimeSieve_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptPrime_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptRand_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptRsa_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSelfTest_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSmac_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSym_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptUtil_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DA_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DictionaryAttackLockReset_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DictionaryAttackParameters_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Duplicate_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECC_Parameters_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECDH_KeyGen_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECDH_ZGen_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EC_Ephemeral_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt2_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt_spt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Entity_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EventSequenceComplete_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EvictControl_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ExecCommand_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FieldUpgradeData_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FieldUpgradeStart_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FirmwareRead_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FlushContext_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetCapability_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetCommandAuditDigest_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetRandom_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetSessionAuditDigest_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetTestResult_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetTime_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HMAC_Start_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HMAC_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Handle_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HashSequenceStart_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Hash_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HierarchyChangeAuth_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HierarchyControl_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Hierarchy_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Import_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/IncrementalSelfTest_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/IoBuffers_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/LoadExternal_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Load_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Locality_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MAC_Start_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MAC_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MakeCredential_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Manufacture_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Marshal_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MathOnByteBuffers_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Memory_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Certify_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ChangeAuth_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_DefineSpace_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Extend_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_GlobalWriteLock_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Increment_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ReadLock_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ReadPublic_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Read_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_SetBits_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_UndefineSpaceSpecial_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_UndefineSpace_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_WriteLock_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Write_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_spt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NvDynamic_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NvReserved_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ObjectChangeAuth_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Object_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Object_spt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Allocate_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Event_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Extend_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Read_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Reset_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_SetAuthPolicy_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_SetAuthValue_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PP_Commands_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PP_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthValue_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthorizeNV_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthorize_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCommandCode_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCounterTimer_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCpHash_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyDuplicationSelect_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyGetDigest_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyLocality_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNV_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNameHash_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNvWritten_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyOR_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPCR_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPassword_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPhysicalPresence_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyRestart_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicySecret_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicySigned_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyTemplate_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyTicket_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Policy_AC_SendSelect_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Policy_spt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Power_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PropertyCap_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Quote_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RSA_Decrypt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RSA_Encrypt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ReadClock_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ReadPublic_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ResponseCodeProcessing_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Response_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Rewrap_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RsaKeyCache_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SelfTest_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SequenceComplete_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SequenceUpdate_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SessionProcess_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Session_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetAlgorithmSet_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetCommandCodeAuditStatus_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetPrimaryPolicy_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Shutdown_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Sign_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/StartAuthSession_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Startup_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/StirRandom_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TestParms_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Ticket_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Time_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmASN1_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmFail_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmSizeChecks_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcDesSupport_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcMath_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcSupport_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslDesSupport_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslMath_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslSupport_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfDesSupport_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfMath_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfSupport_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Unseal_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Vendor_TCG_Test_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/VerifySignature_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_ECC_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_RSA_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_spt_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ZGen_2Phase_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_Data_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_End_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_Start_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Init_fp.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/swap.h delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/TpmASN1.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_ECC.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_RSA.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_spt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECC_Parameters.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECDH_KeyGen.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECDH_ZGen.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/EC_Ephemeral.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/RSA_Decrypt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/RSA_Encrypt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ZGen_2Phase.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_GetCapability.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_Send.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_spt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/Policy_AC_SendSelect.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Attest_spt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Certify.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/CertifyCreation.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/CertifyX509.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetCommandAuditDigest.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetSessionAuditDigest.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetTime.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Quote.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Capability/GetCapability.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Capability/TestParms.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ClockRateAdjust.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ClockSet.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ReadClock.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/CommandAudit/SetCommandCodeAuditStatus.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/ContextLoad.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/ContextSave.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/Context_spt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/EvictControl.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/FlushContext.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/DA/DictionaryAttackLockReset.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/DA/DictionaryAttackParameters.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Duplicate.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Import.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Rewrap.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthValue.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthorize.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthorizeNV.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCommandCode.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCounterTimer.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCpHash.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyDuplicationSelect.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyGetDigest.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyLocality.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNV.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNameHash.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNvWritten.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyOR.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPCR.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPassword.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPhysicalPresence.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicySecret.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicySigned.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyTemplate.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyTicket.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/Policy_spt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Ecdaa/Commit.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeData.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeStart.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FirmwareRead.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/EventSequenceComplete.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/HMAC_Start.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/HashSequenceStart.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/MAC_Start.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/SequenceComplete.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/SequenceUpdate.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ChangeEPS.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ChangePPS.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/Clear.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ClearControl.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/CreatePrimary.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/HierarchyChangeAuth.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/HierarchyControl.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/SetPrimaryPolicy.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Misc/PP_Commands.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Misc/SetAlgorithmSet.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Certify.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ChangeAuth.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Extend.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_GlobalWriteLock.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Increment.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Read.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ReadLock.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_SetBits.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpace.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpaceSpecial.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Write.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_WriteLock.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_spt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ActivateCredential.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Create.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/CreateLoaded.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Load.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/LoadExternal.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/MakeCredential.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ObjectChangeAuth.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Object_spt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ReadPublic.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Unseal.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Allocate.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Event.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Extend.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Read.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Reset.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_SetAuthPolicy.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_SetAuthValue.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Random/GetRandom.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Random/StirRandom.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Session/PolicyRestart.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Session/StartAuthSession.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Signature/Sign.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Signature/VerifySignature.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Startup/Shutdown.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Startup/Startup.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt2.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt_spt.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/HMAC.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/Hash.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/MAC.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/GetTestResult.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/IncrementalSelfTest.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/SelfTest.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Vendor/Vendor_TCG_Test.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/AlgorithmTests.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnConvert.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnMath.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnMemory.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptCmac.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptDes.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccData.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccKeyExchange.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccMain.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccSignature.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptHash.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptPrime.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptPrimeSieve.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptRand.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptRsa.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSelfTest.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSmac.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptUtil.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/PrimeData.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/RsaKeyCache.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/Ticket.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcDesSupport.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcMath.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcSupport.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslDesSupport.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslSupport.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfDesSupport.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfSupport.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/wolfssl.vcxproj delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_Data.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_End.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_Start.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Init.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/CommandDispatcher.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/ExecCommand.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/SessionProcess.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/CommandAudit.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/DA.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Hierarchy.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/NvDynamic.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/NvReserved.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Object.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/PCR.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/PP.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Session.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Time.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/AlgorithmCap.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Bits.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/CommandCodeAttributes.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Entity.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Global.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Handle.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/IoBuffers.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Locality.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Manufacture.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Marshal.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/MathOnByteBuffers.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Memory.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Power.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/PropertyCap.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Response.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/ResponseCodeProcessing.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/TpmFail.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/TpmSizeChecks.c delete mode 100644 vendor/github.com/google/go-tpm-tools/simulator/simulator_test.go rename vendor/github.com/grpc-ecosystem/grpc-gateway/v2/{LICENSE.txt => LICENSE} (100%) delete mode 100644 vendor/github.com/huandu/xstrings/.gitignore delete mode 100644 vendor/github.com/huandu/xstrings/CONTRIBUTING.md delete mode 100644 vendor/github.com/huandu/xstrings/LICENSE delete mode 100644 vendor/github.com/huandu/xstrings/README.md delete mode 100644 vendor/github.com/huandu/xstrings/common.go delete mode 100644 vendor/github.com/huandu/xstrings/convert.go delete mode 100644 vendor/github.com/huandu/xstrings/count.go delete mode 100644 vendor/github.com/huandu/xstrings/doc.go delete mode 100644 vendor/github.com/huandu/xstrings/format.go delete mode 100644 vendor/github.com/huandu/xstrings/manipulate.go delete mode 100644 vendor/github.com/huandu/xstrings/stringbuilder.go delete mode 100644 vendor/github.com/huandu/xstrings/stringbuilder_go110.go delete mode 100644 vendor/github.com/huandu/xstrings/translate.go delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/v2/LICENSE delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/v2/NOTICE delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/.gitignore delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/Makefile delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/decode.go delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/doc.go delete mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/encode.go create mode 100644 vendor/github.com/onsi/ginkgo/v2/Makefile delete mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt delete mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go create mode 100644 vendor/github.com/prometheus/common/model/labelset_string.go create mode 100644 vendor/github.com/prometheus/common/model/labelset_string_go120.go create mode 100644 vendor/github.com/prometheus/common/model/metadata.go create mode 100644 vendor/github.com/prometheus/procfs/net_tls_stat.go create mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go create mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go create mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go create mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.24.0.go delete mode 100644 vendor/go.opentelemetry.io/otel/.gitmodules create mode 100644 vendor/go.opentelemetry.io/otel/attribute/README.md create mode 100644 vendor/go.opentelemetry.io/otel/baggage/README.md create mode 100644 vendor/go.opentelemetry.io/otel/codes/README.md create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/README.md create mode 100644 vendor/go.opentelemetry.io/otel/metric/README.md create mode 100644 vendor/go.opentelemetry.io/otel/metric/embedded/README.md create mode 100644 vendor/go.opentelemetry.io/otel/propagation/README.md create mode 100644 vendor/go.opentelemetry.io/otel/renovate.json create mode 100644 vendor/go.opentelemetry.io/otel/sdk/README.md create mode 100644 vendor/go.opentelemetry.io/otel/sdk/instrumentation/README.md delete mode 100644 vendor/go.opentelemetry.io/otel/sdk/internal/gen.go delete mode 100644 vendor/go.opentelemetry.io/otel/sdk/internal/internal.go create mode 100644 vendor/go.opentelemetry.io/otel/sdk/internal/x/README.md create mode 100644 vendor/go.opentelemetry.io/otel/sdk/internal/x/x.go create mode 100644 vendor/go.opentelemetry.io/otel/sdk/resource/README.md create mode 100644 vendor/go.opentelemetry.io/otel/sdk/trace/README.md create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.17.0/README.md create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/README.md create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go rename vendor/go.opentelemetry.io/otel/semconv/{v1.21.0 => v1.20.0}/event.go (92%) create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go rename vendor/go.opentelemetry.io/otel/semconv/{v1.21.0 => v1.20.0}/resource.go (86%) create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go rename vendor/go.opentelemetry.io/otel/semconv/{v1.21.0 => v1.20.0}/trace.go (94%) delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.21.0/attribute_group.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.21.0/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.21.0/exception.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.21.0/schema.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/README.md create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/attribute_group.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/doc.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/event.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/exception.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/metric.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/resource.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/schema.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.24.0/trace.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/README.md create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/attribute_group.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/doc.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/exception.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/metric.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/schema.go create mode 100644 vendor/go.opentelemetry.io/otel/trace/README.md create mode 100644 vendor/go.opentelemetry.io/otel/trace/embedded/README.md create mode 100644 vendor/go.opentelemetry.io/otel/trace/noop/README.md create mode 100644 vendor/go.opentelemetry.io/otel/verify_readmes.sh rename vendor/go.uber.org/zap/{LICENSE.txt => LICENSE} (100%) delete mode 100644 vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go delete mode 100644 vendor/golang.org/x/crypto/scrypt/scrypt.go delete mode 100644 vendor/golang.org/x/oauth2/internal/client_appengine.go create mode 100644 vendor/golang.org/x/tools/go/ast/inspector/iter.go delete mode 100644 vendor/google.golang.org/appengine/LICENSE delete mode 100644 vendor/google.golang.org/appengine/internal/api.go delete mode 100644 vendor/google.golang.org/appengine/internal/api_classic.go delete mode 100644 vendor/google.golang.org/appengine/internal/api_common.go delete mode 100644 vendor/google.golang.org/appengine/internal/app_id.go delete mode 100644 vendor/google.golang.org/appengine/internal/base/api_base.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/base/api_base.proto delete mode 100644 vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto delete mode 100644 vendor/google.golang.org/appengine/internal/identity.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_classic.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_flex.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_vm.go delete mode 100644 vendor/google.golang.org/appengine/internal/internal.go delete mode 100644 vendor/google.golang.org/appengine/internal/log/log_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/log/log_service.proto delete mode 100644 vendor/google.golang.org/appengine/internal/main.go delete mode 100644 vendor/google.golang.org/appengine/internal/main_common.go delete mode 100644 vendor/google.golang.org/appengine/internal/main_vm.go delete mode 100644 vendor/google.golang.org/appengine/internal/metadata.go delete mode 100644 vendor/google.golang.org/appengine/internal/net.go delete mode 100644 vendor/google.golang.org/appengine/internal/regen.sh delete mode 100644 vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto delete mode 100644 vendor/google.golang.org/appengine/internal/transaction.go delete mode 100644 vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto delete mode 100644 vendor/google.golang.org/appengine/urlfetch/urlfetch.go rename vendor/google.golang.org/grpc/{ => balancer/pickfirst}/pickfirst.go (71%) delete mode 100644 vendor/google.golang.org/grpc/balancer_conn_wrappers.go create mode 100644 vendor/google.golang.org/grpc/balancer_wrapper.go delete mode 100644 vendor/google.golang.org/grpc/codegen.sh create mode 100644 vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/config.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/channel.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/channelmap.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/id.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/server.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/socket.go create mode 100644 vendor/google.golang.org/grpc/internal/channelz/subchannel.go rename vendor/google.golang.org/grpc/internal/channelz/{types_linux.go => syscall_linux.go} (83%) rename vendor/google.golang.org/grpc/internal/channelz/{types_nonlinux.go => syscall_nonlinux.go} (90%) create mode 100644 vendor/google.golang.org/grpc/internal/channelz/trace.go delete mode 100644 vendor/google.golang.org/grpc/internal/channelz/types.go create mode 100644 vendor/google.golang.org/grpc/internal/experimental.go delete mode 100644 vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go create mode 100644 vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go rename vendor/google.golang.org/grpc/internal/{channelz/util_nonlinux.go => tcp_keepalive_others.go} (69%) create mode 100644 vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go create mode 100644 vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go delete mode 100644 vendor/google.golang.org/grpc/internal/xds_handshake_cluster.go create mode 100644 vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go delete mode 100644 vendor/google.golang.org/grpc/resolver_conn_wrapper.go create mode 100644 vendor/google.golang.org/grpc/resolver_wrapper.go create mode 100644 vendor/google.golang.org/grpc/stream_interfaces.go create mode 100644 vendor/google.golang.org/grpc/trace_notrace.go rename vendor/google.golang.org/grpc/{internal/channelz/util_linux.go => trace_withtrace.go} (59%) delete mode 100644 vendor/google.golang.org/grpc/vet.sh create mode 100644 vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go create mode 100644 vendor/google.golang.org/protobuf/internal/editionssupport/editions.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/equal.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_pure.go create mode 100644 vendor/google.golang.org/protobuf/protoadapt/convert.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go delete mode 100644 vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto create mode 100644 vendor/k8s.io/klog/v2/contextual_slog.go create mode 100644 vendor/k8s.io/klog/v2/safeptr.go create mode 100644 vendor/k8s.io/utils/net/multi_listen.go diff --git a/go.mod b/go.mod index f7799f511..29005e619 100644 --- a/go.mod +++ b/go.mod @@ -18,8 +18,8 @@ require ( github.com/gorilla/websocket v1.5.1 github.com/hashicorp/go-version v1.6.0 github.com/jaypipes/ghw v0.12.0 - github.com/onsi/ginkgo/v2 v2.17.0 - github.com/onsi/gomega v1.32.0 + github.com/onsi/ginkgo/v2 v2.21.0 + github.com/onsi/gomega v1.35.1 github.com/rancher-sandbox/ele-testhelpers v0.0.0-20240926104948-8ac88aebed21 github.com/rancher-sandbox/go-tpm v0.0.0-20230111102523-ee25b94d1912 github.com/rancher/fleet/pkg/apis v0.10.0-rc.4 @@ -30,7 +30,7 @@ require ( github.com/rancher/wrangler/v2 v2.1.4 github.com/rancher/yip v1.4.11 github.com/sanity-io/litter v1.5.5 - github.com/spf13/cobra v1.8.0 + github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.17.0 github.com/twpayne/go-vfs v1.7.2 github.com/twpayne/go-vfsafero v1.0.0 @@ -41,21 +41,19 @@ require ( k8s.io/apiextensions-apiserver v0.29.0 k8s.io/apimachinery v0.29.2 k8s.io/client-go v12.0.0+incompatible - k8s.io/klog/v2 v2.110.1 - k8s.io/utils v0.0.0-20230726121419-3b25d923346b + k8s.io/klog/v2 v2.130.1 + k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 sigs.k8s.io/cluster-api v1.6.3 sigs.k8s.io/controller-runtime v0.17.2 sigs.k8s.io/yaml v1.4.0 ) require ( - github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver v1.5.0 // indirect github.com/StackExchange/wmi v1.2.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect @@ -63,30 +61,29 @@ require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/zapr v1.3.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect - github.com/go-task/slim-sprig v2.20.0+incompatible // indirect + github.com/go-openapi/swag v0.23.0 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/certificate-transparency-go v1.1.2 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-tpm v0.9.0 // indirect github.com/google/go-tpm-tools v0.4.2 // indirect github.com/google/go-tspi v0.3.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20230502171905-255e3b9b56de // indirect + github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/huandu/xstrings v1.4.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/itchyny/gojq v0.12.14 // indirect @@ -96,7 +93,6 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -104,10 +100,10 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.45.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/rancher/aks-operator v1.3.0-rc5 // indirect github.com/rancher/eks-operator v1.4.0-rc5 // indirect github.com/rancher/gke-operator v1.3.0-rc6 // indirect @@ -124,32 +120,31 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/twpayne/go-vfs/v4 v4.3.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect - go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/sdk v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.26.0 // indirect + go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.36.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/oauth2 v0.16.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.12.0 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/term v0.30.0 // indirect golang.org/x/text v0.23.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect + google.golang.org/grpc v1.65.0 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect @@ -158,10 +153,10 @@ require ( k8s.io/component-base v0.29.0 // indirect k8s.io/klog v1.0.0 // indirect k8s.io/kube-aggregator v0.28.6 // indirect - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect - k8s.io/kubernetes v1.27.9 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect + k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect + k8s.io/kubernetes v1.32.6 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 // indirect sigs.k8s.io/cli-utils v0.28.0 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect ) diff --git a/go.sum b/go.sum index 9983d8ccd..152cc3809 100644 --- a/go.sum +++ b/go.sum @@ -75,10 +75,7 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20191009163259-e802c2cb94ae/go.mod h1:mjwGPas4yKduTyubHvD1Atl9r1rUq8DfVy+gkVvZ+oo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/semver/v3 v3.1.0/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= @@ -141,8 +138,8 @@ github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e/go.mod h1:9IOqJGCPMS github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -150,8 +147,8 @@ github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6 github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -181,7 +178,7 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -258,9 +255,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -268,12 +264,14 @@ github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= @@ -281,8 +279,8 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v2.20.0+incompatible h1:4Xh3bDzO29j4TWNOI+24ubc0vbVFMg2PMnXKxK54/CA= -github.com/go-task/slim-sprig v2.20.0+incompatible/go.mod h1:N/mhXZITr/EQAOErEHciKvO1bFei2Lld2Ym6h96pdy0= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gobuffalo/flect v1.0.2 h1:eqjPGSo2WmjgY2XlpGwo2NXgL3RucAKo4k4qQMNA5sA= github.com/gobuffalo/flect v1.0.2/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnDvkbYKHs= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -296,8 +294,6 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -332,8 +328,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -404,8 +400,8 @@ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230502171905-255e3b9b56de h1:6bMcLOeKoNo0+mTOb1ee3McF6CCKGixjLR3EDQY1Jik= -github.com/google/pprof v0.0.0-20230502171905-255e3b9b56de/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/rpmpack v0.0.0-20191226140753-aa36bfddb3a0/go.mod h1:RaTPr0KUf2K7fnZYLNDrr8rxAamWs3iNywJLtQ2AzBg= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= @@ -448,8 +444,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= @@ -485,8 +481,6 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= -github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= -github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -586,8 +580,6 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= @@ -637,13 +629,13 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo/v2 v2.17.0 h1:kdnunFXpBjbzN56hcJHrXZ8M+LOkenKA7NnBzTNigTI= -github.com/onsi/ginkgo/v2 v2.17.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= +github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= +github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk= -github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg= +github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= +github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= @@ -690,16 +682,16 @@ github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= -github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -709,8 +701,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= -github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -719,8 +711,8 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/pseudomuto/protoc-gen-doc v1.4.1/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= github.com/pseudomuto/protoc-gen-doc v1.5.0/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= @@ -762,8 +754,8 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.0/go.mod h1:EBwu+T5AvHOcXwvZIkQFjUN6s8Czyqw12GL/Y0tUyRM= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -812,8 +804,8 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -844,8 +836,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= @@ -884,7 +877,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -923,31 +915,31 @@ go.opencensus.io v0.22.6/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -969,8 +961,8 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= gocloud.dev v0.19.0/go.mod h1:SmKwiR8YwIMMJvQBKLsC3fHNyMwXLw3PMDO+VVteJMI= golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -988,7 +980,6 @@ golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= @@ -1003,8 +994,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1030,7 +1021,6 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1084,7 +1074,6 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1106,8 +1095,8 @@ golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= -golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1120,7 +1109,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1200,13 +1188,10 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1218,7 +1203,6 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1227,8 +1211,8 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1300,9 +1284,8 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1352,8 +1335,6 @@ google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -1418,12 +1399,10 @@ google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= -google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI= -google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= +google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 h1:YcyjlL1PRr2Q17/I0dPk2JmYS5CDXfcdb2Z3YRioEbw= +google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 h1:2035KHhUv+EpyB+hWgJnaWKJOdX1E95w2S8Rr4uWKTs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1456,8 +1435,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1473,8 +1452,8 @@ google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX7 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1541,32 +1520,32 @@ k8s.io/component-base v0.29.0 h1:T7rjd5wvLnPBV1vC4zWd/iWRbV8Mdxs+nGaoaFzGw3s= k8s.io/component-base v0.29.0/go.mod h1:sADonFTQ9Zc9yFLghpDpmNXEdHyQmFIGbiuZbqAXQ1M= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= -k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= -k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-aggregator v0.28.6 h1:opRVDw+inLPIyAqG9Fu3+EYWcmbTHOHJNrmuKoeuzQM= k8s.io/kube-aggregator v0.28.6/go.mod h1:NXzqtkCuAfv/modgRbAkPdfUZF+koazCy8Qrs8L+WyE= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/kubernetes v1.27.9 h1:aN3arQtT15QHn3CGZ47egfySPKmSozkj+yZTEF2QLJs= -k8s.io/kubernetes v1.27.9/go.mod h1:bwTXvXbv/nV1D6JnLy4zAcPfChls2+aGL3an0inNbXM= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= +k8s.io/kubernetes v1.32.6 h1:tp1gRjOqZjaoFBek5PN6eSmODdS1QRrH5UKiFP8ZByg= +k8s.io/kubernetes v1.32.6/go.mod h1:REY0Gok66BTTrbGyZaFMNKO9JhxvgBDW9B7aksWRFoY= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= pack.ag/amqp v0.11.2/go.mod h1:4/cbmt4EJXSKlG6LCfWHoqmN0uFdy5i/+YFz+fTfhV4= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 h1:TgtAeesdhpm2SGwkQasmbeqDo8th5wOBA5h/AjTKA4I= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0/go.mod h1:VHVDI/KrK4fjnV61bE2g3sA7tiETLn8sooImelsCx3Y= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/cli-utils v0.28.0 h1:gsvwqygoXlW2y8CmKdflQJNZp1Yhi4geATW3/Ei7oYc= sigs.k8s.io/cli-utils v0.28.0/go.mod h1:WDVRa5/eQBKntG++uyKdyT+xU7MLdCR4XsgseqL5uX4= sigs.k8s.io/cluster-api v1.6.3 h1:VOlPNg92PQLlhBVLc5pg+cbAuPvGOOBujeFLk9zgnoo= sigs.k8s.io/cluster-api v1.6.3/go.mod h1:4FzfgPPiYaFq8X9F9j2SvmggH/4OOLEDgVJuWDqKLig= sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= diff --git a/vendor/github.com/Masterminds/goutils/.travis.yml b/vendor/github.com/Masterminds/goutils/.travis.yml deleted file mode 100644 index 4025e01ec..000000000 --- a/vendor/github.com/Masterminds/goutils/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go - -go: - - 1.6 - - 1.7 - - 1.8 - - tip - -script: - - go test -v - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/06e3328629952dabe3e0 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always diff --git a/vendor/github.com/Masterminds/goutils/CHANGELOG.md b/vendor/github.com/Masterminds/goutils/CHANGELOG.md deleted file mode 100644 index d700ec47f..000000000 --- a/vendor/github.com/Masterminds/goutils/CHANGELOG.md +++ /dev/null @@ -1,8 +0,0 @@ -# 1.0.1 (2017-05-31) - -## Fixed -- #21: Fix generation of alphanumeric strings (thanks @dbarranco) - -# 1.0.0 (2014-04-30) - -- Initial release. diff --git a/vendor/github.com/Masterminds/goutils/LICENSE.txt b/vendor/github.com/Masterminds/goutils/LICENSE.txt deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/Masterminds/goutils/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/Masterminds/goutils/README.md b/vendor/github.com/Masterminds/goutils/README.md deleted file mode 100644 index 163ffe72a..000000000 --- a/vendor/github.com/Masterminds/goutils/README.md +++ /dev/null @@ -1,70 +0,0 @@ -GoUtils -=========== -[![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html) -[![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) [![Build Status](https://travis-ci.org/Masterminds/goutils.svg?branch=master)](https://travis-ci.org/Masterminds/goutils) [![Build status](https://ci.appveyor.com/api/projects/status/sc2b1ew0m7f0aiju?svg=true)](https://ci.appveyor.com/project/mattfarina/goutils) - - -GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some -string manipulation libraries of Java Apache Commons. GoUtils includes the following Java Apache Commons classes: -* WordUtils -* RandomStringUtils -* StringUtils (partial implementation) - -## Installation -If you have Go set up on your system, from the GOPATH directory within the command line/terminal, enter this: - - go get github.com/Masterminds/goutils - -If you do not have Go set up on your system, please follow the [Go installation directions from the documenation](http://golang.org/doc/install), and then follow the instructions above to install GoUtils. - - -## Documentation -GoUtils doc is available here: [![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) - - -## Usage -The code snippets below show examples of how to use GoUtils. Some functions return errors while others do not. The first instance below, which does not return an error, is the `Initials` function (located within the `wordutils.go` file). - - package main - - import ( - "fmt" - "github.com/Masterminds/goutils" - ) - - func main() { - - // EXAMPLE 1: A goutils function which returns no errors - fmt.Println (goutils.Initials("John Doe Foo")) // Prints out "JDF" - - } -Some functions return errors mainly due to illegal arguements used as parameters. The code example below illustrates how to deal with function that returns an error. In this instance, the function is the `Random` function (located within the `randomstringutils.go` file). - - package main - - import ( - "fmt" - "github.com/Masterminds/goutils" - ) - - func main() { - - // EXAMPLE 2: A goutils function which returns an error - rand1, err1 := goutils.Random (-1, 0, 0, true, true) - - if err1 != nil { - fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...) - } else { - fmt.Println(rand1) - } - - } - -## License -GoUtils is licensed under the Apache License, Version 2.0. Please check the LICENSE.txt file or visit http://www.apache.org/licenses/LICENSE-2.0 for a copy of the license. - -## Issue Reporting -Make suggestions or report issues using the Git issue tracker: https://github.com/Masterminds/goutils/issues - -## Website -* [GoUtils webpage](http://Masterminds.github.io/goutils/) diff --git a/vendor/github.com/Masterminds/goutils/appveyor.yml b/vendor/github.com/Masterminds/goutils/appveyor.yml deleted file mode 100644 index 657564a84..000000000 --- a/vendor/github.com/Masterminds/goutils/appveyor.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: build-{build}.{branch} - -clone_folder: C:\gopath\src\github.com\Masterminds\goutils -shallow_clone: true - -environment: - GOPATH: C:\gopath - -platform: - - x64 - -build: off - -install: - - go version - - go env - -test_script: - - go test -v - -deploy: off diff --git a/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go b/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go deleted file mode 100644 index 8dbd92485..000000000 --- a/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go +++ /dev/null @@ -1,230 +0,0 @@ -/* -Copyright 2014 Alexander Okoli - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package goutils - -import ( - "crypto/rand" - "fmt" - "math" - "math/big" - "unicode" -) - -/* -CryptoRandomNonAlphaNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of all characters (ASCII/Unicode values between 0 to 2,147,483,647 (math.MaxInt32)). - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomNonAlphaNumeric(count int) (string, error) { - return CryptoRandomAlphaNumericCustom(count, false, false) -} - -/* -CryptoRandomAscii creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of characters whose ASCII value is between 32 and 126 (inclusive). - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomAscii(count int) (string, error) { - return CryptoRandom(count, 32, 127, false, false) -} - -/* -CryptoRandomNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of numeric characters. - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomNumeric(count int) (string, error) { - return CryptoRandom(count, 0, 0, false, true) -} - -/* -CryptoRandomAlphabetic creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments. - -Parameters: - count - the length of random string to create - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomAlphabetic(count int) (string, error) { - return CryptoRandom(count, 0, 0, true, false) -} - -/* -CryptoRandomAlphaNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters. - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomAlphaNumeric(count int) (string, error) { - return CryptoRandom(count, 0, 0, true, true) -} - -/* -CryptoRandomAlphaNumericCustom creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments. - -Parameters: - count - the length of random string to create - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomAlphaNumericCustom(count int, letters bool, numbers bool) (string, error) { - return CryptoRandom(count, 0, 0, letters, numbers) -} - -/* -CryptoRandom creates a random string based on a variety of options, using using golang's crypto/rand source of randomness. -If the parameters start and end are both 0, start and end are set to ' ' and 'z', the ASCII printable characters, will be used, -unless letters and numbers are both false, in which case, start and end are set to 0 and math.MaxInt32, respectively. -If chars is not nil, characters stored in chars that are between start and end are chosen. - -Parameters: - count - the length of random string to create - start - the position in set of chars (ASCII/Unicode int) to start at - end - the position in set of chars (ASCII/Unicode int) to end before - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - chars - the set of chars to choose randoms from. If nil, then it will use the set of all chars. - -Returns: - string - the random string - error - an error stemming from invalid parameters: if count < 0; or the provided chars array is empty; or end <= start; or end > len(chars) -*/ -func CryptoRandom(count int, start int, end int, letters bool, numbers bool, chars ...rune) (string, error) { - if count == 0 { - return "", nil - } else if count < 0 { - err := fmt.Errorf("randomstringutils illegal argument: Requested random string length %v is less than 0.", count) // equiv to err := errors.New("...") - return "", err - } - if chars != nil && len(chars) == 0 { - err := fmt.Errorf("randomstringutils illegal argument: The chars array must not be empty") - return "", err - } - - if start == 0 && end == 0 { - if chars != nil { - end = len(chars) - } else { - if !letters && !numbers { - end = math.MaxInt32 - } else { - end = 'z' + 1 - start = ' ' - } - } - } else { - if end <= start { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) must be greater than start (%v)", end, start) - return "", err - } - - if chars != nil && end > len(chars) { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) cannot be greater than len(chars) (%v)", end, len(chars)) - return "", err - } - } - - buffer := make([]rune, count) - gap := end - start - - // high-surrogates range, (\uD800-\uDBFF) = 55296 - 56319 - // low-surrogates range, (\uDC00-\uDFFF) = 56320 - 57343 - - for count != 0 { - count-- - var ch rune - if chars == nil { - ch = rune(getCryptoRandomInt(gap) + int64(start)) - } else { - ch = chars[getCryptoRandomInt(gap)+int64(start)] - } - - if letters && unicode.IsLetter(ch) || numbers && unicode.IsDigit(ch) || !letters && !numbers { - if ch >= 56320 && ch <= 57343 { // low surrogate range - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = ch - count-- - // Insert high surrogate - buffer[count] = rune(55296 + getCryptoRandomInt(128)) - } - } else if ch >= 55296 && ch <= 56191 { // High surrogates range (Partial) - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = rune(56320 + getCryptoRandomInt(128)) - count-- - // Insert high surrogate - buffer[count] = ch - } - } else if ch >= 56192 && ch <= 56319 { - // private high surrogate, skip it - count++ - } else { - // not one of the surrogates* - buffer[count] = ch - } - } else { - count++ - } - } - return string(buffer), nil -} - -func getCryptoRandomInt(count int) int64 { - nBig, err := rand.Int(rand.Reader, big.NewInt(int64(count))) - if err != nil { - panic(err) - } - return nBig.Int64() -} diff --git a/vendor/github.com/Masterminds/goutils/randomstringutils.go b/vendor/github.com/Masterminds/goutils/randomstringutils.go deleted file mode 100644 index 272670231..000000000 --- a/vendor/github.com/Masterminds/goutils/randomstringutils.go +++ /dev/null @@ -1,248 +0,0 @@ -/* -Copyright 2014 Alexander Okoli - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package goutils - -import ( - "fmt" - "math" - "math/rand" - "time" - "unicode" -) - -// RANDOM provides the time-based seed used to generate random numbers -var RANDOM = rand.New(rand.NewSource(time.Now().UnixNano())) - -/* -RandomNonAlphaNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of all characters (ASCII/Unicode values between 0 to 2,147,483,647 (math.MaxInt32)). - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomNonAlphaNumeric(count int) (string, error) { - return RandomAlphaNumericCustom(count, false, false) -} - -/* -RandomAscii creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of characters whose ASCII value is between 32 and 126 (inclusive). - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomAscii(count int) (string, error) { - return Random(count, 32, 127, false, false) -} - -/* -RandomNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of numeric characters. - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomNumeric(count int) (string, error) { - return Random(count, 0, 0, false, true) -} - -/* -RandomAlphabetic creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alphabetic characters. - -Parameters: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomAlphabetic(count int) (string, error) { - return Random(count, 0, 0, true, false) -} - -/* -RandomAlphaNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters. - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomAlphaNumeric(count int) (string, error) { - return Random(count, 0, 0, true, true) -} - -/* -RandomAlphaNumericCustom creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments. - -Parameters: - count - the length of random string to create - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomAlphaNumericCustom(count int, letters bool, numbers bool) (string, error) { - return Random(count, 0, 0, letters, numbers) -} - -/* -Random creates a random string based on a variety of options, using default source of randomness. -This method has exactly the same semantics as RandomSeed(int, int, int, bool, bool, []char, *rand.Rand), but -instead of using an externally supplied source of randomness, it uses the internal *rand.Rand instance. - -Parameters: - count - the length of random string to create - start - the position in set of chars (ASCII/Unicode int) to start at - end - the position in set of chars (ASCII/Unicode int) to end before - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - chars - the set of chars to choose randoms from. If nil, then it will use the set of all chars. - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func Random(count int, start int, end int, letters bool, numbers bool, chars ...rune) (string, error) { - return RandomSeed(count, start, end, letters, numbers, chars, RANDOM) -} - -/* -RandomSeed creates a random string based on a variety of options, using supplied source of randomness. -If the parameters start and end are both 0, start and end are set to ' ' and 'z', the ASCII printable characters, will be used, -unless letters and numbers are both false, in which case, start and end are set to 0 and math.MaxInt32, respectively. -If chars is not nil, characters stored in chars that are between start and end are chosen. -This method accepts a user-supplied *rand.Rand instance to use as a source of randomness. By seeding a single *rand.Rand instance -with a fixed seed and using it for each call, the same random sequence of strings can be generated repeatedly and predictably. - -Parameters: - count - the length of random string to create - start - the position in set of chars (ASCII/Unicode decimals) to start at - end - the position in set of chars (ASCII/Unicode decimals) to end before - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - chars - the set of chars to choose randoms from. If nil, then it will use the set of all chars. - random - a source of randomness. - -Returns: - string - the random string - error - an error stemming from invalid parameters: if count < 0; or the provided chars array is empty; or end <= start; or end > len(chars) -*/ -func RandomSeed(count int, start int, end int, letters bool, numbers bool, chars []rune, random *rand.Rand) (string, error) { - - if count == 0 { - return "", nil - } else if count < 0 { - err := fmt.Errorf("randomstringutils illegal argument: Requested random string length %v is less than 0.", count) // equiv to err := errors.New("...") - return "", err - } - if chars != nil && len(chars) == 0 { - err := fmt.Errorf("randomstringutils illegal argument: The chars array must not be empty") - return "", err - } - - if start == 0 && end == 0 { - if chars != nil { - end = len(chars) - } else { - if !letters && !numbers { - end = math.MaxInt32 - } else { - end = 'z' + 1 - start = ' ' - } - } - } else { - if end <= start { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) must be greater than start (%v)", end, start) - return "", err - } - - if chars != nil && end > len(chars) { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) cannot be greater than len(chars) (%v)", end, len(chars)) - return "", err - } - } - - buffer := make([]rune, count) - gap := end - start - - // high-surrogates range, (\uD800-\uDBFF) = 55296 - 56319 - // low-surrogates range, (\uDC00-\uDFFF) = 56320 - 57343 - - for count != 0 { - count-- - var ch rune - if chars == nil { - ch = rune(random.Intn(gap) + start) - } else { - ch = chars[random.Intn(gap)+start] - } - - if letters && unicode.IsLetter(ch) || numbers && unicode.IsDigit(ch) || !letters && !numbers { - if ch >= 56320 && ch <= 57343 { // low surrogate range - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = ch - count-- - // Insert high surrogate - buffer[count] = rune(55296 + random.Intn(128)) - } - } else if ch >= 55296 && ch <= 56191 { // High surrogates range (Partial) - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = rune(56320 + random.Intn(128)) - count-- - // Insert high surrogate - buffer[count] = ch - } - } else if ch >= 56192 && ch <= 56319 { - // private high surrogate, skip it - count++ - } else { - // not one of the surrogates* - buffer[count] = ch - } - } else { - count++ - } - } - return string(buffer), nil -} diff --git a/vendor/github.com/Masterminds/goutils/stringutils.go b/vendor/github.com/Masterminds/goutils/stringutils.go deleted file mode 100644 index 741bb530e..000000000 --- a/vendor/github.com/Masterminds/goutils/stringutils.go +++ /dev/null @@ -1,240 +0,0 @@ -/* -Copyright 2014 Alexander Okoli - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package goutils - -import ( - "bytes" - "fmt" - "strings" - "unicode" -) - -// Typically returned by functions where a searched item cannot be found -const INDEX_NOT_FOUND = -1 - -/* -Abbreviate abbreviates a string using ellipses. This will turn the string "Now is the time for all good men" into "Now is the time for..." - -Specifically, the algorithm is as follows: - - - If str is less than maxWidth characters long, return it. - - Else abbreviate it to (str[0:maxWidth - 3] + "..."). - - If maxWidth is less than 4, return an illegal argument error. - - In no case will it return a string of length greater than maxWidth. - -Parameters: - str - the string to check - maxWidth - maximum length of result string, must be at least 4 - -Returns: - string - abbreviated string - error - if the width is too small -*/ -func Abbreviate(str string, maxWidth int) (string, error) { - return AbbreviateFull(str, 0, maxWidth) -} - -/* -AbbreviateFull abbreviates a string using ellipses. This will turn the string "Now is the time for all good men" into "...is the time for..." -This function works like Abbreviate(string, int), but allows you to specify a "left edge" offset. Note that this left edge is not -necessarily going to be the leftmost character in the result, or the first character following the ellipses, but it will appear -somewhere in the result. -In no case will it return a string of length greater than maxWidth. - -Parameters: - str - the string to check - offset - left edge of source string - maxWidth - maximum length of result string, must be at least 4 - -Returns: - string - abbreviated string - error - if the width is too small -*/ -func AbbreviateFull(str string, offset int, maxWidth int) (string, error) { - if str == "" { - return "", nil - } - if maxWidth < 4 { - err := fmt.Errorf("stringutils illegal argument: Minimum abbreviation width is 4") - return "", err - } - if len(str) <= maxWidth { - return str, nil - } - if offset > len(str) { - offset = len(str) - } - if len(str)-offset < (maxWidth - 3) { // 15 - 5 < 10 - 3 = 10 < 7 - offset = len(str) - (maxWidth - 3) - } - abrevMarker := "..." - if offset <= 4 { - return str[0:maxWidth-3] + abrevMarker, nil // str.substring(0, maxWidth - 3) + abrevMarker; - } - if maxWidth < 7 { - err := fmt.Errorf("stringutils illegal argument: Minimum abbreviation width with offset is 7") - return "", err - } - if (offset + maxWidth - 3) < len(str) { // 5 + (10-3) < 15 = 12 < 15 - abrevStr, _ := Abbreviate(str[offset:len(str)], (maxWidth - 3)) - return abrevMarker + abrevStr, nil // abrevMarker + abbreviate(str.substring(offset), maxWidth - 3); - } - return abrevMarker + str[(len(str)-(maxWidth-3)):len(str)], nil // abrevMarker + str.substring(str.length() - (maxWidth - 3)); -} - -/* -DeleteWhiteSpace deletes all whitespaces from a string as defined by unicode.IsSpace(rune). -It returns the string without whitespaces. - -Parameter: - str - the string to delete whitespace from, may be nil - -Returns: - the string without whitespaces -*/ -func DeleteWhiteSpace(str string) string { - if str == "" { - return str - } - sz := len(str) - var chs bytes.Buffer - count := 0 - for i := 0; i < sz; i++ { - ch := rune(str[i]) - if !unicode.IsSpace(ch) { - chs.WriteRune(ch) - count++ - } - } - if count == sz { - return str - } - return chs.String() -} - -/* -IndexOfDifference compares two strings, and returns the index at which the strings begin to differ. - -Parameters: - str1 - the first string - str2 - the second string - -Returns: - the index where str1 and str2 begin to differ; -1 if they are equal -*/ -func IndexOfDifference(str1 string, str2 string) int { - if str1 == str2 { - return INDEX_NOT_FOUND - } - if IsEmpty(str1) || IsEmpty(str2) { - return 0 - } - var i int - for i = 0; i < len(str1) && i < len(str2); i++ { - if rune(str1[i]) != rune(str2[i]) { - break - } - } - if i < len(str2) || i < len(str1) { - return i - } - return INDEX_NOT_FOUND -} - -/* -IsBlank checks if a string is whitespace or empty (""). Observe the following behavior: - - goutils.IsBlank("") = true - goutils.IsBlank(" ") = true - goutils.IsBlank("bob") = false - goutils.IsBlank(" bob ") = false - -Parameter: - str - the string to check - -Returns: - true - if the string is whitespace or empty ("") -*/ -func IsBlank(str string) bool { - strLen := len(str) - if str == "" || strLen == 0 { - return true - } - for i := 0; i < strLen; i++ { - if unicode.IsSpace(rune(str[i])) == false { - return false - } - } - return true -} - -/* -IndexOf returns the index of the first instance of sub in str, with the search beginning from the -index start point specified. -1 is returned if sub is not present in str. - -An empty string ("") will return -1 (INDEX_NOT_FOUND). A negative start position is treated as zero. -A start position greater than the string length returns -1. - -Parameters: - str - the string to check - sub - the substring to find - start - the start position; negative treated as zero - -Returns: - the first index where the sub string was found (always >= start) -*/ -func IndexOf(str string, sub string, start int) int { - - if start < 0 { - start = 0 - } - - if len(str) < start { - return INDEX_NOT_FOUND - } - - if IsEmpty(str) || IsEmpty(sub) { - return INDEX_NOT_FOUND - } - - partialIndex := strings.Index(str[start:len(str)], sub) - if partialIndex == -1 { - return INDEX_NOT_FOUND - } - return partialIndex + start -} - -// IsEmpty checks if a string is empty (""). Returns true if empty, and false otherwise. -func IsEmpty(str string) bool { - return len(str) == 0 -} - -// Returns either the passed in string, or if the string is empty, the value of defaultStr. -func DefaultString(str string, defaultStr string) string { - if IsEmpty(str) { - return defaultStr - } - return str -} - -// Returns either the passed in string, or if the string is whitespace, empty (""), the value of defaultStr. -func DefaultIfBlank(str string, defaultStr string) string { - if IsBlank(str) { - return defaultStr - } - return str -} diff --git a/vendor/github.com/Masterminds/goutils/wordutils.go b/vendor/github.com/Masterminds/goutils/wordutils.go deleted file mode 100644 index 034cad8e2..000000000 --- a/vendor/github.com/Masterminds/goutils/wordutils.go +++ /dev/null @@ -1,357 +0,0 @@ -/* -Copyright 2014 Alexander Okoli - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Package goutils provides utility functions to manipulate strings in various ways. -The code snippets below show examples of how to use goutils. Some functions return -errors while others do not, so usage would vary as a result. - -Example: - - package main - - import ( - "fmt" - "github.com/aokoli/goutils" - ) - - func main() { - - // EXAMPLE 1: A goutils function which returns no errors - fmt.Println (goutils.Initials("John Doe Foo")) // Prints out "JDF" - - - - // EXAMPLE 2: A goutils function which returns an error - rand1, err1 := goutils.Random (-1, 0, 0, true, true) - - if err1 != nil { - fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...) - } else { - fmt.Println(rand1) - } - } -*/ -package goutils - -import ( - "bytes" - "strings" - "unicode" -) - -// VERSION indicates the current version of goutils -const VERSION = "1.0.0" - -/* -Wrap wraps a single line of text, identifying words by ' '. -New lines will be separated by '\n'. Very long words, such as URLs will not be wrapped. -Leading spaces on a new line are stripped. Trailing spaces are not stripped. - -Parameters: - str - the string to be word wrapped - wrapLength - the column (a column can fit only one character) to wrap the words at, less than 1 is treated as 1 - -Returns: - a line with newlines inserted -*/ -func Wrap(str string, wrapLength int) string { - return WrapCustom(str, wrapLength, "", false) -} - -/* -WrapCustom wraps a single line of text, identifying words by ' '. -Leading spaces on a new line are stripped. Trailing spaces are not stripped. - -Parameters: - str - the string to be word wrapped - wrapLength - the column number (a column can fit only one character) to wrap the words at, less than 1 is treated as 1 - newLineStr - the string to insert for a new line, "" uses '\n' - wrapLongWords - true if long words (such as URLs) should be wrapped - -Returns: - a line with newlines inserted -*/ -func WrapCustom(str string, wrapLength int, newLineStr string, wrapLongWords bool) string { - - if str == "" { - return "" - } - if newLineStr == "" { - newLineStr = "\n" // TODO Assumes "\n" is seperator. Explore SystemUtils.LINE_SEPARATOR from Apache Commons - } - if wrapLength < 1 { - wrapLength = 1 - } - - inputLineLength := len(str) - offset := 0 - - var wrappedLine bytes.Buffer - - for inputLineLength-offset > wrapLength { - - if rune(str[offset]) == ' ' { - offset++ - continue - } - - end := wrapLength + offset + 1 - spaceToWrapAt := strings.LastIndex(str[offset:end], " ") + offset - - if spaceToWrapAt >= offset { - // normal word (not longer than wrapLength) - wrappedLine.WriteString(str[offset:spaceToWrapAt]) - wrappedLine.WriteString(newLineStr) - offset = spaceToWrapAt + 1 - - } else { - // long word or URL - if wrapLongWords { - end := wrapLength + offset - // long words are wrapped one line at a time - wrappedLine.WriteString(str[offset:end]) - wrappedLine.WriteString(newLineStr) - offset += wrapLength - } else { - // long words aren't wrapped, just extended beyond limit - end := wrapLength + offset - index := strings.IndexRune(str[end:len(str)], ' ') - if index == -1 { - wrappedLine.WriteString(str[offset:len(str)]) - offset = inputLineLength - } else { - spaceToWrapAt = index + end - wrappedLine.WriteString(str[offset:spaceToWrapAt]) - wrappedLine.WriteString(newLineStr) - offset = spaceToWrapAt + 1 - } - } - } - } - - wrappedLine.WriteString(str[offset:len(str)]) - - return wrappedLine.String() - -} - -/* -Capitalize capitalizes all the delimiter separated words in a string. Only the first letter of each word is changed. -To convert the rest of each word to lowercase at the same time, use CapitalizeFully(str string, delimiters ...rune). -The delimiters represent a set of characters understood to separate words. The first string character -and the first non-delimiter character after a delimiter will be capitalized. A "" input string returns "". -Capitalization uses the Unicode title case, normally equivalent to upper case. - -Parameters: - str - the string to capitalize - delimiters - set of characters to determine capitalization, exclusion of this parameter means whitespace would be delimeter - -Returns: - capitalized string -*/ -func Capitalize(str string, delimiters ...rune) string { - - var delimLen int - - if delimiters == nil { - delimLen = -1 - } else { - delimLen = len(delimiters) - } - - if str == "" || delimLen == 0 { - return str - } - - buffer := []rune(str) - capitalizeNext := true - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if isDelimiter(ch, delimiters...) { - capitalizeNext = true - } else if capitalizeNext { - buffer[i] = unicode.ToTitle(ch) - capitalizeNext = false - } - } - return string(buffer) - -} - -/* -CapitalizeFully converts all the delimiter separated words in a string into capitalized words, that is each word is made up of a -titlecase character and then a series of lowercase characters. The delimiters represent a set of characters understood -to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized. -Capitalization uses the Unicode title case, normally equivalent to upper case. - -Parameters: - str - the string to capitalize fully - delimiters - set of characters to determine capitalization, exclusion of this parameter means whitespace would be delimeter - -Returns: - capitalized string -*/ -func CapitalizeFully(str string, delimiters ...rune) string { - - var delimLen int - - if delimiters == nil { - delimLen = -1 - } else { - delimLen = len(delimiters) - } - - if str == "" || delimLen == 0 { - return str - } - str = strings.ToLower(str) - return Capitalize(str, delimiters...) -} - -/* -Uncapitalize uncapitalizes all the whitespace separated words in a string. Only the first letter of each word is changed. -The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter -character after a delimiter will be uncapitalized. Whitespace is defined by unicode.IsSpace(char). - -Parameters: - str - the string to uncapitalize fully - delimiters - set of characters to determine capitalization, exclusion of this parameter means whitespace would be delimeter - -Returns: - uncapitalized string -*/ -func Uncapitalize(str string, delimiters ...rune) string { - - var delimLen int - - if delimiters == nil { - delimLen = -1 - } else { - delimLen = len(delimiters) - } - - if str == "" || delimLen == 0 { - return str - } - - buffer := []rune(str) - uncapitalizeNext := true // TODO Always makes capitalize/un apply to first char. - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if isDelimiter(ch, delimiters...) { - uncapitalizeNext = true - } else if uncapitalizeNext { - buffer[i] = unicode.ToLower(ch) - uncapitalizeNext = false - } - } - return string(buffer) -} - -/* -SwapCase swaps the case of a string using a word based algorithm. - -Conversion algorithm: - - Upper case character converts to Lower case - Title case character converts to Lower case - Lower case character after Whitespace or at start converts to Title case - Other Lower case character converts to Upper case - Whitespace is defined by unicode.IsSpace(char). - -Parameters: - str - the string to swap case - -Returns: - the changed string -*/ -func SwapCase(str string) string { - if str == "" { - return str - } - buffer := []rune(str) - - whitespace := true - - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if unicode.IsUpper(ch) { - buffer[i] = unicode.ToLower(ch) - whitespace = false - } else if unicode.IsTitle(ch) { - buffer[i] = unicode.ToLower(ch) - whitespace = false - } else if unicode.IsLower(ch) { - if whitespace { - buffer[i] = unicode.ToTitle(ch) - whitespace = false - } else { - buffer[i] = unicode.ToUpper(ch) - } - } else { - whitespace = unicode.IsSpace(ch) - } - } - return string(buffer) -} - -/* -Initials extracts the initial letters from each word in the string. The first letter of the string and all first -letters after the defined delimiters are returned as a new string. Their case is not changed. If the delimiters -parameter is excluded, then Whitespace is used. Whitespace is defined by unicode.IsSpacea(char). An empty delimiter array returns an empty string. - -Parameters: - str - the string to get initials from - delimiters - set of characters to determine words, exclusion of this parameter means whitespace would be delimeter -Returns: - string of initial letters -*/ -func Initials(str string, delimiters ...rune) string { - if str == "" { - return str - } - if delimiters != nil && len(delimiters) == 0 { - return "" - } - strLen := len(str) - var buf bytes.Buffer - lastWasGap := true - for i := 0; i < strLen; i++ { - ch := rune(str[i]) - - if isDelimiter(ch, delimiters...) { - lastWasGap = true - } else if lastWasGap { - buf.WriteRune(ch) - lastWasGap = false - } - } - return buf.String() -} - -// private function (lower case func name) -func isDelimiter(ch rune, delimiters ...rune) bool { - if delimiters == nil { - return unicode.IsSpace(ch) - } - for _, delimiter := range delimiters { - if ch == delimiter { - return true - } - } - return false -} diff --git a/vendor/github.com/Masterminds/semver/.travis.yml b/vendor/github.com/Masterminds/semver/.travis.yml deleted file mode 100644 index 096369d44..000000000 --- a/vendor/github.com/Masterminds/semver/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: go - -go: - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - 1.10.x - - 1.11.x - - 1.12.x - - tip - -# Setting sudo access to false will let Travis CI use containers rather than -# VMs to run the tests. For more details see: -# - http://docs.travis-ci.com/user/workers/container-based-infrastructure/ -# - http://docs.travis-ci.com/user/workers/standard-infrastructure/ -sudo: false - -script: - - make setup - - make test - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/06e3328629952dabe3e0 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always diff --git a/vendor/github.com/Masterminds/semver/CHANGELOG.md b/vendor/github.com/Masterminds/semver/CHANGELOG.md deleted file mode 100644 index e405c9a84..000000000 --- a/vendor/github.com/Masterminds/semver/CHANGELOG.md +++ /dev/null @@ -1,109 +0,0 @@ -# 1.5.0 (2019-09-11) - -## Added - -- #103: Add basic fuzzing for `NewVersion()` (thanks @jesse-c) - -## Changed - -- #82: Clarify wildcard meaning in range constraints and update tests for it (thanks @greysteil) -- #83: Clarify caret operator range for pre-1.0.0 dependencies (thanks @greysteil) -- #72: Adding docs comment pointing to vert for a cli -- #71: Update the docs on pre-release comparator handling -- #89: Test with new go versions (thanks @thedevsaddam) -- #87: Added $ to ValidPrerelease for better validation (thanks @jeremycarroll) - -## Fixed - -- #78: Fix unchecked error in example code (thanks @ravron) -- #70: Fix the handling of pre-releases and the 0.0.0 release edge case -- #97: Fixed copyright file for proper display on GitHub -- #107: Fix handling prerelease when sorting alphanum and num -- #109: Fixed where Validate sometimes returns wrong message on error - -# 1.4.2 (2018-04-10) - -## Changed -- #72: Updated the docs to point to vert for a console appliaction -- #71: Update the docs on pre-release comparator handling - -## Fixed -- #70: Fix the handling of pre-releases and the 0.0.0 release edge case - -# 1.4.1 (2018-04-02) - -## Fixed -- Fixed #64: Fix pre-release precedence issue (thanks @uudashr) - -# 1.4.0 (2017-10-04) - -## Changed -- #61: Update NewVersion to parse ints with a 64bit int size (thanks @zknill) - -# 1.3.1 (2017-07-10) - -## Fixed -- Fixed #57: number comparisons in prerelease sometimes inaccurate - -# 1.3.0 (2017-05-02) - -## Added -- #45: Added json (un)marshaling support (thanks @mh-cbon) -- Stability marker. See https://masterminds.github.io/stability/ - -## Fixed -- #51: Fix handling of single digit tilde constraint (thanks @dgodd) - -## Changed -- #55: The godoc icon moved from png to svg - -# 1.2.3 (2017-04-03) - -## Fixed -- #46: Fixed 0.x.x and 0.0.x in constraints being treated as * - -# Release 1.2.2 (2016-12-13) - -## Fixed -- #34: Fixed issue where hyphen range was not working with pre-release parsing. - -# Release 1.2.1 (2016-11-28) - -## Fixed -- #24: Fixed edge case issue where constraint "> 0" does not handle "0.0.1-alpha" - properly. - -# Release 1.2.0 (2016-11-04) - -## Added -- #20: Added MustParse function for versions (thanks @adamreese) -- #15: Added increment methods on versions (thanks @mh-cbon) - -## Fixed -- Issue #21: Per the SemVer spec (section 9) a pre-release is unstable and - might not satisfy the intended compatibility. The change here ignores pre-releases - on constraint checks (e.g., ~ or ^) when a pre-release is not part of the - constraint. For example, `^1.2.3` will ignore pre-releases while - `^1.2.3-alpha` will include them. - -# Release 1.1.1 (2016-06-30) - -## Changed -- Issue #9: Speed up version comparison performance (thanks @sdboyer) -- Issue #8: Added benchmarks (thanks @sdboyer) -- Updated Go Report Card URL to new location -- Updated Readme to add code snippet formatting (thanks @mh-cbon) -- Updating tagging to v[SemVer] structure for compatibility with other tools. - -# Release 1.1.0 (2016-03-11) - -- Issue #2: Implemented validation to provide reasons a versions failed a - constraint. - -# Release 1.0.1 (2015-12-31) - -- Fixed #1: * constraint failing on valid versions. - -# Release 1.0.0 (2015-10-20) - -- Initial release diff --git a/vendor/github.com/Masterminds/semver/LICENSE.txt b/vendor/github.com/Masterminds/semver/LICENSE.txt deleted file mode 100644 index 9ff7da9c4..000000000 --- a/vendor/github.com/Masterminds/semver/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2014-2019, Matt Butcher and Matt Farina - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/Masterminds/semver/Makefile b/vendor/github.com/Masterminds/semver/Makefile deleted file mode 100644 index a7a1b4e36..000000000 --- a/vendor/github.com/Masterminds/semver/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -.PHONY: setup -setup: - go get -u gopkg.in/alecthomas/gometalinter.v1 - gometalinter.v1 --install - -.PHONY: test -test: validate lint - @echo "==> Running tests" - go test -v - -.PHONY: validate -validate: - @echo "==> Running static validations" - @gometalinter.v1 \ - --disable-all \ - --enable deadcode \ - --severity deadcode:error \ - --enable gofmt \ - --enable gosimple \ - --enable ineffassign \ - --enable misspell \ - --enable vet \ - --tests \ - --vendor \ - --deadline 60s \ - ./... || exit_code=1 - -.PHONY: lint -lint: - @echo "==> Running linters" - @gometalinter.v1 \ - --disable-all \ - --enable golint \ - --vendor \ - --deadline 60s \ - ./... || : diff --git a/vendor/github.com/Masterminds/semver/README.md b/vendor/github.com/Masterminds/semver/README.md deleted file mode 100644 index 1b52d2f43..000000000 --- a/vendor/github.com/Masterminds/semver/README.md +++ /dev/null @@ -1,194 +0,0 @@ -# SemVer - -The `semver` package provides the ability to work with [Semantic Versions](http://semver.org) in Go. Specifically it provides the ability to: - -* Parse semantic versions -* Sort semantic versions -* Check if a semantic version fits within a set of constraints -* Optionally work with a `v` prefix - -[![Stability: -Active](https://masterminds.github.io/stability/active.svg)](https://masterminds.github.io/stability/active.html) -[![Build Status](https://travis-ci.org/Masterminds/semver.svg)](https://travis-ci.org/Masterminds/semver) [![Build status](https://ci.appveyor.com/api/projects/status/jfk66lib7hb985k8/branch/master?svg=true&passingText=windows%20build%20passing&failingText=windows%20build%20failing)](https://ci.appveyor.com/project/mattfarina/semver/branch/master) [![GoDoc](https://godoc.org/github.com/Masterminds/semver?status.svg)](https://godoc.org/github.com/Masterminds/semver) [![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/semver)](https://goreportcard.com/report/github.com/Masterminds/semver) - -If you are looking for a command line tool for version comparisons please see -[vert](https://github.com/Masterminds/vert) which uses this library. - -## Parsing Semantic Versions - -To parse a semantic version use the `NewVersion` function. For example, - -```go - v, err := semver.NewVersion("1.2.3-beta.1+build345") -``` - -If there is an error the version wasn't parseable. The version object has methods -to get the parts of the version, compare it to other versions, convert the -version back into a string, and get the original string. For more details -please see the [documentation](https://godoc.org/github.com/Masterminds/semver). - -## Sorting Semantic Versions - -A set of versions can be sorted using the [`sort`](https://golang.org/pkg/sort/) -package from the standard library. For example, - -```go - raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",} - vs := make([]*semver.Version, len(raw)) - for i, r := range raw { - v, err := semver.NewVersion(r) - if err != nil { - t.Errorf("Error parsing version: %s", err) - } - - vs[i] = v - } - - sort.Sort(semver.Collection(vs)) -``` - -## Checking Version Constraints - -Checking a version against version constraints is one of the most featureful -parts of the package. - -```go - c, err := semver.NewConstraint(">= 1.2.3") - if err != nil { - // Handle constraint not being parseable. - } - - v, _ := semver.NewVersion("1.3") - if err != nil { - // Handle version not being parseable. - } - // Check if the version meets the constraints. The a variable will be true. - a := c.Check(v) -``` - -## Basic Comparisons - -There are two elements to the comparisons. First, a comparison string is a list -of comma separated and comparisons. These are then separated by || separated or -comparisons. For example, `">= 1.2, < 3.0.0 || >= 4.2.3"` is looking for a -comparison that's greater than or equal to 1.2 and less than 3.0.0 or is -greater than or equal to 4.2.3. - -The basic comparisons are: - -* `=`: equal (aliased to no operator) -* `!=`: not equal -* `>`: greater than -* `<`: less than -* `>=`: greater than or equal to -* `<=`: less than or equal to - -## Working With Pre-release Versions - -Pre-releases, for those not familiar with them, are used for software releases -prior to stable or generally available releases. Examples of pre-releases include -development, alpha, beta, and release candidate releases. A pre-release may be -a version such as `1.2.3-beta.1` while the stable release would be `1.2.3`. In the -order of precidence, pre-releases come before their associated releases. In this -example `1.2.3-beta.1 < 1.2.3`. - -According to the Semantic Version specification pre-releases may not be -API compliant with their release counterpart. It says, - -> A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version. - -SemVer comparisons without a pre-release comparator will skip pre-release versions. -For example, `>=1.2.3` will skip pre-releases when looking at a list of releases -while `>=1.2.3-0` will evaluate and find pre-releases. - -The reason for the `0` as a pre-release version in the example comparison is -because pre-releases can only contain ASCII alphanumerics and hyphens (along with -`.` separators), per the spec. Sorting happens in ASCII sort order, again per the spec. The lowest character is a `0` in ASCII sort order (see an [ASCII Table](http://www.asciitable.com/)) - -Understanding ASCII sort ordering is important because A-Z comes before a-z. That -means `>=1.2.3-BETA` will return `1.2.3-alpha`. What you might expect from case -sensitivity doesn't apply here. This is due to ASCII sort ordering which is what -the spec specifies. - -## Hyphen Range Comparisons - -There are multiple methods to handle ranges and the first is hyphens ranges. -These look like: - -* `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5` -* `2.3.4 - 4.5` which is equivalent to `>= 2.3.4, <= 4.5` - -## Wildcards In Comparisons - -The `x`, `X`, and `*` characters can be used as a wildcard character. This works -for all comparison operators. When used on the `=` operator it falls -back to the pack level comparison (see tilde below). For example, - -* `1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` -* `>= 1.2.x` is equivalent to `>= 1.2.0` -* `<= 2.x` is equivalent to `< 3` -* `*` is equivalent to `>= 0.0.0` - -## Tilde Range Comparisons (Patch) - -The tilde (`~`) comparison operator is for patch level ranges when a minor -version is specified and major level changes when the minor number is missing. -For example, - -* `~1.2.3` is equivalent to `>= 1.2.3, < 1.3.0` -* `~1` is equivalent to `>= 1, < 2` -* `~2.3` is equivalent to `>= 2.3, < 2.4` -* `~1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` -* `~1.x` is equivalent to `>= 1, < 2` - -## Caret Range Comparisons (Major) - -The caret (`^`) comparison operator is for major level changes. This is useful -when comparisons of API versions as a major change is API breaking. For example, - -* `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` -* `^0.0.1` is equivalent to `>= 0.0.1, < 1.0.0` -* `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` -* `^2.3` is equivalent to `>= 2.3, < 3` -* `^2.x` is equivalent to `>= 2.0.0, < 3` - -# Validation - -In addition to testing a version against a constraint, a version can be validated -against a constraint. When validation fails a slice of errors containing why a -version didn't meet the constraint is returned. For example, - -```go - c, err := semver.NewConstraint("<= 1.2.3, >= 1.4") - if err != nil { - // Handle constraint not being parseable. - } - - v, _ := semver.NewVersion("1.3") - if err != nil { - // Handle version not being parseable. - } - - // Validate a version against a constraint. - a, msgs := c.Validate(v) - // a is false - for _, m := range msgs { - fmt.Println(m) - - // Loops over the errors which would read - // "1.3 is greater than 1.2.3" - // "1.3 is less than 1.4" - } -``` - -# Fuzzing - - [dvyukov/go-fuzz](https://github.com/dvyukov/go-fuzz) is used for fuzzing. - -1. `go-fuzz-build` -2. `go-fuzz -workdir=fuzz` - -# Contribute - -If you find an issue or want to contribute please file an [issue](https://github.com/Masterminds/semver/issues) -or [create a pull request](https://github.com/Masterminds/semver/pulls). diff --git a/vendor/github.com/Masterminds/semver/appveyor.yml b/vendor/github.com/Masterminds/semver/appveyor.yml deleted file mode 100644 index b2778df15..000000000 --- a/vendor/github.com/Masterminds/semver/appveyor.yml +++ /dev/null @@ -1,44 +0,0 @@ -version: build-{build}.{branch} - -clone_folder: C:\gopath\src\github.com\Masterminds\semver -shallow_clone: true - -environment: - GOPATH: C:\gopath - -platform: - - x64 - -install: - - go version - - go env - - go get -u gopkg.in/alecthomas/gometalinter.v1 - - set PATH=%PATH%;%GOPATH%\bin - - gometalinter.v1.exe --install - -build_script: - - go install -v ./... - -test_script: - - "gometalinter.v1 \ - --disable-all \ - --enable deadcode \ - --severity deadcode:error \ - --enable gofmt \ - --enable gosimple \ - --enable ineffassign \ - --enable misspell \ - --enable vet \ - --tests \ - --vendor \ - --deadline 60s \ - ./... || exit_code=1" - - "gometalinter.v1 \ - --disable-all \ - --enable golint \ - --vendor \ - --deadline 60s \ - ./... || :" - - go test -v - -deploy: off diff --git a/vendor/github.com/Masterminds/semver/collection.go b/vendor/github.com/Masterminds/semver/collection.go deleted file mode 100644 index a78235895..000000000 --- a/vendor/github.com/Masterminds/semver/collection.go +++ /dev/null @@ -1,24 +0,0 @@ -package semver - -// Collection is a collection of Version instances and implements the sort -// interface. See the sort package for more details. -// https://golang.org/pkg/sort/ -type Collection []*Version - -// Len returns the length of a collection. The number of Version instances -// on the slice. -func (c Collection) Len() int { - return len(c) -} - -// Less is needed for the sort interface to compare two Version objects on the -// slice. If checks if one is less than the other. -func (c Collection) Less(i, j int) bool { - return c[i].LessThan(c[j]) -} - -// Swap is needed for the sort interface to replace the Version objects -// at two different positions in the slice. -func (c Collection) Swap(i, j int) { - c[i], c[j] = c[j], c[i] -} diff --git a/vendor/github.com/Masterminds/semver/constraints.go b/vendor/github.com/Masterminds/semver/constraints.go deleted file mode 100644 index b94b93413..000000000 --- a/vendor/github.com/Masterminds/semver/constraints.go +++ /dev/null @@ -1,423 +0,0 @@ -package semver - -import ( - "errors" - "fmt" - "regexp" - "strings" -) - -// Constraints is one or more constraint that a semantic version can be -// checked against. -type Constraints struct { - constraints [][]*constraint -} - -// NewConstraint returns a Constraints instance that a Version instance can -// be checked against. If there is a parse error it will be returned. -func NewConstraint(c string) (*Constraints, error) { - - // Rewrite - ranges into a comparison operation. - c = rewriteRange(c) - - ors := strings.Split(c, "||") - or := make([][]*constraint, len(ors)) - for k, v := range ors { - cs := strings.Split(v, ",") - result := make([]*constraint, len(cs)) - for i, s := range cs { - pc, err := parseConstraint(s) - if err != nil { - return nil, err - } - - result[i] = pc - } - or[k] = result - } - - o := &Constraints{constraints: or} - return o, nil -} - -// Check tests if a version satisfies the constraints. -func (cs Constraints) Check(v *Version) bool { - // loop over the ORs and check the inner ANDs - for _, o := range cs.constraints { - joy := true - for _, c := range o { - if !c.check(v) { - joy = false - break - } - } - - if joy { - return true - } - } - - return false -} - -// Validate checks if a version satisfies a constraint. If not a slice of -// reasons for the failure are returned in addition to a bool. -func (cs Constraints) Validate(v *Version) (bool, []error) { - // loop over the ORs and check the inner ANDs - var e []error - - // Capture the prerelease message only once. When it happens the first time - // this var is marked - var prerelesase bool - for _, o := range cs.constraints { - joy := true - for _, c := range o { - // Before running the check handle the case there the version is - // a prerelease and the check is not searching for prereleases. - if c.con.pre == "" && v.pre != "" { - if !prerelesase { - em := fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - e = append(e, em) - prerelesase = true - } - joy = false - - } else { - - if !c.check(v) { - em := fmt.Errorf(c.msg, v, c.orig) - e = append(e, em) - joy = false - } - } - } - - if joy { - return true, []error{} - } - } - - return false, e -} - -var constraintOps map[string]cfunc -var constraintMsg map[string]string -var constraintRegex *regexp.Regexp - -func init() { - constraintOps = map[string]cfunc{ - "": constraintTildeOrEqual, - "=": constraintTildeOrEqual, - "!=": constraintNotEqual, - ">": constraintGreaterThan, - "<": constraintLessThan, - ">=": constraintGreaterThanEqual, - "=>": constraintGreaterThanEqual, - "<=": constraintLessThanEqual, - "=<": constraintLessThanEqual, - "~": constraintTilde, - "~>": constraintTilde, - "^": constraintCaret, - } - - constraintMsg = map[string]string{ - "": "%s is not equal to %s", - "=": "%s is not equal to %s", - "!=": "%s is equal to %s", - ">": "%s is less than or equal to %s", - "<": "%s is greater than or equal to %s", - ">=": "%s is less than %s", - "=>": "%s is less than %s", - "<=": "%s is greater than %s", - "=<": "%s is greater than %s", - "~": "%s does not have same major and minor version as %s", - "~>": "%s does not have same major and minor version as %s", - "^": "%s does not have same major version as %s", - } - - ops := make([]string, 0, len(constraintOps)) - for k := range constraintOps { - ops = append(ops, regexp.QuoteMeta(k)) - } - - constraintRegex = regexp.MustCompile(fmt.Sprintf( - `^\s*(%s)\s*(%s)\s*$`, - strings.Join(ops, "|"), - cvRegex)) - - constraintRangeRegex = regexp.MustCompile(fmt.Sprintf( - `\s*(%s)\s+-\s+(%s)\s*`, - cvRegex, cvRegex)) -} - -// An individual constraint -type constraint struct { - // The callback function for the restraint. It performs the logic for - // the constraint. - function cfunc - - msg string - - // The version used in the constraint check. For example, if a constraint - // is '<= 2.0.0' the con a version instance representing 2.0.0. - con *Version - - // The original parsed version (e.g., 4.x from != 4.x) - orig string - - // When an x is used as part of the version (e.g., 1.x) - minorDirty bool - dirty bool - patchDirty bool -} - -// Check if a version meets the constraint -func (c *constraint) check(v *Version) bool { - return c.function(v, c) -} - -type cfunc func(v *Version, c *constraint) bool - -func parseConstraint(c string) (*constraint, error) { - m := constraintRegex.FindStringSubmatch(c) - if m == nil { - return nil, fmt.Errorf("improper constraint: %s", c) - } - - ver := m[2] - orig := ver - minorDirty := false - patchDirty := false - dirty := false - if isX(m[3]) { - ver = "0.0.0" - dirty = true - } else if isX(strings.TrimPrefix(m[4], ".")) || m[4] == "" { - minorDirty = true - dirty = true - ver = fmt.Sprintf("%s.0.0%s", m[3], m[6]) - } else if isX(strings.TrimPrefix(m[5], ".")) { - dirty = true - patchDirty = true - ver = fmt.Sprintf("%s%s.0%s", m[3], m[4], m[6]) - } - - con, err := NewVersion(ver) - if err != nil { - - // The constraintRegex should catch any regex parsing errors. So, - // we should never get here. - return nil, errors.New("constraint Parser Error") - } - - cs := &constraint{ - function: constraintOps[m[1]], - msg: constraintMsg[m[1]], - con: con, - orig: orig, - minorDirty: minorDirty, - patchDirty: patchDirty, - dirty: dirty, - } - return cs, nil -} - -// Constraint functions -func constraintNotEqual(v *Version, c *constraint) bool { - if c.dirty { - - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false - } - - if c.con.Major() != v.Major() { - return true - } - if c.con.Minor() != v.Minor() && !c.minorDirty { - return true - } else if c.minorDirty { - return false - } - - return false - } - - return !v.Equal(c.con) -} - -func constraintGreaterThan(v *Version, c *constraint) bool { - - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false - } - - return v.Compare(c.con) == 1 -} - -func constraintLessThan(v *Version, c *constraint) bool { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false - } - - if !c.dirty { - return v.Compare(c.con) < 0 - } - - if v.Major() > c.con.Major() { - return false - } else if v.Minor() > c.con.Minor() && !c.minorDirty { - return false - } - - return true -} - -func constraintGreaterThanEqual(v *Version, c *constraint) bool { - - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false - } - - return v.Compare(c.con) >= 0 -} - -func constraintLessThanEqual(v *Version, c *constraint) bool { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false - } - - if !c.dirty { - return v.Compare(c.con) <= 0 - } - - if v.Major() > c.con.Major() { - return false - } else if v.Minor() > c.con.Minor() && !c.minorDirty { - return false - } - - return true -} - -// ~*, ~>* --> >= 0.0.0 (any) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0, <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0, <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0, <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3, <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0, <1.3.0 -func constraintTilde(v *Version, c *constraint) bool { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false - } - - if v.LessThan(c.con) { - return false - } - - // ~0.0.0 is a special case where all constraints are accepted. It's - // equivalent to >= 0.0.0. - if c.con.Major() == 0 && c.con.Minor() == 0 && c.con.Patch() == 0 && - !c.minorDirty && !c.patchDirty { - return true - } - - if v.Major() != c.con.Major() { - return false - } - - if v.Minor() != c.con.Minor() && !c.minorDirty { - return false - } - - return true -} - -// When there is a .x (dirty) status it automatically opts in to ~. Otherwise -// it's a straight = -func constraintTildeOrEqual(v *Version, c *constraint) bool { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false - } - - if c.dirty { - c.msg = constraintMsg["~"] - return constraintTilde(v, c) - } - - return v.Equal(c.con) -} - -// ^* --> (any) -// ^2, ^2.x, ^2.x.x --> >=2.0.0, <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0, <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0, <2.0.0 -// ^1.2.3 --> >=1.2.3, <2.0.0 -// ^1.2.0 --> >=1.2.0, <2.0.0 -func constraintCaret(v *Version, c *constraint) bool { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false - } - - if v.LessThan(c.con) { - return false - } - - if v.Major() != c.con.Major() { - return false - } - - return true -} - -var constraintRangeRegex *regexp.Regexp - -const cvRegex string = `v?([0-9|x|X|\*]+)(\.[0-9|x|X|\*]+)?(\.[0-9|x|X|\*]+)?` + - `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + - `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` - -func isX(x string) bool { - switch x { - case "x", "*", "X": - return true - default: - return false - } -} - -func rewriteRange(i string) string { - m := constraintRangeRegex.FindAllStringSubmatch(i, -1) - if m == nil { - return i - } - o := i - for _, v := range m { - t := fmt.Sprintf(">= %s, <= %s", v[1], v[11]) - o = strings.Replace(o, v[0], t, 1) - } - - return o -} diff --git a/vendor/github.com/Masterminds/semver/doc.go b/vendor/github.com/Masterminds/semver/doc.go deleted file mode 100644 index 6a6c24c6d..000000000 --- a/vendor/github.com/Masterminds/semver/doc.go +++ /dev/null @@ -1,115 +0,0 @@ -/* -Package semver provides the ability to work with Semantic Versions (http://semver.org) in Go. - -Specifically it provides the ability to: - - * Parse semantic versions - * Sort semantic versions - * Check if a semantic version fits within a set of constraints - * Optionally work with a `v` prefix - -Parsing Semantic Versions - -To parse a semantic version use the `NewVersion` function. For example, - - v, err := semver.NewVersion("1.2.3-beta.1+build345") - -If there is an error the version wasn't parseable. The version object has methods -to get the parts of the version, compare it to other versions, convert the -version back into a string, and get the original string. For more details -please see the documentation at https://godoc.org/github.com/Masterminds/semver. - -Sorting Semantic Versions - -A set of versions can be sorted using the `sort` package from the standard library. -For example, - - raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",} - vs := make([]*semver.Version, len(raw)) - for i, r := range raw { - v, err := semver.NewVersion(r) - if err != nil { - t.Errorf("Error parsing version: %s", err) - } - - vs[i] = v - } - - sort.Sort(semver.Collection(vs)) - -Checking Version Constraints - -Checking a version against version constraints is one of the most featureful -parts of the package. - - c, err := semver.NewConstraint(">= 1.2.3") - if err != nil { - // Handle constraint not being parseable. - } - - v, err := semver.NewVersion("1.3") - if err != nil { - // Handle version not being parseable. - } - // Check if the version meets the constraints. The a variable will be true. - a := c.Check(v) - -Basic Comparisons - -There are two elements to the comparisons. First, a comparison string is a list -of comma separated and comparisons. These are then separated by || separated or -comparisons. For example, `">= 1.2, < 3.0.0 || >= 4.2.3"` is looking for a -comparison that's greater than or equal to 1.2 and less than 3.0.0 or is -greater than or equal to 4.2.3. - -The basic comparisons are: - - * `=`: equal (aliased to no operator) - * `!=`: not equal - * `>`: greater than - * `<`: less than - * `>=`: greater than or equal to - * `<=`: less than or equal to - -Hyphen Range Comparisons - -There are multiple methods to handle ranges and the first is hyphens ranges. -These look like: - - * `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5` - * `2.3.4 - 4.5` which is equivalent to `>= 2.3.4, <= 4.5` - -Wildcards In Comparisons - -The `x`, `X`, and `*` characters can be used as a wildcard character. This works -for all comparison operators. When used on the `=` operator it falls -back to the pack level comparison (see tilde below). For example, - - * `1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` - * `>= 1.2.x` is equivalent to `>= 1.2.0` - * `<= 2.x` is equivalent to `<= 3` - * `*` is equivalent to `>= 0.0.0` - -Tilde Range Comparisons (Patch) - -The tilde (`~`) comparison operator is for patch level ranges when a minor -version is specified and major level changes when the minor number is missing. -For example, - - * `~1.2.3` is equivalent to `>= 1.2.3, < 1.3.0` - * `~1` is equivalent to `>= 1, < 2` - * `~2.3` is equivalent to `>= 2.3, < 2.4` - * `~1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` - * `~1.x` is equivalent to `>= 1, < 2` - -Caret Range Comparisons (Major) - -The caret (`^`) comparison operator is for major level changes. This is useful -when comparisons of API versions as a major change is API breaking. For example, - - * `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` - * `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` - * `^2.3` is equivalent to `>= 2.3, < 3` - * `^2.x` is equivalent to `>= 2.0.0, < 3` -*/ -package semver diff --git a/vendor/github.com/Masterminds/semver/version.go b/vendor/github.com/Masterminds/semver/version.go deleted file mode 100644 index 400d4f934..000000000 --- a/vendor/github.com/Masterminds/semver/version.go +++ /dev/null @@ -1,425 +0,0 @@ -package semver - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "regexp" - "strconv" - "strings" -) - -// The compiled version of the regex created at init() is cached here so it -// only needs to be created once. -var versionRegex *regexp.Regexp -var validPrereleaseRegex *regexp.Regexp - -var ( - // ErrInvalidSemVer is returned a version is found to be invalid when - // being parsed. - ErrInvalidSemVer = errors.New("Invalid Semantic Version") - - // ErrInvalidMetadata is returned when the metadata is an invalid format - ErrInvalidMetadata = errors.New("Invalid Metadata string") - - // ErrInvalidPrerelease is returned when the pre-release is an invalid format - ErrInvalidPrerelease = errors.New("Invalid Prerelease string") -) - -// SemVerRegex is the regular expression used to parse a semantic version. -const SemVerRegex string = `v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + - `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + - `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` - -// ValidPrerelease is the regular expression which validates -// both prerelease and metadata values. -const ValidPrerelease string = `^([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*)$` - -// Version represents a single semantic version. -type Version struct { - major, minor, patch int64 - pre string - metadata string - original string -} - -func init() { - versionRegex = regexp.MustCompile("^" + SemVerRegex + "$") - validPrereleaseRegex = regexp.MustCompile(ValidPrerelease) -} - -// NewVersion parses a given version and returns an instance of Version or -// an error if unable to parse the version. -func NewVersion(v string) (*Version, error) { - m := versionRegex.FindStringSubmatch(v) - if m == nil { - return nil, ErrInvalidSemVer - } - - sv := &Version{ - metadata: m[8], - pre: m[5], - original: v, - } - - var temp int64 - temp, err := strconv.ParseInt(m[1], 10, 64) - if err != nil { - return nil, fmt.Errorf("Error parsing version segment: %s", err) - } - sv.major = temp - - if m[2] != "" { - temp, err = strconv.ParseInt(strings.TrimPrefix(m[2], "."), 10, 64) - if err != nil { - return nil, fmt.Errorf("Error parsing version segment: %s", err) - } - sv.minor = temp - } else { - sv.minor = 0 - } - - if m[3] != "" { - temp, err = strconv.ParseInt(strings.TrimPrefix(m[3], "."), 10, 64) - if err != nil { - return nil, fmt.Errorf("Error parsing version segment: %s", err) - } - sv.patch = temp - } else { - sv.patch = 0 - } - - return sv, nil -} - -// MustParse parses a given version and panics on error. -func MustParse(v string) *Version { - sv, err := NewVersion(v) - if err != nil { - panic(err) - } - return sv -} - -// String converts a Version object to a string. -// Note, if the original version contained a leading v this version will not. -// See the Original() method to retrieve the original value. Semantic Versions -// don't contain a leading v per the spec. Instead it's optional on -// implementation. -func (v *Version) String() string { - var buf bytes.Buffer - - fmt.Fprintf(&buf, "%d.%d.%d", v.major, v.minor, v.patch) - if v.pre != "" { - fmt.Fprintf(&buf, "-%s", v.pre) - } - if v.metadata != "" { - fmt.Fprintf(&buf, "+%s", v.metadata) - } - - return buf.String() -} - -// Original returns the original value passed in to be parsed. -func (v *Version) Original() string { - return v.original -} - -// Major returns the major version. -func (v *Version) Major() int64 { - return v.major -} - -// Minor returns the minor version. -func (v *Version) Minor() int64 { - return v.minor -} - -// Patch returns the patch version. -func (v *Version) Patch() int64 { - return v.patch -} - -// Prerelease returns the pre-release version. -func (v *Version) Prerelease() string { - return v.pre -} - -// Metadata returns the metadata on the version. -func (v *Version) Metadata() string { - return v.metadata -} - -// originalVPrefix returns the original 'v' prefix if any. -func (v *Version) originalVPrefix() string { - - // Note, only lowercase v is supported as a prefix by the parser. - if v.original != "" && v.original[:1] == "v" { - return v.original[:1] - } - return "" -} - -// IncPatch produces the next patch version. -// If the current version does not have prerelease/metadata information, -// it unsets metadata and prerelease values, increments patch number. -// If the current version has any of prerelease or metadata information, -// it unsets both values and keeps curent patch value -func (v Version) IncPatch() Version { - vNext := v - // according to http://semver.org/#spec-item-9 - // Pre-release versions have a lower precedence than the associated normal version. - // according to http://semver.org/#spec-item-10 - // Build metadata SHOULD be ignored when determining version precedence. - if v.pre != "" { - vNext.metadata = "" - vNext.pre = "" - } else { - vNext.metadata = "" - vNext.pre = "" - vNext.patch = v.patch + 1 - } - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext -} - -// IncMinor produces the next minor version. -// Sets patch to 0. -// Increments minor number. -// Unsets metadata. -// Unsets prerelease status. -func (v Version) IncMinor() Version { - vNext := v - vNext.metadata = "" - vNext.pre = "" - vNext.patch = 0 - vNext.minor = v.minor + 1 - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext -} - -// IncMajor produces the next major version. -// Sets patch to 0. -// Sets minor to 0. -// Increments major number. -// Unsets metadata. -// Unsets prerelease status. -func (v Version) IncMajor() Version { - vNext := v - vNext.metadata = "" - vNext.pre = "" - vNext.patch = 0 - vNext.minor = 0 - vNext.major = v.major + 1 - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext -} - -// SetPrerelease defines the prerelease value. -// Value must not include the required 'hypen' prefix. -func (v Version) SetPrerelease(prerelease string) (Version, error) { - vNext := v - if len(prerelease) > 0 && !validPrereleaseRegex.MatchString(prerelease) { - return vNext, ErrInvalidPrerelease - } - vNext.pre = prerelease - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext, nil -} - -// SetMetadata defines metadata value. -// Value must not include the required 'plus' prefix. -func (v Version) SetMetadata(metadata string) (Version, error) { - vNext := v - if len(metadata) > 0 && !validPrereleaseRegex.MatchString(metadata) { - return vNext, ErrInvalidMetadata - } - vNext.metadata = metadata - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext, nil -} - -// LessThan tests if one version is less than another one. -func (v *Version) LessThan(o *Version) bool { - return v.Compare(o) < 0 -} - -// GreaterThan tests if one version is greater than another one. -func (v *Version) GreaterThan(o *Version) bool { - return v.Compare(o) > 0 -} - -// Equal tests if two versions are equal to each other. -// Note, versions can be equal with different metadata since metadata -// is not considered part of the comparable version. -func (v *Version) Equal(o *Version) bool { - return v.Compare(o) == 0 -} - -// Compare compares this version to another one. It returns -1, 0, or 1 if -// the version smaller, equal, or larger than the other version. -// -// Versions are compared by X.Y.Z. Build metadata is ignored. Prerelease is -// lower than the version without a prerelease. -func (v *Version) Compare(o *Version) int { - // Compare the major, minor, and patch version for differences. If a - // difference is found return the comparison. - if d := compareSegment(v.Major(), o.Major()); d != 0 { - return d - } - if d := compareSegment(v.Minor(), o.Minor()); d != 0 { - return d - } - if d := compareSegment(v.Patch(), o.Patch()); d != 0 { - return d - } - - // At this point the major, minor, and patch versions are the same. - ps := v.pre - po := o.Prerelease() - - if ps == "" && po == "" { - return 0 - } - if ps == "" { - return 1 - } - if po == "" { - return -1 - } - - return comparePrerelease(ps, po) -} - -// UnmarshalJSON implements JSON.Unmarshaler interface. -func (v *Version) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - temp, err := NewVersion(s) - if err != nil { - return err - } - v.major = temp.major - v.minor = temp.minor - v.patch = temp.patch - v.pre = temp.pre - v.metadata = temp.metadata - v.original = temp.original - temp = nil - return nil -} - -// MarshalJSON implements JSON.Marshaler interface. -func (v *Version) MarshalJSON() ([]byte, error) { - return json.Marshal(v.String()) -} - -func compareSegment(v, o int64) int { - if v < o { - return -1 - } - if v > o { - return 1 - } - - return 0 -} - -func comparePrerelease(v, o string) int { - - // split the prelease versions by their part. The separator, per the spec, - // is a . - sparts := strings.Split(v, ".") - oparts := strings.Split(o, ".") - - // Find the longer length of the parts to know how many loop iterations to - // go through. - slen := len(sparts) - olen := len(oparts) - - l := slen - if olen > slen { - l = olen - } - - // Iterate over each part of the prereleases to compare the differences. - for i := 0; i < l; i++ { - // Since the lentgh of the parts can be different we need to create - // a placeholder. This is to avoid out of bounds issues. - stemp := "" - if i < slen { - stemp = sparts[i] - } - - otemp := "" - if i < olen { - otemp = oparts[i] - } - - d := comparePrePart(stemp, otemp) - if d != 0 { - return d - } - } - - // Reaching here means two versions are of equal value but have different - // metadata (the part following a +). They are not identical in string form - // but the version comparison finds them to be equal. - return 0 -} - -func comparePrePart(s, o string) int { - // Fastpath if they are equal - if s == o { - return 0 - } - - // When s or o are empty we can use the other in an attempt to determine - // the response. - if s == "" { - if o != "" { - return -1 - } - return 1 - } - - if o == "" { - if s != "" { - return 1 - } - return -1 - } - - // When comparing strings "99" is greater than "103". To handle - // cases like this we need to detect numbers and compare them. According - // to the semver spec, numbers are always positive. If there is a - at the - // start like -99 this is to be evaluated as an alphanum. numbers always - // have precedence over alphanum. Parsing as Uints because negative numbers - // are ignored. - - oi, n1 := strconv.ParseUint(o, 10, 64) - si, n2 := strconv.ParseUint(s, 10, 64) - - // The case where both are strings compare the strings - if n1 != nil && n2 != nil { - if s > o { - return 1 - } - return -1 - } else if n1 != nil { - // o is a string and s is a number - return -1 - } else if n2 != nil { - // s is a string and o is a number - return 1 - } - // Both are numbers - if si > oi { - return 1 - } - return -1 - -} diff --git a/vendor/github.com/Masterminds/semver/version_fuzz.go b/vendor/github.com/Masterminds/semver/version_fuzz.go deleted file mode 100644 index b42bcd62b..000000000 --- a/vendor/github.com/Masterminds/semver/version_fuzz.go +++ /dev/null @@ -1,10 +0,0 @@ -// +build gofuzz - -package semver - -func Fuzz(data []byte) int { - if _, err := NewVersion(string(data)); err != nil { - return 0 - } - return 1 -} diff --git a/vendor/github.com/cenkalti/backoff/v4/README.md b/vendor/github.com/cenkalti/backoff/v4/README.md index 16abdfc08..9433004a2 100644 --- a/vendor/github.com/cenkalti/backoff/v4/README.md +++ b/vendor/github.com/cenkalti/backoff/v4/README.md @@ -1,4 +1,4 @@ -# Exponential Backoff [![GoDoc][godoc image]][godoc] [![Build Status][travis image]][travis] [![Coverage Status][coveralls image]][coveralls] +# Exponential Backoff [![GoDoc][godoc image]][godoc] [![Coverage Status][coveralls image]][coveralls] This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client]. @@ -21,8 +21,6 @@ Use https://pkg.go.dev/github.com/cenkalti/backoff/v4 to view the documentation. [godoc]: https://pkg.go.dev/github.com/cenkalti/backoff/v4 [godoc image]: https://godoc.org/github.com/cenkalti/backoff?status.png -[travis]: https://travis-ci.org/cenkalti/backoff -[travis image]: https://travis-ci.org/cenkalti/backoff.png?branch=master [coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master [coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master diff --git a/vendor/github.com/cenkalti/backoff/v4/exponential.go b/vendor/github.com/cenkalti/backoff/v4/exponential.go index 2c56c1e71..aac99f196 100644 --- a/vendor/github.com/cenkalti/backoff/v4/exponential.go +++ b/vendor/github.com/cenkalti/backoff/v4/exponential.go @@ -71,6 +71,9 @@ type Clock interface { Now() time.Time } +// ExponentialBackOffOpts is a function type used to configure ExponentialBackOff options. +type ExponentialBackOffOpts func(*ExponentialBackOff) + // Default values for ExponentialBackOff. const ( DefaultInitialInterval = 500 * time.Millisecond @@ -81,7 +84,7 @@ const ( ) // NewExponentialBackOff creates an instance of ExponentialBackOff using default values. -func NewExponentialBackOff() *ExponentialBackOff { +func NewExponentialBackOff(opts ...ExponentialBackOffOpts) *ExponentialBackOff { b := &ExponentialBackOff{ InitialInterval: DefaultInitialInterval, RandomizationFactor: DefaultRandomizationFactor, @@ -91,10 +94,62 @@ func NewExponentialBackOff() *ExponentialBackOff { Stop: Stop, Clock: SystemClock, } + for _, fn := range opts { + fn(b) + } b.Reset() return b } +// WithInitialInterval sets the initial interval between retries. +func WithInitialInterval(duration time.Duration) ExponentialBackOffOpts { + return func(ebo *ExponentialBackOff) { + ebo.InitialInterval = duration + } +} + +// WithRandomizationFactor sets the randomization factor to add jitter to intervals. +func WithRandomizationFactor(randomizationFactor float64) ExponentialBackOffOpts { + return func(ebo *ExponentialBackOff) { + ebo.RandomizationFactor = randomizationFactor + } +} + +// WithMultiplier sets the multiplier for increasing the interval after each retry. +func WithMultiplier(multiplier float64) ExponentialBackOffOpts { + return func(ebo *ExponentialBackOff) { + ebo.Multiplier = multiplier + } +} + +// WithMaxInterval sets the maximum interval between retries. +func WithMaxInterval(duration time.Duration) ExponentialBackOffOpts { + return func(ebo *ExponentialBackOff) { + ebo.MaxInterval = duration + } +} + +// WithMaxElapsedTime sets the maximum total time for retries. +func WithMaxElapsedTime(duration time.Duration) ExponentialBackOffOpts { + return func(ebo *ExponentialBackOff) { + ebo.MaxElapsedTime = duration + } +} + +// WithRetryStopDuration sets the duration after which retries should stop. +func WithRetryStopDuration(duration time.Duration) ExponentialBackOffOpts { + return func(ebo *ExponentialBackOff) { + ebo.Stop = duration + } +} + +// WithClockProvider sets the clock used to measure time. +func WithClockProvider(clock Clock) ExponentialBackOffOpts { + return func(ebo *ExponentialBackOff) { + ebo.Clock = clock + } +} + type systemClock struct{} func (t systemClock) Now() time.Time { diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md index 8bf0e5b78..33c88305c 100644 --- a/vendor/github.com/cespare/xxhash/v2/README.md +++ b/vendor/github.com/cespare/xxhash/v2/README.md @@ -70,3 +70,5 @@ benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$') - [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) - [FreeCache](https://github.com/coocood/freecache) - [FastCache](https://github.com/VictoriaMetrics/fastcache) +- [Ristretto](https://github.com/dgraph-io/ristretto) +- [Badger](https://github.com/dgraph-io/badger) diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go index a9e0d45c9..78bddf1ce 100644 --- a/vendor/github.com/cespare/xxhash/v2/xxhash.go +++ b/vendor/github.com/cespare/xxhash/v2/xxhash.go @@ -19,10 +19,13 @@ const ( // Store the primes in an array as well. // // The consts are used when possible in Go code to avoid MOVs but we need a -// contiguous array of the assembly code. +// contiguous array for the assembly code. var primes = [...]uint64{prime1, prime2, prime3, prime4, prime5} // Digest implements hash.Hash64. +// +// Note that a zero-valued Digest is not ready to receive writes. +// Call Reset or create a Digest using New before calling other methods. type Digest struct { v1 uint64 v2 uint64 @@ -33,19 +36,31 @@ type Digest struct { n int // how much of mem is used } -// New creates a new Digest that computes the 64-bit xxHash algorithm. +// New creates a new Digest with a zero seed. func New() *Digest { + return NewWithSeed(0) +} + +// NewWithSeed creates a new Digest with the given seed. +func NewWithSeed(seed uint64) *Digest { var d Digest - d.Reset() + d.ResetWithSeed(seed) return &d } // Reset clears the Digest's state so that it can be reused. +// It uses a seed value of zero. func (d *Digest) Reset() { - d.v1 = primes[0] + prime2 - d.v2 = prime2 - d.v3 = 0 - d.v4 = -primes[0] + d.ResetWithSeed(0) +} + +// ResetWithSeed clears the Digest's state so that it can be reused. +// It uses the given seed to initialize the state. +func (d *Digest) ResetWithSeed(seed uint64) { + d.v1 = seed + prime1 + prime2 + d.v2 = seed + prime2 + d.v3 = seed + d.v4 = seed - prime1 d.total = 0 d.n = 0 } diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go b/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go index 9216e0a40..78f95f256 100644 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go @@ -6,7 +6,7 @@ package xxhash -// Sum64 computes the 64-bit xxHash digest of b. +// Sum64 computes the 64-bit xxHash digest of b with a zero seed. // //go:noescape func Sum64(b []byte) uint64 diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go index 26df13bba..118e49e81 100644 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go @@ -3,7 +3,7 @@ package xxhash -// Sum64 computes the 64-bit xxHash digest of b. +// Sum64 computes the 64-bit xxHash digest of b with a zero seed. func Sum64(b []byte) uint64 { // A simpler version would be // d := New() diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go index e86f1b5fd..05f5e7dfe 100644 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go @@ -5,7 +5,7 @@ package xxhash -// Sum64String computes the 64-bit xxHash digest of s. +// Sum64String computes the 64-bit xxHash digest of s with a zero seed. func Sum64String(s string) uint64 { return Sum64([]byte(s)) } diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go index 1c1638fd8..cf9d42aed 100644 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go @@ -33,7 +33,7 @@ import ( // // See https://github.com/golang/go/issues/42739 for discussion. -// Sum64String computes the 64-bit xxHash digest of s. +// Sum64String computes the 64-bit xxHash digest of s with a zero seed. // It may be faster than Sum64([]byte(s)) by avoiding a copy. func Sum64String(s string) uint64 { b := *(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)})) diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md index 8969526a6..7c7f0c69c 100644 --- a/vendor/github.com/go-logr/logr/README.md +++ b/vendor/github.com/go-logr/logr/README.md @@ -1,6 +1,7 @@ # A minimal logging API for Go [![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/logr.svg)](https://pkg.go.dev/github.com/go-logr/logr) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-logr/logr)](https://goreportcard.com/report/github.com/go-logr/logr) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/go-logr/logr/badge)](https://securityscorecards.dev/viewer/?platform=github.com&org=go-logr&repo=logr) logr offers an(other) opinion on how Go programs and libraries can do logging diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go index fb2f866f4..30568e768 100644 --- a/vendor/github.com/go-logr/logr/funcr/funcr.go +++ b/vendor/github.com/go-logr/logr/funcr/funcr.go @@ -236,15 +236,14 @@ func newFormatter(opts Options, outfmt outputFormat) Formatter { // implementation. It should be constructed with NewFormatter. Some of // its methods directly implement logr.LogSink. type Formatter struct { - outputFormat outputFormat - prefix string - values []any - valuesStr string - parentValuesStr string - depth int - opts *Options - group string // for slog groups - groupDepth int + outputFormat outputFormat + prefix string + values []any + valuesStr string + depth int + opts *Options + groupName string // for slog groups + groups []groupDef } // outputFormat indicates which outputFormat to use. @@ -257,6 +256,13 @@ const ( outputJSON ) +// groupDef represents a saved group. The values may be empty, but we don't +// know if we need to render the group until the final record is rendered. +type groupDef struct { + name string + values string +} + // PseudoStruct is a list of key-value pairs that gets logged as a struct. type PseudoStruct []any @@ -264,76 +270,102 @@ type PseudoStruct []any func (f Formatter) render(builtins, args []any) string { // Empirically bytes.Buffer is faster than strings.Builder for this. buf := bytes.NewBuffer(make([]byte, 0, 1024)) + if f.outputFormat == outputJSON { - buf.WriteByte('{') // for the whole line + buf.WriteByte('{') // for the whole record } + // Render builtins vals := builtins if hook := f.opts.RenderBuiltinsHook; hook != nil { vals = hook(f.sanitize(vals)) } - f.flatten(buf, vals, false, false) // keys are ours, no need to escape + f.flatten(buf, vals, false) // keys are ours, no need to escape continuing := len(builtins) > 0 - if f.parentValuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) + // Turn the inner-most group into a string + argsStr := func() string { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + vals = args + if hook := f.opts.RenderArgsHook; hook != nil { + vals = hook(f.sanitize(vals)) } - buf.WriteString(f.parentValuesStr) - continuing = true - } + f.flatten(buf, vals, true) // escape user-provided keys - groupDepth := f.groupDepth - if f.group != "" { - if f.valuesStr != "" || len(args) != 0 { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys - buf.WriteByte(f.colon()) - buf.WriteByte('{') // for the group - continuing = false - } else { - // The group was empty - groupDepth-- + return buf.String() + }() + + // Render the stack of groups from the inside out. + bodyStr := f.renderGroup(f.groupName, f.valuesStr, argsStr) + for i := len(f.groups) - 1; i >= 0; i-- { + grp := &f.groups[i] + if grp.values == "" && bodyStr == "" { + // no contents, so we must elide the whole group + continue } + bodyStr = f.renderGroup(grp.name, grp.values, bodyStr) } - if f.valuesStr != "" { + if bodyStr != "" { if continuing { buf.WriteByte(f.comma()) } - buf.WriteString(f.valuesStr) - continuing = true + buf.WriteString(bodyStr) } - vals = args - if hook := f.opts.RenderArgsHook; hook != nil { - vals = hook(f.sanitize(vals)) + if f.outputFormat == outputJSON { + buf.WriteByte('}') // for the whole record } - f.flatten(buf, vals, continuing, true) // escape user-provided keys - for i := 0; i < groupDepth; i++ { - buf.WriteByte('}') // for the groups + return buf.String() +} + +// renderGroup returns a string representation of the named group with rendered +// values and args. If the name is empty, this will return the values and args, +// joined. If the name is not empty, this will return a single key-value pair, +// where the value is a grouping of the values and args. If the values and +// args are both empty, this will return an empty string, even if the name was +// specified. +func (f Formatter) renderGroup(name string, values string, args string) string { + buf := bytes.NewBuffer(make([]byte, 0, 1024)) + + needClosingBrace := false + if name != "" && (values != "" || args != "") { + buf.WriteString(f.quoted(name, true)) // escape user-provided keys + buf.WriteByte(f.colon()) + buf.WriteByte('{') + needClosingBrace = true } - if f.outputFormat == outputJSON { - buf.WriteByte('}') // for the whole line + continuing := false + if values != "" { + buf.WriteString(values) + continuing = true + } + + if args != "" { + if continuing { + buf.WriteByte(f.comma()) + } + buf.WriteString(args) + } + + if needClosingBrace { + buf.WriteByte('}') } return buf.String() } -// flatten renders a list of key-value pairs into a buffer. If continuing is -// true, it assumes that the buffer has previous values and will emit a -// separator (which depends on the output format) before the first pair it -// writes. If escapeKeys is true, the keys are assumed to have -// non-JSON-compatible characters in them and must be evaluated for escapes. +// flatten renders a list of key-value pairs into a buffer. If escapeKeys is +// true, the keys are assumed to have non-JSON-compatible characters in them +// and must be evaluated for escapes. // // This function returns a potentially modified version of kvList, which // ensures that there is a value for every key (adding a value if needed) and // that each key is a string (substituting a key if needed). -func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, escapeKeys bool) []any { +func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, escapeKeys bool) []any { // This logic overlaps with sanitize() but saves one type-cast per key, // which can be measurable. if len(kvList)%2 != 0 { @@ -354,7 +386,7 @@ func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, esc } v := kvList[i+1] - if i > 0 || continuing { + if i > 0 { if f.outputFormat == outputJSON { buf.WriteByte(f.comma()) } else { @@ -766,46 +798,17 @@ func (f Formatter) sanitize(kvList []any) []any { // startGroup opens a new group scope (basically a sub-struct), which locks all // the current saved values and starts them anew. This is needed to satisfy // slog. -func (f *Formatter) startGroup(group string) { +func (f *Formatter) startGroup(name string) { // Unnamed groups are just inlined. - if group == "" { + if name == "" { return } - // Any saved values can no longer be changed. - buf := bytes.NewBuffer(make([]byte, 0, 1024)) - continuing := false - - if f.parentValuesStr != "" { - buf.WriteString(f.parentValuesStr) - continuing = true - } - - if f.group != "" && f.valuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.quoted(f.group, true)) // escape user-provided keys - buf.WriteByte(f.colon()) - buf.WriteByte('{') // for the group - continuing = false - } - - if f.valuesStr != "" { - if continuing { - buf.WriteByte(f.comma()) - } - buf.WriteString(f.valuesStr) - } - - // NOTE: We don't close the scope here - that's done later, when a log line - // is actually rendered (because we have N scopes to close). - - f.parentValuesStr = buf.String() + n := len(f.groups) + f.groups = append(f.groups[:n:n], groupDef{f.groupName, f.valuesStr}) // Start collecting new values. - f.group = group - f.groupDepth++ + f.groupName = name f.valuesStr = "" f.values = nil } @@ -900,7 +903,7 @@ func (f *Formatter) AddValues(kvList []any) { // Pre-render values, so we don't have to do it on each Info/Error call. buf := bytes.NewBuffer(make([]byte, 0, 1024)) - f.flatten(buf, vals, false, true) // escape user-provided keys + f.flatten(buf, vals, true) // escape user-provided keys f.valuesStr = buf.String() } diff --git a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml new file mode 100644 index 000000000..22f8d21cc --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml @@ -0,0 +1,61 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 3 + +linters: + enable-all: true + disable: + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort + - exhaustruct + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam + - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint + - nosnakecase diff --git a/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md index 813788aff..0108f1d57 100644 --- a/vendor/github.com/go-openapi/jsonpointer/README.md +++ b/vendor/github.com/go-openapi/jsonpointer/README.md @@ -1,6 +1,10 @@ -# gojsonpointer [![Build Status](https://travis-ci.org/go-openapi/jsonpointer.svg?branch=master)](https://travis-ci.org/go-openapi/jsonpointer) [![codecov](https://codecov.io/gh/go-openapi/jsonpointer/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonpointer) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +# gojsonpointer [![Build Status](https://github.com/go-openapi/jsonpointer/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/jsonpointer/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/jsonpointer/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonpointer) + +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/jsonpointer.svg)](https://pkg.go.dev/github.com/go-openapi/jsonpointer) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/jsonpointer)](https://goreportcard.com/report/github.com/go-openapi/jsonpointer) -[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonpointer?status.svg)](http://godoc.org/github.com/go-openapi/jsonpointer) An implementation of JSON Pointer - Go language ## Status diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go index 7df9853de..d970c7cf4 100644 --- a/vendor/github.com/go-openapi/jsonpointer/pointer.go +++ b/vendor/github.com/go-openapi/jsonpointer/pointer.go @@ -26,6 +26,7 @@ package jsonpointer import ( + "encoding/json" "errors" "fmt" "reflect" @@ -40,6 +41,7 @@ const ( pointerSeparator = `/` invalidStart = `JSON pointer must be empty or start with a "` + pointerSeparator + notFound = `Can't find the pointer in the document` ) var jsonPointableType = reflect.TypeOf(new(JSONPointable)).Elem() @@ -48,13 +50,13 @@ var jsonSetableType = reflect.TypeOf(new(JSONSetable)).Elem() // JSONPointable is an interface for structs to implement when they need to customize the // json pointer process type JSONPointable interface { - JSONLookup(string) (interface{}, error) + JSONLookup(string) (any, error) } // JSONSetable is an interface for structs to implement when they need to customize the // json pointer process type JSONSetable interface { - JSONSet(string, interface{}) error + JSONSet(string, any) error } // New creates a new json pointer for the given string @@ -81,9 +83,7 @@ func (p *Pointer) parse(jsonPointerString string) error { err = errors.New(invalidStart) } else { referenceTokens := strings.Split(jsonPointerString, pointerSeparator) - for _, referenceToken := range referenceTokens[1:] { - p.referenceTokens = append(p.referenceTokens, referenceToken) - } + p.referenceTokens = append(p.referenceTokens, referenceTokens[1:]...) } } @@ -91,38 +91,58 @@ func (p *Pointer) parse(jsonPointerString string) error { } // Get uses the pointer to retrieve a value from a JSON document -func (p *Pointer) Get(document interface{}) (interface{}, reflect.Kind, error) { +func (p *Pointer) Get(document any) (any, reflect.Kind, error) { return p.get(document, swag.DefaultJSONNameProvider) } // Set uses the pointer to set a value from a JSON document -func (p *Pointer) Set(document interface{}, value interface{}) (interface{}, error) { +func (p *Pointer) Set(document any, value any) (any, error) { return document, p.set(document, value, swag.DefaultJSONNameProvider) } // GetForToken gets a value for a json pointer token 1 level deep -func GetForToken(document interface{}, decodedToken string) (interface{}, reflect.Kind, error) { +func GetForToken(document any, decodedToken string) (any, reflect.Kind, error) { return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider) } // SetForToken gets a value for a json pointer token 1 level deep -func SetForToken(document interface{}, decodedToken string, value interface{}) (interface{}, error) { +func SetForToken(document any, decodedToken string, value any) (any, error) { return document, setSingleImpl(document, value, decodedToken, swag.DefaultJSONNameProvider) } -func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) { +func isNil(input any) bool { + if input == nil { + return true + } + + kind := reflect.TypeOf(input).Kind() + switch kind { //nolint:exhaustive + case reflect.Ptr, reflect.Map, reflect.Slice, reflect.Chan: + return reflect.ValueOf(input).IsNil() + default: + return false + } +} + +func getSingleImpl(node any, decodedToken string, nameProvider *swag.NameProvider) (any, reflect.Kind, error) { rValue := reflect.Indirect(reflect.ValueOf(node)) kind := rValue.Kind() + if isNil(node) { + return nil, kind, fmt.Errorf("nil value has not field %q", decodedToken) + } - if rValue.Type().Implements(jsonPointableType) { - r, err := node.(JSONPointable).JSONLookup(decodedToken) + switch typed := node.(type) { + case JSONPointable: + r, err := typed.JSONLookup(decodedToken) if err != nil { return nil, kind, err } return r, kind, nil + case *any: // case of a pointer to interface, that is not resolved by reflect.Indirect + return getSingleImpl(*typed, decodedToken, nameProvider) } - switch kind { + switch kind { //nolint:exhaustive case reflect.Struct: nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) if !ok { @@ -159,7 +179,7 @@ func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.Nam } -func setSingleImpl(node, data interface{}, decodedToken string, nameProvider *swag.NameProvider) error { +func setSingleImpl(node, data any, decodedToken string, nameProvider *swag.NameProvider) error { rValue := reflect.Indirect(reflect.ValueOf(node)) if ns, ok := node.(JSONSetable); ok { // pointer impl @@ -170,7 +190,7 @@ func setSingleImpl(node, data interface{}, decodedToken string, nameProvider *sw return node.(JSONSetable).JSONSet(decodedToken, data) } - switch rValue.Kind() { + switch rValue.Kind() { //nolint:exhaustive case reflect.Struct: nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) if !ok { @@ -210,7 +230,7 @@ func setSingleImpl(node, data interface{}, decodedToken string, nameProvider *sw } -func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) { +func (p *Pointer) get(node any, nameProvider *swag.NameProvider) (any, reflect.Kind, error) { if nameProvider == nil { nameProvider = swag.DefaultJSONNameProvider @@ -231,8 +251,7 @@ func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interf if err != nil { return nil, knd, err } - node, kind = r, knd - + node = r } rValue := reflect.ValueOf(node) @@ -241,11 +260,11 @@ func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interf return node, kind, nil } -func (p *Pointer) set(node, data interface{}, nameProvider *swag.NameProvider) error { +func (p *Pointer) set(node, data any, nameProvider *swag.NameProvider) error { knd := reflect.ValueOf(node).Kind() if knd != reflect.Ptr && knd != reflect.Struct && knd != reflect.Map && knd != reflect.Slice && knd != reflect.Array { - return fmt.Errorf("only structs, pointers, maps and slices are supported for setting values") + return errors.New("only structs, pointers, maps and slices are supported for setting values") } if nameProvider == nil { @@ -284,7 +303,7 @@ func (p *Pointer) set(node, data interface{}, nameProvider *swag.NameProvider) e continue } - switch kind { + switch kind { //nolint:exhaustive case reflect.Struct: nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) if !ok { @@ -363,6 +382,128 @@ func (p *Pointer) String() string { return pointerString } +func (p *Pointer) Offset(document string) (int64, error) { + dec := json.NewDecoder(strings.NewReader(document)) + var offset int64 + for _, ttk := range p.DecodedTokens() { + tk, err := dec.Token() + if err != nil { + return 0, err + } + switch tk := tk.(type) { + case json.Delim: + switch tk { + case '{': + offset, err = offsetSingleObject(dec, ttk) + if err != nil { + return 0, err + } + case '[': + offset, err = offsetSingleArray(dec, ttk) + if err != nil { + return 0, err + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + } + return offset, nil +} + +func offsetSingleObject(dec *json.Decoder, decodedToken string) (int64, error) { + for dec.More() { + offset := dec.InputOffset() + tk, err := dec.Token() + if err != nil { + return 0, err + } + switch tk := tk.(type) { + case json.Delim: + switch tk { + case '{': + if err = drainSingle(dec); err != nil { + return 0, err + } + case '[': + if err = drainSingle(dec); err != nil { + return 0, err + } + } + case string: + if tk == decodedToken { + return offset, nil + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + } + return 0, fmt.Errorf("token reference %q not found", decodedToken) +} + +func offsetSingleArray(dec *json.Decoder, decodedToken string) (int64, error) { + idx, err := strconv.Atoi(decodedToken) + if err != nil { + return 0, fmt.Errorf("token reference %q is not a number: %v", decodedToken, err) + } + var i int + for i = 0; i < idx && dec.More(); i++ { + tk, err := dec.Token() + if err != nil { + return 0, err + } + + if delim, isDelim := tk.(json.Delim); isDelim { + switch delim { + case '{': + if err = drainSingle(dec); err != nil { + return 0, err + } + case '[': + if err = drainSingle(dec); err != nil { + return 0, err + } + } + } + } + + if !dec.More() { + return 0, fmt.Errorf("token reference %q not found", decodedToken) + } + return dec.InputOffset(), nil +} + +// drainSingle drains a single level of object or array. +// The decoder has to guarantee the beginning delim (i.e. '{' or '[') has been consumed. +func drainSingle(dec *json.Decoder) error { + for dec.More() { + tk, err := dec.Token() + if err != nil { + return err + } + if delim, isDelim := tk.(json.Delim); isDelim { + switch delim { + case '{': + if err = drainSingle(dec); err != nil { + return err + } + case '[': + if err = drainSingle(dec); err != nil { + return err + } + } + } + } + + // Consumes the ending delim + if _, err := dec.Token(); err != nil { + return err + } + return nil +} + // Specific JSON pointer encoding here // ~0 => ~ // ~1 => / @@ -377,14 +518,14 @@ const ( // Unescape unescapes a json pointer reference token string to the original representation func Unescape(token string) string { - step1 := strings.Replace(token, encRefTok1, decRefTok1, -1) - step2 := strings.Replace(step1, encRefTok0, decRefTok0, -1) + step1 := strings.ReplaceAll(token, encRefTok1, decRefTok1) + step2 := strings.ReplaceAll(step1, encRefTok0, decRefTok0) return step2 } // Escape escapes a pointer reference token string func Escape(token string) string { - step1 := strings.Replace(token, decRefTok0, encRefTok0, -1) - step2 := strings.Replace(step1, decRefTok1, encRefTok1, -1) + step1 := strings.ReplaceAll(token, decRefTok0, encRefTok0) + step2 := strings.ReplaceAll(step1, decRefTok1, encRefTok1) return step2 } diff --git a/vendor/github.com/go-openapi/swag/.gitignore b/vendor/github.com/go-openapi/swag/.gitignore index d69b53acc..c4b1b64f0 100644 --- a/vendor/github.com/go-openapi/swag/.gitignore +++ b/vendor/github.com/go-openapi/swag/.gitignore @@ -2,3 +2,4 @@ secrets.yml vendor Godeps .idea +*.out diff --git a/vendor/github.com/go-openapi/swag/.golangci.yml b/vendor/github.com/go-openapi/swag/.golangci.yml index bf503e400..80e2be004 100644 --- a/vendor/github.com/go-openapi/swag/.golangci.yml +++ b/vendor/github.com/go-openapi/swag/.golangci.yml @@ -4,14 +4,14 @@ linters-settings: golint: min-confidence: 0 gocyclo: - min-complexity: 25 + min-complexity: 45 maligned: suggest-new: true dupl: - threshold: 100 + threshold: 200 goconst: min-len: 3 - min-occurrences: 2 + min-occurrences: 3 linters: enable-all: true @@ -20,35 +20,41 @@ linters: - lll - gochecknoinits - gochecknoglobals - - nlreturn - - testpackage + - funlen + - godox + - gocognit + - whitespace + - wsl - wrapcheck + - testpackage + - nlreturn - gomnd - - exhaustive - exhaustivestruct - goerr113 - - wsl - - whitespace - - gofumpt - - godot + - errorlint - nestif - - godox - - funlen - - gci - - gocognit + - godot + - gofumpt - paralleltest + - tparallel - thelper - ifshort - - gomoddirectives - - cyclop - - forcetypeassert - - ireturn - - tagliatelle - - varnamelen - - goimports - - tenv - - golint - exhaustruct - - nilnil + - varnamelen + - gci + - depguard + - errchkjson + - inamedparam - nonamedreturns + - musttag + - ireturn + - forcetypeassert + - cyclop + # deprecated linters + - deadcode + - interfacer + - scopelint + - varcheck + - structcheck + - golint - nosnakecase diff --git a/vendor/github.com/go-openapi/swag/BENCHMARK.md b/vendor/github.com/go-openapi/swag/BENCHMARK.md new file mode 100644 index 000000000..e7f28ed6b --- /dev/null +++ b/vendor/github.com/go-openapi/swag/BENCHMARK.md @@ -0,0 +1,52 @@ +# Benchmarks + +## Name mangling utilities + +```bash +go test -bench XXX -run XXX -benchtime 30s +``` + +### Benchmarks at b3e7a5386f996177e4808f11acb2aa93a0f660df + +``` +goos: linux +goarch: amd64 +pkg: github.com/go-openapi/swag +cpu: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz +BenchmarkToXXXName/ToGoName-4 862623 44101 ns/op 10450 B/op 732 allocs/op +BenchmarkToXXXName/ToVarName-4 853656 40728 ns/op 10468 B/op 734 allocs/op +BenchmarkToXXXName/ToFileName-4 1268312 27813 ns/op 9785 B/op 617 allocs/op +BenchmarkToXXXName/ToCommandName-4 1276322 27903 ns/op 9785 B/op 617 allocs/op +BenchmarkToXXXName/ToHumanNameLower-4 895334 40354 ns/op 10472 B/op 731 allocs/op +BenchmarkToXXXName/ToHumanNameTitle-4 882441 40678 ns/op 10566 B/op 749 allocs/op +``` + +### Benchmarks after PR #79 + +~ x10 performance improvement and ~ /100 memory allocations. + +``` +goos: linux +goarch: amd64 +pkg: github.com/go-openapi/swag +cpu: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz +BenchmarkToXXXName/ToGoName-4 9595830 3991 ns/op 42 B/op 5 allocs/op +BenchmarkToXXXName/ToVarName-4 9194276 3984 ns/op 62 B/op 7 allocs/op +BenchmarkToXXXName/ToFileName-4 17002711 2123 ns/op 147 B/op 7 allocs/op +BenchmarkToXXXName/ToCommandName-4 16772926 2111 ns/op 147 B/op 7 allocs/op +BenchmarkToXXXName/ToHumanNameLower-4 9788331 3749 ns/op 92 B/op 6 allocs/op +BenchmarkToXXXName/ToHumanNameTitle-4 9188260 3941 ns/op 104 B/op 6 allocs/op +``` + +``` +goos: linux +goarch: amd64 +pkg: github.com/go-openapi/swag +cpu: AMD Ryzen 7 5800X 8-Core Processor +BenchmarkToXXXName/ToGoName-16 18527378 1972 ns/op 42 B/op 5 allocs/op +BenchmarkToXXXName/ToVarName-16 15552692 2093 ns/op 62 B/op 7 allocs/op +BenchmarkToXXXName/ToFileName-16 32161176 1117 ns/op 147 B/op 7 allocs/op +BenchmarkToXXXName/ToCommandName-16 32256634 1137 ns/op 147 B/op 7 allocs/op +BenchmarkToXXXName/ToHumanNameLower-16 18599661 1946 ns/op 92 B/op 6 allocs/op +BenchmarkToXXXName/ToHumanNameTitle-16 17581353 2054 ns/op 105 B/op 6 allocs/op +``` diff --git a/vendor/github.com/go-openapi/swag/README.md b/vendor/github.com/go-openapi/swag/README.md index 217f6fa50..a72922299 100644 --- a/vendor/github.com/go-openapi/swag/README.md +++ b/vendor/github.com/go-openapi/swag/README.md @@ -1,7 +1,8 @@ -# Swag [![Build Status](https://travis-ci.org/go-openapi/swag.svg?branch=master)](https://travis-ci.org/go-openapi/swag) [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +# Swag [![Build Status](https://github.com/go-openapi/swag/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/swag/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag) +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) [![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/swag/master/LICENSE) -[![GoDoc](https://godoc.org/github.com/go-openapi/swag?status.svg)](http://godoc.org/github.com/go-openapi/swag) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/swag.svg)](https://pkg.go.dev/github.com/go-openapi/swag) [![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/swag)](https://goreportcard.com/report/github.com/go-openapi/swag) Contains a bunch of helper functions for go-openapi and go-swagger projects. @@ -18,4 +19,5 @@ You may also use it standalone for your projects. This repo has only few dependencies outside of the standard library: -* YAML utilities depend on gopkg.in/yaml.v2 +* YAML utilities depend on `gopkg.in/yaml.v3` +* `github.com/mailru/easyjson v0.7.7` diff --git a/vendor/github.com/go-openapi/swag/initialism_index.go b/vendor/github.com/go-openapi/swag/initialism_index.go new file mode 100644 index 000000000..20a359bb6 --- /dev/null +++ b/vendor/github.com/go-openapi/swag/initialism_index.go @@ -0,0 +1,202 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package swag + +import ( + "sort" + "strings" + "sync" +) + +var ( + // commonInitialisms are common acronyms that are kept as whole uppercased words. + commonInitialisms *indexOfInitialisms + + // initialisms is a slice of sorted initialisms + initialisms []string + + // a copy of initialisms pre-baked as []rune + initialismsRunes [][]rune + initialismsUpperCased [][]rune + + isInitialism func(string) bool + + maxAllocMatches int +) + +func init() { + // Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769 + configuredInitialisms := map[string]bool{ + "ACL": true, + "API": true, + "ASCII": true, + "CPU": true, + "CSS": true, + "DNS": true, + "EOF": true, + "GUID": true, + "HTML": true, + "HTTPS": true, + "HTTP": true, + "ID": true, + "IP": true, + "IPv4": true, + "IPv6": true, + "JSON": true, + "LHS": true, + "OAI": true, + "QPS": true, + "RAM": true, + "RHS": true, + "RPC": true, + "SLA": true, + "SMTP": true, + "SQL": true, + "SSH": true, + "TCP": true, + "TLS": true, + "TTL": true, + "UDP": true, + "UI": true, + "UID": true, + "UUID": true, + "URI": true, + "URL": true, + "UTF8": true, + "VM": true, + "XML": true, + "XMPP": true, + "XSRF": true, + "XSS": true, + } + + // a thread-safe index of initialisms + commonInitialisms = newIndexOfInitialisms().load(configuredInitialisms) + initialisms = commonInitialisms.sorted() + initialismsRunes = asRunes(initialisms) + initialismsUpperCased = asUpperCased(initialisms) + maxAllocMatches = maxAllocHeuristic(initialismsRunes) + + // a test function + isInitialism = commonInitialisms.isInitialism +} + +func asRunes(in []string) [][]rune { + out := make([][]rune, len(in)) + for i, initialism := range in { + out[i] = []rune(initialism) + } + + return out +} + +func asUpperCased(in []string) [][]rune { + out := make([][]rune, len(in)) + + for i, initialism := range in { + out[i] = []rune(upper(trim(initialism))) + } + + return out +} + +func maxAllocHeuristic(in [][]rune) int { + heuristic := make(map[rune]int) + for _, initialism := range in { + heuristic[initialism[0]]++ + } + + var maxAlloc int + for _, val := range heuristic { + if val > maxAlloc { + maxAlloc = val + } + } + + return maxAlloc +} + +// AddInitialisms add additional initialisms +func AddInitialisms(words ...string) { + for _, word := range words { + // commonInitialisms[upper(word)] = true + commonInitialisms.add(upper(word)) + } + // sort again + initialisms = commonInitialisms.sorted() + initialismsRunes = asRunes(initialisms) + initialismsUpperCased = asUpperCased(initialisms) +} + +// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms. +// Since go1.9, this may be implemented with sync.Map. +type indexOfInitialisms struct { + sortMutex *sync.Mutex + index *sync.Map +} + +func newIndexOfInitialisms() *indexOfInitialisms { + return &indexOfInitialisms{ + sortMutex: new(sync.Mutex), + index: new(sync.Map), + } +} + +func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms { + m.sortMutex.Lock() + defer m.sortMutex.Unlock() + for k, v := range initial { + m.index.Store(k, v) + } + return m +} + +func (m *indexOfInitialisms) isInitialism(key string) bool { + _, ok := m.index.Load(key) + return ok +} + +func (m *indexOfInitialisms) add(key string) *indexOfInitialisms { + m.index.Store(key, true) + return m +} + +func (m *indexOfInitialisms) sorted() (result []string) { + m.sortMutex.Lock() + defer m.sortMutex.Unlock() + m.index.Range(func(key, _ interface{}) bool { + k := key.(string) + result = append(result, k) + return true + }) + sort.Sort(sort.Reverse(byInitialism(result))) + return +} + +type byInitialism []string + +func (s byInitialism) Len() int { + return len(s) +} +func (s byInitialism) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} +func (s byInitialism) Less(i, j int) bool { + if len(s[i]) != len(s[j]) { + return len(s[i]) < len(s[j]) + } + + return strings.Compare(s[i], s[j]) > 0 +} diff --git a/vendor/github.com/go-openapi/swag/loading.go b/vendor/github.com/go-openapi/swag/loading.go index 00038c377..783442fdd 100644 --- a/vendor/github.com/go-openapi/swag/loading.go +++ b/vendor/github.com/go-openapi/swag/loading.go @@ -21,6 +21,7 @@ import ( "net/http" "net/url" "os" + "path" "path/filepath" "runtime" "strings" @@ -40,43 +41,97 @@ var LoadHTTPBasicAuthPassword = "" var LoadHTTPCustomHeaders = map[string]string{} // LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in -func LoadFromFileOrHTTP(path string) ([]byte, error) { - return LoadStrategy(path, os.ReadFile, loadHTTPBytes(LoadHTTPTimeout))(path) +func LoadFromFileOrHTTP(pth string) ([]byte, error) { + return LoadStrategy(pth, os.ReadFile, loadHTTPBytes(LoadHTTPTimeout))(pth) } // LoadFromFileOrHTTPWithTimeout loads the bytes from a file or a remote http server based on the path passed in // timeout arg allows for per request overriding of the request timeout -func LoadFromFileOrHTTPWithTimeout(path string, timeout time.Duration) ([]byte, error) { - return LoadStrategy(path, os.ReadFile, loadHTTPBytes(timeout))(path) +func LoadFromFileOrHTTPWithTimeout(pth string, timeout time.Duration) ([]byte, error) { + return LoadStrategy(pth, os.ReadFile, loadHTTPBytes(timeout))(pth) } -// LoadStrategy returns a loader function for a given path or uri -func LoadStrategy(path string, local, remote func(string) ([]byte, error)) func(string) ([]byte, error) { - if strings.HasPrefix(path, "http") { +// LoadStrategy returns a loader function for a given path or URI. +// +// The load strategy returns the remote load for any path starting with `http`. +// So this works for any URI with a scheme `http` or `https`. +// +// The fallback strategy is to call the local loader. +// +// The local loader takes a local file system path (absolute or relative) as argument, +// or alternatively a `file://...` URI, **without host** (see also below for windows). +// +// There are a few liberalities, initially intended to be tolerant regarding the URI syntax, +// especially on windows. +// +// Before the local loader is called, the given path is transformed: +// - percent-encoded characters are unescaped +// - simple paths (e.g. `./folder/file`) are passed as-is +// - on windows, occurrences of `/` are replaced by `\`, so providing a relative path such a `folder/file` works too. +// +// For paths provided as URIs with the "file" scheme, please note that: +// - `file://` is simply stripped. +// This means that the host part of the URI is not parsed at all. +// For example, `file:///folder/file" becomes "/folder/file`, +// but `file://localhost/folder/file` becomes `localhost/folder/file` on unix systems. +// Similarly, `file://./folder/file` yields `./folder/file`. +// - on windows, `file://...` can take a host so as to specify an UNC share location. +// +// Reminder about windows-specifics: +// - `file://host/folder/file` becomes an UNC path like `\\host\folder\file` (no port specification is supported) +// - `file:///c:/folder/file` becomes `C:\folder\file` +// - `file://c:/folder/file` is tolerated (without leading `/`) and becomes `c:\folder\file` +func LoadStrategy(pth string, local, remote func(string) ([]byte, error)) func(string) ([]byte, error) { + if strings.HasPrefix(pth, "http") { return remote } - return func(pth string) ([]byte, error) { - upth, err := pathUnescape(pth) + + return func(p string) ([]byte, error) { + upth, err := url.PathUnescape(p) if err != nil { return nil, err } - if strings.HasPrefix(pth, `file://`) { - if runtime.GOOS == "windows" { - // support for canonical file URIs on windows. - // Zero tolerance here for dodgy URIs. - u, _ := url.Parse(upth) - if u.Host != "" { - // assume UNC name (volume share) - // file://host/share/folder\... ==> \\host\share\path\folder - // NOTE: UNC port not yet supported - upth = strings.Join([]string{`\`, u.Host, u.Path}, `\`) - } else { - // file:///c:/folder/... ==> just remove the leading slash - upth = strings.TrimPrefix(upth, `file:///`) - } - } else { - upth = strings.TrimPrefix(upth, `file://`) + if !strings.HasPrefix(p, `file://`) { + // regular file path provided: just normalize slashes + return local(filepath.FromSlash(upth)) + } + + if runtime.GOOS != "windows" { + // crude processing: this leaves full URIs with a host with a (mostly) unexpected result + upth = strings.TrimPrefix(upth, `file://`) + + return local(filepath.FromSlash(upth)) + } + + // windows-only pre-processing of file://... URIs + + // support for canonical file URIs on windows. + u, err := url.Parse(filepath.ToSlash(upth)) + if err != nil { + return nil, err + } + + if u.Host != "" { + // assume UNC name (volume share) + // NOTE: UNC port not yet supported + + // when the "host" segment is a drive letter: + // file://C:/folder/... => C:\folder + upth = path.Clean(strings.Join([]string{u.Host, u.Path}, `/`)) + if !strings.HasSuffix(u.Host, ":") && u.Host[0] != '.' { + // tolerance: if we have a leading dot, this can't be a host + // file://host/share/folder\... ==> \\host\share\path\folder + upth = "//" + upth + } + } else { + // no host, let's figure out if this is a drive letter + upth = strings.TrimPrefix(upth, `file://`) + first, _, _ := strings.Cut(strings.TrimPrefix(u.Path, "/"), "/") + if strings.HasSuffix(first, ":") { + // drive letter in the first segment: + // file:///c:/folder/... ==> strip the leading slash + upth = strings.TrimPrefix(upth, `/`) } } diff --git a/vendor/github.com/go-openapi/swag/name_lexem.go b/vendor/github.com/go-openapi/swag/name_lexem.go index aa7f6a9bb..8bb64ac32 100644 --- a/vendor/github.com/go-openapi/swag/name_lexem.go +++ b/vendor/github.com/go-openapi/swag/name_lexem.go @@ -14,74 +14,80 @@ package swag -import "unicode" +import ( + "unicode" + "unicode/utf8" +) type ( - nameLexem interface { - GetUnsafeGoName() string - GetOriginal() string - IsInitialism() bool - } + lexemKind uint8 - initialismNameLexem struct { + nameLexem struct { original string matchedInitialism string + kind lexemKind } +) - casualNameLexem struct { - original string - } +const ( + lexemKindCasualName lexemKind = iota + lexemKindInitialismName ) -func newInitialismNameLexem(original, matchedInitialism string) *initialismNameLexem { - return &initialismNameLexem{ +func newInitialismNameLexem(original, matchedInitialism string) nameLexem { + return nameLexem{ + kind: lexemKindInitialismName, original: original, matchedInitialism: matchedInitialism, } } -func newCasualNameLexem(original string) *casualNameLexem { - return &casualNameLexem{ +func newCasualNameLexem(original string) nameLexem { + return nameLexem{ + kind: lexemKindCasualName, original: original, } } -func (l *initialismNameLexem) GetUnsafeGoName() string { - return l.matchedInitialism -} +func (l nameLexem) GetUnsafeGoName() string { + if l.kind == lexemKindInitialismName { + return l.matchedInitialism + } + + var ( + first rune + rest string + ) -func (l *casualNameLexem) GetUnsafeGoName() string { - var first rune - var rest string for i, orig := range l.original { if i == 0 { first = orig continue } + if i > 0 { rest = l.original[i:] break } } + if len(l.original) > 1 { - return string(unicode.ToUpper(first)) + lower(rest) + b := poolOfBuffers.BorrowBuffer(utf8.UTFMax + len(rest)) + defer func() { + poolOfBuffers.RedeemBuffer(b) + }() + b.WriteRune(unicode.ToUpper(first)) + b.WriteString(lower(rest)) + return b.String() } return l.original } -func (l *initialismNameLexem) GetOriginal() string { +func (l nameLexem) GetOriginal() string { return l.original } -func (l *casualNameLexem) GetOriginal() string { - return l.original -} - -func (l *initialismNameLexem) IsInitialism() bool { - return true -} - -func (l *casualNameLexem) IsInitialism() bool { - return false +func (l nameLexem) IsInitialism() bool { + return l.kind == lexemKindInitialismName } diff --git a/vendor/github.com/go-openapi/swag/post_go18.go b/vendor/github.com/go-openapi/swag/post_go18.go deleted file mode 100644 index f5228b82c..000000000 --- a/vendor/github.com/go-openapi/swag/post_go18.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build go1.8 -// +build go1.8 - -package swag - -import "net/url" - -func pathUnescape(path string) (string, error) { - return url.PathUnescape(path) -} diff --git a/vendor/github.com/go-openapi/swag/post_go19.go b/vendor/github.com/go-openapi/swag/post_go19.go deleted file mode 100644 index 7c7da9c08..000000000 --- a/vendor/github.com/go-openapi/swag/post_go19.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build go1.9 -// +build go1.9 - -package swag - -import ( - "sort" - "sync" -) - -// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms. -// Since go1.9, this may be implemented with sync.Map. -type indexOfInitialisms struct { - sortMutex *sync.Mutex - index *sync.Map -} - -func newIndexOfInitialisms() *indexOfInitialisms { - return &indexOfInitialisms{ - sortMutex: new(sync.Mutex), - index: new(sync.Map), - } -} - -func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms { - m.sortMutex.Lock() - defer m.sortMutex.Unlock() - for k, v := range initial { - m.index.Store(k, v) - } - return m -} - -func (m *indexOfInitialisms) isInitialism(key string) bool { - _, ok := m.index.Load(key) - return ok -} - -func (m *indexOfInitialisms) add(key string) *indexOfInitialisms { - m.index.Store(key, true) - return m -} - -func (m *indexOfInitialisms) sorted() (result []string) { - m.sortMutex.Lock() - defer m.sortMutex.Unlock() - m.index.Range(func(key, value interface{}) bool { - k := key.(string) - result = append(result, k) - return true - }) - sort.Sort(sort.Reverse(byInitialism(result))) - return -} diff --git a/vendor/github.com/go-openapi/swag/pre_go18.go b/vendor/github.com/go-openapi/swag/pre_go18.go deleted file mode 100644 index 2757d9b95..000000000 --- a/vendor/github.com/go-openapi/swag/pre_go18.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build !go1.8 -// +build !go1.8 - -package swag - -import "net/url" - -func pathUnescape(path string) (string, error) { - return url.QueryUnescape(path) -} diff --git a/vendor/github.com/go-openapi/swag/pre_go19.go b/vendor/github.com/go-openapi/swag/pre_go19.go deleted file mode 100644 index 0565db377..000000000 --- a/vendor/github.com/go-openapi/swag/pre_go19.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build !go1.9 -// +build !go1.9 - -package swag - -import ( - "sort" - "sync" -) - -// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms. -// Before go1.9, this may be implemented with a mutex on the map. -type indexOfInitialisms struct { - getMutex *sync.Mutex - index map[string]bool -} - -func newIndexOfInitialisms() *indexOfInitialisms { - return &indexOfInitialisms{ - getMutex: new(sync.Mutex), - index: make(map[string]bool, 50), - } -} - -func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms { - m.getMutex.Lock() - defer m.getMutex.Unlock() - for k, v := range initial { - m.index[k] = v - } - return m -} - -func (m *indexOfInitialisms) isInitialism(key string) bool { - m.getMutex.Lock() - defer m.getMutex.Unlock() - _, ok := m.index[key] - return ok -} - -func (m *indexOfInitialisms) add(key string) *indexOfInitialisms { - m.getMutex.Lock() - defer m.getMutex.Unlock() - m.index[key] = true - return m -} - -func (m *indexOfInitialisms) sorted() (result []string) { - m.getMutex.Lock() - defer m.getMutex.Unlock() - for k := range m.index { - result = append(result, k) - } - sort.Sort(sort.Reverse(byInitialism(result))) - return -} diff --git a/vendor/github.com/go-openapi/swag/split.go b/vendor/github.com/go-openapi/swag/split.go index a1825fb7d..274727a86 100644 --- a/vendor/github.com/go-openapi/swag/split.go +++ b/vendor/github.com/go-openapi/swag/split.go @@ -15,124 +15,269 @@ package swag import ( + "bytes" + "sync" "unicode" + "unicode/utf8" ) -var nameReplaceTable = map[rune]string{ - '@': "At ", - '&': "And ", - '|': "Pipe ", - '$': "Dollar ", - '!': "Bang ", - '-': "", - '_': "", -} - type ( splitter struct { - postSplitInitialismCheck bool initialisms []string + initialismsRunes [][]rune + initialismsUpperCased [][]rune // initialisms cached in their trimmed, upper-cased version + postSplitInitialismCheck bool + } + + splitterOption func(*splitter) + + initialismMatch struct { + body []rune + start, end int + complete bool + } + initialismMatches []initialismMatch +) + +type ( + // memory pools of temporary objects. + // + // These are used to recycle temporarily allocated objects + // and relieve the GC from undue pressure. + + matchesPool struct { + *sync.Pool } - splitterOption func(*splitter) *splitter + buffersPool struct { + *sync.Pool + } + + lexemsPool struct { + *sync.Pool + } + + splittersPool struct { + *sync.Pool + } ) -// split calls the splitter; splitter provides more control and post options +var ( + // poolOfMatches holds temporary slices for recycling during the initialism match process + poolOfMatches = matchesPool{ + Pool: &sync.Pool{ + New: func() any { + s := make(initialismMatches, 0, maxAllocMatches) + + return &s + }, + }, + } + + poolOfBuffers = buffersPool{ + Pool: &sync.Pool{ + New: func() any { + return new(bytes.Buffer) + }, + }, + } + + poolOfLexems = lexemsPool{ + Pool: &sync.Pool{ + New: func() any { + s := make([]nameLexem, 0, maxAllocMatches) + + return &s + }, + }, + } + + poolOfSplitters = splittersPool{ + Pool: &sync.Pool{ + New: func() any { + s := newSplitter() + + return &s + }, + }, + } +) + +// nameReplaceTable finds a word representation for special characters. +func nameReplaceTable(r rune) (string, bool) { + switch r { + case '@': + return "At ", true + case '&': + return "And ", true + case '|': + return "Pipe ", true + case '$': + return "Dollar ", true + case '!': + return "Bang ", true + case '-': + return "", true + case '_': + return "", true + default: + return "", false + } +} + +// split calls the splitter. +// +// Use newSplitter for more control and options func split(str string) []string { - lexems := newSplitter().split(str) - result := make([]string, 0, len(lexems)) + s := poolOfSplitters.BorrowSplitter() + lexems := s.split(str) + result := make([]string, 0, len(*lexems)) - for _, lexem := range lexems { + for _, lexem := range *lexems { result = append(result, lexem.GetOriginal()) } + poolOfLexems.RedeemLexems(lexems) + poolOfSplitters.RedeemSplitter(s) return result } -func (s *splitter) split(str string) []nameLexem { - return s.toNameLexems(str) -} - -func newSplitter(options ...splitterOption) *splitter { - splitter := &splitter{ +func newSplitter(options ...splitterOption) splitter { + s := splitter{ postSplitInitialismCheck: false, initialisms: initialisms, + initialismsRunes: initialismsRunes, + initialismsUpperCased: initialismsUpperCased, } for _, option := range options { - splitter = option(splitter) + option(&s) } - return splitter + return s } // withPostSplitInitialismCheck allows to catch initialisms after main split process -func withPostSplitInitialismCheck(s *splitter) *splitter { +func withPostSplitInitialismCheck(s *splitter) { s.postSplitInitialismCheck = true +} + +func (p matchesPool) BorrowMatches() *initialismMatches { + s := p.Get().(*initialismMatches) + *s = (*s)[:0] // reset slice, keep allocated capacity + return s } -type ( - initialismMatch struct { - start, end int - body []rune - complete bool +func (p buffersPool) BorrowBuffer(size int) *bytes.Buffer { + s := p.Get().(*bytes.Buffer) + s.Reset() + + if s.Cap() < size { + s.Grow(size) } - initialismMatches []*initialismMatch -) -func (s *splitter) toNameLexems(name string) []nameLexem { + return s +} + +func (p lexemsPool) BorrowLexems() *[]nameLexem { + s := p.Get().(*[]nameLexem) + *s = (*s)[:0] // reset slice, keep allocated capacity + + return s +} + +func (p splittersPool) BorrowSplitter(options ...splitterOption) *splitter { + s := p.Get().(*splitter) + s.postSplitInitialismCheck = false // reset options + for _, apply := range options { + apply(s) + } + + return s +} + +func (p matchesPool) RedeemMatches(s *initialismMatches) { + p.Put(s) +} + +func (p buffersPool) RedeemBuffer(s *bytes.Buffer) { + p.Put(s) +} + +func (p lexemsPool) RedeemLexems(s *[]nameLexem) { + p.Put(s) +} + +func (p splittersPool) RedeemSplitter(s *splitter) { + p.Put(s) +} + +func (m initialismMatch) isZero() bool { + return m.start == 0 && m.end == 0 +} + +func (s splitter) split(name string) *[]nameLexem { nameRunes := []rune(name) matches := s.gatherInitialismMatches(nameRunes) + if matches == nil { + return poolOfLexems.BorrowLexems() + } + return s.mapMatchesToNameLexems(nameRunes, matches) } -func (s *splitter) gatherInitialismMatches(nameRunes []rune) initialismMatches { - matches := make(initialismMatches, 0) +func (s splitter) gatherInitialismMatches(nameRunes []rune) *initialismMatches { + var matches *initialismMatches for currentRunePosition, currentRune := range nameRunes { - newMatches := make(initialismMatches, 0, len(matches)) + // recycle these allocations as we loop over runes + // with such recycling, only 2 slices should be allocated per call + // instead of o(n). + newMatches := poolOfMatches.BorrowMatches() // check current initialism matches - for _, match := range matches { - if keepCompleteMatch := match.complete; keepCompleteMatch { - newMatches = append(newMatches, match) - continue - } + if matches != nil { // skip first iteration + for _, match := range *matches { + if keepCompleteMatch := match.complete; keepCompleteMatch { + *newMatches = append(*newMatches, match) + continue + } - // drop failed match - currentMatchRune := match.body[currentRunePosition-match.start] - if !s.initialismRuneEqual(currentMatchRune, currentRune) { - continue - } + // drop failed match + currentMatchRune := match.body[currentRunePosition-match.start] + if currentMatchRune != currentRune { + continue + } - // try to complete ongoing match - if currentRunePosition-match.start == len(match.body)-1 { - // we are close; the next step is to check the symbol ahead - // if it is a small letter, then it is not the end of match - // but beginning of the next word - - if currentRunePosition < len(nameRunes)-1 { - nextRune := nameRunes[currentRunePosition+1] - if newWord := unicode.IsLower(nextRune); newWord { - // oh ok, it was the start of a new word - continue + // try to complete ongoing match + if currentRunePosition-match.start == len(match.body)-1 { + // we are close; the next step is to check the symbol ahead + // if it is a small letter, then it is not the end of match + // but beginning of the next word + + if currentRunePosition < len(nameRunes)-1 { + nextRune := nameRunes[currentRunePosition+1] + if newWord := unicode.IsLower(nextRune); newWord { + // oh ok, it was the start of a new word + continue + } } + + match.complete = true + match.end = currentRunePosition } - match.complete = true - match.end = currentRunePosition + *newMatches = append(*newMatches, match) } - - newMatches = append(newMatches, match) } // check for new initialism matches - for _, initialism := range s.initialisms { - initialismRunes := []rune(initialism) - if s.initialismRuneEqual(initialismRunes[0], currentRune) { - newMatches = append(newMatches, &initialismMatch{ + for i := range s.initialisms { + initialismRunes := s.initialismsRunes[i] + if initialismRunes[0] == currentRune { + *newMatches = append(*newMatches, initialismMatch{ start: currentRunePosition, body: initialismRunes, complete: false, @@ -140,24 +285,28 @@ func (s *splitter) gatherInitialismMatches(nameRunes []rune) initialismMatches { } } + if matches != nil { + poolOfMatches.RedeemMatches(matches) + } matches = newMatches } + // up to the caller to redeem this last slice return matches } -func (s *splitter) mapMatchesToNameLexems(nameRunes []rune, matches initialismMatches) []nameLexem { - nameLexems := make([]nameLexem, 0) +func (s splitter) mapMatchesToNameLexems(nameRunes []rune, matches *initialismMatches) *[]nameLexem { + nameLexems := poolOfLexems.BorrowLexems() - var lastAcceptedMatch *initialismMatch - for _, match := range matches { + var lastAcceptedMatch initialismMatch + for _, match := range *matches { if !match.complete { continue } - if firstMatch := lastAcceptedMatch == nil; firstMatch { - nameLexems = append(nameLexems, s.breakCasualString(nameRunes[:match.start])...) - nameLexems = append(nameLexems, s.breakInitialism(string(match.body))) + if firstMatch := lastAcceptedMatch.isZero(); firstMatch { + s.appendBrokenDownCasualString(nameLexems, nameRunes[:match.start]) + *nameLexems = append(*nameLexems, s.breakInitialism(string(match.body))) lastAcceptedMatch = match @@ -169,63 +318,66 @@ func (s *splitter) mapMatchesToNameLexems(nameRunes []rune, matches initialismMa } middle := nameRunes[lastAcceptedMatch.end+1 : match.start] - nameLexems = append(nameLexems, s.breakCasualString(middle)...) - nameLexems = append(nameLexems, s.breakInitialism(string(match.body))) + s.appendBrokenDownCasualString(nameLexems, middle) + *nameLexems = append(*nameLexems, s.breakInitialism(string(match.body))) lastAcceptedMatch = match } // we have not found any accepted matches - if lastAcceptedMatch == nil { - return s.breakCasualString(nameRunes) - } - - if lastAcceptedMatch.end+1 != len(nameRunes) { + if lastAcceptedMatch.isZero() { + *nameLexems = (*nameLexems)[:0] + s.appendBrokenDownCasualString(nameLexems, nameRunes) + } else if lastAcceptedMatch.end+1 != len(nameRunes) { rest := nameRunes[lastAcceptedMatch.end+1:] - nameLexems = append(nameLexems, s.breakCasualString(rest)...) + s.appendBrokenDownCasualString(nameLexems, rest) } - return nameLexems -} + poolOfMatches.RedeemMatches(matches) -func (s *splitter) initialismRuneEqual(a, b rune) bool { - return a == b + return nameLexems } -func (s *splitter) breakInitialism(original string) nameLexem { +func (s splitter) breakInitialism(original string) nameLexem { return newInitialismNameLexem(original, original) } -func (s *splitter) breakCasualString(str []rune) []nameLexem { - segments := make([]nameLexem, 0) - currentSegment := "" +func (s splitter) appendBrokenDownCasualString(segments *[]nameLexem, str []rune) { + currentSegment := poolOfBuffers.BorrowBuffer(len(str)) // unlike strings.Builder, bytes.Buffer initial storage can reused + defer func() { + poolOfBuffers.RedeemBuffer(currentSegment) + }() addCasualNameLexem := func(original string) { - segments = append(segments, newCasualNameLexem(original)) + *segments = append(*segments, newCasualNameLexem(original)) } addInitialismNameLexem := func(original, match string) { - segments = append(segments, newInitialismNameLexem(original, match)) + *segments = append(*segments, newInitialismNameLexem(original, match)) } - addNameLexem := func(original string) { - if s.postSplitInitialismCheck { - for _, initialism := range s.initialisms { - if upper(initialism) == upper(original) { - addInitialismNameLexem(original, initialism) + var addNameLexem func(string) + if s.postSplitInitialismCheck { + addNameLexem = func(original string) { + for i := range s.initialisms { + if isEqualFoldIgnoreSpace(s.initialismsUpperCased[i], original) { + addInitialismNameLexem(original, s.initialisms[i]) + return } } - } - addCasualNameLexem(original) + addCasualNameLexem(original) + } + } else { + addNameLexem = addCasualNameLexem } - for _, rn := range string(str) { - if replace, found := nameReplaceTable[rn]; found { - if currentSegment != "" { - addNameLexem(currentSegment) - currentSegment = "" + for _, rn := range str { + if replace, found := nameReplaceTable(rn); found { + if currentSegment.Len() > 0 { + addNameLexem(currentSegment.String()) + currentSegment.Reset() } if replace != "" { @@ -236,27 +388,121 @@ func (s *splitter) breakCasualString(str []rune) []nameLexem { } if !unicode.In(rn, unicode.L, unicode.M, unicode.N, unicode.Pc) { - if currentSegment != "" { - addNameLexem(currentSegment) - currentSegment = "" + if currentSegment.Len() > 0 { + addNameLexem(currentSegment.String()) + currentSegment.Reset() } continue } if unicode.IsUpper(rn) { - if currentSegment != "" { - addNameLexem(currentSegment) + if currentSegment.Len() > 0 { + addNameLexem(currentSegment.String()) } - currentSegment = "" + currentSegment.Reset() } - currentSegment += string(rn) + currentSegment.WriteRune(rn) + } + + if currentSegment.Len() > 0 { + addNameLexem(currentSegment.String()) } +} + +// isEqualFoldIgnoreSpace is the same as strings.EqualFold, but +// it ignores leading and trailing blank spaces in the compared +// string. +// +// base is assumed to be composed of upper-cased runes, and be already +// trimmed. +// +// This code is heavily inspired from strings.EqualFold. +func isEqualFoldIgnoreSpace(base []rune, str string) bool { + var i, baseIndex int + // equivalent to b := []byte(str), but without data copy + b := hackStringBytes(str) + + for i < len(b) { + if c := b[i]; c < utf8.RuneSelf { + // fast path for ASCII + if c != ' ' && c != '\t' { + break + } + i++ + + continue + } + + // unicode case + r, size := utf8.DecodeRune(b[i:]) + if !unicode.IsSpace(r) { + break + } + i += size + } + + if i >= len(b) { + return len(base) == 0 + } + + for _, baseRune := range base { + if i >= len(b) { + break + } + + if c := b[i]; c < utf8.RuneSelf { + // single byte rune case (ASCII) + if baseRune >= utf8.RuneSelf { + return false + } + + baseChar := byte(baseRune) + if c != baseChar && + !('a' <= c && c <= 'z' && c-'a'+'A' == baseChar) { + return false + } + + baseIndex++ + i++ + + continue + } + + // unicode case + r, size := utf8.DecodeRune(b[i:]) + if unicode.ToUpper(r) != baseRune { + return false + } + baseIndex++ + i += size + } + + if baseIndex != len(base) { + return false + } + + // all passed: now we should only have blanks + for i < len(b) { + if c := b[i]; c < utf8.RuneSelf { + // fast path for ASCII + if c != ' ' && c != '\t' { + return false + } + i++ + + continue + } + + // unicode case + r, size := utf8.DecodeRune(b[i:]) + if !unicode.IsSpace(r) { + return false + } - if currentSegment != "" { - addNameLexem(currentSegment) + i += size } - return segments + return true } diff --git a/vendor/github.com/go-openapi/swag/string_bytes.go b/vendor/github.com/go-openapi/swag/string_bytes.go new file mode 100644 index 000000000..90745d5ca --- /dev/null +++ b/vendor/github.com/go-openapi/swag/string_bytes.go @@ -0,0 +1,8 @@ +package swag + +import "unsafe" + +// hackStringBytes returns the (unsafe) underlying bytes slice of a string. +func hackStringBytes(str string) []byte { + return unsafe.Slice(unsafe.StringData(str), len(str)) +} diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go index f78ab684a..5051401c4 100644 --- a/vendor/github.com/go-openapi/swag/util.go +++ b/vendor/github.com/go-openapi/swag/util.go @@ -18,76 +18,25 @@ import ( "reflect" "strings" "unicode" + "unicode/utf8" ) -// commonInitialisms are common acronyms that are kept as whole uppercased words. -var commonInitialisms *indexOfInitialisms - -// initialisms is a slice of sorted initialisms -var initialisms []string - -var isInitialism func(string) bool - // GoNamePrefixFunc sets an optional rule to prefix go names // which do not start with a letter. // +// The prefix function is assumed to return a string that starts with an upper case letter. +// // e.g. to help convert "123" into "{prefix}123" // // The default is to prefix with "X" var GoNamePrefixFunc func(string) string -func init() { - // Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769 - var configuredInitialisms = map[string]bool{ - "ACL": true, - "API": true, - "ASCII": true, - "CPU": true, - "CSS": true, - "DNS": true, - "EOF": true, - "GUID": true, - "HTML": true, - "HTTPS": true, - "HTTP": true, - "ID": true, - "IP": true, - "IPv4": true, - "IPv6": true, - "JSON": true, - "LHS": true, - "OAI": true, - "QPS": true, - "RAM": true, - "RHS": true, - "RPC": true, - "SLA": true, - "SMTP": true, - "SQL": true, - "SSH": true, - "TCP": true, - "TLS": true, - "TTL": true, - "UDP": true, - "UI": true, - "UID": true, - "UUID": true, - "URI": true, - "URL": true, - "UTF8": true, - "VM": true, - "XML": true, - "XMPP": true, - "XSRF": true, - "XSS": true, +func prefixFunc(name, in string) string { + if GoNamePrefixFunc == nil { + return "X" + in } - // a thread-safe index of initialisms - commonInitialisms = newIndexOfInitialisms().load(configuredInitialisms) - initialisms = commonInitialisms.sorted() - - // a test function - isInitialism = commonInitialisms.isInitialism + return GoNamePrefixFunc(name) + in } const ( @@ -156,25 +105,9 @@ func SplitByFormat(data, format string) []string { return result } -type byInitialism []string - -func (s byInitialism) Len() int { - return len(s) -} -func (s byInitialism) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} -func (s byInitialism) Less(i, j int) bool { - if len(s[i]) != len(s[j]) { - return len(s[i]) < len(s[j]) - } - - return strings.Compare(s[i], s[j]) > 0 -} - // Removes leading whitespaces func trim(str string) string { - return strings.Trim(str, " ") + return strings.TrimSpace(str) } // Shortcut to strings.ToUpper() @@ -188,15 +121,20 @@ func lower(str string) string { } // Camelize an uppercased word -func Camelize(word string) (camelized string) { +func Camelize(word string) string { + camelized := poolOfBuffers.BorrowBuffer(len(word)) + defer func() { + poolOfBuffers.RedeemBuffer(camelized) + }() + for pos, ru := range []rune(word) { if pos > 0 { - camelized += string(unicode.ToLower(ru)) + camelized.WriteRune(unicode.ToLower(ru)) } else { - camelized += string(unicode.ToUpper(ru)) + camelized.WriteRune(unicode.ToUpper(ru)) } } - return + return camelized.String() } // ToFileName lowercases and underscores a go type name @@ -224,33 +162,40 @@ func ToCommandName(name string) string { // ToHumanNameLower represents a code name as a human series of words func ToHumanNameLower(name string) string { - in := newSplitter(withPostSplitInitialismCheck).split(name) - out := make([]string, 0, len(in)) + s := poolOfSplitters.BorrowSplitter(withPostSplitInitialismCheck) + in := s.split(name) + poolOfSplitters.RedeemSplitter(s) + out := make([]string, 0, len(*in)) - for _, w := range in { + for _, w := range *in { if !w.IsInitialism() { out = append(out, lower(w.GetOriginal())) } else { - out = append(out, w.GetOriginal()) + out = append(out, trim(w.GetOriginal())) } } + poolOfLexems.RedeemLexems(in) return strings.Join(out, " ") } // ToHumanNameTitle represents a code name as a human series of words with the first letters titleized func ToHumanNameTitle(name string) string { - in := newSplitter(withPostSplitInitialismCheck).split(name) + s := poolOfSplitters.BorrowSplitter(withPostSplitInitialismCheck) + in := s.split(name) + poolOfSplitters.RedeemSplitter(s) - out := make([]string, 0, len(in)) - for _, w := range in { - original := w.GetOriginal() + out := make([]string, 0, len(*in)) + for _, w := range *in { + original := trim(w.GetOriginal()) if !w.IsInitialism() { out = append(out, Camelize(original)) } else { out = append(out, original) } } + poolOfLexems.RedeemLexems(in) + return strings.Join(out, " ") } @@ -264,7 +209,7 @@ func ToJSONName(name string) string { out = append(out, lower(w)) continue } - out = append(out, Camelize(w)) + out = append(out, Camelize(trim(w))) } return strings.Join(out, "") } @@ -283,35 +228,70 @@ func ToVarName(name string) string { // ToGoName translates a swagger name which can be underscored or camel cased to a name that golint likes func ToGoName(name string) string { - lexems := newSplitter(withPostSplitInitialismCheck).split(name) + s := poolOfSplitters.BorrowSplitter(withPostSplitInitialismCheck) + lexems := s.split(name) + poolOfSplitters.RedeemSplitter(s) + defer func() { + poolOfLexems.RedeemLexems(lexems) + }() + lexemes := *lexems + + if len(lexemes) == 0 { + return "" + } + + result := poolOfBuffers.BorrowBuffer(len(name)) + defer func() { + poolOfBuffers.RedeemBuffer(result) + }() - result := "" - for _, lexem := range lexems { + // check if not starting with a letter, upper case + firstPart := lexemes[0].GetUnsafeGoName() + if lexemes[0].IsInitialism() { + firstPart = upper(firstPart) + } + + if c := firstPart[0]; c < utf8.RuneSelf { + // ASCII + switch { + case 'A' <= c && c <= 'Z': + result.WriteString(firstPart) + case 'a' <= c && c <= 'z': + result.WriteByte(c - 'a' + 'A') + result.WriteString(firstPart[1:]) + default: + result.WriteString(prefixFunc(name, firstPart)) + // NOTE: no longer check if prefixFunc returns a string that starts with uppercase: + // assume this is always the case + } + } else { + // unicode + firstRune, _ := utf8.DecodeRuneInString(firstPart) + switch { + case !unicode.IsLetter(firstRune): + result.WriteString(prefixFunc(name, firstPart)) + case !unicode.IsUpper(firstRune): + result.WriteString(prefixFunc(name, firstPart)) + /* + result.WriteRune(unicode.ToUpper(firstRune)) + result.WriteString(firstPart[offset:]) + */ + default: + result.WriteString(firstPart) + } + } + + for _, lexem := range lexemes[1:] { goName := lexem.GetUnsafeGoName() // to support old behavior if lexem.IsInitialism() { goName = upper(goName) } - result += goName + result.WriteString(goName) } - if len(result) > 0 { - // Only prefix with X when the first character isn't an ascii letter - first := []rune(result)[0] - if !unicode.IsLetter(first) || (first > unicode.MaxASCII && !unicode.IsUpper(first)) { - if GoNamePrefixFunc == nil { - return "X" + result - } - result = GoNamePrefixFunc(name) + result - } - first = []rune(result)[0] - if unicode.IsLetter(first) && !unicode.IsUpper(first) { - result = string(append([]rune{unicode.ToUpper(first)}, []rune(result)[1:]...)) - } - } - - return result + return result.String() } // ContainsStrings searches a slice of strings for a case-sensitive match @@ -341,13 +321,22 @@ type zeroable interface { // IsZero returns true when the value passed into the function is a zero value. // This allows for safer checking of interface values. func IsZero(data interface{}) bool { + v := reflect.ValueOf(data) + // check for nil data + switch v.Kind() { //nolint:exhaustive + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + if v.IsNil() { + return true + } + } + // check for things that have an IsZero method instead if vv, ok := data.(zeroable); ok { return vv.IsZero() } + // continue with slightly more complex reflection - v := reflect.ValueOf(data) - switch v.Kind() { + switch v.Kind() { //nolint:exhaustive case reflect.String: return v.Len() == 0 case reflect.Bool: @@ -358,24 +347,13 @@ func IsZero(data interface{}) bool { return v.Uint() == 0 case reflect.Float32, reflect.Float64: return v.Float() == 0 - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() case reflect.Struct, reflect.Array: return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface()) case reflect.Invalid: return true + default: + return false } - return false -} - -// AddInitialisms add additional initialisms -func AddInitialisms(words ...string) { - for _, word := range words { - // commonInitialisms[upper(word)] = true - commonInitialisms.add(upper(word)) - } - // sort again - initialisms = commonInitialisms.sorted() } // CommandLineOptionsGroup represents a group of user-defined command line options diff --git a/vendor/github.com/go-openapi/swag/yaml.go b/vendor/github.com/go-openapi/swag/yaml.go index f09ee609f..f59e02593 100644 --- a/vendor/github.com/go-openapi/swag/yaml.go +++ b/vendor/github.com/go-openapi/swag/yaml.go @@ -16,8 +16,11 @@ package swag import ( "encoding/json" + "errors" "fmt" "path/filepath" + "reflect" + "sort" "strconv" "github.com/mailru/easyjson/jlexer" @@ -48,7 +51,7 @@ func BytesToYAMLDoc(data []byte) (interface{}, error) { return nil, err } if document.Kind != yaml.DocumentNode || len(document.Content) != 1 || document.Content[0].Kind != yaml.MappingNode { - return nil, fmt.Errorf("only YAML documents that are objects are supported") + return nil, errors.New("only YAML documents that are objects are supported") } return &document, nil } @@ -147,7 +150,7 @@ func yamlScalar(node *yaml.Node) (interface{}, error) { case yamlTimestamp: return node.Value, nil case yamlNull: - return nil, nil + return nil, nil //nolint:nilnil default: return nil, fmt.Errorf("YAML tag %q is not supported", node.LongTag()) } @@ -245,7 +248,27 @@ func (s JSONMapSlice) MarshalYAML() (interface{}, error) { return yaml.Marshal(&n) } +func isNil(input interface{}) bool { + if input == nil { + return true + } + kind := reflect.TypeOf(input).Kind() + switch kind { //nolint:exhaustive + case reflect.Ptr, reflect.Map, reflect.Slice, reflect.Chan: + return reflect.ValueOf(input).IsNil() + default: + return false + } +} + func json2yaml(item interface{}) (*yaml.Node, error) { + if isNil(item) { + return &yaml.Node{ + Kind: yaml.ScalarNode, + Value: "null", + }, nil + } + switch val := item.(type) { case JSONMapSlice: var n yaml.Node @@ -265,7 +288,14 @@ func json2yaml(item interface{}) (*yaml.Node, error) { case map[string]interface{}: var n yaml.Node n.Kind = yaml.MappingNode - for k, v := range val { + keys := make([]string, 0, len(val)) + for k := range val { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, k := range keys { + v := val[k] childNode, err := json2yaml(v) if err != nil { return nil, err @@ -318,8 +348,9 @@ func json2yaml(item interface{}) (*yaml.Node, error) { Tag: yamlBoolScalar, Value: strconv.FormatBool(val), }, nil + default: + return nil, fmt.Errorf("unhandled type: %T", val) } - return nil, nil } // JSONMapItem represents the value of a key in a JSON object held by JSONMapSlice diff --git a/vendor/github.com/go-task/slim-sprig/.travis.yml b/vendor/github.com/go-task/slim-sprig/.travis.yml deleted file mode 100644 index 482aa3cd0..000000000 --- a/vendor/github.com/go-task/slim-sprig/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: go - -go: - - 1.9.x - - 1.10.x - - 1.11.x - - tip - -# Setting sudo access to false will let Travis CI use containers rather than -# VMs to run the tests. For more details see: -# - http://docs.travis-ci.com/user/workers/container-based-infrastructure/ -# - http://docs.travis-ci.com/user/workers/standard-infrastructure/ -sudo: false - -script: - - make setup test - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/06e3328629952dabe3e0 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always diff --git a/vendor/github.com/go-task/slim-sprig/Makefile b/vendor/github.com/go-task/slim-sprig/Makefile deleted file mode 100644 index 63a93fdf7..000000000 --- a/vendor/github.com/go-task/slim-sprig/Makefile +++ /dev/null @@ -1,13 +0,0 @@ - -HAS_GLIDE := $(shell command -v glide;) - -.PHONY: test -test: - go test -v . - -.PHONY: setup -setup: -ifndef HAS_GLIDE - go get -u github.com/Masterminds/glide -endif - glide install diff --git a/vendor/github.com/go-task/slim-sprig/appveyor.yml b/vendor/github.com/go-task/slim-sprig/appveyor.yml deleted file mode 100644 index d545a987a..000000000 --- a/vendor/github.com/go-task/slim-sprig/appveyor.yml +++ /dev/null @@ -1,26 +0,0 @@ - -version: build-{build}.{branch} - -clone_folder: C:\gopath\src\github.com\Masterminds\sprig -shallow_clone: true - -environment: - GOPATH: C:\gopath - -platform: - - x64 - -install: - - go get -u github.com/Masterminds/glide - - set PATH=%GOPATH%\bin;%PATH% - - go version - - go env - -build_script: - - glide install - - go install ./... - -test_script: - - go test -v - -deploy: off diff --git a/vendor/github.com/go-task/slim-sprig/crypto.go b/vendor/github.com/go-task/slim-sprig/crypto.go deleted file mode 100644 index 7427deb83..000000000 --- a/vendor/github.com/go-task/slim-sprig/crypto.go +++ /dev/null @@ -1,441 +0,0 @@ -package sprig - -import ( - "bytes" - "crypto/dsa" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/hmac" - "crypto/rand" - "crypto/rsa" - "crypto/sha1" - "crypto/sha256" - "crypto/x509" - "crypto/x509/pkix" - "encoding/asn1" - "encoding/base64" - "encoding/binary" - "encoding/hex" - "encoding/pem" - "errors" - "fmt" - "hash/adler32" - "math/big" - "net" - "time" - - "github.com/google/uuid" - "golang.org/x/crypto/scrypt" -) - -func sha256sum(input string) string { - hash := sha256.Sum256([]byte(input)) - return hex.EncodeToString(hash[:]) -} - -func sha1sum(input string) string { - hash := sha1.Sum([]byte(input)) - return hex.EncodeToString(hash[:]) -} - -func adler32sum(input string) string { - hash := adler32.Checksum([]byte(input)) - return fmt.Sprintf("%d", hash) -} - -// uuidv4 provides a safe and secure UUID v4 implementation -func uuidv4() string { - return fmt.Sprintf("%s", uuid.New()) -} - -var master_password_seed = "com.lyndir.masterpassword" - -var password_type_templates = map[string][][]byte{ - "maximum": {[]byte("anoxxxxxxxxxxxxxxxxx"), []byte("axxxxxxxxxxxxxxxxxno")}, - "long": {[]byte("CvcvnoCvcvCvcv"), []byte("CvcvCvcvnoCvcv"), []byte("CvcvCvcvCvcvno"), []byte("CvccnoCvcvCvcv"), []byte("CvccCvcvnoCvcv"), - []byte("CvccCvcvCvcvno"), []byte("CvcvnoCvccCvcv"), []byte("CvcvCvccnoCvcv"), []byte("CvcvCvccCvcvno"), []byte("CvcvnoCvcvCvcc"), - []byte("CvcvCvcvnoCvcc"), []byte("CvcvCvcvCvccno"), []byte("CvccnoCvccCvcv"), []byte("CvccCvccnoCvcv"), []byte("CvccCvccCvcvno"), - []byte("CvcvnoCvccCvcc"), []byte("CvcvCvccnoCvcc"), []byte("CvcvCvccCvccno"), []byte("CvccnoCvcvCvcc"), []byte("CvccCvcvnoCvcc"), - []byte("CvccCvcvCvccno")}, - "medium": {[]byte("CvcnoCvc"), []byte("CvcCvcno")}, - "short": {[]byte("Cvcn")}, - "basic": {[]byte("aaanaaan"), []byte("aannaaan"), []byte("aaannaaa")}, - "pin": {[]byte("nnnn")}, -} - -var template_characters = map[byte]string{ - 'V': "AEIOU", - 'C': "BCDFGHJKLMNPQRSTVWXYZ", - 'v': "aeiou", - 'c': "bcdfghjklmnpqrstvwxyz", - 'A': "AEIOUBCDFGHJKLMNPQRSTVWXYZ", - 'a': "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz", - 'n': "0123456789", - 'o': "@&%?,=[]_:-+*$#!'^~;()/.", - 'x': "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz0123456789!@#$%^&*()", -} - -func derivePassword(counter uint32, password_type, password, user, site string) string { - var templates = password_type_templates[password_type] - if templates == nil { - return fmt.Sprintf("cannot find password template %s", password_type) - } - - var buffer bytes.Buffer - buffer.WriteString(master_password_seed) - binary.Write(&buffer, binary.BigEndian, uint32(len(user))) - buffer.WriteString(user) - - salt := buffer.Bytes() - key, err := scrypt.Key([]byte(password), salt, 32768, 8, 2, 64) - if err != nil { - return fmt.Sprintf("failed to derive password: %s", err) - } - - buffer.Truncate(len(master_password_seed)) - binary.Write(&buffer, binary.BigEndian, uint32(len(site))) - buffer.WriteString(site) - binary.Write(&buffer, binary.BigEndian, counter) - - var hmacv = hmac.New(sha256.New, key) - hmacv.Write(buffer.Bytes()) - var seed = hmacv.Sum(nil) - var temp = templates[int(seed[0])%len(templates)] - - buffer.Truncate(0) - for i, element := range temp { - pass_chars := template_characters[element] - pass_char := pass_chars[int(seed[i+1])%len(pass_chars)] - buffer.WriteByte(pass_char) - } - - return buffer.String() -} - -func generatePrivateKey(typ string) string { - var priv interface{} - var err error - switch typ { - case "", "rsa": - // good enough for government work - priv, err = rsa.GenerateKey(rand.Reader, 4096) - case "dsa": - key := new(dsa.PrivateKey) - // again, good enough for government work - if err = dsa.GenerateParameters(&key.Parameters, rand.Reader, dsa.L2048N256); err != nil { - return fmt.Sprintf("failed to generate dsa params: %s", err) - } - err = dsa.GenerateKey(key, rand.Reader) - priv = key - case "ecdsa": - // again, good enough for government work - priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - default: - return "Unknown type " + typ - } - if err != nil { - return fmt.Sprintf("failed to generate private key: %s", err) - } - - return string(pem.EncodeToMemory(pemBlockForKey(priv))) -} - -type DSAKeyFormat struct { - Version int - P, Q, G, Y, X *big.Int -} - -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 *dsa.PrivateKey: - val := DSAKeyFormat{ - P: k.P, Q: k.Q, G: k.G, - Y: k.Y, X: k.X, - } - bytes, _ := asn1.Marshal(val) - return &pem.Block{Type: "DSA PRIVATE KEY", Bytes: bytes} - case *ecdsa.PrivateKey: - b, _ := x509.MarshalECPrivateKey(k) - return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} - default: - return nil - } -} - -type certificate struct { - Cert string - Key string -} - -func buildCustomCertificate(b64cert string, b64key string) (certificate, error) { - crt := certificate{} - - cert, err := base64.StdEncoding.DecodeString(b64cert) - if err != nil { - return crt, errors.New("unable to decode base64 certificate") - } - - key, err := base64.StdEncoding.DecodeString(b64key) - if err != nil { - return crt, errors.New("unable to decode base64 private key") - } - - decodedCert, _ := pem.Decode(cert) - if decodedCert == nil { - return crt, errors.New("unable to decode certificate") - } - _, err = x509.ParseCertificate(decodedCert.Bytes) - if err != nil { - return crt, fmt.Errorf( - "error parsing certificate: decodedCert.Bytes: %s", - err, - ) - } - - decodedKey, _ := pem.Decode(key) - if decodedKey == nil { - return crt, errors.New("unable to decode key") - } - _, err = x509.ParsePKCS1PrivateKey(decodedKey.Bytes) - if err != nil { - return crt, fmt.Errorf( - "error parsing prive key: decodedKey.Bytes: %s", - err, - ) - } - - crt.Cert = string(cert) - crt.Key = string(key) - - return crt, nil -} - -func generateCertificateAuthority( - cn string, - daysValid int, -) (certificate, error) { - ca := certificate{} - - template, err := getBaseCertTemplate(cn, nil, nil, daysValid) - if err != nil { - return ca, err - } - // Override KeyUsage and IsCA - template.KeyUsage = x509.KeyUsageKeyEncipherment | - x509.KeyUsageDigitalSignature | - x509.KeyUsageCertSign - template.IsCA = true - - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - return ca, fmt.Errorf("error generating rsa key: %s", err) - } - - ca.Cert, ca.Key, err = getCertAndKey(template, priv, template, priv) - if err != nil { - return ca, err - } - - return ca, nil -} - -func generateSelfSignedCertificate( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, -) (certificate, error) { - cert := certificate{} - - template, err := getBaseCertTemplate(cn, ips, alternateDNS, daysValid) - if err != nil { - return cert, err - } - - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - return cert, fmt.Errorf("error generating rsa key: %s", err) - } - - cert.Cert, cert.Key, err = getCertAndKey(template, priv, template, priv) - if err != nil { - return cert, err - } - - return cert, nil -} - -func generateSignedCertificate( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, - ca certificate, -) (certificate, error) { - cert := certificate{} - - decodedSignerCert, _ := pem.Decode([]byte(ca.Cert)) - if decodedSignerCert == nil { - return cert, errors.New("unable to decode certificate") - } - signerCert, err := x509.ParseCertificate(decodedSignerCert.Bytes) - if err != nil { - return cert, fmt.Errorf( - "error parsing certificate: decodedSignerCert.Bytes: %s", - err, - ) - } - decodedSignerKey, _ := pem.Decode([]byte(ca.Key)) - if decodedSignerKey == nil { - return cert, errors.New("unable to decode key") - } - signerKey, err := x509.ParsePKCS1PrivateKey(decodedSignerKey.Bytes) - if err != nil { - return cert, fmt.Errorf( - "error parsing prive key: decodedSignerKey.Bytes: %s", - err, - ) - } - - template, err := getBaseCertTemplate(cn, ips, alternateDNS, daysValid) - if err != nil { - return cert, err - } - - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - return cert, fmt.Errorf("error generating rsa key: %s", err) - } - - cert.Cert, cert.Key, err = getCertAndKey( - template, - priv, - signerCert, - signerKey, - ) - if err != nil { - return cert, err - } - - return cert, nil -} - -func getCertAndKey( - template *x509.Certificate, - signeeKey *rsa.PrivateKey, - parent *x509.Certificate, - signingKey *rsa.PrivateKey, -) (string, string, error) { - derBytes, err := x509.CreateCertificate( - rand.Reader, - template, - parent, - &signeeKey.PublicKey, - signingKey, - ) - if err != nil { - return "", "", fmt.Errorf("error creating certificate: %s", err) - } - - certBuffer := bytes.Buffer{} - if err := pem.Encode( - &certBuffer, - &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}, - ); err != nil { - return "", "", fmt.Errorf("error pem-encoding certificate: %s", err) - } - - keyBuffer := bytes.Buffer{} - if err := pem.Encode( - &keyBuffer, - &pem.Block{ - Type: "RSA PRIVATE KEY", - Bytes: x509.MarshalPKCS1PrivateKey(signeeKey), - }, - ); err != nil { - return "", "", fmt.Errorf("error pem-encoding key: %s", err) - } - - return string(certBuffer.Bytes()), string(keyBuffer.Bytes()), nil -} - -func getBaseCertTemplate( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, -) (*x509.Certificate, error) { - ipAddresses, err := getNetIPs(ips) - if err != nil { - return nil, err - } - dnsNames, err := getAlternateDNSStrs(alternateDNS) - if err != nil { - return nil, err - } - serialNumberUpperBound := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberUpperBound) - if err != nil { - return nil, err - } - return &x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{ - CommonName: cn, - }, - IPAddresses: ipAddresses, - DNSNames: dnsNames, - NotBefore: time.Now(), - NotAfter: time.Now().Add(time.Hour * 24 * time.Duration(daysValid)), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{ - x509.ExtKeyUsageServerAuth, - x509.ExtKeyUsageClientAuth, - }, - BasicConstraintsValid: true, - }, nil -} - -func getNetIPs(ips []interface{}) ([]net.IP, error) { - if ips == nil { - return []net.IP{}, nil - } - var ipStr string - var ok bool - var netIP net.IP - netIPs := make([]net.IP, len(ips)) - for i, ip := range ips { - ipStr, ok = ip.(string) - if !ok { - return nil, fmt.Errorf("error parsing ip: %v is not a string", ip) - } - netIP = net.ParseIP(ipStr) - if netIP == nil { - return nil, fmt.Errorf("error parsing ip: %s", ipStr) - } - netIPs[i] = netIP - } - return netIPs, nil -} - -func getAlternateDNSStrs(alternateDNS []interface{}) ([]string, error) { - if alternateDNS == nil { - return []string{}, nil - } - var dnsStr string - var ok bool - alternateDNSStrs := make([]string, len(alternateDNS)) - for i, dns := range alternateDNS { - dnsStr, ok = dns.(string) - if !ok { - return nil, fmt.Errorf( - "error processing alternate dns name: %v is not a string", - dns, - ) - } - alternateDNSStrs[i] = dnsStr - } - return alternateDNSStrs, nil -} diff --git a/vendor/github.com/go-task/slim-sprig/glide.lock b/vendor/github.com/go-task/slim-sprig/glide.lock deleted file mode 100644 index 32908e4ed..000000000 --- a/vendor/github.com/go-task/slim-sprig/glide.lock +++ /dev/null @@ -1,31 +0,0 @@ -hash: 6a3f4f83c443958625ff1bafadd95c96d20d729f34e8e8c2fa72782194fc4807 -updated: 2019-01-30T20:16:27.780177826+01:00 -imports: -- name: github.com/google/uuid - version: 064e2069ce9c359c118179501254f67d7d37ba24 -- name: github.com/huandu/xstrings - version: f02667b379e2fb5916c3cda2cf31e0eb885d79f8 -- name: github.com/imdario/mergo - version: 7c29201646fa3de8506f701213473dd407f19646 -- name: github.com/Masterminds/goutils - version: 41ac8693c5c10a92ea1ff5ac3a7f95646f6123b0 -- name: github.com/Masterminds/semver - version: 59c29afe1a994eacb71c833025ca7acf874bb1da -- name: github.com/stretchr/testify - version: c679ae2cc0cb27ec3293fea7e254e47386f05d69 - subpackages: - - assert -- name: golang.org/x/crypto - version: de0752318171da717af4ce24d0a2e8626afaeb11 - subpackages: - - pbkdf2 - - scrypt -testImports: -- name: github.com/davecgh/go-spew - version: 782f4967f2dc4564575ca782fe2d04090b5faca8 - subpackages: - - spew -- name: github.com/pmezard/go-difflib - version: d8ed2627bdf02c080bf22230dbb337003b7aba2d - subpackages: - - difflib diff --git a/vendor/github.com/go-task/slim-sprig/glide.yaml b/vendor/github.com/go-task/slim-sprig/glide.yaml deleted file mode 100644 index 712b2ba88..000000000 --- a/vendor/github.com/go-task/slim-sprig/glide.yaml +++ /dev/null @@ -1,16 +0,0 @@ -package: github.com/Masterminds/sprig -import: -- package: github.com/Masterminds/goutils - version: ^1.0.0 -- package: github.com/google/uuid - version: ^0.2 -- package: golang.org/x/crypto - subpackages: - - scrypt -- package: github.com/Masterminds/semver - version: v1.2.2 -- package: github.com/stretchr/testify -- package: github.com/imdario/mergo - version: ~0.3.7 -- package: github.com/huandu/xstrings - version: ^1.2 diff --git a/vendor/github.com/go-task/slim-sprig/regex.go b/vendor/github.com/go-task/slim-sprig/regex.go deleted file mode 100644 index 2016f6633..000000000 --- a/vendor/github.com/go-task/slim-sprig/regex.go +++ /dev/null @@ -1,35 +0,0 @@ -package sprig - -import ( - "regexp" -) - -func regexMatch(regex string, s string) bool { - match, _ := regexp.MatchString(regex, s) - return match -} - -func regexFindAll(regex string, s string, n int) []string { - r := regexp.MustCompile(regex) - return r.FindAllString(s, n) -} - -func regexFind(regex string, s string) string { - r := regexp.MustCompile(regex) - return r.FindString(s) -} - -func regexReplaceAll(regex string, s string, repl string) string { - r := regexp.MustCompile(regex) - return r.ReplaceAllString(s, repl) -} - -func regexReplaceAllLiteral(regex string, s string, repl string) string { - r := regexp.MustCompile(regex) - return r.ReplaceAllLiteralString(s, repl) -} - -func regexSplit(regex string, s string, n int) []string { - r := regexp.MustCompile(regex) - return r.Split(s, n) -} diff --git a/vendor/github.com/go-task/slim-sprig/semver.go b/vendor/github.com/go-task/slim-sprig/semver.go deleted file mode 100644 index c2bf8a1fd..000000000 --- a/vendor/github.com/go-task/slim-sprig/semver.go +++ /dev/null @@ -1,23 +0,0 @@ -package sprig - -import ( - sv2 "github.com/Masterminds/semver" -) - -func semverCompare(constraint, version string) (bool, error) { - c, err := sv2.NewConstraint(constraint) - if err != nil { - return false, err - } - - v, err := sv2.NewVersion(version) - if err != nil { - return false, err - } - - return c.Check(v), nil -} - -func semver(version string) (*sv2.Version, error) { - return sv2.NewVersion(version) -} diff --git a/vendor/github.com/go-task/slim-sprig/v3/.editorconfig b/vendor/github.com/go-task/slim-sprig/v3/.editorconfig new file mode 100644 index 000000000..b0c95367e --- /dev/null +++ b/vendor/github.com/go-task/slim-sprig/v3/.editorconfig @@ -0,0 +1,14 @@ +# editorconfig.org + +root = true + +[*] +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = tab +indent_size = 8 + +[*.{md,yml,yaml,json}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-task/slim-sprig/v3/.gitattributes b/vendor/github.com/go-task/slim-sprig/v3/.gitattributes new file mode 100644 index 000000000..176a458f9 --- /dev/null +++ b/vendor/github.com/go-task/slim-sprig/v3/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/vendor/github.com/go-task/slim-sprig/.gitignore b/vendor/github.com/go-task/slim-sprig/v3/.gitignore similarity index 100% rename from vendor/github.com/go-task/slim-sprig/.gitignore rename to vendor/github.com/go-task/slim-sprig/v3/.gitignore diff --git a/vendor/github.com/go-task/slim-sprig/CHANGELOG.md b/vendor/github.com/go-task/slim-sprig/v3/CHANGELOG.md similarity index 67% rename from vendor/github.com/go-task/slim-sprig/CHANGELOG.md rename to vendor/github.com/go-task/slim-sprig/v3/CHANGELOG.md index 0a8069c0a..2ce45dd4e 100644 --- a/vendor/github.com/go-task/slim-sprig/CHANGELOG.md +++ b/vendor/github.com/go-task/slim-sprig/v3/CHANGELOG.md @@ -1,5 +1,137 @@ # Changelog +## Release 3.2.3 (2022-11-29) + +### Changed + +- Updated docs (thanks @book987 @aJetHorn @neelayu @pellizzetti @apricote @SaigyoujiYuyuko233 @AlekSi) +- #348: Updated huandu/xstrings which fixed a snake case bug (thanks @yxxhero) +- #353: Updated masterminds/semver which included bug fixes +- #354: Updated golang.org/x/crypto which included bug fixes + +## Release 3.2.2 (2021-02-04) + +This is a re-release of 3.2.1 to satisfy something with the Go module system. + +## Release 3.2.1 (2021-02-04) + +### Changed + +- Upgraded `Masterminds/goutils` to `v1.1.1`. see the [Security Advisory](https://github.com/Masterminds/goutils/security/advisories/GHSA-xg2h-wx96-xgxr) + +## Release 3.2.0 (2020-12-14) + +### Added + +- #211: Added randInt function (thanks @kochurovro) +- #223: Added fromJson and mustFromJson functions (thanks @mholt) +- #242: Added a bcrypt function (thanks @robbiet480) +- #253: Added randBytes function (thanks @MikaelSmith) +- #254: Added dig function for dicts (thanks @nyarly) +- #257: Added regexQuoteMeta for quoting regex metadata (thanks @rheaton) +- #261: Added filepath functions osBase, osDir, osExt, osClean, osIsAbs (thanks @zugl) +- #268: Added and and all functions for testing conditions (thanks @phuslu) +- #181: Added float64 arithmetic addf, add1f, subf, divf, mulf, maxf, and minf + (thanks @andrewmostello) +- #265: Added chunk function to split array into smaller arrays (thanks @karelbilek) +- #270: Extend certificate functions to handle non-RSA keys + add support for + ed25519 keys (thanks @misberner) + +### Changed + +- Removed testing and support for Go 1.12. ed25519 support requires Go 1.13 or newer +- Using semver 3.1.1 and mergo 0.3.11 + +### Fixed + +- #249: Fix htmlDateInZone example (thanks @spawnia) + +NOTE: The dependency github.com/imdario/mergo reverted the breaking change in +0.3.9 via 0.3.10 release. + +## Release 3.1.0 (2020-04-16) + +NOTE: The dependency github.com/imdario/mergo made a behavior change in 0.3.9 +that impacts sprig functionality. Do not use sprig with a version newer than 0.3.8. + +### Added + +- #225: Added support for generating htpasswd hash (thanks @rustycl0ck) +- #224: Added duration filter (thanks @frebib) +- #205: Added `seq` function (thanks @thadc23) + +### Changed + +- #203: Unlambda functions with correct signature (thanks @muesli) +- #236: Updated the license formatting for GitHub display purposes +- #238: Updated package dependency versions. Note, mergo not updated to 0.3.9 + as it causes a breaking change for sprig. That issue is tracked at + https://github.com/imdario/mergo/issues/139 + +### Fixed + +- #229: Fix `seq` example in docs (thanks @kalmant) + +## Release 3.0.2 (2019-12-13) + +### Fixed + +- #220: Updating to semver v3.0.3 to fix issue with <= ranges +- #218: fix typo elyptical->elliptic in ecdsa key description (thanks @laverya) + +## Release 3.0.1 (2019-12-08) + +### Fixed + +- #212: Updated semver fixing broken constraint checking with ^0.0 + +## Release 3.0.0 (2019-10-02) + +### Added + +- #187: Added durationRound function (thanks @yjp20) +- #189: Added numerous template functions that return errors rather than panic (thanks @nrvnrvn) +- #193: Added toRawJson support (thanks @Dean-Coakley) +- #197: Added get support to dicts (thanks @Dean-Coakley) + +### Changed + +- #186: Moving dependency management to Go modules +- #186: Updated semver to v3. This has changes in the way ^ is handled +- #194: Updated documentation on merging and how it copies. Added example using deepCopy +- #196: trunc now supports negative values (thanks @Dean-Coakley) + +## Release 2.22.0 (2019-10-02) + +### Added + +- #173: Added getHostByName function to resolve dns names to ips (thanks @fcgravalos) +- #195: Added deepCopy function for use with dicts + +### Changed + +- Updated merge and mergeOverwrite documentation to explain copying and how to + use deepCopy with it + +## Release 2.21.0 (2019-09-18) + +### Added + +- #122: Added encryptAES/decryptAES functions (thanks @n0madic) +- #128: Added toDecimal support (thanks @Dean-Coakley) +- #169: Added list contcat (thanks @astorath) +- #174: Added deepEqual function (thanks @bonifaido) +- #170: Added url parse and join functions (thanks @astorath) + +### Changed + +- #171: Updated glide config for Google UUID to v1 and to add ranges to semver and testify + +### Fixed + +- #172: Fix semver wildcard example (thanks @piepmatz) +- #175: Fix dateInZone doc example (thanks @s3than) + ## Release 2.20.0 (2019-06-18) ### Added diff --git a/vendor/github.com/go-task/slim-sprig/LICENSE.txt b/vendor/github.com/go-task/slim-sprig/v3/LICENSE.txt similarity index 96% rename from vendor/github.com/go-task/slim-sprig/LICENSE.txt rename to vendor/github.com/go-task/slim-sprig/v3/LICENSE.txt index 5c95accc2..f311b1eaa 100644 --- a/vendor/github.com/go-task/slim-sprig/LICENSE.txt +++ b/vendor/github.com/go-task/slim-sprig/v3/LICENSE.txt @@ -1,5 +1,4 @@ -Sprig -Copyright (C) 2013 Masterminds +Copyright (C) 2013-2020 Masterminds Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/github.com/go-task/slim-sprig/README.md b/vendor/github.com/go-task/slim-sprig/v3/README.md similarity index 62% rename from vendor/github.com/go-task/slim-sprig/README.md rename to vendor/github.com/go-task/slim-sprig/v3/README.md index b70569585..b5ab56425 100644 --- a/vendor/github.com/go-task/slim-sprig/README.md +++ b/vendor/github.com/go-task/slim-sprig/v3/README.md @@ -1,35 +1,32 @@ -# Sprig: Template functions for Go templates -[![Stability: Sustained](https://masterminds.github.io/stability/sustained.svg)](https://masterminds.github.io/stability/sustained.html) -[![Build Status](https://travis-ci.org/Masterminds/sprig.svg?branch=master)](https://travis-ci.org/Masterminds/sprig) +# Slim-Sprig: Template functions for Go templates [![Go Reference](https://pkg.go.dev/badge/github.com/go-task/slim-sprig/v3.svg)](https://pkg.go.dev/github.com/go-task/slim-sprig/v3) -The Go language comes with a [built-in template -language](http://golang.org/pkg/text/template/), but not -very many template functions. Sprig is a library that provides more than 100 commonly -used template functions. - -It is inspired by the template functions found in -[Twig](http://twig.sensiolabs.org/documentation) and in various -JavaScript libraries, such as [underscore.js](http://underscorejs.org/). +Slim-Sprig is a fork of [Sprig](https://github.com/Masterminds/sprig), but with +all functions that depend on external (non standard library) or crypto packages +removed. +The reason for this is to make this library more lightweight. Most of these +functions (specially crypto ones) are not needed on most apps, but costs a lot +in terms of binary size and compilation time. ## Usage -**Template developers**: Please use Sprig's [function documentation](http://masterminds.github.io/sprig/) for +**Template developers**: Please use Slim-Sprig's [function documentation](https://go-task.github.io/slim-sprig/) for detailed instructions and code snippets for the >100 template functions available. -**Go developers**: If you'd like to include Sprig as a library in your program, -our API documentation is available [at GoDoc.org](http://godoc.org/github.com/Masterminds/sprig). +**Go developers**: If you'd like to include Slim-Sprig as a library in your program, +our API documentation is available [at GoDoc.org](http://godoc.org/github.com/go-task/slim-sprig). For standard usage, read on. -### Load the Sprig library +### Load the Slim-Sprig library -To load the Sprig `FuncMap`: +To load the Slim-Sprig `FuncMap`: ```go import ( - "github.com/Masterminds/sprig" "html/template" + + "github.com/go-task/slim-sprig" ) // This example illustrates that the FuncMap *must* be set before the @@ -37,8 +34,6 @@ import ( tpl := template.Must( template.New("base").Funcs(sprig.FuncMap()).ParseGlob("*.html") ) - - ``` ### Calling the functions inside of templates diff --git a/vendor/github.com/go-task/slim-sprig/v3/Taskfile.yml b/vendor/github.com/go-task/slim-sprig/v3/Taskfile.yml new file mode 100644 index 000000000..8e6346bb1 --- /dev/null +++ b/vendor/github.com/go-task/slim-sprig/v3/Taskfile.yml @@ -0,0 +1,12 @@ +# https://taskfile.dev + +version: '3' + +tasks: + default: + cmds: + - task: test + + test: + cmds: + - go test -v . diff --git a/vendor/github.com/go-task/slim-sprig/v3/crypto.go b/vendor/github.com/go-task/slim-sprig/v3/crypto.go new file mode 100644 index 000000000..d06e516d4 --- /dev/null +++ b/vendor/github.com/go-task/slim-sprig/v3/crypto.go @@ -0,0 +1,24 @@ +package sprig + +import ( + "crypto/sha1" + "crypto/sha256" + "encoding/hex" + "fmt" + "hash/adler32" +) + +func sha256sum(input string) string { + hash := sha256.Sum256([]byte(input)) + return hex.EncodeToString(hash[:]) +} + +func sha1sum(input string) string { + hash := sha1.Sum([]byte(input)) + return hex.EncodeToString(hash[:]) +} + +func adler32sum(input string) string { + hash := adler32.Checksum([]byte(input)) + return fmt.Sprintf("%d", hash) +} diff --git a/vendor/github.com/go-task/slim-sprig/date.go b/vendor/github.com/go-task/slim-sprig/v3/date.go similarity index 52% rename from vendor/github.com/go-task/slim-sprig/date.go rename to vendor/github.com/go-task/slim-sprig/v3/date.go index d1d6155d7..ed022ddac 100644 --- a/vendor/github.com/go-task/slim-sprig/date.go +++ b/vendor/github.com/go-task/slim-sprig/v3/date.go @@ -55,6 +55,14 @@ func dateModify(fmt string, date time.Time) time.Time { return date.Add(d) } +func mustDateModify(fmt string, date time.Time) (time.Time, error) { + d, err := time.ParseDuration(fmt) + if err != nil { + return time.Time{}, err + } + return date.Add(d), nil +} + func dateAgo(date interface{}) string { var t time.Time @@ -73,11 +81,72 @@ func dateAgo(date interface{}) string { return duration.String() } +func duration(sec interface{}) string { + var n int64 + switch value := sec.(type) { + default: + n = 0 + case string: + n, _ = strconv.ParseInt(value, 10, 64) + case int64: + n = value + } + return (time.Duration(n) * time.Second).String() +} + +func durationRound(duration interface{}) string { + var d time.Duration + switch duration := duration.(type) { + default: + d = 0 + case string: + d, _ = time.ParseDuration(duration) + case int64: + d = time.Duration(duration) + case time.Time: + d = time.Since(duration) + } + + u := uint64(d) + neg := d < 0 + if neg { + u = -u + } + + var ( + year = uint64(time.Hour) * 24 * 365 + month = uint64(time.Hour) * 24 * 30 + day = uint64(time.Hour) * 24 + hour = uint64(time.Hour) + minute = uint64(time.Minute) + second = uint64(time.Second) + ) + switch { + case u > year: + return strconv.FormatUint(u/year, 10) + "y" + case u > month: + return strconv.FormatUint(u/month, 10) + "mo" + case u > day: + return strconv.FormatUint(u/day, 10) + "d" + case u > hour: + return strconv.FormatUint(u/hour, 10) + "h" + case u > minute: + return strconv.FormatUint(u/minute, 10) + "m" + case u > second: + return strconv.FormatUint(u/second, 10) + "s" + } + return "0s" +} + func toDate(fmt, str string) time.Time { t, _ := time.ParseInLocation(fmt, str, time.Local) return t } +func mustToDate(fmt, str string) (time.Time, error) { + return time.ParseInLocation(fmt, str, time.Local) +} + func unixEpoch(date time.Time) string { return strconv.FormatInt(date.Unix(), 10) } diff --git a/vendor/github.com/go-task/slim-sprig/defaults.go b/vendor/github.com/go-task/slim-sprig/v3/defaults.go similarity index 53% rename from vendor/github.com/go-task/slim-sprig/defaults.go rename to vendor/github.com/go-task/slim-sprig/v3/defaults.go index ed6a8ab29..b9f979666 100644 --- a/vendor/github.com/go-task/slim-sprig/defaults.go +++ b/vendor/github.com/go-task/slim-sprig/v3/defaults.go @@ -1,10 +1,18 @@ package sprig import ( + "bytes" "encoding/json" + "math/rand" "reflect" + "strings" + "time" ) +func init() { + rand.Seed(time.Now().UnixNano()) +} + // dfault checks whether `given` is set, and returns default if not set. // // This returns `d` if `given` appears not to be set, and `given` otherwise. @@ -37,7 +45,7 @@ func empty(given interface{}) bool { case reflect.Array, reflect.Slice, reflect.Map, reflect.String: return g.Len() == 0 case reflect.Bool: - return g.Bool() == false + return !g.Bool() case reflect.Complex64, reflect.Complex128: return g.Complex() == 0 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: @@ -61,18 +69,90 @@ func coalesce(v ...interface{}) interface{} { return nil } +// all returns true if empty(x) is false for all values x in the list. +// If the list is empty, return true. +func all(v ...interface{}) bool { + for _, val := range v { + if empty(val) { + return false + } + } + return true +} + +// any returns true if empty(x) is false for any x in the list. +// If the list is empty, return false. +func any(v ...interface{}) bool { + for _, val := range v { + if !empty(val) { + return true + } + } + return false +} + +// fromJson decodes JSON into a structured value, ignoring errors. +func fromJson(v string) interface{} { + output, _ := mustFromJson(v) + return output +} + +// mustFromJson decodes JSON into a structured value, returning errors. +func mustFromJson(v string) (interface{}, error) { + var output interface{} + err := json.Unmarshal([]byte(v), &output) + return output, err +} + // toJson encodes an item into a JSON string func toJson(v interface{}) string { output, _ := json.Marshal(v) return string(output) } +func mustToJson(v interface{}) (string, error) { + output, err := json.Marshal(v) + if err != nil { + return "", err + } + return string(output), nil +} + // toPrettyJson encodes an item into a pretty (indented) JSON string func toPrettyJson(v interface{}) string { output, _ := json.MarshalIndent(v, "", " ") return string(output) } +func mustToPrettyJson(v interface{}) (string, error) { + output, err := json.MarshalIndent(v, "", " ") + if err != nil { + return "", err + } + return string(output), nil +} + +// toRawJson encodes an item into a JSON string with no escaping of HTML characters. +func toRawJson(v interface{}) string { + output, err := mustToRawJson(v) + if err != nil { + panic(err) + } + return string(output) +} + +// mustToRawJson encodes an item into a JSON string with no escaping of HTML characters. +func mustToRawJson(v interface{}) (string, error) { + buf := new(bytes.Buffer) + enc := json.NewEncoder(buf) + enc.SetEscapeHTML(false) + err := enc.Encode(&v) + if err != nil { + return "", err + } + return strings.TrimSuffix(buf.String(), "\n"), nil +} + // ternary returns the first value if the last value is true, otherwise returns the second value. func ternary(vt interface{}, vf interface{}, v bool) interface{} { if v { diff --git a/vendor/github.com/go-task/slim-sprig/dict.go b/vendor/github.com/go-task/slim-sprig/v3/dict.go similarity index 69% rename from vendor/github.com/go-task/slim-sprig/dict.go rename to vendor/github.com/go-task/slim-sprig/v3/dict.go index 026eccb73..77ebc61b1 100644 --- a/vendor/github.com/go-task/slim-sprig/dict.go +++ b/vendor/github.com/go-task/slim-sprig/v3/dict.go @@ -1,6 +1,11 @@ package sprig -import "github.com/imdario/mergo" +func get(d map[string]interface{}, key string) interface{} { + if val, ok := d[key]; ok { + return val + } + return "" +} func set(d map[string]interface{}, key string, value interface{}) map[string]interface{} { d[key] = value @@ -77,26 +82,6 @@ func dict(v ...interface{}) map[string]interface{} { return dict } -func merge(dst map[string]interface{}, srcs ...map[string]interface{}) interface{} { - for _, src := range srcs { - if err := mergo.Merge(&dst, src); err != nil { - // Swallow errors inside of a template. - return "" - } - } - return dst -} - -func mergeOverwrite(dst map[string]interface{}, srcs ...map[string]interface{}) interface{} { - for _, src := range srcs { - if err := mergo.MergeWithOverwrite(&dst, src); err != nil { - // Swallow errors inside of a template. - return "" - } - } - return dst -} - func values(dict map[string]interface{}) []interface{} { values := []interface{}{} for _, value := range dict { @@ -105,3 +90,29 @@ func values(dict map[string]interface{}) []interface{} { return values } + +func dig(ps ...interface{}) (interface{}, error) { + if len(ps) < 3 { + panic("dig needs at least three arguments") + } + dict := ps[len(ps)-1].(map[string]interface{}) + def := ps[len(ps)-2] + ks := make([]string, len(ps)-2) + for i := 0; i < len(ks); i++ { + ks[i] = ps[i].(string) + } + + return digFromDict(dict, def, ks) +} + +func digFromDict(dict map[string]interface{}, d interface{}, ks []string) (interface{}, error) { + k, ns := ks[0], ks[1:len(ks)] + step, has := dict[k] + if !has { + return d, nil + } + if len(ns) == 0 { + return step, nil + } + return digFromDict(step.(map[string]interface{}), d, ns) +} diff --git a/vendor/github.com/go-task/slim-sprig/doc.go b/vendor/github.com/go-task/slim-sprig/v3/doc.go similarity index 92% rename from vendor/github.com/go-task/slim-sprig/doc.go rename to vendor/github.com/go-task/slim-sprig/v3/doc.go index 8f8f1d737..aabb9d448 100644 --- a/vendor/github.com/go-task/slim-sprig/doc.go +++ b/vendor/github.com/go-task/slim-sprig/v3/doc.go @@ -1,5 +1,5 @@ /* -Sprig: Template functions for Go. +Package sprig provides template functions for Go. This package contains a number of utility functions for working with data inside of Go `html/template` and `text/template` files. diff --git a/vendor/github.com/go-task/slim-sprig/functions.go b/vendor/github.com/go-task/slim-sprig/v3/functions.go similarity index 51% rename from vendor/github.com/go-task/slim-sprig/functions.go rename to vendor/github.com/go-task/slim-sprig/v3/functions.go index 6bf15cf18..5ea74f899 100644 --- a/vendor/github.com/go-task/slim-sprig/functions.go +++ b/vendor/github.com/go-task/slim-sprig/v3/functions.go @@ -3,18 +3,18 @@ package sprig import ( "errors" "html/template" + "math/rand" "os" "path" + "path/filepath" + "reflect" "strconv" "strings" ttemplate "text/template" "time" - - util "github.com/Masterminds/goutils" - "github.com/huandu/xstrings" ) -// Produce the function map. +// FuncMap produces the function map. // // Use this to pass the functions into the template engine: // @@ -62,7 +62,7 @@ func GenericFuncMap() map[string]interface{} { } // These functions are not guaranteed to evaluate to the same result for given input, because they -// refer to the environemnt or global state. +// refer to the environment or global state. var nonhermeticFunctions = []string{ // Date functions "date", @@ -79,81 +79,76 @@ var nonhermeticFunctions = []string{ "randAlpha", "randAscii", "randNumeric", + "randBytes", "uuidv4", // OS "env", "expandenv", + + // Network + "getHostByName", } var genericMap = map[string]interface{}{ "hello": func() string { return "Hello!" }, // Date functions - "date": date, - "date_in_zone": dateInZone, - "date_modify": dateModify, - "now": func() time.Time { return time.Now() }, - "htmlDate": htmlDate, - "htmlDateInZone": htmlDateInZone, - "dateInZone": dateInZone, - "dateModify": dateModify, - "ago": dateAgo, - "toDate": toDate, - "unixEpoch": unixEpoch, + "ago": dateAgo, + "date": date, + "date_in_zone": dateInZone, + "date_modify": dateModify, + "dateInZone": dateInZone, + "dateModify": dateModify, + "duration": duration, + "durationRound": durationRound, + "htmlDate": htmlDate, + "htmlDateInZone": htmlDateInZone, + "must_date_modify": mustDateModify, + "mustDateModify": mustDateModify, + "mustToDate": mustToDate, + "now": time.Now, + "toDate": toDate, + "unixEpoch": unixEpoch, // Strings - "abbrev": abbrev, - "abbrevboth": abbrevboth, - "trunc": trunc, - "trim": strings.TrimSpace, - "upper": strings.ToUpper, - "lower": strings.ToLower, - "title": strings.Title, - "untitle": untitle, - "substr": substring, + "trunc": trunc, + "trim": strings.TrimSpace, + "upper": strings.ToUpper, + "lower": strings.ToLower, + "title": strings.Title, + "substr": substring, // Switch order so that "foo" | repeat 5 "repeat": func(count int, str string) string { return strings.Repeat(str, count) }, // Deprecated: Use trimAll. "trimall": func(a, b string) string { return strings.Trim(b, a) }, // Switch order so that "$foo" | trimall "$" - "trimAll": func(a, b string) string { return strings.Trim(b, a) }, - "trimSuffix": func(a, b string) string { return strings.TrimSuffix(b, a) }, - "trimPrefix": func(a, b string) string { return strings.TrimPrefix(b, a) }, - "nospace": util.DeleteWhiteSpace, - "initials": initials, - "randAlphaNum": randAlphaNumeric, - "randAlpha": randAlpha, - "randAscii": randAscii, - "randNumeric": randNumeric, - "swapcase": util.SwapCase, - "shuffle": xstrings.Shuffle, - "snakecase": xstrings.ToSnakeCase, - "camelcase": xstrings.ToCamelCase, - "kebabcase": xstrings.ToKebabCase, - "wrap": func(l int, s string) string { return util.Wrap(s, l) }, - "wrapWith": func(l int, sep, str string) string { return util.WrapCustom(str, l, sep, true) }, + "trimAll": func(a, b string) string { return strings.Trim(b, a) }, + "trimSuffix": func(a, b string) string { return strings.TrimSuffix(b, a) }, + "trimPrefix": func(a, b string) string { return strings.TrimPrefix(b, a) }, // Switch order so that "foobar" | contains "foo" - "contains": func(substr string, str string) bool { return strings.Contains(str, substr) }, - "hasPrefix": func(substr string, str string) bool { return strings.HasPrefix(str, substr) }, - "hasSuffix": func(substr string, str string) bool { return strings.HasSuffix(str, substr) }, - "quote": quote, - "squote": squote, - "cat": cat, - "indent": indent, - "nindent": nindent, - "replace": replace, - "plural": plural, - "sha1sum": sha1sum, - "sha256sum": sha256sum, + "contains": func(substr string, str string) bool { return strings.Contains(str, substr) }, + "hasPrefix": func(substr string, str string) bool { return strings.HasPrefix(str, substr) }, + "hasSuffix": func(substr string, str string) bool { return strings.HasSuffix(str, substr) }, + "quote": quote, + "squote": squote, + "cat": cat, + "indent": indent, + "nindent": nindent, + "replace": replace, + "plural": plural, + "sha1sum": sha1sum, + "sha256sum": sha256sum, "adler32sum": adler32sum, - "toString": strval, + "toString": strval, // Wrap Atoi to stop errors. - "atoi": func(a string) int { i, _ := strconv.Atoi(a); return i }, - "int64": toInt64, - "int": toInt, - "float64": toFloat64, + "atoi": func(a string) int { i, _ := strconv.Atoi(a); return i }, + "int64": toInt64, + "int": toInt, + "float64": toFloat64, + "seq": seq, + "toDecimal": toDecimal, //"gt": func(a, b int) bool {return a > b}, //"gte": func(a, b int) bool {return a >= b}, @@ -189,9 +184,12 @@ var genericMap = map[string]interface{}{ } return val }, + "randInt": func(min, max int) int { return rand.Intn(max-min) + min }, "biggest": max, "max": max, "min": min, + "maxf": maxf, + "minf": minf, "ceil": ceil, "floor": floor, "round": round, @@ -202,13 +200,22 @@ var genericMap = map[string]interface{}{ "sortAlpha": sortAlpha, // Defaults - "default": dfault, - "empty": empty, - "coalesce": coalesce, - "compact": compact, - "toJson": toJson, - "toPrettyJson": toPrettyJson, - "ternary": ternary, + "default": dfault, + "empty": empty, + "coalesce": coalesce, + "all": all, + "any": any, + "compact": compact, + "mustCompact": mustCompact, + "fromJson": fromJson, + "toJson": toJson, + "toPrettyJson": toPrettyJson, + "toRawJson": toRawJson, + "mustFromJson": mustFromJson, + "mustToJson": mustToJson, + "mustToPrettyJson": mustToPrettyJson, + "mustToRawJson": mustToRawJson, + "ternary": ternary, // Reflection "typeOf": typeOf, @@ -216,18 +223,29 @@ var genericMap = map[string]interface{}{ "typeIsLike": typeIsLike, "kindOf": kindOf, "kindIs": kindIs, + "deepEqual": reflect.DeepEqual, // OS: - "env": func(s string) string { return os.Getenv(s) }, - "expandenv": func(s string) string { return os.ExpandEnv(s) }, + "env": os.Getenv, + "expandenv": os.ExpandEnv, - // File Paths: + // Network: + "getHostByName": getHostByName, + + // Paths: "base": path.Base, "dir": path.Dir, "clean": path.Clean, "ext": path.Ext, "isAbs": path.IsAbs, + // Filepaths: + "osBase": filepath.Base, + "osClean": filepath.Clean, + "osDir": filepath.Dir, + "osExt": filepath.Ext, + "osIsAbs": filepath.IsAbs, + // Encoding: "b64enc": base64encode, "b64dec": base64decode, @@ -238,6 +256,7 @@ var genericMap = map[string]interface{}{ "tuple": list, // FIXME: with the addition of append/prepend these are no longer immutable. "list": list, "dict": dict, + "get": get, "set": set, "unset": unset, "hasKey": hasKey, @@ -245,45 +264,54 @@ var genericMap = map[string]interface{}{ "keys": keys, "pick": pick, "omit": omit, - "merge": merge, - "mergeOverwrite": mergeOverwrite, "values": values, "append": push, "push": push, - "prepend": prepend, - "first": first, - "rest": rest, - "last": last, - "initial": initial, - "reverse": reverse, - "uniq": uniq, - "without": without, - "has": has, - "slice": slice, - - // Crypto: - "genPrivateKey": generatePrivateKey, - "derivePassword": derivePassword, - "buildCustomCert": buildCustomCertificate, - "genCA": generateCertificateAuthority, - "genSelfSignedCert": generateSelfSignedCertificate, - "genSignedCert": generateSignedCertificate, - - // UUIDs: - "uuidv4": uuidv4, - - // SemVer: - "semver": semver, - "semverCompare": semverCompare, + "mustAppend": mustPush, "mustPush": mustPush, + "prepend": prepend, + "mustPrepend": mustPrepend, + "first": first, + "mustFirst": mustFirst, + "rest": rest, + "mustRest": mustRest, + "last": last, + "mustLast": mustLast, + "initial": initial, + "mustInitial": mustInitial, + "reverse": reverse, + "mustReverse": mustReverse, + "uniq": uniq, + "mustUniq": mustUniq, + "without": without, + "mustWithout": mustWithout, + "has": has, + "mustHas": mustHas, + "slice": slice, + "mustSlice": mustSlice, + "concat": concat, + "dig": dig, + "chunk": chunk, + "mustChunk": mustChunk, // Flow Control: "fail": func(msg string) (string, error) { return "", errors.New(msg) }, // Regex - "regexMatch": regexMatch, - "regexFindAll": regexFindAll, - "regexFind": regexFind, - "regexReplaceAll": regexReplaceAll, - "regexReplaceAllLiteral": regexReplaceAllLiteral, - "regexSplit": regexSplit, + "regexMatch": regexMatch, + "mustRegexMatch": mustRegexMatch, + "regexFindAll": regexFindAll, + "mustRegexFindAll": mustRegexFindAll, + "regexFind": regexFind, + "mustRegexFind": mustRegexFind, + "regexReplaceAll": regexReplaceAll, + "mustRegexReplaceAll": mustRegexReplaceAll, + "regexReplaceAllLiteral": regexReplaceAllLiteral, + "mustRegexReplaceAllLiteral": mustRegexReplaceAllLiteral, + "regexSplit": regexSplit, + "mustRegexSplit": mustRegexSplit, + "regexQuoteMeta": regexQuoteMeta, + + // URLs: + "urlParse": urlParse, + "urlJoin": urlJoin, } diff --git a/vendor/github.com/go-task/slim-sprig/list.go b/vendor/github.com/go-task/slim-sprig/v3/list.go similarity index 54% rename from vendor/github.com/go-task/slim-sprig/list.go rename to vendor/github.com/go-task/slim-sprig/v3/list.go index 41e136625..ca0fbb789 100644 --- a/vendor/github.com/go-task/slim-sprig/list.go +++ b/vendor/github.com/go-task/slim-sprig/v3/list.go @@ -2,6 +2,7 @@ package sprig import ( "fmt" + "math" "reflect" "sort" ) @@ -15,6 +16,15 @@ func list(v ...interface{}) []interface{} { } func push(list interface{}, v interface{}) []interface{} { + l, err := mustPush(list, v) + if err != nil { + panic(err) + } + + return l +} + +func mustPush(list interface{}, v interface{}) ([]interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -26,14 +36,23 @@ func push(list interface{}, v interface{}) []interface{} { nl[i] = l2.Index(i).Interface() } - return append(nl, v) + return append(nl, v), nil default: - panic(fmt.Sprintf("Cannot push on type %s", tp)) + return nil, fmt.Errorf("Cannot push on type %s", tp) } } func prepend(list interface{}, v interface{}) []interface{} { + l, err := mustPrepend(list, v) + if err != nil { + panic(err) + } + + return l +} + +func mustPrepend(list interface{}, v interface{}) ([]interface{}, error) { //return append([]interface{}{v}, list...) tp := reflect.TypeOf(list).Kind() @@ -47,14 +66,67 @@ func prepend(list interface{}, v interface{}) []interface{} { nl[i] = l2.Index(i).Interface() } - return append([]interface{}{v}, nl...) + return append([]interface{}{v}, nl...), nil + + default: + return nil, fmt.Errorf("Cannot prepend on type %s", tp) + } +} + +func chunk(size int, list interface{}) [][]interface{} { + l, err := mustChunk(size, list) + if err != nil { + panic(err) + } + + return l +} + +func mustChunk(size int, list interface{}) ([][]interface{}, error) { + tp := reflect.TypeOf(list).Kind() + switch tp { + case reflect.Slice, reflect.Array: + l2 := reflect.ValueOf(list) + + l := l2.Len() + + cs := int(math.Floor(float64(l-1)/float64(size)) + 1) + nl := make([][]interface{}, cs) + + for i := 0; i < cs; i++ { + clen := size + if i == cs-1 { + clen = int(math.Floor(math.Mod(float64(l), float64(size)))) + if clen == 0 { + clen = size + } + } + + nl[i] = make([]interface{}, clen) + + for j := 0; j < clen; j++ { + ix := i*size + j + nl[i][j] = l2.Index(ix).Interface() + } + } + + return nl, nil default: - panic(fmt.Sprintf("Cannot prepend on type %s", tp)) + return nil, fmt.Errorf("Cannot chunk type %s", tp) } } func last(list interface{}) interface{} { + l, err := mustLast(list) + if err != nil { + panic(err) + } + + return l +} + +func mustLast(list interface{}) (interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -62,16 +134,25 @@ func last(list interface{}) interface{} { l := l2.Len() if l == 0 { - return nil + return nil, nil } - return l2.Index(l - 1).Interface() + return l2.Index(l - 1).Interface(), nil default: - panic(fmt.Sprintf("Cannot find last on type %s", tp)) + return nil, fmt.Errorf("Cannot find last on type %s", tp) } } func first(list interface{}) interface{} { + l, err := mustFirst(list) + if err != nil { + panic(err) + } + + return l +} + +func mustFirst(list interface{}) (interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -79,16 +160,25 @@ func first(list interface{}) interface{} { l := l2.Len() if l == 0 { - return nil + return nil, nil } - return l2.Index(0).Interface() + return l2.Index(0).Interface(), nil default: - panic(fmt.Sprintf("Cannot find first on type %s", tp)) + return nil, fmt.Errorf("Cannot find first on type %s", tp) } } func rest(list interface{}) []interface{} { + l, err := mustRest(list) + if err != nil { + panic(err) + } + + return l +} + +func mustRest(list interface{}) ([]interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -96,7 +186,7 @@ func rest(list interface{}) []interface{} { l := l2.Len() if l == 0 { - return nil + return nil, nil } nl := make([]interface{}, l-1) @@ -104,13 +194,22 @@ func rest(list interface{}) []interface{} { nl[i-1] = l2.Index(i).Interface() } - return nl + return nl, nil default: - panic(fmt.Sprintf("Cannot find rest on type %s", tp)) + return nil, fmt.Errorf("Cannot find rest on type %s", tp) } } func initial(list interface{}) []interface{} { + l, err := mustInitial(list) + if err != nil { + panic(err) + } + + return l +} + +func mustInitial(list interface{}) ([]interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -118,7 +217,7 @@ func initial(list interface{}) []interface{} { l := l2.Len() if l == 0 { - return nil + return nil, nil } nl := make([]interface{}, l-1) @@ -126,9 +225,9 @@ func initial(list interface{}) []interface{} { nl[i] = l2.Index(i).Interface() } - return nl + return nl, nil default: - panic(fmt.Sprintf("Cannot find initial on type %s", tp)) + return nil, fmt.Errorf("Cannot find initial on type %s", tp) } } @@ -145,6 +244,15 @@ func sortAlpha(list interface{}) []string { } func reverse(v interface{}) []interface{} { + l, err := mustReverse(v) + if err != nil { + panic(err) + } + + return l +} + +func mustReverse(v interface{}) ([]interface{}, error) { tp := reflect.TypeOf(v).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -157,13 +265,22 @@ func reverse(v interface{}) []interface{} { nl[l-i-1] = l2.Index(i).Interface() } - return nl + return nl, nil default: - panic(fmt.Sprintf("Cannot find reverse on type %s", tp)) + return nil, fmt.Errorf("Cannot find reverse on type %s", tp) } } func compact(list interface{}) []interface{} { + l, err := mustCompact(list) + if err != nil { + panic(err) + } + + return l +} + +func mustCompact(list interface{}) ([]interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -179,13 +296,22 @@ func compact(list interface{}) []interface{} { } } - return nl + return nl, nil default: - panic(fmt.Sprintf("Cannot compact on type %s", tp)) + return nil, fmt.Errorf("Cannot compact on type %s", tp) } } func uniq(list interface{}) []interface{} { + l, err := mustUniq(list) + if err != nil { + panic(err) + } + + return l +} + +func mustUniq(list interface{}) ([]interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -201,9 +327,9 @@ func uniq(list interface{}) []interface{} { } } - return dest + return dest, nil default: - panic(fmt.Sprintf("Cannot find uniq on type %s", tp)) + return nil, fmt.Errorf("Cannot find uniq on type %s", tp) } } @@ -217,6 +343,15 @@ func inList(haystack []interface{}, needle interface{}) bool { } func without(list interface{}, omit ...interface{}) []interface{} { + l, err := mustWithout(list, omit...) + if err != nil { + panic(err) + } + + return l +} + +func mustWithout(list interface{}, omit ...interface{}) ([]interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -232,15 +367,24 @@ func without(list interface{}, omit ...interface{}) []interface{} { } } - return res + return res, nil default: - panic(fmt.Sprintf("Cannot find without on type %s", tp)) + return nil, fmt.Errorf("Cannot find without on type %s", tp) } } func has(needle interface{}, haystack interface{}) bool { + l, err := mustHas(needle, haystack) + if err != nil { + panic(err) + } + + return l +} + +func mustHas(needle interface{}, haystack interface{}) (bool, error) { if haystack == nil { - return false + return false, nil } tp := reflect.TypeOf(haystack).Kind() switch tp { @@ -251,13 +395,13 @@ func has(needle interface{}, haystack interface{}) bool { for i := 0; i < l; i++ { item = l2.Index(i).Interface() if reflect.DeepEqual(needle, item) { - return true + return true, nil } } - return false + return false, nil default: - panic(fmt.Sprintf("Cannot find has on type %s", tp)) + return false, fmt.Errorf("Cannot find has on type %s", tp) } } @@ -267,6 +411,15 @@ func has(needle interface{}, haystack interface{}) bool { // slice $list 3 5 -> list[3:5] // slice $list 3 -> list[3:5] = list[3:] func slice(list interface{}, indices ...interface{}) interface{} { + l, err := mustSlice(list, indices...) + if err != nil { + panic(err) + } + + return l +} + +func mustSlice(list interface{}, indices ...interface{}) (interface{}, error) { tp := reflect.TypeOf(list).Kind() switch tp { case reflect.Slice, reflect.Array: @@ -274,7 +427,7 @@ func slice(list interface{}, indices ...interface{}) interface{} { l := l2.Len() if l == 0 { - return nil + return nil, nil } var start, end int @@ -287,8 +440,25 @@ func slice(list interface{}, indices ...interface{}) interface{} { end = toInt(indices[1]) } - return l2.Slice(start, end).Interface() + return l2.Slice(start, end).Interface(), nil default: - panic(fmt.Sprintf("list should be type of slice or array but %s", tp)) + return nil, fmt.Errorf("list should be type of slice or array but %s", tp) + } +} + +func concat(lists ...interface{}) interface{} { + var res []interface{} + for _, list := range lists { + tp := reflect.TypeOf(list).Kind() + switch tp { + case reflect.Slice, reflect.Array: + l2 := reflect.ValueOf(list) + for i := 0; i < l2.Len(); i++ { + res = append(res, l2.Index(i).Interface()) + } + default: + panic(fmt.Sprintf("Cannot concat type %s as list", tp)) + } } + return res } diff --git a/vendor/github.com/go-task/slim-sprig/v3/network.go b/vendor/github.com/go-task/slim-sprig/v3/network.go new file mode 100644 index 000000000..108d78a94 --- /dev/null +++ b/vendor/github.com/go-task/slim-sprig/v3/network.go @@ -0,0 +1,12 @@ +package sprig + +import ( + "math/rand" + "net" +) + +func getHostByName(name string) string { + addrs, _ := net.LookupHost(name) + //TODO: add error handing when release v3 comes out + return addrs[rand.Intn(len(addrs))] +} diff --git a/vendor/github.com/go-task/slim-sprig/numeric.go b/vendor/github.com/go-task/slim-sprig/v3/numeric.go similarity index 65% rename from vendor/github.com/go-task/slim-sprig/numeric.go rename to vendor/github.com/go-task/slim-sprig/v3/numeric.go index 4bd89bf7f..98cbb37a1 100644 --- a/vendor/github.com/go-task/slim-sprig/numeric.go +++ b/vendor/github.com/go-task/slim-sprig/v3/numeric.go @@ -1,9 +1,11 @@ package sprig import ( + "fmt" "math" "reflect" "strconv" + "strings" ) // toFloat64 converts 64-bit floats @@ -27,7 +29,7 @@ func toFloat64(v interface{}) float64 { case reflect.Float32, reflect.Float64: return val.Float() case reflect.Bool: - if val.Bool() == true { + if val.Bool() { return 1 } return 0 @@ -67,7 +69,7 @@ func toInt64(v interface{}) int64 { case reflect.Float32, reflect.Float64: return int64(val.Float()) case reflect.Bool: - if val.Bool() == true { + if val.Bool() { return 1 } return 0 @@ -87,6 +89,15 @@ func max(a interface{}, i ...interface{}) int64 { return aa } +func maxf(a interface{}, i ...interface{}) float64 { + aa := toFloat64(a) + for _, b := range i { + bb := toFloat64(b) + aa = math.Max(aa, bb) + } + return aa +} + func min(a interface{}, i ...interface{}) int64 { aa := toInt64(a) for _, b := range i { @@ -98,6 +109,15 @@ func min(a interface{}, i ...interface{}) int64 { return aa } +func minf(a interface{}, i ...interface{}) float64 { + aa := toFloat64(a) + for _, b := range i { + bb := toFloat64(b) + aa = math.Min(aa, bb) + } + return aa +} + func until(count int) []int { step := 1 if count < 0 { @@ -138,10 +158,10 @@ func ceil(a interface{}) float64 { return math.Ceil(aa) } -func round(a interface{}, p int, r_opt ...float64) float64 { +func round(a interface{}, p int, rOpt ...float64) float64 { roundOn := .5 - if len(r_opt) > 0 { - roundOn = r_opt[0] + if len(rOpt) > 0 { + roundOn = rOpt[0] } val := toFloat64(a) places := toFloat64(p) @@ -157,3 +177,52 @@ func round(a interface{}, p int, r_opt ...float64) float64 { } return round / pow } + +// converts unix octal to decimal +func toDecimal(v interface{}) int64 { + result, err := strconv.ParseInt(fmt.Sprint(v), 8, 64) + if err != nil { + return 0 + } + return result +} + +func seq(params ...int) string { + increment := 1 + switch len(params) { + case 0: + return "" + case 1: + start := 1 + end := params[0] + if end < start { + increment = -1 + } + return intArrayToString(untilStep(start, end+increment, increment), " ") + case 3: + start := params[0] + end := params[2] + step := params[1] + if end < start { + increment = -1 + if step > 0 { + return "" + } + } + return intArrayToString(untilStep(start, end+increment, step), " ") + case 2: + start := params[0] + end := params[1] + step := 1 + if end < start { + step = -1 + } + return intArrayToString(untilStep(start, end+step, step), " ") + default: + return "" + } +} + +func intArrayToString(slice []int, delimeter string) string { + return strings.Trim(strings.Join(strings.Fields(fmt.Sprint(slice)), delimeter), "[]") +} diff --git a/vendor/github.com/go-task/slim-sprig/reflect.go b/vendor/github.com/go-task/slim-sprig/v3/reflect.go similarity index 100% rename from vendor/github.com/go-task/slim-sprig/reflect.go rename to vendor/github.com/go-task/slim-sprig/v3/reflect.go diff --git a/vendor/github.com/go-task/slim-sprig/v3/regex.go b/vendor/github.com/go-task/slim-sprig/v3/regex.go new file mode 100644 index 000000000..fab551018 --- /dev/null +++ b/vendor/github.com/go-task/slim-sprig/v3/regex.go @@ -0,0 +1,83 @@ +package sprig + +import ( + "regexp" +) + +func regexMatch(regex string, s string) bool { + match, _ := regexp.MatchString(regex, s) + return match +} + +func mustRegexMatch(regex string, s string) (bool, error) { + return regexp.MatchString(regex, s) +} + +func regexFindAll(regex string, s string, n int) []string { + r := regexp.MustCompile(regex) + return r.FindAllString(s, n) +} + +func mustRegexFindAll(regex string, s string, n int) ([]string, error) { + r, err := regexp.Compile(regex) + if err != nil { + return []string{}, err + } + return r.FindAllString(s, n), nil +} + +func regexFind(regex string, s string) string { + r := regexp.MustCompile(regex) + return r.FindString(s) +} + +func mustRegexFind(regex string, s string) (string, error) { + r, err := regexp.Compile(regex) + if err != nil { + return "", err + } + return r.FindString(s), nil +} + +func regexReplaceAll(regex string, s string, repl string) string { + r := regexp.MustCompile(regex) + return r.ReplaceAllString(s, repl) +} + +func mustRegexReplaceAll(regex string, s string, repl string) (string, error) { + r, err := regexp.Compile(regex) + if err != nil { + return "", err + } + return r.ReplaceAllString(s, repl), nil +} + +func regexReplaceAllLiteral(regex string, s string, repl string) string { + r := regexp.MustCompile(regex) + return r.ReplaceAllLiteralString(s, repl) +} + +func mustRegexReplaceAllLiteral(regex string, s string, repl string) (string, error) { + r, err := regexp.Compile(regex) + if err != nil { + return "", err + } + return r.ReplaceAllLiteralString(s, repl), nil +} + +func regexSplit(regex string, s string, n int) []string { + r := regexp.MustCompile(regex) + return r.Split(s, n) +} + +func mustRegexSplit(regex string, s string, n int) ([]string, error) { + r, err := regexp.Compile(regex) + if err != nil { + return []string{}, err + } + return r.Split(s, n), nil +} + +func regexQuoteMeta(s string) string { + return regexp.QuoteMeta(s) +} diff --git a/vendor/github.com/go-task/slim-sprig/strings.go b/vendor/github.com/go-task/slim-sprig/v3/strings.go similarity index 77% rename from vendor/github.com/go-task/slim-sprig/strings.go rename to vendor/github.com/go-task/slim-sprig/v3/strings.go index 943fa3e8a..3c62d6b6f 100644 --- a/vendor/github.com/go-task/slim-sprig/strings.go +++ b/vendor/github.com/go-task/slim-sprig/v3/strings.go @@ -7,8 +7,6 @@ import ( "reflect" "strconv" "strings" - - util "github.com/Masterminds/goutils" ) func base64encode(v string) string { @@ -35,51 +33,6 @@ func base32decode(v string) string { return string(data) } -func abbrev(width int, s string) string { - if width < 4 { - return s - } - r, _ := util.Abbreviate(s, width) - return r -} - -func abbrevboth(left, right int, s string) string { - if right < 4 || left > 0 && right < 7 { - return s - } - r, _ := util.AbbreviateFull(s, left, right) - return r -} -func initials(s string) string { - // Wrap this just to eliminate the var args, which templates don't do well. - return util.Initials(s) -} - -func randAlphaNumeric(count int) string { - // It is not possible, it appears, to actually generate an error here. - r, _ := util.CryptoRandomAlphaNumeric(count) - return r -} - -func randAlpha(count int) string { - r, _ := util.CryptoRandomAlphabetic(count) - return r -} - -func randAscii(count int) string { - r, _ := util.CryptoRandomAscii(count) - return r -} - -func randNumeric(count int) string { - r, _ := util.CryptoRandomNumeric(count) - return r -} - -func untitle(str string) string { - return util.Uncapitalize(str) -} - func quote(str ...interface{}) string { out := make([]string, 0, len(str)) for _, s := range str { @@ -154,9 +107,9 @@ func strslice(v interface{}) []string { default: if v == nil { return []string{} - } else { - return []string{strval(v)} } + + return []string{strval(v)} } } } @@ -187,10 +140,13 @@ func strval(v interface{}) string { } func trunc(c int, s string) string { - if len(s) <= c { - return s + if c < 0 && len(s)+c > 0 { + return s[len(s)+c:] + } + if c >= 0 && len(s) > c { + return s[:c] } - return s[0:c] + return s } func join(sep string, v interface{}) string { diff --git a/vendor/github.com/go-task/slim-sprig/v3/url.go b/vendor/github.com/go-task/slim-sprig/v3/url.go new file mode 100644 index 000000000..b8e120e19 --- /dev/null +++ b/vendor/github.com/go-task/slim-sprig/v3/url.go @@ -0,0 +1,66 @@ +package sprig + +import ( + "fmt" + "net/url" + "reflect" +) + +func dictGetOrEmpty(dict map[string]interface{}, key string) string { + value, ok := dict[key] + if !ok { + return "" + } + tp := reflect.TypeOf(value).Kind() + if tp != reflect.String { + panic(fmt.Sprintf("unable to parse %s key, must be of type string, but %s found", key, tp.String())) + } + return reflect.ValueOf(value).String() +} + +// parses given URL to return dict object +func urlParse(v string) map[string]interface{} { + dict := map[string]interface{}{} + parsedURL, err := url.Parse(v) + if err != nil { + panic(fmt.Sprintf("unable to parse url: %s", err)) + } + dict["scheme"] = parsedURL.Scheme + dict["host"] = parsedURL.Host + dict["hostname"] = parsedURL.Hostname() + dict["path"] = parsedURL.Path + dict["query"] = parsedURL.RawQuery + dict["opaque"] = parsedURL.Opaque + dict["fragment"] = parsedURL.Fragment + if parsedURL.User != nil { + dict["userinfo"] = parsedURL.User.String() + } else { + dict["userinfo"] = "" + } + + return dict +} + +// join given dict to URL string +func urlJoin(d map[string]interface{}) string { + resURL := url.URL{ + Scheme: dictGetOrEmpty(d, "scheme"), + Host: dictGetOrEmpty(d, "host"), + Path: dictGetOrEmpty(d, "path"), + RawQuery: dictGetOrEmpty(d, "query"), + Opaque: dictGetOrEmpty(d, "opaque"), + Fragment: dictGetOrEmpty(d, "fragment"), + } + userinfo := dictGetOrEmpty(d, "userinfo") + var user *url.Userinfo + if userinfo != "" { + tempURL, err := url.Parse(fmt.Sprintf("proto://%s@host", userinfo)) + if err != nil { + panic(fmt.Sprintf("unable to parse userinfo in dict: %s", err)) + } + user = tempURL.User + } + + resURL.User = user + return resURL.String() +} diff --git a/vendor/github.com/golang/protobuf/jsonpb/decode.go b/vendor/github.com/golang/protobuf/jsonpb/decode.go deleted file mode 100644 index 6c16c255f..000000000 --- a/vendor/github.com/golang/protobuf/jsonpb/decode.go +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright 2015 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 jsonpb - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "math" - "reflect" - "strconv" - "strings" - "time" - - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/encoding/protojson" - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapJSONUnmarshalV2 = false - -// UnmarshalNext unmarshals the next JSON object from d into m. -func UnmarshalNext(d *json.Decoder, m proto.Message) error { - return new(Unmarshaler).UnmarshalNext(d, m) -} - -// Unmarshal unmarshals a JSON object from r into m. -func Unmarshal(r io.Reader, m proto.Message) error { - return new(Unmarshaler).Unmarshal(r, m) -} - -// UnmarshalString unmarshals a JSON object from s into m. -func UnmarshalString(s string, m proto.Message) error { - return new(Unmarshaler).Unmarshal(strings.NewReader(s), m) -} - -// Unmarshaler is a configurable object for converting from a JSON -// representation to a protocol buffer object. -type Unmarshaler struct { - // AllowUnknownFields specifies whether to allow messages to contain - // unknown JSON fields, as opposed to failing to unmarshal. - AllowUnknownFields bool - - // AnyResolver is used to resolve the google.protobuf.Any well-known type. - // If unset, the global registry is used by default. - AnyResolver AnyResolver -} - -// JSONPBUnmarshaler is implemented by protobuf messages that customize the way -// they are unmarshaled from JSON. Messages that implement this should also -// implement JSONPBMarshaler so that the custom format can be produced. -// -// The JSON unmarshaling must follow the JSON to proto specification: -// https://developers.google.com/protocol-buffers/docs/proto3#json -// -// Deprecated: Custom types should implement protobuf reflection instead. -type JSONPBUnmarshaler interface { - UnmarshalJSONPB(*Unmarshaler, []byte) error -} - -// Unmarshal unmarshals a JSON object from r into m. -func (u *Unmarshaler) Unmarshal(r io.Reader, m proto.Message) error { - return u.UnmarshalNext(json.NewDecoder(r), m) -} - -// UnmarshalNext unmarshals the next JSON object from d into m. -func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error { - if m == nil { - return errors.New("invalid nil message") - } - - // Parse the next JSON object from the stream. - raw := json.RawMessage{} - if err := d.Decode(&raw); err != nil { - return err - } - - // Check for custom unmarshalers first since they may not properly - // implement protobuf reflection that the logic below relies on. - if jsu, ok := m.(JSONPBUnmarshaler); ok { - return jsu.UnmarshalJSONPB(u, raw) - } - - mr := proto.MessageReflect(m) - - // NOTE: For historical reasons, a top-level null is treated as a noop. - // This is incorrect, but kept for compatibility. - if string(raw) == "null" && mr.Descriptor().FullName() != "google.protobuf.Value" { - return nil - } - - if wrapJSONUnmarshalV2 { - // NOTE: If input message is non-empty, we need to preserve merge semantics - // of the old jsonpb implementation. These semantics are not supported by - // the protobuf JSON specification. - isEmpty := true - mr.Range(func(protoreflect.FieldDescriptor, protoreflect.Value) bool { - isEmpty = false // at least one iteration implies non-empty - return false - }) - if !isEmpty { - // Perform unmarshaling into a newly allocated, empty message. - mr = mr.New() - - // Use a defer to copy all unmarshaled fields into the original message. - dst := proto.MessageReflect(m) - defer mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - dst.Set(fd, v) - return true - }) - } - - // Unmarshal using the v2 JSON unmarshaler. - opts := protojson.UnmarshalOptions{ - DiscardUnknown: u.AllowUnknownFields, - } - if u.AnyResolver != nil { - opts.Resolver = anyResolver{u.AnyResolver} - } - return opts.Unmarshal(raw, mr.Interface()) - } else { - if err := u.unmarshalMessage(mr, raw); err != nil { - return err - } - return protoV2.CheckInitialized(mr.Interface()) - } -} - -func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error { - md := m.Descriptor() - fds := md.Fields() - - if jsu, ok := proto.MessageV1(m.Interface()).(JSONPBUnmarshaler); ok { - return jsu.UnmarshalJSONPB(u, in) - } - - if string(in) == "null" && md.FullName() != "google.protobuf.Value" { - return nil - } - - switch wellKnownType(md.FullName()) { - case "Any": - var jsonObject map[string]json.RawMessage - if err := json.Unmarshal(in, &jsonObject); err != nil { - return err - } - - rawTypeURL, ok := jsonObject["@type"] - if !ok { - return errors.New("Any JSON doesn't have '@type'") - } - typeURL, err := unquoteString(string(rawTypeURL)) - if err != nil { - return fmt.Errorf("can't unmarshal Any's '@type': %q", rawTypeURL) - } - m.Set(fds.ByNumber(1), protoreflect.ValueOfString(typeURL)) - - var m2 protoreflect.Message - if u.AnyResolver != nil { - mi, err := u.AnyResolver.Resolve(typeURL) - if err != nil { - return err - } - m2 = proto.MessageReflect(mi) - } else { - mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) - if err != nil { - if err == protoregistry.NotFound { - return fmt.Errorf("could not resolve Any message type: %v", typeURL) - } - return err - } - m2 = mt.New() - } - - if wellKnownType(m2.Descriptor().FullName()) != "" { - rawValue, ok := jsonObject["value"] - if !ok { - return errors.New("Any JSON doesn't have 'value'") - } - if err := u.unmarshalMessage(m2, rawValue); err != nil { - return fmt.Errorf("can't unmarshal Any nested proto %v: %v", typeURL, err) - } - } else { - delete(jsonObject, "@type") - rawJSON, err := json.Marshal(jsonObject) - if err != nil { - return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", err) - } - if err = u.unmarshalMessage(m2, rawJSON); err != nil { - return fmt.Errorf("can't unmarshal Any nested proto %v: %v", typeURL, err) - } - } - - rawWire, err := protoV2.Marshal(m2.Interface()) - if err != nil { - return fmt.Errorf("can't marshal proto %v into Any.Value: %v", typeURL, err) - } - m.Set(fds.ByNumber(2), protoreflect.ValueOfBytes(rawWire)) - return nil - case "BoolValue", "BytesValue", "StringValue", - "Int32Value", "UInt32Value", "FloatValue", - "Int64Value", "UInt64Value", "DoubleValue": - fd := fds.ByNumber(1) - v, err := u.unmarshalValue(m.NewField(fd), in, fd) - if err != nil { - return err - } - m.Set(fd, v) - return nil - case "Duration": - v, err := unquoteString(string(in)) - if err != nil { - return err - } - d, err := time.ParseDuration(v) - if err != nil { - return fmt.Errorf("bad Duration: %v", err) - } - - sec := d.Nanoseconds() / 1e9 - nsec := d.Nanoseconds() % 1e9 - m.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec))) - m.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec))) - return nil - case "Timestamp": - v, err := unquoteString(string(in)) - if err != nil { - return err - } - t, err := time.Parse(time.RFC3339Nano, v) - if err != nil { - return fmt.Errorf("bad Timestamp: %v", err) - } - - sec := t.Unix() - nsec := t.Nanosecond() - m.Set(fds.ByNumber(1), protoreflect.ValueOfInt64(int64(sec))) - m.Set(fds.ByNumber(2), protoreflect.ValueOfInt32(int32(nsec))) - return nil - case "Value": - switch { - case string(in) == "null": - m.Set(fds.ByNumber(1), protoreflect.ValueOfEnum(0)) - case string(in) == "true": - m.Set(fds.ByNumber(4), protoreflect.ValueOfBool(true)) - case string(in) == "false": - m.Set(fds.ByNumber(4), protoreflect.ValueOfBool(false)) - case hasPrefixAndSuffix('"', in, '"'): - s, err := unquoteString(string(in)) - if err != nil { - return fmt.Errorf("unrecognized type for Value %q", in) - } - m.Set(fds.ByNumber(3), protoreflect.ValueOfString(s)) - case hasPrefixAndSuffix('[', in, ']'): - v := m.Mutable(fds.ByNumber(6)) - return u.unmarshalMessage(v.Message(), in) - case hasPrefixAndSuffix('{', in, '}'): - v := m.Mutable(fds.ByNumber(5)) - return u.unmarshalMessage(v.Message(), in) - default: - f, err := strconv.ParseFloat(string(in), 0) - if err != nil { - return fmt.Errorf("unrecognized type for Value %q", in) - } - m.Set(fds.ByNumber(2), protoreflect.ValueOfFloat64(f)) - } - return nil - case "ListValue": - var jsonArray []json.RawMessage - if err := json.Unmarshal(in, &jsonArray); err != nil { - return fmt.Errorf("bad ListValue: %v", err) - } - - lv := m.Mutable(fds.ByNumber(1)).List() - for _, raw := range jsonArray { - ve := lv.NewElement() - if err := u.unmarshalMessage(ve.Message(), raw); err != nil { - return err - } - lv.Append(ve) - } - return nil - case "Struct": - var jsonObject map[string]json.RawMessage - if err := json.Unmarshal(in, &jsonObject); err != nil { - return fmt.Errorf("bad StructValue: %v", err) - } - - mv := m.Mutable(fds.ByNumber(1)).Map() - for key, raw := range jsonObject { - kv := protoreflect.ValueOf(key).MapKey() - vv := mv.NewValue() - if err := u.unmarshalMessage(vv.Message(), raw); err != nil { - return fmt.Errorf("bad value in StructValue for key %q: %v", key, err) - } - mv.Set(kv, vv) - } - return nil - } - - var jsonObject map[string]json.RawMessage - if err := json.Unmarshal(in, &jsonObject); err != nil { - return err - } - - // Handle known fields. - for i := 0; i < fds.Len(); i++ { - fd := fds.Get(i) - if fd.IsWeak() && fd.Message().IsPlaceholder() { - continue // weak reference is not linked in - } - - // Search for any raw JSON value associated with this field. - var raw json.RawMessage - name := string(fd.Name()) - if fd.Kind() == protoreflect.GroupKind { - name = string(fd.Message().Name()) - } - if v, ok := jsonObject[name]; ok { - delete(jsonObject, name) - raw = v - } - name = string(fd.JSONName()) - if v, ok := jsonObject[name]; ok { - delete(jsonObject, name) - raw = v - } - - field := m.NewField(fd) - // Unmarshal the field value. - if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd) && !isSingularJSONPBUnmarshaler(field, fd)) { - continue - } - v, err := u.unmarshalValue(field, raw, fd) - if err != nil { - return err - } - m.Set(fd, v) - } - - // Handle extension fields. - for name, raw := range jsonObject { - if !strings.HasPrefix(name, "[") || !strings.HasSuffix(name, "]") { - continue - } - - // Resolve the extension field by name. - xname := protoreflect.FullName(name[len("[") : len(name)-len("]")]) - xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) - if xt == nil && isMessageSet(md) { - xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) - } - if xt == nil { - continue - } - delete(jsonObject, name) - fd := xt.TypeDescriptor() - if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { - return fmt.Errorf("extension field %q does not extend message %q", xname, m.Descriptor().FullName()) - } - - field := m.NewField(fd) - // Unmarshal the field value. - if raw == nil || (string(raw) == "null" && !isSingularWellKnownValue(fd) && !isSingularJSONPBUnmarshaler(field, fd)) { - continue - } - v, err := u.unmarshalValue(field, raw, fd) - if err != nil { - return err - } - m.Set(fd, v) - } - - if !u.AllowUnknownFields && len(jsonObject) > 0 { - for name := range jsonObject { - return fmt.Errorf("unknown field %q in %v", name, md.FullName()) - } - } - return nil -} - -func isSingularWellKnownValue(fd protoreflect.FieldDescriptor) bool { - if fd.Cardinality() == protoreflect.Repeated { - return false - } - if md := fd.Message(); md != nil { - return md.FullName() == "google.protobuf.Value" - } - if ed := fd.Enum(); ed != nil { - return ed.FullName() == "google.protobuf.NullValue" - } - return false -} - -func isSingularJSONPBUnmarshaler(v protoreflect.Value, fd protoreflect.FieldDescriptor) bool { - if fd.Message() != nil && fd.Cardinality() != protoreflect.Repeated { - _, ok := proto.MessageV1(v.Interface()).(JSONPBUnmarshaler) - return ok - } - return false -} - -func (u *Unmarshaler) unmarshalValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - switch { - case fd.IsList(): - var jsonArray []json.RawMessage - if err := json.Unmarshal(in, &jsonArray); err != nil { - return v, err - } - lv := v.List() - for _, raw := range jsonArray { - ve, err := u.unmarshalSingularValue(lv.NewElement(), raw, fd) - if err != nil { - return v, err - } - lv.Append(ve) - } - return v, nil - case fd.IsMap(): - var jsonObject map[string]json.RawMessage - if err := json.Unmarshal(in, &jsonObject); err != nil { - return v, err - } - kfd := fd.MapKey() - vfd := fd.MapValue() - mv := v.Map() - for key, raw := range jsonObject { - var kv protoreflect.MapKey - if kfd.Kind() == protoreflect.StringKind { - kv = protoreflect.ValueOf(key).MapKey() - } else { - v, err := u.unmarshalSingularValue(kfd.Default(), []byte(key), kfd) - if err != nil { - return v, err - } - kv = v.MapKey() - } - - vv, err := u.unmarshalSingularValue(mv.NewValue(), raw, vfd) - if err != nil { - return v, err - } - mv.Set(kv, vv) - } - return v, nil - default: - return u.unmarshalSingularValue(v, in, fd) - } -} - -var nonFinite = map[string]float64{ - `"NaN"`: math.NaN(), - `"Infinity"`: math.Inf(+1), - `"-Infinity"`: math.Inf(-1), -} - -func (u *Unmarshaler) unmarshalSingularValue(v protoreflect.Value, in []byte, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - switch fd.Kind() { - case protoreflect.BoolKind: - return unmarshalValue(in, new(bool)) - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: - return unmarshalValue(trimQuote(in), new(int32)) - case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return unmarshalValue(trimQuote(in), new(int64)) - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: - return unmarshalValue(trimQuote(in), new(uint32)) - case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return unmarshalValue(trimQuote(in), new(uint64)) - case protoreflect.FloatKind: - if f, ok := nonFinite[string(in)]; ok { - return protoreflect.ValueOfFloat32(float32(f)), nil - } - return unmarshalValue(trimQuote(in), new(float32)) - case protoreflect.DoubleKind: - if f, ok := nonFinite[string(in)]; ok { - return protoreflect.ValueOfFloat64(float64(f)), nil - } - return unmarshalValue(trimQuote(in), new(float64)) - case protoreflect.StringKind: - return unmarshalValue(in, new(string)) - case protoreflect.BytesKind: - return unmarshalValue(in, new([]byte)) - case protoreflect.EnumKind: - if hasPrefixAndSuffix('"', in, '"') { - vd := fd.Enum().Values().ByName(protoreflect.Name(trimQuote(in))) - if vd == nil { - return v, fmt.Errorf("unknown value %q for enum %s", in, fd.Enum().FullName()) - } - return protoreflect.ValueOfEnum(vd.Number()), nil - } - return unmarshalValue(in, new(protoreflect.EnumNumber)) - case protoreflect.MessageKind, protoreflect.GroupKind: - err := u.unmarshalMessage(v.Message(), in) - return v, err - default: - panic(fmt.Sprintf("invalid kind %v", fd.Kind())) - } -} - -func unmarshalValue(in []byte, v interface{}) (protoreflect.Value, error) { - err := json.Unmarshal(in, v) - return protoreflect.ValueOf(reflect.ValueOf(v).Elem().Interface()), err -} - -func unquoteString(in string) (out string, err error) { - err = json.Unmarshal([]byte(in), &out) - return out, err -} - -func hasPrefixAndSuffix(prefix byte, in []byte, suffix byte) bool { - if len(in) >= 2 && in[0] == prefix && in[len(in)-1] == suffix { - return true - } - return false -} - -// trimQuote is like unquoteString but simply strips surrounding quotes. -// This is incorrect, but is behavior done by the legacy implementation. -func trimQuote(in []byte) []byte { - if len(in) >= 2 && in[0] == '"' && in[len(in)-1] == '"' { - in = in[1 : len(in)-1] - } - return in -} diff --git a/vendor/github.com/golang/protobuf/jsonpb/encode.go b/vendor/github.com/golang/protobuf/jsonpb/encode.go deleted file mode 100644 index 685c80a62..000000000 --- a/vendor/github.com/golang/protobuf/jsonpb/encode.go +++ /dev/null @@ -1,559 +0,0 @@ -// Copyright 2015 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 jsonpb - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "math" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/encoding/protojson" - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapJSONMarshalV2 = false - -// Marshaler is a configurable object for marshaling protocol buffer messages -// to the specified JSON representation. -type Marshaler struct { - // OrigName specifies whether to use the original protobuf name for fields. - OrigName bool - - // EnumsAsInts specifies whether to render enum values as integers, - // as opposed to string values. - EnumsAsInts bool - - // EmitDefaults specifies whether to render fields with zero values. - EmitDefaults bool - - // Indent controls whether the output is compact or not. - // If empty, the output is compact JSON. Otherwise, every JSON object - // entry and JSON array value will be on its own line. - // Each line will be preceded by repeated copies of Indent, where the - // number of copies is the current indentation depth. - Indent string - - // AnyResolver is used to resolve the google.protobuf.Any well-known type. - // If unset, the global registry is used by default. - AnyResolver AnyResolver -} - -// JSONPBMarshaler is implemented by protobuf messages that customize the -// way they are marshaled to JSON. Messages that implement this should also -// implement JSONPBUnmarshaler so that the custom format can be parsed. -// -// The JSON marshaling must follow the proto to JSON specification: -// https://developers.google.com/protocol-buffers/docs/proto3#json -// -// Deprecated: Custom types should implement protobuf reflection instead. -type JSONPBMarshaler interface { - MarshalJSONPB(*Marshaler) ([]byte, error) -} - -// Marshal serializes a protobuf message as JSON into w. -func (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error { - b, err := jm.marshal(m) - if len(b) > 0 { - if _, err := w.Write(b); err != nil { - return err - } - } - return err -} - -// MarshalToString serializes a protobuf message as JSON in string form. -func (jm *Marshaler) MarshalToString(m proto.Message) (string, error) { - b, err := jm.marshal(m) - if err != nil { - return "", err - } - return string(b), nil -} - -func (jm *Marshaler) marshal(m proto.Message) ([]byte, error) { - v := reflect.ValueOf(m) - if m == nil || (v.Kind() == reflect.Ptr && v.IsNil()) { - return nil, errors.New("Marshal called with nil") - } - - // Check for custom marshalers first since they may not properly - // implement protobuf reflection that the logic below relies on. - if jsm, ok := m.(JSONPBMarshaler); ok { - return jsm.MarshalJSONPB(jm) - } - - if wrapJSONMarshalV2 { - opts := protojson.MarshalOptions{ - UseProtoNames: jm.OrigName, - UseEnumNumbers: jm.EnumsAsInts, - EmitUnpopulated: jm.EmitDefaults, - Indent: jm.Indent, - } - if jm.AnyResolver != nil { - opts.Resolver = anyResolver{jm.AnyResolver} - } - return opts.Marshal(proto.MessageReflect(m).Interface()) - } else { - // Check for unpopulated required fields first. - m2 := proto.MessageReflect(m) - if err := protoV2.CheckInitialized(m2.Interface()); err != nil { - return nil, err - } - - w := jsonWriter{Marshaler: jm} - err := w.marshalMessage(m2, "", "") - return w.buf, err - } -} - -type jsonWriter struct { - *Marshaler - buf []byte -} - -func (w *jsonWriter) write(s string) { - w.buf = append(w.buf, s...) -} - -func (w *jsonWriter) marshalMessage(m protoreflect.Message, indent, typeURL string) error { - if jsm, ok := proto.MessageV1(m.Interface()).(JSONPBMarshaler); ok { - b, err := jsm.MarshalJSONPB(w.Marshaler) - if err != nil { - return err - } - if typeURL != "" { - // we are marshaling this object to an Any type - var js map[string]*json.RawMessage - if err = json.Unmarshal(b, &js); err != nil { - return fmt.Errorf("type %T produced invalid JSON: %v", m.Interface(), err) - } - turl, err := json.Marshal(typeURL) - if err != nil { - return fmt.Errorf("failed to marshal type URL %q to JSON: %v", typeURL, err) - } - js["@type"] = (*json.RawMessage)(&turl) - if b, err = json.Marshal(js); err != nil { - return err - } - } - w.write(string(b)) - return nil - } - - md := m.Descriptor() - fds := md.Fields() - - // Handle well-known types. - const secondInNanos = int64(time.Second / time.Nanosecond) - switch wellKnownType(md.FullName()) { - case "Any": - return w.marshalAny(m, indent) - case "BoolValue", "BytesValue", "StringValue", - "Int32Value", "UInt32Value", "FloatValue", - "Int64Value", "UInt64Value", "DoubleValue": - fd := fds.ByNumber(1) - return w.marshalValue(fd, m.Get(fd), indent) - case "Duration": - const maxSecondsInDuration = 315576000000 - // "Generated output always contains 0, 3, 6, or 9 fractional digits, - // depending on required precision." - s := m.Get(fds.ByNumber(1)).Int() - ns := m.Get(fds.ByNumber(2)).Int() - if s < -maxSecondsInDuration || s > maxSecondsInDuration { - return fmt.Errorf("seconds out of range %v", s) - } - if ns <= -secondInNanos || ns >= secondInNanos { - return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) - } - if (s > 0 && ns < 0) || (s < 0 && ns > 0) { - return errors.New("signs of seconds and nanos do not match") - } - var sign string - if s < 0 || ns < 0 { - sign, s, ns = "-", -1*s, -1*ns - } - x := fmt.Sprintf("%s%d.%09d", sign, s, ns) - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, ".000") - w.write(fmt.Sprintf(`"%vs"`, x)) - return nil - case "Timestamp": - // "RFC 3339, where generated output will always be Z-normalized - // and uses 0, 3, 6 or 9 fractional digits." - s := m.Get(fds.ByNumber(1)).Int() - ns := m.Get(fds.ByNumber(2)).Int() - if ns < 0 || ns >= secondInNanos { - return fmt.Errorf("ns out of range [0, %v)", secondInNanos) - } - t := time.Unix(s, ns).UTC() - // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). - x := t.Format("2006-01-02T15:04:05.000000000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, ".000") - w.write(fmt.Sprintf(`"%vZ"`, x)) - return nil - case "Value": - // JSON value; which is a null, number, string, bool, object, or array. - od := md.Oneofs().Get(0) - fd := m.WhichOneof(od) - if fd == nil { - return errors.New("nil Value") - } - return w.marshalValue(fd, m.Get(fd), indent) - case "Struct", "ListValue": - // JSON object or array. - fd := fds.ByNumber(1) - return w.marshalValue(fd, m.Get(fd), indent) - } - - w.write("{") - if w.Indent != "" { - w.write("\n") - } - - firstField := true - if typeURL != "" { - if err := w.marshalTypeURL(indent, typeURL); err != nil { - return err - } - firstField = false - } - - for i := 0; i < fds.Len(); { - fd := fds.Get(i) - if od := fd.ContainingOneof(); od != nil { - fd = m.WhichOneof(od) - i += od.Fields().Len() - if fd == nil { - continue - } - } else { - i++ - } - - v := m.Get(fd) - - if !m.Has(fd) { - if !w.EmitDefaults || fd.ContainingOneof() != nil { - continue - } - if fd.Cardinality() != protoreflect.Repeated && (fd.Message() != nil || fd.Syntax() == protoreflect.Proto2) { - v = protoreflect.Value{} // use "null" for singular messages or proto2 scalars - } - } - - if !firstField { - w.writeComma() - } - if err := w.marshalField(fd, v, indent); err != nil { - return err - } - firstField = false - } - - // Handle proto2 extensions. - if md.ExtensionRanges().Len() > 0 { - // Collect a sorted list of all extension descriptor and values. - type ext struct { - desc protoreflect.FieldDescriptor - val protoreflect.Value - } - var exts []ext - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - exts = append(exts, ext{fd, v}) - } - return true - }) - sort.Slice(exts, func(i, j int) bool { - return exts[i].desc.Number() < exts[j].desc.Number() - }) - - for _, ext := range exts { - if !firstField { - w.writeComma() - } - if err := w.marshalField(ext.desc, ext.val, indent); err != nil { - return err - } - firstField = false - } - } - - if w.Indent != "" { - w.write("\n") - w.write(indent) - } - w.write("}") - return nil -} - -func (w *jsonWriter) writeComma() { - if w.Indent != "" { - w.write(",\n") - } else { - w.write(",") - } -} - -func (w *jsonWriter) marshalAny(m protoreflect.Message, indent string) error { - // "If the Any contains a value that has a special JSON mapping, - // it will be converted as follows: {"@type": xxx, "value": yyy}. - // Otherwise, the value will be converted into a JSON object, - // and the "@type" field will be inserted to indicate the actual data type." - md := m.Descriptor() - typeURL := m.Get(md.Fields().ByNumber(1)).String() - rawVal := m.Get(md.Fields().ByNumber(2)).Bytes() - - var m2 protoreflect.Message - if w.AnyResolver != nil { - mi, err := w.AnyResolver.Resolve(typeURL) - if err != nil { - return err - } - m2 = proto.MessageReflect(mi) - } else { - mt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL) - if err != nil { - return err - } - m2 = mt.New() - } - - if err := protoV2.Unmarshal(rawVal, m2.Interface()); err != nil { - return err - } - - if wellKnownType(m2.Descriptor().FullName()) == "" { - return w.marshalMessage(m2, indent, typeURL) - } - - w.write("{") - if w.Indent != "" { - w.write("\n") - } - if err := w.marshalTypeURL(indent, typeURL); err != nil { - return err - } - w.writeComma() - if w.Indent != "" { - w.write(indent) - w.write(w.Indent) - w.write(`"value": `) - } else { - w.write(`"value":`) - } - if err := w.marshalMessage(m2, indent+w.Indent, ""); err != nil { - return err - } - if w.Indent != "" { - w.write("\n") - w.write(indent) - } - w.write("}") - return nil -} - -func (w *jsonWriter) marshalTypeURL(indent, typeURL string) error { - if w.Indent != "" { - w.write(indent) - w.write(w.Indent) - } - w.write(`"@type":`) - if w.Indent != "" { - w.write(" ") - } - b, err := json.Marshal(typeURL) - if err != nil { - return err - } - w.write(string(b)) - return nil -} - -// marshalField writes field description and value to the Writer. -func (w *jsonWriter) marshalField(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { - if w.Indent != "" { - w.write(indent) - w.write(w.Indent) - } - w.write(`"`) - switch { - case fd.IsExtension(): - // For message set, use the fname of the message as the extension name. - name := string(fd.FullName()) - if isMessageSet(fd.ContainingMessage()) { - name = strings.TrimSuffix(name, ".message_set_extension") - } - - w.write("[" + name + "]") - case w.OrigName: - name := string(fd.Name()) - if fd.Kind() == protoreflect.GroupKind { - name = string(fd.Message().Name()) - } - w.write(name) - default: - w.write(string(fd.JSONName())) - } - w.write(`":`) - if w.Indent != "" { - w.write(" ") - } - return w.marshalValue(fd, v, indent) -} - -func (w *jsonWriter) marshalValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { - switch { - case fd.IsList(): - w.write("[") - comma := "" - lv := v.List() - for i := 0; i < lv.Len(); i++ { - w.write(comma) - if w.Indent != "" { - w.write("\n") - w.write(indent) - w.write(w.Indent) - w.write(w.Indent) - } - if err := w.marshalSingularValue(fd, lv.Get(i), indent+w.Indent); err != nil { - return err - } - comma = "," - } - if w.Indent != "" { - w.write("\n") - w.write(indent) - w.write(w.Indent) - } - w.write("]") - return nil - case fd.IsMap(): - kfd := fd.MapKey() - vfd := fd.MapValue() - mv := v.Map() - - // Collect a sorted list of all map keys and values. - type entry struct{ key, val protoreflect.Value } - var entries []entry - mv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { - entries = append(entries, entry{k.Value(), v}) - return true - }) - sort.Slice(entries, func(i, j int) bool { - switch kfd.Kind() { - case protoreflect.BoolKind: - return !entries[i].key.Bool() && entries[j].key.Bool() - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return entries[i].key.Int() < entries[j].key.Int() - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return entries[i].key.Uint() < entries[j].key.Uint() - case protoreflect.StringKind: - return entries[i].key.String() < entries[j].key.String() - default: - panic("invalid kind") - } - }) - - w.write(`{`) - comma := "" - for _, entry := range entries { - w.write(comma) - if w.Indent != "" { - w.write("\n") - w.write(indent) - w.write(w.Indent) - w.write(w.Indent) - } - - s := fmt.Sprint(entry.key.Interface()) - b, err := json.Marshal(s) - if err != nil { - return err - } - w.write(string(b)) - - w.write(`:`) - if w.Indent != "" { - w.write(` `) - } - - if err := w.marshalSingularValue(vfd, entry.val, indent+w.Indent); err != nil { - return err - } - comma = "," - } - if w.Indent != "" { - w.write("\n") - w.write(indent) - w.write(w.Indent) - } - w.write(`}`) - return nil - default: - return w.marshalSingularValue(fd, v, indent) - } -} - -func (w *jsonWriter) marshalSingularValue(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error { - switch { - case !v.IsValid(): - w.write("null") - return nil - case fd.Message() != nil: - return w.marshalMessage(v.Message(), indent+w.Indent, "") - case fd.Enum() != nil: - if fd.Enum().FullName() == "google.protobuf.NullValue" { - w.write("null") - return nil - } - - vd := fd.Enum().Values().ByNumber(v.Enum()) - if vd == nil || w.EnumsAsInts { - w.write(strconv.Itoa(int(v.Enum()))) - } else { - w.write(`"` + string(vd.Name()) + `"`) - } - return nil - default: - switch v.Interface().(type) { - case float32, float64: - switch { - case math.IsInf(v.Float(), +1): - w.write(`"Infinity"`) - return nil - case math.IsInf(v.Float(), -1): - w.write(`"-Infinity"`) - return nil - case math.IsNaN(v.Float()): - w.write(`"NaN"`) - return nil - } - case int64, uint64: - w.write(fmt.Sprintf(`"%d"`, v.Interface())) - return nil - } - - b, err := json.Marshal(v.Interface()) - if err != nil { - return err - } - w.write(string(b)) - return nil - } -} diff --git a/vendor/github.com/golang/protobuf/jsonpb/json.go b/vendor/github.com/golang/protobuf/jsonpb/json.go deleted file mode 100644 index 480e2448d..000000000 --- a/vendor/github.com/golang/protobuf/jsonpb/json.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2015 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 jsonpb provides functionality to marshal and unmarshal between a -// protocol buffer message and JSON. It follows the specification at -// https://developers.google.com/protocol-buffers/docs/proto3#json. -// -// Do not rely on the default behavior of the standard encoding/json package -// when called on generated message types as it does not operate correctly. -// -// Deprecated: Use the "google.golang.org/protobuf/encoding/protojson" -// package instead. -package jsonpb - -import ( - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// AnyResolver takes a type URL, present in an Any message, -// and resolves it into an instance of the associated message. -type AnyResolver interface { - Resolve(typeURL string) (proto.Message, error) -} - -type anyResolver struct{ AnyResolver } - -func (r anyResolver) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) { - return r.FindMessageByURL(string(message)) -} - -func (r anyResolver) FindMessageByURL(url string) (protoreflect.MessageType, error) { - m, err := r.Resolve(url) - if err != nil { - return nil, err - } - return protoimpl.X.MessageTypeOf(m), nil -} - -func (r anyResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { - return protoregistry.GlobalTypes.FindExtensionByName(field) -} - -func (r anyResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { - return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) -} - -func wellKnownType(s protoreflect.FullName) string { - if s.Parent() == "google.protobuf" { - switch s.Name() { - case "Empty", "Any", - "BoolValue", "BytesValue", "StringValue", - "Int32Value", "UInt32Value", "FloatValue", - "Int64Value", "UInt64Value", "DoubleValue", - "Duration", "Timestamp", - "NullValue", "Struct", "Value", "ListValue": - return string(s.Name()) - } - } - return "" -} - -func isMessageSet(md protoreflect.MessageDescriptor) bool { - ms, ok := md.(interface{ IsMessageSet() bool }) - return ok && ms.IsMessageSet() -} diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go index 85f9f5736..fdff3fdb4 100644 --- a/vendor/github.com/golang/protobuf/ptypes/any.go +++ b/vendor/github.com/golang/protobuf/ptypes/any.go @@ -127,9 +127,10 @@ func Is(any *anypb.Any, m proto.Message) bool { // The allocated message is stored in the embedded proto.Message. // // Example: -// var x ptypes.DynamicAny -// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } -// fmt.Printf("unmarshaled message: %v", x.Message) +// +// var x ptypes.DynamicAny +// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } +// fmt.Printf("unmarshaled message: %v", x.Message) // // Deprecated: Use the any.UnmarshalNew method instead to unmarshal // the any message contents into a new instance of the underlying message. diff --git a/vendor/github.com/google/go-tpm-tools/.github/workflows/ci.yml b/vendor/github.com/google/go-tpm-tools/.github/workflows/ci.yml deleted file mode 100644 index a30c8082b..000000000 --- a/vendor/github.com/google/go-tpm-tools/.github/workflows/ci.yml +++ /dev/null @@ -1,126 +0,0 @@ -# -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# - -name: CI -on: - push: - tags: - - v* - branches: - - master - - main - pull_request: - -jobs: - build: - strategy: - matrix: - go-version: [1.20.x] - # TODO: Get this working on windows-latest - os: [macos-latest, ubuntu-latest] - architecture: [x32, x64] - exclude: - - os: macos-latest - architecture: x32 - name: Generate/Build/Test (${{ matrix.os }}, ${{ matrix.architecture }}, Go ${{ matrix.go-version }}) - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go-version }} - architecture: ${{ matrix.architecture }} - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - version: "3.20.1" - - name: Install protoc-gen-go - run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0 - - name: Check Protobuf Generation - run: | - go generate ./... ./cmd/... ./launcher/... - git diff -G'^[^/]' --exit-code - - name: Install Linux 64-bit packages - run: sudo apt-get -y install libssl-dev - if: runner.os == 'Linux' && matrix.architecture == 'x64' - - name: Install Linux 32-bit packages - run: sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get -y install libssl-dev:i386 libgcc-s1:i386 gcc-multilib - if: runner.os == 'Linux' && matrix.architecture == 'x32' - - name: Install Mac packages - run: brew install openssl - if: runner.os == 'macOS' - - name: Install Windows packages - run: choco install openssl - if: runner.os == 'Windows' - - name: Build all modules - run: go build -v ./... ./cmd/... ./launcher/... - - name: Run specific tests under root permission - run: | - GO_EXECUTABLE_PATH=$(which go) - sudo $GO_EXECUTABLE_PATH test -v -run "TestFetchImageSignaturesDockerPublic" ./launcher - - name: Test all modules - run: go test -v ./... ./cmd/... ./launcher/... - - lint: - strategy: - matrix: - go-version: [1.20.x] - os: [ubuntu-latest] - dir: ["./", "./cmd", "./launcher"] - name: Lint ${{ matrix.dir }} (${{ matrix.os }}, Go ${{ matrix.go-version }}) - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: Run golangci-lint - uses: golangci/golangci-lint-action@v3.2.0 - with: - version: latest - working-directory: ${{ matrix.dir }} - args: > - -D errcheck - -E stylecheck - -E goimports - -E misspell - -E revive - -E gofmt - -E goimports - --exclude-use-default=false - --max-same-issues=0 - --max-issues-per-linter=0 - --timeout 2m - - lintc: - strategy: - matrix: - go-version: [1.20.x] - os: [ubuntu-latest] - name: Lint CGO (${{ matrix.os }}, Go ${{ matrix.go-version }}) - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: Install Linux packages - run: sudo apt-get -y install libssl-dev - - name: Check for CGO Warnings (gcc) - run: CGO_CFLAGS=-Werror CC=gcc go build ./... - - name: Check for CGO Warnings (clang) - run: CGO_CFLAGS=-Werror CC=clang go build ./... diff --git a/vendor/github.com/google/go-tpm-tools/.github/workflows/releaser.yaml b/vendor/github.com/google/go-tpm-tools/.github/workflows/releaser.yaml deleted file mode 100644 index 1cf1ab90a..000000000 --- a/vendor/github.com/google/go-tpm-tools/.github/workflows/releaser.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: release - -on: - push: - branches: - tags: - - 'v*' - pull_request: - -jobs: - release: - strategy: - matrix: - go-version: [1.20.x] - os: [macos-latest, ubuntu-latest] - - name: Release (${{ matrix.os}}, Go ${{ matrix.go-version }}) - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go-version }} - cache: true - - shell: bash - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - id: cache - uses: actions/cache@v3 - with: - path: dist/${{ matrix.os }} - key: ${{ matrix.go }}-${{ env.sha_short }} - - name: Install Linux packages - run: sudo apt-get -y install libssl-dev - if: runner.os == 'Linux' - - name: Install Mac packages - run: brew install openssl - if: runner.os == 'macOS' - - name: Install Windows packages - run: choco install openssl - if: runner.os == 'Windows' - - name: Build all modules - run: go build -v ./... ./cmd/... ./launcher/... - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v3 - if: success() && startsWith(github.ref, 'refs/tags/') && steps.cache.outputs.cache-hit != 'true' - with: - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/vendor/github.com/google/go-tpm-tools/.gitignore b/vendor/github.com/google/go-tpm-tools/.gitignore deleted file mode 100644 index ac2716827..000000000 --- a/vendor/github.com/google/go-tpm-tools/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -launcher/launcher/launcher -*.test -*.test.exe -cmd/gotpm/gotpm -gotpm -gotpm.exe -files/pkg -files/src -files/go-tpm-tools -*.pkg.tar.xz -.vscode* -*.code-workspace -main diff --git a/vendor/github.com/google/go-tpm-tools/.goreleaser.yaml b/vendor/github.com/google/go-tpm-tools/.goreleaser.yaml deleted file mode 100644 index db06cfb52..000000000 --- a/vendor/github.com/google/go-tpm-tools/.goreleaser.yaml +++ /dev/null @@ -1,39 +0,0 @@ -builds: - - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - arm64 - id: "gotpm" - main: ./cmd/gotpm - binary: gotpm - -archives: - - format: tar.gz - # this name template makes the OS and Arch compatible with the results of uname. - name_template: >- - {{ .ProjectName }}_ - {{- title .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 - {{- else if eq .Arch "386" }}i386 - {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }} - # use zip for windows archives - format_overrides: - - goos: windows - format: zip -checksum: - name_template: 'checksums.txt' -snapshot: - name_template: "{{ incpatch .Version }}-next" -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' - -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/vendor/github.com/google/go-tpm-tools/CONTRIBUTING.md b/vendor/github.com/google/go-tpm-tools/CONTRIBUTING.md deleted file mode 100644 index 38ab28c84..000000000 --- a/vendor/github.com/google/go-tpm-tools/CONTRIBUTING.md +++ /dev/null @@ -1,33 +0,0 @@ -# How to Contribute - -We'd love to accept your patches and contributions to this project. There are -just a few small guidelines you need to follow. - -## Contributor License Agreement - -Contributions to this project must be accompanied by a Contributor License -Agreement. You (or your employer) retain the copyright to your contribution; -this simply gives us permission to use and redistribute your contributions as -part of the project. Head over to to see -your current agreements on file or to sign a new one. - -You generally only need to submit a CLA once, so if you've already submitted one -(even if it was for a different project), you probably don't need to do it -again. - -## Code reviews - -All submissions, including submissions by project members, require review. We -use GitHub pull requests for this purpose. Consult -[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more -information on using pull requests. - -## Community Guidelines - -This project follows [Google's Open Source Community -Guidelines](https://opensource.google.com/conduct/). - -## Releasing a new version - -See [`RELEASING.md`](RELEASING.md) for instructions on how to cut a new -version of go-tpm-tools. diff --git a/vendor/github.com/google/go-tpm-tools/README.md b/vendor/github.com/google/go-tpm-tools/README.md deleted file mode 100644 index 2c72ad3e2..000000000 --- a/vendor/github.com/google/go-tpm-tools/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# Go-TPM tools [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/google/go-tpm-tools)](https://github.com/google/go-tpm-tools/releases) - -[![Build Status](https://github.com/google/go-tpm-tools/workflows/CI/badge.svg)](https://github.com/google/go-tpm-tools/actions?query=workflow%3ACI) -[![Go Reference](https://pkg.go.dev/badge/github.com/google/go-tpm-tools.svg)](https://pkg.go.dev/github.com/google/go-tpm-tools) -![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/google/go-tpm-tools) -[![Go Report Card](https://goreportcard.com/badge/github.com/google/go-tpm-tools)](https://goreportcard.com/report/github.com/google/go-tpm-tools) -[![License](https://img.shields.io/badge/LICENSE-Apache2.0-ff69b4.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) - -The `go-tpm-tools` module is a [TPM 2.0](https://trustedcomputinggroup.org/resource/trusted-platform-module-2-0-a-brief-introduction/) support library designed to complement [Go-TPM](https://github.com/google/go-tpm). - -It contains the following public packages: - - [`client`](https://pkg.go.dev/github.com/google/go-tpm-tools/client): - A Go package providing simplified abstractions and utility functions for interacting with a TPM 2.0, including: - - Signing - - Attestation - - Reading PCRs - - Sealing/Unsealing data - - Importing Data and Keys - - Reading NVData - - Getting the TCG Event Log - - [`server`](https://pkg.go.dev/github.com/google/go-tpm-tools/server): - A Go package providing functionality for a remote server to send, receive, and interpret TPM 2.0 data. None of the commands in this package issue TPM commands, but instead handle: - - TCG Event Log parsing - - Attestation verification - - Creating data for Importing into a TPM - - [`proto`](https://pkg.go.dev/github.com/google/go-tpm-tools/proto): - Common [Protocol Buffer](https://developers.google.com/protocol-buffers) messages that are exchanged between the `client` and `server` libraries. This package also contains helper methods for validating these messages. - - [`simulator`](https://pkg.go.dev/github.com/google/go-tpm-tools/simulator): - Go bindings to the Microsoft's [TPM 2.0 simulator](https://github.com/Microsoft/ms-tpm-20-ref/). - -This repository also contains `gotpm`, a command line tool for using the TPM. -Run `gotpm --help` and `gotpm --help` for more documentation. - -### Building and Installing `gotpm` - -`gotpm` can be directly installed from this repo by running: -```bash -go install github.com/google/go-tpm-tools/cmd/gotpm@latest -# gotpm will be installed to $GOBIN -gotpm --help -``` -Alternatively, to build `gotpm` from a cloned version of this repo, run: -```bash -cd /my/path/to/cloned/go-tpm-tools/cmd/gotpm -go build -# gotpm will be in the cmd/gotpm subdirectory of the repo -./gotpm --help -``` - -## Minimum Required Go Version - -This project currently requires Go 1.20 or newer. Any update to the minimum required Go version will be released as a **minor** version update. - -## `openssl` errors when building `simulator` - -Similarly, when building the `simulator` library (or tests), you may get an error that looks like: -``` -fatal error: openssl/aes.h: No such file or directory - 47 | // #include - | ^~~~~~~~~~~~~~~~ -compilation terminated. -``` -This is because the `simulator` library depends on having the [OpenSSL](https://www.openssl.org/) headers installed. To fix this error, install the appropriate header package: - -### Linux - -```bash -# Ubuntu/Debian based systems -sudo apt install libssl-dev -# Redhat/Centos based systems -sudo yum install openssl-devel -# Arch Linux (headers/library in the same package) -sudo pacman -S openssl -``` - -### macOS - -First, install [Homebrew](https://brew.sh/). Then run: -```bash -brew install openssl -``` - -### Windows - -First, install [Chocolatey](https://chocolatey.org/). Then run: -```bash -choco install openssl -``` - -### Custom install location - -If you want to use a different installation of OpenSSL, or you are getting -linker errors like `ld: library not found for -lcrypto`, you can directly -point Go your installation. We will assume your installation is located at -`$OPENSSL_PATH` (with `lib` and `include` subdirectories). - -#### Add OpenSSL to the include and library path at the command line -This solution does not require modifying go-tpm-tools code and is useful when -working on other projects that depend on go-tpm-tools/simulator. -``` -C_INCLUDE_PATH="$OPENSSL_PATH/include" LIBRARY_PATH="$OPENSSL_PATH/lib" go test ... -``` - -#### Add OpenSSL to the include and library path in the code -This solution modifies your local copy of the go-tpm-tools simulator source -and removes the need to provide the paths on the command line. - -Modify the `CFLAGS`/`LDFLAGS` options beginning with `#cgo darwin` or -`#cgo windows` in `simulator/internal/internal.go` to point at your -installation. This could look something like: -```diff -// #cgo darwin CFLAGS: -I $OPENSSL_PATH/include -// #cgo darwin LDFLAGS: -L $OPENSSL_PATH/lib -``` -Remember to revert your modifications to `simulator/internal/internal.go` -before committing your changes. - -## No TPM 1.2 support - -Unlike [Go-TPM](https://github.com/google/go-tpm) (which supports TPM 1.2 and TPM 2.0), this module explicitly only supports TPM 2.0. Users should avoid use of TPM 1.2 due to the inherent reliance on SHA1 (which is [quite broken](https://sha-mbles.github.io/)). - -## Legal - -Copyright 2018 Google Inc. under the -[Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). Microsoft's TPM simulator -code is licensed under a [3-clause BSD license](https://opensource.org/licenses/BSD-3-Clause) and the [TCG software license](https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.38.pdf). See the [`LICENSE`](LICENSE) file for more information. - -This is not an official Google product. diff --git a/vendor/github.com/google/go-tpm-tools/RELEASING.md b/vendor/github.com/google/go-tpm-tools/RELEASING.md deleted file mode 100644 index 332c3cae6..000000000 --- a/vendor/github.com/google/go-tpm-tools/RELEASING.md +++ /dev/null @@ -1,96 +0,0 @@ -# Releasing a new version of `go-tpm-tools` - -This repository contains multiple Go modules, so care is needed when creating a -new version. Be sure to follow these steps as it's very easy to accidentally -cut a release (as GitHub doesn't have sufficiently advanced -[tag protections](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-tag-protection-rules)). - -## Create the main release PR - -Create a standalone PR titled "Release vX.Y.Z" against the `master` branch. This -PR should (ideally) be an empty commit, but might contain some minor changes if -we want to get them in for a specific release. You can create an empty commit -by running: -``` -git commit --allow-empty -``` - -The description of the PR should just be the release notes that we want to -publish in the GitHub Release. The notes should just have one-line summaries -of the PRs in the release. Trivial PRs can be omitted and related PRs can be -combined in a single line. It should have the following subsections: - - "Breaking Changes" (backwards-incompatible changes to the package API) - - "New Features" (backwards-compatible changes to the package API) - - "Bug Fixes" (fixes to any particular issues) - - "Other Changes" (non-breaking code changes or Doc/CI updates) - -Sections can be omitted if there wouldn't be any PRs under them. The -[`v0.3.2` release notes](https://github.com/google/go-tpm-tools/releases/tag/v0.3.2) -are a good example. We don't need to specifically mention who wrote what PR or -link to the "Full Changelog". Users can just look this stuff up on GitHub on -their own. - -This commit _should not_ change the version numbers in [`go.work`](go.work), -[`cmd/go.mod`](cmd/go.mod), or [`launcher/go.mod`](launcher/go.mod). When -reviewing the PR, the reviewers and author should decide if the release -will be a major, minor, or patch release. Note that the PR should only consist -of a single commit and be "squashed" instead of "merged". - -## Tag the releases - -After the new release is in the `master` branch, we need to create git tags so -that the Go version system can find the releases. Generally the author of the -PR should do this. - -Tagging can be done via the GitHub Web UI. On the -[Releases Page](https://github.com/google/go-tpm-tools/releases), -click [Draft a New Release](https://github.com/google/go-tpm-tools/releases/new). -In that draft, create the git tag corresponding to your release, and copy the -approved release notes into the description. - -Check that the preview of the release notes looks good, and click -"Publish release". The release and tag should now be visible on GitHub. - -## Follow-up Submodule update PR - -After the main release has been merged and tagged, we need to update the go.mod -files in the various submodules. First, you should update the version number in: - - [`go.work`](go.work) - - [`cmd/go.mod`](cmd/go.mod) - - [`launcher/go.mod`](launcher/go.mod) - -Next, we cleanup the modules by running: - - run `go mod tidy` in each module directory - - run `go work sync` in the root directory - - this requires Go 1.20 or later - -Finally, create a PR with the title "Submodule update for vX.Y.Z". This PR -doesn't need a description. The reviewers should just check that the above -steps were done. Note that the PR should only consist -of a single commit and be "squashed" instead of "merged". - -## Tagging the submodules - -The submodules must be tagged separately from the main library release. This -is best done on the git command line. After the Submodule update PR has been -merged, checkout the repo and check that your `HEAD` is on the commit for the -submodule update PR on the `master` branch. This _should not_ be normal release -commit `vX.Y.Z`, but a later commit. Then, run the following command: -``` -git tag "cmd/vX.Y.Z" && git tag "launcher/vX.Y.Z" -``` -replacing `vX.Y.Z` with the actual version number. - -Finally, double check that you've tagged the correct commit, and then push the -tags to the `master` branch by running: -``` -git push origin "cmd/vX.Y.Z" "launcher/vX.Y.Z" -``` - -The tags should then be visible at https://github.com/google/go-tpm-tools/tags - -## (Googlers only) sync code back into google3 - -Follow the directions at http://go/thirdpartygo#updating-imported-code to import -the three modules back into google3. You will need to run the import script for -each module. It's fine for the imports for all the modules to be in one CL. diff --git a/vendor/github.com/google/go-tpm-tools/cel/canonical_eventlog.go b/vendor/github.com/google/go-tpm-tools/cel/canonical_eventlog.go deleted file mode 100644 index 3cfcfdb7a..000000000 --- a/vendor/github.com/google/go-tpm-tools/cel/canonical_eventlog.go +++ /dev/null @@ -1,413 +0,0 @@ -// Package cel contains some basic operations of Canonical Eventlog. -// Based on Canonical EventLog Spec (Draft) Version: TCG_IWG_CEL_v1_r0p37. -package cel - -import ( - "bytes" - "crypto" - "encoding/binary" - "fmt" - "io" - - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -const ( - // CEL spec 5.1 - recnumTypeValue uint8 = 0 - pcrTypeValue uint8 = 1 - _ uint8 = 2 // nvindex field is not supported yet - digestsTypeValue uint8 = 3 - - tlvTypeFieldLength int = 1 - tlvLengthFieldLength int = 4 - - recnumValueLength uint32 = 8 // support up to 2^64 records - pcrValueLength uint32 = 1 // support up to 256 PCRs -) - -// TLV definition according to CEL spec TCG_IWG_CEL_v1_r0p37, page 16. -// Length is implicitly defined by len(Value), using uint32 big-endian -// when encoding. -type TLV struct { - Type uint8 - Value []byte -} - -// MarshalBinary marshals a TLV to a byte slice. -func (t TLV) MarshalBinary() (data []byte, err error) { - buf := make([]byte, len(t.Value)+tlvTypeFieldLength+tlvLengthFieldLength) - - buf[0] = t.Type - binary.BigEndian.PutUint32(buf[tlvTypeFieldLength:], uint32(len(t.Value))) - copy(buf[tlvTypeFieldLength+tlvLengthFieldLength:], t.Value) - - return buf, nil -} - -// UnmarshalBinary unmarshal a byte slice to a TLV. -func (t *TLV) UnmarshalBinary(data []byte) error { - valueLength := binary.BigEndian.Uint32(data[tlvTypeFieldLength : tlvTypeFieldLength+tlvLengthFieldLength]) - - if valueLength != uint32(len(data[tlvTypeFieldLength+tlvLengthFieldLength:])) { - return fmt.Errorf("TLV Length doesn't match the size of its Value") - } - t.Type = data[0] - t.Value = data[tlvTypeFieldLength+tlvLengthFieldLength:] - - return nil -} - -// UnmarshalFirstTLV reads and parse the first TLV from the bytes buffer. The function will -// return io.EOF if the buf ends unexpectedly or cannot fill the TLV. -func UnmarshalFirstTLV(buf *bytes.Buffer) (tlv TLV, err error) { - typeByte, err := buf.ReadByte() - if err != nil { - return tlv, err - } - var data []byte - data = append(data, typeByte) - - // get the length - lengthBytes := make([]byte, tlvLengthFieldLength) - bytesRead, err := buf.Read(lengthBytes) - if err != nil { - return TLV{}, err - } - if bytesRead != tlvLengthFieldLength { - return TLV{}, io.EOF - } - valueLength := binary.BigEndian.Uint32(lengthBytes) - data = append(data, lengthBytes...) - - valueBytes := make([]byte, valueLength) - bytesRead, err = buf.Read(valueBytes) - if err != nil { - return TLV{}, err - } - if uint32(bytesRead) != valueLength { - return TLV{}, io.EOF - } - data = append(data, valueBytes...) - - if err = (&tlv).UnmarshalBinary(data); err != nil { - return TLV{}, err - } - return tlv, nil -} - -// Record represents a Canonical Eventlog Record. -type Record struct { - RecNum uint64 - PCR uint8 - Digests map[crypto.Hash][]byte - Content TLV -} - -// Content is a interface for the content in CELR. -type Content interface { - GenerateDigest(crypto.Hash) ([]byte, error) - GetTLV() (TLV, error) -} - -// CEL represents a Canonical Eventlog, which contains a list of Records. -type CEL struct { - Records []Record -} - -// AppendEvent appends a new record to the CEL. -func (c *CEL) AppendEvent(tpm io.ReadWriteCloser, pcr int, hashAlgos []crypto.Hash, event Content) error { - if len(hashAlgos) == 0 { - return fmt.Errorf("need to specify at least one hash algorithm") - } - digestsMap := make(map[crypto.Hash][]byte) - - for _, hashAlgo := range hashAlgos { - digest, err := event.GenerateDigest(hashAlgo) - if err != nil { - return err - } - digestsMap[hashAlgo] = digest - - tpm2Alg, err := tpm2.HashToAlgorithm(hashAlgo) - if err != nil { - return err - } - if err := tpm2.PCRExtend(tpm, tpmutil.Handle(pcr), tpm2Alg, digest, ""); err != nil { - return fmt.Errorf("failed to extend event to PCR%d: %v", pcr, err) - } - } - - eventTlv, err := event.GetTLV() - if err != nil { - return err - } - - celr := Record{ - RecNum: uint64(len(c.Records)), - PCR: uint8(pcr), - Digests: digestsMap, - Content: eventTlv, - } - - c.Records = append(c.Records, celr) - return nil -} - -func createRecNumField(recNum uint64) TLV { - value := make([]byte, recnumValueLength) - binary.BigEndian.PutUint64(value, recNum) - return TLV{recnumTypeValue, value} -} - -// UnmarshalRecNum takes in a TLV with its type equals to the recnum type value (0), and -// return its record number. -func unmarshalRecNum(tlv TLV) (uint64, error) { - if tlv.Type != recnumTypeValue { - return 0, fmt.Errorf("type of the TLV [%d] indicates it is not a recnum field [%d]", - tlv.Type, recnumTypeValue) - } - if uint32(len(tlv.Value)) != recnumValueLength { - return 0, fmt.Errorf( - "length of the value of the TLV [%d] doesn't match the defined length [%d] of value for recnum", - len(tlv.Value), recnumValueLength) - } - return binary.BigEndian.Uint64(tlv.Value), nil -} - -func createPCRField(pcrNum uint8) TLV { - return TLV{pcrTypeValue, []byte{pcrNum}} -} - -// UnmarshalPCR takes in a TLV with its type equals to the PCR type value (1), and -// return its PCR number. -func unmarshalPCR(tlv TLV) (pcrNum uint8, err error) { - if tlv.Type != pcrTypeValue { - return 0, fmt.Errorf("type of the TLV [%d] indicates it is not a PCR field [%d]", - tlv.Type, pcrTypeValue) - } - if uint32(len(tlv.Value)) != pcrValueLength { - return 0, fmt.Errorf( - "length of the value of the TLV [%d] doesn't match the defined length [%d] of value for a PCR field", - len(tlv.Value), pcrValueLength) - } - - return tlv.Value[0], nil -} - -func createDigestField(digestMap map[crypto.Hash][]byte) (TLV, error) { - var buf bytes.Buffer - for hashAlgo, hash := range digestMap { - if len(hash) != hashAlgo.Size() { - return TLV{}, fmt.Errorf("digest length [%d] doesn't match the expected length [%d] for the hash algorithm", - len(hash), hashAlgo.Size()) - } - tpmHashAlg, err := tpm2.HashToAlgorithm(hashAlgo) - if err != nil { - return TLV{}, err - } - singleDigestTLV := TLV{uint8(tpmHashAlg), hash} - d, err := singleDigestTLV.MarshalBinary() - if err != nil { - return TLV{}, err - } - _, err = buf.Write(d) - if err != nil { - return TLV{}, err - } - } - return TLV{digestsTypeValue, buf.Bytes()}, nil -} - -// UnmarshalDigests takes in a TLV with its type equals to the digests type value (3), and -// return its digests content in a map, the key is its TPM hash algorithm. -func unmarshalDigests(tlv TLV) (digestsMap map[crypto.Hash][]byte, err error) { - if tlv.Type != digestsTypeValue { - return nil, fmt.Errorf("type of the TLV indicates it doesn't contain digests") - } - - buf := bytes.NewBuffer(tlv.Value) - digestsMap = make(map[crypto.Hash][]byte) - - for buf.Len() > 0 { - digestTLV, err := UnmarshalFirstTLV(buf) - if err == io.EOF { - return nil, fmt.Errorf("buffer ends unexpectedly") - } else if err != nil { - return nil, err - } - hashAlg, err := tpm2.Algorithm(digestTLV.Type).Hash() - if err != nil { - return nil, err - } - digestsMap[hashAlg] = digestTLV.Value - } - return digestsMap, nil -} - -// EncodeCELR encodes the CELR to bytes according to the CEL spec and write them -// to the bytes byffer. -func (r *Record) EncodeCELR(buf *bytes.Buffer) error { - recnumField, err := createRecNumField(r.RecNum).MarshalBinary() - if err != nil { - return err - } - pcrField, err := createPCRField(r.PCR).MarshalBinary() - if err != nil { - return err - } - digests, err := createDigestField(r.Digests) - if err != nil { - return err - } - digestsField, err := digests.MarshalBinary() - if err != nil { - return err - } - eventField, err := r.Content.MarshalBinary() - if err != nil { - return err - } - _, err = buf.Write(recnumField) - if err != nil { - return err - } - _, err = buf.Write(pcrField) - if err != nil { - return err - } - _, err = buf.Write(digestsField) - if err != nil { - return err - } - _, err = buf.Write(eventField) - if err != nil { - return err - } - return nil -} - -// EncodeCEL encodes the CEL to bytes according to the CEL spec and write them -// to the bytes buffer. -func (c *CEL) EncodeCEL(buf *bytes.Buffer) error { - for _, record := range c.Records { - if err := record.EncodeCELR(buf); err != nil { - return err - } - } - return nil -} - -// DecodeToCEL will read the buf for CEL, will return err if the buffer -// is not complete. -func DecodeToCEL(buf *bytes.Buffer) (CEL, error) { - var cel CEL - for buf.Len() > 0 { - celr, err := DecodeToCELR(buf) - if err == io.EOF { - return CEL{}, fmt.Errorf("buffer ends unexpectedly") - } - if err != nil { - return CEL{}, err - } - cel.Records = append(cel.Records, celr) - } - return cel, nil -} - -// DecodeToCELR will read the buf for the next CELR, will return err if -// failed to unmarshal a correct CELR TLV from the buffer. -func DecodeToCELR(buf *bytes.Buffer) (r Record, err error) { - recnum, err := UnmarshalFirstTLV(buf) - if err != nil { - return Record{}, err - } - r.RecNum, err = unmarshalRecNum(recnum) - if err != nil { - return Record{}, err - } - - pcr, err := UnmarshalFirstTLV(buf) - if err != nil { - return Record{}, err - } - r.PCR, err = unmarshalPCR(pcr) - if err != nil { - return Record{}, err - } - - digests, err := UnmarshalFirstTLV(buf) - if err != nil { - return Record{}, err - } - r.Digests, err = unmarshalDigests(digests) - if err != nil { - return Record{}, err - } - - r.Content, err = UnmarshalFirstTLV(buf) - if err != nil { - return Record{}, err - } - return r, nil -} - -// Replay takes the digests from a Canonical Event Log and carries out the -// extend sequence for each PCR in the log. It then compares the final digests -// against a bank of PCR values to see if they match. -func (c *CEL) Replay(bank *pb.PCRs) error { - tpm2Alg := tpm2.Algorithm(bank.GetHash()) - cryptoHash, err := tpm2Alg.Hash() - if err != nil { - return err - } - replayed := make(map[uint8][]byte) - for _, record := range c.Records { - if _, ok := replayed[record.PCR]; !ok { - replayed[record.PCR] = make([]byte, cryptoHash.Size()) - } - hasher := cryptoHash.New() - digestsMap := record.Digests - digest, ok := digestsMap[cryptoHash] - if !ok { - return fmt.Errorf("the CEL record did not contain a %v digest", cryptoHash) - } - hasher.Write(replayed[record.PCR]) - hasher.Write(digest) - replayed[record.PCR] = hasher.Sum(nil) - } - - var failedReplayPcrs []uint8 - for replayPcr, replayDigest := range replayed { - bankDigest, ok := bank.Pcrs[uint32(replayPcr)] - if !ok { - return fmt.Errorf("the CEL contained record(s) for PCR%d without a matching PCR in the bank to verify", replayPcr) - } - if !bytes.Equal(bankDigest, replayDigest) { - failedReplayPcrs = append(failedReplayPcrs, replayPcr) - } - } - - if len(failedReplayPcrs) == 0 { - return nil - } - - return fmt.Errorf("CEL replay failed for these PCRs in bank %v: %v", cryptoHash, failedReplayPcrs) -} - -// VerifyDigests checks the digest generated by the given record's content to make sure they are equal to -// the digests in the digestMap. -func VerifyDigests(c Content, digestMap map[crypto.Hash][]byte) error { - for hash, digest := range digestMap { - generatedDigest, err := c.GenerateDigest(hash) - if err != nil { - return err - } - if !bytes.Equal(generatedDigest, digest) { - return fmt.Errorf("CEL record content digest verification failed for %s", hash) - } - } - return nil -} diff --git a/vendor/github.com/google/go-tpm-tools/cel/canonical_eventlog_test.go b/vendor/github.com/google/go-tpm-tools/cel/canonical_eventlog_test.go deleted file mode 100644 index 82779bb32..000000000 --- a/vendor/github.com/google/go-tpm-tools/cel/canonical_eventlog_test.go +++ /dev/null @@ -1,175 +0,0 @@ -package cel - -import ( - "bytes" - "crypto" - "crypto/rand" - "io" - "reflect" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -var measuredHashes = []crypto.Hash{crypto.SHA1, crypto.SHA256} - -func TestCELEncodingDecoding(t *testing.T) { - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - cel := &CEL{} - - cosEvent := CosTlv{ImageDigestType, []byte("sha256:781d8dfdd92118436bd914442c8339e653b83f6bf3c1a7a98efcfb7c4fed7483")} - appendOrFatal(t, cel, tpm, test.DebugPCR, measuredHashes, cosEvent) - - cosEvent2 := CosTlv{ImageRefType, []byte("docker.io/bazel/experimental/test:latest")} - appendOrFatal(t, cel, tpm, test.ApplicationPCR, measuredHashes, cosEvent2) - - var buf bytes.Buffer - if err := cel.EncodeCEL(&buf); err != nil { - t.Fatal(err) - } - decodedcel, err := DecodeToCEL(&buf) - if err != nil { - t.Fatal(err) - } - if len(decodedcel.Records) != 2 { - t.Errorf("should have two records") - } - if decodedcel.Records[0].RecNum != 0 { - t.Errorf("recnum mismatch") - } - if decodedcel.Records[1].RecNum != 1 { - t.Errorf("recnum mismatch") - } - if decodedcel.Records[0].PCR != uint8(test.DebugPCR) { - t.Errorf("pcr value mismatch") - } - if decodedcel.Records[1].PCR != uint8(test.ApplicationPCR) { - t.Errorf("pcr value mismatch") - } - - if !reflect.DeepEqual(decodedcel.Records, cel.Records) { - t.Errorf("decoded CEL doesn't equal to the original one") - } -} - -func TestCELMeasureAndReplay(t *testing.T) { - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - err := tpm2.PCRReset(tpm, tpmutil.Handle(test.DebugPCR)) - if err != nil { - t.Fatal(err) - } - err = tpm2.PCRReset(tpm, tpmutil.Handle(test.ApplicationPCR)) - if err != nil { - t.Fatal(err) - } - - cel := &CEL{} - - cosEvent := CosTlv{ImageRefType, []byte("docker.io/bazel/experimental/test:latest")} - someEvent2 := make([]byte, 10) - rand.Read(someEvent2) - cosEvent2 := CosTlv{ImageDigestType, someEvent2} - appendOrFatal(t, cel, tpm, test.DebugPCR, measuredHashes, cosEvent) - appendOrFatal(t, cel, tpm, test.DebugPCR, measuredHashes, cosEvent2) - - appendOrFatal(t, cel, tpm, test.ApplicationPCR, measuredHashes, cosEvent2) - appendOrFatal(t, cel, tpm, test.ApplicationPCR, measuredHashes, cosEvent) - appendOrFatal(t, cel, tpm, test.ApplicationPCR, measuredHashes, cosEvent) - - replay(t, cel, tpm, measuredHashes, - []int{test.DebugPCR, test.ApplicationPCR}, true /*shouldSucceed*/) - // Supersets should pass. - replay(t, cel, tpm, measuredHashes, - []int{0, 13, 14, test.DebugPCR, 22, test.ApplicationPCR}, true /*shouldSucceed*/) -} - -func TestCELReplayFailTamperedDigest(t *testing.T) { - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - cel := &CEL{} - - cosEvent := CosTlv{ImageRefType, []byte("docker.io/bazel/experimental/test:latest")} - someEvent2 := make([]byte, 10) - - rand.Read(someEvent2) - cosEvent2 := CosTlv{ImageDigestType, someEvent2} - appendOrFatal(t, cel, tpm, test.DebugPCR, measuredHashes, cosEvent) - appendOrFatal(t, cel, tpm, test.DebugPCR, measuredHashes, cosEvent2) - - appendOrFatal(t, cel, tpm, test.ApplicationPCR, measuredHashes, cosEvent2) - appendOrFatal(t, cel, tpm, test.ApplicationPCR, measuredHashes, cosEvent) - appendOrFatal(t, cel, tpm, test.ApplicationPCR, measuredHashes, cosEvent) - - modifiedRecord := cel.Records[3] - for hash := range modifiedRecord.Digests { - newDigest := make([]byte, hash.Size()) - rand.Read(newDigest) - modifiedRecord.Digests[hash] = newDigest - } - replay(t, cel, tpm, measuredHashes, - []int{test.DebugPCR, test.ApplicationPCR}, false /*shouldSucceed*/) -} - -func TestCELReplayEmpty(t *testing.T) { - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - cel := &CEL{} - replay(t, cel, tpm, []crypto.Hash{crypto.SHA1, crypto.SHA256}, - []int{test.DebugPCR, test.ApplicationPCR}, true /*shouldSucceed*/) -} - -func TestCELReplayFailMissingPCRsInBank(t *testing.T) { - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - cel := &CEL{} - - someEvent := make([]byte, 10) - someEvent2 := make([]byte, 10) - rand.Read(someEvent2) - appendOrFatal(t, cel, tpm, test.DebugPCR, measuredHashes, CosTlv{ImageRefType, someEvent}) - appendOrFatal(t, cel, tpm, test.ApplicationPCR, measuredHashes, CosTlv{ImageDigestType, someEvent2}) - replay(t, cel, tpm, measuredHashes, - []int{test.DebugPCR}, false /*shouldSucceed*/) - replay(t, cel, tpm, measuredHashes, - []int{test.ApplicationPCR}, false /*shouldSucceed*/) -} - -func replay(t *testing.T, cel *CEL, tpm io.ReadWriteCloser, measuredHashes []crypto.Hash, pcrs []int, shouldSucceed bool) { - for _, hash := range measuredHashes { - tpm2Hash, err := tpm2.HashToAlgorithm(hash) - if err != nil { - t.Fatal(err) - } - pcrMap, err := tpm2.ReadPCRs(tpm, tpm2.PCRSelection{Hash: tpm2Hash, PCRs: pcrs}) - if err != nil { - t.Fatal(err) - } - pbPcr := &pb.PCRs{Hash: pb.HashAlgo(tpm2Hash), - Pcrs: map[uint32][]byte{}, - } - for index, val := range pcrMap { - pbPcr.Pcrs[uint32(index)] = val - } - if err := cel.Replay(pbPcr); shouldSucceed && err != nil { - t.Errorf("failed to replay CEL on %v bank: %v", - pb.HashAlgo_name[int32(pbPcr.Hash)], err) - } - } -} - -func appendOrFatal(t *testing.T, cel *CEL, tpm io.ReadWriteCloser, pcr int, hashAlgos []crypto.Hash, event Content) { - if err := cel.AppendEvent(tpm, pcr, hashAlgos, event); err != nil { - t.Fatalf("failed to append event: %v", err) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/cel/cos_tlv.go b/vendor/github.com/google/go-tpm-tools/cel/cos_tlv.go deleted file mode 100644 index fb4438ee2..000000000 --- a/vendor/github.com/google/go-tpm-tools/cel/cos_tlv.go +++ /dev/null @@ -1,126 +0,0 @@ -package cel - -import ( - "crypto" - "fmt" - "regexp" - "strings" - "unicode/utf8" -) - -const ( - // CosEventType indicates the CELR event is a COS content - // TODO: the value needs to be reserved in the CEL spec - CosEventType uint8 = 80 - // CosEventPCR is the PCR which should be used for CosEventType events. - CosEventPCR = 13 -) - -// CosType represent a COS content type in a CEL record content. -type CosType uint8 - -// Type for COS nested events -const ( - ImageRefType CosType = iota - ImageDigestType - RestartPolicyType - ImageIDType - ArgType - EnvVarType - OverrideArgType - OverrideEnvType - // EventContent is empty on success, or contains an error message on failure. - LaunchSeparatorType -) - -// CosTlv is a specific event type created for the COS (Google Container-Optimized OS), -// used as a CEL content. -type CosTlv struct { - EventType CosType - EventContent []byte -} - -// GetTLV returns the TLV representation of the COS TLV. -func (c CosTlv) GetTLV() (TLV, error) { - data, err := TLV{uint8(c.EventType), c.EventContent}.MarshalBinary() - if err != nil { - return TLV{}, err - } - - return TLV{ - Type: CosEventType, - Value: data, - }, nil -} - -// GenerateDigest generates the digest for the given COS TLV. The whole TLV struct will -// be marshaled to bytes and feed into the hash algo. -func (c CosTlv) GenerateDigest(hashAlgo crypto.Hash) ([]byte, error) { - contentTLV, err := c.GetTLV() - if err != nil { - return nil, err - } - - b, err := contentTLV.MarshalBinary() - if err != nil { - return nil, err - } - - hash := hashAlgo.New() - if _, err = hash.Write(b); err != nil { - return nil, err - } - return hash.Sum(nil), nil -} - -// ParseToCosTlv constructs a CosTlv from a TLV. It will check for the correct COS event -// type, and unmarshal the nested event. -func (t TLV) ParseToCosTlv() (CosTlv, error) { - if !t.IsCosTlv() { - return CosTlv{}, fmt.Errorf("TLV type %v is not a COS event", t.Type) - } - nestedEvent := TLV{} - err := nestedEvent.UnmarshalBinary(t.Value) - if err != nil { - return CosTlv{}, err - } - return CosTlv{CosType(nestedEvent.Type), nestedEvent.Value}, nil -} - -// IsCosTlv check whether a TLV is a COS TLV by its Type value. -func (t TLV) IsCosTlv() bool { - return t.Type == CosEventType -} - -// FormatEnvVar takes in an environment variable name and its value, run some checks. Concats -// the name and value by '=' and returns it if valid; returns an error if the name or value -// is invalid. -func FormatEnvVar(name string, value string) (string, error) { - if !utf8.ValidString(name) { - return "", fmt.Errorf("malformed env name, contains non-utf8 character: [%s]", name) - } - if !utf8.ValidString(value) { - return "", fmt.Errorf("malformed env value, contains non-utf8 character: [%s]", value) - } - var envVarNameRegexp = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$") - if !envVarNameRegexp.MatchString(name) { - return "", fmt.Errorf("malformed env name [%s], env name must start with an alpha character or '_', followed by a string of alphanumeric characters or '_' (%s)", name, envVarNameRegexp) - } - return name + "=" + value, nil -} - -// ParseEnvVar takes in environment variable as a string (foo=bar), parses it and returns its name -// and value, or an error if it fails the validation check. -func ParseEnvVar(envvar string) (string, string, error) { - // switch to strings.Cut when upgrading to go 1.18 - e := strings.SplitN(string(envvar), "=", 2) - if len(e) < 2 { - return "", "", fmt.Errorf("malformed env var, doesn't contain '=': [%s]", envvar) - } - - if _, err := FormatEnvVar(e[0], e[1]); err != nil { - return "", "", err - } - - return e[0], e[1], nil -} diff --git a/vendor/github.com/google/go-tpm-tools/cel/cos_tlv_test.go b/vendor/github.com/google/go-tpm-tools/cel/cos_tlv_test.go deleted file mode 100644 index 73934bcd4..000000000 --- a/vendor/github.com/google/go-tpm-tools/cel/cos_tlv_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package cel - -import ( - "bytes" - "strings" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - pb "github.com/google/go-tpm-tools/proto/attest" -) - -func TestCosEventlog(t *testing.T) { - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - cel := &CEL{} - - testEvents := []struct { - cosNestedEventType CosType - pcr int - eventPayload []byte - }{ - {ImageRefType, test.DebugPCR, []byte("docker.io/bazel/experimental/test:latest")}, - {ImageDigestType, test.DebugPCR, []byte("sha256:781d8dfdd92118436bd914442c8339e653b83f6bf3c1a7a98efcfb7c4fed7483")}, - {RestartPolicyType, test.DebugPCR, []byte(pb.RestartPolicy_Never.String())}, - {ImageIDType, test.DebugPCR, []byte("sha256:5DF4A1AC347DCF8CF5E9D0ABC04B04DB847D1B88D3B1CC1006F0ACB68E5A1F4B")}, - {EnvVarType, test.DebugPCR, []byte("foo=bar")}, - {EnvVarType, test.DebugPCR, []byte("override-env-1=foo")}, - {EnvVarType, test.DebugPCR, []byte("baz=foo=bar")}, - {EnvVarType, test.DebugPCR, []byte("empty=")}, - {EnvVarType, test.DebugPCR, []byte("override-env-2=foo")}, - {OverrideEnvType, test.DebugPCR, []byte("override-env-1=foo")}, - {OverrideEnvType, test.DebugPCR, []byte("override-env-2=foo")}, - {ArgType, test.DebugPCR, []byte("--x")}, - {ArgType, test.DebugPCR, []byte("--override-arg-1")}, - {ArgType, test.DebugPCR, []byte("--override-arg-2")}, - {OverrideArgType, test.DebugPCR, []byte("--override-arg1")}, - {OverrideArgType, test.DebugPCR, []byte("--override-arg2")}, - } - - for _, testEvent := range testEvents { - cos := CosTlv{testEvent.cosNestedEventType, testEvent.eventPayload} - if err := cel.AppendEvent(tpm, testEvent.pcr, measuredHashes, cos); err != nil { - t.Fatal(err.Error()) - } - } - - var buf bytes.Buffer - if err := cel.EncodeCEL(&buf); err != nil { - t.Fatal(err) - } - decodedcel, err := DecodeToCEL(&buf) - if err != nil { - t.Fatal(err) - } - - if len(decodedcel.Records) != len(testEvents) { - t.Errorf("should have %d records, but got %d", len(testEvents), len(decodedcel.Records)) - } - - for i, testEvent := range testEvents { - extractedCos, err := decodedcel.Records[i].Content.ParseToCosTlv() - if err != nil { - t.Fatal(err) - } - - want := CosTlv{testEvent.cosNestedEventType, testEvent.eventPayload} - if !cmp.Equal(extractedCos, want) { - t.Errorf("decoded COS TLV got %+v, want %+v", extractedCos, want) - } - } -} - -func TestParseEnvVar(t *testing.T) { - tests := []struct { - testName string - envVar string - envName string - envValue string - expectedErrSubstring string - }{ - {"normal case 1", "foo=bar", "foo", "bar", ""}, - {"normal case 2", "FOO=1", "FOO", "1", ""}, - {"normal case 3", "SESSION_MANAGER=\"`\\local/:@?%/tmp/.u/1,unix/.com:/tmp/.u/5\"", "SESSION_MANAGER", "\"`\\local/:@?%/tmp/.u/1,unix/.com:/tmp/.u/5\"", ""}, - {"no =", "foo", "", "", "malformed env var, doesn't contain '='"}, - {"empty", "", "", "", "malformed env var, doesn't contain '='"}, - {"empty value", "foo=", "foo", "", ""}, - {"multiple =", "foo=bar=baz=", "foo", "bar=baz=", ""}, - {"bad name", "3foo=bar=baz=", "", "", "env name must start with an alpha character or '_'"}, - {"bad name quote", "foo\"=bar=baz=", "", "", "env name must start with an alpha character or '_'"}, - {"empty name", "=bar=baz=", "", "", "env name must start with an alpha character or '_'"}, - {"non utf-8 value", string([]byte{'f', '=', 0xC0, 2, 2, '='}), "", "", "malformed env value, contains non-utf8 character"}, - {"non utf-8 name", string([]byte{'a', 0xC0, 2, 2, '='}), "", "", "malformed env name, contains non-utf8 character"}, - } - - for _, test := range tests { - t.Run(test.testName, func(t *testing.T) { - n, v, err := ParseEnvVar(test.envVar) - - if n != test.envName { - t.Errorf("envName mismatch, want [%s], got [%s]", test.envName, n) - } - if v != test.envValue { - t.Errorf("envValue mismatch, want [%s], got [%s]", test.envValue, v) - } - if test.expectedErrSubstring == "" { - if err != nil { - t.Errorf("expected no error, but got [%s]", err) - } else { - formattedEnvVar, err := FormatEnvVar(test.envName, test.envValue) - if err != nil { - t.Errorf("expected no error, but got [%s]", err) - } else if formattedEnvVar != test.envVar { - t.Errorf("formattedEnvVar mismatch, want [%s], got [%s]", test.envVar, formattedEnvVar) - } - } - } else { - if err == nil { - t.Errorf("expected error substring [%s], but got no error", test.expectedErrSubstring) - } else if !strings.Contains(err.Error(), test.expectedErrSubstring) { - t.Errorf("expected error substring [%s], but got [%v]", test.expectedErrSubstring, err) - } - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/attest.go b/vendor/github.com/google/go-tpm-tools/client/attest.go deleted file mode 100644 index f18e4d030..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/attest.go +++ /dev/null @@ -1,326 +0,0 @@ -package client - -import ( - "crypto/x509" - "fmt" - "io" - "net/http" - - sabi "github.com/google/go-sev-guest/abi" - sg "github.com/google/go-sev-guest/client" - tg "github.com/google/go-tdx-guest/client" - tabi "github.com/google/go-tdx-guest/client/linuxabi" - pb "github.com/google/go-tpm-tools/proto/attest" -) - -const ( - maxIssuingCertificateURLs = 3 - maxCertChainLength = 4 -) - -// TEEDevice is an interface to add an attestation report from a TEE technology's -// attestation driver. -type TEEDevice interface { - // AddAttestation uses the TEE device's attestation driver to collect an - // attestation report, then adds it to the correct field of `attestation`. - AddAttestation(attestation *pb.Attestation, options AttestOpts) error - // Close finalizes any resources in use by the TEEDevice. - Close() error -} - -// AttestOpts allows for customizing the functionality of Attest. -type AttestOpts struct { - // A unique, application-specific nonce used to guarantee freshness of the - // attestation. This must not be empty, and should generally be long enough - // to make brute force attacks infeasible. - // - // For security reasons, applications should not allow for attesting with - // arbitrary, externally-provided nonces. The nonce should be prefixed or - // otherwise bound (i.e. via a KDF) to application-specific data. For more - // information on why this is an issue, see this paper on robust remote - // attestation protocols: - // https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.70.4562&rep=rep1&type=pdf - Nonce []byte - // TCG Event Log to add to the attestation. - // If not specified then it take Event Log by calling GetEventLog(). - TCGEventLog []byte - // TCG Canonical Event Log to add to the attestation. - // Currently, we only support PCR replay for PCRs orthogonal to those in the - // firmware event log, where PCRs 0-9 and 14 are often measured. If the two - // logs overlap, server-side verification using this library may fail. - CanonicalEventLog []byte - // If non-nil, will be used to fetch the AK certificate chain for validation. - // Key.Attest() will construct the certificate chain by making GET requests to - // the contents of Key.cert.IssuingCertificateURL using this client. - CertChainFetcher *http.Client - // TEEDevice implements the TEEDevice interface for collecting a Trusted execution - // environment attestation. If nil, then Attest will try all known TEE devices, - // and TEENonce must be nil. If not nil, Attest will not call Close() on the device. - TEEDevice TEEDevice - // TEENonce is the nonce that will be used in the TEE's attestation collection - // mechanism. It is expected to be the size required by the technology. If nil, - // then the nonce will be populated with Nonce, either truncated or zero-filled - // depending on the technology's size. Leaving this nil is not recommended. If - // nil, then TEEDevice must be nil. - TEENonce []byte -} - -// Given a certificate, iterates through its IssuingCertificateURLs and returns -// the certificate that signed it. If the certificate lacks an -// IssuingCertificateURL, return nil. If fetching the certificates fails or the -// cert chain is malformed, return an error. -func fetchIssuingCertificate(client *http.Client, cert *x509.Certificate) (*x509.Certificate, error) { - // Check if we should event attempt fetching. - if cert == nil || len(cert.IssuingCertificateURL) == 0 { - return nil, nil - } - // For each URL, fetch and parse the certificate, then verify whether it signed cert. - // If successful, return the parsed certificate. If any step in this process fails, try the next url. - // If all the URLs fail, return the last error we got. - // TODO(Issue #169): Return a multi-error here - var lastErr error - for i, url := range cert.IssuingCertificateURL { - // Limit the number of attempts. - if i >= maxIssuingCertificateURLs { - break - } - resp, err := client.Get(url) - if err != nil { - lastErr = fmt.Errorf("failed to retrieve certificate at %v: %w", url, err) - continue - } - - if resp.StatusCode != http.StatusOK { - lastErr = fmt.Errorf("certificate retrieval from %s returned non-OK status: %v", url, resp.StatusCode) - continue - } - certBytes, err := io.ReadAll(resp.Body) - resp.Body.Close() - if err != nil { - lastErr = fmt.Errorf("failed to read response body from %s: %w", url, err) - continue - } - - parsedCert, err := x509.ParseCertificate(certBytes) - if err != nil { - lastErr = fmt.Errorf("failed to parse response from %s into a certificate: %w", url, err) - continue - } - - // Check if the parsed certificate signed the current one. - if err = cert.CheckSignatureFrom(parsedCert); err != nil { - lastErr = fmt.Errorf("parent certificate from %s did not sign child: %w", url, err) - continue - } - return parsedCert, nil - } - return nil, lastErr -} - -// Constructs the certificate chain for the key's certificate. -// If an error is encountered in the process, return what has been constructed so far. -func (k *Key) getCertificateChain(client *http.Client) ([][]byte, error) { - var certs [][]byte - currentCert := k.cert - for len(certs) <= maxCertChainLength { - issuingCert, err := fetchIssuingCertificate(client, currentCert) - if err != nil { - return nil, err - } - if issuingCert == nil { - return certs, nil - } - certs = append(certs, issuingCert.Raw) - currentCert = issuingCert - } - return nil, fmt.Errorf("max certificate chain length (%v) exceeded", maxCertChainLength) -} - -// SevSnpDevice encapsulates the SEV-SNP attestation device to add its attestation report -// to a pb.Attestation. -type SevSnpDevice struct { - Device sg.Device -} - -// TdxDevice encapsulates the TDX attestation device to add its attestation quote -// to a pb.Attestation. -type TdxDevice struct { - Device tg.Device -} - -// CreateSevSnpDevice opens the SEV-SNP attestation driver and wraps it with behavior -// that allows it to add an attestation report to pb.Attestation. -func CreateSevSnpDevice() (*SevSnpDevice, error) { - d, err := sg.OpenDevice() - if err != nil { - return nil, err - } - return &SevSnpDevice{Device: d}, nil -} - -// AddAttestation will get the SEV-SNP attestation report given opts.TEENonce with -// associated certificates and add them to `attestation`. If opts.TEENonce is empty, -// then uses contents of opts.Nonce. -func (d *SevSnpDevice) AddAttestation(attestation *pb.Attestation, opts AttestOpts) error { - var snpNonce [sabi.ReportDataSize]byte - if len(opts.TEENonce) == 0 { - copy(snpNonce[:], opts.Nonce) - } else if len(opts.TEENonce) != sabi.ReportDataSize { - return fmt.Errorf("the TEENonce size is %d. SEV-SNP device requires 64", len(opts.TEENonce)) - } else { - copy(snpNonce[:], opts.TEENonce) - } - extReport, err := sg.GetExtendedReport(d.Device, snpNonce) - if err != nil { - return err - } - attestation.TeeAttestation = &pb.Attestation_SevSnpAttestation{ - SevSnpAttestation: extReport, - } - return nil -} - -// Close will free the device handle held by the SevSnpDevice. Calling more -// than once has no effect. -func (d *SevSnpDevice) Close() error { - if d.Device != nil { - err := d.Device.Close() - d.Device = nil - return err - } - return nil -} - -// CreateTdxDevice opens the TDX attestation driver and wraps it with behavior -// that allows it to add an attestation quote to pb.Attestation. -func CreateTdxDevice() (*TdxDevice, error) { - d, err := tg.OpenDevice() - if err != nil { - return nil, err - } - return &TdxDevice{Device: d}, nil -} - -// AddAttestation will get the TDX attestation quote given opts.TEENonce -// and add them to `attestation`. If opts.TEENonce is empty, then uses -// contents of opts.Nonce. -func (d *TdxDevice) AddAttestation(attestation *pb.Attestation, opts AttestOpts) error { - var tdxNonce [tabi.TdReportDataSize]byte - if len(opts.TEENonce) == 0 { - copy(tdxNonce[:], opts.Nonce) - } else if len(opts.TEENonce) != tabi.TdReportDataSize { - return fmt.Errorf("the TEENonce size is %d. Intel TDX device requires %d", len(opts.TEENonce), tabi.TdReportDataSize) - } else { - copy(tdxNonce[:], opts.TEENonce) - } - quote, err := tg.GetQuote(d.Device, tdxNonce) - if err != nil { - return err - } - attestation.TeeAttestation = &pb.Attestation_TdxAttestation{ - TdxAttestation: quote, - } - return nil -} - -// Close will free the device handle held by the TdxDevice. Calling more -// than once has no effect. -func (d *TdxDevice) Close() error { - if d.Device != nil { - err := d.Device.Close() - d.Device = nil - return err - } - return nil -} - -// Does best effort to get a TEE hardware rooted attestation, but won't fail fatally -// unless the user provided a TEEDevice object. -func getTEEAttestationReport(attestation *pb.Attestation, opts AttestOpts) error { - device := opts.TEEDevice - if device != nil { - return device.AddAttestation(attestation, opts) - } - - // TEEDevice can't be nil while TEENonce is non-nil - if opts.TEENonce != nil { - return fmt.Errorf("got non-nil TEENonce when TEEDevice is nil: %v", opts.TEENonce) - } - - // Try SEV-SNP. - if device, err := CreateSevSnpDevice(); err == nil { - // Don't return errors if the attestation collection fails, since - // the user didn't specify a TEEDevice. - device.AddAttestation(attestation, opts) - device.Close() - return nil - } - - // Try TDX. - if device, err := CreateTdxDevice(); err == nil { - // Don't return errors if the attestation collection fails, since - // the user didn't specify a TEEDevice. - device.AddAttestation(attestation, opts) - device.Close() - return nil - } - // Add more devices here. - return nil -} - -// Attest generates an Attestation containing the TCG Event Log and a Quote over -// all PCR banks. The provided nonce can be used to guarantee freshness of the -// attestation. This function will return an error if the key is not a -// restricted signing key. -// -// AttestOpts is used for additional configuration of the Attestation process. -// This is primarily used to pass the attestation's nonce: -// -// attestation, err := key.Attest(client.AttestOpts{Nonce: my_nonce}) -func (k *Key) Attest(opts AttestOpts) (*pb.Attestation, error) { - if len(opts.Nonce) == 0 { - return nil, fmt.Errorf("provided nonce must not be empty") - } - sels, err := allocatedPCRs(k.rw) - if err != nil { - return nil, err - } - - attestation := pb.Attestation{} - if attestation.AkPub, err = k.PublicArea().Encode(); err != nil { - return nil, fmt.Errorf("failed to encode public area: %w", err) - } - attestation.AkCert = k.CertDERBytes() - for _, sel := range sels { - quote, err := k.Quote(sel, opts.Nonce) - if err != nil { - return nil, err - } - attestation.Quotes = append(attestation.Quotes, quote) - } - if opts.TCGEventLog == nil { - if attestation.EventLog, err = GetEventLog(k.rw); err != nil { - return nil, fmt.Errorf("failed to retrieve TCG Event Log: %w", err) - } - } else { - attestation.EventLog = opts.TCGEventLog - } - if len(opts.CanonicalEventLog) != 0 { - attestation.CanonicalEventLog = opts.CanonicalEventLog - } - - // Attempt to construct certificate chain. fetchIssuingCertificate checks if - // AK cert is present and contains intermediate cert URLs. - if opts.CertChainFetcher != nil { - attestation.IntermediateCerts, err = k.getCertificateChain(opts.CertChainFetcher) - if err != nil { - return nil, fmt.Errorf("fetching certificate chain: %w", err) - } - } - - if err := getTEEAttestationReport(&attestation, opts); err != nil { - return nil, fmt.Errorf("collecting TEE attestation report: %w", err) - } - - return &attestation, nil -} diff --git a/vendor/github.com/google/go-tpm-tools/client/attest_network_test.go b/vendor/github.com/google/go-tpm-tools/client/attest_network_test.go deleted file mode 100644 index 83a461c19..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/attest_network_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package client - -import ( - "crypto/x509" - "net/http" - "testing" - - "github.com/google/go-tpm-tools/internal/test" - pb "github.com/google/go-tpm-tools/proto/attest" - "google.golang.org/protobuf/proto" -) - -var externalClient = http.DefaultClient - -func TestNetworkFetchIssuingCertificate(t *testing.T) { - attestBytes := test.COS85Nonce9009 - att := &pb.Attestation{} - if err := proto.Unmarshal(attestBytes, att); err != nil { - t.Fatalf("Failed to unmarshal test attestation: %v", err) - } - - akCert, err := x509.ParseCertificate(att.AkCert) - if err != nil { - t.Fatalf("Error parsing AK Cert: %v", err) - } - - key := &Key{cert: akCert} - - certChain, err := key.getCertificateChain(externalClient) - if err != nil { - t.Error(err) - } - if len(certChain) == 0 { - t.Error("Did not retrieve any certificates.") - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/attest_test.go b/vendor/github.com/google/go-tpm-tools/client/attest_test.go deleted file mode 100644 index 8a4c2876c..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/attest_test.go +++ /dev/null @@ -1,371 +0,0 @@ -package client - -import ( - "bytes" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "math/big" - "net/http" - "net/http/httptest" - "strings" - "testing" - "time" - - sgtest "github.com/google/go-sev-guest/testing" - testclient "github.com/google/go-sev-guest/testing/client" - tgtest "github.com/google/go-tdx-guest/testing" - tgtestclient "github.com/google/go-tdx-guest/testing/client" - tgtestdata "github.com/google/go-tdx-guest/testing/testdata" - "github.com/google/go-tpm-tools/internal/test" - pb "github.com/google/go-tpm-tools/proto/attest" -) - -var localClient = http.DefaultClient - -// Returns an x509 Certificate with the provided issuingURL and signed with the provided parent certificate and key. -// If parentCert and parentKey are nil, the certificate will be self-signed. -func getTestCert(t *testing.T, issuingURL []string, parentCert *x509.Certificate, parentKey *rsa.PrivateKey) (*x509.Certificate, *rsa.PrivateKey) { - t.Helper() - - certKey, _ := rsa.GenerateKey(rand.Reader, 2048) - - template := &x509.Certificate{ - SerialNumber: big.NewInt(1), - NotBefore: time.Now(), - NotAfter: time.Now().AddDate(10, 0, 0), - KeyUsage: x509.KeyUsageCertSign | x509.KeyUsageCRLSign, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - IsCA: true, - MaxPathLenZero: true, - IssuingCertificateURL: issuingURL, - } - - if parentCert == nil && parentKey == nil { - parentCert = template - parentKey = certKey - } - - certBytes, err := x509.CreateCertificate(rand.Reader, template, parentCert, certKey.Public(), parentKey) - if err != nil { - t.Fatalf("Unable to create test certificate: %v", err) - } - - cert, err := x509.ParseCertificate(certBytes) - if err != nil { - t.Fatalf("Unable to parse test certificate: %v", err) - } - - return cert, certKey -} - -func TestFetchIssuingCertificateSucceeds(t *testing.T) { - testCA, caKey := getTestCert(t, nil, nil, nil) - - ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - rw.WriteHeader(http.StatusOK) - rw.Write(testCA.Raw) - })) - defer ts.Close() - - leafCert, _ := getTestCert(t, []string{"invalid.URL", ts.URL}, testCA, caKey) - - cert, err := fetchIssuingCertificate(localClient, leafCert) - if err != nil || cert == nil { - t.Errorf("fetchIssuingCertificate() did not find valid intermediate cert: %v", err) - } -} - -func TestFetchIssuingCertificateReturnsErrorIfMalformedCertificateFound(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - rw.WriteHeader(http.StatusOK) - rw.Write([]byte("these are some random bytes")) - })) - defer ts.Close() - - testCA, caKey := getTestCert(t, nil, nil, nil) - leafCert, _ := getTestCert(t, []string{ts.URL}, testCA, caKey) - - _, err := fetchIssuingCertificate(localClient, leafCert) - if err == nil { - t.Fatal("expected fetchIssuingCertificate to fail with malformed cert") - } -} - -func TestGetCertificateChainSucceeds(t *testing.T) { - // Create CA and corresponding server. - testCA, caKey := getTestCert(t, nil, nil, nil) - - caServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - rw.WriteHeader(http.StatusOK) - rw.Write(testCA.Raw) - })) - - defer caServer.Close() - - // Create intermediate cert and corresponding server. - intermediateCert, intermediateKey := getTestCert(t, []string{caServer.URL}, testCA, caKey) - - intermediateServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - rw.WriteHeader(http.StatusOK) - rw.Write(intermediateCert.Raw) - })) - defer intermediateServer.Close() - - // Create leaf cert. - leafCert, _ := getTestCert(t, []string{intermediateServer.URL}, intermediateCert, intermediateKey) - - key := &Key{cert: leafCert} - - certChain, err := key.getCertificateChain(localClient) - if err != nil { - t.Fatal(err) - } - if len(certChain) != 2 { - t.Fatalf("getCertificateChain did not return the expected number of certificates: got %v, want 2", len(certChain)) - } -} - -func TestKeyAttestSucceedsWithCertChainRetrieval(t *testing.T) { - testCA, caKey := getTestCert(t, nil, nil, nil) - - caServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - rw.WriteHeader(http.StatusOK) - rw.Write(testCA.Raw) - })) - - defer caServer.Close() - - leafCert, _ := getTestCert(t, []string{caServer.URL}, testCA, caKey) - - rwc := test.GetTPM(t) - defer CheckedClose(t, rwc) - - ak, err := AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("Failed to generate test AK: %v", err) - } - - ak.cert = leafCert - - attestation, err := ak.Attest(AttestOpts{Nonce: []byte("some nonce"), CertChainFetcher: localClient}) - if err != nil { - t.Fatalf("Attest returned with error: %v", err) - } - - // Expect one cert retrieved. - if len(attestation.IntermediateCerts) != 1 { - t.Fatalf("Got %v intermediate certs, want 1.", len(attestation.IntermediateCerts)) - } - - if !bytes.Equal(attestation.IntermediateCerts[0], testCA.Raw) { - t.Errorf("Attestation does not contain the expected intermediate cert: got %v, want %v", attestation.IntermediateCerts[0], testCA.Raw) - } -} - -func TestKeyAttestGetCertificateChainConditions(t *testing.T) { - rwc := test.GetTPM(t) - defer CheckedClose(t, rwc) - - ak, err := AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("Failed to generate test AK: %v", err) - } - - akCert, _ := getTestCert(t, nil, nil, nil) - - testcases := []struct { - name string - fetchCertChainClient *http.Client - cert *x509.Certificate - }{ - { - name: "CertChainFetcher is nil", - fetchCertChainClient: nil, - cert: nil, - }, - { - name: "CertChainFetcher is present, key.cert is nil", - fetchCertChainClient: localClient, - cert: nil, - }, - { - name: "CertChainFetcher is present, key.cert has nil IssuingCertificateURL", - fetchCertChainClient: localClient, - cert: akCert, - }, - } - - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - ak.cert = tc.cert - - att, err := ak.Attest(AttestOpts{Nonce: []byte("some nonce"), CertChainFetcher: tc.fetchCertChainClient}) - if err != nil { - t.Fatalf("Attest returned error: %v", err) - } - - if len(att.IntermediateCerts) != 0 { - t.Errorf("Attest() returned with intermediate certs, expected no certs retrieved.") - } - }) - } -} - -func TestSevSnpDevice(t *testing.T) { - rwc := test.GetTPM(t) - defer CheckedClose(t, rwc) - - ak, err := AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("Failed to generate test AK: %v", err) - } - - someNonce := []byte("some nonce") - var someNonce64 [64]byte - copy(someNonce64[:], someNonce) - var nonce64 [64]byte - copy(nonce64[:], []byte("noncey business")) - sevTestDevice, _, _, _ := testclient.GetSevGuest([]sgtest.TestCase{ - { - Input: someNonce64, - Output: sgtest.TestRawReport(someNonce64), - }, - { - Input: nonce64, - Output: sgtest.TestRawReport(nonce64), - }, - }, &sgtest.DeviceOptions{Now: time.Now()}, t) - defer sevTestDevice.Close() - - testcases := []struct { - name string - opts AttestOpts - wantReportData [64]byte - wantErr string - }{ - { - name: "Happy case no nonce", - opts: AttestOpts{ - Nonce: someNonce, - CertChainFetcher: localClient, - TEEDevice: &SevSnpDevice{sevTestDevice}, - }, - wantReportData: someNonce64, - }, - { - name: "Happy case with nonce", - opts: AttestOpts{ - Nonce: someNonce, - CertChainFetcher: localClient, - TEEDevice: &SevSnpDevice{sevTestDevice}, - TEENonce: nonce64[:], - }, - wantReportData: nonce64, - }, - { - name: "TEE nonce without TEE", - opts: AttestOpts{ - Nonce: someNonce, - CertChainFetcher: localClient, - TEENonce: nonce64[:], - }, - wantErr: "got non-nil TEENonce when TEEDevice is nil", - }, - } - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - att, err := ak.Attest(tc.opts) - if (err == nil && tc.wantErr != "") || (err != nil && !strings.Contains(err.Error(), tc.wantErr)) { - t.Fatalf("Attest(%v) = %v, want %q", tc.opts, err, tc.wantErr) - } - // Successful attestation should include a SEV-SNP attestation. - if err == nil { - snp, ok := att.GetTeeAttestation().(*pb.Attestation_SevSnpAttestation) - if !ok { - t.Fatalf("Attestation missing SEV-SNP attestation: %v", att.GetTeeAttestation()) - } - report := snp.SevSnpAttestation.Report - if !bytes.Equal(report.GetReportData(), tc.wantReportData[:]) { - t.Fatalf("SEV-SNP nonces differ. Got %v, want %v", report.GetReportData(), tc.wantReportData) - } - } - }) - } -} - -func TestTdxDevice(t *testing.T) { - rwc := test.GetTPM(t) - defer CheckedClose(t, rwc) - - ak, err := AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("Failed to generate test AK: %v", err) - } - - someNonce := []byte("some nonce") - var someNonce64 [64]byte - copy(someNonce64[:], someNonce) - var nonce64 [64]byte - copy(nonce64[:], []byte("noncey business")) - tdxTestDevice := tgtestclient.GetTdxGuest([]tgtest.TestCase{ - { - Input: someNonce64, - Quote: tgtestdata.RawQuote, - }, - { - Input: nonce64, - Quote: tgtestdata.RawQuote, - }, - }, t) - defer tdxTestDevice.Close() - - testcases := []struct { - name string - opts AttestOpts - wantReportData [64]byte - wantErr string - }{ - { - name: "Happy case no nonce", - opts: AttestOpts{ - Nonce: someNonce, - TEEDevice: &TdxDevice{tdxTestDevice}, - }, - wantReportData: someNonce64, - }, - { - name: "Happy case with nonce", - opts: AttestOpts{ - Nonce: someNonce, - TEEDevice: &TdxDevice{tdxTestDevice}, - TEENonce: nonce64[:], - }, - wantReportData: nonce64, - }, - { - name: "TEE nonce without TEE", - opts: AttestOpts{ - Nonce: someNonce, - TEENonce: nonce64[:], - }, - wantErr: "got non-nil TEENonce when TEEDevice is nil", - }, - } - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - att, err := ak.Attest(tc.opts) - if (err == nil && tc.wantErr != "") || (err != nil && !strings.Contains(err.Error(), tc.wantErr)) { - t.Fatalf("Attest(%v) = %v, want %q", tc.opts, err, tc.wantErr) - } - // Successful attestation should include a TDX attestation. - if err == nil { - _, ok := att.GetTeeAttestation().(*pb.Attestation_TdxAttestation) - if !ok { - t.Fatalf("Attestation missing TDX attestation: %v", att.GetTeeAttestation()) - } - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/close.go b/vendor/github.com/google/go-tpm-tools/client/close.go deleted file mode 100644 index 13030355f..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/close.go +++ /dev/null @@ -1,29 +0,0 @@ -package client - -import ( - "io" - "testing" - - "github.com/google/go-tpm/legacy/tpm2" -) - -// CheckedClose closes the simulator and asserts that there were no leaked handles. -func CheckedClose(tb testing.TB, rwc io.ReadWriteCloser) { - for _, t := range []tpm2.HandleType{ - tpm2.HandleTypeLoadedSession, - tpm2.HandleTypeSavedSession, - tpm2.HandleTypeTransient, - } { - handles, err := Handles(rwc, t) - if err != nil { - tb.Errorf("failed to fetch handles of type %v: %v", t, err) - } - if len(handles) != 0 { - tb.Errorf("tests leaked handles: %v", handles) - } - } - - if err := rwc.Close(); err != nil { - tb.Errorf("when closing simulator: %v", err) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/eventlog.go b/vendor/github.com/google/go-tpm-tools/client/eventlog.go deleted file mode 100644 index 9c74e0bba..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/eventlog.go +++ /dev/null @@ -1,19 +0,0 @@ -package client - -import "io" - -// GetEventLog grabs the crypto-agile TCG event log for the system. The TPM can -// override this implementation by implementing EventLogGetter. -func GetEventLog(rw io.ReadWriter) ([]byte, error) { - if elg, ok := rw.(EventLogGetter); ok { - return elg.EventLog() - } - return getRealEventLog() -} - -// EventLogGetter allows a TPM (io.ReadWriter) to specify a particular -// implementation for GetEventLog(). This is useful for testing and necessary -// for Windows Event Log support (which requires a handle to the TPM). -type EventLogGetter interface { - EventLog() ([]byte, error) -} diff --git a/vendor/github.com/google/go-tpm-tools/client/eventlog_linux.go b/vendor/github.com/google/go-tpm-tools/client/eventlog_linux.go deleted file mode 100644 index 1e75483b2..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/eventlog_linux.go +++ /dev/null @@ -1,7 +0,0 @@ -package client - -import "os" - -func getRealEventLog() ([]byte, error) { - return os.ReadFile("/sys/kernel/security/tpm0/binary_bios_measurements") -} diff --git a/vendor/github.com/google/go-tpm-tools/client/eventlog_other.go b/vendor/github.com/google/go-tpm-tools/client/eventlog_other.go deleted file mode 100644 index c6e7960c1..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/eventlog_other.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build !linux -// +build !linux - -package client - -import "errors" - -func getRealEventLog() ([]byte, error) { - return nil, errors.New("failed to get event log: only Linux supported") -} diff --git a/vendor/github.com/google/go-tpm-tools/client/example_test.go b/vendor/github.com/google/go-tpm-tools/client/example_test.go deleted file mode 100644 index 08a06d9bc..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/example_test.go +++ /dev/null @@ -1,274 +0,0 @@ -package client_test - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rand" - "fmt" - "io" - "log" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal" - "github.com/google/go-tpm-tools/server" - "github.com/google/go-tpm-tools/simulator" - "github.com/google/go-tpm/legacy/tpm2" -) - -var tpmHashAlg = tpm2.AlgSHA256 -var hashAlg = crypto.SHA256 - -func ExampleKey_Quote() { - // On verifier, make the nonce. - nonce := make([]byte, 8) - - if _, err := io.ReadFull(rand.Reader, nonce); err != nil { - log.Fatalf("failed to create nonce: %v", err) - } - - // On client machine, generate the TPM quote. - // TODO: use real TPM. - simulator, err := simulator.Get() - if err != nil { - log.Fatalf("failed to initialize simulator: %v", err) - } - defer simulator.Close() - - ak, err := client.AttestationKeyECC(simulator) - if err != nil { - log.Fatalf("failed to create attestation key: %v", err) - } - defer ak.Close() - - pcr7 := tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: []int{7}, - } - - quote, err := ak.Quote(pcr7, nonce) - if err != nil { - log.Fatalf("failed to create quote: %v", err) - } - - // On verifier, verify the quote against a stored public key/AK - // certificate's public part and the nonce passed. - if err := internal.VerifyQuote(quote, ak.PublicKey(), nonce); err != nil { - // TODO: handle verify error. - log.Fatalf("failed to verify quote: %v", err) - } - // Output: -} -func ExampleKey_Import_eK() { - // On client machine, EK should already exist. - // TODO: use real TPM. - simulator, err := simulator.Get() - if err != nil { - log.Fatalf("failed to initialize simulator: %v", err) - } - defer simulator.Close() - - ek, err := client.EndorsementKeyECC(simulator) - if err != nil { - log.Fatalf("failed to create endorsement key: %v", err) - } - - // Pass EK pub to remote server, typically via an EK cert. - // The server can then associate the EK public to the corresponding client. - - // Data to seal to EK public. - secret := []byte("secret data") - - // ek.PublicKey already verified using the manufacturer-signed EK cert. - importBlob, err := server.CreateImportBlob(ek.PublicKey(), secret, nil) - if err != nil { - log.Fatalf("failed to create import blob: %v", err) - } - - // On client, import the EK. - output, err := ek.Import(importBlob) - if err != nil { - // TODO: handle import failure. - log.Fatalf("failed to import blob: %v", err) - } - - fmt.Println(string(output)) - // TODO: use output of ek.Import. - // Output: secret data -} - -func ExampleKey_Attest() { - // On verifier, make the nonce. - nonce := make([]byte, 8) - - if _, err := io.ReadFull(rand.Reader, nonce); err != nil { - log.Fatalf("failed to create nonce: %v", err) - } - - // On client machine, generate the TPM quote. - // TODO: use real TPM. - simulator, err := simulator.Get() - if err != nil { - log.Fatalf("failed to initialize simulator: %v", err) - } - defer simulator.Close() - - ak, err := client.AttestationKeyECC(simulator) - if err != nil { - log.Fatalf("failed to create attestation key: %v", err) - } - defer ak.Close() - - attestation, err := ak.Attest(client.AttestOpts{Nonce: nonce}) - if err != nil { - log.Fatalf("failed to attest: %v", err) - } - - // TODO: establish trust in the AK (typically via an AK certificate signed - // by the manufacturer). - // On verifier, verify the Attestation message. This: - // - checks the quote(s) against a stored public key/AK - // certificate's public part and the expected nonce. - // - replays the event log against the quoted PCRs - // - extracts events into a MachineState message. - // TODO: decide which hash algorithm to use in the quotes. SHA1 is - // typically undesirable but is the only event log option on some distros. - _, err = server.VerifyAttestation(attestation, server.VerifyOpts{Nonce: nonce, TrustedAKs: []crypto.PublicKey{ak.PublicKey()}}) - if err != nil { - // TODO: handle parsing or replay error. - log.Fatalf("failed to read PCRs: %v", err) - } - fmt.Println(attestation) - // TODO: use events output of ParseMachineState. -} - -func Example_sealAndUnseal() { - // TODO: use real TPM. - simulator, err := simulator.Get() - if err != nil { - log.Fatalf("failed to initialize simulator: %v", err) - } - defer simulator.Close() - - srk, err := client.StorageRootKeyECC(simulator) - if err != nil { - log.Fatalf("failed to create storage root key: %v", err) - } - - sealedSecret := []byte("secret password") - - sel := tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{7}} - // Seal the data to the current value of PCR7. - sealedBlob, err := srk.Seal([]byte(sealedSecret), client.SealOpts{Current: sel}) - if err != nil { - log.Fatalf("failed to seal to SRK: %v", err) - } - - // Validate by unsealing the sealed blob. Because it is possible that a TPM can seal a secret - // properly but fail to certify it (thus we shouldn't unseal it because the creation status - // cannot be verify). This ensures we can unseal the sealed blob, and that its contents are - // equal to what we sealed. - output, err := srk.Unseal(sealedBlob, client.UnsealOpts{CertifyCurrent: sel}) - if err != nil { - // TODO: handle unseal error. - log.Fatalf("failed to unseal blob: %v", err) - } - // TODO: use unseal output. - fmt.Println(string(output)) - // Output: secret password -} - -func ExampleKey_GetSigner() { - // TODO: use real TPM. - simulator, err := simulator.Get() - if err != nil { - log.Fatalf("failed to initialize simulator: %v", err) - } - defer simulator.Close() - - exampleECCSignerTemplate := tpm2.Public{ - Type: tpm2.AlgECC, - NameAlg: tpm2.AlgSHA256, - Attributes: tpm2.FlagSign | tpm2.FlagFixedTPM | - tpm2.FlagFixedParent | tpm2.FlagSensitiveDataOrigin | tpm2.FlagUserWithAuth, - ECCParameters: &tpm2.ECCParams{ - CurveID: tpm2.CurveNISTP256, - Sign: &tpm2.SigScheme{ - Alg: tpm2.AlgECDSA, - Hash: tpmHashAlg, - }, - }, - } - key, err := client.NewKey(simulator, tpm2.HandleOwner, exampleECCSignerTemplate) - if err != nil { - log.Fatalf("failed to create signing key: %v", err) - } - defer key.Close() - - toSign := []byte("message to sign") - hash := hashAlg.New() - hash.Write(toSign) - digest := hash.Sum(nil) - - cryptoSigner, err := key.GetSigner() - if err != nil { - log.Fatalf("failed to create crypto signer: %v", err) - } - sig, err := cryptoSigner.Sign(nil, digest, hashAlg) - if err != nil { - log.Fatalf("failed to sign: %v", err) - } - - // Verifier needs to establish trust in signer.Public() (via a certificate, - // TPM2_ActivateCredential, TPM2_Certify). - if !ecdsa.VerifyASN1(cryptoSigner.Public().(*ecdsa.PublicKey), digest, sig) { - // TODO: handle signature verification failure. - log.Fatal("failed to verify digest") - } - // Output: -} - -func ExampleKey_SignData() { - // TODO: use real TPM. - simulator, err := simulator.Get() - if err != nil { - log.Fatalf("failed to initialize simulator: %v", err) - } - defer simulator.Close() - - exampleECCSignerTemplate := tpm2.Public{ - Type: tpm2.AlgECC, - NameAlg: tpm2.AlgSHA256, - Attributes: tpm2.FlagSign | tpm2.FlagFixedTPM | - tpm2.FlagFixedParent | tpm2.FlagSensitiveDataOrigin | tpm2.FlagUserWithAuth, - ECCParameters: &tpm2.ECCParams{ - CurveID: tpm2.CurveNISTP256, - Sign: &tpm2.SigScheme{ - Alg: tpm2.AlgECDSA, - Hash: tpmHashAlg, - }, - }, - } - key, err := client.NewKey(simulator, tpm2.HandleOwner, exampleECCSignerTemplate) - if err != nil { - log.Fatalf("failed to create signing key: %v", err) - } - defer key.Close() - - toSign := []byte("message to sign") - hash := hashAlg.New() - hash.Write(toSign) - digest := hash.Sum(nil) - - sig, err := key.SignData(toSign) - if err != nil { - log.Fatalf("failed to sign data: %v", err) - } - - // Verifier needs to establish trust in signer.Public() (via a certificate, - // TPM2_ActivateCredential, TPM2_Certify). - if !ecdsa.VerifyASN1(key.PublicKey().(*ecdsa.PublicKey), digest, sig) { - // TODO: handle signature verification failure. - log.Fatal("failed to verify digest") - } - // Output: -} diff --git a/vendor/github.com/google/go-tpm-tools/client/handles.go b/vendor/github.com/google/go-tpm-tools/client/handles.go deleted file mode 100644 index 62273af51..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/handles.go +++ /dev/null @@ -1,72 +0,0 @@ -package client - -import ( - "fmt" - "io" - "math" - - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -// Reserved Handles from "TCG TPM v2.0 Provisioning Guidance" - v1r1 - Table 2 -const ( - EKReservedHandle = tpmutil.Handle(0x81010001) - EKECCReservedHandle = tpmutil.Handle(0x81010002) - SRKReservedHandle = tpmutil.Handle(0x81000001) - SRKECCReservedHandle = tpmutil.Handle(0x81000002) -) - -// From "TCG EK Credential Profile", v2.3r2 Section 2.2.1.4 -const ( - // RSA 2048 EK Cert. - EKCertNVIndexRSA uint32 = 0x01c00002 - // ECC P256 EK Cert. - EKCertNVIndexECC uint32 = 0x01c0000a -) - -// Picked available handles from TPM 2.0 Handles and Localities 2.3.1 - Table 11 -// go-tpm-tools will use handles in the range from 0x81008F00 to 0x81008FFF -const ( - DefaultAKECCHandle = tpmutil.Handle(0x81008F00) - DefaultAKRSAHandle = tpmutil.Handle(0x81008F01) -) - -// GCE Attestation Key NV Indices -const ( - // RSA 2048 AK. - GceAKCertNVIndexRSA uint32 = 0x01c10000 - GceAKTemplateNVIndexRSA uint32 = 0x01c10001 - // ECC P256 AK. - GceAKCertNVIndexECC uint32 = 0x01c10002 - GceAKTemplateNVIndexECC uint32 = 0x01c10003 -) - -func isHierarchy(h tpmutil.Handle) bool { - return h == tpm2.HandleOwner || h == tpm2.HandleEndorsement || - h == tpm2.HandlePlatform || h == tpm2.HandleNull -} - -// Handles returns a slice of tpmutil.Handle objects of all handles within -// the TPM rw of type handleType. -func Handles(rw io.ReadWriter, handleType tpm2.HandleType) ([]tpmutil.Handle, error) { - // Handle type is determined by the most-significant octet (MSO) of the property. - property := uint32(handleType) << 24 - - vals, moreData, err := tpm2.GetCapability(rw, tpm2.CapabilityHandles, math.MaxUint32, property) - if err != nil { - return nil, err - } - if moreData { - return nil, fmt.Errorf("tpm2.GetCapability() should never return moreData==true for tpm2.CapabilityHandles") - } - handles := make([]tpmutil.Handle, len(vals)) - for i, v := range vals { - handle, ok := v.(tpmutil.Handle) - if !ok { - return nil, fmt.Errorf("unable to assert type tpmutil.Handle of value %#v", v) - } - handles[i] = handle - } - return handles, nil -} diff --git a/vendor/github.com/google/go-tpm-tools/client/handles_test.go b/vendor/github.com/google/go-tpm-tools/client/handles_test.go deleted file mode 100644 index 39744a990..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/handles_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package client_test - -import ( - "reflect" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -const ( - // Maximum number of handles to keys tests can create within a simulator. - maxHandles = 3 -) - -func TestHandles(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - expected := make([]tpmutil.Handle, 0) - for i := 0; i < maxHandles; i++ { - expected = append(expected, test.LoadRandomExternalKey(t, rwc)) - - handles, err := client.Handles(rwc, tpm2.HandleTypeTransient) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(handles, expected) { - t.Errorf("Handles mismatch got: %v; want: %v", handles, expected) - } - } - - // Don't leak our handles - for _, handle := range expected { - if err := tpm2.FlushContext(rwc, handle); err != nil { - t.Error(err) - } - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/import.go b/vendor/github.com/google/go-tpm-tools/client/import.go deleted file mode 100644 index 6e1e3c0e3..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/import.go +++ /dev/null @@ -1,83 +0,0 @@ -package client - -import ( - "fmt" - - "github.com/google/go-tpm-tools/internal" - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -func loadHandle(k *Key, blob *pb.ImportBlob) (tpmutil.Handle, error) { - auth, err := k.session.Auth() - if err != nil { - return tpm2.HandleNull, err - } - private, err := tpm2.Import(k.rw, k.Handle(), auth, blob.PublicArea, blob.Duplicate, blob.EncryptedSeed, nil, nil) - if err != nil { - return tpm2.HandleNull, fmt.Errorf("import failed: %w", err) - } - - auth, err = k.session.Auth() - if err != nil { - return tpm2.HandleNull, err - } - handle, _, err := tpm2.LoadUsingAuth(k.rw, k.Handle(), auth, blob.PublicArea, private) - if err != nil { - return tpm2.HandleNull, fmt.Errorf("load failed: %w", err) - } - return handle, nil -} - -// Import decrypts the secret contained in an encoded import request. -// The key used must be an encryption key (signing keys cannot be used). -// The req parameter should come from server.CreateImportBlob. -func (k *Key) Import(blob *pb.ImportBlob) ([]byte, error) { - handle, err := loadHandle(k, blob) - if err != nil { - return nil, err - } - defer tpm2.FlushContext(k.rw, handle) - - unsealSession, err := NewPCRSession(k.rw, internal.PCRSelection(blob.Pcrs)) - if err != nil { - return nil, err - } - defer unsealSession.Close() - - auth, err := unsealSession.Auth() - if err != nil { - return nil, err - } - out, err := tpm2.UnsealWithSession(k.rw, auth.Session, handle, "") - if err != nil { - return nil, fmt.Errorf("unseal failed: %w", err) - } - return out, nil -} - -// ImportSigningKey returns the signing key contained in an encoded import request. -// The parent key must be an encryption key (signing keys cannot be used). -// The req parameter should come from server.CreateSigningKeyImportBlob. -func (k *Key) ImportSigningKey(blob *pb.ImportBlob) (key *Key, err error) { - handle, err := loadHandle(k, blob) - if err != nil { - return nil, err - } - key = &Key{rw: k.rw, handle: handle} - - defer func() { - if err != nil { - key.Close() - } - }() - - if key.pubArea, _, _, err = tpm2.ReadPublic(k.rw, handle); err != nil { - return - } - if key.session, err = NewPCRSession(k.rw, internal.PCRSelection(blob.Pcrs)); err != nil { - return - } - return key, key.finish() -} diff --git a/vendor/github.com/google/go-tpm-tools/client/keys.go b/vendor/github.com/google/go-tpm-tools/client/keys.go deleted file mode 100644 index 165156b10..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/keys.go +++ /dev/null @@ -1,522 +0,0 @@ -// Package client contains some high-level TPM 2.0 functions. -package client - -import ( - "bytes" - "crypto" - "crypto/subtle" - "crypto/x509" - "errors" - "fmt" - "io" - - "github.com/google/go-tpm-tools/internal" - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -// Key wraps an active asymmetric TPM2 key. This can either be a signing key or -// an encryption key. Users of Key should be sure to call Close() when the Key -// is no longer needed, so that the underlying TPM handle can be freed. -// Concurrent accesses on Key are not safe, with the exception of the -// Sign method called on the crypto.Signer returned by Key.GetSigner. -type Key struct { - rw io.ReadWriter - handle tpmutil.Handle - pubArea tpm2.Public - pubKey crypto.PublicKey - name tpm2.Name - session Session - cert *x509.Certificate -} - -// EndorsementKeyRSA generates and loads a key from DefaultEKTemplateRSA. -func EndorsementKeyRSA(rw io.ReadWriter) (*Key, error) { - ekRsa, err := NewCachedKey(rw, tpm2.HandleEndorsement, DefaultEKTemplateRSA(), EKReservedHandle) - if err != nil { - return nil, err - } - if err := ekRsa.trySetCertificateFromNvram(EKCertNVIndexRSA); err != nil { - ekRsa.Close() - return nil, err - } - return ekRsa, nil -} - -// EndorsementKeyECC generates and loads a key from DefaultEKTemplateECC. -func EndorsementKeyECC(rw io.ReadWriter) (*Key, error) { - ekEcc, err := NewCachedKey(rw, tpm2.HandleEndorsement, DefaultEKTemplateECC(), EKECCReservedHandle) - if err != nil { - return nil, err - } - if err := ekEcc.trySetCertificateFromNvram(EKCertNVIndexECC); err != nil { - ekEcc.Close() - return nil, err - } - return ekEcc, nil -} - -// StorageRootKeyRSA generates and loads a key from SRKTemplateRSA. -func StorageRootKeyRSA(rw io.ReadWriter) (*Key, error) { - return NewCachedKey(rw, tpm2.HandleOwner, SRKTemplateRSA(), SRKReservedHandle) -} - -// StorageRootKeyECC generates and loads a key from SRKTemplateECC. -func StorageRootKeyECC(rw io.ReadWriter) (*Key, error) { - return NewCachedKey(rw, tpm2.HandleOwner, SRKTemplateECC(), SRKECCReservedHandle) -} - -// AttestationKeyRSA generates and loads a key from AKTemplateRSA in the Owner hierarchy. -func AttestationKeyRSA(rw io.ReadWriter) (*Key, error) { - return NewCachedKey(rw, tpm2.HandleOwner, AKTemplateRSA(), DefaultAKRSAHandle) -} - -// AttestationKeyECC generates and loads a key from AKTemplateECC in the Owner hierarchy. -func AttestationKeyECC(rw io.ReadWriter) (*Key, error) { - return NewCachedKey(rw, tpm2.HandleOwner, AKTemplateECC(), DefaultAKECCHandle) -} - -// EndorsementKeyFromNvIndex generates and loads an endorsement key using the -// template stored at the provided nvdata index. This is useful for TPMs which -// have a preinstalled AK template. -func EndorsementKeyFromNvIndex(rw io.ReadWriter, idx uint32) (*Key, error) { - return KeyFromNvIndex(rw, tpm2.HandleEndorsement, idx) -} - -// GceAttestationKeyRSA generates and loads the GCE RSA AK. Note that this -// function will only work on a GCE VM. Unlike AttestationKeyRSA, this key uses -// the Endorsement Hierarchy and its template loaded from GceAKTemplateNVIndexRSA. -func GceAttestationKeyRSA(rw io.ReadWriter) (*Key, error) { - akRsa, err := EndorsementKeyFromNvIndex(rw, GceAKTemplateNVIndexRSA) - if err != nil { - return nil, err - } - if err := akRsa.trySetCertificateFromNvram(GceAKCertNVIndexRSA); err != nil { - akRsa.Close() - return nil, err - } - return akRsa, nil -} - -// GceAttestationKeyECC generates and loads the GCE ECC AK. Note that this -// function will only work on a GCE VM. Unlike AttestationKeyECC, this key uses -// the Endorsement Hierarchy and its template loaded from GceAKTemplateNVIndexECC. -func GceAttestationKeyECC(rw io.ReadWriter) (*Key, error) { - akEcc, err := EndorsementKeyFromNvIndex(rw, GceAKTemplateNVIndexECC) - if err != nil { - return nil, err - } - if err := akEcc.trySetCertificateFromNvram(GceAKCertNVIndexECC); err != nil { - akEcc.Close() - return nil, err - } - return akEcc, nil -} - -// LoadCachedKey loads a key from cachedHandle. -// If the key is not found, an error is returned. -// This function will not overwrite an existing key, unlike NewCachedKey. -func LoadCachedKey(rw io.ReadWriter, cachedHandle tpmutil.Handle, keySession Session) (k *Key, err error) { - cachedPub, _, _, err := tpm2.ReadPublic(rw, cachedHandle) - if err != nil { - return nil, fmt.Errorf("failed to read public area of cached key: %w", err) - } - - k = &Key{rw: rw, handle: cachedHandle, pubArea: cachedPub, session: keySession} - return k, k.finish() -} - -// KeyFromNvIndex generates and loads a key under the provided parent -// (possibly a hierarchy root tpm2.Handle{Owner|Endorsement|Platform|Null}) -// using the template stored at the provided nvdata index. -func KeyFromNvIndex(rw io.ReadWriter, parent tpmutil.Handle, idx uint32) (*Key, error) { - data, err := tpm2.NVReadEx(rw, tpmutil.Handle(idx), tpm2.HandleOwner, "", 0) - if err != nil { - return nil, fmt.Errorf("read error at index %d: %w", idx, err) - } - template, err := tpm2.DecodePublic(data) - if err != nil { - return nil, fmt.Errorf("index %d data was not a TPM key template: %w", idx, err) - } - return NewKey(rw, parent, template) -} - -// NewCachedKey is almost identical to NewKey, except that it initially tries to -// see if the a key matching the provided template is at cachedHandle. If so, -// that key is returned. If not, the key is created as in NewKey, and that key -// is persisted to the cachedHandle, overwriting any existing key there. -func NewCachedKey(rw io.ReadWriter, parent tpmutil.Handle, template tpm2.Public, cachedHandle tpmutil.Handle) (k *Key, err error) { - owner := tpm2.HandleOwner - if parent == tpm2.HandlePlatform { - owner = tpm2.HandlePlatform - } else if parent == tpm2.HandleNull { - return nil, fmt.Errorf("cannot cache objects in the null hierarchy") - } - - cachedPub, _, _, err := tpm2.ReadPublic(rw, cachedHandle) - if err == nil { - if cachedPub.MatchesTemplate(template) { - k = &Key{rw: rw, handle: cachedHandle, pubArea: cachedPub} - return k, k.finish() - } - // Kick out old cached key if it does not match - if err = tpm2.EvictControl(rw, "", owner, cachedHandle, cachedHandle); err != nil { - return nil, err - } - } - - k, err = NewKey(rw, parent, template) - if err != nil { - return nil, err - } - defer tpm2.FlushContext(rw, k.handle) - - if err = tpm2.EvictControl(rw, "", owner, k.handle, cachedHandle); err != nil { - return nil, err - } - k.handle = cachedHandle - return k, nil -} - -// NewKey generates a key from the template and loads that key into the TPM -// under the specified parent. NewKey can call many different TPM commands: -// - If parent is tpm2.Handle{Owner|Endorsement|Platform|Null} a primary key -// is created in the specified hierarchy (using CreatePrimary). -// - If parent is a valid key handle, a normal key object is created under -// that parent (using Create and Load). NOTE: Not yet supported. -// -// This function also assumes that the desired key: -// - Does not have its usage locked to specific PCR values -// - Usable with empty authorization sessions (i.e. doesn't need a password) -func NewKey(rw io.ReadWriter, parent tpmutil.Handle, template tpm2.Public) (k *Key, err error) { - if !isHierarchy(parent) { - // TODO add support for normal objects with Create() and Load() - return nil, fmt.Errorf("unsupported parent handle: %x", parent) - } - - handle, pubArea, _, _, _, _, err := tpm2.CreatePrimaryEx(rw, parent, tpm2.PCRSelection{}, "", "", template) - if err != nil { - return nil, err - } - defer func() { - if err != nil { - tpm2.FlushContext(rw, handle) - } - }() - - k = &Key{rw: rw, handle: handle} - if k.pubArea, err = tpm2.DecodePublic(pubArea); err != nil { - return - } - return k, k.finish() -} - -func (k *Key) finish() error { - var err error - if k.pubKey, err = k.pubArea.Key(); err != nil { - return err - } - if k.name, err = k.pubArea.Name(); err != nil { - return err - } - // We determine the right type of session based on the auth policy - if k.session == nil { - if bytes.Equal(k.pubArea.AuthPolicy, defaultEKAuthPolicy()) { - if k.session, err = NewEKSession(k.rw); err != nil { - return err - } - } else if len(k.pubArea.AuthPolicy) == 0 { - k.session = NullSession{} - } else { - return fmt.Errorf("unknown auth policy when creating key") - } - } - return nil -} - -// Handle allows this key to be used directly with other go-tpm commands. -func (k *Key) Handle() tpmutil.Handle { - return k.handle -} - -// Name is hash of this key's public area. Only the Digest field will ever be -// populated. It is useful for various TPM commands related to authorization. -// This is equivalent to k.PublicArea.Name(), except that is cannot fail. -func (k *Key) Name() tpm2.Name { - return k.name -} - -// PublicArea exposes the key's entire public area. This is useful for -// determining additional properties of the underlying TPM key. -func (k *Key) PublicArea() tpm2.Public { - return k.pubArea -} - -// PublicKey provides a go interface to the loaded key's public area. -func (k *Key) PublicKey() crypto.PublicKey { - return k.pubKey -} - -// Close should be called when the key is no longer needed. This is important to -// do as most TPMs can only have a small number of key simultaneously loaded. -func (k *Key) Close() { - if k.session != nil { - k.session.Close() - } - tpm2.FlushContext(k.rw, k.handle) -} - -// Seal seals the sensitive byte buffer to a key. This key must be an SRK (we -// currently do not support sealing to EKs). Optionally, the SealOpts struct can -// be modified to provide sealed-to PCRs. In this case, the sensitive data can -// only be unsealed if the seal-time PCRs are in the SealOpts-specified state. -// There must not be overlap in PCRs between SealOpts' Current and Target. -// During the sealing process, certification data will be created allowing -// Unseal() to validate the state of the TPM during the sealing process. -func (k *Key) Seal(sensitive []byte, opts SealOpts) (*pb.SealedBytes, error) { - var pcrs *pb.PCRs - var err error - var auth []byte - - pcrs, err = mergePCRSelAndProto(k.rw, opts.Current, opts.Target) - if err != nil { - return nil, fmt.Errorf("invalid SealOpts: %v", err) - } - if len(pcrs.GetPcrs()) > 0 { - auth = internal.PCRSessionAuth(pcrs, SessionHashAlg) - } - certifySel := FullPcrSel(CertifyHashAlgTpm) - sb, err := sealHelper(k.rw, k.Handle(), auth, sensitive, certifySel) - if err != nil { - return nil, err - } - - for pcrNum := range pcrs.GetPcrs() { - sb.Pcrs = append(sb.Pcrs, pcrNum) - } - sb.Hash = pcrs.GetHash() - sb.Srk = pb.ObjectType(k.pubArea.Type) - return sb, nil -} - -func sealHelper(rw io.ReadWriter, parentHandle tpmutil.Handle, auth []byte, sensitive []byte, certifyPCRsSel tpm2.PCRSelection) (*pb.SealedBytes, error) { - inPublic := tpm2.Public{ - Type: tpm2.AlgKeyedHash, - NameAlg: SessionHashAlgTpm, - Attributes: tpm2.FlagFixedTPM | tpm2.FlagFixedParent, - AuthPolicy: auth, - } - if auth == nil { - inPublic.Attributes |= tpm2.FlagUserWithAuth - } else { - inPublic.Attributes |= tpm2.FlagAdminWithPolicy - } - - priv, pub, creationData, _, ticket, err := tpm2.CreateKeyWithSensitive(rw, parentHandle, certifyPCRsSel, "", "", inPublic, sensitive) - if err != nil { - return nil, fmt.Errorf("failed to create key: %w", err) - } - certifiedPcr, err := ReadPCRs(rw, certifyPCRsSel) - if err != nil { - return nil, fmt.Errorf("failed to read PCRs: %w", err) - } - computedDigest := internal.PCRDigest(certifiedPcr, SessionHashAlg) - - decodedCreationData, err := tpm2.DecodeCreationData(creationData) - if err != nil { - return nil, fmt.Errorf("failed to decode creation data: %w", err) - } - - // make sure PCRs haven't being altered after sealing - if subtle.ConstantTimeCompare(computedDigest, decodedCreationData.PCRDigest) == 0 { - return nil, fmt.Errorf("PCRs have been modified after sealing") - } - - sb := &pb.SealedBytes{} - sb.CertifiedPcrs = certifiedPcr - sb.Priv = priv - sb.Pub = pub - sb.CreationData = creationData - if sb.Ticket, err = tpmutil.Pack(ticket); err != nil { - return nil, err - } - return sb, nil -} - -// Unseal attempts to reverse the process of Seal(), using the PCRs, public, and -// private data in proto.SealedBytes. Optionally, the UnsealOpts parameter can -// be used to verify the state of the TPM when the data was sealed. The -// zero-value UnsealOpts can be passed to skip certification. -func (k *Key) Unseal(in *pb.SealedBytes, opts UnsealOpts) ([]byte, error) { - if in.Srk != pb.ObjectType(k.pubArea.Type) { - return nil, fmt.Errorf("expected key of type %v, got %v", in.Srk, k.pubArea.Type) - } - sealed, _, err := tpm2.Load( - k.rw, - k.Handle(), - /*parentPassword=*/ "", - in.GetPub(), - in.GetPriv()) - if err != nil { - return nil, fmt.Errorf("failed to load sealed object: %w", err) - } - defer tpm2.FlushContext(k.rw, sealed) - - pcrs, err := mergePCRSelAndProto(k.rw, opts.CertifyCurrent, opts.CertifyExpected) - if err != nil { - return nil, fmt.Errorf("invalid UnsealOpts: %v", err) - } - if len(pcrs.GetPcrs()) > 0 { - if err := internal.CheckSubset(pcrs, in.GetCertifiedPcrs()); err != nil { - return nil, fmt.Errorf("failed to certify PCRs: %w", err) - } - - var ticket tpm2.Ticket - if _, err = tpmutil.Unpack(in.GetTicket(), &ticket); err != nil { - return nil, fmt.Errorf("ticket unpack failed: %w", err) - } - creationHash := SessionHashAlg.New() - creationHash.Write(in.GetCreationData()) - - _, _, certErr := tpm2.CertifyCreation(k.rw, "", sealed, tpm2.HandleNull, nil, creationHash.Sum(nil), tpm2.SigScheme{}, ticket) - // There is a bug in some older TPMs, where they are unable to - // CertifyCreation when using a Null signing handle (despite this - // being allowed by all versions of the TPM spec). To work around - // this bug, we use a temporary signing key and ignore the signed - // result. To reduce the cost of this workaround, we use a cached - // ECC signing key. - // We can detect this bug, as it triggers a RCInsufficient - // Unmarshaling error. - if paramErr, ok := certErr.(tpm2.ParameterError); ok && paramErr.Code == tpm2.RCInsufficient { - signer, err := AttestationKeyECC(k.rw) - if err != nil { - return nil, fmt.Errorf("failed to create fallback signing key: %w", err) - } - defer signer.Close() - _, _, certErr = tpm2.CertifyCreation(k.rw, "", sealed, signer.Handle(), nil, creationHash.Sum(nil), tpm2.SigScheme{}, ticket) - } - if certErr != nil { - return nil, fmt.Errorf("failed to certify creation: %w", certErr) - } - - // verify certify PCRs haven't been modified - decodedCreationData, err := tpm2.DecodeCreationData(in.GetCreationData()) - if err != nil { - return nil, fmt.Errorf("failed to decode creation data: %w", err) - } - if !internal.SamePCRSelection(in.GetCertifiedPcrs(), decodedCreationData.PCRSelection) { - return nil, fmt.Errorf("certify PCRs does not match the PCR selection in the creation data") - } - expectedDigest := internal.PCRDigest(in.GetCertifiedPcrs(), SessionHashAlg) - if subtle.ConstantTimeCompare(decodedCreationData.PCRDigest, expectedDigest) == 0 { - return nil, fmt.Errorf("certify PCRs digest does not match the digest in the creation data") - } - } - - sel := tpm2.PCRSelection{Hash: tpm2.Algorithm(in.GetHash())} - for _, pcr := range in.GetPcrs() { - sel.PCRs = append(sel.PCRs, int(pcr)) - } - - session, err := NewPCRSession(k.rw, sel) - if err != nil { - return nil, fmt.Errorf("failed to create session: %w", err) - } - defer session.Close() - - auth, err := session.Auth() - if err != nil { - return nil, err - } - return tpm2.UnsealWithSession(k.rw, auth.Session, sealed, "") -} - -// Quote will tell TPM to compute a hash of a set of given PCR selection, together with -// some extra data (typically a nonce), sign it with the given signing key, and return -// the signature and the attestation data. This function will return an error if -// the key is not a restricted signing key. -func (k *Key) Quote(selpcr tpm2.PCRSelection, extraData []byte) (*pb.Quote, error) { - // Make sure that we have a valid signing key before trying quote - var err error - if _, err = internal.GetSigningHashAlg(k.pubArea); err != nil { - return nil, err - } - if !k.hasAttribute(tpm2.FlagRestricted) { - return nil, fmt.Errorf("unrestricted keys are insecure to use with Quote") - } - - quote := &pb.Quote{} - quote.Quote, quote.RawSig, err = tpm2.QuoteRaw(k.rw, k.Handle(), "", "", extraData, selpcr, tpm2.AlgNull) - if err != nil { - return nil, fmt.Errorf("failed to quote: %w", err) - } - quote.Pcrs, err = ReadPCRs(k.rw, selpcr) - if err != nil { - return nil, fmt.Errorf("failed to read PCRs: %w", err) - } - // Verify the quote client-side to make sure we didn't mess things up. - // NOTE: the quote still must be verified server-side as well. - if err := internal.VerifyQuote(quote, k.PublicKey(), extraData); err != nil { - return nil, fmt.Errorf("failed to verify quote: %w", err) - } - return quote, nil -} - -// Reseal is a shortcut to call Unseal() followed by Seal(). -// CertifyOpt(nillable) will be used in Unseal(), and SealOpt(nillable) -// will be used in Seal() -func (k *Key) Reseal(in *pb.SealedBytes, uOpts UnsealOpts, sOpts SealOpts) (*pb.SealedBytes, error) { - sensitive, err := k.Unseal(in, uOpts) - if err != nil { - return nil, fmt.Errorf("failed to unseal: %w", err) - } - return k.Seal(sensitive, sOpts) -} - -func (k *Key) hasAttribute(attr tpm2.KeyProp) bool { - return k.pubArea.Attributes&attr != 0 -} - -// Cert returns the parsed certificate (or nil) for the given key. -func (k *Key) Cert() *x509.Certificate { - return k.cert -} - -// CertDERBytes provides the ASN.1 DER content of the key's certificate. If the -// key does not have a certficate, returns nil. -func (k *Key) CertDERBytes() []byte { - if k.cert == nil { - return nil - } - return k.cert.Raw -} - -// SetCert assigns the provided certificate to the key after verifying it matches the key. -func (k *Key) SetCert(cert *x509.Certificate) error { - certPubKey := cert.PublicKey.(crypto.PublicKey) // This cast cannot fail - if !internal.PubKeysEqual(certPubKey, k.pubKey) { - return errors.New("certificate does not match key") - } - - k.cert = cert - return nil -} - -// Attempt to fetch a key's certificate from NVRAM. If the certificate is simply -// missing, this function succeeds (and no certificate is set). This is to allow -// for AKs and EKs that simply don't have a certificate. However, if the -// certificate read from NVRAM is either malformed or does not match the key, we -// return an error. -func (k *Key) trySetCertificateFromNvram(index uint32) error { - certASN1, err := tpm2.NVReadEx(k.rw, tpmutil.Handle(index), tpm2.HandleOwner, "", 0) - if err != nil { - // Either the cert data is missing, or we are not allowed to read it - return nil - } - x509Cert, err := x509.ParseCertificate(certASN1) - if err != nil { - return fmt.Errorf("failed to parse certificate from NV memory: %w", err) - } - return k.SetCert(x509Cert) -} diff --git a/vendor/github.com/google/go-tpm-tools/client/keys_test.go b/vendor/github.com/google/go-tpm-tools/client/keys_test.go deleted file mode 100644 index 0ed42a1dd..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/keys_test.go +++ /dev/null @@ -1,302 +0,0 @@ -package client_test - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "io" - "math/big" - "reflect" - "testing" - "time" - - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" -) - -func TestNameMatchesPublicArea(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ek, err := client.EndorsementKeyRSA(rwc) - if err != nil { - t.Fatal(err) - } - defer ek.Close() - - matches, err := ek.Name().MatchesPublic(ek.PublicArea()) - if err != nil { - t.Fatal(err) - } - if !matches { - t.Fatal("Returned name and computed name do not match") - } -} - -func TestCreateSigningKeysInHierarchies(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - template := client.AKTemplateRSA() - - // We are not authorized to create keys in the Platform Hierarchy - for _, hierarchy := range []tpmutil.Handle{tpm2.HandleOwner, tpm2.HandleEndorsement, tpm2.HandleNull} { - key, err := client.NewKey(rwc, hierarchy, template) - if err != nil { - t.Errorf("Hierarchy %+v: %s", hierarchy, err) - } else { - key.Close() - } - } -} - -func TestCachedRSAKeys(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - keys := []struct { - name string - getKey func(io.ReadWriter) (*client.Key, error) - }{ - {"SRK", client.StorageRootKeyRSA}, - {"EK", client.EndorsementKeyRSA}, - } - - for _, k := range keys { - t.Run(k.name, func(t *testing.T) { - // Get the key the first time and persist - srk, err := k.getKey(rwc) - if err != nil { - t.Fatal(err) - } - defer srk.Close() - - pub := srk.PublicKey() - if tpm2.FlushContext(rwc, srk.Handle()) == nil { - t.Error("Trying to flush persistent keys should fail.") - } - - // Get the cached key (should be the same) - srk, err = k.getKey(rwc) - if err != nil { - t.Fatal(err) - } - defer srk.Close() - - if !reflect.DeepEqual(srk.PublicKey(), pub) { - t.Errorf("Expected pub key: %v got: %v", pub, srk.PublicKey()) - } - - // We should still get the same key if we evict the handle - if err := tpm2.EvictControl(rwc, "", tpm2.HandleOwner, srk.Handle(), srk.Handle()); err != nil { - t.Errorf("Evicting control failed: %v", err) - } - srk, err = k.getKey(rwc) - if err != nil { - t.Fatal(err) - } - defer srk.Close() - - if !reflect.DeepEqual(srk.PublicKey(), pub) { - t.Errorf("Expected pub key: %v got: %v", pub, srk.PublicKey()) - } - }) - } -} - -func TestKeyCreation(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - keys := []struct { - name string - getKey func(io.ReadWriter) (*client.Key, error) - }{ - {"SRK-ECC", client.StorageRootKeyECC}, - {"EK-ECC", client.EndorsementKeyECC}, - {"AK-ECC", client.AttestationKeyECC}, - {"SRK-RSA", client.StorageRootKeyRSA}, - {"EK-RSA", client.EndorsementKeyRSA}, - {"AK-RSA", client.AttestationKeyRSA}, - } - - for _, k := range keys { - t.Run(k.name, func(t *testing.T) { - key, err := k.getKey(rwc) - if err != nil { - t.Fatal(err) - } - key.Close() - }) - } -} - -func BenchmarkKeyCreation(b *testing.B) { - rwc := test.GetTPM(b) - defer client.CheckedClose(b, rwc) - - benchmarks := []struct { - name string - getKey func(io.ReadWriter) (*client.Key, error) - }{ - {"SRK-ECC-Cached", client.StorageRootKeyECC}, - {"EK-ECC-Cached", client.EndorsementKeyECC}, - {"AK-ECC-Cached", client.AttestationKeyECC}, - - {"SRK-ECC", func(rw io.ReadWriter) (*client.Key, error) { - return client.NewKey(rw, tpm2.HandleOwner, client.SRKTemplateECC()) - }}, - {"EK-ECC", func(rw io.ReadWriter) (*client.Key, error) { - return client.NewKey(rw, tpm2.HandleEndorsement, client.DefaultEKTemplateECC()) - }}, - {"AK-ECC", func(rw io.ReadWriter) (*client.Key, error) { - return client.NewKey(rw, tpm2.HandleOwner, client.AKTemplateECC()) - }}, - - {"SRK-RSA-Cached", client.StorageRootKeyRSA}, - {"EK-RSA-Cached", client.EndorsementKeyRSA}, - {"AK-RSA-Cached", client.AttestationKeyRSA}, - - {"SRK-RSA", func(rw io.ReadWriter) (*client.Key, error) { - return client.NewKey(rw, tpm2.HandleEndorsement, client.SRKTemplateRSA()) - }}, - {"EK-RSA", func(rw io.ReadWriter) (*client.Key, error) { - return client.NewKey(rw, tpm2.HandleOwner, client.DefaultEKTemplateRSA()) - }}, - {"AK-RSA", func(rw io.ReadWriter) (*client.Key, error) { - return client.NewKey(rw, tpm2.HandleOwner, client.AKTemplateRSA()) - }}, - } - - for _, bm := range benchmarks { - b.Run(bm.name, func(b *testing.B) { - // Don't count time to populate the cache - b.StopTimer() - key, err := bm.getKey(rwc) - if err != nil { - b.Fatal(err) - } - key.Close() - b.StartTimer() - - for i := 0; i < b.N; i++ { - key, err := bm.getKey(rwc) - if err != nil { - b.Fatal(err) - } - key.Close() - } - }) - } -} - -// Returns an x509 Certificate for the provided pubkey, signed with the provided parent certificate and key. -// If the provided fields are nil, will create a self-signed certificate. -func getTestCert(t *testing.T, pubKey crypto.PublicKey, parentCert *x509.Certificate, parentKey *rsa.PrivateKey) (*x509.Certificate, *rsa.PrivateKey) { - t.Helper() - - certKey, _ := rsa.GenerateKey(rand.Reader, 2048) - - template := &x509.Certificate{ - SerialNumber: big.NewInt(1), - NotBefore: time.Now(), - NotAfter: time.Now().AddDate(10, 0, 0), - KeyUsage: x509.KeyUsageCertSign | x509.KeyUsageCRLSign, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - IsCA: true, - MaxPathLenZero: true, - } - - if pubKey == nil && parentCert == nil && parentKey == nil { - pubKey = certKey.Public() - parentCert = template - parentKey = certKey - } - - certBytes, err := x509.CreateCertificate(rand.Reader, template, parentCert, pubKey, parentKey) - if err != nil { - t.Fatalf("Unable to create test certificate: %v", err) - } - - cert, err := x509.ParseCertificate(certBytes) - if err != nil { - t.Fatalf("Unable to parse test certificate: %v", err) - } - - return cert, certKey -} - -func TestSetCert(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - key, err := client.AttestationKeyECC(rwc) - if err != nil { - t.Fatalf("Unable to create key: %v", err) - } - - ca, caKey := getTestCert(t, nil, nil, nil) - akCert, _ := getTestCert(t, key.PublicKey(), ca, caKey) - - if err = key.SetCert(akCert); err != nil { - t.Errorf("SetCert() returned error: %v", err) - } -} - -func TestSetCertFailsIfCertificateIsNotForKey(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - key, err := client.AttestationKeyECC(rwc) - if err != nil { - t.Fatalf("Unable to create key: %v", err) - } - - otherKey, _ := rsa.GenerateKey(rand.Reader, 2048) - - ca, caKey := getTestCert(t, nil, nil, nil) - akCert, _ := getTestCert(t, otherKey.Public(), ca, caKey) - - if err = key.SetCert(akCert); err == nil { - t.Error("SetCert() returned successfully, expected error") - } -} - -func TestLoadCachedKey(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - createdKey, err := client.NewKey(rwc, tpm2.HandleNull, client.SRKTemplateRSA()) - if err != nil { - t.Fatalf("NewKey() returned error: %v", err) - } - defer createdKey.Close() - - handles := []struct { - name string - handle tpmutil.Handle - errExpected bool - }{ - {"successful retrieval with handle", createdKey.Handle(), false}, - {"error for bad handle", tpmutil.Handle(0x0), true}, - } - - for _, k := range handles { - t.Run(k.name, func(t *testing.T) { - loadedKey, err := client.LoadCachedKey(rwc, createdKey.Handle(), client.NullSession{}) - if k.errExpected && err == nil { - t.Fatal("LoadCachedKey() returned successfully, expected error") - } else if !k.errExpected && err != nil { - t.Fatalf("LoadCachedKey() returned error: %v", err) - } else if k.errExpected { - return - } - defer loadedKey.Close() - - if !reflect.DeepEqual(createdKey, loadedKey) { - t.Errorf("Loaded key does not match created key") - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/pcr.go b/vendor/github.com/google/go-tpm-tools/client/pcr.go deleted file mode 100644 index 12d955062..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/pcr.go +++ /dev/null @@ -1,170 +0,0 @@ -package client - -import ( - "crypto" - "fmt" - "io" - "math" - - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" -) - -// NumPCRs is set to the spec minimum of 24, as that's all go-tpm supports. -const NumPCRs = 24 - -// We hard-code SHA256 as the policy session hash algorithms. Note that this -// differs from the PCR hash algorithm (which selects the bank of PCRs to use) -// and the Public area Name algorithm. We also chose this for compatibility with -// github.com/google/go-tpm/legacy/tpm2, as it hardcodes the nameAlg as SHA256 in -// several places. Two constants are used to avoid repeated conversions. -const ( - SessionHashAlg = crypto.SHA256 - SessionHashAlgTpm = tpm2.AlgSHA256 -) - -// CertifyHashAlgTpm is the hard-coded algorithm used in certify PCRs. -const CertifyHashAlgTpm = tpm2.AlgSHA256 - -func min(a, b int) int { - if a < b { - return a - } - return b -} - -// allocatedPCRs returns a list of selections corresponding to the TPM's implemented PCRs. -func allocatedPCRs(rw io.ReadWriter) ([]tpm2.PCRSelection, error) { - caps, moreData, err := tpm2.GetCapability(rw, tpm2.CapabilityPCRs, math.MaxUint32, 0) - if err != nil { - return nil, fmt.Errorf("listing implemented PCR banks: %w", err) - } - if moreData { - return nil, fmt.Errorf("extra data from GetCapability") - } - var sels []tpm2.PCRSelection - for _, cap := range caps { - sel, ok := cap.(tpm2.PCRSelection) - if !ok { - return nil, fmt.Errorf("unexpected data from GetCapability") - } - // skip empty (unallocated) PCR selections - if len(sel.PCRs) == 0 { - continue - } - sels = append(sels, sel) - } - return sels, nil -} - -// ReadPCRs fetches all the PCR values specified in sel, making multiple calls -// to the TPM if necessary. -func ReadPCRs(rw io.ReadWriter, sel tpm2.PCRSelection) (*pb.PCRs, error) { - pl := pb.PCRs{ - Hash: pb.HashAlgo(sel.Hash), - Pcrs: map[uint32][]byte{}, - } - - for i := 0; i < len(sel.PCRs); i += 8 { - end := min(i+8, len(sel.PCRs)) - pcrSel := tpm2.PCRSelection{ - Hash: sel.Hash, - PCRs: sel.PCRs[i:end], - } - - pcrMap, err := tpm2.ReadPCRs(rw, pcrSel) - if err != nil { - return nil, err - } - - for pcr, val := range pcrMap { - pl.Pcrs[uint32(pcr)] = val - } - } - - return &pl, nil -} - -// ReadAllPCRs fetches all the PCR values from all implemented PCR banks. -func ReadAllPCRs(rw io.ReadWriter) ([]*pb.PCRs, error) { - sels, err := allocatedPCRs(rw) - if err != nil { - return nil, err - } - - allPcrs := make([]*pb.PCRs, len(sels)) - for i, sel := range sels { - allPcrs[i], err = ReadPCRs(rw, sel) - if err != nil { - return nil, fmt.Errorf("reading bank %x PCRs: %w", sel.Hash, err) - } - } - return allPcrs, nil -} - -// SealOpts specifies the PCR values that should be used for Seal(). -type SealOpts struct { - // Current seals data to the current specified PCR selection. - Current tpm2.PCRSelection - // Target predictively seals data to the given specified PCR values. - Target *pb.PCRs -} - -// UnsealOpts specifies the options that should be used for Unseal(). -// Currently, it specifies the PCRs that need to pass certification in order to -// successfully unseal. -// CertifyHashAlgTpm is the hard-coded algorithm that must be used with -// UnsealOpts. -type UnsealOpts struct { - // CertifyCurrent certifies that a selection of current PCRs have the same - // value when sealing. - CertifyCurrent tpm2.PCRSelection - // CertifyExpected certifies that the TPM had a specific set of PCR values when sealing. - CertifyExpected *pb.PCRs -} - -// FullPcrSel will return a full PCR selection based on the total PCR number -// of the TPM with the given hash algo. -func FullPcrSel(hash tpm2.Algorithm) tpm2.PCRSelection { - sel := tpm2.PCRSelection{Hash: hash} - for i := 0; i < NumPCRs; i++ { - sel.PCRs = append(sel.PCRs, int(i)) - } - return sel -} - -func mergePCRSelAndProto(rw io.ReadWriter, sel tpm2.PCRSelection, proto *pb.PCRs) (*pb.PCRs, error) { - if proto == nil || len(proto.GetPcrs()) == 0 { - return ReadPCRs(rw, sel) - } - if len(sel.PCRs) == 0 { - return proto, nil - } - if sel.Hash != tpm2.Algorithm(proto.Hash) { - return nil, fmt.Errorf("current hash (%v) differs from target hash (%v)", - sel.Hash, tpm2.Algorithm(proto.Hash)) - } - - // At this point, both sel and proto are non-empty. - // Verify no overlap in sel and proto PCR indexes. - overlap := make([]int, 0) - targetMap := proto.GetPcrs() - for _, pcrVal := range sel.PCRs { - if _, found := targetMap[uint32(pcrVal)]; found { - overlap = append(overlap, pcrVal) - } - } - if len(overlap) != 0 { - return nil, fmt.Errorf("found PCR overlap: %v", overlap) - } - - currentPcrs, err := ReadPCRs(rw, sel) - if err != nil { - return nil, err - } - - for pcr, val := range proto.GetPcrs() { - currentPcrs.Pcrs[pcr] = val - } - return currentPcrs, nil -} diff --git a/vendor/github.com/google/go-tpm-tools/client/pcr_test.go b/vendor/github.com/google/go-tpm-tools/client/pcr_test.go deleted file mode 100644 index 96e884cd6..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/pcr_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package client_test - -import ( - "bytes" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "fmt" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -var extends = map[tpm2.Algorithm][]struct { - digest []byte -}{ - tpm2.AlgSHA1: { - {bytes.Repeat([]byte{0x00}, sha1.Size)}, - {bytes.Repeat([]byte{0x01}, sha1.Size)}, - {bytes.Repeat([]byte{0x02}, sha1.Size)}}, - tpm2.AlgSHA256: { - {bytes.Repeat([]byte{0x00}, sha256.Size)}, - {bytes.Repeat([]byte{0x01}, sha256.Size)}, - {bytes.Repeat([]byte{0x02}, sha256.Size)}}, - tpm2.AlgSHA384: { - {bytes.Repeat([]byte{0x00}, sha512.Size384)}, - {bytes.Repeat([]byte{0x01}, sha512.Size384)}, - {bytes.Repeat([]byte{0x02}, sha512.Size384)}}, -} - -func pcrExtend(alg tpm2.Algorithm, old, new []byte) ([]byte, error) { - hCon, err := alg.Hash() - if err != nil { - return nil, fmt.Errorf("not a valid hash type: %v", alg) - } - h := hCon.New() - h.Write(old) - h.Write(new) - return h.Sum(nil), nil -} - -func TestReadPCRs(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - cases := []struct { - name string - hashalg tpm2.Algorithm - }{ - {"SHA1", tpm2.AlgSHA1}, - {"SHA256", tpm2.AlgSHA256}, - {"SHA384", tpm2.AlgSHA384}, - } - - for _, c := range cases { - t.Run(c.name, func(t *testing.T) { - test.SkipOnUnsupportedAlg(t, rwc, c.hashalg) - - pcrbank, err := tpm2.ReadPCR(rwc, test.DebugPCR, c.hashalg) - if err != nil { - t.Fatal(err) - } - - for _, d := range extends[c.hashalg] { - if err := tpm2.PCRExtend(rwc, tpmutil.Handle(test.DebugPCR), c.hashalg, d.digest, ""); err != nil { - t.Fatalf("failed to extend pcr for test %v", err) - } - pcrVal, err := pcrExtend(c.hashalg, pcrbank, d.digest) - if err != nil { - t.Fatalf("could not extend pcr: %v", err) - } - pcrbank = pcrVal - sel := tpm2.PCRSelection{Hash: c.hashalg, PCRs: []int{test.DebugPCR}} - proto, err := client.ReadPCRs(rwc, sel) - if err != nil { - t.Fatalf("failed to read pcrs %v", err) - } - if !bytes.Equal(proto.Pcrs[uint32(test.DebugPCR)], pcrbank) { - t.Errorf("%v not equal to expected %v", proto.Pcrs[uint32(test.DebugPCR)], pcrbank) - } - } - }) - } -} - -func TestCheckContainedPCRs(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - sel := client.FullPcrSel(tpm2.AlgSHA256) - baseline, err := client.ReadPCRs(rwc, sel) - if err != nil { - t.Fatalf("Failed to Read PCRs: %v", err) - } - - toBeCertified, err := client.ReadPCRs(rwc, tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{1, 2, 3}}) - if err != nil { - t.Fatalf("failed to read pcrs %v", err) - } - if err := internal.CheckSubset(toBeCertified, baseline); err != nil { - t.Fatalf("Validation should pass: %v", err) - } - - if err := tpm2.PCRExtend(rwc, tpmutil.Handle(test.DebugPCR), tpm2.AlgSHA256, bytes.Repeat([]byte{0x00}, sha256.Size), ""); err != nil { - t.Fatalf("failed to extend pcr for test %v", err) - } - - toBeCertified, err = client.ReadPCRs(rwc, tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{1, 3, test.DebugPCR}}) - if err != nil { - t.Fatalf("failed to read pcrs %v", err) - } - if err := internal.CheckSubset(toBeCertified, baseline); err == nil { - t.Fatalf("validation should fail due to PCR %d changed", test.DebugPCR) - } - - toBeCertified, err = client.ReadPCRs(rwc, tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{}}) - if err != nil { - t.Fatalf("failed to read pcrs %v", err) - } - if err := internal.CheckSubset(toBeCertified, baseline); err != nil { - t.Fatalf("empty pcrs is always validate") - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/quote_test.go b/vendor/github.com/google/go-tpm-tools/client/quote_test.go deleted file mode 100644 index 6a177702a..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/quote_test.go +++ /dev/null @@ -1,154 +0,0 @@ -package client_test - -import ( - "bytes" - "crypto/ecdsa" - "crypto/rsa" - "fmt" - "io" - "testing" - - "github.com/google/go-attestation/attest" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" -) - -func TestQuote(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - keys := []struct { - name string - getKey func(io.ReadWriter) (*client.Key, error) - }{ - {"AK-ECC", client.AttestationKeyECC}, - {"AK-RSA", client.AttestationKeyRSA}, - } - - pcrSels := []tpm2.PCRSelection{ - { - Hash: tpm2.AlgSHA256, - PCRs: []int{7}, - }, - client.FullPcrSel(tpm2.AlgSHA256), - } - - for _, key := range keys { - for _, sel := range pcrSels { - name := fmt.Sprintf("%s-%d", key.name, len(sel.PCRs)) - t.Run(name, func(t *testing.T) { - ak, err := key.getKey(rwc) - if err != nil { - t.Errorf("failed to generate AK: %v", err) - } - defer ak.Close() - - quoted, err := ak.Quote(sel, []byte("test")) - if err != nil { - t.Errorf("failed to quote: %v", err) - } - sig, err := tpm2.DecodeSignature(bytes.NewBuffer(quoted.GetRawSig())) - if err != nil { - t.Errorf("signature decoding failed: %v", err) - } - - switch pub := ak.PublicKey().(type) { - case *ecdsa.PublicKey: - hash, err := sig.ECC.HashAlg.Hash() - if err != nil { - t.Fatalf("not a valid hash type: %v", sig.ECC.HashAlg) - } - - hashCon := hash.New() - hashCon.Write(quoted.GetQuote()) - if !ecdsa.Verify(pub, hashCon.Sum(nil)[:], sig.ECC.R, sig.ECC.S) { - t.Errorf("ECC signature verification failed") - } - case *rsa.PublicKey: - hash, err := sig.RSA.HashAlg.Hash() - if err != nil { - t.Fatalf("not a valid hash type: %v", sig.RSA.HashAlg) - } - - hashCon := hash.New() - hashCon.Write(quoted.GetQuote()) - if err = rsa.VerifyPKCS1v15(pub, hash, hashCon.Sum(nil), []byte(sig.RSA.Signature)); err != nil { - t.Errorf("RSA signature verification failed: %v", err) - } - } - }) - } - } - -} - -func TestQuoteShouldFailWithNonSigningKey(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - srk, err := client.StorageRootKeyRSA(rwc) - if err != nil { - t.Errorf("failed to generate SRK: %v", err) - } - defer srk.Close() - - selpcr := tpm2.PCRSelection{ - Hash: tpm2.AlgSHA1, - PCRs: []int{7}, - } - _, err = srk.Quote(selpcr, []byte("test")) - if err == nil { - t.Errorf("Quote with a non-signing key should fail") - } - t.Log(err) -} - -// Basic tests of Key.Attest, more advanced methods are in server package -func TestAttest(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - keys := []struct { - name string - getKey func(io.ReadWriter) (*client.Key, error) - shouldSucceed bool - }{ - {"AK-ECC", client.AttestationKeyECC, true}, - {"AK-RSA", client.AttestationKeyRSA, true}, - {"EK-ECC", client.EndorsementKeyECC, false}, - {"EK-RSA", client.EndorsementKeyRSA, false}, - } - for _, key := range keys { - t.Run(key.name, func(t *testing.T) { - ak, err := key.getKey(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - attestation, err := ak.Attest(client.AttestOpts{Nonce: []byte("some nonce")}) - if !key.shouldSucceed { - if err == nil { - t.Error("expected failure when calling Attest") - } - return - } - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - // Basic check, make sure we got multiple banks, and fields parse - if _, err = tpm2.DecodePublic(attestation.AkPub); err != nil { - t.Errorf("failed to decode AkPub: %v", err) - } - if len(attestation.Quotes) <= 1 { - t.Error("expected multiple quotes") - } - if _, err = attest.ParseEventLog(attestation.EventLog); err != nil { - t.Errorf("failed to parse event log: %v", err) - } - }) - - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/seal_test.go b/vendor/github.com/google/go-tpm-tools/client/seal_test.go deleted file mode 100644 index 2b2586c70..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/seal_test.go +++ /dev/null @@ -1,460 +0,0 @@ -package client_test - -import ( - "bytes" - "crypto/sha256" - "io" - "reflect" - "testing" - - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - pb "github.com/google/go-tpm-tools/proto/tpm" -) - -func TestSeal(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - keys := []struct { - name string - getSRK func(io.ReadWriter) (*client.Key, error) - }{ - {"RSA", client.StorageRootKeyRSA}, - {"ECC", client.StorageRootKeyECC}, - } - for _, key := range keys { - t.Run(key.name, func(t *testing.T) { - srk, err := key.getSRK(rwc) - if err != nil { - t.Fatalf("can't create %s srk from template: %v", key.name, err) - } - defer srk.Close() - - secret := []byte("test") - pcrToChange := test.DebugPCR - sel := tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{7, pcrToChange}} - sealed, err := srk.Seal(secret, client.SealOpts{Current: sel}) - if err != nil { - t.Fatalf("failed to seal: %v", err) - } - - opts := client.UnsealOpts{ - CertifyCurrent: tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: []int{7}, - }, - } - unseal, err := srk.Unseal(sealed, opts) - if err != nil { - t.Fatalf("failed to unseal: %v", err) - } - if !bytes.Equal(secret, unseal) { - t.Fatalf("unsealed (%v) not equal to secret (%v)", unseal, secret) - } - - extension := bytes.Repeat([]byte{0xAA}, sha256.Size) - if err = tpm2.PCRExtend(rwc, tpmutil.Handle(pcrToChange), tpm2.AlgSHA256, extension, ""); err != nil { - t.Fatalf("failed to extend pcr: %v", err) - } - - // unseal should not succeed. - if _, err = srk.Unseal(sealed, opts); err == nil { - t.Fatalf("unseal should have caused an error: %v", err) - } - }) - } -} - -func TestSelfReseal(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - key, err := client.StorageRootKeyRSA(rwc) - if err != nil { - t.Fatalf("can't create srk from template: %v", err) - } - defer key.Close() - - secret := []byte("test") - pcrList := []int{0, 4, 7} - sOpts := client.SealOpts{ - Current: tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: pcrList, - }, - } - - sealed, err := key.Seal(secret, sOpts) - if err != nil { - t.Fatalf("failed to seal: %v", err) - } - - uOpts := client.UnsealOpts{ - CertifyCurrent: tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: []int{7}, - }, - } - unseal, err := key.Unseal(sealed, uOpts) - if err != nil { - t.Fatalf("failed to unseal: %v", err) - } - if !bytes.Equal(secret, unseal) { - t.Errorf("unsealed (%v) not equal to secret (%v)", unseal, secret) - } - - sealed, err = key.Reseal(sealed, uOpts, sOpts) - if err != nil { - t.Fatalf("failed to reseal: %v", err) - } - - unseal, err = key.Unseal(sealed, uOpts) - if err != nil { - t.Fatalf("failed to unseal after resealing: %v", err) - } - if !bytes.Equal(secret, unseal) { - t.Errorf("unsealed (%v) not equal to secret (%v)", unseal, secret) - } -} - -func computePCRValue(base []byte, extensions [][]byte) []byte { - for _, extension := range extensions { - sum := sha256.Sum256(append(base, extension...)) - base = sum[:] - } - return base -} - -func TestComputePCRValue(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - pcrNum := test.DebugPCR - extensions := [][]byte{ - bytes.Repeat([]byte{0xAA}, sha256.Size), - bytes.Repeat([]byte{0xAB}, sha256.Size), - bytes.Repeat([]byte{0xAC}, sha256.Size), - bytes.Repeat([]byte{0xAD}, sha256.Size), - } - - pcrBase, err := tpm2.ReadPCR(rwc, pcrNum, tpm2.AlgSHA256) - if err != nil { - t.Fatalf("failed to read pcr %v", err) - } - - for _, extension := range extensions { - err := tpm2.PCRExtend(rwc, tpmutil.Handle(pcrNum), tpm2.AlgSHA256, extension, "") - if err != nil { - t.Fatalf("failed to extend pcr: %v", err) - } - } - - pcrVal, err := tpm2.ReadPCR(rwc, pcrNum, tpm2.AlgSHA256) - if err != nil { - t.Fatalf("failed to read pcr %v", err) - } - - computedValue := computePCRValue(pcrBase, extensions) - if !bytes.Equal(pcrVal, computedValue) { - t.Fatalf("pcrVal (%v) not equal to computedValue (%v)", pcrVal, computedValue) - } -} - -func TestReseal(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - key, err := client.StorageRootKeyRSA(rwc) - if err != nil { - t.Fatalf("can't create srk from template: %v", err) - } - defer key.Close() - - secret := []byte("test") - pcrToChange := test.DebugPCR - sel := tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{7, pcrToChange}} - sealed, err := key.Seal(secret, client.SealOpts{Current: sel}) - if err != nil { - t.Fatalf("failed to seal: %v", err) - } - - uOpts := client.UnsealOpts{ - CertifyCurrent: sel, - } - unseal, err := key.Unseal(sealed, uOpts) - if err != nil { - t.Fatalf("failed to unseal: %v", err) - } - if !bytes.Equal(secret, unseal) { - t.Fatalf("unsealed (%v) not equal to secret (%v)", unseal, secret) - } - - // create a new set of PCRs value for modification - predictedPcrsValue, err := client.ReadPCRs(rwc, sel) - if err != nil { - t.Fatalf("failed to read PCRs value: %v", err) - } - // change pcr value to the predicted future value for resealing - extensions := [][]byte{bytes.Repeat([]byte{0xAA}, sha256.Size)} - predictedPcrsValue.GetPcrs()[uint32(pcrToChange)] = computePCRValue(predictedPcrsValue.GetPcrs()[uint32(pcrToChange)], extensions) - - sOpts := client.SealOpts{Target: predictedPcrsValue} - resealed, err := key.Reseal(sealed, uOpts, sOpts) - if err != nil { - t.Fatalf("failed to reseal: %v", err) - } - - // unseal should not succeed since pcr has not been extended. - if _, err = key.Unseal(resealed, client.UnsealOpts{}); err == nil { - t.Fatalf("unseal should have failed: %v", err) - } - - // save the current PCR value for certification before extend the PCRs - oldPcrsValue, err := client.ReadPCRs(rwc, sel) - if err != nil { - t.Fatalf("failed to read PCRs value: %v", err) - } - for _, extension := range extensions { - err = tpm2.PCRExtend(rwc, tpmutil.Handle(pcrToChange), tpm2.AlgSHA256, extension, "") - if err != nil { - t.Fatalf("failed to extend pcr: %v", err) - } - } - - // unseal should fail when certifying current PCR values, as one PCR has changed - _, err = key.Unseal(resealed, client.UnsealOpts{CertifyCurrent: sel}) - if err == nil { - t.Fatalf("unseal should fail since the certify PCRs have changed.") - } - - // certify original PCR values (PCR values at seal-time) will work - unseal, err = key.Unseal(resealed, client.UnsealOpts{CertifyExpected: oldPcrsValue}) - if err != nil { - t.Fatalf("failed to unseal: %v", err) - } - if !bytes.Equal(secret, unseal) { - t.Errorf("unsealed (%v) not equal to secret (%v)", unseal, secret) - } -} - -func TestSealResealWithEmptyPCRs(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - key, err := client.StorageRootKeyRSA(rwc) - if err != nil { - t.Fatalf("can't create srk from template: %v", err) - } - defer key.Close() - - secret := []byte("test") - pcrToChange := test.DebugPCR - sealed, err := key.Seal(secret, client.SealOpts{}) - if err != nil { - t.Fatalf("failed to seal: %v", err) - } - opts := client.UnsealOpts{ - CertifyCurrent: tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: []int{pcrToChange}, - }, - } - unseal, err := key.Unseal(sealed, opts) - if err != nil { - t.Fatalf("failed to unseal: %v", err) - } - if !bytes.Equal(secret, unseal) { - t.Fatalf("unsealed (%v) not equal to secret (%v)", unseal, secret) - } - - extension := bytes.Repeat([]byte{0xAA}, sha256.Size) - if err = tpm2.PCRExtend(rwc, tpmutil.Handle(pcrToChange), tpm2.AlgSHA256, extension, ""); err != nil { - t.Fatalf("failed to extend pcr: %v", err) - } - - // unseal should fail as the PCR has changed (not as same as when sealing) - _, err = key.Unseal(sealed, opts) - if err == nil { - t.Fatalf("unseal should fail as PCR 7 changed") - } - - // reseal should succeed as UnsealOpts is empty - sealed, err = key.Reseal(sealed, client.UnsealOpts{}, client.SealOpts{}) - if err != nil { - t.Fatalf("failed to reseal: %v", err) - } - - // unseal should success as the above Reseal() "refreshes" the certify PCRs. - unseal, err = key.Unseal(sealed, opts) - if err != nil { - t.Errorf("failed to unseal: %v", err) - } - if !bytes.Equal(secret, unseal) { - t.Fatalf("unsealed (%v) not equal to secret (%v)", unseal, secret) - } -} - -func BenchmarkSeal(b *testing.B) { - rwc := test.GetTPM(b) - defer client.CheckedClose(b, rwc) - - pcrSel7 := tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{7}} - sOptsPCR7 := client.SealOpts{Current: pcrSel7} - uOptsPCR7 := client.UnsealOpts{CertifyCurrent: pcrSel7} - benchmarks := []struct { - name string - sOpts client.SealOpts - uOpts client.UnsealOpts - getKey func(io.ReadWriter) (*client.Key, error) - }{ - {"SRK-ECC-SealPCR7-UnsealPCR7", sOptsPCR7, uOptsPCR7, client.StorageRootKeyECC}, - {"SRK-ECC-SealEmpty-UnsealPCR7", client.SealOpts{}, uOptsPCR7, client.StorageRootKeyECC}, - {"SRK-ECC-SealPCR7-UnsealEmpty", sOptsPCR7, client.UnsealOpts{}, client.StorageRootKeyECC}, - {"SRK-ECC-SealEmpty-UnsealEmpty", client.SealOpts{}, client.UnsealOpts{}, client.StorageRootKeyECC}, - {"SRK-RSA-SealPCR7-UnsealPCR7", sOptsPCR7, uOptsPCR7, client.StorageRootKeyRSA}, - {"SRK-RSA-SealEmpty-UnsealPCR7", client.SealOpts{}, uOptsPCR7, client.StorageRootKeyRSA}, - {"SRK-RSA-SealPCR7-UnsealEmpty", sOptsPCR7, client.UnsealOpts{}, client.StorageRootKeyRSA}, - {"SRK-RSA-SealEmpty-UnsealEmpty", client.SealOpts{}, client.UnsealOpts{}, client.StorageRootKeyRSA}, - } - - for _, bm := range benchmarks { - key, err := bm.getKey(rwc) - if err != nil { - b.Fatal(err) - } - b.Run(bm.name, func(b *testing.B) { - for i := 0; i < b.N; i++ { - blob, err := key.Seal([]byte("test123"), bm.sOpts) - if err != nil { - b.Fatal(err) - } - if _, err = key.Unseal(blob, bm.uOpts); err != nil { - b.Fatal(err) - } - } - }) - } -} -func TestSealOpts(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - emptySet := map[uint32]struct{}{} - srk, err := client.StorageRootKeyECC(rwc) - if err != nil { - t.Fatalf("failed to create SRK: %v", err) - } - - opts := []struct { - name string - current tpm2.PCRSelection - target *pb.PCRs - expectedPcrs map[uint32]struct{} - }{ - {"CurrentEmpty-TargetNil", tpm2.PCRSelection{}, nil, emptySet}, - {"CurrentEmpty7-TargetNil", tpm2.PCRSelection{}, nil, emptySet}, - {"CurrentEmpty-TargetEmpty", tpm2.PCRSelection{}, &pb.PCRs{}, emptySet}, - {"CurrentSHA1Empty-TargetSHA256Empty", - tpm2.PCRSelection{Hash: tpm2.AlgSHA1}, - &pb.PCRs{Hash: pb.HashAlgo_SHA256}, - emptySet}, - {"CurrentSHA256Empty-TargetSHA1Empty", - tpm2.PCRSelection{Hash: tpm2.AlgSHA256}, - &pb.PCRs{Hash: pb.HashAlgo_SHA1}, - emptySet}, - {"CurrentSHA2567-TargetSHA1Empty", - tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{7}}, - &pb.PCRs{Hash: pb.HashAlgo_SHA1}, - map[uint32]struct{}{7: {}}}, - {"Current7-TargetPCR0,4", - tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{0, 7}}, - &pb.PCRs{Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{4: {0x00}}}, - map[uint32]struct{}{ - 0: {}, - 4: {}, - 7: {}, - }}, - } - - sliceToSet := func(a []uint32) map[uint32]struct{} { - ret := make(map[uint32]struct{}) - for _, val := range a { - ret[val] = struct{}{} - } - return ret - } - for _, testcase := range opts { - t.Run(testcase.name, func(t *testing.T) { - sOpts := client.SealOpts{Current: testcase.current, Target: testcase.target} - sealed, err := srk.Seal([]byte("secretzz"), sOpts) - if err != nil { - t.Errorf("error calling Seal with SealOpts: %v", err) - } - outPcrsMap := sliceToSet(sealed.Pcrs) - if !reflect.DeepEqual(outPcrsMap, testcase.expectedPcrs) { - t.Errorf("received PCRs (%v) do not match expected PCRs (%v)", - outPcrsMap, testcase.expectedPcrs) - } - }) - } - - // Run empty SealOpts. - _, err = srk.Seal([]byte("secretzz"), client.SealOpts{}) - if err != nil { - t.Errorf("error calling Seal with SealOpts: %v", err) - } -} -func TestSealAndUnsealOptsFail(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - srk, err := client.StorageRootKeyECC(rwc) - if err != nil { - t.Fatalf("failed to create SRK: %v", err) - } - - pcrSel7 := tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{7}} - pcrMap7 := map[uint32][]byte{7: {0x01, 0x02}} - pbPcr7 := &pb.PCRs{Hash: pb.HashAlgo_SHA256, Pcrs: pcrMap7} - opts := []struct { - name string - current tpm2.PCRSelection - target *pb.PCRs - }{ - {"CurrentSHA256-TargetSHA1", pcrSel7, &pb.PCRs{Hash: pb.HashAlgo_SHA1, Pcrs: pcrMap7}}, - {"Current-TargetPCROverlap", pcrSel7, pbPcr7}, - {"Current-TargetPCROverlapMultiple", tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{0, 4, 7, 8}}, - &pb.PCRs{Hash: pb.HashAlgo_SHA256, Pcrs: map[uint32][]byte{0: {}, 4: {0x00}, 9: {0x01, 0x02}}}}, - } - - for _, testcase := range opts { - t.Run("Seal"+testcase.name, func(t *testing.T) { - sOpts := client.SealOpts{Current: testcase.current, - Target: testcase.target} - _, err := srk.Seal([]byte("secretzz"), sOpts) - if err == nil { - t.Errorf("expected failure calling SealOpts") - } - }) - } - - sealed, err := srk.Seal([]byte("secretzz"), client.SealOpts{}) - if err != nil { - t.Fatalf("failed to seal: %v", err) - } - for _, testcase := range opts { - t.Run("Unseal"+testcase.name, func(t *testing.T) { - uOpts := client.UnsealOpts{CertifyCurrent: testcase.current, - CertifyExpected: testcase.target} - _, err := srk.Unseal(sealed, uOpts) - if err == nil { - t.Errorf("expected failure calling SealOpts") - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/session.go b/vendor/github.com/google/go-tpm-tools/client/session.go deleted file mode 100644 index 07019bc90..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/session.go +++ /dev/null @@ -1,101 +0,0 @@ -package client - -import ( - "io" - - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -// Session is an interface for TPM sessions. -type Session interface { - io.Closer - Auth() (tpm2.AuthCommand, error) -} - -func startAuthSession(rw io.ReadWriter) (session tpmutil.Handle, err error) { - // This session assumes the bus is trusted, so we: - // - use nil for tpmKey, encrypted salt, and symmetric - // - use and all-zeros caller nonce, and ignore the returned nonce - // As we are creating a plain TPM session, we: - // - setup a policy session - // - don't bind the session to any particular key - session, _, err = tpm2.StartAuthSession( - rw, - /*tpmKey=*/ tpm2.HandleNull, - /*bindKey=*/ tpm2.HandleNull, - /*nonceCaller=*/ make([]byte, SessionHashAlg.Size()), - /*encryptedSalt=*/ nil, - /*sessionType=*/ tpm2.SessionPolicy, - /*symmetric=*/ tpm2.AlgNull, - /*authHash=*/ SessionHashAlgTpm) - return -} - -// PCRSession is a TPM session that is bound to a set of PCRs. -type PCRSession struct { - rw io.ReadWriter - session tpmutil.Handle - sel tpm2.PCRSelection -} - -// NewPCRSession creates a new PCRSession. -func NewPCRSession(rw io.ReadWriter, sel tpm2.PCRSelection) (Session, error) { - if len(sel.PCRs) == 0 { - return NullSession{}, nil - } - session, err := startAuthSession(rw) - return PCRSession{rw, session, sel}, err -} - -// Auth returns the AuthCommand for the session. -func (p PCRSession) Auth() (auth tpm2.AuthCommand, err error) { - if err = tpm2.PolicyPCR(p.rw, p.session, nil, p.sel); err != nil { - return - } - return tpm2.AuthCommand{Session: p.session, Attributes: tpm2.AttrContinueSession}, nil -} - -// Close closes the session. -func (p PCRSession) Close() error { - return tpm2.FlushContext(p.rw, p.session) -} - -// EKSession is a TPM session that is bound to the EK. -type EKSession struct { - rw io.ReadWriter - session tpmutil.Handle -} - -// NewEKSession creates a new EKSession. -func NewEKSession(rw io.ReadWriter) (Session, error) { - session, err := startAuthSession(rw) - return EKSession{rw, session}, err -} - -// Auth returns the AuthCommand for the session. -func (e EKSession) Auth() (auth tpm2.AuthCommand, err error) { - nullAuth := tpm2.AuthCommand{Session: tpm2.HandlePasswordSession, Attributes: tpm2.AttrContinueSession} - if _, _, err = tpm2.PolicySecret(e.rw, tpm2.HandleEndorsement, nullAuth, e.session, nil, nil, nil, 0); err != nil { - return - } - return tpm2.AuthCommand{Session: e.session, Attributes: tpm2.AttrContinueSession}, nil -} - -// Close closes the session. -func (e EKSession) Close() error { - return tpm2.FlushContext(e.rw, e.session) -} - -// NullSession is a TPM session that is not bound to anything. -type NullSession struct{} - -// Auth returns the AuthCommand for the session. -func (n NullSession) Auth() (auth tpm2.AuthCommand, err error) { - return tpm2.AuthCommand{Session: tpm2.HandlePasswordSession, Attributes: tpm2.AttrContinueSession}, nil -} - -// Close closes the session. -func (n NullSession) Close() error { - return nil -} diff --git a/vendor/github.com/google/go-tpm-tools/client/signer.go b/vendor/github.com/google/go-tpm-tools/client/signer.go deleted file mode 100644 index 9c098886b..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/signer.go +++ /dev/null @@ -1,146 +0,0 @@ -package client - -import ( - "crypto" - "crypto/rsa" - "encoding/asn1" - "fmt" - "io" - "math/big" - "sync" - - "github.com/google/go-tpm-tools/internal" - "github.com/google/go-tpm/legacy/tpm2" -) - -// Global mutex to protect against concurrent TPM access. -var signerMutex sync.Mutex - -type tpmSigner struct { - Key *Key - Hash crypto.Hash -} - -// Public returns the tpmSigners public key. -func (signer *tpmSigner) Public() crypto.PublicKey { - return signer.Key.PublicKey() -} - -// Sign uses the TPM key to sign the digest. -// The digest must be hashed from the same hash algorithm as the keys scheme. -// The opts hash function must also match the keys scheme (or be nil). -// Concurrent use of Sign is thread safe, but it is not safe to access the TPM -// from other sources while Sign is executing. -// For RSAPSS signatures, you cannot specify custom salt lengths. The salt -// length will be (keyBits/8) - digestSize - 2, unless that is less than the -// digestSize in which case, saltLen will be digestSize. The only normal case -// where saltLen is not digestSize is when using 1024 keyBits with SHA512. -func (signer *tpmSigner) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) { - if pssOpts, ok := opts.(*rsa.PSSOptions); ok { - if signer.Key.pubArea.RSAParameters == nil { - return nil, fmt.Errorf("invalid options: PSSOptions can only be used with RSA keys") - } - if signer.Key.pubArea.RSAParameters.Sign.Alg != tpm2.AlgRSAPSS { - return nil, fmt.Errorf("invalid options: PSSOptions cannot be used with signing alg: %v", signer.Key.pubArea.RSAParameters.Sign.Alg) - } - if pssOpts.SaltLength != rsa.PSSSaltLengthAuto { - return nil, fmt.Errorf("salt length must be rsa.PSSSaltLengthAuto") - } - } - if opts != nil && opts.HashFunc() != signer.Hash { - return nil, fmt.Errorf("hash algorithm: got %v, want %v", opts.HashFunc(), signer.Hash) - } - if len(digest) != signer.Hash.Size() { - return nil, fmt.Errorf("digest length: got %d, want %d", digest, signer.Hash.Size()) - } - - signerMutex.Lock() - defer signerMutex.Unlock() - - auth, err := signer.Key.session.Auth() - if err != nil { - return nil, err - } - - sig, err := tpm2.SignWithSession(signer.Key.rw, auth.Session, signer.Key.handle, "", digest, nil, nil) - if err != nil { - return nil, err - } - return getSignature(sig) -} - -// GetSigner returns a crypto.Signer wrapping the loaded TPM Key. -// Concurrent use of one or more Signers is thread safe, but it is not safe to -// access the TPM from other sources while using a Signer. -// The returned Signer lasts the lifetime of the Key, and will no longer work -// once the Key has been closed. -func (k *Key) GetSigner() (crypto.Signer, error) { - if k.hasAttribute(tpm2.FlagRestricted) { - return nil, fmt.Errorf("restricted keys are not supported") - } - hashAlg, err := internal.GetSigningHashAlg(k.pubArea) - if err != nil { - return nil, err - } - // For crypto.Signer, Go does the hashing. Make sure the hash is supported. - hash, err := hashAlg.Hash() - if err != nil { - return nil, err - } - return &tpmSigner{k, hash}, nil -} - -// SignData signs a data buffer with a TPM loaded key. Unlike GetSigner, this -// method works with restricted and unrestricted keys. If this method is called -// on a restriced key, the TPM itself will hash the provided data, failing the -// signing operation if the data begins with TPM_GENERATED_VALUE. -func (k *Key) SignData(data []byte) ([]byte, error) { - hashAlg, err := internal.GetSigningHashAlg(k.pubArea) - if err != nil { - return nil, err - } - - var digest []byte - var ticket *tpm2.Ticket - if k.hasAttribute(tpm2.FlagRestricted) { - // Restricted keys can only sign data hashed by the TPM. We use the - // owner hierarchy for the Ticket, but any non-Null hierarchy would do. - digest, ticket, err = tpm2.Hash(k.rw, hashAlg, data, tpm2.HandleOwner) - if err != nil { - return nil, err - } - } else { - // Unrestricted keys can sign any digest, no need for TPM hashing. - hash, err := hashAlg.Hash() - if err != nil { - return nil, err - } - hasher := hash.New() - hasher.Write(data) - digest = hasher.Sum(nil) - } - - auth, err := k.session.Auth() - if err != nil { - return nil, err - } - sig, err := tpm2.SignWithSession(k.rw, auth.Session, k.handle, "", digest, ticket, nil) - if err != nil { - return nil, err - } - return getSignature(sig) -} - -func getSignature(sig *tpm2.Signature) ([]byte, error) { - switch sig.Alg { - case tpm2.AlgRSASSA: - return sig.RSA.Signature, nil - case tpm2.AlgRSAPSS: - return sig.RSA.Signature, nil - case tpm2.AlgECDSA: - sigStruct := struct{ R, S *big.Int }{sig.ECC.R, sig.ECC.S} - return asn1.Marshal(sigStruct) - default: - return nil, fmt.Errorf("unsupported signing algorithm: %v", sig.Alg) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/signer_test.go b/vendor/github.com/google/go-tpm-tools/client/signer_test.go deleted file mode 100644 index 3045efe0c..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/signer_test.go +++ /dev/null @@ -1,317 +0,0 @@ -package client_test - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/sha1" - "crypto/sha256" - "encoding/asn1" - "math/big" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" -) - -func templateSSA(hash tpm2.Algorithm) tpm2.Public { - template := client.AKTemplateRSA() - // Can't sign arbitrary data if restricted. - template.Attributes &= ^tpm2.FlagRestricted - template.RSAParameters.Sign.Hash = hash - return template -} - -func templatePSS(hash tpm2.Algorithm) tpm2.Public { - template := templateSSA(hash) - template.RSAParameters.Sign.Alg = tpm2.AlgRSAPSS - return template -} - -func templateECC(hash tpm2.Algorithm) tpm2.Public { - template := client.AKTemplateECC() - template.Attributes &= ^tpm2.FlagRestricted - template.ECCParameters.Sign.Hash = hash - return template -} - -// Templates that require some sort of (default) authorization -func templateAuthSSA() tpm2.Public { - template := templateSSA(tpm2.AlgSHA256) - template.AuthPolicy = client.DefaultEKTemplateRSA().AuthPolicy - template.Attributes |= tpm2.FlagAdminWithPolicy - template.Attributes &= ^tpm2.FlagUserWithAuth - return template -} - -func templateAuthECC() tpm2.Public { - template := templateECC(tpm2.AlgSHA256) - template.AuthPolicy = client.DefaultEKTemplateECC().AuthPolicy - template.Attributes |= tpm2.FlagAdminWithPolicy - template.Attributes &= ^tpm2.FlagUserWithAuth - return template -} - -func verifyRSA(pubKey crypto.PublicKey, hash crypto.Hash, digest, sig []byte) bool { - return rsa.VerifyPKCS1v15(pubKey.(*rsa.PublicKey), hash, digest, sig) == nil -} - -func verifyECC(pubKey crypto.PublicKey, _ crypto.Hash, digest, sig []byte) bool { - var sigStruct struct{ R, S *big.Int } - asn1.Unmarshal(sig, &sigStruct) - return ecdsa.Verify(pubKey.(*ecdsa.PublicKey), digest, sigStruct.R, sigStruct.S) -} - -func TestSign(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - keys := []struct { - name string - hash crypto.Hash - template tpm2.Public - verify func(crypto.PublicKey, crypto.Hash, []byte, []byte) bool - }{ - {"RSA-SHA1", crypto.SHA1, templateSSA(tpm2.AlgSHA1), verifyRSA}, - {"RSA-SHA256", crypto.SHA256, templateSSA(tpm2.AlgSHA256), verifyRSA}, - {"RSA-SHA384", crypto.SHA384, templateSSA(tpm2.AlgSHA384), verifyRSA}, - {"RSA-SHA512", crypto.SHA512, templateSSA(tpm2.AlgSHA512), verifyRSA}, - {"ECC-SHA1", crypto.SHA1, templateECC(tpm2.AlgSHA1), verifyECC}, - {"ECC-SHA256", crypto.SHA256, templateECC(tpm2.AlgSHA256), verifyECC}, - {"ECC-SHA384", crypto.SHA384, templateECC(tpm2.AlgSHA384), verifyECC}, - {"ECC-SHA512", crypto.SHA512, templateECC(tpm2.AlgSHA512), verifyECC}, - {"Auth-RSA", crypto.SHA256, templateAuthSSA(), verifyRSA}, - {"Auth-ECC", crypto.SHA256, templateAuthECC(), verifyECC}, - } - - message := []byte("authenticated message") - // Data beginning with TPM_GENERATED_VALUE (looks like a TPM-test message) - generatedMsg := append([]byte("\xffTCG"), message...) - for _, k := range keys { - hash := k.hash.New() - hash.Write(message) - digest := hash.Sum(nil) - alg, err := tpm2.HashToAlgorithm(k.hash) - if err != nil { - t.Fatal(err) - } - - t.Run(k.name, func(t *testing.T) { - test.SkipOnUnsupportedAlg(t, rwc, alg) - - key, err := client.NewKey(rwc, tpm2.HandleEndorsement, k.template) - if err != nil { - t.Fatal(err) - } - defer key.Close() - - signer, err := key.GetSigner() - if err != nil { - t.Fatal(err) - } - sig, err := signer.Sign(nil, digest, k.hash) - if err != nil { - t.Fatal(err) - } - if !k.verify(signer.Public(), k.hash, digest, sig) { - t.Error(err) - } - }) - t.Run(k.name+"-SignData", func(t *testing.T) { - test.SkipOnUnsupportedAlg(t, rwc, alg) - - key, err := client.NewKey(rwc, tpm2.HandleEndorsement, k.template) - if err != nil { - t.Fatal(err) - } - defer key.Close() - - sig, err := key.SignData(message) - if err != nil { - t.Fatal(err) - } - if !k.verify(key.PublicKey(), k.hash, digest, sig) { - t.Error(err) - } - - // Unrestricted keys can sign data beginning with TPM_GENERATED_VALUE - if _, err = key.SignData(generatedMsg); err != nil { - t.Error(err) - } - }) - t.Run(k.name+"-SignDataRestricted", func(t *testing.T) { - test.SkipOnUnsupportedAlg(t, rwc, alg) - - restrictedTemplate := k.template - restrictedTemplate.Attributes |= tpm2.FlagRestricted - key, err := client.NewKey(rwc, tpm2.HandleEndorsement, restrictedTemplate) - if err != nil { - t.Fatal(err) - } - defer key.Close() - - sig, err := key.SignData(message) - if err != nil { - t.Fatal(err) - } - if !k.verify(key.PublicKey(), k.hash, digest, sig) { - t.Error(err) - } - - // Restricted keys cannot sign data beginning with TPM_GENERATED_VALUE - if _, err = key.SignData(generatedMsg); err == nil { - t.Error("Signing TPM_GENERATED_VALUE data should fail") - } - }) - } -} - -func TestSignIncorrectHash(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - key, err := client.NewKey(rwc, tpm2.HandleEndorsement, templateSSA(tpm2.AlgSHA256)) - if err != nil { - t.Fatal(err) - } - defer key.Close() - - signer, err := key.GetSigner() - if err != nil { - t.Fatal(err) - } - - digestSHA1 := sha1.Sum([]byte("authenticated message")) - digestSHA256 := sha256.Sum256([]byte("authenticated message")) - - if _, err := signer.Sign(nil, digestSHA1[:], crypto.SHA1); err == nil { - t.Error("expected failure for digest and hash not matching keys sigScheme.") - } - - if _, err := signer.Sign(nil, digestSHA1[:], crypto.SHA256); err == nil { - t.Error("expected failure for correct hash, but incorrect digest.") - } - - if _, err := signer.Sign(nil, digestSHA256[:], crypto.SHA1); err == nil { - t.Error("expected failure for correct digest, but incorrect hash.") - } -} - -func TestSignPSS(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - keys := []struct { - name string - opts crypto.SignerOpts - template tpm2.Public - keyBits uint16 - saltLen int - }{ - // saltLen should be (keyBits/8) - digestSize - 2, unless that is less than - // digestSize in which case, saltLen will be digestSize. - // The only normal case where saltLen is not digestSize is when using - // 1024 keyBits with SHA512. - {"RSA-SHA1", crypto.SHA1, templatePSS(tpm2.AlgSHA1), 1024, 20}, - {"RSA-SHA256", crypto.SHA256, templatePSS(tpm2.AlgSHA256), 1024, 32}, - {"RSA-SHA384", crypto.SHA384, templatePSS(tpm2.AlgSHA384), 1024, 48}, - {"RSA-SHA512", crypto.SHA512, templatePSS(tpm2.AlgSHA512), 1024, 62}, - {"RSA-SHA512", crypto.SHA512, templatePSS(tpm2.AlgSHA512), 2048, 64}, - {"RSA-SHA1", &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthAuto, Hash: crypto.SHA1}, templatePSS(tpm2.AlgSHA1), 1024, 20}, - {"RSA-SHA256", &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthAuto, Hash: crypto.SHA256}, templatePSS(tpm2.AlgSHA256), 1024, 32}, - {"RSA-SHA384", &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthAuto, Hash: crypto.SHA384}, templatePSS(tpm2.AlgSHA384), 1024, 48}, - {"RSA-SHA512", &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthAuto, Hash: crypto.SHA512}, templatePSS(tpm2.AlgSHA512), 1024, 62}, - {"RSA-SHA512", &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthAuto, Hash: crypto.SHA512}, templatePSS(tpm2.AlgSHA512), 2048, 64}, - } - - for _, k := range keys { - t.Run(k.name, func(t *testing.T) { - alg, err := tpm2.HashToAlgorithm(k.opts.HashFunc()) - if err != nil { - t.Fatal(err) - } - test.SkipOnUnsupportedAlg(t, rwc, alg) - - k.template.RSAParameters.KeyBits = k.keyBits - - key, err := client.NewKey(rwc, tpm2.HandleEndorsement, k.template) - if err != nil { - t.Fatal(err) - } - defer key.Close() - - hash := k.opts.HashFunc().New() - hash.Write([]byte("authenticated message")) - digest := hash.Sum(nil) - - signer, err := key.GetSigner() - if err != nil { - t.Fatal(err) - } - sig, err := signer.Sign(nil, digest[:], k.opts) - if err != nil { - t.Fatal(err) - } - // Different implementations may specify different salt length. Some have "keyBytes - digestSize - 2", some have - // just "digestSize". Therefore here we just verify with default salt length. - err = rsa.VerifyPSS(signer.Public().(*rsa.PublicKey), k.opts.HashFunc(), digest[:], sig, nil) - if err != nil { - t.Error(err) - } - }) - } -} - -// Make sure signing fails when using PSS params with a non-PSS key -func TestFailSignPSS(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - keys := []struct { - name string - template tpm2.Public - }{ - {"SSA", templateSSA(tpm2.AlgSHA256)}, - {"ECC", templateECC(tpm2.AlgSHA256)}, - } - - pssOpts := rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthAuto, Hash: crypto.SHA256} - - for _, k := range keys { - t.Run(k.name, func(t *testing.T) { - key, err := client.NewKey(rwc, tpm2.HandleEndorsement, k.template) - if err != nil { - t.Fatal(err) - } - defer key.Close() - - signer, err := key.GetSigner() - if err != nil { - t.Fatal(err) - } - - // Fake SHA-256 digest - digest := make([]byte, 32) - if _, err = signer.Sign(nil, digest, &pssOpts); err == nil { - t.Error("expected failure when using PSS options") - } - }) - } -} - -// Signing keys without a signature scheme are incompatible with GetSigner -func TestFailGetSignerNullScheme(t *testing.T) { - template := templateSSA(tpm2.AlgSHA256) - template.RSAParameters.Sign = nil - - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - key, err := client.NewKey(rwc, tpm2.HandleEndorsement, template) - if err != nil { - t.Fatal(err) - } - defer key.Close() - - if _, err = key.GetSigner(); err == nil { - t.Error("expected failure when calling GetSigner") - } -} diff --git a/vendor/github.com/google/go-tpm-tools/client/template.go b/vendor/github.com/google/go-tpm-tools/client/template.go deleted file mode 100644 index f2b48115d..000000000 --- a/vendor/github.com/google/go-tpm-tools/client/template.go +++ /dev/null @@ -1,143 +0,0 @@ -package client - -import ( - "crypto/sha256" - - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -// Calculations from Credential_Profile_EK_V2.0, section 2.1.5.3 - authPolicy -func defaultEKAuthPolicy() []byte { - buf, err := tpmutil.Pack(tpm2.CmdPolicySecret, tpm2.HandleEndorsement) - if err != nil { - panic(err) - } - digest1 := sha256.Sum256(append(make([]byte, 32), buf...)) - // We would normally append the policy buffer to digest1, but the - // policy buffer is empty for the default Auth Policy. - digest2 := sha256.Sum256(digest1[:]) - return digest2[:] -} - -func defaultEKAttributes() tpm2.KeyProp { - // The EK is a storage key that must use session-based authorization. - return (tpm2.FlagStorageDefault | tpm2.FlagAdminWithPolicy) & ^tpm2.FlagUserWithAuth -} - -func defaultSRKAttributes() tpm2.KeyProp { - // FlagNoDA doesn't do anything (as the AuthPolicy is nil). However, this is - // what Windows does, and we don't want to conflict. - return tpm2.FlagStorageDefault | tpm2.FlagNoDA -} - -func defaultSymScheme() *tpm2.SymScheme { - return &tpm2.SymScheme{ - Alg: tpm2.AlgAES, - KeyBits: 128, - Mode: tpm2.AlgCFB, - } -} - -func defaultRSAParams() *tpm2.RSAParams { - return &tpm2.RSAParams{ - Symmetric: defaultSymScheme(), - KeyBits: 2048, - ModulusRaw: make([]byte, 256), // public.unique must be all zeros - } -} - -func defaultECCParams() *tpm2.ECCParams { - return &tpm2.ECCParams{ - Symmetric: defaultSymScheme(), - CurveID: tpm2.CurveNISTP256, - Point: tpm2.ECPoint{ - XRaw: make([]byte, 32), - YRaw: make([]byte, 32), - }, - } -} - -// DefaultEKTemplateRSA returns the default Endorsement Key (EK) template as -// specified in Credential_Profile_EK_V2.0, section 2.1.5.1 - authPolicy. -// https://trustedcomputinggroup.org/wp-content/uploads/Credential_Profile_EK_V2.0_R14_published.pdf -func DefaultEKTemplateRSA() tpm2.Public { - return tpm2.Public{ - Type: tpm2.AlgRSA, - NameAlg: tpm2.AlgSHA256, - Attributes: defaultEKAttributes(), - AuthPolicy: defaultEKAuthPolicy(), - RSAParameters: defaultRSAParams(), - } -} - -// DefaultEKTemplateECC returns the default Endorsement Key (EK) template as -// specified in Credential_Profile_EK_V2.0, section 2.1.5.2 - authPolicy. -// https://trustedcomputinggroup.org/wp-content/uploads/Credential_Profile_EK_V2.0_R14_published.pdf -func DefaultEKTemplateECC() tpm2.Public { - return tpm2.Public{ - Type: tpm2.AlgECC, - NameAlg: tpm2.AlgSHA256, - Attributes: defaultEKAttributes(), - AuthPolicy: defaultEKAuthPolicy(), - ECCParameters: defaultECCParams(), - } -} - -// AKTemplateRSA returns a potential Attestation Key (AK) template. -// This is very similar to DefaultEKTemplateRSA, except that this will be a -// signing key instead of an encrypting key. -func AKTemplateRSA() tpm2.Public { - return tpm2.Public{ - Type: tpm2.AlgRSA, - NameAlg: tpm2.AlgSHA256, - Attributes: tpm2.FlagSignerDefault, - RSAParameters: &tpm2.RSAParams{ - Sign: &tpm2.SigScheme{ - Alg: tpm2.AlgRSASSA, - Hash: tpm2.AlgSHA256, - }, - KeyBits: 2048, - }, - } -} - -// AKTemplateECC returns a potential Attestation Key (AK) template. -// This is very similar to DefaultEKTemplateECC, except that this will be a -// signing key instead of an encrypting key. -func AKTemplateECC() tpm2.Public { - params := defaultECCParams() - params.Symmetric = nil - params.Sign = &tpm2.SigScheme{ - Alg: tpm2.AlgECDSA, - Hash: tpm2.AlgSHA256, - } - return tpm2.Public{ - Type: tpm2.AlgECC, - NameAlg: tpm2.AlgSHA256, - Attributes: tpm2.FlagSignerDefault, - ECCParameters: params, - } -} - -// SRKTemplateRSA returns a standard Storage Root Key (SRK) template. -// This is based upon the advice in the TCG's TPM v2.0 Provisioning Guidance. -func SRKTemplateRSA() tpm2.Public { - return tpm2.Public{ - Type: tpm2.AlgRSA, - NameAlg: tpm2.AlgSHA256, - Attributes: defaultSRKAttributes(), - RSAParameters: defaultRSAParams(), - } -} - -// SRKTemplateECC returns a standard Storage Root Key (SRK) template. -// This is based upon the advice in the TCG's TPM v2.0 Provisioning Guidance. -func SRKTemplateECC() tpm2.Public { - return tpm2.Public{ - Type: tpm2.AlgECC, - NameAlg: tpm2.AlgSHA256, - Attributes: defaultSRKAttributes(), - ECCParameters: defaultECCParams(), - } -} diff --git a/vendor/github.com/google/go-tpm-tools/cloudbuild.yaml b/vendor/github.com/google/go-tpm-tools/cloudbuild.yaml deleted file mode 100644 index 6b4b5e91d..000000000 --- a/vendor/github.com/google/go-tpm-tools/cloudbuild.yaml +++ /dev/null @@ -1,177 +0,0 @@ -substitutions: - # using this base image for now, because there is an issue causing the newest COS dev - # image not booting with cs. - '_BASE_IMAGE': '' # left empty means using the latest image in the family - '_BASE_IMAGE_FAMILY': 'cos-dev' # base image family - '_OUTPUT_IMAGE_PREFIX': 'confidential-space' - '_OUTPUT_IMAGE_SUFFIX': '' - '_OUTPUT_IMAGE_FAMILY': '' - '_BUCKET_NAME': '${PROJECT_ID}_cloudbuild' - -steps: -# determine the base image -- name: 'gcr.io/cloud-builders/gcloud' - id: BaseImageIdent - env: - - 'BASE_IMAGE=$_BASE_IMAGE' - - 'BASE_IMAGE_FAMILY=$_BASE_IMAGE_FAMILY' - script: | - #!/usr/bin/env bash - - # if BASE_IMAGE is not specified in the substitutions, use the latest COS dev image - base_image=${BASE_IMAGE} - if [ -z ${base_image} ] - then - echo "getting the latest COS image" - base_image=$(gcloud compute images describe-from-family ${BASE_IMAGE_FAMILY} --project cos-cloud | grep name | cut -d ' ' -f 2) - fi - - echo ${base_image} > /workspace/base_image.txt - -- name: 'gcr.io/cloud-builders/gcloud' - id: DebugImageBuild - waitFor: ['BaseImageIdent'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'OUTPUT_IMAGE_FAMILY=$_OUTPUT_IMAGE_FAMILY' - - 'BUCKET_NAME=$_BUCKET_NAME' - script: | - #!/usr/bin/env bash - set -exuo pipefail - - base_image=$(cat /workspace/base_image.txt) - echo "building the debug image: ${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX} with the base image: ${base_image}" - gcloud builds submit --config=launcher/image/cloudbuild.yaml --region us-west1 \ - --substitutions _BASE_IMAGE=${base_image},_OUTPUT_IMAGE_FAMILY=${OUTPUT_IMAGE_FAMILY}-debug,_OUTPUT_IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX},_IMAGE_ENV=debug,_CS_LICENSE=projects/confidential-space-images/global/licenses/confidential-space-debug,_BUCKET_NAME=${BUCKET_NAME} - exit - -- name: 'gcr.io/cloud-builders/gcloud' - id: HardenedImageBuild - waitFor: ['BaseImageIdent'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'OUTPUT_IMAGE_FAMILY=$_OUTPUT_IMAGE_FAMILY' - - 'BUCKET_NAME=$_BUCKET_NAME' - script: | - #!/usr/bin/env bash - set -exuo pipefail - - base_image=$(cat /workspace/base_image.txt) - echo "building the hardened image: ${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX} with the base image: ${base_image}" - gcloud builds submit --config=launcher/image/cloudbuild.yaml --region us-west1 \ - --substitutions _BASE_IMAGE=${base_image},_OUTPUT_IMAGE_FAMILY=${OUTPUT_IMAGE_FAMILY},_OUTPUT_IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX},_IMAGE_ENV=hardened,_CS_LICENSE=projects/confidential-space-images/global/licenses/confidential-space,_BUCKET_NAME=${BUCKET_NAME} - exit - -- name: 'gcr.io/cloud-builders/gcloud' - id: ExperimentsTests - waitFor: ['DebugImageBuild'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'PROJECT_ID=$PROJECT_ID' - script: | - #!/usr/bin/env bash - - cd launcher/image/test - echo "running experiments client tests on ${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX}" - gcloud builds submit --config=test_experiments_client.yaml --region us-west1 \ - --substitutions _IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID} - exit - -- name: 'gcr.io/cloud-builders/gcloud' - id: DebugImageTests - waitFor: ['DebugImageBuild'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'PROJECT_ID=$PROJECT_ID' - script: | - #!/usr/bin/env bash - - cd launcher/image/test - echo "running debug image tests on ${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX}" - gcloud builds submit --config=test_debug_cloudbuild.yaml --region us-west1 \ - --substitutions _IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID} - exit - -- name: 'gcr.io/cloud-builders/gcloud' - id: HardenedImageTests - waitFor: ['HardenedImageBuild'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'PROJECT_ID=$PROJECT_ID' - script: | - #!/usr/bin/env bash - - cd launcher/image/test - echo "running hardened image tests on ${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX}" - gcloud builds submit --config=test_hardened_cloudbuild.yaml --region us-west1 \ - --substitutions _IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID} - exit -- name: 'gcr.io/cloud-builders/gcloud' - id: LaunchPolicyTests - waitFor: ['HardenedImageBuild'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'PROJECT_ID=$PROJECT_ID' - script: | - #!/usr/bin/env bash - - cd launcher/image/test - echo "running launch policy tests on ${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX}" - gcloud builds submit --config=test_launchpolicy_cloudbuild.yaml --region us-west1 \ - --substitutions _HARDENED_IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID} - exit - -- name: 'gcr.io/cloud-builders/gcloud' - id: HardenedNetworkIngressTests - waitFor: ['HardenedImageBuild'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'PROJECT_ID=$PROJECT_ID' - script: | - #!/usr/bin/env bash - cd launcher/image/test - echo "running hardened image ingress network tests on ${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX}" - gcloud builds submit --config=test_ingress_network.yaml --region us-west1 \ - --substitutions _IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID} - exit -- name: 'gcr.io/cloud-builders/gcloud' - id: DebugNetworkIngressTests - waitFor: ['DebugImageBuild'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'PROJECT_ID=$PROJECT_ID' - script: | - #!/usr/bin/env bash - cd launcher/image/test - echo "running debug image ingress network tests on ${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX}" - gcloud builds submit --config=test_ingress_network.yaml --region us-west1 \ - --substitutions _IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID} - exit -- name: 'gcr.io/cloud-builders/gcloud' - id: LogRedirectionTests - waitFor: ['HardenedImageBuild'] - env: - - 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' - - 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' - - 'PROJECT_ID=$PROJECT_ID' - script: | - #!/usr/bin/env bash - - cd launcher/image/test - echo "running log redirection tests on ${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX}" - gcloud builds submit --config=test_log_redirection.yaml --region us-west1 \ - --substitutions _HARDENED_IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID} - exit - - -options: - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/cmd/attest.go b/vendor/github.com/google/go-tpm-tools/cmd/attest.go deleted file mode 100644 index 0fad64f61..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/attest.go +++ /dev/null @@ -1,197 +0,0 @@ -package cmd - -import ( - "fmt" - "io" - "strconv" - - "cloud.google.com/go/compute/metadata" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/proto/attest" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/spf13/cobra" - "google.golang.org/protobuf/proto" -) - -var ( - key string - teeTechnology string -) - -// Add constants for other devices when required -const ( - // SevSnp is a constant denotes device name for teeTechnology - SevSnp = "sev-snp" - // Tdx is a constant denotes device name for teeTechnology - Tdx = "tdx" -) - -var attestationKeys = map[string]map[tpm2.Algorithm]func(rw io.ReadWriter) (*client.Key, error){ - "AK": { - tpm2.AlgRSA: client.AttestationKeyRSA, - tpm2.AlgECC: client.AttestationKeyECC, - }, - "gceAK": { - tpm2.AlgRSA: client.GceAttestationKeyRSA, - tpm2.AlgECC: client.GceAttestationKeyECC, - }, -} - -// If hardware technology needs a variable length teenonce then please modify the flags description -var attestCmd = &cobra.Command{ - Use: "attest", - Short: "Create a remote attestation report", - Long: `Gather information for remote attestation. -The Attestation report contains a quote on all available PCR banks, a way to validate -the quote, and a TCG Event Log (Linux only). -Use --key to specify the type of attestation key. It can be gceAK for GCE attestation -key or AK for a custom attestation key. By default it uses AK. ---algo flag overrides the public key algorithm for attestation key. If not provided then -by default rsa is used. ---tee-nonce attaches a 64 bytes extra data to the attestation report of TDX and SEV-SNP -hardware and guarantees a fresh quote. -`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - - rwc, err := openTpm() - if err != nil { - return err - } - defer rwc.Close() - - if !(format == "binarypb" || format == "textproto") { - return fmt.Errorf("format should be either binarypb or textproto") - } - - var attestationKey *client.Key - algoToCreateAK, ok := attestationKeys[key] - if !ok { - return fmt.Errorf("key should be either AK or gceAK") - } - createFunc := algoToCreateAK[keyAlgo] - attestationKey, err = createFunc(rwc) - if err != nil { - return fmt.Errorf("failed to create attestation key: %v", err) - } - defer attestationKey.Close() - - attestOpts := client.AttestOpts{} - attestOpts.Nonce = nonce - - // Add logic to open other hardware devices when required. - switch teeTechnology { - case SevSnp: - attestOpts.TEEDevice, err = client.CreateSevSnpDevice() - if err != nil { - return fmt.Errorf("failed to open %s device: %v", SevSnp, err) - } - attestOpts.TEENonce = teeNonce - case Tdx: - attestOpts.TEEDevice, err = client.CreateTdxDevice() - if err != nil { - return fmt.Errorf("failed to open %s device: %v", Tdx, err) - } - attestOpts.TEENonce = teeNonce - case "": - if len(teeNonce) != 0 { - return fmt.Errorf("use of --tee-nonce requires specifying TEE hardware type with --tee-technology") - } - default: - // Change the return statement when more devices are added - return fmt.Errorf("tee-technology should be either empty or should have values %s or %s", SevSnp, Tdx) - } - - attestOpts.TCGEventLog, err = client.GetEventLog(rwc) - if err != nil { - return fmt.Errorf("failed to retrieve TCG Event Log: %w", err) - } - - attestation, err := attestationKey.Attest(attestOpts) - if err != nil { - return fmt.Errorf("failed to collect attestation report : %v", err) - } - - if key == "gceAK" { - instanceInfo, err := getInstanceInfoFromMetadata() - if err != nil { - return err - } - attestation.InstanceInfo = instanceInfo - } - - var out []byte - if format == "binarypb" { - out, err = proto.Marshal(attestation) - if err != nil { - return fmt.Errorf("failed to marshal attestation proto: %v", attestation) - } - } else { - out = []byte(marshalOptions.Format(attestation)) - } - if _, err := dataOutput().Write(out); err != nil { - return fmt.Errorf("failed to write attestation report: %v", err) - } - return nil - }, -} - -func getInstanceInfoFromMetadata() (*attest.GCEInstanceInfo, error) { - - var err error - instanceInfo := &attest.GCEInstanceInfo{} - - instanceInfo.ProjectId, err = metadata.ProjectID() - if err != nil { - return nil, err - } - - projectNumber, err := metadata.NumericProjectID() - if err != nil { - return nil, err - } - instanceInfo.ProjectNumber, err = strconv.ParseUint(projectNumber, 10, 64) - if err != nil { - return nil, err - } - - instanceInfo.Zone, err = metadata.Zone() - if err != nil { - return nil, err - } - - instanceID, err := metadata.InstanceID() - if err != nil { - return nil, err - } - instanceInfo.InstanceId, err = strconv.ParseUint(instanceID, 10, 64) - if err != nil { - return nil, err - } - - instanceInfo.InstanceName, err = metadata.InstanceName() - if err != nil { - return nil, err - } - - return instanceInfo, err -} - -func addKeyFlag(cmd *cobra.Command) { - cmd.PersistentFlags().StringVar(&key, "key", "AK", "indicates type of attestation key to use ") -} - -func addTeeTechnology(cmd *cobra.Command) { - cmd.PersistentFlags().StringVar(&teeTechnology, "tee-technology", "", "indicates the type of TEE hardware. Should be either empty or one of sev-snp or tdx") -} - -func init() { - RootCmd.AddCommand(attestCmd) - addKeyFlag(attestCmd) - addNonceFlag(attestCmd) - addTeeNonceflag(attestCmd) - addPublicKeyAlgoFlag(attestCmd) - addOutputFlag(attestCmd) - addFormatFlag(attestCmd) - addTeeTechnology(attestCmd) -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/attest_test.go b/vendor/github.com/google/go-tpm-tools/cmd/attest_test.go deleted file mode 100644 index 8cc3bcf18..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/attest_test.go +++ /dev/null @@ -1,397 +0,0 @@ -package cmd - -import ( - "io" - "os" - "strconv" - "strings" - "testing" - "time" - - sgtest "github.com/google/go-sev-guest/testing" - sgtestclient "github.com/google/go-sev-guest/testing/client" - tgtest "github.com/google/go-tdx-guest/testing" - tgtestclient "github.com/google/go-tdx-guest/testing/client" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -var getIndex = map[string]uint32{ - "rsa": client.GceAKTemplateNVIndexRSA, - "ecc": client.GceAKTemplateNVIndexECC, -} - -func GCEAKTemplateECC() tpm2.Public { - return tpm2.Public{ - Type: tpm2.AlgECC, - NameAlg: tpm2.AlgSHA256, - Attributes: tpm2.FlagSignerDefault, - ECCParameters: &tpm2.ECCParams{ - Sign: &tpm2.SigScheme{ - Alg: tpm2.AlgECDSA, - Hash: tpm2.AlgSHA256, - }, - CurveID: 3, - }, - } -} -func GCEAKTemplateRSA() tpm2.Public { - return tpm2.Public{ - Type: tpm2.AlgRSA, - NameAlg: tpm2.AlgSHA256, - Attributes: tpm2.FlagSignerDefault, - RSAParameters: &tpm2.RSAParams{ - Sign: &tpm2.SigScheme{ - Alg: tpm2.AlgRSASSA, - Hash: tpm2.AlgSHA256, - }, - KeyBits: 2048, - }, - } -} - -// Need to call tpm2.NVUndefinespace on the handle with authHandle tpm2.HandlePlatform. -// e.g defer tpm2.NVUndefineSpace(rwc, "", tpm2.HandlePlatform, tpmutil.Handle(client.GceAKTemplateNVIndexRSA)) -func setGCEAKTemplate(tb testing.TB, rwc io.ReadWriteCloser, algo string, data []byte) error { - var err error - idx := tpmutil.Handle(getIndex[algo]) - if err := tpm2.NVDefineSpace(rwc, tpm2.HandlePlatform, idx, - "", "", nil, - tpm2.AttrPPWrite|tpm2.AttrPPRead|tpm2.AttrWriteDefine|tpm2.AttrOwnerRead|tpm2.AttrAuthRead|tpm2.AttrPlatformCreate|tpm2.AttrNoDA, - uint16(len(data))); err != nil { - tb.Fatalf("NVDefineSpace failed: %v", err) - } - err = tpm2.NVWrite(rwc, tpm2.HandlePlatform, idx, "", data, 0) - if err != nil { - tb.Fatalf("failed to write NVIndex: %v", err) - } - return nil -} - -func makeOutputFile(tb testing.TB, output string) string { - tb.Helper() - file, err := os.CreateTemp("", output) - if err != nil { - tb.Fatal(err) - } - defer file.Close() - return file.Name() -} - -func TestNonce(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - // Without nonce. - RootCmd.SetArgs([]string{"attest", "--key", "AK"}) - if err := RootCmd.Execute(); err == nil { - t.Error("expected not-nil error") - } - // With odd length nonce. - RootCmd.SetArgs([]string{"attest", "--nonce", "12345", "--key", "AK"}) - if err := RootCmd.Execute(); err == nil { - t.Error("expected not-nil error") - } -} - -func TestAttestPass(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - tests := []struct { - name string - key string - algo string - nonce string - }{ - {"defaultKey", "", "rsa", "1234"}, - {"AKWithRSA", "AK", "rsa", "2222"}, - {"AKWithECC", "AK", "ecc", "2222"}, - } - for _, op := range tests { - t.Run(op.name, func(t *testing.T) { - secretFile1 := makeOutputFile(t, "attest") - defer os.RemoveAll(secretFile1) - attestArgs := []string{"attest", "--output", secretFile1} - if op.key != "" { - attestArgs = append(attestArgs, "--key", op.key) - } - if op.algo != "" { - attestArgs = append(attestArgs, "--algo", op.algo) - } - if op.nonce != "" { - attestArgs = append(attestArgs, "--nonce", op.nonce) - } - RootCmd.SetArgs(attestArgs) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - }) - } -} - -func TestFormatFlagPass(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - inputFile := makeOutputFile(t, "attestXYZQ") - outputFile := makeOutputFile(t, "attestout") - defer os.RemoveAll(inputFile) - defer os.RemoveAll(outputFile) - tests := []struct { - name string - nonce string - report string - verifiedReport string - format string - }{ - {"Format:binary", "abcd", inputFile, outputFile, "binarypb"}, - {"Format:textproto", "abcd", inputFile, outputFile, "textproto"}, - } - for _, op := range tests { - t.Run(op.name, func(t *testing.T) { - attestArgs := []string{"attest", "--nonce", op.nonce, "--output", op.report, "--format", op.format} - RootCmd.SetArgs(attestArgs) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - debugArgs := []string{"verify", "debug", "--nonce", op.nonce, "--input", op.report, "--output", op.verifiedReport, "--format", op.format} - RootCmd.SetArgs(debugArgs) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - }) - } -} - -func TestFormatFlagFail(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - inputFile := makeOutputFile(t, "attest") - outputFile := makeOutputFile(t, "attestout") - defer os.RemoveAll(inputFile) - defer os.RemoveAll(outputFile) - tests := []struct { - name string - nonce string - report string - verifiedReport string - formatAttest string - formatDebug string - }{ - {"Format:binary", "abcd", inputFile, outputFile, "binarypb", "textproto"}, - {"Format:textproto", "abcd", inputFile, outputFile, "textproto", "binarypb"}, - {"Format:textproto", "abcd", inputFile, outputFile, "textproto", "xyz"}, - } - for _, op := range tests { - t.Run(op.name, func(t *testing.T) { - attestArgs := []string{"attest", "--nonce", op.nonce, "--output", op.report, "--format", op.formatAttest} - RootCmd.SetArgs(attestArgs) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - debugArgs := []string{"verify", "debug", "--nonce", op.nonce, "--input", op.report, "--output", op.verifiedReport, "--format", op.formatDebug} - RootCmd.SetArgs(debugArgs) - if err := RootCmd.Execute(); err == nil { - t.Error(err) - } - }) - } -} - -func TestMetadataPass(t *testing.T) { - var dummyInstance = Instance{ProjectID: "test-project", ProjectNumber: "1922337278274", Zone: "us-central-1a", InstanceID: "12345678", InstanceName: "default"} - mock, err := NewMetadataServer(dummyInstance) - if err != nil { - t.Error(err) - } - defer mock.Stop() - instanceInfo, err := getInstanceInfoFromMetadata() - if err != nil { - t.Error(err) - } - if instanceInfo.ProjectId != dummyInstance.ProjectID { - t.Errorf("metadata.ProjectID() = %v, want %v", instanceInfo.ProjectId, dummyInstance.ProjectID) - } - projectNumber, err := strconv.ParseUint(dummyInstance.ProjectNumber, 10, 64) - if err != nil { - t.Error(err) - } - if instanceInfo.ProjectNumber != projectNumber { - t.Errorf("metadata.NumericProjectID() = %v, want %v", instanceInfo.ProjectNumber, projectNumber) - } - if instanceInfo.InstanceName != dummyInstance.InstanceName { - t.Errorf("metadata.InstanceName() = %v, want %v", instanceInfo.InstanceName, dummyInstance.InstanceName) - } - instanceID, err := strconv.ParseUint(dummyInstance.InstanceID, 10, 64) - if err != nil { - t.Error(err) - } - if instanceInfo.InstanceId != instanceID { - t.Errorf("metadata.InstanceID() = %v, want %v", instanceInfo.InstanceId, instanceID) - } - if instanceInfo.Zone != dummyInstance.Zone { - t.Errorf("metadata.Zone() = %v, want %v", instanceInfo.Zone, dummyInstance.Zone) - } -} - -func TestAttestWithGCEAK(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - secretFile1 := makeOutputFile(t, "attest") - defer os.RemoveAll(secretFile1) - var template = map[string]tpm2.Public{ - "rsa": GCEAKTemplateRSA(), - "ecc": GCEAKTemplateECC(), - } - tests := []struct { - name string - nonce string - keyAlgo string - }{ - {"gceAK:RSA", "1234", "rsa"}, - {"gceAK:ECC", "1234", "ecc"}, - } - for _, op := range tests { - t.Run(op.name, func(t *testing.T) { - data, err := template[op.keyAlgo].Encode() - if err != nil { - t.Fatalf("failed to encode GCEAKTemplateRSA: %v", err) - } - err = setGCEAKTemplate(t, rwc, op.keyAlgo, data) - if err != nil { - t.Error(err) - } - defer tpm2.NVUndefineSpace(rwc, "", tpm2.HandlePlatform, tpmutil.Handle(getIndex[op.keyAlgo])) - - var dummyInstance = Instance{ProjectID: "test-project", ProjectNumber: "1922337278274", Zone: "us-central-1a", InstanceID: "12345678", InstanceName: "default"} - mock, err := NewMetadataServer(dummyInstance) - if err != nil { - t.Error(err) - } - defer mock.Stop() - - RootCmd.SetArgs([]string{"attest", "--nonce", op.nonce, "--key", "gceAK", "--algo", op.keyAlgo, "--output", secretFile1, "--format", "binarypb"}) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - }) - } -} - -func TestTeeTechnologyFail(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - // value of tee-technology flag should be sev-snp - RootCmd.SetArgs([]string{"attest", "--nonce", "1234", "--key", "AK", "--tee-nonce", "12345678", "--tee-technology", "sev"}) - if err := RootCmd.Execute(); err == nil { - t.Error("expected not-nil error") - } -} - -func TestSevAttestTeeNonceFail(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - // non-nil TEENonce when TEEDevice is nil - RootCmd.SetArgs([]string{"attest", "--nonce", "1234", "--key", "AK", "--tee-nonce", "12345678", "--tee-technology", ""}) - if err := RootCmd.Execute(); err == nil { - t.Error("expected not-nil error") - } - - // TEENonce with length less than 64 bytes. - sevTestDevice, _, _, _ := sgtestclient.GetSevGuest([]sgtest.TestCase{ - { - Input: [64]byte{1, 2, 3, 4}, - }, - }, &sgtest.DeviceOptions{Now: time.Now()}, t) - defer sevTestDevice.Close() - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Error(err) - } - defer ak.Close() - attestopts := client.AttestOpts{ - Nonce: []byte{1, 2, 3, 4}, - TEENonce: []byte{1, 2, 3, 4}, - TEEDevice: &client.SevSnpDevice{Device: sevTestDevice}, - } - _, err = ak.Attest(attestopts) - if err == nil { - t.Error("expected non-nil error") - } - -} - -func TestTdxAttestTeeNonceFail(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - // non-nil TEENonce when TEEDevice is nil - RootCmd.SetArgs([]string{"attest", "--nonce", "1234", "--key", "AK", "--tee-nonce", "12345678", "--tee-technology", ""}) - if err := RootCmd.Execute(); err == nil { - t.Error("expected not-nil error") - } - - // TEENonce with length less than 64 bytes. - tdxTestDevice := tgtestclient.GetTdxGuest([]tgtest.TestCase{ - { - Input: [64]byte{1, 2, 3, 4}, - }, - }, t) - defer tdxTestDevice.Close() - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Error(err) - } - defer ak.Close() - attestopts := client.AttestOpts{ - Nonce: []byte{1, 2, 3, 4}, - TEENonce: []byte{1, 2, 3, 4}, - TEEDevice: &client.TdxDevice{Device: tdxTestDevice}, - } - _, err = ak.Attest(attestopts) - if err == nil { - t.Error("expected non-nil error") - } -} - -func TestHardwareAttestationPass(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - inputFile := makeOutputFile(t, "attest") - outputFile := makeOutputFile(t, "attestout") - defer os.RemoveAll(inputFile) - defer os.RemoveAll(outputFile) - teenonce := "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678" - tests := []struct { - name string - nonce string - teetech string - wanterr string - }{ - {"TdxPass", "1234", "tdx", "failed to open tdx device"}, - {"SevSnpPass", "1234", "sev-snp", "failed to open sev-snp device"}, - } - for _, op := range tests { - t.Run(op.name, func(t *testing.T) { - attestArgs := []string{"attest", "--nonce", op.nonce, "--output", inputFile, "--format", "textproto", "--tee-nonce", teenonce, "--tee-technology", op.teetech} - RootCmd.SetArgs(attestArgs) - if err := RootCmd.Execute(); err != nil { - if !strings.Contains(err.Error(), op.wanterr) { - t.Error(err) - } - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/fake_metadata.go b/vendor/github.com/google/go-tpm-tools/cmd/fake_metadata.go deleted file mode 100644 index 46a6a2a2d..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/fake_metadata.go +++ /dev/null @@ -1,72 +0,0 @@ -package cmd - -import ( - "fmt" - "net/http" - "net/http/httptest" - "os" - "strings" - - "cloud.google.com/go/compute/metadata" -) - -const metadataHostEnv = "GCE_METADATA_HOST" - -// Instance struct for supported fake values for metadata server. -type Instance struct { - ProjectID string - ProjectNumber string - InstanceID string - InstanceName string - Zone string -} - -// MetadataServer provides fake implementation for the GCE metadata server. -type MetadataServer struct { - server *httptest.Server - oldMetadataHostEnv string - responses map[string]string -} - -// NewMetadataServer starts and hooks up a Server, serving env. -// data is the mock Instance data the metadata server will respond with. -func NewMetadataServer(data Instance) (*MetadataServer, error) { - resp := map[string]string{} - resp["project/project-id"] = data.ProjectID - resp["project/numeric-project-id"] = data.ProjectNumber - resp["instance/id"] = data.InstanceID - resp["instance/zone"] = data.Zone - resp["instance/name"] = data.InstanceName - - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - path := "/computeMetadata/v1/" - uri := strings.TrimPrefix(r.URL.Path, path) - if uri != "" { - res, found := resp[uri] - if found { - w.Write([]byte(res)) - return - } - } - http.Error(w, http.StatusText(http.StatusNotImplemented), http.StatusNotImplemented) - }) - httpServer := httptest.NewServer(handler) - - old := os.Getenv(metadataHostEnv) - s := &MetadataServer{oldMetadataHostEnv: old, server: httpServer, responses: resp} - - os.Setenv(metadataHostEnv, strings.TrimPrefix(s.server.URL, "http://")) - - if !metadata.OnGCE() { - s.Stop() - return nil, fmt.Errorf("gcpmocks.NewMetadataServer: failed to fake being on a GCE instance") - } - return s, nil -} - -// Stop shuts down the server and restores original metadataHostEnv env var. -func (s *MetadataServer) Stop() { - os.Setenv(metadataHostEnv, s.oldMetadataHostEnv) - - s.server.Close() -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/flags.go b/vendor/github.com/google/go-tpm-tools/cmd/flags.go deleted file mode 100644 index 9d14b5a1e..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/flags.go +++ /dev/null @@ -1,224 +0,0 @@ -package cmd - -import ( - "errors" - "fmt" - "io" - "os" - "strconv" - "strings" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/spf13/cobra" -) - -var ( - output string - input string - nvIndex uint32 - nonce []byte - teeNonce []byte - keyAlgo = tpm2.AlgRSA - pcrs []int - format string -) - -type pcrsFlag struct { - value *[]int -} - -func (f *pcrsFlag) Set(val string) error { - for _, d := range strings.Split(val, ",") { - pcr, err := strconv.Atoi(d) - if err != nil { - return err - } - if pcr < 0 || pcr >= client.NumPCRs { - return errors.New("pcr out of range") - } - *f.value = append(*f.value, pcr) - } - return nil -} - -func (f *pcrsFlag) Type() string { - return "pcrs" -} - -func (f *pcrsFlag) String() string { - if len(*f.value) == 0 { - return "" - } - var b strings.Builder - fmt.Fprintf(&b, "%d", (*f.value)[0]) - for _, pcr := range (*f.value)[1:] { - fmt.Fprintf(&b, ",%d", pcr) - } - return b.String() -} - -var algos = map[tpm2.Algorithm]string{ - tpm2.AlgUnknown: "", - tpm2.AlgRSA: "rsa", - tpm2.AlgECC: "ecc", - tpm2.AlgSHA1: "sha1", - tpm2.AlgSHA256: "sha256", - tpm2.AlgSHA384: "sha384", - tpm2.AlgSHA512: "sha512", -} - -type algoFlag struct { - value *tpm2.Algorithm - allowed []tpm2.Algorithm -} - -func (f *algoFlag) Set(val string) error { - present := false - for _, algo := range f.allowed { - if algos[algo] == val { - *f.value = algo - present = true - } - } - if !present { - return errors.New("unknown algorithm") - } - return nil -} - -func (f *algoFlag) Type() string { - return "algo" -} - -func (f *algoFlag) String() string { - return algos[*f.value] -} - -// Allowed gives a string list of the permitted algorithm values for this flag. -func (f *algoFlag) Allowed() string { - out := make([]string, len(f.allowed)) - for i, a := range f.allowed { - out[i] = algos[a] - } - return strings.Join(out, ", ") -} - -// Disable the "help" subcommand (and just use the -h/--help flags). -// This should be called on all commands with subcommands. -// See https://github.com/spf13/cobra/issues/587 for why this is needed. -func hideHelp(cmd *cobra.Command) { - cmd.SetHelpCommand(&cobra.Command{Hidden: true}) -} - -// Lets this command specify an output file, for use with dataOutput(). -func addOutputFlag(cmd *cobra.Command) { - cmd.PersistentFlags().StringVar(&output, "output", "", - "output file (defaults to stdout)") -} - -// Lets this command specify an input file, for use with dataInput(). -func addInputFlag(cmd *cobra.Command) { - cmd.PersistentFlags().StringVar(&input, "input", "", - "input file (defaults to stdin)") -} - -// Lets this command specify an NVDATA index, for use with nvIndex. -func addIndexFlag(cmd *cobra.Command) { - cmd.PersistentFlags().Uint32Var(&nvIndex, "index", 0, - "NVDATA index, cannot be 0") -} - -// Lets this command specify some number of PCR arguments, check if in range. -func addPCRsFlag(cmd *cobra.Command) { - cmd.PersistentFlags().Var(&pcrsFlag{&pcrs}, "pcrs", "comma separated list of PCR numbers") -} - -// Lets this command specify the public key algorithm. -func addPublicKeyAlgoFlag(cmd *cobra.Command) { - f := algoFlag{&keyAlgo, []tpm2.Algorithm{tpm2.AlgRSA, tpm2.AlgECC}} - cmd.PersistentFlags().Var(&f, "algo", "public key algorithm: "+f.Allowed()) -} - -func addHashAlgoFlag(cmd *cobra.Command, hashAlgo *tpm2.Algorithm) { - f := algoFlag{hashAlgo, []tpm2.Algorithm{tpm2.AlgSHA1, tpm2.AlgSHA256, tpm2.AlgSHA384, tpm2.AlgSHA512}} - cmd.PersistentFlags().Var(&f, "hash-algo", "hash algorithm: "+f.Allowed()) -} - -func addNonceFlag(cmd *cobra.Command) { - cmd.PersistentFlags().BytesHexVar(&nonce, "nonce", []byte{}, "hex encoded nonce for vTPM attestation, cannot be empty") -} - -// Lets this command specify the type of output file (binary or txt) -func addFormatFlag(cmd *cobra.Command) { - cmd.PersistentFlags().StringVar(&format, "format", "binarypb", "type of output file where attestation report stored ") -} - -func addTeeNonceflag(cmd *cobra.Command) { - cmd.PersistentFlags().BytesHexVar(&teeNonce, "tee-nonce", []byte{}, "hex encoded teenonce for hardware attestation, can be empty") -} - -// alwaysError implements io.ReadWriter by always returning an error -type alwaysError struct { - error -} - -func (ae alwaysError) Write([]byte) (int, error) { - return 0, ae.error -} - -func (ae alwaysError) Read(_ []byte) (n int, err error) { - return 0, ae.error -} - -// Handle to output data file. If there is an issue opening the file, the Writer -// returned will return the error upon any call to Write() -func dataOutput() io.Writer { - if output == "" { - return os.Stdout - } - - file, err := os.Create(output) - if err != nil { - return alwaysError{err} - } - return file -} - -// Handle to input data file. If there is an issue opening the file, the Reader -// returned will return the error upon any call to Read() -func dataInput() io.Reader { - if input == "" { - return os.Stdin - } - - file, err := os.Open(input) - if err != nil { - return alwaysError{err} - } - return file -} - -// Load SRK based on tpm2.Algorithm set in the global flag vars. -func getSRK(rwc io.ReadWriter) (*client.Key, error) { - switch keyAlgo { - case tpm2.AlgRSA: - return client.StorageRootKeyRSA(rwc) - case tpm2.AlgECC: - return client.StorageRootKeyECC(rwc) - default: - panic("unexpected keyAlgo") - } -} - -// Load EK based on tpm2.Algorithm set in the global flag vars. -func getEK(rwc io.ReadWriter) (*client.Key, error) { - switch keyAlgo { - case tpm2.AlgRSA: - return client.EndorsementKeyRSA(rwc) - case tpm2.AlgECC: - return client.EndorsementKeyECC(rwc) - default: - panic("unexpected keyAlgo") - } -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/flush.go b/vendor/github.com/google/go-tpm-tools/cmd/flush.go deleted file mode 100644 index 13f3da753..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/flush.go +++ /dev/null @@ -1,87 +0,0 @@ -package cmd - -import ( - "fmt" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/spf13/cobra" -) - -var handleNames = map[string][]tpm2.HandleType{ - "all": {tpm2.HandleTypeLoadedSession, tpm2.HandleTypeSavedSession, tpm2.HandleTypeTransient}, - "loaded": {tpm2.HandleTypeLoadedSession}, - "saved": {tpm2.HandleTypeSavedSession}, - "transient": {tpm2.HandleTypeTransient}, - "persistent": {tpm2.HandleTypePersistent}, -} - -var flushCmd = &cobra.Command{ - Use: "flush ", - Short: "Close active handles on the TPM", - Long: `Close some or all currently active handles on the TPM - -Most TPM operations require an active handle, representing some object within -the TPM. However, most TPMs also limit the number of simultaneous active handles -(usually a max of 3). This command allows for "leaked" handles (handles that -have not been properly closed) to be flushed, freeing up memory for new handles -to be used with future TPM operations. - -The TPM can also take an active handle and "persist" it to NVRAM. This frees up -memory for more transient handles. It can also allow for caching the creation of -slow keys (such as the RSA-based EK or SRK). These handles can be evicted from -NVRAM using the "persistent" argument, but are not flushed with "all", as this -can result in data loss (if the persisted key cannot be regenerated). - -Which handles are flushed depends on the argument passed: - loaded - only flush the loaded session handles - saved - only flush the saved session handles - transient - only flush the transient handles - all - flush all loaded, saved, and transient handles - persistent - only evict the persistent handles`, - ValidArgs: func() []string { - // The keys from the handleNames map are our valid arguments - keys := make([]string, len(handleNames)) - for k := range handleNames { - keys = append(keys, k) - } - return keys - }(), - Args: cobra.ExactValidArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - rwc, err := openTpm() - if err != nil { - return err - } - defer rwc.Close() - - totalHandles := 0 - for _, handleType := range handleNames[args[0]] { - handles, err := client.Handles(rwc, handleType) - if err != nil { - return fmt.Errorf("getting handles: %w", err) - } - for _, handle := range handles { - if handleType == tpm2.HandleTypePersistent { - if err = tpm2.EvictControl(rwc, "", tpm2.HandleOwner, handle, handle); err != nil { - return fmt.Errorf("evicting handle 0x%x: %w", handle, err) - } - fmt.Fprintf(debugOutput(), "Handle 0x%x evicted\n", handle) - } else { - if err = tpm2.FlushContext(rwc, handle); err != nil { - return fmt.Errorf("flushing handle 0x%x: %w", handle, err) - } - fmt.Fprintf(debugOutput(), "Handle 0x%x flushed\n", handle) - } - totalHandles++ - } - } - - fmt.Fprintf(messageOutput(), "%d handles flushed\n", totalHandles) - return nil - }, -} - -func init() { - RootCmd.AddCommand(flushCmd) -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/flush_test.go b/vendor/github.com/google/go-tpm-tools/cmd/flush_test.go deleted file mode 100644 index e984644d5..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/flush_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package cmd - -import ( - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" -) - -func TestFlushNothing(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - RootCmd.SetArgs([]string{"flush", "all", "--quiet"}) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } -} - -func TestFlush(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - RootCmd.SetArgs([]string{"flush", "transient", "--quiet"}) - - // Loads then flushes 1, 2, 3 transient handles. - for numHandles := 1; numHandles <= 3; numHandles++ { - for i := 0; i < numHandles; i++ { - test.LoadRandomExternalKey(t, rwc) - } - - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - - // Ensure there are no active handles after that. - h, err := client.Handles(rwc, tpm2.HandleTypeTransient) - if err != nil { - t.Fatal(err) - } - if len(h) != 0 { - t.Errorf("TPM should be empty of transient handles; got: %d; want: 0", len(h)) - } - } -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/go.mod b/vendor/github.com/google/go-tpm-tools/cmd/go.mod deleted file mode 100644 index 2c6ddec45..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/go.mod +++ /dev/null @@ -1,31 +0,0 @@ -module github.com/google/go-tpm-tools/cmd - -go 1.20 - -require ( - cloud.google.com/go/compute/metadata v0.2.3 - github.com/google/go-sev-guest v0.9.3 - github.com/google/go-tdx-guest v0.2.3-0.20231011100059-4cf02bed9d33 - github.com/google/go-tpm v0.9.0 - github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba - github.com/spf13/cobra v1.3.0 - google.golang.org/protobuf v1.31.0 -) - -require ( - cloud.google.com/go/compute v1.19.3 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/certificate-transparency-go v1.1.2 // indirect - github.com/google/go-attestation v0.5.0 // indirect - github.com/google/go-tspi v0.3.0 // indirect - github.com/google/logger v1.1.1 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/pborman/uuid v1.2.1 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.3 // indirect - go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/sys v0.12.0 // indirect -) diff --git a/vendor/github.com/google/go-tpm-tools/cmd/go.sum b/vendor/github.com/google/go-tpm-tools/cmd/go.sum deleted file mode 100644 index 70679a31d..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/go.sum +++ /dev/null @@ -1,1382 +0,0 @@ -bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -bitbucket.org/creachadair/shell v0.0.6/go.mod h1:8Qqi/cYk7vPnsOePHroKXDJYmb5x7ENhtiFtfZq8K+M= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.39.0/go.mod h1:rVLT6fkc8chs9sfPtFc1SBH6em7n+ZoXaG+87tDISts= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.92.2/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.92.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= -cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.19.3 h1:DcTwsFgGev/wV5+q8o2fzgcHOaac+DKGC91ZlvpsQds= -cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= -cloud.google.com/go/monitoring v0.1.0/go.mod h1:Hpm3XfzJv+UTiXzCG5Ffp0wijzHTC7Cv4eR7o3x/fEE= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/spanner v1.17.0/go.mod h1:+17t2ixFwRG4lWRwE+5kipDR9Ef07Jkmc8z0IbMDKUs= -cloud.google.com/go/spanner v1.18.0/go.mod h1:LvAjUXPeJRGNuGpikMULjhLj/t9cRvdc+fxRoLiugXA= -cloud.google.com/go/spanner v1.25.0/go.mod h1:kQUft3x355hzzaeFbObjsvkzZDgpDkesp3v75WBnI8w= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/trace v0.1.0/go.mod h1:wxEwsoeRVPbeSkt7ZC9nWCgmoKQRAoySN7XHW2AmI7g= -code.gitea.io/sdk/gitea v0.11.3/go.mod h1:z3uwDV/b9Ls47NGukYM9XhnHtqPh/J+t40lsUrR6JDY= -contrib.go.opencensus.io/exporter/aws v0.0.0-20181029163544-2befc13012d0/go.mod h1:uu1P0UCM/6RbsMrgPa98ll8ZcHM858i/AD06a9aLRCA= -contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0= -contrib.go.opencensus.io/exporter/stackdriver v0.12.1/go.mod h1:iwB6wGarfphGGe/e5CWqyUk/cLzKnWsOKPVW3no6OTw= -contrib.go.opencensus.io/exporter/stackdriver v0.13.5/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= -contrib.go.opencensus.io/exporter/stackdriver v0.13.8/go.mod h1:huNtlWx75MwO7qMs0KrMxPZXzNNWebav1Sq/pm02JdQ= -contrib.go.opencensus.io/integrations/ocsql v0.1.4/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE= -contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-amqp-common-go/v2 v2.1.0/go.mod h1:R8rea+gJRuJR6QxTir/XuEd+YuKoUiazDC/N96FiDEU= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-sdk-for-go v29.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v30.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-service-bus-go v0.9.1/go.mod h1:yzBx6/BUGfjfeqbRZny9AQIbIe3AcV9WZbAdpkoXOa0= -github.com/Azure/azure-storage-blob-go v0.8.0/go.mod h1:lPI3aLPpuLTeUwh1sViKXFxwl2B6teiRqI0deQUvsw0= -github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20191009163259-e802c2cb94ae/go.mod h1:mjwGPas4yKduTyubHvD1Atl9r1rUq8DfVy+gkVvZ+oo= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/semver/v3 v3.1.0/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= -github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= -github.com/apache/beam v2.28.0+incompatible/go.mod h1:/8NX3Qi8vGstDLLaeaU7+lzVEu/ACaQhYjeefzQ0y1o= -github.com/apache/beam v2.32.0+incompatible/go.mod h1:/8NX3Qi8vGstDLLaeaU7+lzVEu/ACaQhYjeefzQ0y1o= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apex/log v1.1.4/go.mod h1:AlpoD9aScyQfJDVHmLMEcx4oU6LqzkWp4Mg9GdAcEvQ= -github.com/apex/logs v0.0.4/go.mod h1:XzxuLZ5myVHDy9SAmYpamKKRNApGj54PfYLcFrXqDwo= -github.com/aphistic/golf v0.0.0-20180712155816-02c07f170c5a/go.mod h1:3NqKYiepwy8kCu4PNA+aP7WUV72eXWJeP9/r3/K9aLE= -github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.19.45/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.25.11/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= -github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI= -github.com/caarlos0/ctrlc v1.0.0/go.mod h1:CdXpj4rmq0q/1Eb44M9zi2nKB0QraNKuRGYGrrHhcQw= -github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e/go.mod h1:9IOqJGCPMSc6E5ydlp5NIonxObaeu/Iub/X03EKPVYo= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= -github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= -github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/devigned/tab v0.1.1/go.mod h1:XG9mPq0dFghrYvoBF3xdRrJzSTX1b7IQrvaL9mzjeJY= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.3.0-java/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= -github.com/etcd-io/gofail v0.0.0-20190801230047-ad7f989257ca/go.mod h1:49H/RkXP8pKaZy4h0d+NW16rSLhyVBt4o6VLJbmOqDE= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= -github.com/fullstorydev/grpcurl v1.8.0/go.mod h1:Mn2jWbdMrQGJQ8UD62uNyMumT2acsZUCkZIqFxsQf1o= -github.com/fullstorydev/grpcurl v1.8.1/go.mod h1:3BWhvHZwNO7iLXaQlojdg5NA6SxUDePli4ecpK1N7gw= -github.com/fullstorydev/grpcurl v1.8.2/go.mod h1:YvWNT3xRp2KIRuvCphFodG0fKkMXwaxA9CJgKCcyzUQ= -github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= -github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= -github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= -github.com/google/certificate-transparency-go v1.1.2-0.20210422104406-9f33727a7a18/go.mod h1:6CKh9dscIRoqc2kC6YUFICHZMT9NrClyPrRVFrdw1QQ= -github.com/google/certificate-transparency-go v1.1.2-0.20210512142713-bed466244fa6/go.mod h1:aF2dp7Dh81mY8Y/zpzyXps4fQW5zQbDu2CxfpJB6NkI= -github.com/google/certificate-transparency-go v1.1.2 h1:4hE0GEId6NAW28dFpC+LrRGwQX5dtmXQGDbg8+/MZOM= -github.com/google/certificate-transparency-go v1.1.2/go.mod h1:3OL+HKDqHPUfdKrHVQxO6T8nDLO0HF7LRTlkIWXaWvQ= -github.com/google/go-attestation v0.5.0 h1:jXtAWT2sw2Yu8mYU0BC7FDidR+ngxFPSE+pl6IUu3/0= -github.com/google/go-attestation v0.5.0/go.mod h1:0Tik9y3rzV649Jcr7evbljQHQAsIlJucyqQjYDBqktU= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM= -github.com/google/go-licenses v0.0.0-20210329231322-ce1d9163b77d/go.mod h1:+TYOmkVoJOpwnS0wfdsJCV9CoD5nJYsHoFk/0CrTK4M= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/go-replayers/grpcreplay v0.1.0/go.mod h1:8Ig2Idjpr6gifRd6pNVggX6TC1Zw6Jx74AKp7QNH2QE= -github.com/google/go-replayers/httpreplay v0.1.0/go.mod h1:YKZViNhiGgqdBlUbI2MwGpq4pXxNmhJLPHQ7cv2b5no= -github.com/google/go-sev-guest v0.9.3 h1:GOJ+EipURdeWFl/YYdgcCxyPeMgQUWlI056iFkBD8UU= -github.com/google/go-sev-guest v0.9.3/go.mod h1:hc1R4R6f8+NcJwITs0L90fYWTsBpd1Ix+Gur15sqHDs= -github.com/google/go-tdx-guest v0.2.3-0.20231011100059-4cf02bed9d33 h1:lRlUusuieEuqljjihCXb+Mr73VNitOYPJYWXzJKtBWs= -github.com/google/go-tdx-guest v0.2.3-0.20231011100059-4cf02bed9d33/go.mod h1:84ut3oago/BqPXD4ppiGXdkZNW3WFPkcyAO4my2hXdY= -github.com/google/go-tpm v0.9.0 h1:sQF6YqWMi+SCXpsmS3fd21oPy/vSddwZry4JnmltHVk= -github.com/google/go-tpm v0.9.0/go.mod h1:FkNVkc6C+IsvDI9Jw1OveJmxGZUUaKxtrpOS47QWKfU= -github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba h1:qJEJcuLzH5KDR0gKc0zcktin6KSAwL7+jWKBYceddTc= -github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba/go.mod h1:EFYHy8/1y2KfgTAsx7Luu7NGhoxtuVHnNo8jE7FikKc= -github.com/google/go-tspi v0.3.0 h1:ADtq8RKfP+jrTyIWIZDIYcKOMecRqNJFOew2IT0Inus= -github.com/google/go-tspi v0.3.0/go.mod h1:xfMGI3G0PhxCdNVcYr1C4C+EizojDg/TXuX5by8CiHI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/licenseclassifier v0.0.0-20210325184830-bb04aff29e72/go.mod h1:qsqn2hxC+vURpyBRygGUuinTO42MFRLcsmQ/P8v94+M= -github.com/google/logger v1.1.1 h1:+6Z2geNxc9G+4D4oDO9njjjn2d0wN5d7uOo0vOIW1NQ= -github.com/google/logger v1.1.1/go.mod h1:BkeJZ+1FhQ+/d087r4dzojEg1u2ZX+ZqG1jTUrLM+zQ= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/rpmpack v0.0.0-20191226140753-aa36bfddb3a0/go.mod h1:RaTPr0KUf2K7fnZYLNDrr8rxAamWs3iNywJLtQ2AzBg= -github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= -github.com/google/trillian v1.3.14-0.20210409160123-c5ea3abd4a41/go.mod h1:1dPv0CUjNQVFEDuAUFhZql16pw/VlPgaX8qj+g5pVzQ= -github.com/google/trillian v1.3.14-0.20210511103300-67b5f349eefa/go.mod h1:s4jO3Ai4NSvxucdvqUHON0bCqJyoya32eNw6XJwsmNc= -github.com/google/trillian v1.4.0/go.mod h1:1Bja2nEgMDlEJWWRXBUemSPG9qYw84ZYX2gHRVHlR+g= -github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/wire v0.3.0/go.mod h1:i1DMg/Lu8Sz5yYl25iOdmc5CT5qusaa+zmRWs16741s= -github.com/googleapis/gax-go v2.0.2+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= -github.com/goreleaser/goreleaser v0.134.0/go.mod h1:ZT6Y2rSYa6NxQzIsdfWWNWAlYGXGbreo66NmE+3X3WQ= -github.com/goreleaser/nfpm v1.2.1/go.mod h1:TtWrABZozuLOttX2uDlYyECfQX7x5XYkVxhjYcR6G9w= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= -github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= -github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= -github.com/jhump/protoreflect v1.8.2/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= -github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= -github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= -github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= -github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= -github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= -github.com/mwitkow/go-proto-validators v0.2.0/go.mod h1:ZfA1hW+UH/2ZHOWvQ3HnQaU0DtnpXu850MZiy+YUgcc= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= -github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= -github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/pseudomuto/protoc-gen-doc v1.4.1/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= -github.com/pseudomuto/protoc-gen-doc v1.5.0/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= -github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.0/go.mod h1:EBwu+T5AvHOcXwvZIkQFjUN6s8Czyqw12GL/Y0tUyRM= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b/go.mod h1:am+Fp8Bt506lA3Rk3QCmSqmYmLMnPDhdDUcosQCAx+I= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= -github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/soheilhy/cmux v0.1.5-0.20210205191134-5ec6847320e5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= -github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= -github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0= -github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0= -github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao= -github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug= -github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= -github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.etcd.io/etcd/api/v3 v3.5.0-alpha.0/go.mod h1:mPcW6aZJukV6Aa81LSKpBjQXTWlXB5r74ymPoSWa3Sw= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0-alpha.0/go.mod h1:kdV+xzCJ3luEBSIeQyB/OEKkWKd8Zkux4sbDeANrosU= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= -go.etcd.io/etcd/client/v3 v3.5.0-alpha.0/go.mod h1:wKt7jgDgf/OfKiYmCq5WFGxOFAkVMLxiiXgLDFhECr8= -go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= -go.etcd.io/etcd/etcdctl/v3 v3.5.0-alpha.0/go.mod h1:YPwSaBciV5G6Gpt435AasAG3ROetZsKNUzibRa/++oo= -go.etcd.io/etcd/etcdctl/v3 v3.5.0/go.mod h1:vGTfKdsh87RI7kA2JHFBEGxjQEYx+pi299wqEOdi34M= -go.etcd.io/etcd/etcdutl/v3 v3.5.0/go.mod h1:o98rKMCibbFAG8QS9KmvlYDGDShmmIbmRE8vSofzYNg= -go.etcd.io/etcd/pkg/v3 v3.5.0-alpha.0/go.mod h1:tV31atvwzcybuqejDoY3oaNRTtlD2l/Ot78Pc9w7DMY= -go.etcd.io/etcd/pkg/v3 v3.5.0/go.mod h1:UzJGatBQ1lXChBkQF0AuAtkRQMYnHubxAEYIrC3MSsE= -go.etcd.io/etcd/raft/v3 v3.5.0-alpha.0/go.mod h1:FAwse6Zlm5v4tEWZaTjmNhe17Int4Oxbu7+2r0DiD3w= -go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD00Szc= -go.etcd.io/etcd/server/v3 v3.5.0-alpha.0/go.mod h1:tsKetYpt980ZTpzl/gb+UOJj9RkIyCb1u4wjzMg90BQ= -go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4= -go.etcd.io/etcd/tests/v3 v3.5.0-alpha.0/go.mod h1:HnrHxjyCuZ8YDt8PYVyQQ5d1ZQfzJVEtQWllr5Vp/30= -go.etcd.io/etcd/tests/v3 v3.5.0/go.mod h1:f+mtZ1bE1YPvgKdOJV2BKy4JQW0nAFnQehgOE7+WyJE= -go.etcd.io/etcd/v3 v3.5.0-alpha.0/go.mod h1:JZ79d3LV6NUfPjUxXrpiFAYcjhT+06qqw+i28snx8To= -go.etcd.io/etcd/v3 v3.5.0/go.mod h1:FldM0/VzcxYWLvWx1sdA7ghKw7C3L2DvUTzGrcEtsC4= -go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.22.6/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E= -go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= -go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= -go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= -go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= -go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= -go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= -go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= -go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -gocloud.dev v0.19.0/go.mod h1:SmKwiR8YwIMMJvQBKLsC3fHNyMwXLw3PMDO+VVteJMI= -golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210126194326-f9ce19ea3013/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190620070143-6f217b454f45/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191119060738-e882bf8e40c2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201014170642-d1624618ad65/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.6.0/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.10.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.37.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.45.0/go.mod h1:ISLIJCedJolbZvDfAk+Ctuq5hf+aJ33WgtUsfyFoLXA= -google.golang.org/api v0.46.0/go.mod h1:ceL4oozhkAiTID8XMmJBsIxID/9wMXJVVFXPg4ylg3I= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= -google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190620144150-6af8c5fc6601/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210331142528-b7513248f0ba/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210413151531-c14fb6ef47c3/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210427215850-f767ed18ee4d/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98= -gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= -gopkg.in/src-d/go-git.v4 v4.13.1/go.mod h1:nx5NYcxdKxq5fpltdHnPa2Exj4Sx0EclMWZQbYDu2z8= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -pack.ag/amqp v0.11.2/go.mod h1:4/cbmt4EJXSKlG6LCfWHoqmN0uFdy5i/+YFz+fTfhV4= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/vendor/github.com/google/go-tpm-tools/cmd/gotpm/main.go b/vendor/github.com/google/go-tpm-tools/cmd/gotpm/main.go deleted file mode 100644 index 3aa688317..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/gotpm/main.go +++ /dev/null @@ -1,14 +0,0 @@ -// Package main is a binary wrapper package around cmd. -package main - -import ( - "os" - - "github.com/google/go-tpm-tools/cmd" -) - -func main() { - if cmd.RootCmd.Execute() != nil { - os.Exit(1) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/open.go b/vendor/github.com/google/go-tpm-tools/cmd/open.go deleted file mode 100644 index 78658a516..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/open.go +++ /dev/null @@ -1,44 +0,0 @@ -package cmd - -import ( - "fmt" - "io" - - "github.com/google/go-tpm-tools/client" -) - -// ExternalTPM can be set to run tests against an TPM initialized by an -// external package (like the simulator). Setting this value will make all -// gotpm commands run against it, and will prevent the cmd package from -// closing the TPM. Setting this value and closing the TPM must be managed -// by the external package. -// ExternalTPM can have a TPM simulator or a real TPM. -var ExternalTPM io.ReadWriter - -// extTPMWrapper is designed to wrap the ExternalTPM to provide some overriding -// functions. -type extTPMWrapper struct { - io.ReadWriter -} - -// Close is no-op for extTPMWrapper to prevent it closing the underlying simulator. -func (et extTPMWrapper) Close() error { - return nil -} - -// EventLog is a workaround so the caller can call the underlying EventLogGetter function -// of the underlying TPM. -func (et extTPMWrapper) EventLog() ([]byte, error) { - return client.GetEventLog(et.ReadWriter) -} - -func openTpm() (io.ReadWriteCloser, error) { - if ExternalTPM != nil { - return extTPMWrapper{ExternalTPM}, nil - } - rwc, err := openImpl() - if err != nil { - return nil, fmt.Errorf("connecting to TPM: %w", err) - } - return rwc, nil -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/open_other.go b/vendor/github.com/google/go-tpm-tools/cmd/open_other.go deleted file mode 100644 index bc87bf6b5..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/open_other.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build !windows -// +build !windows - -package cmd - -import ( - "io" - "os" - - "github.com/google/go-tpm/legacy/tpm2" -) - -var tpmPath string - -func init() { - RootCmd.PersistentFlags().StringVar(&tpmPath, "tpm-path", "", - "path to TPM device (defaults to /dev/tpmrm0 then /dev/tpm0)") -} - -// On Linux, we have to pass in the TPM path though a flag -func openImpl() (io.ReadWriteCloser, error) { - if tpmPath == "" { - tpm, err := tpm2.OpenTPM("/dev/tpmrm0") - if os.IsNotExist(err) { - tpm, err = tpm2.OpenTPM("/dev/tpm0") - } - return tpm, err - } - return tpm2.OpenTPM(tpmPath) -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/open_windows.go b/vendor/github.com/google/go-tpm-tools/cmd/open_windows.go deleted file mode 100644 index 8bfc9131a..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/open_windows.go +++ /dev/null @@ -1,12 +0,0 @@ -package cmd - -import ( - "io" - - "github.com/google/go-tpm/legacy/tpm2" -) - -// There is no need for flags on Windows, as there is no concept of a TPM path. -func openImpl() (io.ReadWriteCloser, error) { - return tpm2.OpenTPM() -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/pubkey.go b/vendor/github.com/google/go-tpm-tools/cmd/pubkey.go deleted file mode 100644 index bf44862d1..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/pubkey.go +++ /dev/null @@ -1,100 +0,0 @@ -package cmd - -import ( - "crypto" - "crypto/x509" - "encoding/pem" - "fmt" - "io" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm/tpmutil" - - "github.com/google/go-tpm/legacy/tpm2" - "github.com/spf13/cobra" -) - -var hierarchyNames = map[string]tpmutil.Handle{ - "endorsement": tpm2.HandleEndorsement, - "owner": tpm2.HandleOwner, - "platform": tpm2.HandlePlatform, - "null": tpm2.HandleNull, -} - -var pubkeyCmd = &cobra.Command{ - Use: "pubkey ", - Short: "Retrieve a public key from the TPM", - Long: `Get the PEM-formatted public component of a TPM's primary key - -A TPM can create a primary asymmetric key in one of 4 hierarchies: - endorsement - used for remote attestation, privacy sensitive - owner - used for local signing/encryption, reset on TPM2_Clear - platform - rarely used - null - all keys are ephemeral, reset on every boot - -Furthermore, this key is based on a template containing parameters like -algorithms and key sizes. By default, this command uses a standard template -defined in the TPM2 spec. If --index is provided, the template is read from -NVDATA instead (and --algo is ignored).`, - ValidArgs: func() []string { - // The keys from the hierarchyNames map are our valid arguments - keys := make([]string, len(hierarchyNames)) - for k := range hierarchyNames { - keys = append(keys, k) - } - return keys - }(), - Args: cobra.ExactValidArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - rwc, err := openTpm() - if err != nil { - return err - } - defer rwc.Close() - - key, err := getKey(rwc, hierarchyNames[args[0]], keyAlgo) - if err != nil { - return err - } - defer key.Close() - - return writeKey(key.PublicKey()) - }, -} - -func init() { - RootCmd.AddCommand(pubkeyCmd) - addIndexFlag(pubkeyCmd) - addOutputFlag(pubkeyCmd) - addPublicKeyAlgoFlag(pubkeyCmd) -} - -func getKey(rw io.ReadWriter, hierarchy tpmutil.Handle, _ tpm2.Algorithm) (*client.Key, error) { - fmt.Fprintf(debugOutput(), "Using hierarchy 0x%x\n", hierarchy) - if nvIndex != 0 { - fmt.Fprintf(debugOutput(), "Reading from NVDATA index %d\n", nvIndex) - return client.KeyFromNvIndex(rw, hierarchy, nvIndex) - } - - switch hierarchy { - case tpm2.HandleEndorsement: - return getEK(rw) - case tpm2.HandleOwner: - return getSRK(rw) - default: - return nil, fmt.Errorf("there is no default key for the given hierarchy: 0x%x", hierarchy) - } -} - -func writeKey(pubKey crypto.PublicKey) error { - fmt.Fprintf(debugOutput(), "Got key: %+v\n", pubKey) - asn1Bytes, err := x509.MarshalPKIXPublicKey(pubKey) - if err != nil { - return err - } - - return pem.Encode(dataOutput(), &pem.Block{ - Type: "PUBLIC KEY", - Bytes: asn1Bytes, - }) -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/read.go b/vendor/github.com/google/go-tpm-tools/cmd/read.go deleted file mode 100644 index 13377d96e..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/read.go +++ /dev/null @@ -1,108 +0,0 @@ -package cmd - -import ( - "errors" - "fmt" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" - "github.com/spf13/cobra" -) - -var readCmd = &cobra.Command{ - Use: "read ", - Short: "Read from the TPM", - Long: `Read from the TPM`, - Args: cobra.NoArgs, -} - -var pcrHashAlgo = tpm2.AlgUnknown - -var pcrCmd = &cobra.Command{ - Use: "pcr", - Short: "Read PCRs from the TPM", - Long: `Read PCRs from the TPM - -Based on --hash-algo and --pcrs flags, read the contents of the TPM's PCRs. - -If --hash-algo is not provided, all banks of PCRs will be read. -If --pcrs is not provided, all PCRs are read for that hash algorithm.`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - rwc, err := openTpm() - if err != nil { - return err - } - defer rwc.Close() - - if pcrHashAlgo != tpm2.AlgUnknown { - sel := tpm2.PCRSelection{Hash: pcrHashAlgo, PCRs: pcrs} - if len(sel.PCRs) == 0 { - sel = client.FullPcrSel(sel.Hash) - } - - fmt.Fprintf(debugOutput(), "Reading %v PCRs (%v)\n", sel.Hash, sel.PCRs) - pcrs, err := client.ReadPCRs(rwc, sel) - if err != nil { - return err - } - return internal.FormatPCRs(dataOutput(), pcrs) - } - if len(pcrs) != 0 { - return errors.New("--hash-algo must be used with --pcrs") - } - - fmt.Fprintln(debugOutput(), "Reading all PCRs") - banks, err := client.ReadAllPCRs(rwc) - if err != nil { - return err - } - - for _, bank := range banks { - if err = internal.FormatPCRs(dataOutput(), bank); err != nil { - return err - } - } - return nil - }, -} - -var nvReadCmd = &cobra.Command{ - Use: "nvdata", - Short: "Read TPM NVData", - Long: `Read NVData at a particular NVIndex - -Based on the --index flag, this reads all of the NVData present at that NVIndex. -The read is authenticated with the owner hierarchy and an empty password.`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - rwc, err := openTpm() - if err != nil { - return err - } - defer rwc.Close() - - data, err := tpm2.NVReadEx(rwc, tpmutil.Handle(nvIndex), tpm2.HandleOwner, "", 0) - if err != nil { - return err - } - if _, err := dataOutput().Write(data); err != nil { - return fmt.Errorf("cannot output NVData: %w", err) - } - return nil - }, -} - -func init() { - RootCmd.AddCommand(readCmd) - readCmd.AddCommand(pcrCmd) - readCmd.AddCommand(nvReadCmd) - addOutputFlag(pcrCmd) - addPCRsFlag(pcrCmd) - addHashAlgoFlag(pcrCmd, &pcrHashAlgo) - addIndexFlag(nvReadCmd) - nvReadCmd.MarkPersistentFlagRequired("index") - addOutputFlag(nvReadCmd) -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/root.go b/vendor/github.com/google/go-tpm-tools/cmd/root.go deleted file mode 100644 index 3f18382aa..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/root.go +++ /dev/null @@ -1,61 +0,0 @@ -// Package cmd contains a CLI to interact with TPM. -package cmd - -import ( - "fmt" - "io" - "os" - - "github.com/spf13/cobra" - "google.golang.org/protobuf/encoding/prototext" -) - -// RootCmd is the entrypoint for gotpm. -var RootCmd = &cobra.Command{ - Use: "gotpm", - Long: `Command line tool for the go-tpm TSS - -This tool allows performing TPM2 operations from the command line. -See the per-command documentation for more information.`, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - if quiet && verbose { - return fmt.Errorf("cannot specify both --quiet and --verbose") - } - cmd.SilenceUsage = true - return nil - }, -} - -var ( - quiet bool - verbose bool -) - -func init() { - RootCmd.PersistentFlags().BoolVar(&quiet, "quiet", false, - "print nothing if command is successful") - RootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, - "print additional info to stdout") - hideHelp(RootCmd) -} - -func messageOutput() io.Writer { - if quiet { - return io.Discard - } - return os.Stdout -} - -func debugOutput() io.Writer { - if verbose { - return os.Stdout - } - return io.Discard -} - -// Default Text Marshalling options -var marshalOptions = prototext.MarshalOptions{ - Multiline: true, - EmitASCII: true, -} -var unmarshalOptions = prototext.UnmarshalOptions{} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/seal.go b/vendor/github.com/google/go-tpm-tools/cmd/seal.go deleted file mode 100644 index 661cfe827..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/seal.go +++ /dev/null @@ -1,146 +0,0 @@ -package cmd - -import ( - "fmt" - "io" - - "github.com/spf13/cobra" - - "github.com/google/go-tpm-tools/client" - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" -) - -var sealHashAlgo = tpm2.AlgSHA256 - -var sealCmd = &cobra.Command{ - Use: "seal", - Short: "Seal some data to the TPM", - Long: `Encrypt the input data using the TPM - -TPMs support a "sealing" operation that allows some secret data to be encrypted -by a particular TPM. This data can only be decrypted by the same TPM that did -the encryption. - -Optionally (using the --pcrs flag), this decryption can be furthur restricted to -only work if certain Platform Control Registers (PCRs) are in the correct state. -This allows a key (i.e. a disk encryption key) to be bound to specific machine -state (like Secure Boot).`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - rwc, err := openTpm() - if err != nil { - return err - } - defer rwc.Close() - - fmt.Fprintln(debugOutput(), "Loading SRK") - srk, err := getSRK(rwc) - if err != nil { - return err - } - defer srk.Close() - - fmt.Fprintln(debugOutput(), "Reading sealed data") - secret, err := io.ReadAll(dataInput()) - if err != nil { - return err - } - - fmt.Fprintf(debugOutput(), "Sealing to PCRs: %v\n", pcrs) - opts := client.SealOpts{Current: tpm2.PCRSelection{ - Hash: sealHashAlgo, - PCRs: pcrs}} - sealed, err := srk.Seal(secret, opts) - if err != nil { - return fmt.Errorf("sealing data: %w", err) - } - - fmt.Fprintln(debugOutput(), "Writing sealed data") - var output []byte - if output, err = marshalOptions.Marshal(sealed); err != nil { - return err - } - if _, err = dataOutput().Write(output); err != nil { - return err - } - fmt.Fprintf(debugOutput(), "Sealed data to PCRs: %v\n", pcrs) - return nil - }, -} - -var unsealCmd = &cobra.Command{ - Use: "unseal", - Short: "Unseal some data previously sealed to the TPM", - Long: `Decrypt the input data using the TPM - -The opposite of "gotpm seal". This takes in some sealed input and decrypts it -using the TPM. This operation will fail if used on a different TPM, or if the -Platform Control Registers (PCRs) are in the incorrect state. - -All the necessary data to decrypt the sealed input is present in the input blob. -We do not need to specify the PCRs used for unsealing. - -We do support an optional "certification" process. A list of PCRs may be -provided with --pcrs, and the unwrapping will fail if the PCR values when -sealing differ from the current PCR values. This allows for verification of the -machine state when sealing took place. -`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - rwc, err := openTpm() - if err != nil { - return err - } - defer rwc.Close() - - fmt.Fprintln(debugOutput(), "Reading sealed data") - data, err := io.ReadAll(dataInput()) - if err != nil { - return err - } - var sealed pb.SealedBytes - if err := unmarshalOptions.Unmarshal(data, &sealed); err != nil { - return err - } - - fmt.Fprintln(debugOutput(), "Loading SRK") - keyAlgo = tpm2.Algorithm(sealed.GetSrk()) - srk, err := getSRK(rwc) - if err != nil { - return err - } - defer srk.Close() - - fmt.Fprintln(debugOutput(), "Unsealing data") - - opts := client.UnsealOpts{CertifyCurrent: tpm2.PCRSelection{ - Hash: client.CertifyHashAlgTpm, - PCRs: pcrs}} - secret, err := srk.Unseal(&sealed, opts) - if err != nil { - return fmt.Errorf("unsealing data: %w", err) - } - - fmt.Fprintln(debugOutput(), "Writing secret data") - if _, err := dataOutput().Write(secret); err != nil { - return fmt.Errorf("writing secret data: %w", err) - } - fmt.Fprintln(debugOutput(), "Unsealed data using TPM") - return nil - }, -} - -func init() { - RootCmd.AddCommand(sealCmd) - RootCmd.AddCommand(unsealCmd) - addInputFlag(sealCmd) - addInputFlag(unsealCmd) - addOutputFlag(sealCmd) - addOutputFlag(unsealCmd) - // PCRs and hash algorithm only used for sealing - addPCRsFlag(sealCmd) - addHashAlgoFlag(sealCmd, &sealHashAlgo) - addPCRsFlag(unsealCmd) - addPublicKeyAlgoFlag(sealCmd) -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/seal_test.go b/vendor/github.com/google/go-tpm-tools/cmd/seal_test.go deleted file mode 100644 index 7ebf499ae..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/seal_test.go +++ /dev/null @@ -1,147 +0,0 @@ -package cmd - -import ( - "bytes" - "crypto/sha256" - "os" - "strconv" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -func makeTempFile(tb testing.TB, content []byte) string { - tb.Helper() - file, err := os.CreateTemp("", "gotpm_test_*.txt") - if err != nil { - tb.Fatal(err) - } - defer file.Close() - if content != nil { - if _, err := file.Write(content); err != nil { - tb.Fatal(err) - } - } - return file.Name() -} - -func TestSealPlain(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - operations := []struct { - name string - algo string - sealPCRs string - certifyPCRs string - }{ - {"RSASeal", "rsa", "", ""}, - {"ECCSeal", "ecc", "", ""}, - {"RSASealWithPCR", "rsa", "7", ""}, - {"ECCSealWithPCR", "ecc", "7", ""}, - {"RSACertifyWithPCR", "rsa", "", "7"}, - {"ECCCertifyWithPCR", "ecc", "", "7"}, - {"RSASealAndCertifyWithPCR", "rsa", "7,8", "1"}, - {"ECCSealAndCertifyWithPCR", "ecc", "7", "7,23"}, - } - for _, op := range operations { - t.Run(op.name, func(t *testing.T) { - secretIn := []byte("Hello") - secretFile1 := makeTempFile(t, secretIn) - defer os.Remove(secretFile1) - sealedFile := makeTempFile(t, nil) - defer os.Remove(sealedFile) - secretFile2 := makeTempFile(t, nil) - defer os.Remove(secretFile2) - - sealArgs := []string{"seal", "--quiet", "--input", secretFile1, "--output", sealedFile} - if op.sealPCRs != "" { - sealArgs = append(sealArgs, "--pcrs", op.sealPCRs) - } - if op.algo != "" { - sealArgs = append(sealArgs, "--algo", op.algo) - } - RootCmd.SetArgs(sealArgs) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - pcrs = []int{} // "flush" pcrs value in last Execute() cmd - - unsealArgs := []string{"unseal", "--quiet", "--input", sealedFile, "--output", secretFile2} - if op.certifyPCRs != "" { - unsealArgs = append(unsealArgs, "--pcrs", op.certifyPCRs) - } - RootCmd.SetArgs(unsealArgs) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - secretOut, err := os.ReadFile(secretFile2) - if err != nil { - t.Fatal(err) - } - if !bytes.Equal(secretIn, secretOut) { - t.Errorf("Expected %s, got %s", secretIn, secretOut) - } - }) - } -} - -func TestUnsealFail(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - extension := bytes.Repeat([]byte{0xAA}, sha256.Size) - - sealPCR := test.DebugPCR - certPCR := test.ApplicationPCR - operations := []struct { - name string - sealPCRs string - certifyPCRs string - pcrToExtend []int - }{ - // TODO(joerichey): Add test that TPM2_Reset make unsealing fail - {"ExtendPCRAndUnseal", strconv.Itoa(sealPCR), "", []int{sealPCR}}, - {"ExtendPCRAndCertify", strconv.Itoa(sealPCR), strconv.Itoa(certPCR), []int{certPCR}}, - {"ExtendPCRAndCertify2", "", strconv.Itoa(certPCR), []int{certPCR}}, - } - for _, op := range operations { - t.Run(op.name, func(t *testing.T) { - secretIn := []byte("Hello") - secretFile := makeTempFile(t, secretIn) - defer os.Remove(secretFile) - sealedFile := makeTempFile(t, nil) - defer os.Remove(sealedFile) - - sealArgs := []string{"seal", "--quiet", "--input", secretFile, "--output", sealedFile} - if op.sealPCRs != "" { - sealArgs = append(sealArgs, "--pcrs", op.sealPCRs) - } - RootCmd.SetArgs(sealArgs) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - pcrs = []int{} // "flush" pcrs value in last Execute() cmd - - for _, pcr := range op.pcrToExtend { - pcrHandle := tpmutil.Handle(pcr) - if err := tpm2.PCRExtend(rwc, pcrHandle, tpm2.AlgSHA256, extension, ""); err != nil { - t.Fatal(err) - } - } - - unsealArgs := []string{"unseal", "--quiet", "--input", sealedFile, "--output", secretFile} - if op.certifyPCRs != "" { - unsealArgs = append(unsealArgs, "--pcrs", op.certifyPCRs) - } - RootCmd.SetArgs(unsealArgs) - if RootCmd.Execute() == nil { - t.Error("Unsealing should have failed") - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/verify.go b/vendor/github.com/google/go-tpm-tools/cmd/verify.go deleted file mode 100644 index 6032209f5..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/verify.go +++ /dev/null @@ -1,96 +0,0 @@ -package cmd - -import ( - "crypto" - "fmt" - "io" - - sv "github.com/google/go-sev-guest/verify" - tv "github.com/google/go-tdx-guest/verify" - pb "github.com/google/go-tpm-tools/proto/attest" - "github.com/google/go-tpm-tools/server" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/spf13/cobra" - "google.golang.org/protobuf/proto" -) - -var verifyCmd = &cobra.Command{ - Use: "verify", - Short: "Verify a remote attestation report.", - Args: cobra.NoArgs, -} -var debugCmd = &cobra.Command{ - Use: "debug", - Short: "Debug the contents of an attestation report without verifying its root-of-trust (e.g., attestation key certificate). For debugging purposes only", - RunE: func(cmd *cobra.Command, args []string) error { - attestationBytes, err := io.ReadAll(dataInput()) - if err != nil { - return err - } - attestation := &pb.Attestation{} - - if format == "binarypb" { - err = proto.Unmarshal(attestationBytes, attestation) - } else if format == "textproto" { - err = unmarshalOptions.Unmarshal(attestationBytes, attestation) - } else { - return fmt.Errorf("format should be either binarypb or textproto") - } - if err != nil { - return fmt.Errorf("fail to unmarshal attestation report: %v", err) - } - - pub, err := tpm2.DecodePublic(attestation.GetAkPub()) - if err != nil { - return err - } - cryptoPub, err := pub.Key() - if err != nil { - return err - } - - var validateOpts interface{} - switch attestation.GetTeeAttestation().(type) { - case *pb.Attestation_TdxAttestation: - validateOpts = &server.VerifyTdxOpts{ - Verification: tv.DefaultOptions(), - } - case *pb.Attestation_SevSnpAttestation: - if len(teeNonce) != 0 { - validateOpts = &server.VerifySnpOpts{ - Validation: server.SevSnpDefaultValidateOpts(teeNonce), - Verification: &sv.Options{}, - } - } else { - validateOpts = &server.VerifySnpOpts{ - Validation: server.SevSnpDefaultValidateOpts(nonce), - Verification: &sv.Options{}, - } - } - default: - validateOpts = nil - } - ms, err := server.VerifyAttestation(attestation, server.VerifyOpts{Nonce: nonce, TrustedAKs: []crypto.PublicKey{cryptoPub}, TEEOpts: validateOpts}) - if err != nil { - return fmt.Errorf("verifying attestation: %w", err) - } - out, err := marshalOptions.Marshal(ms) - if err != nil { - return nil - } - if _, err := dataOutput().Write(out); err != nil { - return fmt.Errorf("failed to write verified attestation report: %v", err) - } - return nil - }, -} - -func init() { - RootCmd.AddCommand(verifyCmd) - verifyCmd.AddCommand(debugCmd) - addNonceFlag(debugCmd) - addOutputFlag(debugCmd) - addInputFlag(debugCmd) - addFormatFlag(debugCmd) - addTeeNonceflag(debugCmd) -} diff --git a/vendor/github.com/google/go-tpm-tools/cmd/verify_test.go b/vendor/github.com/google/go-tpm-tools/cmd/verify_test.go deleted file mode 100644 index 5f6c0bddd..000000000 --- a/vendor/github.com/google/go-tpm-tools/cmd/verify_test.go +++ /dev/null @@ -1,145 +0,0 @@ -package cmd - -import ( - "os" - "strings" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -func TestVerifyNoncePass(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - file1 := makeOutputFile(t, "attest") - file2 := makeOutputFile(t, "verify") - defer os.RemoveAll(file1) - defer os.RemoveAll(file2) - - RootCmd.SetArgs([]string{"attest", "--nonce", "1234", "--key", "AK", "--tee-nonce", "", "--output", file1, "--tee-technology", ""}) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - - RootCmd.SetArgs([]string{"verify", "debug", "--nonce", "1234", "--input", file1, "--output", file2}) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } -} - -func TestVerifyNonceFail(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - file1 := makeOutputFile(t, "attest") - file2 := makeOutputFile(t, "verify") - defer os.RemoveAll(file1) - defer os.RemoveAll(file2) - - RootCmd.SetArgs([]string{"attest", "--nonce", "1234", "--output", file1}) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - - RootCmd.SetArgs([]string{"verify", "debug", "--nonce", "4321", "--input", file1, "--output", file2}) - if err := RootCmd.Execute(); err == nil { - t.Error("expected non-nil error") - } -} - -func TestVerifyWithGCEAK(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - file1 := makeOutputFile(t, "attest") - file2 := makeOutputFile(t, "verify") - defer os.RemoveAll(file1) - defer os.RemoveAll(file2) - - var template = map[string]tpm2.Public{ - "rsa": GCEAKTemplateRSA(), - "ecc": GCEAKTemplateECC(), - } - tests := []struct { - name string - nonce string - keyAlgo string - }{ - {"gceAK:RSA", "1234", "rsa"}, - {"gceAK:ECC", "1234", "ecc"}, - } - for _, op := range tests { - t.Run(op.name, func(t *testing.T) { - data, err := template[op.keyAlgo].Encode() - if err != nil { - t.Fatalf("failed to encode GCEAKTemplateRSA: %v", err) - } - err = setGCEAKTemplate(t, rwc, op.keyAlgo, data) - if err != nil { - t.Error(err) - } - defer tpm2.NVUndefineSpace(rwc, "", tpm2.HandlePlatform, tpmutil.Handle(getIndex[op.keyAlgo])) - - var dummyInstance = Instance{ProjectID: "test-project", ProjectNumber: "1922337278274", Zone: "us-central-1a", InstanceID: "12345678", InstanceName: "default"} - mock, err := NewMetadataServer(dummyInstance) - if err != nil { - t.Error(err) - } - defer mock.Stop() - - RootCmd.SetArgs([]string{"attest", "--nonce", op.nonce, "--key", "gceAK", "--algo", op.keyAlgo, "--output", file1, "--format", "binarypb", "--tee-technology", ""}) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - - RootCmd.SetArgs([]string{"verify", "debug", "--nonce", op.nonce, "--input", file1, "--output", file2}) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - }) - } -} - -func TestHwAttestationPass(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - ExternalTPM = rwc - - inputFile := makeOutputFile(t, "attest") - outputFile := makeOutputFile(t, "attestout") - defer os.RemoveAll(inputFile) - defer os.RemoveAll(outputFile) - teenonce := "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678" - tests := []struct { - name string - nonce string - teetech string - wanterr string - }{ - {"TdxPass", "1234", "tdx", "failed to open tdx device"}, - {"SevSnpPass", "1234", "sev-snp", "failed to open sev-snp device"}, - } - for _, op := range tests { - t.Run(op.name, func(t *testing.T) { - attestArgs := []string{"attest", "--nonce", op.nonce, "--key", "AK", "--output", inputFile, "--format", "textproto", "--tee-nonce", teenonce, "--tee-technology", op.teetech} - RootCmd.SetArgs(attestArgs) - if err := RootCmd.Execute(); err != nil { - if !strings.Contains(err.Error(), op.wanterr) { - t.Error(err) - } - } else { - RootCmd.SetArgs([]string{"verify", "debug", "--nonce", op.nonce, "--input", inputFile, "--output", outputFile, "--format", "textproto", "--tee-nonce", teenonce}) - if err := RootCmd.Execute(); err != nil { - t.Error(err) - } - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/files/PKGBUILD b/vendor/github.com/google/go-tpm-tools/files/PKGBUILD deleted file mode 100644 index 56ac2fd58..000000000 --- a/vendor/github.com/google/go-tpm-tools/files/PKGBUILD +++ /dev/null @@ -1,35 +0,0 @@ -# Maintainer: Joe Richey -pkgname=gotpm -pkgver=0.1.2 -pkgrel=1 -pkgdesc='TPM2 command-line utility' -arch=('x86_64') -_reponame=go-tpm-tools -url="https://github.com/google/${_reponame}" -license=('APACHE') -depends=('glibc') # go-pie requires CGO, so we have to link against libc -makedepends=('go-pie') -source=("git+${url}.git#tag=v${pkgver}?signed") -validpgpkeys=('19CE40CEB581BCD81E1FB2371DD6D05AA306C53F') -sha256sums=('SKIP') - -build() { - cd ${_reponame} - go build \ - -trimpath \ - -ldflags "-extldflags $LDFLAGS" \ - ./cmd/${pkgname} -} - -package() { - cd ${_reponame} - - install -Dm755 $pkgname "${pkgdir}/usr/bin/${pkgname}" - install -Dm755 files/boot-unseal.sh "${pkgdir}/etc/${pkgname}/boot-unseal.sh" - - initcpio_name='encrypt-gotpm' - install -Dm644 files/initcpio.hooks "${pkgdir}/usr/lib/initcpio/hooks/${initcpio_name}" - install -Dm644 files/initcpio.install "${pkgdir}/usr/lib/initcpio/install/${initcpio_name}" - - install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" -} diff --git a/vendor/github.com/google/go-tpm-tools/files/boot-unseal.sh b/vendor/github.com/google/go-tpm-tools/files/boot-unseal.sh deleted file mode 100755 index c40c2d0e1..000000000 --- a/vendor/github.com/google/go-tpm-tools/files/boot-unseal.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/ash - -key_found=0 -# Loop through all devices to find the ESP -for device in $(blkid -o device); do - part_type=$(blkid -p $device -s PART_ENTRY_TYPE -o value) - if [ "$part_type" != "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" ]; then - continue - fi - - # Temporarily mount the ESP to read disk unlock keys - mkdir -p /mnt/esp - mount -t vfat -o ro $device /mnt/esp - - # Attempt to unseal each sealed keyfile on the ESP. Note that just becasue - # the key is unsealed by the TPM, does not mean it will unlock the disk. We - # write the unsealed key to the in-memory rootfs, it is not written to disk. - for f in /mnt/esp/*/disk_unlock_keys/*.sealed; do - if [ -f "$f" ]; then - if gotpm unseal --input "$f" --output "/crypto_keyfile.bin" ; then - echo "Unsealed ${f#/mnt/esp}" - key_found=1 - break - else - echo "Failed to unseal ${f#/mnt/esp}" - fi - fi - done - umount $device - - if [ $key_found -ne 0 ]; then - exit 0 - fi -done - -echo "Unable to unseal any TPM disk unlock key" -exit 1 - -# vim: set ft=sh ts=4 sw=4 et: diff --git a/vendor/github.com/google/go-tpm-tools/files/initcpio.hooks b/vendor/github.com/google/go-tpm-tools/files/initcpio.hooks deleted file mode 100644 index 274837958..000000000 --- a/vendor/github.com/google/go-tpm-tools/files/initcpio.hooks +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/ash - -run_hook() { - /etc/gotpm/boot-unseal.sh -} - -# vim: set ft=sh ts=4 sw=4 et: diff --git a/vendor/github.com/google/go-tpm-tools/files/initcpio.install b/vendor/github.com/google/go-tpm-tools/files/initcpio.install deleted file mode 100644 index 0dc6da863..000000000 --- a/vendor/github.com/google/go-tpm-tools/files/initcpio.install +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -build() { - # Allows us to mount the ESP - add_module vfat - # Allows us to use the TPM (through either hardware interface). - add_module tpm_crb - add_module tpm_tis - - add_binary gotpm - add_file /etc/gotpm/boot-unseal.sh - - add_runscript -} - -help() { - cat < ./ diff --git a/vendor/github.com/google/go-tpm-tools/go.work.sum b/vendor/github.com/google/go-tpm-tools/go.work.sum deleted file mode 100644 index 397ef657f..000000000 --- a/vendor/github.com/google/go-tpm-tools/go.work.sum +++ /dev/null @@ -1,251 +0,0 @@ -cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= -cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= -cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= -cloud.google.com/go/accesscontextmanager v1.7.0/go.mod h1:CEGLewx8dwa33aDAZQujl7Dx+uYhS0eay198wB/VumQ= -cloud.google.com/go/aiplatform v1.37.0/go.mod h1:IU2Cv29Lv9oCn/9LkFiiuKfwrRTq+QQMbW+hPCxJGZw= -cloud.google.com/go/analytics v0.19.0/go.mod h1:k8liqf5/HCnOUkbawNtrWWc+UAzyDlW89doe8TtoDsE= -cloud.google.com/go/apigateway v1.5.0/go.mod h1:GpnZR3Q4rR7LVu5951qfXPJCHquZt02jf7xQx7kpqN8= -cloud.google.com/go/apigeeconnect v1.5.0/go.mod h1:KFaCqvBRU6idyhSNyn3vlHXc8VMDJdRmwDF6JyFRqZ8= -cloud.google.com/go/apigeeregistry v0.6.0/go.mod h1:BFNzW7yQVLZ3yj0TKcwzb8n25CFBri51GVGOEUcgQsc= -cloud.google.com/go/apikeys v0.6.0/go.mod h1:kbpXu5upyiAlGkKrJgQl8A0rKNNJ7dQ377pdroRSSi8= -cloud.google.com/go/appengine v1.7.1/go.mod h1:IHLToyb/3fKutRysUlFO0BPt5j7RiQ45nrzEJmKTo6E= -cloud.google.com/go/area120 v0.7.1/go.mod h1:j84i4E1RboTWjKtZVWXPqvK5VHQFJRF2c1Nm69pWm9k= -cloud.google.com/go/artifactregistry v1.13.0/go.mod h1:uy/LNfoOIivepGhooAUpL1i30Hgee3Cu0l4VTWHUC08= -cloud.google.com/go/asset v1.13.0/go.mod h1:WQAMyYek/b7NBpYq/K4KJWcRqzoalEsxz/t/dTk4THw= -cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E= -cloud.google.com/go/automl v1.12.0/go.mod h1:tWDcHDp86aMIuHmyvjuKeeHEGq76lD7ZqfGLN6B0NuU= -cloud.google.com/go/baremetalsolution v0.5.0/go.mod h1:dXGxEkmR9BMwxhzBhV0AioD0ULBmuLZI8CdwalUxuss= -cloud.google.com/go/batch v0.7.0/go.mod h1:vLZN95s6teRUqRQ4s3RLDsH8PvboqBK+rn1oevL159g= -cloud.google.com/go/beyondcorp v0.5.0/go.mod h1:uFqj9X+dSfrheVp7ssLTaRHd2EHqSL4QZmH4e8WXGGU= -cloud.google.com/go/bigquery v1.50.0/go.mod h1:YrleYEh2pSEbgTBZYMJ5SuSr0ML3ypjRB1zgf7pvQLU= -cloud.google.com/go/billing v1.13.0/go.mod h1:7kB2W9Xf98hP9Sr12KfECgfGclsH3CQR0R08tnRlRbc= -cloud.google.com/go/binaryauthorization v1.5.0/go.mod h1:OSe4OU1nN/VswXKRBmciKpo9LulY41gch5c68htf3/Q= -cloud.google.com/go/certificatemanager v1.6.0/go.mod h1:3Hh64rCKjRAX8dXgRAyOcY5vQ/fE1sh8o+Mdd6KPgY8= -cloud.google.com/go/channel v1.12.0/go.mod h1:VkxCGKASi4Cq7TbXxlaBezonAYpp1GCnKMY6tnMQnLU= -cloud.google.com/go/cloudbuild v1.9.0/go.mod h1:qK1d7s4QlO0VwfYn5YuClDGg2hfmLZEb4wQGAbIgL1s= -cloud.google.com/go/clouddms v1.5.0/go.mod h1:QSxQnhikCLUw13iAbffF2CZxAER3xDGNHjsTAkQJcQA= -cloud.google.com/go/cloudtasks v1.10.0/go.mod h1:NDSoTLkZ3+vExFEWu2UJV1arUyzVDAiZtdWcsUyNwBs= -cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= -cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= -cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= -cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= -cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -cloud.google.com/go/contactcenterinsights v1.6.0/go.mod h1:IIDlT6CLcDoyv79kDv8iWxMSTZhLxSCofVV5W6YFM/w= -cloud.google.com/go/container v1.15.0/go.mod h1:ft+9S0WGjAyjDggg5S06DXj+fHJICWg8L7isCQe9pQA= -cloud.google.com/go/containeranalysis v0.9.0/go.mod h1:orbOANbwk5Ejoom+s+DUCTTJ7IBdBQJDcSylAx/on9s= -cloud.google.com/go/datacatalog v1.13.0/go.mod h1:E4Rj9a5ZtAxcQJlEBTLgMTphfP11/lNaAshpoBgemX8= -cloud.google.com/go/dataflow v0.8.0/go.mod h1:Rcf5YgTKPtQyYz8bLYhFoIV/vP39eL7fWNcSOyFfLJE= -cloud.google.com/go/dataform v0.7.0/go.mod h1:7NulqnVozfHvWUBpMDfKMUESr+85aJsC/2O0o3jWPDE= -cloud.google.com/go/datafusion v1.6.0/go.mod h1:WBsMF8F1RhSXvVM8rCV3AeyWVxcC2xY6vith3iw3S+8= -cloud.google.com/go/datalabeling v0.7.0/go.mod h1:WPQb1y08RJbmpM3ww0CSUAGweL0SxByuW2E+FU+wXcM= -cloud.google.com/go/dataplex v1.6.0/go.mod h1:bMsomC/aEJOSpHXdFKFGQ1b0TDPIeL28nJObeO1ppRs= -cloud.google.com/go/dataproc v1.12.0/go.mod h1:zrF3aX0uV3ikkMz6z4uBbIKyhRITnxvr4i3IjKsKrw4= -cloud.google.com/go/dataqna v0.7.0/go.mod h1:Lx9OcIIeqCrw1a6KdO3/5KMP1wAmTc0slZWwP12Qq3c= -cloud.google.com/go/datastore v1.11.0/go.mod h1:TvGxBIHCS50u8jzG+AW/ppf87v1of8nwzFNgEZU1D3c= -cloud.google.com/go/datastream v1.7.0/go.mod h1:uxVRMm2elUSPuh65IbZpzJNMbuzkcvu5CjMqVIUHrww= -cloud.google.com/go/deploy v1.8.0/go.mod h1:z3myEJnA/2wnB4sgjqdMfgxCA0EqC3RBTNcVPs93mtQ= -cloud.google.com/go/dialogflow v1.32.0/go.mod h1:jG9TRJl8CKrDhMEcvfcfFkkpp8ZhgPz3sBGmAUYJ2qE= -cloud.google.com/go/dlp v1.9.0/go.mod h1:qdgmqgTyReTz5/YNSSuueR8pl7hO0o9bQ39ZhtgkWp4= -cloud.google.com/go/documentai v1.18.0/go.mod h1:F6CK6iUH8J81FehpskRmhLq/3VlwQvb7TvwOceQ2tbs= -cloud.google.com/go/domains v0.8.0/go.mod h1:M9i3MMDzGFXsydri9/vW+EWz9sWb4I6WyHqdlAk0idE= -cloud.google.com/go/edgecontainer v1.0.0/go.mod h1:cttArqZpBB2q58W/upSG++ooo6EsblxDIolxa3jSjbY= -cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= -cloud.google.com/go/essentialcontacts v1.5.0/go.mod h1:ay29Z4zODTuwliK7SnX8E86aUF2CTzdNtvv42niCX0M= -cloud.google.com/go/eventarc v1.11.0/go.mod h1:PyUjsUKPWoRBCHeOxZd/lbOOjahV41icXyUY5kSTvVY= -cloud.google.com/go/filestore v1.6.0/go.mod h1:di5unNuss/qfZTw2U9nhFqo8/ZDSc466dre85Kydllg= -cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= -cloud.google.com/go/functions v1.13.0/go.mod h1:EU4O007sQm6Ef/PwRsI8N2umygGqPBS/IZQKBQBcJ3c= -cloud.google.com/go/gaming v1.9.0/go.mod h1:Fc7kEmCObylSWLO334NcO+O9QMDyz+TKC4v1D7X+Bc0= -cloud.google.com/go/gkebackup v0.4.0/go.mod h1:byAyBGUwYGEEww7xsbnUTBHIYcOPy/PgUWUtOeRm9Vg= -cloud.google.com/go/gkeconnect v0.7.0/go.mod h1:SNfmVqPkaEi3bF/B3CNZOAYPYdg7sU+obZ+QTky2Myw= -cloud.google.com/go/gkehub v0.12.0/go.mod h1:djiIwwzTTBrF5NaXCGv3mf7klpEMcST17VBTVVDcuaw= -cloud.google.com/go/gkemulticloud v0.5.0/go.mod h1:W0JDkiyi3Tqh0TJr//y19wyb1yf8llHVto2Htf2Ja3Y= -cloud.google.com/go/gsuiteaddons v1.5.0/go.mod h1:TFCClYLd64Eaa12sFVmUyG62tk4mdIsI7pAnSXRkcFo= -cloud.google.com/go/iam v0.3.0 h1:exkAomrVUuzx9kWFI1wm3KI0uoDeUFPB4kKGzx6x+Gc= -cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/iap v1.7.1/go.mod h1:WapEwPc7ZxGt2jFGB/C/bm+hP0Y6NXzOYGjpPnmMS74= -cloud.google.com/go/ids v1.3.0/go.mod h1:JBdTYwANikFKaDP6LtW5JAi4gubs57SVNQjemdt6xV4= -cloud.google.com/go/iot v1.6.0/go.mod h1:IqdAsmE2cTYYNO1Fvjfzo9po179rAtJeVGUvkLN3rLE= -cloud.google.com/go/kms v1.10.1/go.mod h1:rIWk/TryCkR59GMC3YtHtXeLzd634lBbKenvyySAyYI= -cloud.google.com/go/language v1.9.0/go.mod h1:Ns15WooPM5Ad/5no/0n81yUetis74g3zrbeJBE+ptUY= -cloud.google.com/go/lifesciences v0.8.0/go.mod h1:lFxiEOMqII6XggGbOnKiyZ7IBwoIqA84ClvoezaA/bo= -cloud.google.com/go/logging v1.4.2 h1:Mu2Q75VBDQlW1HlBMjTX4X84UFR73G1TiLlRYc/b7tA= -cloud.google.com/go/logging v1.4.2/go.mod h1:jco9QZSx8HiVVqLJReq7z7bVdj0P1Jb9PDFs63T+axo= -cloud.google.com/go/logging v1.7.0 h1:CJYxlNNNNAMkHp9em/YEXcfJg+rPDg7YfwoRpMU+t5I= -cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= -cloud.google.com/go/managedidentities v1.5.0/go.mod h1:+dWcZ0JlUmpuxpIDfyP5pP5y0bLdRwOS4Lp7gMni/LA= -cloud.google.com/go/maps v0.7.0/go.mod h1:3GnvVl3cqeSvgMcpRlQidXsPYuDGQ8naBis7MVzpXsY= -cloud.google.com/go/mediatranslation v0.7.0/go.mod h1:LCnB/gZr90ONOIQLgSXagp8XUW1ODs2UmUMvcgMfI2I= -cloud.google.com/go/memcache v1.9.0/go.mod h1:8oEyzXCu+zo9RzlEaEjHl4KkgjlNDaXbCQeQWlzNFJM= -cloud.google.com/go/metastore v1.10.0/go.mod h1:fPEnH3g4JJAk+gMRnrAnoqyv2lpUCqJPWOodSaf45Eo= -cloud.google.com/go/monitoring v1.13.0/go.mod h1:k2yMBAB1H9JT/QETjNkgdCGD9bPF712XiLTVr+cBrpw= -cloud.google.com/go/networkconnectivity v1.11.0/go.mod h1:iWmDD4QF16VCDLXUqvyspJjIEtBR/4zq5hwnY2X3scM= -cloud.google.com/go/networkmanagement v1.6.0/go.mod h1:5pKPqyXjB/sgtvB5xqOemumoQNB7y95Q7S+4rjSOPYY= -cloud.google.com/go/networksecurity v0.8.0/go.mod h1:B78DkqsxFG5zRSVuwYFRZ9Xz8IcQ5iECsNrPn74hKHU= -cloud.google.com/go/notebooks v1.8.0/go.mod h1:Lq6dYKOYOWUCTvw5t2q1gp1lAp0zxAxRycayS0iJcqQ= -cloud.google.com/go/optimization v1.3.1/go.mod h1:IvUSefKiwd1a5p0RgHDbWCIbDFgKuEdB+fPPuP0IDLI= -cloud.google.com/go/orchestration v1.6.0/go.mod h1:M62Bevp7pkxStDfFfTuCOaXgaaqRAga1yKyoMtEoWPQ= -cloud.google.com/go/orgpolicy v1.10.0/go.mod h1:w1fo8b7rRqlXlIJbVhOMPrwVljyuW5mqssvBtU18ONc= -cloud.google.com/go/osconfig v1.11.0/go.mod h1:aDICxrur2ogRd9zY5ytBLV89KEgT2MKB2L/n6x1ooPw= -cloud.google.com/go/oslogin v1.9.0/go.mod h1:HNavntnH8nzrn8JCTT5fj18FuJLFJc4NaZJtBnQtKFs= -cloud.google.com/go/phishingprotection v0.7.0/go.mod h1:8qJI4QKHoda/sb/7/YmMQ2omRLSLYSu9bU0EKCNI+Lk= -cloud.google.com/go/policytroubleshooter v1.6.0/go.mod h1:zYqaPTsmfvpjm5ULxAyD/lINQxJ0DDsnWOP/GZ7xzBc= -cloud.google.com/go/privatecatalog v0.8.0/go.mod h1:nQ6pfaegeDAq/Q5lrfCQzQLhubPiZhSaNhIgfJlnIXs= -cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= -cloud.google.com/go/pubsublite v1.7.0/go.mod h1:8hVMwRXfDfvGm3fahVbtDbiLePT3gpoiJYJY+vxWxVM= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.0/go.mod h1:19wVj/fs5RtYtynAPJdDTb69oW0vNHYDBTbB4NvMD9c= -cloud.google.com/go/recommendationengine v0.7.0/go.mod h1:1reUcE3GIu6MeBz/h5xZJqNLuuVjNg1lmWMPyjatzac= -cloud.google.com/go/recommender v1.9.0/go.mod h1:PnSsnZY7q+VL1uax2JWkt/UegHssxjUVVCrX52CuEmQ= -cloud.google.com/go/redis v1.11.0/go.mod h1:/X6eicana+BWcUda5PpwZC48o37SiFVTFSs0fWAJ7uQ= -cloud.google.com/go/resourcemanager v1.7.0/go.mod h1:HlD3m6+bwhzj9XCouqmeiGuni95NTrExfhoSrkC/3EI= -cloud.google.com/go/resourcesettings v1.5.0/go.mod h1:+xJF7QSG6undsQDfsCJyqWXyBwUoJLhetkRMDRnIoXA= -cloud.google.com/go/retail v1.12.0/go.mod h1:UMkelN/0Z8XvKymXFbD4EhFJlYKRx1FGhQkVPU5kF14= -cloud.google.com/go/run v0.9.0/go.mod h1:Wwu+/vvg8Y+JUApMwEDfVfhetv30hCG4ZwDR/IXl2Qg= -cloud.google.com/go/scheduler v1.9.0/go.mod h1:yexg5t+KSmqu+njTIh3b7oYPheFtBWGcbVUYF1GGMIc= -cloud.google.com/go/secretmanager v1.10.0/go.mod h1:MfnrdvKMPNra9aZtQFvBcvRU54hbPD8/HayQdlUgJpU= -cloud.google.com/go/security v1.13.0/go.mod h1:Q1Nvxl1PAgmeW0y3HTt54JYIvUdtcpYKVfIB8AOMZ+0= -cloud.google.com/go/securitycenter v1.19.0/go.mod h1:LVLmSg8ZkkyaNy4u7HCIshAngSQ8EcIRREP3xBnyfag= -cloud.google.com/go/servicecontrol v1.11.1/go.mod h1:aSnNNlwEFBY+PWGQ2DoM0JJ/QUXqV5/ZD9DOLB7SnUk= -cloud.google.com/go/servicedirectory v1.9.0/go.mod h1:29je5JjiygNYlmsGz8k6o+OZ8vd4f//bQLtvzkPPT/s= -cloud.google.com/go/servicemanagement v1.8.0/go.mod h1:MSS2TDlIEQD/fzsSGfCdJItQveu9NXnUniTrq/L8LK4= -cloud.google.com/go/serviceusage v1.6.0/go.mod h1:R5wwQcbOWsyuOfbP9tGdAnCAc6B9DRwPG1xtWMDeuPA= -cloud.google.com/go/shell v1.6.0/go.mod h1:oHO8QACS90luWgxP3N9iZVuEiSF84zNyLytb+qE2f9A= -cloud.google.com/go/spanner v1.45.0/go.mod h1:FIws5LowYz8YAE1J8fOS7DJup8ff7xJeetWEo5REA2M= -cloud.google.com/go/speech v1.15.0/go.mod h1:y6oH7GhqCaZANH7+Oe0BhgIogsNInLlz542tg3VqeYI= -cloud.google.com/go/storage v1.22.1 h1:F6IlQJZrZM++apn9V5/VfS3gbTUYg98PS3EMQAzqtfg= -cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= -cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= -cloud.google.com/go/storagetransfer v1.8.0/go.mod h1:JpegsHHU1eXg7lMHkvf+KE5XDJ7EQu0GwNJbbVGanEw= -cloud.google.com/go/talent v1.5.0/go.mod h1:G+ODMj9bsasAEJkQSzO2uHQWXHHXUomArjWQQYkqK6c= -cloud.google.com/go/texttospeech v1.6.0/go.mod h1:YmwmFT8pj1aBblQOI3TfKmwibnsfvhIBzPXcW4EBovc= -cloud.google.com/go/tpu v1.5.0/go.mod h1:8zVo1rYDFuW2l4yZVY0R0fb/v44xLh3llq7RuV61fPM= -cloud.google.com/go/trace v1.9.0/go.mod h1:lOQqpE5IaWY0Ixg7/r2SjixMuc6lfTFeO4QGM4dQWOk= -cloud.google.com/go/translate v1.7.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/video v1.15.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/videointelligence v1.10.0/go.mod h1:LHZngX1liVtUhZvi2uNS0VQuOzNi2TkY1OakiuoUOjU= -cloud.google.com/go/vision/v2 v2.7.0/go.mod h1:H89VysHy21avemp6xcf9b9JvZHVehWbET0uT/bcuY/0= -cloud.google.com/go/vmmigration v1.6.0/go.mod h1:bopQ/g4z+8qXzichC7GW1w2MjbErL54rk3/C843CjfY= -cloud.google.com/go/vmwareengine v0.3.0/go.mod h1:wvoyMvNWdIzxMYSpH/R7y2h5h3WFkx6d+1TIsP39WGY= -cloud.google.com/go/vpcaccess v1.6.0/go.mod h1:wX2ILaNhe7TlVa4vC5xce1bCnqE3AeH27RV31lnmZes= -cloud.google.com/go/webrisk v1.8.0/go.mod h1:oJPDuamzHXgUc+b8SiHRcVInZQuybnvEW72PqTc7sSg= -cloud.google.com/go/websecurityscanner v1.5.0/go.mod h1:Y6xdCPy81yi0SQnDY1xdNTNpfY1oAgXUlcfN3B3eSng= -cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= -github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= -github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= -github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f/go.mod h1:sfYdkwUW4BA3PbKjySwjJy+O4Pu0h62rlqCMHNk+K+Q= -github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= -github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= -github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-sev-guest v0.8.0 h1:IIZIqdcMJXgTm1nMvId442OUpYebbWDWa9bi9/lUUwc= -github.com/google/go-tpm v0.3.4-0.20230613064043-511507721cb1/go.mod h1:Yj9bYgsIKoza8oMlxZqvqgUIDKFaExnuLaDdOtFCwG4= -github.com/google/go-tpm-tools v0.3.9/go.mod h1:22JvWmHcD5w55cs+nMeqDGDxgNS15/2pDq2cLqnc3rc= -github.com/google/go-tpm-tools v0.3.10/go.mod h1:HQfQboO+M8pRtBfO5U3KMhwzfC/XC3TaMCgRfTpII8Q= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/googleapis/enterprise-certificate-proxy v0.1.0 h1:zO8WHNx/MYiAKJ3d5spxZXZE6KHmIQGQcAzwUzV7qQw= -github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go v2.0.2+incompatible h1:silFMLAnr330+NRuag/VjIGF7TLp/LBrV2CJKFLWEww= -github.com/googleapis/gax-go/v2 v2.4.0 h1:dS9eYAjhrE2RjmzYw2XAPvcXfmcQLtFEQWn0CR82awk= -github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= -github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= -github.com/googleapis/go-type-adapters v1.0.0 h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/josephlr/google-api-go-client v0.86.1 h1:nSNMjyd+GV04cF99zd5r/Ql5sZvA0ehya/Qtj/GbE68= -github.com/josephlr/google-api-go-client v0.86.1/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= -go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 h1:+jnHzr9VPj32ykQVai5DNahi9+NSp7yYuCsl5eAQtL0= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= -golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= -golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= -google.golang.org/api v0.111.0/go.mod h1:qtFHvU9mhgTJegR31csQ+rwxyUTHOKFqCKWp1J0fdw0= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= -google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= -google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20220329172620-7be39ac1afc7/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f h1:hJ/Y5SqPXbarffmAsApliUlcvMU+wScNGfyop4bZm8o= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= -google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230525234025-438c736192d0/go.mod h1:9ExIQyXL5hZrHzQceCwuSYwZZ5QZBazOcprJ5rgs3lY= -google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/vendor/github.com/google/go-tpm-tools/internal/pcrs.go b/vendor/github.com/google/go-tpm-tools/internal/pcrs.go deleted file mode 100644 index e0f972b57..000000000 --- a/vendor/github.com/google/go-tpm-tools/internal/pcrs.go +++ /dev/null @@ -1,132 +0,0 @@ -// Package internal contains private helper functions needed in client and server -package internal - -import ( - "bytes" - "crypto" - "encoding/hex" - "fmt" - "io" - - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" -) - -const minPCRIndex = uint32(0) - -func maxPCRIndex(p *pb.PCRs) uint32 { - max := minPCRIndex - for idx := range p.GetPcrs() { - if idx > max { - max = idx - } - } - return max -} - -// FormatPCRs writes a multiline representation of the PCR values to w. -func FormatPCRs(w io.Writer, p *pb.PCRs) error { - if _, err := fmt.Fprintf(w, "%v:\n", p.Hash); err != nil { - return err - } - for idx := minPCRIndex; idx <= maxPCRIndex(p); idx++ { - if val, ok := p.GetPcrs()[idx]; ok { - if _, err := fmt.Fprintf(w, " %2d: 0x%X\n", idx, val); err != nil { - return err - } - } - } - return nil -} - -// CheckSubset verifies if the pcrs PCRs are a valid "subset" of the provided -// "superset" of PCRs. The PCR values must match (if present), and all PCRs must -// be present in the superset. This function will return an error containing the -// first missing or mismatched PCR number. -func CheckSubset(subset, superset *pb.PCRs) error { - if subset.GetHash() != superset.GetHash() { - return fmt.Errorf("PCR hash algo not matching: %v, %v", subset.GetHash(), superset.GetHash()) - } - for pcrNum, pcrVal := range subset.GetPcrs() { - if expectedVal, ok := superset.GetPcrs()[pcrNum]; ok { - if !bytes.Equal(expectedVal, pcrVal) { - return fmt.Errorf("PCR %d mismatch: expected %v, got %v", - pcrNum, hex.EncodeToString(expectedVal), hex.EncodeToString(pcrVal)) - } - } else { - return fmt.Errorf("PCR %d mismatch: value missing from the superset PCRs", pcrNum) - } - } - return nil -} - -// PCRSelection returns the corresponding tpm2.PCRSelection for the PCR data. -func PCRSelection(p *pb.PCRs) tpm2.PCRSelection { - sel := tpm2.PCRSelection{Hash: tpm2.Algorithm(p.GetHash())} - - for pcrNum := range p.GetPcrs() { - sel.PCRs = append(sel.PCRs, int(pcrNum)) - } - return sel -} - -// SamePCRSelection checks if the Pcrs has the same PCRSelection as the -// provided given tpm2.PCRSelection (including the hash algorithm). -func SamePCRSelection(p *pb.PCRs, sel tpm2.PCRSelection) bool { - if tpm2.Algorithm(p.GetHash()) != sel.Hash { - return false - } - if len(p.GetPcrs()) != len(sel.PCRs) { - return false - } - for _, pcr := range sel.PCRs { - if _, ok := p.Pcrs[uint32(pcr)]; !ok { - return false - } - } - return true -} - -// PCRSessionAuth calculates the authorization value for the given PCRs. -func PCRSessionAuth(p *pb.PCRs, hashAlg crypto.Hash) []byte { - // Start with all zeros, we only use a single policy command on our session. - oldDigest := make([]byte, hashAlg.Size()) - ccPolicyPCR, _ := tpmutil.Pack(tpm2.CmdPolicyPCR) - - // Extend the policy digest, see TPM2_PolicyPCR in Part 3 of the spec. - hash := hashAlg.New() - hash.Write(oldDigest) - hash.Write(ccPolicyPCR) - hash.Write(encodePCRSelection(PCRSelection(p))) - hash.Write(PCRDigest(p, hashAlg)) - newDigest := hash.Sum(nil) - return newDigest[:] -} - -// PCRDigest computes the digest of the Pcrs. Note that the digest hash -// algorithm may differ from the PCRs' hash (which denotes the PCR bank). -func PCRDigest(p *pb.PCRs, hashAlg crypto.Hash) []byte { - hash := hashAlg.New() - for i := uint32(0); i < 24; i++ { - if pcrValue, exists := p.GetPcrs()[i]; exists { - hash.Write(pcrValue) - } - } - return hash.Sum(nil) -} - -// Encode a tpm2.PCRSelection as if it were a TPML_PCR_SELECTION -func encodePCRSelection(sel tpm2.PCRSelection) []byte { - // Encode count, pcrSelections.hash and pcrSelections.sizeofSelect fields - buf, _ := tpmutil.Pack(uint32(1), sel.Hash, byte(3)) - // Encode pcrSelect bitmask - pcrBits := make([]byte, 3) - for _, pcr := range sel.PCRs { - byteNum := pcr / 8 - bytePos := 1 << uint(pcr%8) - pcrBits[byteNum] |= byte(bytePos) - } - - return append(buf, pcrBits...) -} diff --git a/vendor/github.com/google/go-tpm-tools/internal/pcrs_test.go b/vendor/github.com/google/go-tpm-tools/internal/pcrs_test.go deleted file mode 100644 index 5391af189..000000000 --- a/vendor/github.com/google/go-tpm-tools/internal/pcrs_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package internal - -import ( - "testing" - - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" -) - -func TestHasSamePCRSelection(t *testing.T) { - var subtests = []struct { - pcrs *pb.PCRs - pcrSel tpm2.PCRSelection - expectedRes bool - }{ - {&pb.PCRs{}, tpm2.PCRSelection{}, true}, - {&pb.PCRs{Hash: pb.HashAlgo(tpm2.AlgSHA256), Pcrs: map[uint32][]byte{1: {}}}, - tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{1}}, true}, - {&pb.PCRs{Hash: pb.HashAlgo(tpm2.AlgSHA256), Pcrs: map[uint32][]byte{}}, - tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{}}, true}, - {&pb.PCRs{Hash: pb.HashAlgo(tpm2.AlgSHA256), Pcrs: map[uint32][]byte{1: {}}}, - tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{4}}, false}, - {&pb.PCRs{Hash: pb.HashAlgo(tpm2.AlgSHA256), Pcrs: map[uint32][]byte{1: {}, 4: {}}}, - tpm2.PCRSelection{Hash: tpm2.AlgSHA256, PCRs: []int{4}}, false}, - {&pb.PCRs{Hash: pb.HashAlgo(tpm2.AlgSHA256), Pcrs: map[uint32][]byte{1: {}, 2: {}}}, - tpm2.PCRSelection{Hash: tpm2.AlgSHA1, PCRs: []int{1, 2}}, false}, - } - for _, subtest := range subtests { - if SamePCRSelection(subtest.pcrs, subtest.pcrSel) != subtest.expectedRes { - t.Errorf("HasSamePCRSelection result is not expected") - } - } -} diff --git a/vendor/github.com/google/go-tpm-tools/internal/public.go b/vendor/github.com/google/go-tpm-tools/internal/public.go deleted file mode 100644 index 7a3e501f0..000000000 --- a/vendor/github.com/google/go-tpm-tools/internal/public.go +++ /dev/null @@ -1,49 +0,0 @@ -package internal - -import ( - "crypto" - "fmt" - - "github.com/google/go-tpm/legacy/tpm2" -) - -// GetSigningHashAlg returns the hash algorithm used for a signing key. Returns -// an error if an algorithm isn't supported, or the key is not a signing key. -func GetSigningHashAlg(pubArea tpm2.Public) (tpm2.Algorithm, error) { - if pubArea.Attributes&tpm2.FlagSign == 0 { - return tpm2.AlgNull, fmt.Errorf("non-signing key used with signing operation") - } - - var sigScheme *tpm2.SigScheme - switch pubArea.Type { - case tpm2.AlgRSA: - sigScheme = pubArea.RSAParameters.Sign - case tpm2.AlgECC: - sigScheme = pubArea.ECCParameters.Sign - default: - return tpm2.AlgNull, fmt.Errorf("unsupported key type: %v", pubArea.Type) - } - - if sigScheme == nil { - return tpm2.AlgNull, fmt.Errorf("unsupported null signing scheme") - } - switch sigScheme.Alg { - case tpm2.AlgRSAPSS, tpm2.AlgRSASSA, tpm2.AlgECDSA: - return sigScheme.Hash, nil - default: - return tpm2.AlgNull, fmt.Errorf("unsupported signing algorithm: %v", sigScheme.Alg) - } -} - -// PubKeysEqual returns whether the two public keys are equal. -func PubKeysEqual(k1 crypto.PublicKey, k2 crypto.PublicKey) bool { - // Common interface for all the standard public key types, see: - // https://pkg.go.dev/crypto@go1.18beta1#PublicKey - type publicKey interface { - Equal(crypto.PublicKey) bool - } - if key, ok := k1.(publicKey); ok { - return key.Equal(k2) - } - return false -} diff --git a/vendor/github.com/google/go-tpm-tools/internal/quote.go b/vendor/github.com/google/go-tpm-tools/internal/quote.go deleted file mode 100644 index ba18361c6..000000000 --- a/vendor/github.com/google/go-tpm-tools/internal/quote.go +++ /dev/null @@ -1,135 +0,0 @@ -package internal - -import ( - "bytes" - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/subtle" - "fmt" - - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" -) - -// SignatureHashAlgs are the hash algorithms we support for Quote signatures, in -// their preferred order of use. -var SignatureHashAlgs = []tpm2.Algorithm{tpm2.AlgSHA512, tpm2.AlgSHA384, tpm2.AlgSHA256} - -// VerifyQuote performs the following checks to validate a Quote: -// - the provided signature is generated by the trusted AK public key -// - the signature signs the provided quote data -// - the quote data starts with TPM_GENERATED_VALUE -// - the quote data is a valid TPMS_QUOTE_INFO -// - the quote data was taken over the provided PCRs -// - the provided PCR values match the quote data internal digest -// - the provided extraData matches that in the quote data -// - the signature hash algorithm must be in HashAlgs -// -// Note that the caller must have already established trust in the provided -// public key before validating the Quote. -// -// VerifyQuote supports ECDSA and RSASSA signature verification. -func VerifyQuote(q *pb.Quote, trustedPub crypto.PublicKey, extraData []byte) error { - sig, err := tpm2.DecodeSignature(bytes.NewBuffer(q.GetRawSig())) - if err != nil { - return fmt.Errorf("signature decoding failed: %v", err) - } - - hash, err := verifyHashAlg(sig) - if err != nil { - return err - } - - switch pub := trustedPub.(type) { - case *ecdsa.PublicKey: - if err = verifyECDSAQuoteSignature(pub, hash, q.GetQuote(), sig); err != nil { - return err - } - case *rsa.PublicKey: - if err = verifyRSASSAQuoteSignature(pub, hash, q.GetQuote(), sig); err != nil { - return err - } - default: - return fmt.Errorf("only RSA and ECC public keys are currently supported, received type: %T", pub) - } - - // Decode and check for magic TPMS_GENERATED_VALUE. - attestationData, err := tpm2.DecodeAttestationData(q.GetQuote()) - if err != nil { - return fmt.Errorf("decoding attestation data failed: %v", err) - } - if attestationData.Type != tpm2.TagAttestQuote { - return fmt.Errorf("expected quote tag, got: %v", attestationData.Type) - } - attestedQuoteInfo := attestationData.AttestedQuoteInfo - if attestedQuoteInfo == nil { - return fmt.Errorf("attestation data does not contain quote info") - } - if subtle.ConstantTimeCompare(attestationData.ExtraData, extraData) == 0 { - return fmt.Errorf("quote extraData %v did not match expected extraData %v", - attestationData.ExtraData, extraData) - } - return validatePCRDigest(attestedQuoteInfo, q.GetPcrs(), hash) -} - -// Get the cryptographic hash used for the signature and make sure we support it -func verifyHashAlg(sig *tpm2.Signature) (crypto.Hash, error) { - var hashAlg tpm2.Algorithm - if sig.ECC != nil { - hashAlg = sig.ECC.HashAlg - } else if sig.RSA != nil { - hashAlg = sig.RSA.HashAlg - } else { - return 0, fmt.Errorf("signature is missing hash algorithm") - } - - // Convert from TPM2 hash algorithm to a Golang hash algorithm - hash, err := hashAlg.Hash() - if err != nil { - return 0, err - } - for _, alg := range SignatureHashAlgs { - if hashAlg == alg { - return hash, nil - } - } - return 0, fmt.Errorf("unsupported signature hash algorithm: %v", hash) -} - -func verifyECDSAQuoteSignature(ecdsaPub *ecdsa.PublicKey, hash crypto.Hash, quoted []byte, sig *tpm2.Signature) error { - if sig.Alg != tpm2.AlgECDSA { - return fmt.Errorf("signature scheme 0x%x is not supported, only ECDSA is supported", sig.Alg) - } - - hashConstructor := hash.New() - hashConstructor.Write(quoted) - if !ecdsa.Verify(ecdsaPub, hashConstructor.Sum(nil), sig.ECC.R, sig.ECC.S) { - return fmt.Errorf("ECC signature verification failed") - } - return nil -} - -func verifyRSASSAQuoteSignature(rsaPub *rsa.PublicKey, hash crypto.Hash, quoted []byte, sig *tpm2.Signature) error { - if sig.Alg != tpm2.AlgRSASSA { - return fmt.Errorf("signature scheme 0x%x is not supported, only RSASSA (PKCS#1 v1.5) is supported", sig.Alg) - } - - hashConstructor := hash.New() - hashConstructor.Write(quoted) - if err := rsa.VerifyPKCS1v15(rsaPub, hash, hashConstructor.Sum(nil), sig.RSA.Signature); err != nil { - return fmt.Errorf("RSASSA signature verification failed: %v", err) - } - return nil -} - -func validatePCRDigest(quoteInfo *tpm2.QuoteInfo, pcrs *pb.PCRs, hash crypto.Hash) error { - if !SamePCRSelection(pcrs, quoteInfo.PCRSelection) { - return fmt.Errorf("given PCRs and Quote do not have the same PCR selection") - } - pcrDigest := PCRDigest(pcrs, hash) - if subtle.ConstantTimeCompare(quoteInfo.PCRDigest, pcrDigest) == 0 { - return fmt.Errorf("given PCRs digest not matching") - } - return nil -} diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/attestations/gce-cos-85-no-nonce.pb b/vendor/github.com/google/go-tpm-tools/internal/test/attestations/gce-cos-85-no-nonce.pb deleted file mode 100644 index fb69dfc6aa03b20c38491a118722ee26ef2c52db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 29596 zcmeHw2|QI>`~Sub>{?}5dM~(9US#-{!Mr?+SnU2M0d+I7dWa8{ioE|fskcJuC4QVnm z@**6><`{?g2d=;?7DTE<%!q{9810fe1DV7b>Gh+|Bg`uvb-afOrv)h3xJxQuvk}_j zR-0L$IpnU=DQ=#A1&@o>=#r3`q(9~0LU(`VJxhFWp-U0tNDL}E;Z1I(%ZD2llin6y z@?(V^DZM_K;@Ww3#QiVNyn3UCQ6#iEwB$+G>32wjGLGi%J>xT7i>0?Y^~A1Nd^8OJ z%+V8+R|Y8J0u>3W}zY^`-5>R8&cmyNk$j7kJYRENbbb6OL^H)KTBiAUOtZL%-( zP@U8}{6fK*ZjqG2d(%`+D~uW70-)mrpLGw6i^K;{=ETKhPIL!UsRSTL`lPWT9jmSB zL=@YlHv7U*4}9A45x{p5(*nErw~G@(w7Iznz&DEd?l;(21b&v~9%I$YP&S{;te(_jtN!Li|S{08-jr4KH)*0*6P_2`LYp^XE^p;M_aBuK0Ysi*QC?rS-1q zxn}a9>m|2?RMg6*v^w_eo!}viccrfcIAdC3r^|WbIJ+;jY((Gn^=KZ8&nna^quBd8 zq+s&7(v{Dy6-7j&df6ohRwYeq^7MJ+(k*j_oz(Mt66v1FX1CmIRumNgRX3tx4mP!QL;;sq?cIt@mP;ZMzStJ$RKpgWTbQqsxPqIN>mZ`w5Q)U?J7XpIw4LL;S*4F87(@8O7z#Ru7iN*H z10i);D_+{AH^w*K$T{?6f$uQ=Py*T?N$mXS0)!#xFjy;?HRuD)bIEzjS;L z8_0*4jzKy5Jw(B!zCMv+?7#956N54<(@bVGJ1^ zgHJ#_w74U6Z11aMkuKewwVbf&!(eI*Ka_yxhp7Q{46UN=wYwWVGpe;z8R<53^){w6 z-qEE}{HZpd{{1!&-EQ-cSgG!crMNXqD;Rm^%e~~ml&2@`dJ7@t!q3)Sg_+6z(dI*Z z9zQziazk&znyno8Xfi%y6?`^Y?n05+l99qevsiT-y|zs%6UXS?bDsp!Oo-gKPD>v~ z7x>#QCClxu>#XV%R)3!qCzTd0ODZqQ$Iv%9*K2pa!r<+>wpT-a=@%gb_u@M|X`Ub5 zdx~NCbx)J2mEiu~+m|;z;98AMlE*~h)#0hC^x=G>4HusW4Gn&XtBBIi(X=KcKjC6T zs~c}kImnDlq+6Un978+(x!fe*q%y;Asn)?uTS^y@YJ9mzx`3@X!s5m7a=TLz3`P|I zKW4|FCCSM8Xz=m|Fk~yJ<=o79F{8k0PIRfgn|(O{Nm^2@(uD)TnYPn{C!rQ~Pik4y zNWoUk1GX#pH;wuaUXY584*rKG{!IW#MMMWz&`9`f)V@%wSsN zbnprGgf%jMajshnQ@vL-((46>`(5Lk?HOwIgwrqUlA}Q?+Fz2M{+Fl-=-?h#sjXZ; zeyUH^({_7)8gg+^_onO-d5zxUs|RzvOdd*u9Es`Rj0q2P4eZn@S@q86mL~TJGWx$t z5@EiyUm-t3Q;EM{AEW~4;M5Xr4EBkqZkN7@dnu7~ApUv5Y~EZd>HIWb$9T!K%sr3_ z`b*`-@JrG&{t^|04*oEu`JzDiHQC+X3H2-~Pf7c6M@i?*uhjIveL(y65hN9qi{zKS zHYpuk3^V*uknrG%ee|s!kj)#VbH=gn)fyMeJVQ5@I7YNifobjfCAlbnsU&EAiHh)- zq^JI+v?%D{=;~7&yc^<=$>$w7-{~w8BQ+jasEW{z_4(?`0ksc(!92o#A+1!(KZS`; zzK@BpZA^6AORYTwF$&nVeC|Bm(KUa8usVhJk=;I;h|6KcrLJ@Tz(nhg;&8G)bxGK< z7?MFmr`V0I=73QoU;p9cCT?dD`0h^Yn+xj-R{Q6i{rA0$pvexTXHF{YI$xyXtUhzET_b=6_C9rTA!g&wUUTx3HIM!1L(I}Ut`q5(HE3bQ!n@X1^)~VB>@oL3ui`-O z%%&*5IqAR;Chr&udFxc84+gu1A{4WnIZzUZyD`hcDVF5jt{hR}6g{E2?s40j_BuQdLN$F75q3(@)bM*0EC1T&NuA2sAwHHkHi0{lwiWMp)R z565IHrhJS1l5bjAcAX7SwTs2TQxAwoFvfa4y_%m#OY))5l?OA=kD2wqb0NHQ8hi^% zhxh|@{v-f=i}Fvs#q_7%qWM#A(b6Hlf%>0%!F&&%f0l$>avQYOaET(e^~6|CuWuFQy*Xpb{3E6=pmn=JMozeu0U3-Y4> zQ>8)lr@j}24iPGAd&N8TO2##P=xMetN>absIg0mJy|izhRbEL9pDE}%6y1^3bm^KC zFw_&Am6GybW!cK!2ju@*HF;9-pD2UxZb3^(z@py4{| za1DQq2M!^&O-Tq4;@^SbZEOGzz<@9Ch#&OWj!^Q7AG@>!IGNQdOH%F9I!FVfr-1_f zpB7m~%hy**CeI}d>kUdACw*xsXLV%5GAQrbk3~(p793f1mns_fwe6=j@R=3V_ z&dm-PB`GFkZa8XBd>zBnxc8+A41J{$C`{}Pax|W?7N7=bfMOg1u;BO$4)6m|fE(!7 z-155v0ifRpz+$GSgaSvpc<8muVdiF~ za=px$`qc+M)E;Rzcd(6`r}^0#X>P#)TIXl`r5X0-m4u~<_uOmdJJBvU9>Xuz$dc>6 z+MIPpXZaBNh5Y2M>`(o4hQ!p6{cyabY8r5TPY-QRU!0DIlP5Sl^tB@eysj|3}o zcbaMW-Tt-&wy`xSDBv(~%WUkO@$TA36FCN)xMXe)wkj|8(P4ia|GDsIrys(AV3_yG z{Ws080y)ULtQ+QjDSd=~zAS2Wg#wMP^n$aEyr*(YP_sRyH1+r1n$A}*yF>mcF5#DQ z)B)r0&JfTA3N2dCO`k41aI*FSqqX2$pPe`%kY?~>_+U(8iB@KsRfSd~TPz|1!h(n( zA}AmtBp@WDvF9XQq5ZtJfU-S+9WgVuMNpEE3q)&2zo#T1fD!|U@KhueK~6$s1|gv* zG&4ccBWUp+GI|O%lpEH`)5imgLheE^-~&nNDfK-4Ja8zi2mBBg6M$qu(BZ===%HGk zp3ZI<_`!o}!bncUZhR<|ewUi(7BR*LZs3K(x?_Vej&K7LBnN^WPe4S^Xr`g512=R- z;Xp?2a9vCg+#iWRa4=DdA`sFDNu-Rpw79q>6Qvm5EB?j%Unz400oU(~mVg)_iXfl{ z5D^3vgb@S;z&RbtAR(=l_W`lT`f{GX(u`DMZFsN!#{O(Z;!}=KOr&zW&lL=hxG@t} zwCQy;itVZ*m*Gvt4X(`eOblUFP{I73lDVAn&Fpb<@A$L_KRIq*sAaoaX11BF$Ypci~|Z1cXEc070=U0*jyqzx{4{0)kBlF@gxZA@<<|s32Src$fHE<;9Mfg#+0k zqv$jf-CIj#9!BR@N*CVa*9qxx0;Es%VC4t zHJb|@4`MP9ug9n!2Ub$>zL9mM3vyt{@W`W-XB2w%CYbHv-0eZ@M>$U3n|*K-Fw_> zMI&#L3@0zNh-R(?`kz!WW}Pf}xAu%BESlHkA(ss(I1#IiC`SSM3pmmrJiz=1nRY-x^vMN~e^+DJFaU&;$12me!AlP6l45 zMvaC(cTb&y&?3dqJ#BOR?l+2xpI;@QTa)GvN-W2@Hq^RuoVHJE`5NZDnvGjR43m$4 zR!mdna_`;TZ9=&S1!DEw1KeX>)1F|WsZPzAdCd{#CaWZ`L|%CtSY>A9Xb1ytp!TYs zixl$Lb-~i1-uI~}$0 z7nsup`@KH`-A=6J_koTJ1UiasprZvYngwC`o>%T;GQ3*6cwemI_sww&>C*rGNXLbM zZzCPc7SiDXP9qTQg7R?2d>`#35MQAk=tYG8m&*M!#A|Tm3Y0Z>8djKS2e>WEPpaQ^ zwf-b95R{%(Tke7(=$%@7U`;C6Qluh}88#Y;E)Bc1!Iy0ci22IaB%RISvw3Y}q!591 z#uau4Cp}}g?>^2`mhf;$rLbMeS`j12wA)g_d2r>rIqMRrNEhe)AHraPrFPZMWt962{zhm-R zp4p*O7eC=bQ}gmSP>a;+)5?an2F8BSms3)0EjGb5WQ8w~zL)Eqrk6BaiB~W_&Q~hx z6OaT+d!Mlo@ur9zh&`Eltv8}SyGy37q>V>2{%S)W=9dt!f7-%UtBsIrwgS#V%;roS zF|Dg)&S`9yO|m599eeD+SBUph;_o0{lD=!)0z|rc^V9hV$q)4+?qm{&&Rn%x&8Tw+ zl;tI3H0+PXHSy7FHC9?g>x9Q>yZMzCFVqQb-bIvtveOK@f><-0g9knQ0O^z{Dp7JP zh2$&^&khbZh?WeE$JW>(@;!a^TO-jiilX}98_#ERv-Q#S$R{ly7E?xiVUFsvMcL5rR?$@s#*4B8X8sE`t z^3qedGH~Y80nh@7c6yKJ+-G*8|s z*v|e~f(EjpX%KBRU|;Co!zFWJa`Z{&*NAudhJNiDD}x4yQi=NVCn~gTX#Y(p06nD7 z-tPyFbIZ9|(Rq(prMhUmD3Fr%8o{mus;;e$FhKSWT@F})WkDRWq) z27aFgNULz%ZCdLvneHlns_KFI()=N(rb-luSKT!%!?Fq)8pTbc{Z!5v&mF~1;S1t9 z0uFyr>~`Yzd>`*95fOwdUlcpd0k%dC?nm~|9QK8asuDQ-0q)}e{cy*O*tHFJ)LU?; zuKELzllU6sBtVe+uafp>(AM9R`g)qG_By@ktOkSgDK1-yx81F;pM_~f3sRC~HF!&C zVTN_yWhJH$$apQSpGehFdbB=&@q{`&{+2?7shDGHPt>SfSE~H#?IRgY`Bhv~tJ6@< z@P;?9pP)vv*WYXE-n?NtULsQ7_J)h|vHpJQJicON-VhT6f+VVq;g)3^^{k24B|^AL z!Q1gfJ44+oN0y)BMofi@bbkrjboFbz505-KV0F!Y#W|E&i|nS|=m)(>iV%w~T@p(^ zp0A+or^Mfbwtxo#7V#h64Vx8xwvdUF?iG|#2zI|>_vvzcPur(%k``H^vf^VNcaub! zUsb8*?Niz~+brd8{QhM}pu+{oqCAB);ZVsQq1s4oV}WG1=87tfJB(LPSF0 zNa6GL6Enk;7kNWuZys8z?YV-uwa~F~;p`!|(LKle-UT2=(l$=l*D7|G_BW@qOB$1l ztxkPFB$fz1Lx%o?CS>B(j~! zG!K_9`Cwm|b8$jRKK;Ra&h;DStJetyD|X+$dqz#KFm}H2^8MDQpXsVv3ACRRnsg7T z7fHT0)^qRS5WTX}^fj~%ImLO`K=bXct4a}2=v{3e9uHuK0x~U|25JDQb|H0LW^s0u z7ID%^wfQB-1EOOCe7rBF2w^~~flpqZR}bP8b@)Cx!*TS(nc|PE1C!!bGa2yS9Cu3| z5}&v=rP&+z>COf+)1JP53LJ0v7TR`{Id}Y61nBV47WfBn%lZO*$G#74E}$}JxD9UP zKt+B{b#5}e{99BD{g;E<7aJBz4^?yV@pQ-fx#LY#CIsU)l2LtwWT0(|ltzkz<|q<0 zN0A_qiQ>HyU%ZI_xPU*yu1em}~9MAZ~L(@h2_{nB|A_=Ye#9Ns&bW(Q& z=tkY-c9qLHBLzfcYG%wn(fbEoJuH}Y(CY9fuEfrHTY>rZYGLEXp#Z-k5$)E`Cml z?Kk|eo^?zd=R{#}HNciKejB^OUm(JtZH-famgg=A!-KIi&W>W5G1c!xY2sI>Pg_dA zRYZhe*)})BFCfCp!@f&X7#>v;9{wNy>Jh(dF)+N)^gG7&cW{%>bxdks*ggq1%}>sR zFkq6NzQv{R*nbl+?LlyE0~7NPEy}MU3U5&U4x;b|<$sZ^KSQfFDpa%4 z$783%C8ZnhdSM>$h*{i@pWb+#Sz=AP;Pw)PmmqD9{i)?l=qcvalBQYy)KVMl_{9Wr zSuM9+RCjKkQGQ0-ao;XsF$ml6oNpt*&ii)$(=r=J4boY{x00U02KO|kW)=oxW7k#E zpElmSLd*P-o%Zn?CKA}?MY%USnC0TBPxG<-h4b_w>aI_gjN^XAX^K+njuyVzK&OCNYthHq9MUCM?v|A7f-gA9adK1HShIP5y^6}9xXtjt4 zfBieOf>c;KR-TCH$!u78#(=Z2>XuWz_L903txWX8|M^hM{ToRt}-&6rW;QB|C z`YCW(-VQiZxf>8~Uy%2&KS>mrNzT52e1BMftis>t99=O7LXlK@lSSsPpsgryb9!%l z8>w*aL@O$i>i&n4x>OP2HOL8-fTO(db)Q7IPE$%m(`D|#n%uf-kv;1*=RAA3H=gY6 z<+o4!7PyGM0M|=U|N7%J0MQU=EjI1|*H~utz>WLfi{Ap*5A+q-_lEyrKN$XpeKq{Q zqfo)Vt5CtdRjA;2g$f}qDut9lNQy~WGE<9+f&pSk#Fu~{b*}$D5q}0!wO4jg^Lq+X zSo6PhW0(c*?M4{ZmH4f*o`q-+v@k}IjoC5Zr;sR1ald*bxlkX&Je*~8%)TQoU&;>H z@4YezQPudE1I^=fS&=w>cloIHoA|2EFt>#}^?@1vaKX#B4+d2_lkKs;fBi+;l~0#7 zbEcmQP@hyt(J&aO^bof=nnpLqbRZS2RQ*=|{4ueX^YK!?DLz`u`|cPUk%vE>-!rvJ zZ0^{Rtbi-rP3-sv%3zWd94DOGp@tT!T?u|7=B}(5Fy9lDFTmc)IIQn|(o2viex2H6 zpBaKIQm)@&)BcrDE9KE_a!8I^;+s)XH7!f3L%2L(5!z!4hh$x5Fp$;R1}Q^?{_h~l zqyZU2vMe}KRuNVa+LiMR5I^F%)pdcx_uw!=7{hl7ehLBMHPW2#3oKXUI$Hg{m zPgvJ&LP6F1ixILNIvY>ihhmS^2;_w@t-hiYYG#>kq-|V_;`7{df(-pQ!9$Rz&hzuBXNmbpPGK_W4M|Hzh173Q-@jA5!Svt_{g~PG#QXQunLHlT$m+BG)6dmq zT8>xeD@RM17Be90&01pE+Xpc@9c8OtkeWwP+O(ZvK$4+>W3}8JmhQzS5rF68yQ@vn zOJ|?#x^DdZzO27jhZK}4Y)dt0F`T~+0(!9ImNRrY+2C6wdUm^7nF}N05J=FxA(!pwcRH@=x1KHJ9 z>-(BzwjZ18F5+_gPi5nnRkKZALLC(@D_kD;y;;4m*r@eAV5rx}UV3~=zTF~U=|NBj z;qC-xtA($C;kyJs1%~6q4ELU1FPTF6lQ`(qoC0PB24A~r`>3eepAR|sMvU1!;EbWH zzc=E!lVYtFf%q9^7hfIokME8UB%ec*6^oP+6b&B8UW(Ef(Z`AO&WvdC_db5YxcVqz zu$(c*SLM9C&GDYSHRJk5uSnQG7C>GFX|UBxJK(BxYqH&t>{BuAiIewI54~RV$Zpgb z-`})*k0FiMo{*OwfY7E`Cn$j^t$iXnY+mUQ% zg@*yS-op`G@qypf1kOZ**WcvjDp`GfW_7G!w*>!qoi466;uEtV6hLOSa3H7)?J1d~ z+Dn=bq!gMG->B8RC+xOLZkHe_0LsfVCisT>qm2 zc!57KXQT{3SM&8_uhzs3D&`cYFJX2SLP!{ZJr(;k8T^SfB0b{jmYukfp_`Cz@+omM z=%`a4Ct|}k--z6>xA}b6sgqDZ@MVd`GxFPwfidfc`DIRiW`_<8-E84=?V9yJ^};$) z2L=?Gh~2Jgo5)6ppGpX&jg^xZyt^6_)2>?lAbR!v$EnUjp5VL@Yz!HNyY6)6{q?#O zP|6?W(;ke&yRY+!+>(?R%%=vp)=39|10LWCCwK6B*@0_y@N1qN0UPMdF`cYmK$gy{ zwD6fUKzOAdK7YS-2nr}T`&?bqzwehmEU^Ee-3H@Iqt9)_&?!%Ws;SQ0Lt+guAfRBh z1}Uh|VP38mZMo-p&Fe(x;5`Haqv5#}Sy^F$L&M6e;;x@58qQ1Kg{z%O^u}-X0@u;F zVLhDT_@yo?US4ikGzy3H^ng2oqm6J?Pfy&|;uueS<=CpV|G5^7FQfkqcl_Mge~$Zh zp8r#M$LIS$mv`d-D0i^+{s;4p?=vTW9Zaxh9$ky_iM8&fFYr}oVby$?p#d)Xd;dYP zuJN?<=Vz5i5(&l=Y1||fn5OK66-nojR;-<2dNAM&rHM9knt4M{C_jhC@H>pn$B302 zi~{-QaE^>wO@KN%u`;Wi#R3PKae|N5d`UwC{Mg@4py2C2-r?tc@eV(M@<)pv^7s5N ze(dvKwG8pcv(-P->;Inr{e{JRKb_M3{bIhK5`SkNBkBM6{4XB5K>+=t(uA$VIvUgF zZ@h0HddhZp5*JcN83F~yBgd0+b3LU$SR8=_bZg02S2MR;8|L}CC)5fhdrUxJfSR~z zs4%Z7X?rP3IuOdDQz~%$)x7d_u;KXi*A=}IWA^!12F_PCXbKmVye+NPdhZCb+*-A( zVr+_6rL93J)M)dP@vwzgtMP7gQ)%mwYugKqfAP;2qzJq?q9>9qeV?m0(pz!|_QF6q z{GZkfxmFl>$Gb}koz#(0K3YjZ3fK{?WPJ ziwR%~s>-IIBKg;xjezWDQG+s-YkM#Dh@L1WKO0MBLM*ABp0?Q-WkRu{04~hla+~*l z&u5bWzmU-w&TpJV6 zul|Mqb~)@YFa`|3pXp!b|84&Dg(kzjkg6TcPk<>hr88Kdf1Bf`!OmCT_WzcD)g6)k z)cxE1zvTbCG8?LX_8gRZ?+G!r5uhKkmG0)f?Q+;*@>~A@8vk$eKSRUgS7oD_Tk(S5 z(3F{dN?CcESe-`@bN|M(Lx{;E^(qY&24t5%DYx@?rz z&1PE?e7EorskUQSKoKk+YAK_tyv1*QxOCBZW;Ri;MH*__@BOi%U>`5Oap=L zf#kxAS}XPuEHY}!+ez-+cNqMu_-mtF_UJf*8z}TK7)KCrb6Qc;5hdzw)vGlT{i4@s zzpw|Cb{@V6U<{apCbapEIDh)i?<;VVb8V2eK^G|KQtXlo&Wqx@m8yd{@iLIXGL^I! z=qK7rd-L9QJKVm4eZ!UkF9hPS#TFL-+1h|l59IKrcf0ZWrp+mf&lKgg>yAbP?-h;I zJBOgaSoy>JbsqJMi*YsSBs$%{x(dUTq%dF^;;&4I1q6!w;ox5(-9b4fPex zbe$h1p79n+KX$eI>Z6($Zs$FaPi{tsT_UWOm5pN~8$EKj0OZR2wz3JIwKWPl{Ounu z?90>72OuB>0^m+E(0wVRou2XAG9)B~KoDRLx?N`0;GoDhcK`Nt7?1?S0pTwc+d~^) zmrOL7cBK+siqYbfF)oGnUg+^Psn?*{(lDZQ@-z|MwBugH`BEO?7~|abV4dT~^^dWW z5<5Lm1&2@=?sVob^;IvsP6?(Z8@uRxhbr?&XqN7-Yyd7xCd9};nVvoA(BmBQNDtaQ z^!_e>2i;HIAUK@$kPNu=wPkgO=2Ho67W0rbS;L+anBAq4HlwRh;Dse)YvJg%g%0%y z6Y8nqLyvmG&7N)AMfR=8xepk>RfYjd(|Zq@bYm_izK!NJumMq%jzokyU;M904VTWB#%^~EI}p0lnk!1 zyK1(bd}ZCMrjIR(coA43~pbIwQ!<*~ibp4(;wJ3wOjgq5Rx%Dhi^&*WwfpW|9>K_X*wY zwO1YJ8QC?#3{!^!N@ef$;G(r$TET;v;kUJ;1p3ZAo9yk@v#Kq#s5=OAh5<{%EGj+n zGw21JBN1;Q-QxMImVD>U3r`D|#{3gAVh)#EON29@G`CVg`$6J5ZpVFB990FeZ^UVO z!V!Dw&dWJbi$Hggo}*5@3;S}QKn7~$lIVtzJL&Bk_6)Iaaj(RLcRzpRYg|Wv%eu7p zZUqcz_sY<@YI#TYos;#!qJ#7#O{}|>5pxB&|YtxMpRxvft$Bk z8S4@shX+gcH~De4LRwaH9`hZ?-Iea2=U1<}qyz(Mdd{i!C|c9>SKUtKPzd1x}1sumj;AAl<{=|_=+vr@|cXE$u4hD`^OouXkRc=;rqy${Z4F^ZS zZN3pGcb_XCoNV&5qtSs<1!iwz=a|VTD4?_P@uE!<523UG>NrI~YoBH9jF@TK#;C7N zaNvEJ8;dYtGGU4{}qR%DE-}^3og7ow-M2CL63Exz?}S=m5sKjG=f*hDJB85hyTJc52zX?#9e;XXb`LKiHBQ^DL_Ji+{XvoQGbuze z>GiD6C&7E8iz6;7r-rh&as5#uaEmg=(+{VB_@;~`dYBKUIL#bu5lxU^vuaw>ef`D> z3cQM>cPBdgR7J(ZJ0DWk=`b-7ib=jYwi;70G}*bX_zVU(*d-l&7s9q*YrRGLPJjSm zoQVGNsd~}9aT7^$Y&RmPB$rRC+7n`2B5GwxQ{2?!_x=j>*tOEAAAE)ULZqoGq*p+O+g9_!Kdis2uFK* z_^v|yVGooS)(#h_fP{bHFYM=m zb;4pC?aG>d25Fn7)OwanA5UL9j1v~V?eGPsULOuGbv_jMR29sCX0NH&H@$V5h5I&}x>!fBb~2&fy+G^n2_~ih7%;Km zXnHs7!wS3LgE&PQq*2Ug%Dx$0K?rFLEJ$`5-lx(kP&wf6Gxy$9i^qD#igXh zP!4EOClpc?C5Zva!0rs?hUbHEkdkt8kU_|Zp&gu@BqULiPBLh4)v`ER+(}A8LR=at z<%j^8A;lb|&{9&47;za1F-J)UX(uN%Qj+Trtv7+~4ORz<6>tRZ9F~>;1b&z`*~vRgB-7=zo3d{gn>s zJFWMZU;F>P^~xBvF_@xC$CW?Tq97)ZHm_!JUIte?PTij?jM_DDLfTdQvSQvnZOz78 ziE%wVkLtCb>hLiez<}PMiA0ChLfgkNx0_;X!^TtU%}rWv=Nfelc0W~oQf%vrNxkdM zcH=SHtyCyGC1CSM%AATD4pewiI1Jp(M0I;X*>5HSKWHZJ7uzR-SNwOZguhj~e}PK( z&szaMGAsVj9b__vr}a4ySbTa*DN;I5rad_tS^x!@~zm?mp0`e0qEK<*Z7xW9q1?3;A5PFuFWsv%b7?@c;Wb+Kw{!jqy?xV?icp<1O#y8t}y4tKLov$xa0Y zx}+6(V^@L>h3~QU*W?u$@LJb6DYIg^mqRB;V^@-uEev>e1~X-lXkif6*pOh+T`C{P z!OWuetRj-~Gu5ln@?rff7}Gw#)njpah?XUd%Ak4HuXN47E#Ch{i}zpC8~wT#`L`1J zSCvQrzs~))!D^}H#X5us#>rx&JNUIK*O65;eHIj$q4!-Xc6U-p-grE1m?%Qy=C%=W zGTpD6P~L-MhQ7fZ21FfvMr6cW+xAj*$n2wBJItiIqa-9aGm8Z3XArkiY`lEv#)+dE z1v4bU%G&po4nD;He}(UiI)TIGzn`p4?X^7LK26FU5(n;&I#92En&?0ZILLWqUB0Rx z@{$iu0Yj1^o8zwb%CHHg_dRv)PvS_j4S@lh$%|vjU5SK`)X&2X)5x(23^l~cmAoS? zAUWrg&XDTBtHh0=R}Rbf|H_mke99MqPy7BoCHa?6ZT#_a$*<09l=%B_ zpT7_H`TKC6zk0Y22&mv1$gk%BWlo4pg%>h1UJNl2GqiD=g0H?k0R<959647BcOTMP zD+wQ?_q<~8z>vq6xLGUU3UAHiX zK{g-qYpOh%K0Z*melGlNwDwcjaxgond2J7(<0mCS%?l&@_gusO&RoO4RrBHk2k`z@ zz5c4|#RdLvwBPR~QC<`9}|mW3GKX0P0>N5CzwxCn_b9uGCc>IVpSX z4R;aR_|{{C3d`4{_iV4S!GJxw&^Po!e)hED+5tGF#{wo14V^EE93JxYyjwL@KE|e7 z`F`ZXKAWM@<~Nuc|A2|zAXkk*aKdhD&zK3u#~+Kv_`-EO{K4r#{Eo7(#nLj&CQ*Q%n?k)9Sdo;Ek#)?FN>&`j=d^?0TjXn zcWmZfGM__KCb+}PmB|}g++t&S^U^63mX$kaGqJXg_su$(4q*28hplo$as1yG%NT?6 z1E=8};Q?5j3*5vH4a({(+C+hfAeIK#U%|IGrPC8wGp7MJ6nboD9(oaIFxb3R3HZbI z^!mSWw9c2~tSRUzemkKWNrk{~Ck79wCRTIv^m9ZWMjXQXiC_jeFLyhPtDQg64vmko za{-Sx7XoJoJup5(2q95~C_)Gc-bGE3;<5-)S%kC@LP{2afa}U4_rpbHwN>@KRK!dT zRUGtW5whSZ7T|VvQ6xfI3@IvxL?R^chg%>dzyMKkFhCLv0JnJlY_rM#^?$p!y@@=6 zU;!+t*{v_PeR?z@Sa$fckaiA~pzrl=I9x+vRLoC>sn5u3+)YV)3jDBSf+PgQ#H0iS zkOK&9gyxPPK^QITg2Q?F%8H11xnhN#!2`@iwm&-71BY?O&#Z`isSfx6A9su+793== z6BS1L;1Ifa#+(p!gepS0K(RpnFC^xMpu#6cjXx0^LPSU!hM>Xw_d>`Kq$I@7;lyMF z2rhgGIfMj?f3-11*=f3 zqpY};xF-0MLQ;cGY%81)2JtsF)ccK)Xp2x3fv=ljg$*X5080--@GyvwfDz(`I0B>e z^A$qlS0$j_kU}UzVm3=HYb=Z%UwUpBVYH{aY=9ri4I|`?_7cK@b1vYmCD8^q(@RxJ=%Qq;nwM@;@d_eQa^Uq8hGw5vD zA?^KMg(L*Wi_rPU$qOB5_*z~bFx@PRcewQms~P&BbbcjIqyM9MVf@$(iSwFNn9-yG zq%BWU)>4Md$Eib*R1!;dI+--=_QNK}{m(uHerFD3jJZhubsRPMI9S-u7_}y s02c4vxG1WU*N0}w;=U;qFB diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/attestations/gce-cos-85-nonce9009.pb b/vendor/github.com/google/go-tpm-tools/internal/test/attestations/gce-cos-85-nonce9009.pb deleted file mode 100644 index c8b4be221cbfdbbd19e8898d663fee8e7b3cd781..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 29602 zcmeHw2|Sct`~Pi>bp{zkh)J@B8T-Dk$-ZSb#$XuxSSx$kWvP(J7E&ZdSzBn4B~ejI zk;R0dcyubH-|DWG;=Hov1S+DDy`<(B&uCt-dh5%#$44?q~0RY$n zFat1Z@C5)pJ1TvsPvWC_HMsXsAI`OG#2>e}(6j#R#84%SP8q*WG+;xBXjyPvm8GVp zDI!Ac4{%9-ymoXFnV6u}E+se2l3!4Uv7;-!mkZ6gHfj7@zf`Be+T}7(LJ}iw|#GxOR-3 z7J#JDkm_yxwdZBfrd_W@qsV5`9TI{+nLTU!H=tHt~e8tkn@KFjYMWY;;aYCPtT z&7XgC<|IP#uG}lHB*b9|=`)Z4gyi@3+@F~wG_@p(b}JC+rjKT0Kh<^LQ4tV4W;vTu zy`uFbf@_4ZwJ}LI5`n$jY9{A##WlvWi$}%V6CFPBCaZ~W#Y=S#x5)MKo>Ae*M=t9z z2kY3zz2d45PxPJAkjRNtRvI|GTt0ZwkG49?-EjqT5bYP#Td+*0+*)E5cwWjgAbKC) z^cnYKD`w>yS>a732VZWjh<-H8bEPPDF#42B$e}I)9hQlN>vYVC0^yZv*&Xv5B3ce@ zX~$<4M0O3x8hLD?wU0nj3JYrJw!jubqkZBI>>g%1ua{D8-eFK;&Bdp^(`_UZ*z<`i z)NU6X=Au{ebaC+5yTqzB{pN;v_V-X~D1wce7Qy`5B8L5bcwP3quWsqpq171$=gw>} z1cqQHRqeM13}HergO&XU1BS5tFoY7pTvM(5tL-Ak;8G`xc`0(SQbB}EWavS>!{lcuyAKbwKhCqIp8{&r? zZ2e&f6v2#fZ|{yT$0Z=&-xEti^xbOwbU7EK10a~MiMQ5nZ}d4{t)tF@Sk*UJ9X@4{VQyP~7(#(yR?S(Ytu0~Y z9_wVReXr0SIm5q`RHNiStR03Q=0=TR_76^i6}P1i?wULh?z7d z{f}NRLjE|myXVtn+?3)2?_J4p7nL!ae@9_3KXyaRM7h*}CXtqc zcS@oA0-n#0*JD53qo&ss?%P%5gCm3r^$B;mAAf9Re-ikZp03Ea_GZ=tVS~H&XAGq8 zO9duz-}R^RJ+pgO+Pyc-W*A}qaWS}6YC>iAn<9$?idzFYa^)sH&j^e4ItYJ&B)$^f z`;;449M(O0uvb9S6W|wmj_>35F!(%Hv5V2fxLU1#kjX8-Ut^#`KX(^FtUjJaA-H`A z!lIy6z@9+`_G@175BY7s{?-k~qCp^Ea3(KN2TAhWoF3`AsCBGfxWC6Uso9CS)w z1$`PU7>fmg`~wtx;{nFn@=FxS5J>M!47Q%1R_fCYbP2DHLeKT;Uzhh#)aoj}v^US! z?2#;(7dZl{q?P>HqLX}rTT_L_xn(M4o-=TGMS{3Q!jwxx#R!B|Yc#24!?@dY4| z3{p3kol-Jym%dJXBbB=+=~cma{zN*})F^-3P|2v=J&+>emnhQz5=CkRGCvo`Smp6R zqhj>-)tn=1%U%4OaYkI9>K|py3Ql?x*g%TRzeI8CFU5lVQmw*&iF+sl`6#XVoKX2? z`R#tm_1n^(Q}qz{Q%zW1tm%38kn!DPXgbI}1p>*E{7~P>QIn3{;7nfWk#1p@pvhD* zw)4A{P94`)5$G`lW6}K*MTTFBMT~+1O298xFzhj&|V-e1{z;r^Xld z>1)Ex>rl#6+lF+6I+pD*Fv}4Al;neL<$9)j&1#C{O13|uaHF^VXj?F$V7_p$$~`vQ z6W_?zYA7lG!Qw3p8?slhdDj6YBAYKG8?ENaNrehxzB^P9+lgFUXuV zsHfPTX_CyJ?SL%NT4 z@Go2z6!W0LLdbJjqHn|NKAf+#*e_7rUevfFca3huEY;3x<|uU(Qr?}%ggt|n8jg?z z*xs_+<(IXm<$f~lV6b~o_ zQ;{Q3CJ8&MKU(yp6a=?>oITA`Kh!;hxtY^l+Qyb}ucf5Qz}PhJ_-6z5)$?@@5y!6X zYy(r#BT(NW?$6v{sx5yi6$Jv76ts3!o^e#YgJ-)jRb}UY{^E+e} z?8gwEY^avQ-X~h-U+QW$S?@Y{jwz21OvUi0YJ(bq`glOTVkDp_@W^#*oA#5z>W&FG zWcnV-XqE)u=a)|9Gg5x+_TGQkU#a6 z;eV=JTmMuY(jZW~8ZEL8XckP$uAcYVE7sOkq=;-vs5~Qg$}}wnRwgMXaHB!_nEZth z=YWr}7h{?Sz;eO<6o+(wDiz{Sm5b?5rDFb5saXE`RP05KWF$l){{busg8pW{I4n|6 z6R8!1^CqGsHex~m2q_Jeq-O(201kWsI?~j~Mu3WM(%|{`fU8BVsxL3LZ9)^yq_Va|zyU9^3(=y~>M8d!Bp1pOZ+7U- zR1uWT$tRG7Ru&=Vj6@hg(^c zDs-{o>K7jRGk9m%-@!L(9~Iza*>V#OFuJ|mEz7(sza%n4vh!Xu|Djglp?Cp_#%+0C z3(eUl^yVzFuN8;4=B)G}j42qPyOAVLHMEe1KHj=M0Yp7-S08Ya=xaj-Izhk4jXHd= zdVkhHRZY)e@<@AHo0�|3PXP(7B?2Q6Ropt0{5fNrQ#3^T8a+_<%nmK=w7eNkk3q9a8LU z9U123cYAIma||xYzyRm_H!TJ~m~O9q{36$gn|Nd=7e|$^*OUGrqQL2>mq#DLfiSpV z-0tgEmw;UKUG`P0z_e~iV8Awwx6ZF?@64yF=e(eQWEZl| zBmn4vVI*S==mUk;*G`WfE!z`UdzQsc_?`b|mC z6-`c7Kn@{;K(;t>L*^MjFHK_{_TUFBOdU{klr%zzbq_Dnk&(eD08~^u8it~wB)5Q4 zGC?fN&`c;sl7pIwRs%!8yZZQh<1y&1C}xr;6%(C-PoOsugZD;S;&H)fW)y>yNv6(Yb;RC;J?~2RX*;rS1h{!7;=ysLw}y(J}t}n8~f`%SX3U=xZ&JY`B>mOwd3m;Y2EiJQy<7H#X4K) z-J6ZHZz50h$lwGGYkR~#LrqBA9=CjNTutQ~j$?)|3D%+I^rFOC-OGtMr@u_`! z%(mUV5APx)Uywn_$pErqPZS=-0Dk-JOk`whPzn?|XrTm29`sNiD6(C0sq$Rg*z}&9 z@F&M!QxH(iJ1Mus4(Iet=`-^_4l+gwlcMf~@}hVme;)bkmJWUnGC)DuwdiIu#T5m7 zSgUq(fy-Xpan##E`llh4w0tx2o`_Iq=HuS^bc!q@lQUr)k0x&S+C9#FCjEqn|G<7y z7cX;74!X!Jc-q}3mGzVE@Uv_8A{1CWCc;#pEAz^l`)cS}`Yt1#-c^=WmrSSWzV+%P z)QZPkr|ds6-6Ebf9}*O&X39QX@L}oYw#dWuk1~|Cu9r|$Rpz_GJd|MQ6VRg}5uXEh zrqz+nc5za<;&lo6E0zyA`&+JkvWyG4 z!hm@a@yaWG1j>k(z;@o45b(NMRQ&1^8DdFxXJ|?}(X*k}lk2EcM$6YQ=i6-B5^j9t z;AiCwbsn#-we4nfvoIjRz$@4*!879-?l67kgoW<}B=3mYk@=X5??S39Ok9lNz*WpH z_0usTLHh1^guctfe*8>N%r-&8d}Z@WO%dj7JO1jBR@aYPG|wIP;C^WpeLmznFt<5S zn|^^geQ@0SBhYPzN`D{dctD_|-2gg9;G9J$p8r*)Agl4E;@Jlh6~FI}>qvL(-;Z=W zDC7pxZCgh=62NJNVBIm^Zn*EGofPUTv;&=}sQ*&Fe};GsE<7RfR<8X@FIs_}Hsx`e z*FEi4gzkqP%dRbV$B}i7EIqWN5^gC{Q^fU~3>+?vJip4HV-83J$k(Kv%;mR#Yj2_y zjdvp!c7&zABP%{i4U+*gMOB0?PD>+&cU-R2xOjEMAlwtE9tfvBy5=4*PlYU3Ya3arCqe zU(UC%%sjV3j7ZNvwThW#&>U4Yb}%vxguNM&xzS=DRzqF*8Xa(<&UN&?mM6tL&fo1~ zMSU`wEOpn*ZRC7uVtW$e(l2*K_vEz8)s@`f)lRz9kdON%#OoQgcF?&2;Tf+$ZlmCE zqlg~WSFz$YbArQ@}n4kR}5GwC!|S|8Sniq|CsmKIOfiLBj4m998yhh9W28BZWXAAN-0k}4`u zA(TRM-}jIA_BV)^^bIA{I34kO(Hwju!uwz@?$EJUmXt4zpBcAL-o7@tU&vEY>bah` zksghsUct!DGtcB`$JNc-##y8#c zjzN>JfzrkM*Dvj}dThE1eRptqKZ3H0)llv=jvC0 ztizqA`VT-(>T8gb0zvM-irb$-TTf^D+fn-3D@^9&TFh>lJPuOtIJLTAYIp6oohtl;_9xqRwJEVzBx~UXxF5z;mGxmu>d%EJnZI9zkr>b~H z7Di#*Q4KS1pJ4`amKU}4uU|DEDiJHcF~h_C)UZ$A;~6jW>>+cZWyZa2wnzFHiY6=^NJg?HhQu$M&+*yjujD4)t}%Cm#)BXv3}B z^(k%mdB1|TpGN*3v;{v5wodx^q2HqDv$b5JY?rW{Qkd68$CV37oi|oGC|l%3%8Czo z-%S-~o2*jL7gSk2*(?)ey7;Co#Q7|AR*}{Y(pR!Wq&7y^ROkqyxuQzz4$GxX>#@h0 zWce#0wEpi_*qEQa&hMk1d1Rxp<09(jbld9Lla_=hI}Ub#2u2NLtRAheRqiP5X+Fj& zZAv4tFtRdfbEv=g5Q1}Nn(}#9dg8NmvX8Wd3C>Rg1UacV3)#=_|4_5*3Vh|2Z98)c z$B8VfDA|&aPKCMWUZ^M@d$`EGeAQ~<3PiYK`|Z0YGz(;mLxQ%DKY&~I7vMYaeQGn`o<@oWVoIHkceCfK~r*Pvyr}87B0_ z7}&BMr) z#SId#Q!HgpC3KflsJ8glXF|n`tJQ_~!+C0Fo6KO-eTR%nwxnm&O z7Erl0*=js0IyQe8>1Qua`8t5?_-wK5p^<}_!#MMkXEk>|v0A>v7jl>c8Mp-uH0{ zoKYk9+r*`**UveZAKEs2i%U@n|0ZDCf#Ti(Cbl1HlwU&>Num55M3EHA{~}(0hE_M| zG0i5Q4jhe=mTkQ2i+ji`VSPJkboFgki5=B6;SC5cp}JhV)5}@0BWw#LP2&RTrS|xt zbICOFI)ttCcdnmMeaYDNz%h9?6yNZQe>K?A@Aj$ZW%e#wRO66$(mr8E_q0aFrh5|- zmer0uZ@hkyk?j*FdO8A9Yg&8c9n-%YiBu5XmM+=N%%I(fBp_c=q$2hb5SB2k( zhWqh!uvAvfZt?LHxbBR2{(64rJEIRLET81q$30E6URab%N#SG6@Pd|!inRB{o7gkO zUZS{R76UV^Jjpqs?Wj7Q?Ksev;94{4uGKt^#h@iBXDO{veb5`oC33KX;uGH%am*0y}%p~jHjOKR7b99us zHCFHAbtJRDnf`cURaB=_vEh??&9;HhRVRimUVIp2u0f3(AhQcbCM(Pw8t7!kROvEr z1yHUk#9cmbJ@VSl3Le2tJ~cS`fSOOpMN#yMe+p8sDJ{C`!p`2Byt-oY}^E{!K~{0S0DJzehXYbkXPW}oBoIYVEP~a z)%5?SKn4GZdPtyAUp#&^xc>WC{255qUfjwc z;3G_HC-8>AJPzF3jxw$*30!7B3Dv#d!V*h8=*aefR;nz`>ypQjLPH!|f40d1r?$jX zGLFD*zxiIMy4I&$SU$J=ywuUVbNh8?lB#Y+5~lCehaB%g3SYRrH?-1?dWX}4E3Y#y zu3XU09epLl5T}%;WpuyNThe-e24awPPdZkm`kmsL0}?G~l4JtX{B`C8@0gmen>oi9~voA0k$?I)^lrhTi zcMxUPfR3k}6CNn5h^&Zc&wU9@#N*(Zl*&gZ)IV zyF=uT$oAV1Vf9nzqUGE4R-bwGC3w^b<%hE_Od>>@w~aP3HZH~T`|LPGjeVMIrpjcC z5zSbe6nj=$>$|s6%ys`(XO&uZI)77*GV15FSwtC4DUagkd~z(D_iLh-xK&tS9Cd_2 zpXug2B8{zy-ff-Y@{=)aPDY$$XRfK6nQwo69ruC4Fs0+tVvzN>5U}kF1gw4^0>(iI zxW5Sj<=g%8<<4QrzlDGw$pioL4z?+~z<(^e{2UGbo4EZMFy!vIe-BM*ZFYX=&K!x? z_0=s$V$_c7y*iVAl7gQy6L*}+n5yK7h~`y>2X~5BSs%_Y4O)!8SX^Yt;`JUySD)+| zeWfYaaR~DKVrF!`MN2$qYcDRht!%*;TJtzom+@94kZNq?Qmt@jTgPmZ7{L4K z!=2vsrI|cOt$)YCJQgO*Pz_*XZ4@ zt8Y`(EPd_nZok@=Zjae%{u-JW-n_lUBUR-QGyQ}?fQV+e1X2g9nQn$nYhyRvuTpWj zf%?)ly9e534xgIq&Jpu^GINM*>N#d_U@l4*lr9VfT(6#eQH=6lbtl#HN*D4q3cGJ&!Cy>AJ+{%Yz@XTtZ+NU&K2 zpD>mW@4OK^k<(b}VzDx^qTW3@?_;$F42fc0V*}a(T~D8} zEIdx`EoX@jP&=b&f3R~`&5)tVBqisk0_bF@7Dv6TGqFm)CWnCL9EopD8NQcp`F6=W zr%`WcchmMA#ypbQ;(O+*r`ivDzTvX59?2|Me40Yu(>c+8Ha?!jCW$)oa;_>#2WOQ za!Oqf-S67Xjaqd$WkO@z)qJKsGY$p_zbUbPNprg~Bz}3HfLz>XPT2jv>n;4A?c+h2 zukBLw;6Ra?#OnQL?l3XDj4m7o48;tk=H>awezf+026yPl*;TW(+8O5ucqP}09Pxeu zg##Lr<`JTN=2Wev7}*fmHoa1zgOgLLqhZEFSKd~1New!kx_JLgRfD!@QOUc~YMn(F zkmUNVT{Tm4k|=Ela-qSPe}n{EB(a)g*49+kUwJm1z|a@>ctM)bYYzjl9N7mvT`_*r zo3IxN#v}ddyjHjd2W^r$uXKwcCe~jkHB<>dpmT8azFXgcXjLQDBOTX#`?=0W0zI+o z@iy~bcYqHwz#J5n%|Su(uNiwG`Oo4;Wonmqo$C}oR7`U+f!>TlTK8DST4Ssk?Yt7W zF?-#t-TOVAH8RphMpM8L6j#-LAMj7VLq@JBhATYNNmPt@U#Pe;HPW3rb7-egRiQT5 zW2M9!tU!3WlMyORz;DMeEifcxjUwy;< zTlv*DS^87m0x4i>rdI=mj9X!wz9@SQ=+8g#kt*%I+SXv8`*B! zn?!yq|6im3ZU55>^DdM9tOv^`i+{8r72N|EZ+!Q)dtZNlBe4A&Y%=o~Y^6Y2QQiD% zjTo5=CK(+Z4kclC3oWU1T_S^v;7KqWId#>I%s1@~7XYe?I3QqM(GLQjE}P!}wEZo8 zgHtCO$n^IdDLkh$?-adFPD6Dg%T0Tez`u&VF2;R_o(p(@!VrgZ0RcDn8fG-QM3Ydx zP!ruFewpzLc|c|JjlH)MRM?aHAIaJ$ z7d&w=HdMCIcYB<2!cXMbflD2i9@o4kobg6KyM8$GJfvD)K9Pg^iO1ankSg1|$|h3L zmS_mMfa%iGTkE7 zy2U>>fOYgO-X)!&`>E*#r?VbW1LwcitnO@CDPhcJ>$9V7*l`HAy;R!%$pQ>`ZNqY{ z@X6)rHqB@=hLL{D$DL6YFV`Gny5|+V?wh_-g##+1yDZH*aOYCq9p*E#ZJ)loPvq7i zC3NYP@ecX=oaES;7ch#OdmN(lgvme9O%Tcyz?%7yX2tlWeUdaQ@QBpkn$+K#)ZaU4 z!DBJ&$D;nPYf|gDcAhj9PY3>y#x*E#o;`Niq1b+2c)6 zZ&(J9Pq$T}=7HbZ$NiCwPl@q39%t8MEFd*E|3GI)te1;C(go*=2_z8Jl*ECr*(vVL zqAm>U7P;Hyq<+71VCxGuxF!rxDO)r^ir4b!g!N`c-PVm2>OS#uxU0j!wzkZ=ZZF&o z4!rN*rq-!AhMgw5kn%`Kxksy?Zof0 zqpl?J4LeQGxDqn&yqOTU4)GG}-0#XaEtm@fj$;PSi?51!QQf}k#GLSsI4L2z{ng_D z(>kV`cBNf+E8sw@?{U3LHh1JdxZ3SaO%f_C;eV=Dp-XfA@<)s4mxoVR)sY=>5Q}Ui~ay?nU7Wkfsy);+8<&oJ$x<*1`QZS~_znQN1f96ecoj3JwcuRZZuABt# zZeoF?>h$#y6}b6S;V{5wVCdZS7)tJom1zqX}Y%x>8NW87m75ze{%EmB)@Eu*x#X}yI4u|s`J}5lhvNz;O#b^ZUSM_F# zL`xw>2t*_bY5xsFd4it&Nb2FwE+%_QmDv0!+~S90VSwK1r*rnHybxI-%t6|MYuz@r zV-n^Wt4{*#!$Ka&U7dvks~=_C8JEy*O&2EY1TH$K#u{$_TyXZy>DB1Avj*&fLU+#6 z_r7uW^0`LFN9)YRn8fxKLjgGAW>fz|OE=OiDJwHo#s;%Y9Pdk#W^N?#48VZCvdlTZ zx~pUTG4rnl(R(X(un!UrmvLc8DZg=vb(i3$FC7Kax zUJr}hUdo`3P+iHs^(<`H;o|6Xs_7BzH+cTY5qLxy=MzX&LVZ(5Qk`sj(_F_6w1_7w zF4;D{*MB?X3Iir%n7qhOK37xo_B#bFyXE}iMFj51rNM>xioW4n%gQg|fU{%j-Vfm% zyLFaZbngTUK@!Cb=Q8WXcO||^Rp8)_zaomFwi>3kdYWfiD5U7+;Vec$hl~M^KUh zeMmX_yCAVX-T^)YoDz{3YKB4v;IM(DZm5Lu^~Lym`S>G)@c!VkmZLY0DC&*z#XAy1 zl+eg8^hE=`@veBBizC*}-zU)5(H)QT$M|F2LzP@HgaF(>q7iUz7;LEHmsFdvLCQpb z9|8gA|0Oy$z)RExAAoTt;9Ni=1RsoxFWy@e7lI`Oy5N*NasJ*of{2%oOCWe8eZvY6 zA;kiVz8=+)=#O`E1COO|1d0aW-5hb?Ee8Hr9GD*xFNc;A1%q&4GX>pPf1dzHoGTu= zVMrCHWDL%JSyQgXar7DaW%UM%zXnynPww<>*G$q=?bdNv`?uFP5 zywCiJ-t7lz7m{Ad)XQE_mZeLkD^{ z3Mq+_k&%*?MQ-qe^u>g(gY7?skw|w;fIHD2hx_NCbv;=C5#vu(+T;R5a8n9!$B0Ww zgZ%jr9o=yuE_gRw08vRsPD)lr9EU@JP%Vc=qg-6ESVnIDJe-=w2TW1B!-r7mch!%xZot^q$FIVon>8Jv1nKH>*csz_ly0*#il6<05NIIkUQ-{ZhGTt>61vF>;S{2ILJZ^}+#se&M9XXGBT; zHD~S7mb7PfMoDu@O-90o*~y-z zk{6Wo@9Anc-b_jCGIz%)~0vaoM|1U+8Le*o{!p7uX&Vw zPZ~JM>9MR>)dPLQkEDg8snE@dm%8LQM2>Yock4;zN_7Z_18YZS2amL;KptzJf$!U* zz#-Jvkf2cV0a8GD+W#1Hy7Nx8#>}`OSL!bAQ|$SbB}wE+0Dv3~_)uK~&(5*vvsWMMfMZYE)DPZ&WiygLK~ zlEYoN7a-d$b(Tt^2AO;=8a*`T4WMY&3BJgey9Y}F-d^T75YKMlZqva_m(aE??d=Tt zEj&u!>t%fP0}xMM^23zttvy*sS?96lGu2})iYljx*HNl@~_$^X69@V~Rx z@Nbp8c)$s~zeTUVDthsN{~_)7XUR0>J@-dnK5uCxDyR7PVR8KBPkTVwYXGX`x&Kh5 zRO-dLDvvn%%QHKRu%vbJYVJ`jv|V9|i6Eo;1(kYJ!4aYzL`og@6lo>u1KyaQ;DfEG_`4=N$wt50Xxl zea)7Rh1Rq7kp8PZ(w{oRMYAJx*-p{HfLfzK^^O7ma`wEuiI`mB6ykyKW`|OYo$8#J zX6fK$0UV$eCA(uk@rLa*sxsLNS*}Xc&_YN^;LATomprF>Ydj0@;PSwtjdc%hcTeQP zP8d<(`)rxwh=JfToC`7-Pjp9`1!6&71H_wXQPC8#;QlM*#-Vg3GCQ^m;Hpxm!`LHV zGA(BNcWS|ZIG$er7p~U%a-B6T6YXy|RHNxpq~pZk1=SQ91fM_`^gfg&$xRM7BKmqc z;yfLL(2iJAh@(4ry}1auI_Qn_7eR@Lqr_1nXwVinM@!11#N|=4A}ASo6bh*?kKTrx+v{UHwtoC-knJF4UiWT^Yz4wx`7v%i*0;#yf+c&Mp{`B`_ddp z9{yf97d$x0<|rnlP8*IdAZ zuMlbnvzNOJsj)r*>)r)O6c-5rfI`v@;6>mAC?-8hNRQK`$2TajzD>=>>b|ze ztIw>fW7r(|KHc5Eg_L9mi?F8-(iA#x;ct1f$9%0U$@%6aUOVDp>C}9_R?jD^!lc15 zO1CAMNRweB=#6}7c^f%uf7do)Drr3Z(IZrmw;wgR?0&iO(DZThwIt=3(%0@t-N*E; z)2C1uOSHucCLc7#OdsMrkY@QrpnK0-npS1psef9tV03dT` z@q+T4!4LsNMDPh2AO^4i$XOmb7@cLdbFP*#h63HxBnQ5dZ88h@%XuJJz&j5t2@L5_ zqFN-qn`8$_7~+m!Vx9#ui#}y_DOr8-RTm$uPjlp`gH5d~QBbC~-9%O^45N(j2VF;X zH-a|AxD|x7hiTikn#Mdum+oQ#eaBO%ZV7DN)^!FwgAe`dahVBI{ImU=nh|^v4U>{7 zU~~cC@#*&n;QJn-fp?JZ%`<*EAp|Vqx>OY^l5%J|DDNP4R*>ET(2-yHW-TigAGHyGX2Ym}iaran}ZH04u;7 z@Bm{ez!m)S0)B2A?R5fiG3#A^H-bv!_gvv4kNx~NumGcI{mxqDT<7#X!7+&M=;aUH zO$h>$iqZMJ&kOBr$t%pk8G~;d))!c~@?$nN0A(Q8u=(L^>LaD7>JpNxtQ#KZWe^aP zbP!8%EZCrSo6CP<`6YG^G!zLN8j7%;gM^5Hh=>6^@{i}vH4H6);-F%%L@Gq?;UFMj zp#abeT;xzvR3u$wBy2n-R~v|ygO$CFAB0&$`7#tjhQlQY72@WBa`ABS@f(rjadUwg zf;`Y48UMC+C<6Uo8$&<=kU|mg0FWt6#83nTpia|FI*KIXi4NQ5r|Hse4-=*rFSZ!@ za)M5$pZUchj7=ws1}&U!m`xYKOG3}d~^fd z-C}wPLQ?*)#&gVwSe23a0b?)Up?_;I_eLQ;v|+Ymw4$AD%AiH_p>j3O(=2=pIj%rP zq9iYDA8EsEG-}Q@?^-si=NGF2=+n$Tl3HIxL_z=%^0lFwP-<}esd14>k%?>D4pcUF zM^%{}Ke{#4jC{L=g%5$!!ip~-LeaLDp z52Zg}XDdPMPC!Lw*zq83U)n=@F2z!%i8p18Ru?Unv7U2!pz#bGMwRYsYNVB09121$ z9FlCzh6iby_p3SYemN}?^;gULpu{Rmz2!-B;i(EnvV}~m9kUMo!mWXBoS2{WRBJ2N zkbzg|>harsl;Ur1*;bHDE@J^us$lavXT#|x)lh)@=xy6E9ctFL9)S*3N7m>06zz!s zj9>Nie6iI7%V0qnko}FOiv57m|6WsZL8aI|*VLEjxQ+72$<%PO2&LqrfRdeQD*j(J zRaq8JRk^u@epXdj#=o!rzv*hpmAt5{o5Pk5^E92%19uxC@2ZUJOb%Gyo!a=%kc~MZ zvds)u=-jJrATT}2u)MhA5ZHpG;`Opf1J%Ys)kurrE4p+wQmn<~mbG`^*RLp# z$ITVV8hXONLSjlkCfsi@j=>a$5Z<8L$dVXe&hnEsOOpC(w^WUiN}b2OJxP-#%o^}b z#w=xB>ET0}M>O7Ta(>T%uG?J4*B=RSi1a?s3NKmY8E1%8JndGn^wH@HQ1dNXI#QVI z@D*qdT_4Ntu-JNeG-O%qqx|X6#nMk&-F-zAU4~(3pSIv_EADakl}B%VOFtu8wRc#{ zV&@iRD#x-f-}z|mBAgJ~|M>CmboB_0=HTvrI+G(>qdMfW4E;CHZ+JiH>Td!6iLMq5 zTa4G}JPN|r=j7~z?8m1kwGHud#;a)gmCtGk3a-#;+Aaw`{+h;*apd;oNm3M2|7*Hy za+Zl&ORLdHhObdhTU-kV%1=eVH6HU&_%(;^9C%3fx4penR6kr{*)pmn&Ti>@izW~A z2*GvWiBT<1V?Ba)!z6oHfTS2ssegX_3%R46ceZ>&4D_uSR9vqUzPzt-Evcbb7wXmD z&3)%g>m1L^n-GvVvZRKyt-)6;mq>}M(&400pw2hZu(tXH`<2~lp755V=$yQsVTuy{ za(#6Ki6$o7v#`AT$8U10)~qGSNt5*PEGCtQSCgSt&u>(4tY`}63kLOF!JUzk$%VIb z?psnja(;iF<%z^0dU?h0;2}$C@f?~k* z2bBm>SDT9nN&ris6JhFGc-lL-*m=3SaN$F7VVP(|Xj(Sb&aN)jTr^NBSPmu;iK>H@ zhpVTntrtYv)x*uz!@|n}tRVswf|Vl?asRd)qGRviVGYr+@bL13s9Jb9+IYD+Sy+K~ z*45PuN&^~LE+{`YFE^Bzi(ANu42PTlEXfB;LPKu;S9oTDGN18G_j{hf6$K(K3E_r< z%>8dGL;GTNOjDUYV~}ac8g| z36iATezh|l{v@+!#d~11!2YDGEfyI69AdKkBDFX(l{dKw1di9r+W$r8n z#YebsHAv6@C)oeo?_QT1AWZ z{m~o}NX}MQ(=$h418VGvMpN6tMqwdqtGKjrG0J2G-ak`fn)m%}_=rUiCZlDkyV5 zUp5(p?lkYz*88I6vz}y4@al!Hgm#rnGPvDyTsld_8%?L3TS%p?V!@7AK4rd)@4q)1 z@NnRI9m*TORlLOHd#xu^u0c+C{_k33Kk#a%3*pU~>Wz`3q;I1YNE z9eJ@Js=M&mAn2Wg9Z6D9$YwCn98PS^m8kILncha}xia?fl-t)>jRIs2wTeUDuv5L5 z)|vtc_A^CW%qu_fROd$z*ic|zSSSrBXbFu{6MVvn(?J~NdK}NuAXKw3-!?tl!xX-r zDz$z&Hc?JeB!tp#>_FPkrW>c>7)Vy%_7-{c_|i8GNeRDcc6H2aOxInsR?{8)EAaNB zQ2J$C%e09@Xpf-C#RB{m@0A=VdB^NmM-cm*Qn82noap_^o@_KA<;j^pZbxgS3;lY$ zx#-7j-ZWPFke*n%t7S}iIZ#}muWDZ1`&p$q61{eLk{|U*mLx4nq>fwFM;t!9fJ$DE z`a9+#8-B}qRa7QWftLj@UV1oMT{N|c% z_*^wbdEtIX;R>7#|I6KyjMUG2Ep8qzI0p{Q__wwHw^cev-h3P*BqKKF ziw>g+4;Ho6b31l{LAUhnz;xTEAt3}Rg=UZKn+r6BzgX6EY=~b+4M5s6FVW1bo*Ir1 zb0ZMkQ+o8dsqrdCfu1cTpYY?u+n8#&z0|>{Yac8!<0#h`_qDgoOH6qjZ&7CJ_BDi2 z`ztQqdUO|WPXBIGh(>^nM|}8;B3va>Pl-`+#hG!r$&QGOFM&d#)t|ZB2t$K>DZArS zZ+G%t3S*CYXvpJPppd6`(zJZN_#1{A)5*#}ak*Dfl&< zeVPvm#BO|}drOG^-bK_W8HGK9sWhXq?v8D;nZOdC0LcQ+$p%tyz%dDA(<*F9Td}|P zvM{y}Nl{!FAta$d|DDyu8h2RCfoAnV1AW7Zufob0efIKRN%e%h#76m!_!AmQ*>+Q z39<#z=otUCdF0fz_{rJZbG$AsDIW1blE*t%72=P-G#$Lo+v2)%8&&&LXXTxl2RnEq z3k-qu6ecZg=y$4ylT^3Zh8KP3m3#=9$XEEE!0Qg$5C3iX_x{@`=)X0c`)_F1^}g#M zI=u3PME_TOA#N!2%on=+r!NHa%^=dCopP{su(I&7fk=9L*}Hl;fG!-&44%1dTu?3{ zEM6nQlQ#PE}hvp%KRc*)1>@EyFE>&2Oi64g`IUYBHDZbb3-dk zbx~9&b)6S6T#MwAT3phvNDg)9i<=-`Q(bYOWnjL_e|juUf|)u^@vLvEmGE<`G1D58 zFErMe1;dg4mbN)5TeCg2cKwRt)_se(2zv}q8I!;~9o7$idnA2)CQekWS9=@oU5s^g zsb(DKCu&n4VJffV7LiP5`}DfUXR%mEZSN`;a+J+8Y4W0~X=e(b6{Aas3P|U!n>6UU ziT_*I?eS$qq1&YGcYJ#i4<4vzehSd7(Eev!x8YsA?u5m>tCscyqN$0-qrI8r?NGfl z*G(O&3RTWg%#n|j{adaZD88WZf--yNv_bjVxp}@jZARx#8tAmCK~ z?AI+zKj=7VKn)6)15Q#OsomaQ35fL6Z`GpnQ!q9<9cQvHeHW;)cTx4zU<%O|>4da6lg zOJtkP<+4-}BzeZrF>myK^b|4^E4gaEGKGX+G=#CVy_+6U6Ra6+D^C%hS4k)u!eWo& z^CC&b(!Zt!?REW)C|)F7Wy>2GOI_c3l>|E33-kl1PDCeb@r({f+MgmuAPRqZI_@&- zKqv4qWMJ2u0>y49Mc?!?rO=x-_D?;tvYy8MgS|IONGU?)4Ejy)hdi~baN^r+m=nMB znJ*918+DglFXNpr+W-pXa(^_!{bKyDC{y)8;G0I&tc!H*2fj|94aiXWS(6Bn-WH5+ zvezG^-j`S|$L^>4cJJVx&G zDX^q641zZU5`LEamR_Nt3dqDrEJ^0J335c$&oZ^4HkAH~nr1Dx8!XTY*|>{0L^{-P$of!I z&}8SRe!>@V;&cU*GJQC#mV#)hrrBS@{}U}UQ|IBjo+;IQP-;-~hD?>8(A@hf%UIPW zLATHLmxw!g3eW|H4IE5|0#;j)wb2*UDp{he&@Ei8NDRMJvHFc-TiC@IADfm%1=mN~ zsk<8x(j(K;_r|X4xC6Z!d1W8eWL{9{`V?&DFumq9Q7nTH5_ zSHIul_&nH0TWO0yfLbk=(H{@ucJnXWeWJ1^X^h5Dw|jBJ>Rc|v^mk(@-~BT-n*q{p}i^gL>ARASvE& z{HSEH2@r|qrNKi{2nW!bUU*GS(j?p*UM1h=Bqnv_{Ae3j zd2#M__}J=~7M{>DJ!NwCul8wZJ$)M<8|5!PL`K|Yqf_Bw-M~}Yu#c)v*5&rjy%u`y zNNrt(T$#ez$}C>KCxFe&w^cMzK>R5~873$jyF|ck4hZl8Ib5H?+$rYae=7 zhqzEaoq_WWP~4iq zD-JLE+lwGrFt;r8^AoWH|&e|z#Fbp$b zByDd|(MXmkeJpvvpCZky^4%f;02GWh6($+YC_X7=QXK7vy?AQMps6W5;@L-PR@6aMBzzIq*((uwK9HG@*yL0!3qP7whJNwf)l$ilz z@nX8aLreXkV-13P=MGME)XU+-hb{Lw0^Yt{7OO=|TPMi9XSDKnXoZ=_+A1*7Vg#gF za6GXnNHL@cem2W@btw0+zZqilLG|y@!p%bT_%J|ahG7&q*-wB&Cnr=V7_%qo&-f(; zF*CeP^zYDO>Pl7(5c06UoS8uO(xjTs$CERhf@e}~popx5SwnawbV zrpxF&FN4uF-}kS@b=?gLasTMBregiK=25|Kk>yE>=M6d*6>Xa1;$icm9P3%?`FA$W zwXYad!hpZSm!cRY=1U&E*Zk(c3r<_i4=9l2Re z*WvLOR>EtQoopTwLLR?#4@uX8(&1Q+3|&#kxaWA;h!qnR9zWk@za%MVnYkhE(7Ny9 zxNdm>eH!4}@W%If{6QQN?;Je7?Qy0YPJwlfew%@FSntkuIr?*aA-~mI++OS(tJ>JM z@OXox)C=ord4|$YkIWeGbEd>+RSY^!F>8^dE_>UT+;NA;YbUkk9TCtW78cV?GL-v# z$~JMu=)qX4(#W81>M>0I0*@bIBnhIv<{sN}sU$ux;DrquTaK{5BSTDB-| zzTawvc{iwD`>Qp3Q{XAjt9+IZk=f=%C!`!~++VxroZ<18UoC4ryCR$$%Qm*^Qe+;m ze&z5}{Rx4M_tnjL;&3Gyczoi~0-LJ;wxcK;eGB!M(oQL=F zDT?K4_8lZK0)@%7Irf(viq1Ot)qNvxtOo~v;h#05k5P&v`GnuBNx2P&3EkQi zr!q&Jj)@2k8A9;%S)14%)qWkPWm?m!Ibt#CSFAN+&CbRc9Dg9o|?3e$Z1RPsNJgdUvYCh zzF1W>RL81W@e3Ym%Y3Ng1J!4)SCR`{=oh@9v*R#yJ-gS`d*#+(JV^>XeSY-S`kgX7 z$pYeBpBqh_6{dDbymqE-8Kw?=p%1W&2jTI8l7n>o@g!lRS1}Ri>CA;xozyVx%xiYh z>X0lOB8(B?@#4K%*;8U0_jR-?4@_r6TAyz?dkK5`x$E9`Bf8cr<_V9NzVp5->_M;< zT0k{+@|1J~J7-nVPB!DW8@S5v#=S|C;qmfs(Jh!hqh>}<3p=i}y~E${FmiUB;HR^1 zqhy<5F`9zMYesXOc!pLJ_luFdqN9(EsnPLk#BR#(XzAaMzX!G8gU1^!DSnC8T~3)5 zns{aWoL*dk7c$ zJ>EX!{AIm$iq?^jA2$4)qFKw>>{Q#d&YD`rC&(A&F_5y)G0;T-Pv4c8`P9900(ZEA zmczfPyTm%6)#k%aRZ33{;|`{&+QeNnR!kjd%IUnB$~-a#kN0J&$lzx?+;9&pn|;zWEgdu9-eUBjRpGhuepi8V zRR=siq^Qp3MfgyZW9sF{Iw5bmkf6M4j#4cGEbO{?CCuP9E%x@KWlI&vf0B|$F5n#_Z)!%(&k9v{2S`|JVmc8>%xuO|`R zrW;{JL^S6L-%Aa%DgR-s9Xfb?{O!D3eG8aWXeFLD-OOv6t3y{dHJlftkIF`Hn{Fyl z!Q(UT4q3G)y(De)s>iQWO-=$x2|QgV3#IdItsC&TjHKZ450o6pxGd~BbdMKLcFdQf zS7=WrE06(N+vcu4w5sR4@c6=N5?X%Up}Yzlc_u?Y$Jqi1u1?ycF$ZrI1%(JN^hfac zM_Zg4@oJSPWtr$f2WkWLm@6jpd+V+ng{&zrr%Yty;qhhmjGt1S8Hc`X*lgs8ggD<)=fbm8%}8@}UVc}nd(bXF|8BEPciCqIfy&6Q)LT`C~0Gl}7eZvDmnz9MTW zda}k6Ld9HNM5z)s+8Jw%&BRP?frz#|pWK=r49`y|9*-?q?ZQFW9UY?1J72Lpml=b{ za0Z0oLF*+=@dg`1{ZYQd%R3Ui@c6OrgheN6&);0$k3FQ zoIF&edJ#$Yw+`X)OKkMZB6?CIS7}AGmrVRc4v zKnca_Bdh9qc)ZUC3cP%r=u=Y>gbSGSG?o~?*hE;`rrlBV8__XXj-2rLH&>nr(U)cH zn0v{2e-L<^I$35!+g&KnxyDQ2J}$Hv4v!Z>jM5gvZtGvUP;{|-|1G?VUr-&pZ-so3n`uz0n?8*N*qJ+8%A?Z#HC`E5hTg^^L~~eKR?T z%k*}6X|*aG_puLT0AEAzr42Q9>rq*FyzJ{Y<=&WmFBHBBXa!mmey~<8A4|H@6LYCk zHNwGe>NafWiws_8AKxcBbonmGVlr!bN>hqyb+l?_%z9!0Q{onPksotTNa$0rw~LM{ zeDR5y)M`+STSU3kOk7Jq0jm!SXEe?~Y;!i&D2`wc}zH3!v894|bH<`U{j+jG%vnN%9Z`A|_KD1d&}uA1Sc?|nU| zt^zm!F5pLzz90`;fF#I^%z4q@iYr84;e~~J$lvx8br_QmoE_5bLaSeYBwhZ9M@8U) zqZ?p;*6#V(o)iCT`?er2PT&Z5{vV75Oy|M*`5`NOSy?pi>o&uw6W(#LM=+yh3iv$3 z0&H8nb{huSz6cAvkRP|b|4?#6AvSBNq>G1JxQ$$J<4MVw|_1zIbazqoVO1J-_yhXVC{MVe;vhh1O!k8EWo+7 z0PKG7iHyK&l4PON9Y_*$VW%N#7o9)xD-Tv+0S~1ToT|YHX_jK{7`8M8!-%UJ|D{a5|1g>@DTKlhg#fXQjxe<%kC$i%>c_vefpZvo}J`3^x- zC!iZPSHFx7l;C??@)1tWHG~t=6)KWEq|=xA|4I3P*$QwC{h_z*m*{-( zeu{1Jor~bZ0)}bsLz+L`96SCvv@kqvtW>+`&k3E+(BsZk6H4L67pVkkkV_DL_eqBR zU^DP%Nc{2mi%&v^M2HDW$tif$@t1!8U(k!6`#oXq`Al|H@>sSlSIksyELQT;?M^Jf zU!(8VO{eu!i%fdka)D2K3)?MHgzr;jKLlwayCil+r-FSWZ+5GOb+MT=?nh70RNU)F z>YwU23#bj(LEGf?!(Q9~*#CI;{r>C)uG?oi4_jVv!0XI+3LYw1VL7>Nj~Kgf?;EkO zUT4y62P}Y}T@NXWFttD`Y6|;`RSV<}hq2%tH))c(d;1dC+KFnM!D)n9CI@hJgRQip zVEeE%%tAVW?RkSoMP0wIz#L${Gq}bTn^Plytz?S>~H?R%Z%6=WB zX9dQh;3}f~-7boP2V!}_HI5J90q;WK%E}Jjg}`TP@QD}T2JvTk7GMtV_fjtK3AQE) zf~7WKYzfxo1%yH5d0QSoj=Dm?oU=o(q5$U)4md%+EkKUkz`7n_?(b{){OJ4H*qDKQ iyMpzc!7&mApIp9|{+R>o9|RmjE-<$Jj<5w|;C}!kVk%4k diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/cos-101-amd-sev.bin b/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/cos-101-amd-sev.bin deleted file mode 100644 index 193fa87805fe5743fdd9a1c02d4c9fd2d558a6c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23050 zcmeI42|Sct`}lABGDFE4Vo0)t8H`=_E!jzSV+@9|&R8p3$}USGN<>Im5|Uk663J4L zQV|s?NtQ(Z_gLPiJoW2&-{<|k&-?rQpW|cBy_~tvbnD`FVxN?L1f0w&m8Ixe zv<_~EGH!1GY(x8bIYXNG21}MfM01Nm4 z1i%+S0XT49b8X)p@CWyO01SA<4?wI73NZXbQsM2mcfIJHVW_mk+UC-t&@PXA`yqg9 z2Opz$A=KO~U;Z8&=H~oEpKTt=Hg~YKnx_RgnYXt>0S4!n`(&8*WaWh>OLpC_-+SV= z@UtiZiQ1j#-RJAmGju*3LcdZNVL7|pv%`>L8~HvMQBpMxn7*fnwkMvT3km2e}$T2ar(V(+H(F%;1OFVe|`<7hWT+LX`)>_0Tvv&4Q>1w6q&0zmS; zxUmE^ZXP5%TW7Lq;oY8FaU4$;r6GVrZ>!mpS>s)mk6&aOa1&1L=He*vavvJ-BM4jy zdwKd16bOQPNA7DjuK+R;ciC6WeG|J$eepZhs&a&C-57-@YWY*n=b5No8Qa3?C~1UFYM)%7BO!rM0PwIR z1O!e)NoGb)$w+Euf?$L*5O=5gQZdr$dHQ+~P*@MxAuPrp z!35tyJWk69(em_k#$jLw52}eGxZ%5qMH+KIkWez9d z{kCgKC;+l>l5GGyoP?G%oP-3pq(c`dqBXbRAAPhtbNsF5aV7Se1?_43bE)yqxt3X} zA)3iO1yLCSlVl3_;DzQ)4?i*sqF+305l-f_^RBTBmzarxFV zql+*XD)FhqI!spGeGl)#LSK-Ol92!;xo&VQd>eT0cQKNXtddi}$-oRQNIXDK&PxvK zkX$Uj+VbYzfwRFwXI@d@;PtyHw?~Ye?U~YL;(P382p1+6-A&F1=MDXJ;qON}csob{ z`Tb58Tk9#R<*`AxHS4n-4`Nc`@1M{=4JfANpO$mm5$M2_>XAjKz%251I*8-ZWP6|W z}O)BO;6X4lCeCGzFD{pyFy>6!a)!0bO1 z7nJ3_OVobv-i50aKi*6^aOz!yc-mZmU!;mL`$+ce;>(?(C+Qz0@7HL~qbMoPa)P)j zLJ%3`rvpO1`tDAwBAMypQ2A`2nsst2b2)Bc-X2bRE&oPw)`*gEYyTIKGjs~g5^~jt z9&!#eG%X#945;3Q8VVVAPZ}j>KuDmwZcPffH(tyguOQj6D6=~-zL4NnQ|ZQa+CI7A zd(3&&8#e?So;vn*f3hmC`@Pj&CUi3pAX?Ae-#ywbc^Gq&K4sF(Ym)T*DV0-m$FF|~ zC^0i~G=u_;s6DEej*Ix|x?p$cI!+$JPWK$&DX5>d-?Ug=gel#6Z&|=?r_bBfuco?k zzcddo4fp}(HXqc+8<^7tpL@Rt-R4=TAA^n;1Rd=<=oo;jW`Wqf9WNZVPP(0Iq$2`OBLMA!@^Hrdn083`ceDd{;bH%!a{r2WHIBRia^_A0 ziZ5;hyDbYN)tlX{mxX!*&!krtx?o7|jV?a4rV?(rsG@)wFd96WA6mMy_pB)(ftM>! zIG4HC=Dm%PVmQ{Bkkc8I@RHNM^B7-2+@pS-dIqCi$u7sfJRM#3RIGW6pC-$Eeq743 zF0;Ah_P8ElP&PR`QQ*qCd57AG_zX%Bh9YvtB{GZPujHC=Y9{fEnGuRwtY!yn&fZ}! zHQjSp>jXzn%gBu^vqLFYmkA+BSr=ANGuzb1lnreSjC~=mN2PBy*aVeR=e$DTuT?pX zebjKHn8WxuUoW~DhagGV^KvH{f1=od=*XlS_riP5cF0!c-Qv@Xt*FVu{2}7?j9J)f z-6G|kD1z;z;Bcl0AJbJb=Qg%GOZid6JNoE>?}+!y!apEhg1%eKJ93$_)#c0KQlD>% zxlh>~f)fQWv)Cr5y#`)&wzN->hy$jD@w$lu}4qr5! zgatnOOx}jPn5TrxC(ryiFwr+qBc9j)EV|tOl=q8z|63s*$1*V|&WsB$ixHwEN#9S;K?8atir(cOvcrU{9u)Y8Lj@UKx0+q#^M7YpA?!DMbeo=tj8KkKgn z?|lFEQDwPTlJOnAIxjuN>%Gkths_@wuaJK@_T|V9%6qK(vacw|F*kDS9PG8sP#qJW z;*P($X?D%#9qSZLoA7PUr^xN(bD9Pxje6~K+`D*XuZ#>0r+rVnYmNGqi|kAqTuOQB zpO)#-av?p<5CC#WpR>m|Y_GUH&T5DEpjDEK#;a^;Ij=$N7eLjm$q@?3-GNCQ4f_&8 z7Y*RbeKDr@1EgdRi2jVyC!4JV(IccZ%KSIi4T$jt(A9I=7+NY4&o|a_xR>|I$G)Ok9=3;di); z{mHQdeWi_Mega(sy3a>5lLub?b zm!VoGh3P2MYrK(Km;s&H^!PKqvR)s*oJi79di-VT>IrpNY^!3psf1%wSHzHfN0P#P zyK8FQg%aM;`7sE0Sk3hNVbtK+FAJKw&5fqd^27>nP4jX;)$iAJ9VWvj zqPT)e_5G9`aO$E?o@WmwVgL2kQTMUroYE(7b;b+m2xapKpNXuedrKUz4s;41+;^FI zb-%+E?W$Bh(1+-k+`S23d-sC25IAz2w zrdG>a+a^rBN=acV*&m+8+ZpO!cm4F7FlZ`rQTGp_O;^9%`|#lK0jnGKbIu`bTGY*U zL!b4I(*|2~=u%ql<@*k8zbyPCwD~{uw}|~bJ79M4tA%Wg%spXQ#US_VcFWgdyKXIa zQZ~qm6yzTDxSJr(_O?VdOHgU$T)niP@xtqt0Ea8&GYYiUr2Tn3B9+IrjfGC(>WfM= z?l4!RSiE_xPLj18Kb z1E{ofwpFF&o{i9=NQhLM`sjE-{7LU#{#T=`Co9XV3!btqOiQZBv$>S<11{Yd^K?d}Vhi8|jsh7(g+ z98;Ok10pCt!5>Tc`wzI?#t+1<@WV`WzJ3zaI~&Qe>b~1wfK=@B*VaKuTIKr(bAq$Z zdZ+0fs`d1&m?>)B#kb*I4&|3c+G~$$0E>HlPg!!DJx4KlkHGir#Us-h#@La10Wzf4 zRD5gNn;p`3gmw(!Ei1Yf4k8a>siIhbx9lwQv+=2V%OOf_6i>Ma?MWxTAnQAOb?%AI6F#cMwQKq zZ;zcHJ8dcRVLv?V`ntIpb_E_*82ZC9IbjibVPSvyT@U|e#z2WeGj1B!Kj7wGwcr?V)Jcr#xhv|shs?j+;j#}G;)yD2 zR?N*}a0$c7D2|mMAL-IEjJ-{2%Z<71He4;5PQ@}7Oj4Z}lSn@Fk-T3hx;tKA^zq74 ziw7c))A@v9VO&>CKz$L^(Sahnf^Dx{4IV{!5^m0Rm);(2X)r>~%53$f-Q3{P z`5$u$^r(?}Z*pns)pO1-53Oppaw#nOKLjQoIQKf3*nVnJevc@kLHP}$hz8| z)h&8dz0uOq(_vCFwRgQR5BVf4+GEF7-lyeRQ@z8z2JsT8&9yJ7kQF`3HlJ5FA&``B zgMD^2jz&%k$3lOnIYap+L(2oZxS2p~&G_CGe>?B?3(pH|95tvWNIyt<1{vJf7=81u zFFN{*%9-c2&DR;&mN*%nPP0-%ug%C$qZyse`Ci1@xvD&xXAs-p;oul}10Vi|Gksu1 z_c3R0}p%u4XwzFEFFtagmiHS~I&bp9tFkHO7t!(;s^ufugx2*>U;Dm&1X}ctG zvwh6`g>}(`!dc!|`KWeK#_lydB`76k3>E28pFv(RVoG>%FQHlf#zzr~={W7yaBdeY zM`wX^ZP{TyI})4Lq{ovhqFP-FHA|}HI|sj(WQ>@-n0>-j4xiA2rDu=6Ei$pKp_6{2 zOqbGzr(BVbyisZ~`pViI8p2IB_2lgXYJMR{1<`7sc$iLIVtC!P-F@ZftIEW9zLa0` z?ApCDyyu>Peezatk!^tMHK>36ei?wQAG8*0H^KEJt*p24f%nW-aQ#GIf&R$-5B-Vz zANrm9e^a4?{!pQUZdIsYM1=}2DK3pb!lfjnE!nn-i-QLw5b%uyKYO_T=S2J!q$;no zY!mPlrnMG$jboYs?(c#dR^|DAVLwN%-P^z%LH)#z?Ex*aAkn?T^;C{NhHW6-=%{^5 z%mryXV4wF~AGxZ=QYIve+hq=U`tGMA+S9QmZK1e#cWwrx_P~U%wI2*DcBbaBe^C7@ z`TFuT&CIcJp>2_hi5dpI#U7FtN0N6uVLgz9Rx10TaQUc2!{u0Me4>xmC&4?$Ml@m1 zr+7x^Da;*PPAL*{c2PJ^Lzqkwf?`CITGY@Ym2*ME67I_T{inJDF9>lqF%Rf_M|ug9 z#eUglB4`GuJ}%$muxkI-r-|;!SsL<8wfN~FaWySV`a^^)UN7md50obKmUuT?c+aDUGrO?K%Xr6W&4eBQ=ueVI2vUH`)pJTaD9U+(+ zWum>ar`VumvFe?s;fYToH`yfRdquXVZQq{p45`ySrfqsZGh54b#NYFiWk?U}b2avi zOc&cwp3shVQeo8#SHtC6bXJDl`=edUg|dQK=ilxSsoyzP%TT)*vDcI51U33;oQX1{ z6-qRD^{v=&ex=vJS}~_1EDlPQ>~ucHY6aBKY10VO>PXkz=lrtFoW12?i`+`g5RNL` z6VG?`=Ls}cMmp_UxrOJBv)LPPl3Z?5H8I`wsu?p&p&#E_vEXO16#+Xp5U}!N1WbSk z=-os>;V$ni*{f)>tqAy;KJag!V4J!N^yj+EuW9h#B<-)jkjc|~A3Z)vJGm>Y52qQQn2o(ySlE`v=P`yTJJ&Nd zt}feftn7mFNu+5m6XK>>Llo!jK1^my!MqoF`Qr#}hPF^3!O+05O#aT!&Y3zffNyEG zqVD9!bHgmv#^Vp<{JdJEAv^jMLJ}4EeRe)8oS0%V>BD=(U~7;QDe*1J!4`Z5ANDl9 zk5@V5Wqo&7V@r|^YPabt^7FyZ`62&iAC8C9tWUHF*tjRJ^8m?HRtg?A=VQ){nq&Qy*LUG)3XI#Ra8@ zfi0xF;@GU-eFugg7WgF?j!`h(e_ow8itwX!&?!#=-t_jp$7%bhsM=o+J~%DGX6~P1 zDCg%5A9vbcsYN20q3nX!F<+W>B{_8oO`R)NKytC~z}b%x8iV=-v3qX@H3jZH9cG?? z9M@OK9EDf8tYCAjYft$zeWSOOoJ-l{Zv!71b^R}IgZFmPQ=WOv?npU2^!G5eWL#)?6 zkHDFaeUI$#5co3L_nkSwM8fkOPU>y8*8?Xa$V$Y8?BGTW=Yk9m7L_=Srw_ z^2=gRl+AaFv?vZ}Px{9^HLlZ%dqct3#8l0&6AH+xsoY@O*SEK|tt@yEfIc5YNwo+H zCzxaK#leqDR7fryW~;dA-7&pvKT>>QNA!mc`m9BNfd1``XpdYaE4xS6?hb#-D}KK{ zNTFkw2vZ*faO1*f)94-v6Oqs2z5m4^To#e8WxUTIhs;+VYe>2+1qvA7%odr@ys0In zYd**WMKj1J9zN?KBwx^7Y+A}tLX9sw(K{~O#AWby{Ajjyj)brj*w(Gl9yH)FV%n5! zGs43FjQ4N^BR+hym|BQGv=RU??MVZtI{P@hA*=TLjXit0~dT-jy)Y) z#O=KL1Bp4N6pfXd_eF8@GH>Mts|n}UQ+=0Xmk77gJ-}MG%1ewhBBuT8**_vu;9wvU@s9=+bst~`#{Z}Q zUf>_tGAbsZqrUp++eJx(qRIVZr5KhRa!MwEr)ZxhlOLJJagUg)PfoiLA*N4PUXnU_@hhul{mJN+bjjew}CWlBT^jAnMCu0oll}oRHrB=7zm)9TR>judL&B zpuj~FiT09PFV4axQ{qAxqU9BY@6HED-B!(gcyfMWX|yeeFDPpe8%0g)t~-|Y;7e5^ zDCN)EY5&7^BGx432ivIu#yaT$Fu((haB>IlmmL_ZLyUQH1Vq5rJA&UPC4mAxDr9S6 zJtQQQV26;gZeRQU#-#yb%k{5PhcR5R&^tjt%5J>RqMSG$z&WxpLho&RqJhYtQfb(0 zQbW!!{b+pQ;~@y3=l+< zK9_l+-bqWI@$&ca&OtmRLPKHaY17j~1NsM)=Ox{~($-v-xeHUvi1!u%YX#$Ia99s# z7%|jE#mftaMWYBI@ssRT5EqvZzReRd` z>&s%-c#>!F+i^%m)=@jr{Zvy3EB3ZfJt&YtXQIuPY+ln9BEaP_FpIHS3ZKiwDAKGB zWXhVA`>WGXD6`93yyHSMzu3!Q{!v2%yxCh9P>AE7n277X#6(;``MpI?{`dMX(f9f9 z3Pb$)YW1)5`oGtI|3EO`FPC(`4d(l0;UBDHB>aEA{!2tR2+$3crlH+w_K^tTDzl3~ z*q7Ydg>YwDLkLiZX|*v|L9rx5GroEPWxWOMPvl}gT6cAd>xxiyYIQ+@{6}Za-F68{ z>m4xG7q6|GO`m^s@%5q(ZfD#TJA()Iy?Xk^HVk(TIuy5g6w%Ma$sNHe*P?b+j7^EE zv^6LNOKJs*h%KU8O-$zi*xDxV`Yv!}W54H3tp}@+Cd)|&XVY|4V8JH#Lcwyx|DKUg zphWAbRIzQ_@dzKSgg`~?pw_XmnGY!;1ZQ3G+=;8m!;PbCKu^S4K`=aiv)Z+N6TlQy zl}$lK^3Nq3A-S*O1_dfN_FU}}KaoqLdH62h~-TZ%_Qw+oYq_3c>QjS}_VCA9ECzr*wI|c3sa<9Y5})a4!HOxdim6Z`8lu z51SPj0|wxq>7TBDYx_O+g&g2{rh7NuGPLn<*2*N%vtHw>!FSyc261k-Uv*QYe<|PE z{^?86C$q8od{MEnNG&Ud{Xh@-+I3g&ulK`dCBL=*&(*)R{g;|Nj0PfcIZ-Qc z)dNbK8yf-`1LmL!ZN4eaznlx;g_^k+`xt6;f$Wa`9r7$_d4*>Tnhg1iA)`iTlFtD> zWNX)6y}v#W*FV8$!x6E zhYH^baHfa~dC?4NpOc|LM_-@yclWhzC+o1gc{_FCe7$jdHdrg$i%WIHrhWKGN6h|_ zLN~U4?SLRB5dz;N1JgzyZ9W;d_8}=LIXN7Bg0A1-rO2oN*2~8_eP}3MQ;wfMdLiq7b09zv9>kdxp>f=4tC2FcC1Gj*_P7=~Roy{!~RRH@|KuU?uZh zw!L9We&yW3dgWWJbqynly-PG1j;$Ziee}zU)BIy`wS(?>XhH?nRnYfzB2iUi%Pw3S z+`z)-dvR+*0}AUIKu#|6!vX0Gg4GvnnF!b(6yOH>BZ+S(ih}KP0=L%(=J)sHZ+rSr zzbN-}3-!BKIQ~w=L{dYX|pN*#`g8aAVs$O=cZd#abLW>K_ouYYClZp)LPzbQQ zmoDbmfh_VNRe66kF^4_--<<7p#lCVT)1g%MNHc#81z1O3a>HLn3~wuU87YzNgIQxQ z44$B;6mFntRMiMN`zC8pIbz6IwmD@vQ70Iu05F2Jiea3vVh-R^fS9w7uY)Ms$r&I% zZhsS|ls)2$QQ2X?fiq58Ru#KvLqbLTA;7p;7L{T_oJzPUHB4hy$;54%xi4Pj-5e2= zDeWdv{Wqb26qBe|Lz>`oW=y5D=?drY4v(~@nbbOR4@feQMaLpv{=j?n^O4Znr-UdB zuY=PWX0TSG2zF?9M>&`y#tG$%Bd92fZxJWAFO51Us9WUjJ$u#Ou0fU;Y*2Lwpj5D+ z2NSR4)e7oM3v1Vo5bDl&IdZR4&#JP(qUs>j847$H*s0Q`@CN;k;7G=wvt#CRdcy_h z)ho|)K0fh_PmMZUXpIbGi!`@VLHm-&w6w?kP#jf7i7n#P4Rb}O+<84IZV})v)^)^* z|D9ka1V}{4xKp(^+A~FeAiR|j-8KFgZ(POLYMp=YZV?o??UkxiVR=Vx*2(%{ zLab1J-rlDwMcOo_H$Iz%zdU)Vq>AK}z36GHvH7aN^6raC7kIzx9cM3smk-v{2TKTq zxj4dM;xOW_$`;w4U%v@aiSK+JedehxAKGi$X;9@A1ZZw&XReBW8WtqgQ|HUwMBXr; z`E>6w!d;o3DFOBJQY9!*-gQZ>YrloQ?|{8ac|5X5lajBr>CERo{;Ubj7E_?T<_* zlhmSPV*OD$KJ|3D|Fdk8YqF_skuCAH%l=qscO5fnf>wV&L7tmm843YB2cKPSK2FJf zy*P3Hnk>=?6_|X+zt8@3!FEnr*h+M|((I_j$YTX>h;@Tjb z@EvWpg%hsDwkOZq&dNXCelTFDXe@;FyMD8RA&@W;903N0*=!N$yrA1&81=|kN23Gz zifrB#&QT)~5I|>T>8ecvAE}HG>KJWyQ@3U18wu0ol_9)MP{0G(#u+HE@>!;XVG-e6 zcWu&I;JQOXg#NCt*;ig)S_yBtqQ@>Mbmt0v-)k3l&n6OnS_dwMShnv3!ea=VL;ZIn z-9SCBpul)P+MjtcwLeyhsTRjO2m$&FQa*WCHNF`*KKDuxaj;km{UG{e;XS>NroIxo z%AYc!fa!5}NsPq#vQyl5+PnDSNio{EJoOM2_lFmqUrNJIQB|k64F~NxnHzppIVptw z7VqyR0^gU%c={3);amFXvHiKuw-R%aD`9VhkJwY;y0aXdAiyP_NSb!v1xCG^l_@D> z^v%{w-n{*To;kVd4)^qe!ug;8Gwby|={R@hzC2%t@Kg-+vQ+D-_hULkWEN#{eok$+ zSGh(?g|~Uzx>gS>35sIAcpotw)`3`nfN^)+%wa^}DXw462i){WVF@rF zPnd_N4+ih+jsY)B{7nHr3{FuRhW7Npd*U#P1VSL<+Z_`)439zk5+|V|%F7GoDL z^TYapE39@N7=ow=$_r~p2v9`8JlwH%{wM<4#nIDQ5e`G+-9;U-c$5PU;|QL`d7>P> zupXkA05s0m5u@ma@$tamMBF_ceZikKSkLex#8RNdYenq{K3HdG@TU#dPm1EP&UP5^ zmoR+L81Q;9tSka43ZBA%qYKma}!V>-qB`PVS#@(HJEI68sPX+@4 zBn)=N2|gH9J*P>x2b=*yC>``~nG% z?smk^A_R(Je0)58>>MyIC_hkvP?UiEcFG+UVCR7K#4Cy*zB%fM@dM!n!W1OSTKXAY z*1#eL78i4L7lDIUP~=6x{D?u1DFq7WtcZ6(i6f;z`8)}BE|>sEtTP4=mXL9jl#r4@!co!~ z83_kRjI0b2?I__SjggjhLP<(WAd%A2k`fM*;^LALV9+=kBY{A`CDABJX@o2q=?KH4 za0EpM32_MrI6~4v%1Kg60wFE#ghojtWl#t-5+x-qiA0H`WiUt?X>kV(9D|TXV#J*! z9VFps8F5*pgE-28_ji-7fE(X8(BGe{Be<+|DFGg7@U@!~0@RnJ`EW>;@HM12>85KL z2KfcaPJBB09`{CeAC$X^6f_Qu_f~oBMUg@rb8k+_(27;!b8&*LRZr^_JP!u+77nZ) zKQ(&lGj*buUZ73Jz3s-9e{j!zQ7YXEbJe2?AhX1--?ZMw+Mf7qPa-3yOI9C*V@SF4j%^sa}2xrQHh!{J3A4 z%Cr^6G{RqJs*)|JrzD&87HUa9{&L3vi=PQ-E1e8GnQA3+plOxhWj&>`FHS5V+~90b|A4>{y-;| zKSixQG8B>x0hCkUqqr_Ajy-7$v|y28pXiS(B0(kNOH~3Jj9GRE)jeD@MpLji?Qty~Fr0PO5*(r)H3|_riSUhqis+#1+#U}Y%UTEH!JzK3r(7Zso72Ad2dP7874u} zbY0USPl9^BQ^@|ejIjU1HrT%h{eN83`diWZvx*k*y$hD>kx96r;Qc|(8!75%JlP+^ z)#ZqbzS+EydMqI`eF=G$oZ*eVdz^J{ef}W4G9*XQO<7ar0siu4b(A-P!&b8_3&pxh zUwVVlAUB8Ad_rsI3J+sooZHE9#EnC9Ii8P?u@qLNpKR7-0w?+p+!x^D>bFbKi>I&3 zAvucVtjC7qJ#~VsSbQW=5TH~AMXkcz@vu2kOdbCCbhbzj@U=Uga| zdP)peSu-wOyqrs;8mjno$X~uhDvq4@@SCv6D1Pgnk)0{H3-@k>2N;>=ds!Q)!N6LT z=Zr(Z49HeHP0W6m{yNEEP{ClLI6sr@d%yL0pbq$OeDnk==~J4ZPW&*z#Q#17XgI^n z%<&n0HD0EIHa?rwtn$=nNGL#=D$U?_u{lm!0}76!S;|dx_9>>x5fh=5i*$_R~APX^a{|gSOzghSbr`8s$ zlNU5Q|Ayh8g&{9M4DbZk)Hgz4)aBfcgx@GVWFRW5@c3bF)QzPB=@4L$T+!{wiDG2J z^{NurNVyx+yDy@RTb~*fS-u~-Z(G3u1$cBJ(~N<>_6(BR{sg6`LMGugZLi539`SX} z&YLP9<Gn2v`Z==mkSx$?bO zT4ox<9RUN4JyJ_u!J_FQ+H4mFJw4x+;Y$ji`U4j?Kxx)&TX=)m9(b4=_XXxTSDYs3eVQn2Bn61 e5MQPFfmp^Ef-mT*b%gn22`(@bUo3qUa{vGU$iVOSk`P#E z=8ZwY^fX~w{uoaJTynh{DL_j64>`aDKmZs31>o!D)L^!LLB%^^@XANP#iCMGW*dvn zf$dPn?GT`Ad4^r0cxk@i#f8K^gC6OlRBwzGY!9v21jSuUW^D|G0v;q+BgClHlOCo^ zEfmGyY1f;}ZfcQNk!3}k4M*-usA3w9|5TXB)L9sT#KhgCK@kb-02+W6$c80=1@Hg? z@B@$l4m{UhJNEzrz;ir+0ZaS=#5$t@!@oEc*^Zm+M(qqoW~A0NT`39c@O+>Q0S>kC zGwK#Ytt<)^9xaZlKme#QA8JRHDCs z_$7qed^xvj!8Rzc_jyF2`TAzCmzyyhOdj0NQeE{ehX6vI2|R8aI|jpCpr=m2n7HSPeVZ9 zG?Zi(2+{HKa>Zd_2M%b6A$Z_i#8L<&i-y-)Wegr>y zp{1<{GsYnaAR!N!J|+m}kATCuS?MI;a5=aPLS9NvO3H?nPLg;kwQ>57qr^hk4Y1= zWToOAjoaKBjI>)7?ARO+@jpCkBvkEWjs_;qn`FHy;A7yAecmd6bHRf44B?^OY;y7m z@p^1MY}=Riq4@X`PQ`76#D2;L7t&!SvVNvReT(xM=DDcnMLvnpw8JV~O1MHhxzR zcN!?F6|lk0+6}qr1DI3rsljc}0!wKHruVt;2y$jR<(WgL$SnGPI+)|hySqJhPqT+) z1_;<$_A|Oz*<14DpO}O$xOpYBe$jm~bn9WL0`sAF!7Aj-^U9hBE4DHB-herMC@m^4 zm`v53^60=-N<=nM_N7cVN@UCj`p2l5vcJfkU3|GSEPC6MbY-ok0*bQI92dwTB?#g) z`H8^LuYP=~RU|VV9BQA9)N`UIvX>M47M$RuR|{{H=Dbibz0)3V*;z`kprQxJkmzV84!}Fj@$19J#L=Qe|4Q?$D$lxP*O3$y|&Vw`-D?^=Kl4bkbx!WxZcL$x!tSolJkUSV&d~8Q0(s*7?5z}YVA6*!BWo1v6IUwn~uOj(O z_8$8wdlRJytScd}JvjL#r&Ie;{-VSuy?PA{CS2)mN0*+BE_*4}zW1Fb%N~xDv8m5) zDryWSH+Hh(niSyY}N;<3-`|Y#tv0pLY zeP8DoM_0>>8#xx1$1g7vLep~2tsrOUHOEwq9gIxavA%m zCwG*z_=3xF1;&qK#JLudd zChNY8|Z?9;=JLGSap3a1pGk%oZVp`J&xF~?56vZQ=zJY?MV{_d^8 z!@};0(!+Y5MtU@kdby)~sqE&-si&xAhuGj>W1Z51NpapNA zdjF)d!aL3Mo+Ze>l2ycn9SJRzvyMl&>&1^6Q1K@2S&EXQ6NjbrR>_z+J*$ z4|i;EmUXzJUxPbM_1^(G>2E9Tc^#xbwBMR~ z8Kx60LPwcd>m#j$>C>CdOgh;u@BMMG&fA>Hy1sx|A(MW->|~xVE@p5+Z#^vuAyu?)J={9 zpA8~uL#*5MDQ))fe*{ zY}_YWlz+tYezFAH`!e+$A(fRg4YK~GpWd_tI$t86QKYpa?Jd|PS{bQpDx89AC@Isr z$9(;`_1mYKBst50wD=FpY)nJ1b9$+#pV(;Zx(2^9*|Ku!j3sVh*U`?|0C<1;%88mv z<@Um^hLfB!rZkcZqs#AYj`igq+rc?KNjdx=Eq*ACLdb z%5IV9z9Kbi@6|jnGi7Sv(ZMZoZNC0nXzO)}_o;xKbF5aEC80IA-rV;*fDHo3H?A6K z093kp^i>)8Sy4I^$uSxeAJO|I2D|qNydEWm0%=D0oE+~C_;LDhAqC^-s3&jpzp!_| zkg|Py3icq|!-k&{AHS$Fe)G|eGl6UjC#sKw_J*y{wkgbc5N#1)B0^i>Z@?{c1Ne@7 zAKctPVa|9R+-QK3a~0)hQ((ngQ7!bp4r&`ZEQArF;fD9}!1{R*Ra90u^E#4k+k#}E zZiDNYm{+hZ(Q;+ig5P zk;5^OJscQCIR}3#6A;kn-t60#up$66)B8FnWRMlZvg*MXAV@0y`Rkp2NJizo0Whf6V|ugI{5%oe5`7hV>IR(-E(^0#{>5Ek6%UzTT4GXVQ^Y+f5EMR7FR2V z0-tK7NNG1em!#&Keps(6R_+TDP?!ebK$ozNUE#0c;V;+h6rkqGLeBJf@U$yhQaiSM zR$_a?!q^ELxev*R$;6@-WX?N2@8S2G4mWSVhPx&97r?r|TK z6$%rQ=FnbtC5_d|mo}#ozRxLKncw;qS2A+5Jg+;1w{oW53^LivP)D;5vn>Di6H2t; zoz~67vn7ck1uJO77P~WMP7wiC{`<6H6(pY`3Rwhb>bcW8V`#1(W~C?TL;KU1MPT!pZP#nw1iIbw*(t#pr6qKa${hNbSi2gSc{=Gdk#oZ^T>9 z%)S+osh|)a-gf5FvYG8(?t)FuJBDA+^L;RyJ#9IVWgqh_)q3HRd{UACL%Iifk(g*( zSFDLWW7Ktu+h&mv!_qUH@3b9NC;3-LzQX4Vy(<-RBU~u(-eqLrC!f1Ffn+;0j~W9E(b2s30DHkBsJgMkk6GIl5LBlzT_;k>4u*4sKVMjhUT$xI4b*KD& z5eEsNX>51GZ7Q*|Be#%|+a7%`s7ezTo3@#CBjsQ?-%MXV-5ht|-NgGl2m0WIUov4z9(j=5q;TV-D8+Q5?wtr8 zH!Meck!xM~L4HRP`#Wh*->r!0bSTz-QLot9|F!J&3yYE2L8c1$xB)CPcl3RUnL{m| z>|0g3aX(kRGh6U7vHs1 zalxyDZ)Irr13{U;u3vOIh;J3tnhFrJ1kvWQb(2?yCt#nbU$Mr)gd4?FazD$!N zPA&20WF3LMKJz`~>RMm2Avrv5^U^2o&mGpCPAF>)!%g0+2|U#W6S;c#Kv1bG^)9DJ z)vwd9Enn5n9(yHBAET72Wz=2jDP?^)ea9f{{xp|Mb8eO2ULbs$S5%Rbw(9;kmv*h4-v9uNqlxXFA@Q|d3s&c?YN6-dg->vXN2ner`dYxms<`1)Tbq>7<@S3v;?P49) zU_YJh<`A|ktnDtTi2Aw95&K&7R)#!!;|^5_=Y+5>yx$?(uyd@Ap>8p1kJqka)Tn2P zW~z*~NU`+Q_u@l^mEH&H#9a=vIIC2$)8S1uil~QaGYGPp(ueYg1>~7IyDP#Mc~qDo z996hMugQk91R7fty}LU3#b+YfoQyb0F5Xf%Gv|8Ugqfu?>UAj zKhrh#N>je^X!$wSXle6&CPa-zV=QNL4<@^%Xu+Gj;%SsFLu(k2Y;1%sSGc#ceWqR< z;Qumvy*~QmnIV>H(^rr7`Fpp>LU!~hhNdbB;CDVR9-m+`>+$uB$JR=ZA5Usg4YB4o z`mp=vRFaydx7~fNn=NVfNIvt|t2|-a_RhdpR5L^pri0QGXA#)cv&`N=&`MX8u0Ho|DxaLG)A=4S)EHu~JUgz~ zY<*7UaZn2>S0bD3RomO@8)wB9Cdx#|E0*X3cyols{&;G2BQCj_m1n~!N`?Uoh zJR4$Oc$(N#%pB{hc2Uv(Xvgk~=Y}TlDLKF7lD`kq;;4~xCY0${WZ@8;qp{6NFCL~@ zPAz(7)#*LoThF!2m{%%OV*gzEL|e4`8*Urx(c{I6&yvWxI^MNiiVdw=Y-?kB=si=t zuk%ij<5awOa`m!phWPyIE^Jsi<>&|3dh~4+L+*Q4n*#digvLo|1!s%@muc1M8|+8h zPm6au6%aTJu~X8$ZGubhIy~k{tBJ-SA{G!$G2}oh_I}_SEm}bnUkwgr(>u3Kv&MWO zz_1E3ll-FipsLkQ(H5mX-FE@;&rIv}65mqr-(sp}*a-#XHPmjf?d{ofr?os}5r7W& zBV}5IM3SvAzNH~g%hX8D9b~&+W>p8|bqZ{Q=syH=;fARcsxfT)jUu zS5P{&Jy@}gOO&Yx0=RSg=F;dN4i{C(;eEJd6d{ku)G^&_lt<>LfHfwiKMn;g%yfAOUR>`%=zr?^?E{ZI_IK;xJwBMkD(SDG7YikuOb%56y2_NQ@va{aM?0n5zS zyjJ~I%d0)fmp_pQzaDqJlhSiB;S1q*rYA^sE5F1zBVtls&;AvW0tW+;h#wk|)xCfP z82_UNc!M9XWmHT+TSN7c_lr_SCGV8Su3%X5$SIkCT_t<9nf%GLB0b})=3Mv?p{wLu z+9}->bl9bn2fpHP&V*jQ>>5B;%> zM@vk8s{0O!cY2z@|5sD&t; zP;1;{R!c4*`{dQ9kCqTX$rXQn(eRPq$v)w|2OL+J=j-ryjYCJhgv&--&ss{>LV|>6qzcB- z;IN*qFk+~SnzuI&i$W5xUY;-)(Ao%7_wpjF1;=<12gll|{rhGxv5)>9>O|kz-$#AD z&3{+hiS7RT+D`GeQU_=6-`IBInmGb&VuBspz+x0W&h7zYuCL}!cI_vpw7{UhPoI^m z>Q1!_ocGSvjamc2F101BL@Gt*^Dx2o+373B8po5k3FiI~sE zDABC;Wy@Ps1ZdJwsIn_qPjaJ}NA@sSebmwdANE!U3UT}s6VdNWOhgCDZ#8=IpZ;H> z?eo7ChWPv5>L1DVKmEUdAeirmF5O=T^Zl^$cl;R1|Hu8mMCb+qbVH=+Ji-$5aqogs z%z>oWjs?U0vP2&Tgu=i|Al!mke*h-b+?;(ZY5BeMy6VPGBN zcVtF=3<~DNbVaF^J~9fglN_Xk?bkUv*6rGRBtq4QHKqNQcOUnqFrX`HtsWR2ze#rO z+zc=WMP+kPko35*V1hmR2AB zn$9W-F_6&|Fa*U_wO?QOw~t9js}(~OhIHZ;LqFyzE>DbhCQl#ZGb+o|=6iZ{CKG5nF|oU-Nz&~`hhO;wfn9w z9R02HPb=87Nbaj1B$Fie$%1r57ht^p+*cod`}~c-=Wnpd%%8}W{Ak5=bILU$Wv`l~ zw{tiY1mDlIq|!x)1)PT_Ky2jIRo8F6nXjJ#psI)geAg6xfAAN*S^RJ3Tj?8|J6%hn zzdt4Kvd+9y#7=n))%9C$=9>imTl962ZoBl*;06jq34Bi zKo{BCy;mQu&%^a!aBWyq;6(v5z#9A#ari$Q4aEC_6gF13n^R5p$F0B87FRBzO}alR zn`pN7LV&^IC+C*$Rh<-E|DZRVZUWumAyG+c4kC8@Msq zq8VXEKiX&cv?JW&<*H+3=e&YPx9JB}D4;U7+tREZb2;flw1AOq+vNR&qOHf25QWv_ z?fYu75~CtVAQX4@JA~_rkj>J)!xbrjJ@b2-6~o5(Bx+XR7O9__)K5+7XCy7SEoN<7 z)cQWJDT!}q#+6A%(Y;usgKxHD)K7I($_Ig6oOTmhns z;1|BGutzPKlppl(JL#fhd!27KG)y!A0=yE>p;9VJREsdDhG}t?jW^TGFL_sVazs%c zziSrTTLT4Tn8dsrGlYhjF_p6BE1W|+JTtz`oT?}HgroyGbSw%Lk9<}?9}cT~Mu^4m zI=h@?2B{KRa71~a_rcH@7o;DKpr$0Tg`NDK4C=h#PSN`hoYcEJ`dLQUpqdasrRb9Z zOrnxkC%7jg{H|`4aOdflFCMfT*j5%-5LV=HcJJmWA-=Zc7XflDk9Wxg*8_&6} zUK-B(IOv~rD)wNpopd-`jFqh#%8xw0-%5O>`1dvD%JSOo)iH&AQkf zNKOzgEZFl*twfjR%8kz!5ig@JlvRR(-T@z-Hy-PS#}a~I z;G={|z=)@6TX-A3Rs&H>YJU@V@|goa%6rArfUCz|3`h6szuFn;3e`5A7 zO(QNoApn_&Z=lQnpLvs7<4t`FZ>ewGloOzx^~|KnI=#IF1s(xaCZ%K&`36on2>ceLNN)mCu+v8f&Xmt)ItOS{IBH zxu@&?>DZxChv>5ovkK3)9|#;M84G3orr&H~2x*uojsSzh?6)v*x1jQYh_w8{QL zB{m-l*Vq?P5I}F`%Vqmyeo{GMntSQZg_VewO9t#h!uKw1>v`km;dP5dfYzCtA%X21hI}!E&7uCA zk#3|}P*h~9j0#|Wcd9o*hN%w6+YbSHi;mCvRNZ{r7dii02yviP2lXf}y7+;?M{_?( zebu>aC}1AxA%&4VTb{ym?{0?xJS|=qSD+cH=JEKv>q}X93RQJx>rn9S==_Mws%fF@ zw|Rfd5x8|4~=?=C7sV;AiG)g2YF51?A)SsGmfdKC#89m6(46CVm`kW&# zYIPnN3B{ybA6$qn>3z|XoEI~=!&lfL_!#Wcy5HKF-%^XGqJf-#9;laZIB$fcf zd%--t@EBh|4-9zV8-Vl%34)u<{V_NtS+In7M?4ya^78cc!eNvMgdj6G%ol_5BThpl zq_;N`@8N}q`D5{*yUo!PLlE;sdSe|4fl3J227NIK`Texo|d*Fy}A^+h`4Fldkn&I^h5#(Iij z0#P_WG)BoCgZISXL_NIFe&AO5^~_h4SPN|WT2)5^9_#7~ZkJ!bDCUcGb;N*gSHPn% z;Qe4&d4#kWcnJdzQ}7&x_wscFmkZc>B6ggTF=&;uu+Y;~($bdG($Lb95S5UWlNMFe zlF}AcLrBSpBD6H+B{k*LG$atRv`4oLD6tVAdy%@gp@z)qamu;$=fyDP=ODmxSuhid zv!ce({LYD;e0MoCC0l}ZQ%DUS2HHIzVPy?~0wa@X^ZQ|+=Q%|l$1BStOk%&%b-vXX zA*afXqz>6HaQWn-z|xaa;iKC1Ws$hX7TZ5Epw$1z0j2(PK>fu7N?Tf6OF~XdR#aA7 zOI}o7LrO|iO&YEajxPymIcZ5rDR5N%W?L6H)_B!G7_IdZW2MWCQWQ(fZ(*$L9^kD(oj6!s z9PJ?r2k)T7i-7qPOTl%)6GL1&5PRV;DY&exw2T~VogbJtGH4BK|1FG!xgmYs2zU(U z--Fh*zxfi7c!JU<7f76|lCK+5LRtpo&x_#bh6zMtT`|4{C0TiCIavt|1`a~CJPH9v zyP!}~Xc<{&DQ9^Zl$Gc50{rjIlH(>%OGW3LqMOIo`N)925hJ(ZqlFqUySy?njN?uwLE#oZb z;(|iR@cw4@CUQ(;b$|q)vuAG0P>}6aUwyN30s`Esp2_Tws~Q(wUCf%%{pyp6zp z+lql_oYVL03#A??fX&H!ukm$9LCq~^?XkwxAv>dlIi-3d5yQ+x_o%ySixpR;9U6w6 zcini6@#3j3mHvaX_vea$f&Fib7{5%>fBfwIBMZ`ZX73;V+yC#gSKj0{lR2{Rx$1Hy zlHBa+>h(;Xt6&u7=%aUeQ7qlZz0lUE#ap~_g@g{{(UXr_tc8tEC(5^;pv^uB-YCx=)?;r zsC8cqgyup3)l*YQ?(<4xgRMc<^9Ko zbi;SY-;Ap@pwkA_-Duvmi=m1`R%?n&UtEfb!>* zP>h)n;4P!?$9xYLrIeLtW5!A1+i|#+h?tXp?WBsH+;16ct)M{EftO?^0+qMlsP|fY zQD}ymmA4dx1ZQMYLi~*4=krbHEN>n=td;wgGFVmjp~`_LOdw=@$La){@qg_^PJ3W; zv3ZP&FC-q^x3#}U^90%cRM5zIXi2fGi~P+V7%db*g=mPs{y?5X^knC-YgaONvO@?I zSWTH3OleCZeX4m8dT_e}hj4FgoI=4YX)fgj{7I%XXFj#M<1x=+LsWaKtF9eX?D`|F zQrM_302}lD=_>uxZJmM(;Uh}Ip3&INOVlGnNs zo#>PVB`?grpT36w9bdy=DtYmO2E3o5*Pj)=cmZNS_%D0hH21k5j<|8f(nw5R@#*9I z*c)H=gR)mYxsvOxP@(qpELvFiWA=81E$~4I#I1MVVapUl@B`g&XjlN2;081ELxH^d{yzc$O?&_V diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/cos-93-amd-sev.bin b/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/cos-93-amd-sev.bin deleted file mode 100644 index 8fc3f1d7de2387d6af246569eee05bab587d8b03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24158 zcmeHv2Ut_f*7gn^5=5j5h@nUoNa#rKAX21=bOH$w2`vfDMpfxj6i^UB5D}$_fOKi1 zG^Htsh>BQfHmV5n?@;bJa`f}ud+vA7{h!atlgysklUZwK&%CqNnl&2$0Dv6)elG}v znP%P?XSlu=T-y)hNkmAk6(a-4NdKV#m;opN2VekVEuRLA)^4bJM?We01h`m~smX3( z)!nxh#%z^0RCVa4`9F?KLEMLD8Tp+PDQukrn;TChoDm8s~d{)gF8GsRiMD3 zR(>YEJeZ|Lu3{%UrgH8fp20KG?jE*U=Zp{+%ho$EfYJ5kZh7Wi89Bj;(j5Eo-SShWSyIh zh#I^A^Mcp63?M7DNK)c9bPg{af9bJ8(> zej(S8>a)e%YB^hA!0zF$mKn3Ymf3WB=1J7GmST3Kw%R4xqg9fJO!GyNwjDJ0-SSxP z)3&@9x%-N_aHkAN74>X1x-F@PF`piIo=PqnL$}V-28U)~|2cy_OX^1rzzh5k0m!%P zMiVu6^2l(owGwLsE^9Mo7x?$*i&AIv9< zXFMqW$S&DByZYcgQZNAwfGn%}%cEzm>^)U>jm1{<1AgP47+9ufF{CFVHb*xl(I#KF znllm+O0gXgN)E{+CxeiYZFSs9Hp}>RVG3ox7dv2KYLB3&q7^x*cXFN{0)bKjh>!#% z6hTWxZb3oCL}p=zWI`~K5;RP7nkXFB#S8C=MIl)c%%n_eCVE3JUr!j^)A#rPwc z5!*=lbWBiPFE3Xd2EK2frZ{pZVh1S~%EYSawOSa1hZ}nnu^!mN7&P4249Sh)A{8KK zVzJQH(TAJhP(+ZB2iyP?2=_xG5Zr9^k_d!6LKdkYEiWx?%|i^7>7ON)E_FX9JGK+GrHG-Mj-{yaNcpry!7 zlNU&I)NOIAHP&fSv}JcV#Q)%ev2cZ>IU1O}wEx_j96m<=h~XB6+jACl>BI-N({XWU zBxlK(gHtSOf$3>~}ChAS)D<2y!q&2$M3lQ1DW~TcsBY zt~bA(+I#N!;Mv!dI7BTU)zP(T5l!23P!+X9`KlRY!&l~}|k-XG?CG=8_o_Ho)% z*+C+9nj>8gD_5^TG0!Y~+084CZBg&V)A|QNiY$l5535ov&8lb}EZM@+dkgOPq2Nk! z&Q!eKJC6=rnPgZ4RsZR!I?0sT0KZe}rW`Larx#vs4?el&QKE`=Lk?wOL52(TkTMi` zp5jbE&{to+_;Sd{4o>yY#u^zXC)1W<`sW-GWH)ke6=b|nHNDgOMeHoSQiIfMp{vTZ@0FEBQb=w4Ok&V9x)vF=-# z^R6|mJ8p9N*jJTA4PKAVl^tgEAE7{`p@+Xmq zaTV##{^ya77Xe>Gy6vk-M*=wQ0B1Lprz__BXeWdC2JOHkBILi6@1G%F6`D6-kEKh$ z^7AHu&pPjvR)f3kl1O*p+0?Q;Hw>h6WZ|JLwP@WXbtO#y{(+OZ!9~l0=ga{q!k&`2 z^fW=ccXs=gL$R*JtoFlkFS#7skMUoLdDN?4%ea3>qT8`ALnBLG%2gAD_vC5M!ep&$ z(i#ezUKtVx6cRJzg|4N~IaQCvo~IIH%%@;lB)2;Ll|lzW!z_6zEnHcb&0??JxqBQ% z=DXT-PjGfMzqplQaUkjX5-}(t@e+F@PbJ*y4DCACs!*QO$gdM!T9twMQ;63!YGtq6 zNX9#s58qD7=}H+oYM^Sl)70S{)h98Z$fJ9|LA;+9{tn{B8M#MIQOFmsEL{zi{ah*G zK_heEe5uV`a=8bfrX(Ao?RYe*MvzIjy1?qBen^BK&NnxEs$6WP4UxO#pc8l#v0yR| z4}A2QqDAIXjw&vfBJETESWkbIWKQpJWQpTxpXasyjX|Er(l95^zB)kl(&VX0>%`sq zCr3owm1Lgjdm8K0I_PJP@WpeO$Hgbp$US98e2s8o=x{Y%$eWOb%U3?0PI$a!+Fu*d z{%+z?S&4Uo={>_5Z$ssq-3_G&EgzdMQ+zn~<;XUwPBtTj*Ho`Cx3X)T9Ca;Ftz$DW zVQ(ufZrDw+P13fAHgOHfY^9jhF+RD!+cC?dgID3&i@~QU-y+_P+eT#z9L(C>sySLS zOIw`x1a&n)0q6lEt}fpYK}kiN%{HF_n*=xQ*O_vAya%vf01fwgGz{2t4=!~y(k@`mzn|;h*#|;+xzz@Cu?Wd z40dgC#dvK9cFOCBhX$PfAlPl(!*ZobEkFP(%#BsCyTe}KE_ z|2*8WBUsnqj$sw)#jSORE-bG|^^~?{$u?{8%HxJD`BMz90T{8Gn&}Lv%;&X7|>0X;#jo?7B1! z4uhW!!|0A%wHi=a3-W&hZ9gsiJ!tcP=x-JMdAi@?(pM{mDEUrN1?9sYHyxI4M0YeU zwNusY5xbIo)Uz#4l6|63BSTnqIlWfS&vgDxbAZz|ijPWkwq(6IJYr>GdZr?$akcq{ z+V@yWldRr8)`Da#1<>I?EU_~`eVx%u^Zt>wCeKa8ovG&KYv~7YgFMIXPx~VV5|__Z zmZ`MocGaHck~O83nj2Y~us+eBePSEe`zfktoe5D-6Cj`IvLc;^2*O;{Tv;4NN2W`5 zRlt^B*|ajpa-L7I43W?I?3k5y{kf{r*@yExzudN*s~{82-*LC?yryAR_v|5 z7t%Iwli{6d9@hL+_^1WdvDqB|f+j$1-bCn+UKW6x>3^LOHavHVb;X0vUx-ZN^Vd5A(3G-weY3*T zu7+o}I8_)L+OSYoO~tkl+z#XxpK{b2(FPU-eNS6+o=c}3?Bos>CS}Za71(qHZP2Fd6aEUjzWzt?`vZ+|yw7S>d zm&Yc@%~C*#8B1ulirdE=6`|JUa1wKqewcyx;h>$}!8 z@u^S_lX3HPiEX;=i}fmJ4y@vY8*Vmpr8U%P&M1nEVroW5VwG}2tRA2lt%*_u|l zj!PH5k4vCMjofDgmnL67Nh#HEu!G?q585CPY@gy3HH&kYCE`ZuIE#yObPT>M7hC5MBcHxOXSyu{n>h&*jvN z2_@v(VTZ5B(C*R2v2MB7a9-^tV{@NF%*Q}%)hoeee+Qqt7oT0RLu*ryk$sT$I&Azv zd*tm@Ph{j5^|Q~a8*VbPFLE&sy=S9>-T0{Z-kHhOlK*+M!y)xYbBq!ytxo8`TZGWJ zT&exbqVEEa`|!526cm2k>g6uf;I!@8>sh`J#?$8y44$()H56|(H?I&IE5MlOL2*S~ zthFm*za3L}DP^Ns7}TgBooigjL2ZhE<@r~{Y_4~iVrHldCEmM`Jml;!gVf0t4DWf4 znRe@;BkO4O5fSq4cW6bCZ;dWE5!#VbHT#m8XlK)|sGf!hsar>@auB$JnZH*iE97)e zNX&oJ004pOA5-e5z-4{c|9rs?K)Pv4$*=Mhc|Zy+*A#O8pwW|jKm6rw+1v;fYWbDz z3T>kHl0d`guINT;@e9xEQDIy9KIfDtNQl3;o^~VSWW3bGQ2f3ra^Lvm#GQTp2x45O zoI`@7#cmdXyqd@X(F~vK{M6g1q6JM(3(HEF!o)hXKFVC%&m8x>Gp<4L)+aH__c3~R zLU+1hIoq$eRu>=ScYxU4Nq9WIEUw$3RJEv4vVGud;rSO9&!?X-mmtOr;i;J;6ZvNL zRrGRi)##I22vp08r*0Kljl8zCgaz#+pL{aWM8?&8$HdLRMZOMPZ$SC$kJ|v`y`Z*Oy#ZWLQi{88_xXI>3|v2uS76^W z|HFP@{)c^I{@)O&VBZy}V4DRhI7y&FNK48gWe~Dba@On&l9FJC6cVwX@uS7{KgZ(F zK&tE}D}#`iD4ng)8yxc(@L&hRq&&y>3r9MIUUwZ!IL#9W_C7k9EAbwshfZf1Vc7dq z_aAj^j=Cu40POae?V-@nUQB~#>~x!zIny?CMDKlcVM{P>>Rx3)au;0m#@&5^1+Fwa zj(ruc6K^iv&`BG8CBkq@IbPeiyTDW0>PX_YCv1BYoK=fIC|x}&Rd+R7ju4O6oe{og zx}P@W*(A@%9Hk|?`Lr@IYX>FzJ(Srj?r@ZNLbIl`SlR61r&1njD*lrlffq%%>RI}Y zd`@|bl1G1GFcY>w(1a;=IjuNO;Ops+oTH^k(~NyTD5{224<;JfcUG48a+@F#}7rm@=#%1JiFL_C=bqclhA*$S2 z){7P4!pRY4dfU4Sj0+dar*uqC%!pO8ODlGZZB5y__584m{{2xs^9N~}x`$r)d(Bt} zb+J9uTpOQiyU|GKaFC2`I2|b(e%J z>{Mlea+c$scumz_Aky0G*T1WqotGZQ?r6*fxmvGbX1?Qf17@1iD7L+H-p^_?1Z-c2 zfaUK)z!(St-5U^)x5Fnx;kq;VW(fF^Jn(OyU>mXv?8map&(Yw&iQAt6LmE%_10!m%YsP@IBKLi_z!v^9(8c zo}-%!V$~0L+qUhv-JD>D;xm6uap8FFj+{ers*jkrj2jZfw2n)`b)B^m%$(z! zIZThJ=HIHKDXq8d)45{5SX+Lbc%dul9Fbk)oY@;FTKR_ZjbTDV@zlp^-R}WIr4hDh zC`qZw>Z0nyz-F=?G3+)|-vGmR3;Yxqj!`l{cvg`!g7l+u(l1E@-gfuA!|CDGH5{)V z-}hdM-O~TO$sRu+#48t-GF^!Dc{MkJzUAWdA;{^=&NSH)S0I;q_MZC`u03Exl<0gr zpd-{d^ps`paZFDhO9Vmvs*>HYj$I|gM*AnIxE3=hCIYoNE9IStg$5<(a7eC^h^E*V z4-yW%Tkt$rtv|fGW(SW6uXL*9-kIXb)|2jUxUH>5lJb;>V#&KY##^sN1eGtewlY8P z{#dc+{+&RFcTo~?6-zcL60<8j*x+KSkq@pl=tgJ8%n3H@9EOw8byKhsu4cc*_iFEN zaU5$uFVXFoL*&ZEzLV)~75XyX;W0~AK{5uBuz+NWp#b8sZ2@nz>4f$ZG&xmF?=+g8 z8zn%2XR4@FimMV&)GW7)H7ob)jr&IpnbzpXyrtx?XRct}4g(Z4)o-!y?h(AxQha;? zfIS;P$u2byg764&d)u`+#w@0Ty8)t3teItg#yTw zI&K6*mLolTcvDX8-uNtY%G+f+55#eEv<@+{A|Stf1(`vnsE-oTnYD2`ezZ=HN+0^= zuzviS)nd?c;6_i}^?8cJug6^PobI_Ay+~|K^#rMI=9lDWL<%Zv(LX#=5TGLx=|c;$ zx*MLQ>G#Ch|B$*h-LeW`)N%&Yp=E@oq__QZ*r_&(%!8Oi1>0)Na561E@*deL!F>| z>zH5CYui|T7;wo<>TY4<^K%I4q?jPaNJS;lwz=aGO&Zw`PtMIRjuU$eJPIzx%^Q(9lzU78vHjI z1O{}eldrnjcfJC z@Xs79L5do2Tjm*_wB~tL@-Ei(Fb_mzFysPVYHDymZ@=1{wEI`Os;lyCaLx0vK0+W> z(2oX(^>l@kTwTVD)6cOv?33maljc^SwFXF0mj2CHetd82hZw8b4=`vd6cXTI{nRm zRw=JOIf3z_Uxa=*e!<6 zreTz6SNhWwEK2;fXere=6s@MXomrj>GFpDp)&?K;<_#3m_$LL@zAq_|HcS@^+KSd;oA>>LG$TQ!0u|BsQ~lfRwF9Nq0WLh$XrmTRo`MxbsSlttrGbS(BJ*K z$`_3%nGbTi(%7^eQTzIuj-GCjLxdJ}=zBwbicYd|^Dw)ySaN=~``~UF!@j=~4U$~- z+Eq6-CyCOwAQv|F`{zlpwc%o&4!~D0c}baIII^Cu{KU1$W2avjy^r5R%f@VO1NMT! zGNkVWM34XjV^SzmZea)u$Lq!gDq{z9kButyq!cO8sG;hX)t-&$8(08c;j869_xKI6 zt7$X992Aw!K|%7b1v`;FUnPyNsNdRky+iUuHf=_d=$rPoz{+TcfxUZ_xj({hAwD|5CiU{W4Sv11hI93a;Zik9$j-kEpAyRl5;y5c#eB ze~td;`DbjPr62RbkU#uIeUy;Zwqn3!?YXZ!`1bi5gU{b^gPFe&EBn%k>tz&chRNO7 zpV-c6&v8x={j6PoAOTRv`J^tGYpAVNz7emb08mxL0EAUV-w*snZ)E?|@n-s&C0M;( z!Fms4S?44y=CZ;x)z+%qh&KrQyXfno+<5fS-~kFF35K9fED;9;qbpU8c6kl6xLU_hoOzZs{O1VGED9XyHa1A zO?pw|4g~}|M&m4Q-Y%bTqRQzIHOol}MgX$O36DKUnUlEG=&l21?U?JaA5IDw+q6!#9TaOhp^VI}7;E2C zc`hbA>^YS3&R+WveNpmh`f=P9MX+anq**bpk57_j1s;+5rAhtLq<(qQg2!T3k461o z*Q8c)t%$UBKo5RN>ly{{BL5M?HIDYGw&j_@!0ix2ws zpLNl-Ddn3E3KsK+00jZK$aB%iO z?}4K+E+}6dQC(Sb6Fb>GDKuG!?~Ao{I%;%x46r_DhiO3p)hqLcaLF=W-NQX8A$Rq{ zMed(}`J%Jk(5CE)Rrx-cD-8J5zg@jU>8-n;da4 z&sHXc{gkDRy0b4uRP)`a@3NzzEVYT9ny1{6N%!82OIihZNOT-=5ttHAg96E@fg;Ie zF%Rmyw;h=yKM*IR#CN=UOfW5Hx?`K$*_ICjn!JPF$F{$TJUe91@9h2FWkCHk6ll21!BQSO6mnR$tHyU{Jw@GI+K}KeVw-%|q>xrg zktz%*>A0-fp<-p^+wbUB5-ZcCL&aZI*RYVq>Gt*#6?Y1#!JvTG!0`2kFshw53*zT)D9G$b1ty;L z?{PeHWiIYWwAQFJ45%`-zr&MW|LH_jcs5h!NQ8}Yg+UfmLG@vr=si96`4fi<>`z{> zpH>{&x-Vcbe>8~gn|`x_BW2)XI3gSYx7)2b-5K)aQ4GOyF{lew>yf!a(O3@{J#kj6+| zC_cUO-rWuXL_(AvE=Ma!-Q(dU*OzjL)6^BIEl&^cI+-1MT`eJqqmlQI9D(PhFFraR z%581&e3QeVTK5|icwjtz!M7&h1K~I?XA};O^+16~7}eoN=-_a0cgr^bEJv!;f06$Ve#PZnu8~X zDDH{!#ySuKl#%dt%HqDBSQjh??cnT+_wx02aKmEoD7>>&2Z39^z;$0p*0lpg|%yFBIAv>nV;2aK`zfG0N^3ye9@H=HZ3* z1y9DWMFcTYDX`J2MIDHEtg9<{I)3e@I05VGfB|2ofOp1#_5H4;NH`p;fRqsj%VEIL zO1g>nA~=An27E1$`cK&ew8&Xl=xZq>WHhz3wY1g6q$M?F#Uv%A<;65)HKfGUHKaAQ zrL@)Mz|#tJ$2N^C6aRwaOODJBt_Ce0dCc)#F_`i!5j+}~vONKx-2*|sQ4--eseQls zh?=*RzOiNSg~SstF7gGyfCr+fTZB0yY#z=j-McJA$Le{WXjr)qzqF{xn|z1Q$3e~J zz8|@0@yLPr@Q2Mac)dR}t~CC~ai#HVT>U-cN>*A^T3ZsKC5Dti>WIl9r8UG9q$M@P z4%_D9PU3{-cnE_HZC|J~2=ngU5T}9h@+3 zC_hkOQkH`McFO}5;NXPyA}EU?f0v8K_&Jc)0}$!f!jIr@75F5;;u2^NF$7qHGA|PD zN6H143{MPcJwfh9z@-s#ax${=@HKwm-l)J;9R8;e6Yhp0xDoLf%s&UTtA8U9QFx;A z1{Wxtt1`h2B`G5d^5;c#aKi+kv91^bQCS}Cq#%PqJ4s8+qU5BINLeXq7iW2CgaSqu zgL0BmaF&&omzQ;xMmr&8Q5X!y1t}}*m=)fagkL3 z52;DYNI5B>WL)IHA15b-tdp~x6H?LzDJKW|TRTZg%gUk<(k=*j1v$|DS_b7JEzSFf zNi61Z>12G=ZsgE}Bcq<@o#poP?~a0#_=2h3@;slzxg=6zuiON~INmcKj1ot6K%f0iq(Ek=U_a+zg&5?dm)sqm7GN%;N! zuzLMJIf;L*5C1W_nhrjWy4= z-_!>oP=($tCA?+@S=S(b$$9@iIq#p>5Pqa`{9$oOVGBvT?*y@0`amy{J4vJWVlXHZ z3aBN&LvdeH9(~dhXvHeeG1eQC4?!goiqr$^Oj-F3gBmICt!_tcX{xq|M)c3_j=dRE zuSF*eYPivkw~IUH9bc);D|m4&q5^X3QoUlMw=-|luFYCIsPdsa2&;=aNv+$E@HQzn z$vh7p-(uJa)PD2`g1zJ|%=NSa-#sUA(KiNOQ#f`-bk~2WrI4wK4Ie9h zW#4rh2IQ6YAF4YVCZMEnJNk+^@_Co#)mv4Zvf|VH`}D5d7Eh0HJNA&WC#Puz_l|P} zvm^)qMgaZaQi^}+#OvDs@5RNxvNZj9$?}(A`Bw!?;9C>B%00*Jf_!IGGQG_QUQ=#? z?9#Y*8wwC6$rtMEZQii46rL8ijVTpi=k~AUQOR3YV<>L6Kbi*vZoX0CAHcy{x*CSc zSjuKn&kUd6ZHoGIqK1S10~6&V7?03|0FCbDHklCP-D!OiRm>o8e8)Tm8u@>}#Z1o2 z60YeLFdETW*wm76E9>;9IUXo5MAv4uukg7XWzAy9@gNtM#DO#)d6t<##lzK&na`m( z7=SKeza}8NtMoz^o5=Z_N2h9f=v|`68=9)F?<+*paRm8i9;I{>Ro9(Fr|;)ib-(>* zHd3D#odBNSIPq&E^)J6`^2bh|-@Ii~=GQBUe!Y_D*DHzs>MMyrKm|QFzumi>*m8{` zPsw>%@UVRRUfxMvH*!{9DB#H_`q|!jYuI&h`RP;iu{0OSzS4z=c|r0AePEQjPHL^+{4Cd4y$#RJhpaKVDtTu$UzIRS|=c+g}jctO+NF9GbY3Shhd$!Ywzb8uRF+>eCbDmq{+uAubz zVRpo=#l5LeV1Po|{m6*|nYf$fg@;b(}OcY_b?OF3Zxj{)>OQ=qRS zqqLqsQFTbfEVQcS4Y|`J{*LK6bG4(K1_kp2pM~vu2W#JBO8oqv?*OT42Y~x~tLNR! zFnB+#Gll@y_w)mI6G^AxzGX|-Li=fJK>zJ7*~O0I;;BJ;>=)^wK$)?xM*9FhkK@9H z@vt<}SmM#+wf4CvTeTSpt=uOQnJ|D(9CFWY{0;kML_v%PJWq|bsty+!DUflNK4wO( wWh@12kM6T*X4{L|-4#5?2PKk@=Y5AQQw-4;+`B`={jo$hxS6jr$SdLh0d=cDK>z>% diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/debian-10.bin b/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/debian-10.bin deleted file mode 100644 index e461a2930fd2a8b9d885c715847b10232e4f6a88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22220 zcmeHv1z1$w`tQ))seqJ7!wiiyNOyO44qYPM-5`iGf;57(bV(^7p$JGQ4blq8ok2a{ zcZTo$zjL4a|3A-t?mcV7nYGt%zw6z5ul3em?*ae-0944Ih;z(`>H~n4W`igXHnFq< zE+zpk5OQ1^AOVmBPyw_6wg6XvJHP{A3UGkbrLOCa053@06<`TD;t2pj@X&$>`Fk3D zD((`uFPf}LN#8}{%4=Kk!=DOrTv|esN(t;F19o$lb+Q6Oj{I{$fmGoDfWWECw_g=S z#bgz?5{43c)g>nAAE9zX+DsQ$V_v6B;629zEM+1v$D;o_9dgcfQHSti4&f5YlQ;kj z`M3k%eiPMePsJ}k6y|!CEp$6&Qss;I?Dni2!cC&^zlhy~v_XpsKpv2<+gZGt`b;jO zp`6HodEfPS8#)9t@jYlFGOkEEBU%5sbSqgDFc|&>7!0?NhX4-;503_TCr7w$9b&i% z#6m`63YQ5##e##wKmq`9LD)b{WCTq_1WY6+OD|`8;2jby5Fe0_1H=L127$QsuB-eU zz+ctBI3pO2=Feo|kN^n5a5w-+_vrA!aBzT;=69%mXO8yfnQ=6OYTy5zh^#5K>q)$GM3VTJ zEj3QcqxT-U9Uu}am9D)&+VfWeS}W)?(wjNJ>M6rA1oNnZ3;s{(`4K%r2>0qH3mmow zGiJu#lWx|f3BEu?K^cRO9)Evd6*p3Zu0~#X(W?KO+53-FVafK!g@-~e!i>OfT>1>{asU?UPE5@xD|B8VTd zf5-@?XUK2|Ng0_8_W>!P&9sQ5K;po^2H-#e1aNRyh)6&L$k(55JLG9XZaW+xI{%Iu zo(ReFFYPsV%VR1zYGf}Tat#XvdYTBu&%d^}?bc6SZz6aS%QDke@hDigrva~*t-yh} zcsr9~9|1(mb2bbNvA%zwlG%)!#Dt~gnC%;b(`zed9fol01lv#t0KE>~6BRi9y2Ad-*}Ec-Ov*{YdAq)3 zS>qnL>k8$gsu4CioON?>ZHVx=d~{5i@)VNi)|}aNPedxniXIDPs()Am)! zeO{uBh;IhaTc{sQ@fLtIBe#ms^;Q3kQhE{<=f&U{s zGXWWX@=X2LJj+YUQ%Q(XaR5Oeh#dK^(h4B?qRb(( zN|wbl)que;9Y-OIVJ#OdA#F+*m}R zxLvjO(_IT5#T;h0?3 zzJ(A7UeTek+jvS{wJ5)uuXJJ3d47&P;Ulz~Z7DFq$dr5Gs#~yCmArStO%T`*zrAWa zlH)nLXP(?u?IRlM6A`eYR=S?^5XClu=%;)MhEs;zDS03+G8!{793osWFA*FfMEV2% zBz4R#Bu4Xui-xW7C-mnuD;|!#j5Y?|`o{@`@Q9dq&;jZYAgR%#NT{B`g;rj?%3YN86+pp_tR;9ZI4IaLUfak15o_d=;jm^Avst<83PCi*2z+1mMEhY1A zZyAf!vA~?x9=ug(j5PhB|BdaKj66rKOGk6fzh z{5WeyTC=1`=|?Cf;xF>NE>UkCxM+>!hSL^B43}K$_)pnd6D9cv9Rv`pVZ}rXMucvy zjI~RwRkDVr#M?3J`91iq_B?2imArLHZ4rQXmL=3>QuB$kp)m5TOw?zIRTL z?UUJKi``gAPKA_l_L{H?Fw=Y3Nr>xV&y`2k@Yv+gpr%h-iD!Z%wBzY-?Se*BfQ$Hq zKIpu_G|&X+1r5o-kgGi=05Dv4Yv#UCx@2M7`#0Fumf+uZoHV2jS}Y(l3)YSk{iS*C zLcVX>amct3-E#I@x1dh;UeiH@8Jz!D>lR*!G0DLNH6^cg3#7^ktpbCB{zr5RGm!D8 zZlU>W-J&TeCHrqHmts^0g#k%4J9*5a&WHeH4@?O-4T~k>0F<5NM;LW(9hm6-a+0Qb zeZ;KklgG??=Zdn~Vu6W*%^H`V+ur8%7Li5=h(#OdhS+el#!3(Ey0lR%XGQy6JrIdY z;HbMNQ{~aHJEU+&?w0>*a2AEPmm+3O`w7k@@nqX~=3-So!{hUo58m(}uC~$1(%*$N z-6Gg{+4)fP;U`K4`l0W8T1Mob{Zsur_aD^x@UOkEGmBB|;B#KKxl1_2S%k{_PRG`0 z(r>2=Q62S*QVmmtIjSkxoJe=Gj@f4h)6_az|I(;3BA_MQTG>Shp9YbJW-Mk;!v!#= z!mZ<(hPrE4TLAa&w{r1>C>K{C{y%gDM7bbcw*hJYI0g?jZO^*w8w0%5 zJ;b4M4*Zi2BB<<;Kx+?neiHjm8RYbiCNr9B>OVT@Uue0%)Ir>+;#a_tu~SdXN?aQq zZbm5%PkO&Sd@*`)GP&oDL3}d01e%8%I$R~h7{SjCD}&z$hKM02)KeTFG#}nJB>Sq8 z`0a&es5k>TReN2PDq&w|MMfGmdEy703$LeXZb^}^+uPNekyNl2wV&ph?qIDs(#?tD zkcbYB70PuhR%hW;plT$v541Hi3&}E5a$ML^+bU-d`ipa2@F0`KBv6TVzR05UpdTGV zC_FKI`-Mltw^^lO68|kqN2~kd{GEircRQpgI*M zO;a#SqPgu(5i2B({h(yECYy`9_WMiqQkJ0YA|#i=oTip_vIkbH(i+(DS^+O|i8JfM z-`EHz(l)RgC8&hO^~VJpi{&4&VJ$tLaPU}tY1=>@{vGA*$+F_x_mwPO>UZckcn2KR zT+_m9zH*z|-8!xl2vX51;b8qy5cN$woSsxOKlrs?_8Bl!gRn$8osNC*-l|yYZ3B3b zwe*!ReL-Q7R%v2a&1E{8+PQ~c5RjP)Pwym3^#HJ@Z$+(ObJLq4xDb`>y`j&`)8#ce z<4bK?@^(IJQ3#JnJz1)Pm)y1Nep%>mOYDJ?oPAuLIt3ObF>5r|y_DyCW`lI8w z{y_26y4D}4H}ps3|A;K+00Mu?V#YsYG1Tv%l7QG?wpO<0rtX$hVjk``U{_m+djd7_ ze!3(eAc!Bt#|7fzxKu3IQ2L(O*t z)VclECb#LEBglU=57DB5OQn*!oYDowCWi|}4B_n*w{0ou7z}u>E+vT2Q}jIZO^8`KZ79@Rwq*}ya}A|a0}R9n%X$gY(z+$bTVC6GcfZRZ z{MH;25X~X-U%Dk_jPU&N#Jw5bqlw?1DrbH2)2vqi?@fXG5&rial7B(_FVz6yg`bORu}`;C-5$Sio1hww6SD{|f!mK#n>R8gT#C`@NcVO@ zQi-NM(^q_KlJ-ZPYYa{ADH5VTpv~MKP(bIgvWwj&n?X!0B_%1!ZeAAU;PLG3((CV7 zMeN)po~-Dx*)yy7sNtXj)G68W`;q!gDgJ2NFWgPLTaDU{OYg8ST5AyTJqp^+Sbb}eg=>I%)7C5Vr4=ENWlhl9LB%L>QLa#FZFaZ#o5WCK4T`I%%@zvj zL~xCpl31>2uJKwvQypHCTQoJp{@8*Wzp-$+fywqF0&eLf+Q!jIdf3YV)krJpTX6+7 z_(DNUHb`ErNeX5UUv{AkwD?AFAz;g!`99uweK97-JH%R~?MMDYXub(Y@B4J`3-~bj z`AKYdAG`cG3rvGMQ%(tBQR5_{7uMAd z+y`xIB6pX$3(!4~Pe`>MPkFPvMIzgJ6A72|9QP~IVv9eEc_VT*Ep_iVZ--?a5@a6c zBz%OCqPYXsmT##!qC2FLU&o>i?1jq_CY?!{(CwCtrQg0YN9Q=Gp5dWna@JcD*F|-a z*KY9-3EHO?JR9W}{3>&}FRjSXY&y>zm8#tX*Xxncp=5JzM((h7 zAegfZaonrOj9l0Mw<}_FdOIS}Dpa)!8GkXm*zerv$y$9s+f7&Gcc3c|(grP1SH$~< zGopg{vy}_--JbQ`OBaDdvE78>=u3jPJTMrM3ZhIbP7tNwK&9Yr!3N?2a$JjK zOy+-XfY5Psw{-n$C33AluA^BX5GOy7528P=gIl0qRbarM)W^T%@?Y}w>!L6)G1M*1 zJzOoR#3AYo^xNmaq=Dh|ParCFTWcpsln){g|LcI(ka4zI0!EERaK)>kWwRCeiQGHU z?@Vtq8}c1Bjx}dBNi<1hc$F&$U^+`-Tm(4wJ8lLV!A&$;-HBMha(p9}QCeJ$X|8}k6_({({T-H-A`xt(TVwN#(=LmJnujA;gWYK7OW6h0*+ z0eau8KO1;U3gJ4|km%mS>(gEdPzr82VNn|7RlEu#3YA{k5%3FWtKNV^dWH$^*@!C~ zdsVVBD%haI^0XU)+=Pag|4IzLi?PU3^@@}0xj50cH17-6iz3aOSDyQ4*e6)OFm!9X7V!exmO@~jns(14I_E-Evq__y9uX+Zk7kaMN~nDph`>BkrK`JhQX1H(tc9q6m8>-D;i1nOf8$r`8%n}tKcvDAPbeputQ z>6bit^4Ibt5+YBWf65ayEOLH>XUV=Q-7xnRDE2!jjzNH;0d}x;gh-KJudUDtkR)u~ z%)uZEAlbF3ARyGTb#?cENRVqc|EH}f2Bf-vjl~7z1o3k5a&qaB;&1@@`GL>_JRp8f zpdL`{!}_@S1n^C&G)3DQ zX-Dn5wp+4mpjS;asgm;8M z=cxI9y)`)$k*(tPdgR^dq`|!?v!X-ktz(ID@+VIL&Z7C;Uq`(+`)YsNgF%ox_2~K~ z2L%rFRTeb5jC`#re$I1LATs1IG;raD?~i}iWvjp!l`~yfP|jSJ>A&;AOej=gU#KX|7rd& zkqta=8F-I}x`7TRdariJ9DPRys0JAg6jX@vKv|&lFENBh1jh^j@&kE)_XH0|%>4Jf zIzxuFxvixeJ5T~jlM+!7cpu1@$CJku&hhtWLnG&ZTqh(p{>O_(f<-nFjjcoJ`KqxF z>dE0cZasx8nE7=rw@j0|;td5NJP{*FBj!O3K};Hl6BrZZVa@TxE}{O7FJDa=7=tl{ zhIikQ;%$c?J5L{D(5K?aPk7k242zF9+9GRAlm3VeuBf2dHC>2b$S}F3w5+^_lRIjX zJBZeELTPXpZE!pQ&b@Y)RI98?%obsxL$8+eEU;UwOfIQe&cv2x9`KI2 z8gt!!%`=EIcVc;{rT;qQ^+nJTw)ENes43=?Ns?I2I}?{~?5R;66*EM~JBfsCMEdVz zEims5ygX{i&1#x~m0K*o%q3jN_f0zp{sJH)7(F(0v?3mN1vrN4(r*;J2xU^Qr z?$a0u(~UUNu$gA0RcEs)>b&&#hVQ{{{$8g~zwoHw6((VY+jd3`khWKqeP`2qt6$DFHX{3lw@U_CpT)!17?_{ z8`XjIe)CqDXyCX0#{ojZQw4UBy727mLWBJb3*tZK)P(MKUx;Snop^S{wp#v_I*|DY zdDr?6(*O=CbP#c`%}xqBM5r$L!-#D;~amXbV zv6ad4Sg<$@kwYuHN4>kDW%x;W&SQ8aphIzWJxa(QPdq}j=iQQv&pg24lZ)9vX7?~X z27B(v_V<{&LyV_~2R%c%ALvpNi$+`F*5Z$5G)wC}#6Xuyh6tp2-4%TcQeWoD$MN6g ztV`#l#Bz*2c;`L<%+fB_dgDKigjaub$oTC;w)#Xnd!?PnJxPm}7KZeQ_{M!7?eD(W zf^vMxZ3k%wUl`t;&Su^=;(yv;8Q6aK9$!So)0#2&Ee86XhztYQ4~KB>avxDzJU8qv zKGJ-Uf}g2I@7p12!(lG_5Z4g^t}JNmQw_*f*XO2?ht6 zpFRV0wGQlD39O&91$AJ-UnZ5@x%F0=qDbwtW1VPhsfnT(WwK>1IxPN}J*4palk@3h z99M?BA65}0xhC|(Q103bq&=!|A{+CC#rMt4=7%p2vZ7T#X95SXxkX?JTb!~eq3&7x z*oETYw8P?WZ-+L?J6IOuQr<{F7;O}7w@&3TO~4&E6qdaE5AEq5wGX$OoEROxg~h)y-)1=RZ&Ckh!P@cYinG6v>0@}V3BeCyHWrSr z!)uPPc*g!MwR*w(`7tcBJ5Hr0etUx7Kehb8v-B`H_)Hio_W%~3c>V?3cA8T(PM8GK zhT}us1lkfk9sS}evA=HN?DFW;oP9z&%stkTUR>S%&c1d z2o^6gmYusOyq}|?R`bnhHK@CB-_iZPn~#fTyfcB_n6MixUU~%8lztgGD}3p`{T|B{ z?pdFnqx}aSYMUN1mK7$wMOeJcK_Ym9M%G`WP|B?QZpOtRE|nL~F@ep-%3R0rrMU+z zKKO&cSp5mA#8^&7&)bO6Y+bQYp>gTB#cBa-9 z)4q{T2~sH*B(Btbx{}SX__+9jsPQl8{1u*d2i~=ReNNC|ItFRYBou5H2Ut4VwkPBz8s zZG^=;{rG{Q4<{Y-FjWC}vb3ULq=+gqav3Q%8hKdf?o3M!EItQNr7-0yHV`r|b12^F z+1&-^A~>2@RCycpTA-ma?8bbYo%;OoWR=yuq?l*Z>=K`3l@Wu`;Hd#mS|OSEUc+$_ zEd2woYUS+tr0DhBLW8asN?e%=h*cSu94vx0vf7F~DmU~gR=0x3*6ls5=CAjg7fhD7 z^LteRT+4~AFC0$LHL_`M=<5)jpo3y@z86OiqrOW?Hl~G zEFQ1!|9FPyOkR3Uv)ao?y>f>d^O%)F+5Mx+*Ejrau>AL`m4}+RE$WTYjg%yrw=rohwTfeVF~`m)!P0*? zG^}Ahh66|0fNIp#;`O#-BBWPDPTNGVi{OA|tIr1(zYgFxe1(mu9kdQm^{#I@F3{e0 zB1)nz@zXW7Tc$(4gvFEB&%Ztx#2Oa&teUy+l1dsw{9t`x_>D{`wr;i!)(o4fd_L|Gk@ z_1y!kj|OD33i2di@yqfcJxyX48KIa&w->CR$P_VV%!c_IPc@*NDQmsv?rjKgT zJN_CMAcH2eeJm{giwz|ah9ICt-E9ti5 zF6p86C4i-Gpo4VFE^LE0O46BR>f4qLL$jaQaCXV$JmmYU!*D(qEmpBZvivvBh3i-oSs0F2f1C6^rF|mi^2> zVjHaMAWNWfo)FU#Si;_#BoB*6_t?asaNaDMJaoV7*q}U6FC3t2$IXe>++(ji=izDu zi^o)*Nd)(%;K_O#mWBt5+q3+5YFBjNs=iqdz$4^Xc?OHeDJ;l(qY9k)p?@@?YiT~Z zLlGgG{(OWK*EWTTO;$Av7EkB}tY^pjAuF;0|B~)b#watGYtrsG1^AT$zKA^)3*`nr z;ZuT(Uhep(q6cF*R{>$+PwQzou{z~J3OJ00j?bRL;>i+|h)Sp2)(99%y=mLc$Ukc? zR%v`^{_c9&$rz3|-2{uLh|%e~Y*`@BclLAYh9y7EqC;Y29evRGp)vcz*vxP^f zSi$;{{8uDa^h#IKuz1FiA`PWN;51RvK&Y(&;S+mA08Pb1{ixv?2EbcX(Hs6dGfn1Z zfjwklpl0+2+rygGGlN6|V$53Zsw1IUOu_b`0>&1ZZ%_pE#KeWKP`}KU`Ra%sQOp@yuFe)j-U$#p!1933}|M z)h;0Yvkw_SkA#dOTEa;C(@BA(5a; z78EJzNIQqc1Cr0RElC(xVe`HbRoO#8KOJuJ{j#r<0zgMk(tl8Q0-4mHt0N|7Q0v3N?+5J^@6>~~R zWiZhMXUVt_QoxIWWrFpLS9{``-*<1=Z}-1ANWOO7AjKro&7>4JW1UcK%Rm3z4A;lj zMeJ6?eM9~Ttbf_!isSA|PPjE-8)_Z-m{{!X$vB#-LO#50in5z7EI-2h_x79e_1@)+ zS+`pFh6)NvP_G!aJ(yn~E~ilX;B>NeJ-maSmGm9)d%zoGzY zABL`REMOkrhRb?j54ZP1wT&*v3l=XKVXruAI;DRaWiTFSbE4s)g}&py<>pJ23h(IPrP#|_+}{l*aNVOVZ`!+wyyA~UZQeR+Yn<3m6I z`mFk1pN*Xa$FS;%NT~a~kE0frAMMXc_rH&*(X@MxR)fxVBBL}c=+xc!(0qeuje z*q`QgZjY0h`NuU8}iNSIYHh|_boofC*p?u^q+U+3~!0{eHm4(h&=X!Lpb;f zOW($A;)I;BU2Q{S_e$66d5E>d?fKsX?6maW~|fW9#OGaBMi{S$%-}`9(36 z;>vPNBmqGy#hsCPY3URtSo)5eZ#lFVdq(<;UN{rCBzYKbENxSYsQ^>i^xCBN{UTxU z&iRt)2bKJqww35VYUjG>IFvTfxB0tuBH_5EqF7bSVezir;9$S4`_c+2k zNRwORFAWpL>a2#SUIoMAy-6%^sUu74Yu%k-cP_-5s5KdksDu1Lp@1jLtkI0&^K!4it`zS(}4Iog_=fy*{eF8}@Kq$~30! zEnQ1O&$W3e`AE8sQD=-HEhmN2W?seeE| zLh8qF@$d#-Bfl(1bGVkPKw~Pkz#amoFzUf z=q=|W-RZe6S&T(TUDyy|SGdUni!Yk|X^)F!YP16lu!X8S7V8i)6T$$CX+{zeW#ICW@6Oz6!zoj~V z2#aqPL4K^85JUAHtD=kL;)0US#z(}->nWm-k)t1tI?j#v7p-vb5jb1TpZJppI@V}W z3`MIGAF%J?CZ5M(tU6Z7-tb4-Jig&xao`vu^ZYJi8{2sM20yP(tpwIK6+32aobEc`K>#ZtoCl0rm-Jcfq>iEWKDZ&@ zx}`F7yHfoLk6s$PmL0#ShODY~eQ48)mBeSzAx>f!4a-lDivHm?ZZSp0D#?I-%v&`6 zJj=I-N*+yx$VMyV{nPNhmz<;mR6s%E{x;IDOmdb zITpoD{HtX7*5YdZBuI9oV}kVH2`8?^+hhZ8R%mX-SBJR(c-322?!Cp4FPvJ6#L|gT z*C)OQ&X;!axeluM+=yR|#BVz_Q?qnL`Ra}NN59(sgpzyPaSz=)EoqoY`s;ouEI;D} z1rlAOY=W^{{?51v5o5#WAxLzs-`+H0`cxjSi!s3BXS49$I>^LLowsRF$fJBev&OPQ zOO;7jlc(%Ba8?q(VGqn%MK{ogp<0J`aW$;Ae>lCX79?QnMw8XdlwYh!MRp8J|2?CMLdev?Rd^!81Zs+H#lc`Y>RI(O3H$F-H{v0S@XzZ*BFa8Z^{X+UK6zRGDShzh zMf$*MYfst&fvwjGEd9l#im)=}QOxro&33<6-zx~4`gYwiey|MchDttV%fDg&EU7j| zZnx|d1EmJA?M{#q(r8!^O|_ePyPCVl`;Dd6VCkQS*O*`RZ!DCk7E<*j>;Y((emN%u@M*|%lu=GENfe8Y9 z9qc!+)VB|mI-W))k)H8sdGBTO zS@wZXBA}JAAaMzvh`351nwBBnpY4Wz*_~P1JJ`{D z%H*@lL;2XOTHwy(B+v>*<0WL}U=_NnH7q}0>rYe#ur%as;s`3cllDsca>X%==j((q z^pL;%W1$Mc;t%p2xf?WW#Uh?ziN3aB)IB;hU|HI1y0kd0U}`?@mV?C~QcjunZKUCf ziVXQt6wH378Zpv%D%nPorL_vi?9PuK(!% zn4s#Txf|~z29ZnzmGk(#oWu{z`w{DN(nAqwJ|(kiA(z#(Hgx;|!_ucDMu{B*Qxp-V^;ZC`tTkwj-ub(0_yR_p6ld%WuQYiTKT zw-x{-(KfJ9MBjM2_Vvf3qRL%dU%?>?R>BD$NE_^qEohKq(DM8I-@CLZL-uU3fb81h z3TcCE*#Y?_lDpLQf4Pe8!T1m9yZV-{PXJ{d%r-IEnk1o zAOu+envh*=xl8}9LWC2u= zU3Q>5)mTGz)`9M%qjG&0+#tNVL3XdP1UNzde{fy1hqOZO3mhikjTpl9);Dl)ko+?Q z1bEbInowSqDo}&)a&;BMu$OPEvFO%8?=$2%29Dx+1NiP3Sa{2#*8=U+nx%~g{K91Ub-B6{`T6sgIkfPru50mP zm^4w8GKrCkLR{yv0;+?dCGgkZnVzuauO;_@YN39dkWg3Ycpo9#S?NcsR0#^=w^O7| zqA4zSr#meMe`-qr;5Th3o&U}vV`@V!YXNq0SF*IUfLyS?LIP`JvxMo(ZdA5cp82uY z+Z94OyrTT??DY>?3~o$alxGuoE%Jc8A>knb=JR7`E(39g#M-mdNLuwr*CrUW|Eu43 z?2mK*JAOfJ5eVf#>3cjrA0mZ(=PKJ$rt{Cw(2U_YGa+rHOY`l}ewx?`pgSkR!i;=>T{DTmZIT2mk8pS&XpS;#p?E9gfWXOTZS1qUzeUw7>$I7@b6< zI6ujrW+Rj*eFNcGrQFa&Y6&1w{!(Zb_hSq#v}0%~`1L&00X7h0*%7h@BEnP1PK@C{ z6GiXc?U(J~1eDLOmyBKR@~fc7zjb9$ zDbArjS}|=wL$DfLRJzB5L4;#Y$y{CD%TSc&}9jw{5&_Fa@0pvYy134KAivt zjRVDgCvia%(71t|K+x|xBms>MnwI4T+04ws&6LgJI>Uzz>}t(^oq}e`Y6i&)W;Hkc zryMeeu`z!I2P{fc*~5?Yiz5cDVo&pdgnvp)`IQa_I0X_wv%u&OF@fm6yF@^M$(j3$ z9oha!`})hS{(0}u>r@u6bYbbCF|_fRs4?B0d)W6dnk&ng+w->~ec-P^3qOwSQ1(m- z@SN{-JW;Z8_+*Bk0jF&#{ZX#}^k|{(iHp0=5iZ9-p+-2oZ zzU6>tbWnJZZ)}DGtg8GfV`cG(=K&Tnmk?WZd`=G}(lX1twCigeEMOfEi0&;~bxp)V;ClYi3wgo0SW*HupF16m>d@#(?5R0ek6ZEk%DFVzBb;zex7HMb~bL# zzJbSr;ea=e86%#q9;T)4P8xry7O%Tq?8-v&bQT6+JmZqi8vn}NE7{n34C5z&49%q(9?kh9sozMXgb*V_<1|nv*`0F=ox4p3G;g`kc=?d zxII5Zzpja%ej7>E<`ahNFhKJu-5`61KaUmi{K->ci8WrEx7;cu{MFFQjQ3qhmmqOK)zLR?sl0F3k-PW4U@xDh#;?p7==;q zLhxi=KgB(|#3lWZ$K%1$lQlyU@Oh?vR|5h@L%D)dt<5It+S8~`!uS_oTiwg^5-Ru0 z6Mp;6JpN**yPM}7H5g#)UQA~(`ox5J(U%>bffvn0w^WC0hC4CKVq+^93`?N+0s#5p zQ3ezpWvG4!`Gy^juyLFdXNLG=upn4=;f51WbU`0kXKq{W25`H`jd9pDFegZUW% z3I6#4z>k$b=-YnvnxA>`0b{;r7}I&FrE|%6Fo1j}R%XZbdKQ~u$0-46_V^;?_Hr{U zj8mwqK6M-0drKKqeDumujX@>0Zmhx zL(fPdD_NSXRp9P2JOXna9)U5I3&F&|#3V_@)ah_>aJsLQ%#fcc8$k~z#Kz-}R*l{v z#K3@I0dP`5Vz3Be2!)VipHzQd#b6n|IyJuNOrTSWMiKRvfGbq)h_372hof4SN3*w*`;^RPb z7bBlDtn;2K!q)`8y>(m7RQ1#1ZXt8YwEW7{M4DBgMjV&!0Cz`=?8eHM-bB{M_*tLI zFEqWIfz$T6^3z&l6D1EZAs7HgzA{`9eg^DoMhvJVTq2CbX0L6S#5$ULg}l>m|HSBt zJLJFU+lap!La?VXfTR%80QG46A$w$)I)VHOJGZlWkj2EscanmGh?dCk36(xAplkhg z`oM{+*$2aR))H!0oy-5Pi8@fY(v_|q(fd-$*rQj}w~6oSxfwC38J zyB44UkHDITM?eOS?GfJwe=zol6XcHugR;c%>w+*i9?BH4$uSM}1wmy%5xC^|#x_1q z&K{1wNDo00I1#E4ha5-G!QLI|VK2x8XF!$UlT&Is+j%2>kmr3_6p-GYNN*coXYdJ7 z(@^&z8gYtAnqnn~j|Viyji`d*liP;i3p(1YB4UApyDq zgy=CTf+FGJVgHEC+;FaAnOT1=vxbrei-J500xl>Bx|o0OdfMizKh5nM zUsS}j#33A0pYi3Mtsq`>Usw#Sn=-RQ1d~#06HUSHiBqOr?bv!BRhgN^JGb@t`Y_&y z$!E}_5;((z>ISw>ru{wL(9X-+*I1(a4g@~r97a4_`q~&1k0aSj^EZYiK`(0J&cSK_^#BDXlz<5z z42FJyEua9%!(pf=iJ>Sq(QslEL5_iO2*rX!zzoieDmVe9fm4N1D4o|+_z+@3+BB?{ zeZmk|@-&-E5!?a=V1^pP_2Ig?+PRw18cx2xo~H!_?7ZFh-M{NHza7$Dz|++kRVv`= zjkNc(^Ysw`)dJLUP<27Q1(g=m)pMXS!1=&`xClQ8g47I^StH zX0+nBiv0cke^rr#_kU1>FPiy6BEZgk6&1ThkxGNv%`LUhoy9gTy4kwogHUyT?4ScJKHXeNa6xlKjFxz%0AV{t4DxFte}hEL+-&Rn>0ZvL zmDDpUr{a^8X`+M9lo_wJwkq9ZRC_?}N2--Yvnhu%_}b5J?) zP7Kz7QcI~mML6?599k?UYBQ$pOfNj@v^0#_@0Ln1)bGX?SX#N-0LfFfzTbw^!Wyym zb$vb%Vcj%Za+i%lqq})jW8splu}Iadw%?-)YY3Zu+4Vri;VgM(%4h@6s^17jh=VJH zz3bDhC07F%@~Rjt^QdZL+CS27SEsWh#dD^v@5Ke)Y;`7joX^05mHxS#q6`>m+jvGn z;^!)yOJAK~yTvP!_z0 zO7@@yqR$B*ehXFUV6LnBj^iBd2lY(a{m+q49$JC%ClZ_&x*o?MVhEn9ZIZBGa*Xhe zm=k!KXqpT+{L!aV!zn>ah2jzrX(7FRomdoXype9s9yZ@6j`#%FXB|9{7m$Jsa5@wc zLO_08z+$MRtoF@O3m?T2VYnbd7@S-RBZN`YN{|$k_(uLy)&5m{XpoGo^{j|bQSam~ zr|zoEU{-P<=aeF_o51pnVr{x4q4@yReamH7q)cg>2E>PD@fryivm~PB)QwgRGw4z zh0cTwe!5XUZ?%iOT0YO+b`@flAkRxwC2F3~(2S#Yxr-wcOX!Vb$LL)Ty)XG&B$ZOJ zak~`?)&qEQH1YLi7VPKy07(*f*(z06bY~TdG3o2R{1P^=-GZs(_@D#V`a>kpxLz28 z__Q+4d+qRxD`rTmV)m_TKR9%a@aH-uOm~@k&h63A`yzVyoNTYc2~ZB5{Ja1Eah-8A zNyXAPAK`a?pS!0*Av=@K?I$Bo)7`3T?Z|-3d$wYrFItoFY)R&sP>rGS&6Y!inZrit|S zcJ{g8?B?e1FB1mWe#a(E2`5LvVB`c~aP@EnH&sxR$Rpbof{O{k1%(8K5TYpC1xbX+ zHxm9oBgJ2t@_3Vf0sW-mJ#Oo~rq}*~C0D~uBgG6V2J1ozD%)D zsD-_c!CW@=@X6-O5>sgtQ;xAGMdzxN?%%0+!YLf!OH(5^nxwU&sJ9=xZE_#x`PqDQ zCil)+^N9897YVvT7iBl$$~i+#{F%6h9eC^dA(vWj4%~3MG6%sQmn5q&;<(8-qn}QKlcxKAquvDY}nXG0fnL6laniA*}aVTpn;o)g0V?6;4zX}hJ z52N@M=8jXr`Tv=LjrfCl|D_WdqBC=9HwX4Jx5j6=z7Risp%;`U{(yzxbcudZ{dA-{ z>+1N}JrR-inbZk^%7Rh(q+OFSf9KD*S-c2#N)4B1)8>l6JMHAeqJh$D`7XZi;E`PH zBn(x-G`4T|Y=h137%1QQP~Y-6^Ih@cvbq<~Sqv_g;C`(g7P=r(Mb|og9Gv0#C-2MS z(`~8QheI+#X4XAiu!6+WI#`x{;&>arb~SLCv?$v=zUndR83TD700W92%6F@eyKTk^ z2Mh-$f0%D6Xn(bQEBgL$rhGHW6oFL36jsCFO&79Tiyw@gYN|xD$FGpJ1Zce&OAdxz za`f7iC0=K&-`AeFLv2SM2a4`R{$E~u ziXj9M2w{=$Yfq3ALXq(B@E={@-?U!lfuBNoKnOY8uh*V`nA80A;`1)9+u7$zcrF?Q z1x>)1_#CR+4^$l_BXZ z@fZK>8$Q=#yBizz>acVOCycXmZI%dU+}YpA5mU=`_T{U$XqIP^G2$9rYkb~N$0M!A z!;JXi!s@J@)fsX|_=_kub^J9Jxn~bE+5I?syCC`7mVbKI%2nXE^9dCvW}ZilE`4eiiYPVGpy69{x`ET%zv{hO_GCQz@=adWvqC(p z#OkX~G1bY22){cn5iU~s?4$)tr6bU?o>4i|+^E4DXKk;u(fKkaNUIPj7EV`W35!(j z)#w-ThA$Rid3D~dt)Hh?JU^{sKy=k8^kELw&8p}DCz+%Z)dE)6bS@`$Bu1Q*zq83t z_&(#Mo8NSeb2V%99?szQq~_pQDX+gi6FWlextpH%jp&Ls5gQlUtt!cI9iu`7-$CA$ z-80dgG=_H~y3Mja!*3c;6sn}L3v_Z!%cs&=V9L&ChVQ`&!6gG}Y5fljz zkNQVM<%jbgi^~4HsK(A7_DFvp7MU$`@=Kh;=xnE(;Z5@tkU#bA5m7nW*2#IKlBm z&zW~()xOGUT;?&>CwQCQsoZtk(dEqcUcf2rs$-JW7YUvjTI8&YVK}JkI)R5QQoi2o zktQWS)RQl3iRq%b=*-N{Wg&X_Re=&e^*!yQ{)rZ{$rf|YWzGP2yg4_XE87))YbxGn zPK^5Xi)tIUZ4xd!;rS?9Udl7z84ui{>=&_gW8ksqYq)hH9_dld@kW%qRePATtPUY5 zpUnH=d9VL`v4Pf(1q>SF@JNBCsOr5tt^cCg$vsub_sF3DMh@A3yKQ;@6sE*gsD~=&@u*snkZF+8Blh5tB_a1YC~_K5Efm&_OT*$=7F15M2^>BY=T~ywd^W>XJH~h| z?k(O3-Se~fqUT)_7U@TzNkuf&1zB~IatP52ZOvvKP1De4pQwgPTAfyGOU4b{bl@h1 z3&97e_q48VE(S;Y7`N!L`UsnCentj zwR=A$E$C1YKC@oZOI45~T~wLXa%LbY>YM@N;gwJIj4DaU3Lh=`9J!oxGk3VFNU!_E zv2v~U{pKTaPUeAy_2LACq-Y55(Rmp*l|F1`ZeV1@(fceTW3d&6xHF)w4D{`ByT$Fwu6*l*#3+kUiI zjzcNNR;TDCI+yuA^iC`Jm=C<{yZC^LHbU8C!0LARL&tJAk@bcd*^`qZdH8SP;5KPOjV;P^oec7#;LSQ;{ch@Qxg{E< zwZ1qDSD6QpAx|1^e3$pF?b&};u?#u6rrYLZIzY7Nu=!=%HM{k@3n+P$# zUN2;#9n@wl(3^Fyl1nJE)|6*XcF4g;$8QNl=I`CwA5JFr<~sRy8loip()=>cNmt1m zmr6Y7`!1s6+uw}diJt7_!z(Z5MuzhH#1P8Z@9=8jt~ds|L=h7=qT@w{q6RgY`C$Q+ zw)RnNrlrRDG%E^e9M-A>Chd2!nl7N@=@z4EHQXHTlCj)>>J^@*2WKU;9UhWW&A8=y z%8Ume8y!E}?etMz**0@k*16@ghwF;%F8pCIvY|8JapGXJUed33zVek$F{jXYC@hx_N)NpdG-r_Y*nS>e}0V@~-w zJxKRL$Ln8j&D$qs#VjmlddFVo{~^Z`iPwv_T&0u2*3@g7{0SXD%t0B#=;9UMeDXnJ zUhoqK9Nyg1L9XnV8haY8x2-k?(eVRzi(K0w_4;e}d`*`Qg*x)N$D?zs$q%Ubc@b+p zGw$g4QymL>kEBlDiRT?%@+h(nUXj}SP=7$`;AgQuOA)26h>lO%pCfV}7LrSpp(b!b zysdhP_nwoTbD~CC?d1*c!p*bjcpR%w*jQH#;&ZL54wgv9q*$IGWKs8Gx~9$-M%I$* ziT{M3?I<#_M^>(M1VRqDDycA-PdFYV&pzc5&B#8K7|2G)<4v5?(j~)P45)J_8wh9r zS_6qroXSCZCkN=6W;xvAK*z(LC?t=ST&&H47nC^o3DyPeJ%H}Q2+L=7YZj7n?R?Sk z1T-lU7x*?rA4m^i7uZdBnMw3lY$hvPSQELqjx=6LK*tjjKJ7-HTFgZX(OvSMj@2N; z3w@}1^E5X_?ue{52?g;__^yrpj5Jo&*6v7AgkPe}t1pQ#0H@Aea8~accdz*ubUX>N zz4gN<0A4*RnQ@2o?>XalDxmFv!v5DiK~abb_pHN?|I!Z zx^Txwm-!wI^8;c=&uZfi1poaLRYgN}Ji6sS;o;}G_6+>t#$5I4%9rK_#4j3bIS*aP z>9g`%yz(-UG6kK#DDG1IRw=Q30mU8vi%kOMR*n#1N2}HhD`%02Y=YvK=y-AYm#m_R zl#wGA_?WY-))Ja-TKJCEHQP9K5Zi{!=9uVs*}klt37OT~26`2{R@31vk5}D&Px}OV z8D8}ycj=SyLB}hkk99|8huYx;R}&;pC^Ya1R26OIaD2H)r19#FA5}6sUgZU@4d*0w zX7u~ht}DE+NItilxx2mM7z8#FH08H9 z4{Rphg4>9o?TF$kEGx_^y+#`^tzmxKd7nafqig`!}wNJN^cFv7XIk~D|EcqdJ^&_n_7rL zzOwCulj&bNNm%@ex5%A7PQ7XB`D*8fj`wzzsWE`Mz&AciXQlN)wmm-8*n?y;-L6z0&g}L?%d{F(WbKbB^fvD`x4Jx2d}sLtbe& z-%){iZLG10+rBxx{o?fGL^73hIXXUWSk-jxM)g)=d2uSt#m2E@_+qTbHRTk0YH!wd zQ>8j|eEg>Hqio>C4kcz@ZxXIU55}UTbgq=hQ=M}YL9gw$Skdu`SM#p)&*3xRJn(Vo z;ab*R8j@Pqai5RfFC8Xo3R7i3$7kFevTM8kl&aCUo}^AQ`8q&F>Vte&sE~i&zJXZK z>vRDNk-?37qt1S3RaGzh;@(5Y-`fz-Nz|%1D9ywT+0`1X$6vIZ-C04d7V@M#ov>6& zM8}spaePR1=NS65;bal}=F;WgBsF`ai6+a!pJQ1MN*S}D<&zNn{Y$)Kow;W||eXV=i^VN|eMCgU~hC5%f@Fb4xIEJC(nkCNxCH*RBSq9)sJcR z6H@Oe^D=)dpsKTs6N+v5DgJg)Hy2edbB8l!hvS2{@#y#-*URy8L%BCEm{3+HH|wga zS!;IC$M;F@JvAK;o-axKs!p}jCbQdeQdhRY!PIy}Wbf3LTpv1q zv}Yk*WXq99G(zEjmm$sLe$j)cI^Ki#Nm*=3r3Ngr^q2aD-$?N6l9d}pH zG^*61kjamVjTtAC;wSy-re?HJPYfYrNJ&i?I4~T_2;Uu~yYB%}!k5?MZ0RsZ=Wke- zMK~kfaG+{-|G8MdYz@_l^!2^!jN;%2v`hEws_W75{^PX7`Gm2DR+1QW__Iv5cmV|D zFnz0@nAz3XIGC#dI=)k?Qi82CW6RoC*>7CzMe4g!Gv=N`6@g`8Qm;1>^HJz{Nz531 z8G_bBu~tLJ+Z&s|Aq&Xlrzkbr7G~Bfcl}JTs|W;``h8s0;_|kDm`c zJeKh9YA1^8-^J^=-~XQeN9{KJU2>uL{9U}jz4X707izTsPPssS-}F^f4n_gQ>J$gz zJ8X3AwdQ5`v)+XPjEWy8;9w6{*gHv~^0wlkLgt0j4BH9K>;USh3YZRwkMqC# zo6Cp0nfdce(s~Ubw@ao=vLgMwTzH?hMnwltUqIAjN8tEK3UEj*{X^ACfHI&4uz)Yh z1_D0dNf8IY9i(&s8}R&yFW`LiK>{8>Jo77}T)KleGRj-!YM`|9sLG{jHf9$-;@8ZI zmGLFj580$S0Gi`^51B9i>hb@&488sl8RDSjPfp57!#kmtQyj7Y%W=Jj#K&X(Uss66 z0OfN){rIM zxL`5KE$L*7BV84H!fQVmKtx|&z`9eDOjJ3d#<^GrmHWcW_^{%UobMw4de=BBN#QSK z_@=tRg>SNamjMo-{sfQewLOx?7StGm?>86eebO5(BQ*D1+dfR@^x9r{^KbKgJ2z5;K_=)u{=KzlQ5Asc$JQc_ z>U{}Hbu95|0A(#EAjJYotpoOv@X?jWkuA9aTwn`Mfh9^H?Q}F=9^khxSfT))%<=&L zP^Yy}mWHBOKs@3IuLkCVfCRt?oCQ$l_P)ndltid#ip>mxu>%EVq!hdFQDuLUAO!S( za_6`Yp#i{(ialSKWUhP(t)}h({n^?7iPjuP{4?4Zpm4uiP5y{sAmX>A1j^qY7_L1O z9dSNo*q_&_tVU7gG~Nx4Bb%`fa%9E z6gnEijej$SqTooVf#ZSlhyVA-kPzh<{-Y#^jyf`wzZ~R$rn$c!h4VS$8+Nc^fg+SfR<~#G=@~7C^cUEj(O+54$3K+9V02}sagNzF4 zsPy9?ivlRu2?t$>!;z7BgC=GN4yz#;=4`=S5iGxOROSHUFrXB`oZnaHyE@#rII$r$rr@ay;M zn#&r=2xJ=up3vWX-Jl*B0rL2>HtB))Q0d1uiG6F60w}!z_%Q-M|7}Z96Buw}8isP# zP=Ki*9iJl|N3GaKRL*I-A%FOk6*Cw#B41y4`Iu+LN#*u!$~$g(_?<{MmnG`wSKo|P zKM$YIDF&aVc`s@OW&pr~;`Dop`*!)=fnk93(Q*Lucu@eMCOI-kfL%P{dY#9?KOZ>$ E7oXGm`Tzg` diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/rhel8-uefi.bin b/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/rhel8-uefi.bin deleted file mode 100644 index fcca9f4388871f1a7595b6da3dada1b54016f676..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34034 zcmeFa1z1(x)-S&4*qctJL8M`CI;6Y1ySrPF?rso78bKNfDe009DN&G6QX~yf?%u|E z-*@w#?|k?9|Ic&obMLosvzTlB_LyVMHRhjdkFV0Hdmc}nA&+yzwd#@&B=2RsVtswqAb+hI;IQ564tRSKoTGgWkUyG5AXnZ0lWd`04Hc$ z=11EZ;0tYg0IZ=$d;pN2i~{if!Re#ePZI74AH`C&sTg`lJoxOZz6SyU_q^T|EA2F9 zX;+d}Znuq8Ya|F8yxv#gD9YZbvHQm03IaS>l?xO<%W0#6g8KaA(J7Ra2+q79M?mys;_wfm-govNj zQHqsdg8-~=rUp+n=LXLnnh@@rR}R*ZLZrotcmvuv9WK#a!FC+y0JCol#NnTNIr zYp8gjy_&CX#=S_J!Fz%QSj$FYiO2lK6qK7EnCN;8P15Ggn3AXleR+# z(o*|QCaN!Jw)7p^=e3?ggz;l-gHM`Y1*sgqOYYrc#yl%bC^)f%-4{a=!6p4tW?7%vh8Fs z;84VKa45o?0whEPL_`e0O9jGh+c4u@FcvBXbEI74CoBX6APNAC3&941P?5Bekw7Re z*1m3zU`i4!2tSyg6T%7Mfk1c+el!I*!M~b+^Nmmh+CP&;Kmj0yBH#d^-D4t#A|L?9 zT3@0Ee0FxU+$BLAu{Z^$jeJku$O~YVo`^uu(2xtbki6Z6RT@)w{F-2hcRR>F<4L^h zR1uvkcdu&wBget7L}bs>dmbjbMWskg*wf&o-Cy?3?}Cs}tMwcP(_K6l(%HaVkloD# z*UlMNAX&x~T?)L-ER5>!@NwOZ-(JN zTM?j}@J&70oG&lv{$`6y#z&1@$ww=4cPPd?1oH8Vw`H+pp7E}vKFuhfP}q>6(^Eu5 zLI5BXYl79m6wr~Tz(yuUCd^g~N0K<U z_Zp^eKO=Y;&$`f2bw5QkD0D~U=Lp4H_9k*v@E?N-^wdl@C(qv_Z+?ThN$?t@`ZNJ6tzeX@U zTotes#4n2{8FIssOHFsf^HEt))a$-=g-g$Sif9;7Ltz-a2D|oAV&Ndx^k5F*8sSm5 zek7jWRuOmfhT_5M#ap8H%_>P<3qIT>%bE1f-&U#|SC6vO<7!w!=s-rq<)>%PR-}-= zu;t37e<)f-Rw5}iHaHL5C~L5{nwhSf4eERt6KMV-R-{J_ZPZ%r4WtL zu$C3JyqMqB;p{u_?FY4P7+7)!;E||eZvY?j6Qv~%o~?z~=j5`!KWj;u$9TKmja*&@ zCSR31K~>AKdaNEa9HE*-9Xaux<8A&`X!pU+_{6EEgM}bavUQ#Q+jo>NbNz&sc?~Dt1 z4;O*ied|jY!JR953=TUVnX5L{=PT9j%z95QuxI>*H*>9p#+aD%FFo{&_G(fO&v^)f z2NCx-O~>+l#t$u1dusi~!u_LyHZ;n&^X{S9ClUSBT%ic6(2-IEzY@2M5m1|BuMK}4mN^)oeEhS4ArUyss+lCigsRJ zZh{;fmL5**&c9`u-O|;W!_Cnic9g@-!_~^$(#w+rDi%-~hl(y#ZlOX8l~q%yFo4;h z|G+%#P$<|86&-q^C@5$M2*_Gs4Y1npHW)Ed>Q_g;zP^9gk+sKvqX#dz>5CK!9n87# z=rh7}Qp6X`cP^My$w3PR(?{DHHsv3Rn!N8O1D>#z_!#W^x3uy(sNci2I)7_*jA;A( zQ#qMmXWK-yo)u_bclbuJDa!n-!72L*IYrKvJ>wbhS@+qqHb1mtmhZW*xOKw!LtoU0 z)4M%%-1(l2vye%(^*)`dff+=i38o)yTNjD*`wXgNzc!}t{Hv^xN~!h@q`f{-G4U7H=Y;oOZ(C8iG_sVV(xHRYFITR&A=s} zBM1N(ZMd-@D4Z!>+_5}`ZENlN+xL`(o`Y>x&^Zh5dy4(CX}6&J>%J!{F4Ss${%y6; zXZwH9L536i|D&xIAJhTn*dXy(BmFQt&h~iOkq_=2G^#nV0asF@2}zs{x8-WQn?8&vQ7YUB z+zid3@bgs$)pefZ%o5Lbd}S$B=QlpPXnW;{`08pOlPvRP*s~i1JI&qq#O}SNVq_Tk zdZ=SU{w^>*u=}G_gTKJma)U*jau>hby4@|p5v~$+zL$FTCbIztJ;<8q?^WuUqb$+Q zT`h_9cNAlpp87bblN}gt_CNdmLMWd^HtL==msA3UA-Tp>_-YlXWAg?vljl z40U@L|56p=@{%??mTc~StlK}apMPuJc+e%Tz+)4id_dK>c6vNaGMqjP0f+eF3=(7t zPn<*e<@5=(Pj>XU%ZP!YPmHTWmxIH^QIi@ej*(hVZW@yvsU?4TsvR!DNKW0^P@_&b z&|Q_4K|`MW3g^=IQHEzq^o!0;jaC#jtX17d1?C4>Th8=LVmKsX!xO~{y~?#Y_!Q_` zNu5I-tt`UwEL5DA4m9?vxx;}H+?TwlByma9V%<-3=)D=nN05roji=x9YTa#BYnsKM zM(b+#T3w+`3VwM&ddfja?8x!PCcchtYbbp2V7G@Wv|2}zl8w zwpo|U%~SuiS+krqWWNN(eK_w~+cue$&8DmtcA`$u(|qFWhR7*9kz~3i4wEFch=jp} zP*d^3Q+BMi2QyCIo6Yu3G?8D?rq9=vryCKL9d4X82!*KW zlyS0sFN*mh5y?QRT^RbpAonvkTZ^zvHj|!X`1YoF`b{H5(XGsl2*W!fqV2N89@^{l zwDn8(-Xozh7k{Emmgxgv&EJUGz~*7FKyoK4JDg%DDA4CK`^=yIY|YQ@bDL6RRQmZ^ z4Wjf1>)z(#Kzm|uwA9?QvJU+)J$U0;%rWW`1vUByYhXy_{=kaH-0|7$>ApG1AZq6TO z<7blx)&z%y|65pP2ebZUmHrP_b?sfOTzx&M)qXm>&^V4-?Y|rFyau%wZL(u*ydU_K zY2N{$>9ptKI;=(>)e8QA8rD8Q9lrEwChmm4uCk<>Ex^Jb$krvBq|4&4dJjPDsEJhO@59#7uU7Bt$@e=f@ z&NI}satev3vc4S}_uYP?rSi!Lh#Y0zC`nr0u;zTjci-UFS2?8LmO~P1IYj@p8=05SQ)HX zAYULGDgD0{@Ib{ED!fpc{Tb?jdD%F*euO#(ze5{nsG|Z_0xSG(Lqi>r|6Zu`PiX(G z86dn2a91z&?{#T76cFjSqk-eXB8p4k`Mun3O0JAsIW`mJ_6LYevbq2K6+gSQ<7xL6 z(qyLX9atNQE?EvjB? zIjMp5%Ju@jr$1InJlzk7^wjOupz-83I4O?R8Ae`4!#MaHw=r=Vm{{}i92kp!Av!|g z5v2KS@44mLhA_msE@bPtYMi(vU%0$Jw^w2+Iowo>;womhjY2lrwa!yTJYOu|bgPiL z0WZZfmWJ`;#2ZfmQ;|v|v;9>h-11qBozwHoh~^;mXdBrZ2}O1I!XeCdD8B6}N*4E; zd(ej3?nZGVVJlkPeX#T5azcS`gsnt3fc(4g$}=2;uk-y+5hD-{qbVS1yU zlj=N}^JASxA={gZM#y`DdxWyu7RYMZf|^T5)BnZKX6oqUOM0Hz z0jc!SM68jcNF~y&8!0oU!Zu<*&mJAfC^5E}FR(y)S$s-I|}3KdKw-%2k0p>04q!t{?c< zAjjm>&8T3TaP=Bg{MFpjfD4m{Ta7?Kc(J2SN~>pr*gcE_3|h+8Dw8qwkm;|Rrl*2i zVj~^7Ab>;!JzItXqIiX0;?{sl+1kZL*U>p{-%4#m=NW zX|6>Qu+A#9>iNjJ#fIWcK4t7n^P4Qj{HHAwtvSympGju7rT=|ww*e;G-T!57gIxP|5{f6Dmu-ySY0_hT)Qd!JM$0E~C63s`RAQ}u#l`(Zg6KTYJfH{nEg(j<=b(7xtMK2RA6Yww>dOBG8~a5qSxtoWIt_E zNC7w`@5iH>pAP^K!GNF73+Q3b3w~>DBqUVKUpYEVBvhz#fMFIXhY zG&p~9^9cV0B_Yb>$iQecfzH#Kf~fTkt>e7B?MU(9f`y7v(-)*Lv5=Lhhj&EDvDEX^ ztue#pY&VNOmnnRFKR(`>zJW1g%tlOxLIfO@Y7{Y-pzUWiQW>BqUSHE_*gK75S>YEj zzKAZ=u{LE}qozLI;YVuK{Tz>~G1MtQvL@a%~Krkv1=Vdi}Jq5Hf3EWPD$w3v+XGyHWqX zP-A>CSrc_}t4O$OJPn{v0N(9=_Di2U{Cj;84b>-ZKlKR)7P)}YR0S7XO{d z2NIxZxjNZ9L$%1Shj^F-D3bP`maY&AFxd}PK|rWu@8RVQ)gV6-2tU18aWM6dhkD## zE(jkt9~ZX)DGn!CKmZIozzY%J0vmuu|3MP;i{!7T2S5;-xQmy$hqWh!4C?Q|o(_QU z|I&%3w}qtmzns<2lq08Tidb&sCu5fRWUQrDB#5M$A6o}bzl)|FM=y;dRn6o0 ztVn5>a;T)<`zgrw^oGpim~Rp|Z%ZZ=9hhvzhHdwgcGlipeq67X{y0;v+a3ojj`h^u z(4D>P?N8cO`x+`QXH)OTQY5P_cgM=I5%+~-nGk_DqYlz@f9_lBM3nm%va7RNPrnd2 zo$gVu;+hbe<6*tteF*p>Q=X=4i*lgxRo64sBiOetmej`7nE%NmP;7ddBJMI80HT=F zEVf|E%9(1^sK~gCh@XTP-XQ&$I8Wp5(T&-Ws9ZJA7h^9!%^KZ~u_!r_-8+-4B!Bn_ z;3ihcb2RR^J5c}I(+q)*)cqe1W+-rA5B6Xganv7{;^#a^2ctp{!;>eK2()@hR$kY`mJo@1!Dc*kMncMsskRcsMamL%eZB$~i#U52_p7eWs zXjK*M2lF?HZ?ep8sI04Q;pC5-LGFJ0shTK7HL-qU?0-uW6c!L5z@>8kc^xAwEtykq#cUly|Z)ieX zF^X;499S~vbIg4~a|d^(+}o?;KhheB(2qIOvYTgR)aJ4)>oo`ZA@*Uner+&hcyqt# zIf$^zb3dz&$mHN)tJGW6Z_RyzV(uGm*<)8D)REJvpaQ_K?}^XEt+74fEAl;4A<$vvmjxSxgv*XeMAlp;o(8XHxl2M zG=y*UUW#Soo%?jfw_E?zI?(wDeLnmT*8l;gbdYg>xSbUA$S_;-hZBMDr$=>Y!EpEW z$6V1RD=|}I+Bv@OXq5J9%qgE#)Lt&f`;FB}m;y${ZJG}|I>v8Bmb^#Dg1VG9w_}6@ z@g$z0;-nv^1W%rIU06Fr<_P@q8oB$u49QTdnzoJh|E*Wn}*h)NI&@ONE z7KeOOF-9US=&c%fBlCWRd=md<-nMLBT0G~t)Jv}+aE@-N&Q#ze3SQ&s3DcKXxtcSb z9Mulqx23Jx+88sV5?em{>wdk9eMf;mwc|MB_&wv)r^W1>CIXL|tb;pGmhnZ^d~BKW zr-7K1QCUVFuTBuW6kemX`Rq7czNUR8gSb$OIdDMKfx}YqDxoXLwYsQfKv_ZdX^&2F zGs$h@{vIW@RI#cG@h`k-l8jEYKVt^in_Td7CAe|P9@2${_${T3^2W3(MTy2c=LWI( zax-Ods#NQIOnCemM_BRKhZpmyI3A3*UTq>tbI%w?pxts5%D7+ULN;+19zU?OSQxoJ z%!X0>gxNKS-7^YH#Of2P3i_d~ze6|Yoo`Pn;i z4<0%)8L(iY!sGiYa%8YdtO|7d^qj*c&Q5F4TW|&Z4`MjI*ghU;f^6XNdKc+84>OAN zC7)iH(&HAaif$_DjhJ9QLyltdwyVr?hsSHC^c7v;(IA#RpB&CX3urs45Zmivt7fo+;c zR%~7Oueb(_nO{fdn-P2`W@qI*8r^b+$1@G?X*AvuER17aJa8#D3pl*<^=;dCJZo>G z<9CGN3R3X+a&5+)fkIr6#p8oFIiEacA z6C$4Qc-b*@bB1-)oX9mn$3xaR+|L6B&W^8mY3%yQST~prR^jpP$H}fUwDN&k#WEI^ zx3VsWajAWA&Is&wHkP_Zzgc?2<3nEwO*EdPOHSlv^-V{O=jw}(3vc6M>$$Ql>+tEC z+QQ>w=jHT|GMdg3YM-P79n5X3=I=(kB*~;%k$BJy=u5Z4;}a5#VkX~XlA~36T8}b* zP(PTxbFAjP9eq(fkKGk4M-Gp#*{gx5GvIq3WISQF#S=JyR7BW<1-WRmKl5Q!yfi3; z$M<7&R>^u-FTP5BLfh0rdJ&&qD8ov%Q$pNo9Lp8mdkK#pBWYtXjxRUACt zO4o1+-!F%quv+Jwn@XeB@iXX)6u?j4d*`DHo7I9eJYITexW*fEvR&?yPvgE7{%b4c zn#Ghm{VH?r9wIC*+@MAl@t*k&v}*( zD#}~LFY1wgcNt@4!+13oa985R7CzVg1g3uAHGPXaXF6J(S#v@pvVFc^qgT5v>%fRf zef!e=oaX+dd>aQmeZ@$-(mCsn*U0b<45*+kWr6av~#W+k+9bH-e~clDDhNe zn;9leB4@EBXv5>5ZlQAHbUErqW^tvV<=<*{EU`x0FiD}P<7H+Z-*JbM10J7&oR2NeH1^!B)N6P(Vhs!fNy5NfK9xHcab=ia?O-(>SDE9Kp_ z_=Zoi$pj=cdSt|#QA{Rr*mPC`Pyg7rRyB7eC3ZW%*r?~J3U{^=a!r;sC+nR$d0k~* zwQKeit5?Z;@8+RS>ycpV8?*KO!hUrC_j+>sQ>SxGtz5cm_Bu>2h)UfXiA_1 zp8tN0%5XE!Rf7rou`*@HyBJHT;Mkkidm3UJ{d+Ge#;)1-qezkAmQ&I6YQhU(oPxdl z-FWN$4rcAOb_r}>miUzvc>4E7Mzt&_a1f}P&`qAT`A%2Og!PLm=$hT>Avk8;8}Nt6 zZvzC3pJOBIhHL}W{TkcOigZ7^5T($R1?ZbPtka`@gU6FMuDm!N#-DuLn3hQ3{+%T= z1!ohD#&t=H(U#3A(32P*FEYU}`gC84e{74cm7)Km>57rQAfL^vY$X%PyQ1fXj_`Q9 z4>FuX&&h3uMPgp3?S8;dC(7xPZtNXmyFVnKQ&b=ck6%}W7-$o_%L&INdp>1*OQ!sG zkG+!S<~O#7ko+?f^eK4!`(B`6W5|9qG}~9o#22!tXmGPvHTt%rhTHr7#wYar@c6*0 z;0mH)rMcRD%NXP(m3q5!ZGZKWmjZR}U`A~g$9Q=Bdpjy32+b~~?I*>Ky77T6L^oEl z_yN;qV>h;o3c03Jc>K!PowwcCn|1ZbQL`QeUuDmFU3H7~pWkB$rX*CUYU_u`BkEqc z<1iC%#ys^(>-Ir@JYHeWv{?SlZl<}`QUDoZ438H~`S@jvF{tQ)()~0b>rIolO51OT z!3vuh)dTVU(s!=Oo4h8#AKNMSSRJdfH1Fxlz&w_Sg#{~Q?tSmJ;s|oDEqMANu|WE&)7!BR!NG4iP(iG16`%b6@uC7+V9xM{~<& zSE$DDOf~LavyZ_lJW7^!?FYicsjEicG^_LPly*Gyeq+6`rrtLvPwm$Fj$g-IU;pwBd)5h%VkSSAN zi4s|;JJbbc<+3^*u2;GZuJ+u>Pbh`QV=#Uci~B_Xj>2})oxl7;hejqFqwJ9jPZY5b zF}8Sf^)>vL*b1D88}V44pK~7vM(w-mJINEMT_nY|1($KOrzpbXF}-(z6mGjEvnO7+ zoSRgK8byNi9eB7fTKgPTm%Kep;PD{!g=E+MG(349r6O+_Mg6Y2YIY#1f8lEVOI*q_;`#2Kke3OQa@nu7V;WA2rf)VRb7)lyI1gogY7f z$CD+e5S7n)ZV@n+`_Xk;kiXMjt=UW*VgB)b`5_QvK1B$sb)o!k&Sk6T0JItSKpQbyoy-48Qk`0gNvtF?8 zHvAGNagPTtS%`*jyCl~&A`kOO|G**A&!LPP9?$P=Z?wuL?XyPqV(e`5k>9ddk?W^9nUrWBeeZ~k2`^GMep zb)`Z?`!rQgeRzIE1a5zPR%r0DP~5iN>TdWQVM&?|;|{5n?O{IgAU4Kp{-+q`ptF8U zU3$d^5TUFSLGX$Ktcw%&UY|pP;<@Q*TM|5d@rY0==SstJ?t6YkET%b_-fl09(jF_z z#`+6~we@GCT*FU)sQ2yWR3Uk7t$Px_#rXzwb`v2-$`Rr4sd@)}o-aIJI?7Rb(R|KO zFg+N}3-PXTqk&w*VTO(Ud(D54y&|)$7i+#mKJX_XfV@**He}}@!7;8mB@*tv7~rgj=STNlis08V4cbnh z@mk2|gXkD7D|$_@LyWtj3uigA8JX~Sz2vX7?leQr$p?=thXVzzxjqz}e=IB#rRtX^ z$Q|ssmd`P!%o%N0xR0o4r?HBt@3uZM?|M%A0pa1)LC~W3SoO8|+I*tF*tbg`vHN?? zh8uTR*2@kTRHAi3^3}F?8)p}HuKAyqROq^mq|&^s$%ENIMcn>o#&zN6x0-jH@MAYt z>RwjC^KaeoevEVpsSmP>r?Kk!0&9eGCZFViSIB@XII7__Zj1>+lH1MkO`tD?_*5s;3L;OX0W&YY7ob!zNreYn#1eG+CX`5-Igro|NvYkCOR zV8S*1=G?wJBN878`rH`gb#Ylrt-P@w7fnFWPC+@gA}gDw0#Dz0cbZdowQp>&aSjJZT@pJ--4uK8C%@?%diIEBdX)|01=Xg?d0 z`dHLr1fh~QAx$=OQv)!-^B-E(CijxgY4VeG&LyF~@`q%Wd35%pVoYGJS|sBn_qF*I zqwFWZo5YztmSV8&#eM=_D6)BQsxKRV%*x`}5P@(lA0Ce+zksfLbL$CB4}ql|9VZ%R z)}q~UvR;Zc)8PR1;Wd9aA#EOHe?#Az&}VB!M)56k#8-{r=CfOKg?*PJQ*x8n{HtWk zvx|YPyUlN$(xVB@sNZ_j`@F2wog2=_F~cVL&bAJJy(!iXC5Q4t{I?2PZga|QuFvb1 z4$CD(gPIKyJTW*gG_T>a$O*H$5)B8#1*-ZJEcc#$t^DSrJi5&xRN?z#c+vqLpYG=O zCBQs0GhT4#VUDq$O<-g+>-q4=%NW~|%=Wvdci{1vn`-H5v%$-K7FUT(+A;XCRODNF z5i?jZz4wYLrZBF_PgYpd2dUJZ?UX_7qtjrXjJ#^;JJ=S2AHUx_?k@F<*np>>ReBRc zO3DK3Bz|#FowX`C$NQV)-M5=FOiaN(=5!&~ag9|0cBZ*s7;owe{fvh zF3R?v~ZYs5i=a`tO?dfAQg+~V{G9x-sK1h%^q@~rx)h6^rno7}p?H@S9$&KL*V5lvsKxUV z{d226dv9s=1^({6YC;E|{U&g_)wO(S#jV*F^UD$~0=bz583nGS=k=AP&phj1o)mnb z@obE9f~Q|Cv=!4WtCID`u%U}fQ(msc@fniO>WW_d_XXRgLc>dV{ImI{_YwD`!>|zo z?rkjURPSXCF=5x)7zoP>D(Jb#Z6Ed)JcpxG^(*3~4<7c3#v#V1$@e zF);wo|8q&>PveYFm;(|TFGD9u;R#YoYIJd)%{Y$4cQh>XIOF zh=u2;PtEXTAGegEYLjHhF>V?|pul?iM8*4AF{;T1`C#rf|D>M{ZwNGL5`S`$^6i)+ zT8yST%&9DPm9^bJqX&2vJqJ&JFwd&=nZPDlp{;~QAPI^C>BJod*BKY?FTzmh+rLb;fc&dZw#6CY z@ryZl(@t^;a~B<26pCnHKigv2V5G|>Z7EW99lNPWT=NH(Y+{=jBG7Fkd$^l6J70ae zr4b@z?@61}%3N5gOigwMPk))m>>G%)NhxgZ_$o3PX$C#bzUp{56a91TV@b!aGS~7U ztB6k;!=ftQ&JAiXqCae|e49CZ`ZRNBv%N3l4S~JyIXwN+fmpog6fk*@CCP z;e6?yM?=`Vk+T~e{)kb!lGD{S=)DTIW^SO?A{Fm7{kf5yavIk$koN2#aw2rX#9@@&AxnCSUWsE(0;`1|ACk4fkmwl<%1N+2C(HD^v%HPEqn2($5>)7?3naVPmEaC zcAtH-`c%c-de*A|k3XTBGauN=z!ei637{xitQcK))4$Kzwwg5W=qqoUkPeSOO>|y# zPs|W9D^g{BUWS=L^QOl36}^PveZh%4>i3tfJ&zbhF}tH$!0+oKacnt=+?bacjzs%5 zl}!h=qOQHE>$@vFeJWzK_z6JXIs2)+6z zDmxy_P7u;)w!-7J&=Fp98~5~yoI;)&o_4>Bo4wKG+gkayV)AITFJCJO_WnHV6;jyi zSjd26`xk!ir7;=RJtfIRGzNM#9&CC70jr|s*~k?fuf%k3u=NWs$nE;Zu4r_~$8V$D z>Lz@KcLM|vkQ8qrWu0Ld7_1BY3;?Yzn)CKEu_WqRdsYW7)rceH>yb9Lx{n-Qn!T;g z$B+5=>!np#B_9BEaqzEdK77%O?ROd4AlOCcH0<$7vIk~wNPqxeT#3pX$-Gt{y$5v& zvK$hrS4%=O9hy+)?M=d~-+P>a0LS5}b5uoJlo3K5RTld>msov{vH4);i!OejvByIW zsY6mk7%h^5`|h`L(YBVe+4!No!k5RvfF6TwzgCg`qk@krw4RR@w4#p(j87=Pf8|(n zg5-;R|D^g6*VkzfY1N^er{@e1fTk(=bbY+GhA_WM8ix|~a&BAwl_;GB;>(_QPqE8E z+#rCcaUHllQRKGl=vrh6BC>sB%W6%n;77Uj z0@^n`$FNFLur253?jIaOU*m@UaQ@)b0-yoq-3mYrkb_ou@`CQA0WQ!z?0VdwAA5i& z^lxf_67(+@Xek9hC@o|J<{#e${O;h_%4{V*k3;b7LYe4!^xJ8Ecw&f%$jICPBPc}~ zfIM{X@uMfZAN?3X>DobQIzuV)0=NO}&~rA>HUJQGg$y@_v?b>sa?W2BQ1CFmX;$=V z3cVy{0RkXd&ndw;g=Sc!;e92Y3dx09C|yl5lk86C7^d;O%xNG1U3Ec_hWQZ(cR^>O zj1PvzeB(=>65^xpg@cNNI`uP&RiBXWzT2@KNSdjL`|8!3?E>xnpN*l&-;N;|fC0VT ztN?8&=i<=ua)XTy8X;h$^I5>&XKvLeyCR#l*2IO#sDuETC#*7rK1kAGF0sw0Hgu5d z*GX~kYP(;Y1@}vK6yU)e>b;F+zEdEeyw2JWk@f2N)oZ)>GimC8n@E}9N*n71=86RR zfa6!ZAi%={*89ES~~%U z;-iQE#dSLU?R7$a+!0FXb^g4U)X;iiu=-WD&>CSd=}?3I_JH0|n6$uT2PQ#MKU$8^ zv(Oog00K;jBmF3dg@6E^K}bl5=s#$}MnR9BDwa)$k#~_AU(q^KwWYW_EV4-|T|eIk)3?%(e>t7u1qD3GR&0 zUM0<)oS^GNs9`JL#ogSXZv_7+N<(eq;p+TjnF+P38>~tV6#5_5iT^o`4AXM|x!!+T zq5qUMf?fB2?%JX2mj8pj!|dLF?%H8q$Qt0cP5|M=>#U{vR*jnp7LR7$WKj&!Hv$4M zAyLFQRX5oAE~R#S$Eov9C}_#~7RwE`JLRpN5k41z0EV3RbJN2y$g^@-T@cPnJzgh1 zm-k^ZXS`opRrqcGK1KLr#zx5y4yqk!>>W11X17Pd?pO z0|FB5ayQI{I!m73Z3-m;f8v}lY*){Lvli*4wbBU!3~i{tacXHUznH-{O^<9q z@z*UlM7z7@H%(%y-_7I9wJ={6j(9sGr(E(A@BP})VJm2S0`q3o#5J^F(Ww!XixCnH z7MSINp8By}T?N6MIsom@Cg9Dlc60I`^PRU@;)(0}I|oeqD?dO`Oz^Ky5@#01?_-Rf z%so_}XYkq-0RBSP@8;O|)RO7@r8{MFa*cmn#8*RR;Y`A0kft2XQfjUZqjS7$E-S7rE74|3(e|F`Ts6B4R}M5x zKVd0-Rb=%kS{Ln?N6SiMnLP#q5@H2w)Lzc$@sAiGDO69~(~8f@U~fq^;dNQo4AAeZ z0|A0R(7SUf=yoO3CD3F_$!{Hljg+5aka9Y!}(}LzX>WJlRD1#B`3>`s!?Y zjyrX(l)Se&x*#HQ0|e-qg4B7*=p~insO$?zP%k~2qN3peKGdTmI2|Y-!XGuc^L$Kv ztkO$HTT(JVu>PGHlm*f{${(UJj79-%{jtH)Td?iFO3&CrCm^hH=HI1fet!E$kp3s9 zyblLENOD!kPp_Sfv4t~S*FIG)1qeuGqNFK9_);jbuCqF9sO}(Hzr#esUc0OLttqs|6EAdKGCzceix;}ql#3r)4i;MV`bYEM z&%nQ0raIBKD^5ZlQW%ZVRXA7iRg*pMQOBha<3q4U0q_)n!#f-%eqJ#`ByVl?vccz( zUJpCv?qnLjqwIWJ>cD5fd*4!B`&IG!{$xWo>K?BrNRh$KCHjXI(NZQFVspMkg~$;P z4^Ia3PjGPN!(}#YR&G1YFUGpaD!kZGk|gqaa2J&`evPYZ>$8ll@Gf?`P?zxQxbq-z zytEdu-=ba*8 z<>ss=0y5`XCsHAI1&qQNlE?2!&z#lkXK{zI=QlZTAS&K$m|0;ezMVmVfV!z+?}s`I zmXfOT_8rrz-gKd*y)wQ^Lj`@w7JMks0t%Tr`Hc1$BhK|JJVW%hoPF)W&dperK2`Txy*mQZjMDW46X^@eW_~0s`{$IsHg&`B?pU56e;O-4hO7~=K|Nkh-S2~M6I%J6HLqbQBIm2O(=DRmRv^HE6OH;aZ`QrbUe=U&nQ7^U zj_RSx+XQ@S-c@YwSPyjatI0fSH)r$I6>lfAJB-P~4E{fuHKe{aXwxoyRCG~c(lhg? zY}qy-VUDi|xj?`b^YhJQbNM&qkX3#u!~6FS9z9s9eaJHMBy&lAdS;&s1o(Q1h3r0* z>8pzwv-qVPxZ6r_;+sj)n)%$M9XMWZg`#hI(#O2V{IdR7sjSZA3P4rb%z2D5W=vP0Od zo%l_;*!}oh9`64Rb*mC9o2$*v; z=GVY{TBI(8!-rb<@r9(I)$R%l&IfJ3h3#*)W*#6wu{OB_!!wz2OI2rP+v)C4y8;Uu zrP=Y+8QS8Zwo6i)ywriKmD}%M#*9KZ@L7-9V1dd%?yB+~uD);O5m<<=*?r-MMjlapsa0Lms2DFW#uFJ{028;c*^B!^TX3OHU5a2Qkl z1v#v)2?Th?V*T{Hof(*z$mVEAxAA28F+v6I`Dywd6~_On?n(opY}@v2UuNu*-FV2B zeGAzVWyu~Q48{zDVVJRINm8jHOO_JKzJyAa$QlZXvM&jVLWL|P^4_DKKB?#VmS27T z%-lCW4##;N=XEaElEgrnapmDBsQ97s;sOsi!=ODKJ>Y0htS=s% zFt%YLygYGU9>`q)XQSUNl#9kSE>+A&o4zk7t6AFuGd_tdi9JJAUxJxUBo;=-+j`cM z{kCdeAABzPhBo}P`+FHE;G=3(UV-tx*L*Zhc!Q32O@Z3-GixM8w49jb0omwVhG|sO z1lE=L{@0f;9z1D#x`)`M`Z4r>0QB<3|F;PLFkjJc&#nm6v51&H6NpItn4mp#-<=Ku zJh!jYZ0fLc`gxorDqnFdmITf_%Yo_&^V&8c~|N zOsTj>|M68#l5&>dZt^A;S8-OKL+w$9AC>r?u#!-}&i;c5NjEwtqrx!U z47S3^wv)z_Zd|_r^7TYI!?BJ&ju@QUE|!?kMayQhmJHU2E+vDs(z4A@7i1wo@%x4F zqWYeLQRHvmfA!+O+DAt?GHIG$$)+Mh`DW1ojM-H1oih}N*hoj06zB-Uk%>n4pGeIZ zD|Z*trWtBIQ7VdHv>Yi$tUgx!=A3O37pwOOZypQv4P#hV3Tb*ZuE&Q^=Zccl) z5_I!MgTU*P^xaLvxn@|eJWRSEdeSK_n2zK@ZfuNxLm7?d{a}TMP{57L=|x<#ut84; z^^#}dnb7EodU+aZeFuD^;GHx5UphFcUU?^BGW9Q!n=j}yBoQc= zUuH@Q-UBT%0bglDf#Q-;^Fumw1zo@D_$(cea^snJLIKZ#%{p! z-3_BeRW#)uWqX8b$UA=@!?^;McoLdGRwxio_ini?Jun$>t-9{AF3RC3uj*u>!!@*c zx}NkTivI?sxm(7)ENMhOc8w<>2C~fX13Xg^9!-1c0mEIp`0oYt4^V` zF(bxyTMyG?4K4~fvdv`f!IJT&2nmtGgTqBqQfYKgR$E6iRc`hE1nE0X;IPNT!B~73 zO93j+?|o$)RX;D3)9vms!faq!Fa*XpuZ0|x%Vwz}u348~TeTOniriurF`ZoXj@LbF zqDB1?EZk06e*yM?ie+c&h9nvvpT-oL2O2Rw6A&DB|kn61d}0`-T@H0BHs2GFkqL~cC|avdontwGt1 z3P1p}$UT%E_829a8G2rXkkt^gWuB{*@W7m45$8&7Zge^nh{sLDtm2KSx=*C8KEmw3 zU7E?#Wp@5A&a&RB%jPRb99!Dd-+i>F=eOd0EW&DgMlW@z#c)VRAA~Cy(|CGGpgg>= z*g)_*3Mb*~i*_bPI!L@4kwWk*cvTW!!U^q#`$6a5FTrE;etG8v9)pNM;vGHI99+ED_bAT6yRi&U0#Ldos2(I2QRo@(XSEp4Pa zS?^UIYQ{~>9I_-Ug8&hBgFI{zv;;Y&?uYs3hbuJ}K!9iC&1O08!l-Nxk=WZ=mC%O= zCUe82C^u|_CMy;k(D$G~8f`v077CZF;4_U=UJ16}8sLeDy1sOS>{^TefpqQ&T+DIK zi;Kp?*zg0k`9n)ur~jAAB2xIbh;}MV=I@s~l=b7?ZJ55;0r+V}>4{Vx^`?wC4K2J_V9-O*rkr4)oW^Vq)(6% z$LX^QG8lK7>98rQAQ8s9s(0)B*~0hRcSyyQ@J5=!WAwm_NNFeX+P? z+IN6|l@>Pm-~xa1C0Od{6YZ^O9S$||$95Yk+&kGJreMUR3+{?`M#8<^f5~<>9LgF_ zu77@8>~uEIaO0IGjkqZp1Smps*b3{eHTtmZCEv=xB;t@44rVX(AWv5&h1#$zV8Q8H zcJf2G@s-tGx>^1qQ^Ae$?Iv1vm;CI$ISw*;Xbi))tK~JFdyUr(^ThmDYT16hZoAtmoJ@Lt- z(QwV3Sbx<1VCI3~k@*;6-@z9PPDEfFNIV!>0z4ZT;}1r4uv4@&DF5x>(uV9}xyzuh zjXLY2_ujMp)xn?Zlsa#S_d$S=Cb!6zrK^`NbDY@f;g}2H)6|tMOfArOK8&px-skZg z3M3oMoS0&Je1U`UCB_>aVbzR5j&Plo9oRD_ZapU&`FXf+o-bxOVYO`X^P$r$W$vzX{M}b z$FjOF5^_704zTNgSZoxs23>9-)3V}hd-&IrRLMWJ9Q*c)CITrDIb)cQX5;5ftcI zdRHOki4+PS3F&D!8H#bSXq0nryN+F-(skNX+k~>G%^mc)eDhV%$q)0lLJ-G)n#{h> z^WX}7`0psn9U(bK`?6Spq)x9jr=GU(aoqW22(TR6)@av7&rxD0U^k&BoO3?q7>5kW z(XBf%@5#okT8==0t9|e*4MT6*mU6Ink85aWxD3R^DEuV~E0VT59PP;$3dz*cPF~&n z6<=JkF2%PRxvO%Ghq<5vz!F&?(ROO?NF;Wb=@@i;OayNjeBovfYhq7QWE#6PE(igd zEXWc^Yvv89jA?cJHbtvh$g90qdZM`L&Iw*lyV|l01xjOz2p5k{QGS*&FD6N)y` zj+Q^jE5Fn~8V>9LlY(HnAL5=4SI=)K#D`!q#z{eIkg|R(I``C%C7=H{gdp zWkscku3E|uLwq0ful=q+DBJ~zi+cX6N!%E(Mc!tez&o$(o;GfhED&IHF9dA9iYdIu z+smFXO!DrgxooDP<-B#M7`ovE*=NwSa@R5&3JBInc_Tr9ptH1|_MKuO;=p$^!ZD{^4t|iR?(h?7nz{OeFMXftx237}TCVD4VBJ zJZ2p5BCjK4P0g3dSjE~|ll|zNx1-h#6xD3vhxf1*=7={o8~MX3o5cP@!?b!e_yJ&R zV~HRC`15mgu^o4S3Gy=RgXkW ze?IK*Ji8jHVhomH<_nVo+8Vz)%`{W!*Bev&nhd44&ob`2n)2)-|4X%|*=tdR^A69T zj}$4;?Lyb-Z}ozBw&$>K2@J8<4^oHxe?RB8{|8A5cXOx0C2`Lh`flyYguW(k~?SQ~@C*(5HR_*QiPg~{#Lju^1I^>3|f zNi@b~mxgj|Dh-Y1xzm=kS8>)8^;=HjX*J+xQtIB+V6&RRvct@Ji<1FpvdwY$L)Of& zC;cN&X_o;w6j+X$7rR+vHvE_Ib!A#N3b;F#e9V+?lJ$gcVJ6d^iX>{UFRvd6%wbjs z$M2mPR*C&pLweio1Aw?D7u;F$eQBPyiueOVVO*Y#5%z#zGr`>Duc zg_yF661Vdzl^+B$5oRr;#)UTThr8_WaX|ro1IP!KKwk$Yd0l_J#;BP2nd;UVGN*pQ zCm&ajYX)-}6t4|_7PadcuKj?#>*qgCT#Tm^fX08@QD%Bj{SiUArb)834lu&vi9bs9s^=&fR-nrMJd9OZFy!-U300d8z Z_HSUBf$=I>32=t_qw%gV^KW^;e*il-1lj-q diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-1804-amd-sev.bin b/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-1804-amd-sev.bin deleted file mode 100644 index ebdb904f6bf93b483fea764f724193a938bbf244..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26013 zcmeIbbwE_z+BdxEn4wbv83gGVQbLe!73uB)h8nu0JCzg#5d=g)2|-Xw1QkR=LfWE{ zMp97t_L#S$=REiM-t)ZY{PAub_pH6Iz1DAC>#B9FHCq4x037i1r-KW;sN;sPfvG9N zlzb4bUU1>BWY_>U`Wak+8h`*W01CjrUMB=kUvHdtOBk>C0NCl($cmBDs%Vl!smLKf z@2B;nLdE-Ag%dXuhtKqj1`*6@Ntrl)HujGzxk&dg1PZud-3{j_luvq*Dzbem{%NP$ zW_HUHiPIgfEVBmSOLyp zS@}!Z1@HyS9smNo;sXeN1qx97K*~ezyxeDVB+M!^xuK<^G_=dLTLuC+cCb;Y7DEm6 ziln;f5p~;x9%QbmX3vlf%ITbpG~`dA0EPV&uQ>II>xH4IB3&<1@`aPWTqg?h#_ z*dtKjMd4%{{+5UJg*6v_WEb~c$_T^$3rdYPE7xzjwh+CjxPL?ze^;gGmWFxx(0yT{ zB~h?dtGCk$&(r!TN=blsS8#X|iN8Vmj!*~WpAE=aG#}*w6!^yr0DgsQ+>}mvdqYO# zR<`ufv;nO-`H`g&2ml#xn98&>j6yu^x{_aBJFTAL*Rh^v(l56W;h`8w-v9+}+320R zjPDB_xH(I(`>tgbtNVkV@s7@(B(vjz!r}#P;?1I6vXSZ6|)udFVfguhaj=c>J z$9j{8gN=oaO#}?8Q_tH+m@U9b@QJviRik%Eu&^L_0GwQq6b{A5(Zj`o;<+Mx-JIaZ z=tu;`;o?GqLV}`#f}+M>iV{NbZ^b`65sr2IuhnAV0XX4UWB}MaF?Ki>7SL5UNEo>5 z;$*WxhuvYl2}$cXNS?|G}TWNATT-nq?!bTF-!)lk;`hf?}e#KS5JIq-^?W+gZ_ zarvJlCNAHIc`S{?UNw;Ky!0${xMz%hp(^84H7)@`4|e>EG0F4fv8PW|YRGiG{x~*% zelUeLi|GbIQ|#nA<-PT4Aoc!~{cKsH<13ESOs`&^b#9?;T79F>Jw|0@N#s9J5@?Y0 z`Fyg~$()d&>HDr3Yuecg*I%igV(M;`$fYcpS0Pb;AoeP?I-|HpeM*_tPy-tW3&1MS zfuDynft+R{#ihlizM>V0BflXqo*B-;ndv2{Y;M{46wZvk&5BD8rw#ox0U4Tr3JdEH z7Y~jDp8m>qa5O=-V*&9uj%ibzrYoIms${#JP$pEV_W6QHr&OqqrS!#D&z+F1Ch7AJ zsIDdQ4maKj3O9OOL-B+^-PD$o5V~AaVkj~Z`NV#P@l@DE0~^2pJF32CcLGO4 z#8oI1!j3ozYZ**=UM~uXdHr}&{gdYf4FaN=_6Q;|;{{}lY$TL7JybxtT)NZk365xM zos2tSRY6hPKtqkk%^9SP2g(y==LJ(hdAOlGth|um6H;&q^nDyEp+DY-={g`i zY++hf9$x;iGgcl>2roBhD;oq%8-?=vVn_txVnQN9a1lWv3DA%TiG3}KqKojb(Ek<8 z+;GmXm|6aeSwl$!rXU9sf(r_Q7V4i{t|#*~@y%rh?3L_~7v}a20u-^$2uQ}%XS}#) zE6J8z7MDWmri^Wb0x9UukxoHwiPNNAY}#``F(fKrjDbvBt)TZ^2Fx@ypJ!RP~WDQWQ|L5yI;t3 zW~qGU+8%A|a7*XQ`6mK1S6A2)aF&ujBrH5u-&dfZgap^9q&mNv#f@9s62@I5$KrOM z`4~ZU>hJ`SfP;_nVg0#>ugcuH4NLb)`~9V-vk_8VT->>zJdE-e%TrgkMX5sDu$QJS zx^jHFS8Y;TD*R<5{bNF=w2S9+E)XCu(R{UB;aKNDPHDi&@riiwv2d}%PtsuFf_??~ zi#@acq|luwQ`l)w*>5tccjrP^ZM+5i$d3o8v2mfthyfkY;aY>ijT{^Tju8_XF1ng% z_-|(IuZB>`PFrCj*pQ-m=VqjTQ9OlRYU0hqFFzD>(SPOdOv~!o`dXh5&g)e@aN@nC)}<%y+24M z8@|juGndX>#SKl;IOOCazpyhLc(c!^4)2-&GFfu!wbp~Ts9K>_!&q&x9Kf)tAy>7 zmYl5rJHB(ojvPL&+RK-b7b?hhV(@yETFZ2(!tj5%l3?d^A%R|^NoYSEL zFPxA2m)%`!#K~8-EO|oE$`Zc*`NO=wkY)48otww0HJ-POXeG~ zUwMoqyX>1#3u*6*6w$&ML6)}OFg(4 zV*g+5wN8Qou#gBk{Qcs!z@jj^2oDSUU-4QzaIUXj>-e9&mY$Nb+TV6tHwm3J+m(nM zHK2u$VnXn}p$b^Kw(n>|2$oZWAXT2tP~tXqC9Axrw0xHbws`XP&!}a~g(jb>)BQZ# z*q8I9kUl;{F5c8A!a=AZQKe(Wy^-ZyR(#;0;_0MILRIXl<=!WH4X)=|EtAZ+oEViQqmzBsQ=r~@rXq`yiBR`aQ+s0_ zkF**Ov(P6;7Ua3?XTkC!pTzL#5-!1HA5~|a@aE|5z$w@^>zfnP4XD$q8KCSVXm0R& z`|8-G(7|Q;O#y0JCxJJ1iIuD~?U5tP3oXLoW%?TQeCrMw1l=#zJl4t^UPnh=;bqYj z=2;_CUvr45N!1hbzTp_|c&gw8Md5PUFm8G0h^$dwWM77+b;|LhUQCJ7Dx``<)0NpG zqIdUdb&7ezmJ0FQpXEHLpJ!0Cn^w^!y{I2jolASAD!SJ}CYiNH!2FU{R8m_~xP{z} zO@5MhSNom4r)!ZlEYW)eecO{~`o_w5eRYnV5IWiJtnHBzUAZo5<#=SPN-9iCzetGh zAV2P-d^88W-i`3*#@V~@E4tK0Dwj_PJY%1hOFwFgeR}5dRFugnnbQp_v>tksCyw78 zy)cJ^&t0%{ELr(6Kr(bBZi-Zt!y3n(rf9X7BQMYBq~)%7`h$0VZoBoG(J|@U@5-^2 zRuHYV1;I#KZ-Uh9t)fPw2t!Q&LGaCgEdF`cGYtBV=I{Q4z(@a!{~-L$f5iT;*kU0# z{HrbI`e}>NGa8rz7~LW5kTzCc2$-C=mjlWJ2~K>_!Q+eo@UPBx5r}>Gd=AQ0cMm7R0 zO-Nzk)iT^p-Ov^Mh=!-I$kCntgbne^+l6I(f!6+bhg0gOaYbQnQ%~lc-d%en=KVfi z@O6^g%&U_%Udop_O=2urd7EFU+_c|0&vD&jk)Wuf?wFL0XyDAi5=UJO<3U{qD-o(# zIio*L!WedvdM5y7X1^r{?`f5Irtg4MxI)p zO0?3yG~ofo7ZhGlX1`8#;9`72!e6F3#^0wl;8f=jzI zDbW4=P5)Ncs#OV@##7p4t~{s7sXPyg9eP!ZM9#!t#$#U*R8F??A37B0S902XG{gB| zjOkMRIMMLYc1>b2JIBN&hGE>~VtTs5?7B%=Au*pPEyiul)3}coXb0{*c38E(^IF$g z3vO7n7+HqNrNC%UgH~-8PZ8sdf_VLBxMKuF%ex6vJ)6N7%h$Fc@r3)QJD5B| zbRH}|w0SorEr_TLoB433o3=1ly7+E(t9);Aq=hciVcbGJlS(qG((|lbu57Nw%nj}; ziWJXy7S6SvH=Ys}GPg}Fm)_!#7Y`7<-`u_&RU2|X)=uR}Qhp_+bQre-o^L~nruBu| z7J~NrfEW=RQVr{XtM8wG>QO)0!B=Py$aoH(SY-q4e3>?mx>h3Zk)X(Y?ZH(`C- z-be842ht48xfmp#t?*5BPb+zv^!E1z+@?Jeu58$Ao)cDWU*RnJp>gIk+oWhdu{ZuU zz5dmge!P8n42!+7SUIKS>v(VLgL!T4<7cz7Jo)J7JZVUWFUFHXiPKd$`hljA!JH2;DUd>VqS~)>uw$GPXRe zOHLz=RZ5F~e;0Q3;g!y(8HHxnLwPoYuqJPE-yrD?rMleA+)jf~lyC{|3*SO(Mx)?g zCpp(~Ya{NK&B?pHvW$4`?$~8hAPlalWFy4 z5!g8<$DqJ9fJ+8N5PYHb_BvxhNXS0lsmGBGoDkhJjcO5tq3{v`a+WeXwwrWTIN8m0 zVURi-Ix&({b?=uDF( z=jPlcKaJ3Pqe#JK670_@MaPcxontE0o^`2`O)R!NBgdSI$R)<4-x7!@*t@nrluG8o z$u>TXqa@OA5=Fq~B$W|#$CaTc0F(ad=*W%e$!B~-6{Xy$5Pr`X5*gba-m`?O_Wq8M zWMoa4^kTx1eP@{YA$~O0wvkVa$_xtVR~0U^TdMXNKE09M?1M>vbSd(IhBM+OC9LG3 zd)Q@dI17pO(7-9xtJj>kjCqLhG3jTYJG_@uw$55Rjcna@by~Il2(J!AH9qsZpY$;i zM`Q+*{&7i`GD)Frp21^7mx!LN&2qx~g+=vv8&e)C3>%8 z(i6S4ID4LwaLKREg|av7#OGR^=%lG!lt-$cwox|X8apOEq(LEd>`uUgYug!^f_{Bvft=CHukSxW>J0oJVH#!J4xo{ zrz8kKP-h}It9^;P+vF1_Jvr*m!i%NPXW>#_o1uB3S0;NydD2i9+r4^NHfWrbLd!>nJ7aJhb~j7+YO`i5^nvp|KpJ&uUI z`QxkRNYU`?(9(WPdU3ga7O^Cnh+$J=>{%8|i8Ib;iR~?Gw+ZTStQ(_DurcXR_hje3 zm08Qt)vo+#J{{J2f6c{9($n8v@1h%(V~>m{CcQ%D*z<_%AvOeoHPF_?edN-45bp3EyU_ArcFzXx0#Ib%SZ7FytR+p zqqY~DdMroAV~R=d#6%V9H!T-ml(cxE+8p09^@Ymy#l-1u%DG;Tu6qK%*<0sWU6rIk zqsg@M57-|$KWJX%NiP!>7me}gOWWn|drpB_KZ=_3(7j`vbg+V%|3Y);ZQH%;X z2;bP1&c57(v+ef27{AXg9>;x_?@10XYs+u+@0#fCUzp|S-=>LwEA_fDyjiGtq?9Sq zT)^c+I_J;`CcPg=#Z@uhy*2lsvgy0c?-b(u+*^!ax2oPZ*?nH9QS}s)KCHM7(GWQh zXW_%OX-xX?ajBkr+k^@|Ihl|9V!E@9`S zJY)JN4J_<2>EnzuqqgauGX=jq*K$Jz;=ZwdT-$B&QL(C>m}thTRIPxr$$P3nDhyoBKNKXT{|?``Q6Ech)%2}De1gZq7St! z-d-5A*Iu`qLXvw{PMu54_YqsvHN91q|KqKjF|LSuMF5cNqI=y z6Ev2`q`$6?q!YAq;Me;+f3Rh_7`w!L@TvkAV77bo ze21Xwz6d6LQ4I~VnBG8s1&IoWk-yV)A&gWv6 zgux%r_SF+Fna%F3qSlId(jLAwQ%b_5FLPj@NOxf$SlDndjU5e&dLwnFQ<`+LJggnh zvhS1u43oZmv0U&x2c_q7Mk&8Ng~YO8Nt8WYQuz3l-IGKmgT^;7=_@92i1&kd$EZH; z2}@#6owGk*u|!cxKHja!{8m#IyBd?e=G?JaF&pMG2fQRHqLVmBTk4>lboks7jL#h^ z#-~a2FzFwx`He>8t3MHDu}O;+rS4AS6|SJ4d+iph87{iXVIYP{Ul%|ahj$IfVtr7< zrACUP&d1JS^rIeIAa(-h$>BWBQB3;Am?DSyBX+9SY6w?C&quUeckE_+LFa!h&$@pq za*Xsh{y!mVx})MD_l2}|X7R$Yt-tx-HoBJLyDQvbjGQ&a z44M(c9SJ5-4o)U3Y=Xtv)Yi)(n0PwKgze}a%zcc=)TQdkT!(lrvWJY^fYwblHMiN{ z9#6oe?{tbvkR8ao;$uitliG4#UCr`b#Sr0g=CYX@3b=wjsIrf4s43g`SErPeEQJ!@e{>{qTX zSeSSYUQ`M7@n6+&Q8nXrxA%y@scjTlW?FR2oAx*}K^FCI^7EXI$x1ybn36FqJ+b#d zZ{TX!$G)Q_t~g4>a@riNZ6=uY>(ynG%t$vLs2Z2FpL}t;mUdM-Wv}LHY2fW6%eQQ5 z>M`kkUmqbWAc;LRm%=(qJbTQV$PY>d(J}9gnO%#Ghd2pf(my+OSK@ft)h$aeW$)J~ zyV75k88delsR*oyP`Hmu%tvCiBl?_}&qLjXs;AZh+K3xDDzm1WB}bP&LoT>kcv zWHH+{?>2p^Ovj6`w}s)C9c%E0kmiwPa~@kz;6r5UOXmEUV^LC#cdVDPK9M|jiqC~} z?>CG4blqxqOl?=BA-b<1x#Z54O)xWdg-;x86>}>b5gHD7e9IXB*sXUC+`DHB?%wl2 z;{@^kikO`fDL22Qe$IS@-WA?DT_xc zvzT~!lJxQCP=M;z&Kf>!L|5&TZz9Z4WVJQ-oaot}XPZ{ZPokrarwz-!GOCg;wfDGF z*LoXTaIU=wY#S3XdeMD}@6>UyxdV*$UwexPIB+363xpH$aA_=lu4N z*4GThM8{Gz+y1Od!g;{h_|4#DY;0Uy5x^AON~8>^foJrFitn|U0-k^axJT3l%w&iG zA^<cCz6Fm%J?SFrVe#2=Y&UH!iQ@+*Jf01-Hpynr5vTn=yp|A5>fpawdc z9t1A#ikvH5keRMP(B8nsrv_L`d6lVsaFilk<7+qVSOtIYr)Z1+1-l+*_-FIn^F&(R zO(h*^F%W=fuFzN!6)uvN z7(x*zb&BWtc5v)t`GUdd?VY{Jwi|2#*GG`Cgv2fy)0r>#Ym@&;KP~^*Pr)xE!VdQH z>sZ1-S?~eJ4gpwzJ5$j+d~E?fu=lp$)7V&0pjQs(%O+MVEKn10ap=guJpZlgFC%>R z4q+HYuF;t&(#fORyhc@MT?VblHy!RK8&?u6T9SLnp;M2`esXAL=Yu{3khb@@w|n-b zcg8R`ucpOknym(pcCC;}6nFV#TaLbPJrwZG8>=pYkr~e*fqC4z4-=2U|z`vHxt}K?L7yf^k{q z6$zBa40Fqy1LNwM78MsP}XS)z^0+6(kcP` zc?2tY*6p{S43C%NJm4I6EPKVI!OsCjC0!|)`7FLXABUQ?Rk#&n`tcok#R(Yu%&6ZKbb#&*7uil|t8} zXuUxnq2E4SV?M**v-uU$ZDbLV9x508rI8~lLDQu+6mVX$1+`Q^EUL>60{Vd8SIX~o zqwD#19;#LjENZqWSFf`Oge}-%3G2+w!GX()H~U2hYuv-}fN!C}A;-V7)t_~7dUCfg z@AgyFYXEs2G96Nw(Zl!X;?Vay$9_Kh@A&pjuD?ka%Urs+A?dT6ZLhZz>^j3iRJ;;m z5P-k1(~9g) zgZ}SFV83!FOEWOe*i80uvK7mrQQHA~fTqwp2oPbBPMTTYy3^twmd)Iyu{g)gc=pyX zn^x?qP`?hLNi`Ixyphc&VXU0IQsPgmD&3k=kZ8&J7FNpT5`{09-t#aybGv3V(K;pH)?*Zj6Z27Hl6adJN0_a$q1pIvU4$o4{8c-&XL#+i^$RU}?r&}zi{UCrY zthIf&9N2xN9T4B;f}J%OFCyZ!+j=T;Mut?g;>aQtP+mI-cuZssSE#1p`~;bg+f<+PirPigF2niX-4{?d|I2 zEnx5AZOw0EXa7ZUej?L%$|o0&T^}Y28m`1Gu04txo|uOK1<<2!^&w$qI5dhG??We^ z=-iWzp86zkbov^%toOYVaVStiQTPVeTbQ)8bCgNV+!#$Y_ATl%r3mX?(Nth?X%EQKi-_Fy*+Z$;MgNq>q5rTGhd?F$e z)_fvDVm5r%f}$dPC#?{IHa21+Vpc-7Fb^=;!2sVuHa^lQ!TC{IZdJ~wK+f#LVB{hM zu)m^o{|bdA&a0KQ_~4klzzabyd34lfl!Y4h!f(myGC+ZLE>4X#CuLLdX1lq znJL0~|2p)4fg|82E@mMn!Uy6N0C#b_Sh?ErJ9~Ozpj=BqmV9~bqOeG*;p1lIIXqgFC^XkW=2dxUx*TUIL5;T7e`4BSQQCR_0pKCfA4V;a zxSppil%75$*|T`*Lly*J@Ii@}sBs)*Uuc;pS`(A;y-3}LH4p49a2)0L9{8jH4t4L* z8ERa)qln6WN6VvFLsBVcy?n#X%)4VEiNzE&oksONbmbm!+tnH}iZzMvz2x~D0Bt<{ z-MmnL0BLuhy=_RNg=io>K7(@$dm%mT;wA)8-i>`KAXfjemd~;=318k(P`%8UY}Zl2 zx`gor<&C%3pg<@g+h@u%>!b^xo$AG&UVbdOU&Ap4I2pF&mi4^6fb*<8b@%$l^Ho;m z>Ly*&&m(X6{su@dgog{#)ynw`OtiE7sq>VP4`&=I_=QLvab8VfDbn-I4IYC4F=y~) zW(R#;BE3GnpHZ%PTYL9NU7LQc%E_{<;hYBaPeOm{yba3L4rykV)UT$~ zU|CWvn8l;@rp^u1QVU`%Z*uZZ2=JLAv*5{Z!hV z6~&jRNfL_j7SAv!px@9Ptx`18Jon5UB}U$JxOwNsy~j+e>Z6+>0nRH94H3-KUf6c< zhr_)(6Wk@<$M}C?q6v)8^B=Ph;pzi3!_e%i;D>rqmjpAjZH?s>Ys_8u#?O?4p@Y20 zv-7V%oUc6W5M5!abGoql^26KcEPcw!@He=vryqeE)@@J9__p0IJ;c+RuS3XS7bl$` zwk3_YDRq=w?qFDLY5Vos{LA?FVw*mTdZ|%nH<|t!|3F|Eru)>{Y>F#OEtVDA*t}$y zYpMipQzIb&sU+RICl}?1bI;KD%u^^n_5#%}$edADwiakM{VM(crK9H#ZDtM3Y9e4PVU)uaQUxBiSMEcAo-npX z2C_zIO}C10VqW{;mZFP)nyaEDjOp^-)LTv9=pE-j;Wi`S(QtKRHM7&3>E#yP!Zd9UiosjJ>2!fc;fbn3_gode5TSjpXtdZR5E4he*uCPBU^->mAA8( zG#mrbR;B&SHQLkmce5i<58uxh#@x8}8UiReh%w(cWDqRmvo)>}feX~_$d{F#y#IMZ zo5c({X|xXo$nWmhZ;)SODZ*sV_*EPx-yZ_b(p{yDY`46Gs;lbD8)30^y7S z9ah(Sb=qGLnZW$~VbbV-FgetuO*8`~LXdshYVG4rnCA#q2xWx;MC(Ck_BArst(9$f zS?=CpIniNC9eZ_U20yofK}1ZC3JOG9Wt={r7?)Tl8yLY{gs=O#;tFoR+11X+%zfH= zHA3~hijR};7fEqht@OQrc*hQh^%p!Y2v=|LtpFbW7D!tQ)RzpEG#?+*7K2&Vsz%x6 zBz|2@H=>pWda%Nm}To|Im%%MOA zUylT7$z;UJ1?kmV+fPX$>D(Dtni5=KC6Q8`ey;7UAx;(fiBMXsQ~R;w_iG$Z`~nW) z2mUV83-$+$81VjU#5}0gV+^~Jlyov9&Z^;R{?rlIR&{XAf^Gfz>^;uUz1b}q_-{{G zq~VjTndv{K^kt)sy1XN80R>D4G*_-oY8Fjn6_a)<>*6r%znFPi#dzeyXtF&jQfEF3 zxwLshr?v9L;f2CVNq%mYU-g{5H0Cfyl`WCGFpA`%V>xv3 z+Iq6H5a3|A1D=*lNvF=r!JK=;x8O=jH$#PU_wmNA_m16o)O}E(Fi7|KDm5M@@p0vw zCQoL!NoF@oamio7%*;dUb9w^qh2BZaWAF2(#IBl6D9A%W5FzTAe>jCjp>UE+h~-pmDFm}dYZ(}p+? z6euURdSY_w#ItJ)r-R;1+mc=MwT#{w61Z2_GH9iG;~{P{#T!Qn9Yy^MI*Bf8E(F(q zHRYh0l7B_9GObRin6iE_?R$Nn^qd zFSfI1-&`cI48bAuAF znJLK?=VB4^Td(37*Y)XsH4JFe>4kJbfa7N2>E-W?kaj@Y+9F&rG%rW+!7Qo#L7LU7 zQSw!n8jkRD$;Tl;_f}dFWohYRhKEAKv5Op|C`}L7r>x!LTsYxP>w8;gzzwZRJU8o# z$TcsHP<7#_-k-hZ^XQQAeeR=;IN2@Pdx!^4$1dqPL@gS3y4L0d ztO_nuC*48MB2@Yb+SnoB1TR^02IA{?z^R$Ck>kT83jaVIwBdQt zMYQ74Nled?&Sgp|(h|q(NN;_xt@m5wXAUJY&9)2YS~|?+)qEO#_skVHk$;BL0cr2x z41T<%zd#iD@}1A#!^$56t-Mf7AtXhkhB|Xx=p&(BX5apGN(iuauewzbC;Vdm9v-eb z@28p7jz06NhjndCo@y=dlX4YMAi(&MKdM;Z>|Sgwi$qiv)rjA$S}eZfRYM;vyBASU zH+|!Qf)|k)y!1uS2R5Q~I?<`DpF9OMl;uw<%EjB0+<%cytoS|kye>)h+Ek}l3Is5V zJ*(Y2kunm_;M-oTQ=G+z7pbD~?0s0wJ+Bd9y?qu6+9V_zQ%Lp$anH6xjpd;I zI*!3g4r%ViI{0{@4fG_;J1=#7_^Fyj#VsY7-jf(;`2Nw9$j_VV1J4HwG7+?o3%n1~vBpfrgzd-=kYaV8+Sio&UwkJLyBq z8}?q;pv#t~CaJ?35rP8gRBR$!YBNwk+f5;dFemd}o)l-bVR4`Ymz^ntbK2NW@qMPm z!JAy#_2EaMe2Rd$b>f(nJKsAdbV~fMLoN-2|HeOu%m9wjQ|6pvJ5SG8pLuy{<i&e4qGi1Fs_prb^%RKP?jBR-Y~hmRL#NH8U!50PrNKo#Z$ArrJ3k8-lr2Kq z34w6K;8V`Z+MeQBqv5=ZRu(6$W7+2pUVnrD$KT1FI979ZQOJ$Wz^GIvVc>p%ZBSio zZP?v~Pe{vBB`B~pBWC8BX`4Z-=_HoPug zqg9SoHo~if{lcejvC*&aFp#A+afO6#yfDS9$vXe^qUz**i%<>-phlE9vmTP)iwrGs zXK1jMKh|=b(6W?~x*#&6aImU+0SaJY)unze7;?Z*AGaQ1qdRw_L?vs9F^+oWS~-kf zo%Q*?MndL&v7+ULb#{MowdP|N!3Bz+Blsg+gXw+AXu|mTY@Dq;Jz-xHoIi^8uHJlK z;Q#f?kMAf?@GF>d1gX9d@p&R$+?)}7e=7xfftbhxVT1CpwX;Gx6BB)zv-u!x5h!9J za3s+K31j<}bHqeQS5NQ;%sv1KQX%bNV5H9WrBmPwKD_KeYmN@v{SdA&Gbxyt19<-S zfFJmP)c1mO0Ll$rv_t-=&<%W7hy|GD{c!=|=Oy%`1v`Y5m$wJP;(H?&Uo);2;2TW5 zzReT9Hb+bZ`<9Ib`QnP=vvWqdx%q?N?L7IuQfnA4vJHD`(=xfH+#|2#q;1lH+;YYuDLPU(u-p1`qvRGPEPF_h<+Qu2>ZHsiV z=R^0w&J(-^`yR?ldwKcmz|kB;dU@D>tMO}rAN|Cyl@bSG=z-h>HY#vxts(AooqJ*& zk(yCnNhk!!eh(=ta~BUCJn8R~L2?a}`@E!xM{XSI%c-5$aXa=R6!@rtlN@X9)Ls?H z=hXP1xI{=JUGhAx+AYP0=UTgCn{LJ^YW`0f*VH`gc^Veqh{-sWEz(7^~MOS}O)_<(6zpCrMMPI*H`BP!PU-_!B-y8WC zRQBJmv)`2VU#R%+X)Ri9iHHz34k#iHO)$lU-pcYPDT49y^K+n$#@FNDuHhIE&^nH^ za)xHE5pFDtUDzKJDX|g-XVRwZV*6tR6=TiUNB3o{Nq{f&J=eB~>e&yY;sMtPEU4csU;Rp2)Pla-wHi zlXly%f`@pdRPFMFQ?|3v-Kk4b_l|1*5`%+K1O5mV#%J~arx$eXj)=uE#{%*(+@rS} zhg7B3NWf*uW;60ayGJ{I^jC><$X-3$<5jY%Pfg*oXv|S>nK}x9Dd_^@3)B1AiwVcW z52>kp3xn@6h^ZW9=X}YjF%Ss_j zpWId75q4mU^lCeCvL`i{4lr##oJ2YTc0G=Zeqt`^Z53Zo5&fBa=KxQnkLyK=GywVPym}> z<>_?xMu*5|?59Vb^r{(JMQ3Wc^8)h}J6>PoCi{qg(v~4Grpb3oT*eLOdfpy-UHGRJ z@kB2kqL*2Jjv9s_U7ERWH?(vl5~dQuwv+OnYh7nT5d!$I-yV7BCEq&ZEv7D$(J3jV zbIP!yp%A;j>Gs=QGp=?h(0QMz?{q~F?Rtv$(Mj(Q+<+*K_;r3YV#^mh35%x&m5=io z9l;$u5~CV|)7>OD?f|D1|q!1-^>Ive#2C{$YBf2+H9A^-epjK8eqv1te}Or^6W zcCo636E8V6j59NP)U|m0SYnvkX+J-4DWBU?P=NYEQ#S!_UpfzqdtT;TWklpU{_}QJ zkip5BgULpI@i*h)3@PujS|aZ`-Fp>%uejn@J^L2CfP1MezRcG#m_$`}H0iBvV3_K< zXSQY7a6~L^O)dlwD8@ItK1C#cMs#-&PVeOF!amWUFSMJbJm{KsSC$i8C-@MMG_EHo zx)O?Qz~Nmk0byuYlxdh?h(0x(HR}XJbYs6y+^2)Yxl>+ojO`{kwoCVmEPYQI{2}+l z&uH)RI-7QF7}jlSH)0_4=7Mi61faQzm4M~@;+oo{I)93{_H!Rv(gv(#PCw~bypmtj zi|T>`f#x^vLW)vph)CIzC&+U6YPN4yF1iv9*mW(&cPjctdB`7U+_GUUOzW#IG2EjH z#1L*U7yv=JS^1;I=}$Q+ZMmAaH>3UI%rbUz_lPaz>oxQiAV7^-WJ6^h8J&4U+jH6w z`qz%v?qyTch&FdQpZ)k$irx+i?6fNyHIUHmmb0bM8^&A z2~m86G6`ZDd&t%4vk}%b^lMt)1cqi2n6~(G!d&2lCj>Mp^GHYZRx6(2+Jd`@+<1K# z0{Hvvhnuj|k4YY-TL0|H_Fl;MWYcA3%D#QzemV+cFnywa=rn~axU*XJom`v7S|Cf?xA3;JkXhY!%yq*{8e+MB? zR(teed8o`zTbsi>OuPsSa}52!9cVvtT^N`OC)&2~{O<)`mZRufU~!xM$l4(XzNE3+ zXMnMwkHm{#x$TgST)F4S>*NiqVvd70gJVXmD(O(*`J=TunYo2RbFuD%y^Y?RTc1*w z&ageMP#-l^MjBlbsl{ofsDjNn&G3vr&fht=|0||%Jo-NWz`#^-n&9@G>!$h-1c+{5 z5sJerZP;Fg01w0q`=g;@cwu<^casB{?{7m8MhryRQUFP|;7I>I49pG7-%KBk{d}{? zgqp3eFp+n&QtY*Fj{4-)3Z?r4Qji0J!V=`bqcM-xdYz9e3p+)B95-}o00Yl|ntU2cDHp6DY_$iS`x?V9Wdp*@z?YwJ% zp?Bz=qyKZR^6#W4Fc=)~?IHn9nB$w~8@!V6&?LiN1`fWZo|&xj-El3`+67M^-thY# zn^t(2J@$fLO(mp7htoK2mJ?BnUnTz66$8`RC($+JyMGc}+<+j2*y%4WdUe7*#6 zU(S-+vwfiCa;2JD1&WnE7#^&k@%oy1cgbAjFa~ZiVK$&;^Dnn=gyLvzV=3wFfTMc6f(KVSpWqZb3eC0 zPdAR%uiUzmVbs*Mbjy5RFY>vysUN#^^n%$D0)_oX)o@|$?2EbUMoM>!(VTWdc(@{* z(c6weP9r4$eVoSFh&1s^q&QyB1lYSWessUp>JEvo5cpplaJpM8wB~1V&!mM}5hrYi zsNr5d!fE*=#y&@@X5v1$9dP8N=upo+VuT}?az8Yj?u5|0Vx>z)S68|oRprF4BSs?y zwE~%LJu}DWSRZ?6ay=jYzf}ATN5AH(zxC;B;SY&x451kCE}d&z56y9?y2W9C$M~8k z^y4ECDp5MqX;Iz)(Li;VY!1=u%jM!T*GY$$FXf6Cwv~>pK!E|eUHj%RTKkk!I6ACH zwm+5Lz$FgPKpuJG_X5InDPYdSd@pi~sl2my(JxgB?=}tWhfw@uWau9d{rq8_qNLM> z@cR||=lCT~jSd#X-rrNd0s%&FrJXKBm5E-gt}SmCE1Sl0rn)*X#5vZk_P@wmBT@A-1lKZC%+w292_vk&j$v17l6Ah$DtLOg*Cv1fC diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-2104-no-dbx.bin b/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-2104-no-dbx.bin deleted file mode 100644 index 90d277f2f8bd6533a9836f3d25989135b8616bb0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33824 zcmeIb2|QH$|37~0%Zy!?Y$N+VWUa`q5VBL2!C>q$wvaVDWeFu~NcI+FE3_a>mSk%o zlx>nedN`f?5e_@G~1 zQ-6OaS+9_xaH6`USUX1A_~o>QPKs1-L!b_DQjura1lSpnlz?1tgR>@m_Cb zwof(V3G99-@HFSmWBe6Y3!iyMeN-FoP0C=yZXcyu%h~i?rv{>@rIqxu`0FZp*VRl* zo>v|enHB@Dig-O1^(3L2qJRV#PQl@eCjJTvM6>nK0p({2N){tWdB7R`hX#P%aE9o?Ed{$OhS1f3 zg0$2-l7#OG?a6&hus+-{htXWk z_QJ*f3X>BfIq;zcr~z3<^|@n-*Hy#H3-_Jon|IwgMht$Y`(t2tcubB;a{Q?Rl^TW! zco6m~JP7MmCJr_hHZ~E^t4cj#6KpaGC&4G;4LugRMuLR}!2{sr!lZC0K8_wP4iwJ` z>FHt*XQm|)mV`@+2#W}d2@8uEZ*5A6z`t((Nt<3t$ob*lLF^`lH7>0#g|k~;uHR;O9j!+ zo!M;8qK%q2)9oLB+{bV?vEgd0OIVzI2a1&}!Eew#dAJPZcgs&7^IuLb?L}$Tmpg)?8v8shfb1*ALS@h zlWBYTVQ}bVZye1PrYwTG@HY#TcNT5~@s*=CZ;PYtUT_^{dhtxdp@F7u?v+08AeE6h zk$2AxUxS#>Codu-()|6#DxEIPYo{utzc_Y;sl8SzgYw#h3W@Sv@fY#8FXeZrjw-Vm zs$t_`0a({`;3wfsprn~dacOX=Q?x>GbPCfvjxd|}dMiBG=FlM)J_}Y_bN=cT z!4KR{Ppn-GxkGI(ph6q~E<=v1TGV*&UGADY>7G|DC3L)?#E^GNbc6E*3RNPFCV;7-Ei|!BOnTE3MLXaoiVT#|z~ zMU6@6lg+_Yj;lwD7;+R8+uD1YAxCoBVrf!3ksZK%)n${tX1M;8f|S zx^ODeiqKC$&^oBWg2=~#YF}RE0b^@}M*Z?2C{PbvXQ0i)lTDcMX6}gEr=KkSYIQK~ zKJk=6{Ox9Wc?tP)9);Yf*KFK5q6z0jyuxMhf9%6wyDmTn9>YA;KvMs)7w;V1!24M* z#+!f#;dE~IVqyewSNPVMaP~AjJTOie0w==sV|*%XJsn{xI0a^dkc!v<;bx0+vOzmL z36sM~F*^yU2(*z_j?PY2!pv|+%pPK@eJ44wxTvs*6i6f@;@g{I zm`!+Kz`q4EFPwWDGwaVWt0}3$6y#tcaA9GPq5hb;9!``;-Y+)bEaQAI`RPMQ!zJ}Ik6Ay*PFVC_^;Y`OYMom6Y{iHxa2{~7;67TThEpEir z%0b*IaxC66;~#>lj%;!e3E6rmZ&qvGdr^Fb*RbFdX}7oZSSs>x8xL>BhO1HbR7w2Y zsu)$kW9;cMv$iyk_BqS=hEi|Y5brSmQSJPRG#>)gg?-!16@;Y;N=gk*j!(pgkA;gB zB(V<*7qlzDZ}`k&L!muWCa2YgvisD4UXf2*MWh*={@WL*v2mfy#DETHa4kURMh*@E z+lYw_7jv3W_z$%9TOw4l)>arfXGn4Xxkfsh9^v6b2ki3Ur!ik=!PSFLBR2qsxMp&W=JZ_9)C=As1I?D|bt@n-HiLppJv83+gSXw4kn3^42o&bC zknk1iL^|vzyhlFq#xp|uGP@Qgw5{`Jv&-GjUIYpRay*PDy(_CE>`wZSTdj^*En?f; zTgzwgs;lk@H?)F2H)y86W`_5C=y4~i82kJ{z8UhO*fgcP?W zD)LBJ$kb>@ox*srKuAKY9iOqU;z#X*z-9r)nqlqN0LA(h=?3$%k%Q&e!n=_4#QWbB z`Q|hPg=t9M6e4*<9p?NwMzB_@;@#T^!(;7SA#;iHb39QOmE{fxGT8KgP%uKalGJ_% z;x(7u4`08*zM&;2>pd)>No>dE;iNs2gz_mRTMNVMRB9~Np$=sE1jj9q5JwEEq8LQ` zZD*ciKXpii_B?es;9Y!kz7{82+5E;sf=1S$h0lu<-XiAr`-^f9P^&#@=vSNaJ8B?y z>#e5yoicNr13D#f-b~L^bl%|MIuJ#TPEsSoos%1-g_$h7Nbcv&E2p^?-^Fh zlR2CvGe+Y+MtY|_K#^8nV}#))uRozK0s0;;)l-wZ+lyv0lwUSqI$ie2KtsG+B;!S?`dnf?3-lFe2B%P#mt#+`J)CTFi<9n)r$1o2ou+Q%GJ!QYzGocb_-e0QhjX%LmydUJ2+kGhUV^t+Y<|7(`q@ESN%ugqd zr^*FfJW{3m`E6}i+QS^WNPoG=(?-FzA~n$}Ewg88Sv9Xj`fe&7jkzFli}P5Cd--gO zI85jCfK2I$ZdGxWGbIBRz^ z8>@H6YYd;-e6zp@2R7@#38|?k;Uml26GAcjdi0c zzOO)37vyp^x>r-!srNuiB*U}+S-0P@pFg#3VubRW@V1UM4`?yDt)Uo?vWN$l?;NEZ zmpp@Nfn%WLF(WFyrT2!Sc{Grq0+ZsP!GK^n{0n!O7ICVU_M0#)XkGkpTQ5YOn-Nxb ztK=m0qxz!cORS6+hsZWO(=WNjg+HmQ)2_nPB6)3)o{5+t8F%CukR_v)ZSJ_H+IXV$ z3MCVv?uELh+A2Qj<9sY48+NQH&D7>|@}e8!__R?MV6yeMuW-0?wYT70TQ%u=C$4+8 zN~^qwvWwt;4f^#9<_iJ6Gjz*B)HL=&udJiX*v6Ye`e!B^4h9wLtI-K8*j^%Ne>(3v zUsCfj^n40GtNKB{c{0^`+pzL@JrVaTyCAzG*ElG0W{Uf8OIrJ7jWR>JE~#6@9oUa% zik4O(Rm>YJOBEHn`LRMLpFeOq2k%UC+TH3221V;J6YEc?gT?%wI?Nm*5={=;u9rf~7Q_&C z^eeXx2Wsi(i3ohjj`$!S%0;J_74*b7bse6fOP!~Z#39toIVP95|1|c|@ubo7r;f-R ztx=(I)qBHn;O2nOI~;u8YirCGl^*~k&*>vZNyWGKlj$9@oa=x^B% z!XNBM_`ijVMd0vlF6Q~p#h8c&rT}_(C~K4@0*!>pxub2JT~T1*gK-|WgB@YGu#~W* zsIaKWmf6_e6vJ%714I5TPzB-q+fX^aLp4A-Svh;U!L+s=UNDY>Y5i)z^AcKzptwS9=I9H6@sv9tiA6)YY7BaBb9knD`R+v*P;A`QHw>heM6ju!9GWzhH z{qWU#argI;!Y^Z7#$QO3qm`4mPlcJY@!x-;l54Yek}KVHiXgA0iutgPnD2PcG*?v^ z*&m3|F{k0Lw`J0)o<6>mhKN3IOXQ|#;+L(<_tJZ9-%~LY2S&cr9ko~4qMV(| zIS0h49%w%2Dyb4VEEmr|($wxbQJ|}_b{c{khPuIjg5n8-eDVcR90c=1$U#}&GVaQ*Fo zM-zSmu9kT`QzcaCF9kfH`hv;}>g;x?0~Z$%Ik*+-81IBOV5p-3SBIRq;yX%C<@P1tw)0q?=!wWAJkD8R<%Q5%ukFQYRL-wu_!-=)=93Pe+@RTJ=U&MBL+HgYo10W4QH`G(ANR zZ09VBUg|n%!431Ke7_`K*N9!7_6>D2Xw+tP6E$AC7OCHiJ4iq@vmQ0tv3xGJWPTMA zN%-k#3zMtA&fTedmcygc!pO3~@x`Kcnw$*j{F|wb@|_n$%ygMHBPOevR4zJ~xoOB{ z$Yz+0XYt;mh;xf%<(}_&VFa9n(hN;eQth5611-#eQ=lCrv@l)AYAAaz1cw3mq@9-LRQTSFa_p$YN=qI18_f@wmJZ;Tbi9>T|(? z^Q=df85v%j8Lb8Z&IfPc zKK0D8U^F_nJIHZUWN-O$p^28}AuMURQa#-5Fs&&B$Z)R+I=pGOfUT+l6F+nHrEbiT zTE2x>vFDaMXRtn~eSiXVZBAJ8k0&n|u&rkY$jc-a2M#zAPn`_V(yU+0f!;=>^`t(( zVcK9z96DoH_8};S6Eq)tgPfh@+?Hhl|6qa~udMua^7 zB6DiarG$OpOPqA)|@*%7F{Qt;;jAc_ALpB9%|- zF^ob1+9GOq%E)Dh^!#-KOAdvHiu>S>oeodZH)5YkQBgam^oT#l&?>LRcW$-I!lac(s=(^ckyMrn@rXS{-+K zG6D|*1l}pl(#(6Qoz=^2!$j|2*R4_KcQyJ$X>fxmE%~Lx0#HEbm3wy{8$=>=?Iq(- zG=%U@gXDu;nS%YgzOSr~unaO2W3!JbHfac0ysbwFH_qziftdDU-ofgzh4?#WI9SYs z0|&Q|T5Kht+ySSpsv6kFSiArk=JVWNzofOT7qV-4PIDY6`QVuS&a6|5{@B>KxT3&m zFoCNK90y-9X{?>IoCe$gTd*?c24|3{MFJ|fD-7i;uD(J9EWEL&Xn*asaiZlJS5eq`1 znRT(s9z+(;@AP`)&@6n(daU+X|7Le=(HidAx9@EpUFg0M^%32e;sjp(_v9n<^;UP< zbXz`ffCy|#en1aIE(f@P|3K*wPy;P>cYUYUMKud1WyVU8G+DU#)BtM%zcRH4j#98w zWW};IoA8hK$uu)G@lcMB{6k6@aQPX&&*-4UG6cvkLwaHJZ{FK{X&b$w1oPdGlLRlc zM)vXEh~e;E91@2DS2LY6o$JJnjvCYxCLQXRI)COw5;{pk(N%@})MJPOw-e*AV=ggM zVfYF`4V92u`qe+UPluo0r|?#bFoXBG-Ig%0+KQ?E*?<*ROhr{|OS|1bDY$_;g51&+ z#jP!S@F>_nv7kVw9L`ob5ep0SVsUV=3AfIPk%C4MVIW0@(TVee4MG8)g-l^9NiM2} z0s(YcuY7y@!mKWw<@cghdg67*Z(#M>!ILGVT*H=b6#ErV*(?nxE)|*NiK?}(qX>fk zKq@*vm5RvL9k70@IO~A5QH%_@!Jfkp_8orkl?S~49Z3KH9u^aZs{nnJD_Y0W4aE)T zKgbW~fhnTg?6(x30wmC_it1N7YbP6063&~JyT_$djms(Ve0*(D9|B0*xZYXUc;3c8niv?dt3ZlgGI7 znl6|f7+L&x>HfcWbxh;^_pZKeVE zR`bms{Tr<3Ncygl@jC5?00PXYoZ|athAjr4D@tC3PU4&;)1m>6xKkD9i*cN1vw#Aw zU5JC_Bo)%5F*oG9N@7Oe220%%Ts-8kuM?KU)pdchMLn&%fY*!_TNurMW1&P~4CG-9 z7ih_8>tfuj)1VBxLe6!W?ck$H~Rw&RP$b6NMBF^@vKF4WC zlszBjP9z1Q4RP$IH}Lv1-dh)0(y? zN5rCMB;%SMA9=gr*UX7SqY4G^4jN1%>CCVo(FH7x$fvy%P~WCN4$W%|8rY5CO~`$tBl?M_TJe1Ctz5Fd7@Tdm2LT*- znm!##4)v;z{u;qT~6?d#eKSEC+1L7v89S- zZk2;gimLed*!Az@aFUmwzkaet$eq{`a?x{vy8#o#d_`cm71<4cBc6R>CQ^69gd#T& z#cyP!%NDtF#^OSNc)^4#dPwg`(*>d7w5a3vFYS-@kH~Dho=YQ+l9s!60tzfByh)6) z+~`ph3}Lu!caDzm%zS<#QZ9+*eV3q1r>hs*oJgPZM70jH;L9+cM^loDAOx*K6LaNZ zK%uZgx}W@I6x&X0MF}3mJaoWV0s;D(>Y%sj0X`i7Hwy%sUzi^=<_dlg{3A)cTd_5h zaNm;05$Pp1;y35umX3to;0T2PW%=S?8b2=IxR*JSyO4OQ+3^KVQA!8#i0e!$vyP+t zB`8qSJ{aj3#&-TDA-00X-BK6ETs}&*CDC6uv8EsRfSAiK16xX#s0DT}h>D zhs?y*AiyfF64{YJQj#v8lj21)(Fp#DX~*cf>lT3RBw^6yDwlHBQ85;STkWXwwTJODFIPo3sC_{q?NURrLd(iLdr_a!b%(ga|Qj{J>Xl&hWcxzxIakC&B=LO zlQUWD4Vi)fHYrM#DHP^7FJ==W&xK|B`uIKL(>Xq_EK>6^=(?;f0~BcDVIz|6FAFBu zNq#KlaU_8b_>%N&)O#SHQ=w_S@LKaKNpYrMDsS}EfCr}}D;1J=4|p`p#T99d@{;~0 zYaSsB5Z;!Mf!$5-fA0LnjN5+u$P9w`iF+!<-{eGV)YeVHrNiia{|1hbm!!CvxTpY#R|p(0;)rmv5_AALYd6aIIOOTGO~M*w zuUQkQ_q|fFh_PUS03sXyCKL6!FCfh4Du|v4Uq5$SMNevE;H;9ui>#_!4hB%bZNyjR zn&YH_Gr1?XB_zQg4WM)v@5L!hQL1^kAl&)}@}foFwUD99Hc!t)m`hP(4D-)~_FI(J zZa)FI33LZiOGPhaYKtT$K0nkkbz$)e1Yq!Rmb`JC>r1Ln!vxX1xQu5k^<%6F;Nv9M zenI!14F#~NJNJ)MFVu*cK!)S>q^eY&(#`;dJ-cqaj#%cCMLv!X#wT+@JB-8)gLMZ%xh!t z z_}=w0Lx8Xo_%d&MJsm^P8`U!&?awqt39< za6P3q*feE1Hgm4A7pXM`NmdYC2Dw zsWw4|OWz?QkV6v>1uAr~U_(r|J;;s+l1BJoIph0@YG2o|5ALZq!Z{X_m@!h@Gf|b! z@u>Y;ZV!rRAdC6;Wcm%)ZXwE??wcfgA;>3m$x-eD5$UL#(A|R&;2fW5LiM!|V~_L2 zxdoW5%g^h_)1=KRK68FULNV0f76=9OYuZCq^2YDKYd+&FPTsM(T$FX^0n?o7z_R~Y zhgsX2V3sj7wl(}-U#HFp?+tfm!CgW;1ru=leeofkJYXh!diK-B=1YkREYKrb7Y6*J z?sQLILrH)!NYc@yj5-RdkYX0Qyo%eC@5l?(P2Ds6e8*$U^i9($pn!wZ)fqSYR2G4h z`C;NkKqT<&jrpngHu@)yG4J~91Q0^)or0|Gsr`10I1Fzk!b6z;NPZx&J=A?fBb6d$ zy1~436`P+dsr;5uAvFpDkRGBPei$p?mvLgB$Gf$#77DgYQ?Evw20TbIaJv2VHEE@K5AS55qoat3Nf)(q37C?Gm3G z5)HFOcp%L%jS7O2M!UKr_aIY}o^_bu>nF`m?I$!~FG&vBBx8U8>s1+^DN+|F0*+Zd zc@?*WD6cSwHUsB6Y;8* z_~s%0;dtD)O|ah+_(#;AmxKU8IawMCIco^I5=(9q;(6l*sYUaT<39W_x3i2)OOkw0 zpoARp@YE5G=BtxO{a%e(k;QtNhps&rx>MEAi#V2b5BEOBD?2G2MSUNgXvcX+g7lw& z5&i+p8R&gB-z#+lj5iqNa7B&*_nOK+L4b}x_F4wAT4;H@%E9Q&rrs4rNACnD#X~Tr zq?_^A>p;CeAjsh|F63Hsd1)@W)t%|tE3!kndcl(?tg-Y1Y>uL9xNsOcpPas39?3E7 z)p6n2NlaG%JGX+8*(()y**KUIU(GDM@J&Q%vP^s5@SHsaI7AU4d!N%C@LLj(u6TBO z(cM`jM#g<`^-3~RH$zvgAr!D*WfzJqd*Vv_cr^Ff<2*q_Lq%+>3FV}A8@SWrQ1mLt zB>}Sme5Qg|pXtb@RFY-sb^*b3Fe{`r!rcKa4d2sFD`ht0S80yg+)NF2zW072CoJpg zO9-H3E6!4B$RL~}U}an`3KyzclP@lisQf&l&1!;rWAq6Mkl$SI6fgNK(&33iF$u^! zQTs@jjC#Gq_bwR>OghZ36G0mmmc;*ll5pIB7OU;OD$OoLr(j;*pxS_c_DZNun`j(L zge2QoY3$;Sn&3L85Wofjh!*@#d{RqZuu!(-XT4d(%F%L~I{fnNIDSSAgQ&P36%+_X zTsnF(IwHDC);E|X4`26lX$o$)$>r7uEM3}qRVxi`rWKy|)G0-Ao< zI|$nkdssceRHT@$4~db95o&#@d4%BQxD&+lDu6mz$JeHGcgUQPU|>(C!i=H zle5d668qNMsB4)hbxcO@I~9C`=IoCCeQf_I&itnlgQ2(S`S^j&!}e0e&trye7|yMz zWJ3VNlU&V4wfx)fQr{kxFeY3=vukL)iX|}*z$d=;(aay57?fM}qa2Z7yP3J6y&aI! zwkRtrq|=_BmnMAoEvfvM1jL-t#mkQ6TtS)_4?uwSm4rOXf`X|_t_n5Gv0MYr>aI?Y z*xDs|aDwUaqP)ZTRt(Z?AgPZ!*5ms9%bZU6H+mylc;VLC^O5 zlyTep1yYAO1`EA9jY+?J`gyitD=jKiPi*f@W2 zXWFOo?re;8=E3q*nHf=F;Py4VZgaZ0LQ*3rkf2)Ha<%MwEA#phW9BkO;paqL^HD-; z0{nQxcdSXfUNTc9OWuBDiHH4`XJRFxuXHc73pl|r4%`pSel`?HYgm-D>A%EKrF#Yu z^-6%A4g#=?myWj5QR@~4_&MZq&IpUVpf&RHPw!b=I5vSg_TCE$sIPHOKRZzFxW@EE zNW%A4&aC6rtd%>mN$VTd1eJ&NJLfi}gn>u+Hx6>0-0#}DMu16ieU}mFn>+nzhfNtL zbt`aH8Fb{@+83~LKYZFC2i-|qW~HWTk9QC6J-VJY*%yMCqCI7Ubi!E-6K2+6)zAWAX>W#hMcLROU6EElnCK}AEr0rezDX~7K=#g6 z@27_x>=PgW)@Dxb;${FhMf6j)kQZR7o;|8Q0SNOc^)rfKHHc4_=}zRZm<}S922|zIpRHv zM`A#z8)0mG^^M8nMlDXRXo3BfHsAzj-@!|t&&Ne{(lj-;;Z)V@yQU~bj0L1Kb-YDB z=XnZ7vM68k_Sb%r_Ho&a_PxN#Ku^|J^=TuY*k zDZ(UIzBe>RxEK>@X6fwU>}uxZ?COYckoL4ip^-us-~=)IJt&{$(v&pRKKb%k7dCLA zmHki-vL6h=oawwXhNsIP)~MrOx<+)OC4?~%dRSS8y3tfoURgAf7Yb<1uD^JgM; z!}J8@P^=UuEp?!Z^!lPzwb#5LO90X7RO=v~>CI$*^+%yMPo%hr{t-%Bl#Q(e_(V%@ zK@{40FJR+}@ZN)VeiASCTw=p3TfrU&aoILO=ve2qGjb z#l#LuSnokCFA|mmiBl`5P975ZKxm!Z^(mba0?gmJ-6)I`6r24K4_B3cV|=cq%k=VQ z)ng{N;|*{Lxl$-_*0|o=IbTTQV|WFt)cIRf{a$a6hvVB_HuS);2B~$|Do*6&X_vpA;>2)QUPKiBe1b#2KV(qon>JDJFLJ;kR{(&)%sKmPHo(;+Y zh*5HPjo0Gk-Q>?efcnTNkCoc1qt15o-8fARy=w0}#+ua6ozTAT#X8fLeE}SdrMuxT zX>7AE`O`vnF*M;ZI)-P^wB+qFnUAkACq>J}L4j}!()RtKjyUV-&AfW{n88@zJCd!Z zBLZz{`#TAZy_gT~X>$9gH>xwni(4*H^Y##^S<4F4U(bU8*BpnvW6O#XpU*7Wpszw_ z%uk<+?^6pF7D}XI7hO3%4h6Jb6w(OOl7}-7bKf@1_m$$YKF#2eFu0aq$rRn2%cET# zv>z&<2uNB)4sS3Cz~b?Di0h;7 za`+4p9WfLbalWf)FCG1Y^dOxcZbiB@Fkt0)`piQ% ziiV+r%T_0EEW|-v);}^Ozs;FGbkBY{X1A}0AtG=fh`X1WjkTAVqq7xK+8&8?*(0a4 z+4+x(8b*DYu?RB`i*U|&UtWHI00)NUIGD>drbJxW4U7t8qIxRNTKQFlR|MXi+(4NZ zC_#ahad8u;WUE99asJ>p69E@|>F2VTG-;j{Srds+pM=cz>K+T{uX&k2Poo^JY=l<^ z+ts#TLy6t+_8@y|^&q&=eQNx4xqPYoT;_h2yA}Zuz`(DPRMdQgVMt{3g$}wV!p-4> z6x#De!`QQrT^3kI;OZ6CGAVHo7ABn&H@YZ+Fm7{6U<}bD2OzI+A_(3Hrmt_lpt(dO z@}*8ZUchlb)A~#}SYP_Cb>E^JnBG=t1STM0>40!^gKbwzzHQn#xeIK;|LvY{@15Pi zw_xo8{M6Qm1l&-LE)Gb6U#eyJ5EHo~EuCGhtPv;&Vxq0&j|a*M=}b%nwj`z@VeGpl zM@)orasv;*Y|f&byMJ+WVAJCgD_F97t#r4au|lT1z*2@!3+Gt;hhbK zv(7G5M*6Jl7`46GM@+kx~#ix3lGbPH2*k>=W|CvkndtThsWc6UXZ?OfSxyPjhP z&csH4jkUKi5EH?^)_Oo;IXMehJ2<e37bOaLy;J`0W6x#Od=LErKfo-z@(RLBa!x5u8X9dIrg@pw%^M2uy0ydT|+pW2C zsb8|O;8$R7;NUk5wFtVqAJ94 z+xPz!(e{QQ%F$*osP9ejCqhAdzxnT8;+A~=fdYWJAe>N^(gMO?bz;jA-|Fgqdl<0P z(F%4Fs#{c5{RXPEq4_esKywuW=;)8KS9_57AN*j&`K1}J;Jm|e^K#i@pwDo`?-&M!AHy3=|Wan%&X)XE@{9CEYik|En9tPLS+FP4#Ea;H#Z z-)|Yv&D{b+f-pHN4}_B?(h9bnhjN2~H1eGke@kwNub=#7dizeYT-z+mzpb?D7;^>N zqncb`KmXS#nEl&zzNgb*T;Di(&vgX;(rs|TK$_mg)4PcJ_nCS(RsStqy>rU%WWBRz zo2`FN*E^T~3w-?#CG4+^{TI;v8f9;BHqkcssDmXK47vVPMPY)17^2yh=pXVsi1AOj zY!89`0>Ojl+;Rv0ISl{pE_bAcxhWLF0p^Nuv;xOS@5t*fSc30u{3r7JV_Wb~lhtpG z!M3(-H~+Th=SNKRjlp2Qz?3j17N54RmS>HCJ4U!BEO36@8i=g)!Ff% zwh}%6Jb!Z=<5qs?Ka)}TJIQkkJjln}S)gxc{@sMk|Iy$456kLrWy=48zqutYfgP*y zKY#Oo{J1A&wB4Wn+41=QrO)rE{y)jz+`6Cte^BP%BfdXj(Y<+G6My90UMfM^K#G^w zJB@*6$n2?`5WsYZK-TmE$IJsNRuOXQYwfpRa2^wT$>%Yd7!pDw#a{>o2+?WniPNOd z*7ZWYb7$pf)1Rv3XkZRV&;Nyl{)Mv7Z@SEOit8(|?TtOvpKU_f+l^M&?~wPDBGE_1 zB5`9WK2E&$#GASTnsUli;&o(+J}F(zjqGskxjdvUTg7vttL!=^fwht!d&pm^HeiYkKcoWpbm8xD>z~%9e_j~*5#t}~4p^1>g_(KV*}fn8_fAUg ze+3GVd4E#x{uR-J78lda|FQiXY-7wA!$0rnM1LXCy-i!Yjo1G)AJl^X7gHtwR15d- z)ckKA>{f~Azik8lwIt8Cd-y*k&A+)6|1(6tI<)C~R_ou9x%~Ha$G=%&K)U=3wrQ^) z`iPQ<4>yoay+F=sts$vUBmV9%HUwbQ4^DY1sG7DC?q1WEwmED#t#l89J}GpAKKqN` zojf8az){~{`}z*lt%DnO*YK)h*thLGypLGrOX>OJsdbJqkRHiWe1VwGL%3(e(8O)D>VV3;dz50RuCv!?Cu6f>U2rt#1vm9|2J=I;L+bd# zXB^D~eS@j;=7K6NN|K@*jZu?oyGECO_msC*j#oyxI(mZR0bx2w zG-iO@*Rh%I;J85n>z!kugKg~z%Glk7cyD`i9X%b;AeeBPNuu%T=m?@#zAr5n0x(}g z!!JRDU0A2uus=joVnqv&CyZLlCyI}ViG?&xyMj|l`;)R+ZX#IqV+Lfp531XR?6Zc5 zUTSAxtM96!>&IROuK3=VtZwvj_u6QGTxaPL5=&6poHDb(&SfQa9UmuPR-2~UFuETA=Yn1%_8I$>Iu&&wXp@?{Gw0k*262`BoZQd2)dosp zBhmRIX2i@Pcc?5KD^a|v=56~KcHITo_+b74;pp~tklUWFmC|XwzS*f<-70w#pDy~I z|NG+W;L<_4=kU*QJ8fu8Mj+E<7Y<3b(Z-K)`OE~7%-E7P-(ly8Gg`iuGtP7`Cd*Up=+&d|znLvF!MV$E~5wYg+CNBw-~+IYY9H zBjEC^w{@PT9K=g~Us${l(0}M&`Rr^xp~CG&c8?m9vT7j(L?$Qkk}~o1?FROl8xV)< z*+0l=tKz*4N&25Y)vJfuY@huZM=!BkhzJ_R8Z&?7oAVGrA|#VFKjVVyxfIx@0%5&+m8e(0L>E@|bRsNl`? z%~Wi8d6k#!1HOb6gKt=!=cuHN3r>3GN6b59=~X@;U__7GOCNU3AE&)eZp?ePUVk6dzDKYBY12K8 zI(ih!%qw5(e)P#cITz+FYtB3d0s5$PR>Wg(HE`oyj1S~aP91Q{A7YLUJbu*6OY*Qs z;bAC1?NirIfZLVG$9g6+`CVCX$O8V8CTBkbiSaLQY6T@<4Fxg84PR*pxnqClMd+RU z(%t>+YrX`WlV`Ry@_&zzsEYT;yteWUJhtGLY981Z98Oc70WM>fk8hGbN+fwgY`qsw zXYc9AIZ~r9vVKLm*D2wqEH}8Q!Q$DNAw6NS*#K+ucRr=QJk(UvQJog3;M zVRC6L<0G+|e6^b1Bm^io38^W|B%?L0dHjUNpYEmI)jO%w`^4_IIcR)%bePT>3am9L z8r6`{te3FI(HVwa^?!2vZt2CeK&C`fqP3eS&pKp2J!K5!boeGutH)Ac-Sge^VNby@ zA_5(vtrwF$jTi33M8KPMd3m*)`ZE4GV(Q2VTyX6LYNn^1hiSzpoDpXZyjx=2oXGH< z|9IVPp>~FQZNA|nxUxW0^TZ>>qQ6o2y>!$dFR;ql)YBxka=Gv+*ZL7`9q4sil^3S_ z0RQ8pLUL!>Z!H^e?rJ=Y`{;oNhvkF6k6>*r?SU5Dc`LC8U$xfNYeD4mwntQa(;kwl zYa(Tsz(pz?l+n)~YtPzLMOxtZ=`yx1_P!vd8ywyL+$pFj@nLcZxbgw-yJUn8`{&d9 zq(5!k;*_GaIB(iL#Dn?}qCY=KTT#Fmnf>O=#oB!~JO-ipM|95Y_94G&JZ1vR9y|gQ zN-rjI885u7&QuQd01`w_xr2+r(1q&SE{@e@Kp$?t%sOZ$Yl8ne#(5$5w%ZCR;RH)O zIH&ot$$g8^7ilWV9!xnSk5}-#@AxLkQFKkRy1f0s)*=V~LRGs*5975i611T5<4sy} z+a$cZ!-lCnuVJxlH_}XPWAp z%cV+{J%=G*2y$+qdg=#V8>@9b%ucT5{j}XMdE7mCS{G_>$E@+wLr#=+pL_50Yg9(vPeO5&o-9Tj!!J1Wd_nm}X0vglA+Joq75Ed-7j3WYYI9rJG}2^@Vx4}z z@|>5fdy#ffsIs=nFswnHQl!h`(Gk2B>U=rvUV)6&SjHdpd@CujGfQX>s(+e&85nql zjryb+fxvsxxXN6bJAYPU9|TZ$Ix0#TT=t$;`bVumfu##e3K9qfWS=56Ezea`Cu_fd0|B~f`g+}- zi=QXnpZ@7-QMzFUL%ZlI?M?fpumkRsI1bX_Bz>y^vL54Q*aTH(iC@z%S*G*CqppnWqxlW%rJM@zcT7*k0`Gn&|ZI-e^6k- z;$6GsmsuH2+9e9`7qP|Wqc#PPWtAU7_Fv9=D3&8~EUGb9!t%1U%Gvo6-dkV@ewu*y zGvQ>-XwmYk88i17tNF*`2BIW<6qlI*#^{6&o6`^887}X`Yc3=>o%8JVQr0f?f1C>X z4^KJ!mMGk_e%7j9q{$Iqy}LqOaqQPzjpEkzkN86X$;VPom5`8`Jx$gS`^0!Q_$@jtF3wQ%&Z%Tb1_WF!K9;bt%u1KC z#oiJcQZg&&ZKV9SX3}^Xt-TRCd#`(_XQ~8EGdbDJmUljdBb> z%`QvLWO`JJ=&E(PgSO-5!>j?NlxTHKli4F(osbTgg*U+_Lmv9wa`Aty$#yU26^&AS zG?TH9Cgf=EO07sD0~P+eAuw90b#Qd)5Y1K_LlK26djsMbA3qtljN_r7o zin4cO&7IWp8Sia-;lTi6l@zxzNtwoe`Pg39kA(8+ZJ(aY-1igZ%er!If_vs*&!yeb z%6764Gbv+FOa0T80<1>C!P~hY70d>*jY>g?3kTPgwUXl?NPr_xtOh>V$oBYy%`MtjIKPfxYcWKWVX=40^4` zB%gZgAe5rr4F(}*KEiMd2#{$g^*Qy+y~D3OrC!_72WJ8?5^s!EHuJKq?qtKXn#rKR zMNW>+&&%eS{LsrXRpu>si+S7OmnYe9r;bh<(%j~h9*EFeQq50{#TK2gs#Jj%?+NmD zG8o^b1Ymwd0Q@zjuS=aP9xdfDRD zcfV8oW7|2w6#rv%86;rrsp&4?+V7gbKP_!CIF&C3?R&1yG!JoFc3DU?WmwrAGrxLbl)-Tpt5W|T4j diff --git a/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-2104-no-secure-boot.bin b/vendor/github.com/google/go-tpm-tools/internal/test/eventlogs/ubuntu-2104-no-secure-boot.bin deleted file mode 100644 index c783e736ee45f6c804ab213284bd3bb4b8aa5656..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 38268 zcmeEubzBwQ_V=Od&@Bxj4TlD$JEXhw&~WGwq`Mmgkw%aZ5s;KFDFviNX(gpYKzR?S z_j#VfbMNoIpU>}p?)%3(h{K-w&YHE?ti5W_YybcNK!E=K-NpnxsNoE@pq7`Smi7cY zxr4ZW!r%e$SJxl{2mlxWY5))b`gt4`y8C%T)H&wE^L>DoR-G6h7Ln|I93Vap2H@?* z-Yu@u^P{50;@ByrG2VwLUsUfI*nQXci7JaHejNY=IKsUMW=EBX8%^dpej42~D1VsU z(Jd&-Pt2JUWJVKHPcR>SQW8rrQW9(ij%q`*xVo_{KoTGgWkVZa3vdOv13Um`00(GW z=DO_&@Pf8o0buA6PXOmnMgh40;PgrKiG)ksu2`}b6+;KHE5B{U4}T1RuluLM`|GtC zTIFQrYfS@{>T$yQAGee_3Nn|gY`!xrX?Ybsv( zfe6pjY~foe81A8e3W8w!Pu2P{S%}_yF zXbGhwdjZFbKck#3bnL(l?`!FwXq?@pvil*q>C23MSaOOzz48%9I^E`=8h1efDjisM z;eWAt=Sp(WO%__3qQexgTp`qfN(gmKtN;!Ekpz$k`vg= z*&akmjL9hg65!(G;^gJz0}M63 zNA){(w71wGh959L#7G(Vk+_`W$0|J%2B)qr=XWl7rwy|>s(Sw;ejndjfNk2dSjgJ~ zItWjv%8MuVy=R1E4XGWEu;o>;%%CzrLrvj6Nm1kpp@@ zVN`}-5mj&@xR{PD>|HgSNKyJ~MUkP8 z-)29ky-y;_qR2;Sja=HptKEAENPe|!{kbyMZjM2eVs1j&p@XP(=aV+`EWVy8n$LKd zpHAF&wL~-ioPdWbubk3$)w3m^%*hE+47Uj8;uWsRV#+k|%_YA~D;-f-mZ8&Cghzk_ zz!hqM)IbzaNmF1U5+M>~s)iy+9B_Qd2xef+aOadUHXZB%QC*#;LnHwa1^zt%`wD;$ z2X~2x1VVuB{w#Lr(}ap04iKGBsg5g3{On6>_3iSQO0H`8@4h^P_X0glh2!Vm*xPm* zq^>pKKaORcYN>b_tk+eC+s$6!KvcYyNwJH-Nym3O2nw;jdzXsEoQBwxwdsic8>7=3 zD`#ECaO(uyPzL~mF8yOw0;F~422&@^Foox+jtSCaB?defca+G5f)<-^v->RIzw58? zn+Xt*#gz;qwdYpVS$2C;5)kpRYf0h4%~ufxEut?3jZc5WHbN{E$eJ3+AzURq=-iFK z+u11Mf?8A9TRDAO^r2}v2_*091G219kKDEU<-=+bHoDw3GjJ`4@HhhW%$bT5(&yIP z+4PS^E69o@rG|#b`!Spr|2l?uRmpwoQHCVe3E0>4-Df&IZQGYH0OogOr|}aEqAgJ$ zvawqQcbKF3I^YwQyrR{&(&^N$3kCw(0Z++@OOV7;wtXl^VhFV}gg+h6Cbgk&>LkDH zmyqC>sAG~Wj+v)pEaFM==kkseLB2VLe+^v#3H036rU*6aH%IaBvlmEzH;R$gK*0!a ze~w~wGxT?n*OU-o9y};0i4y~ab~TQX@!_>JIPpQaR}EBrbR9D{8(Sx9cZd@w4hZY& zAPPQ;I@rb zO&eQROKMd!S9c$3B{Nrhu)DK^nFW|y9RhK`HYA)NJ}w?E5DzDpAk>g>@%?P_UNu2M zf&USnnL&&{d8YY$o)x7PsU^j!xj>wpPz&|1Em!wiU36Qe&YkKzT^nD{bsk8;8=+v% zDy+IQf3C*fa@^bsXk6B};PS&IR>4}vcq%}c65o5Y5c(o3oAt}ltE5S^#ie${(h3my zyxak@YL?|wwSfLGl?3YWksln3xtGE1+v~$4hZ=U~cQGUzm*~I$K>9Y(O;C=zL>Cq3 z{HlmTX{&1W@flI)RL9`NS~th)qp!DP5Vqp>V>Y@J&Lwg2F#PLelO5(hBSvi=aU*Wx zz%je5eha}Dx}-nwi8=SeRj**PDtYIa7eBBU zerv^KD93Yn$0E7oxsO<=Pej17dg)q@FN$pf;ZMsI45tE>lp+WR8I1)Q4iPSxpAZfa z>Q?}NvS;QOlEZl-MT6FOV+J!?6~06D(Iz0$e_TKSj|ikh2WUVYt~oTg5eH#FpAiK% z;uV>2&<(TpXG17$r7pSXuZ!C@sr-aa3-#VzTDww^;nn3-h*}`1Rn1e$QwmqKad&sV z%fVsc>cH;!TbJ1_AdVc)_O@3?Ih5_u7sv8=(Q+T&`t?aE znRjc`NTjYMa8jqAw9o`;@;G5K-lk9ml{1Geu(hxA7t zwRA!3Rb%aG5~TD)loE-Td0yX9N%vi}hjPQ|iXsL}zU%r=*jf`N`3LO>;ICrFL<>cP zZZ40sO0HJ2g{H*YvFQ6rovA+y>SrTwUQnM0;GSj)cbHZ$a@Q3`z5|n@-}+MFSJV+4 zp)Bx%1G9%90`fhMy+yG8%jd3zm0^a^om7b(rkF$-@q0mJ*3;i4^}vIeE#CpjDu*8T zo|fIdP!$*RSzuE^w`1^hQr}Lu^?iSv@v!H~BddF4dSF=Hqod3>#ueK33((#({dR)8AeTb-eqU z4kC=&|3B@u_@MzX7tdArd+oKLP425EC@APZ;nOh3IA?caMXEom9~f7@*pqdMI0 zlSZ>s1QxYN1R#3=CE+wJ7l;B-wv!)X)VQ?)(R&r7&GLGP*wV+3Sn|%5*C6NMTz zzkhCdm(yKD5*;8OZKxMw!_^!sJMh(|g+?VS+V4_IG%kUw=8jyIN8Q(f`;-c#{wu** z6y9D+!0Ogx>~W&;mNS-OH36fe^QI5p@E(85F)|FC?Pwd5 zfA&xHZ{L-w@ey2|tuc>LY7=l?vbjw#z+HsO|6bSDc-(Kh15pF@i*hw{gaxV@#DY+7 zqlU$23TS2>ZSdW=G9sWU+*-v&7mpT^mUbj&N7Dr`qROl5nTGn+?nMFI``>QM6Y92H zL3sc0LQuDbbbSs)_s22#t8o0Z!~Ru(mxjUtJwJtV{vBUzYUjW|c{lvZHc7PBVCToN z?^QUR-qU7AlTG}8@Agmp=ihoaUQ~%o(9p<6 zMiyat7Amd_I~rS+?0$a9{F~`c0z^pxJBEQQ;1cA(_(sgq3_b}nXnwIZvD6|WueGM6Z`Cj709NFrSwhjD^xSX^&hu!(s7 zAv@;6qcI1Mm3rGcn(#A}cgIUg?`A7my)-E4x%m4W)LqlUtM_=#>`0Gl?ggo8mvFKD zD2Vzd5zauOl^^^@Kl>DvsYy^Gn@-Qse`iHJ^_C&L=xX|Mn1PUpXtOMltJV@d?TZ=T zF9^uYg(sAWGF<@7Nz$lgEM5k41Q)`Rowp2md3yY&rvj-B3*OGBP4~kiQjZs^;HAHU zJL?PmZHYWklCzIWTJ%D6Vf_cnFaNRm_gT*r)PJ=7_8%yo+SmRA^@jh5{EygTE)eLa zEoS<|7GGsF)RNHX&eqD-!pt2^E$-oN197#5CO%ieAl9F((*MD#j;)g=#LJCZ^=H5f&Eu$5|J{V=Be1z(g&l4AOV3HVZ3}>= z)s~xkrxI~cGw>^NNOKQ$=*-Dj%z;34c~K>spScgx<+6e(A}_V`a`zYeg~#oD9_!JZ zALE=?=lJW~Wzrc9B24L6+va48txwb#p15wJlngXd-qYaqTOHqGXpA8L(KtYd1}T+E z>TpUI5+5Hd6g7gkQ`)knqGvSZyZkOmh@QGYT01)5iMP~g!0?s98x&)}jAl<8rD00M z+HOOk(X=IhkYg4bW`pJ?W%RH>ljWn&3E?QOkpnr4;YiD4x)_L4-JKae{4SMAhN?!c zd*aEgi+#ghYtJ;5PYf{-BfzziB&9VAj-*~&`nS*I5Po|ONvP)#{g(+(856uVWvzxVW!V9sS>_4K&qJ2HgiK{BA>29g%-8)%hp1|JDr9>G+ZV5T0wm)<2u*i zI>t<7g8g6F7Kc})-3;E2jXWqPA`O<&eQTT(^wRpd1Mhyzs_5+{-U4(FXLxOf`gbv9&dKwc`up*^X z!q;C=KYE=x*ppUdWImZ^flA%#f#da1_&~ZbHzRjYClJD2hB)d~WKOQ<|JNkP_~ceZ zpjD_^6*As@cCp{N@#EE63_xh1y>?QgTb!6LS{@oLWn+c$kXq2YvlWxWyQ^XYE!jYT zL>N6=ngYCdnRonZk8;Vv-okvq!DBzlQj*BgvGE6r-jN5A-pv6_4Y7ij%>F3K0a2tN9@Y+KZk)s*!Ydp)5KGd`3E~8G zHxAVI-7VQUc|cs(#vaJ>*Aq}WZth^$zjsg9p6R**$H~bp2oivLrt5+n=dUIx;7^X} zpK|$6dHU5U3?POE*uujVOf3O*l$^h_86YhTr+)%bYuH*lK`WC`OZ%^ja04dU<_Q?p zmcbRT2bRp26~}TZqu-m|Vlfgpd^OUT)gaj*nc-Eg5&(3T!MF%;>~-7-G=>{{WknhB z3Dfbdct&aQbD)LFiC?GsP#$MlbCl5|N*RcjTcfA#)>Ov@&15gi7nN4pPb;McY#-8i zNHZoG6>09jX{PWgAr8?0X8qaFTUr>$v6@)#4sMUma)5Gh(=n@ZKflst7-6XF!uCDC zfR^X$a7a&qkgoN(!jab{%fmu-x~xw+5y(wx`2{b<;X9a$z-pJ=JkKNuzomI!upP}t zhxrBPob$8V7njcaX<-Di3sqYz4hzUdtq~w&1h;&jK(Qgi7MUUZn2JmG(0jU<$&PazYGtzrY@t68L<(OArWE>O4W*(NzisP8!Gou6fP~O*K8ifu*?Yv8l6YxYlBT# zRPJ0Nd*k43#u{-g_ewvf&(6Dy-;qTtT#w;TPPX;*=ed`RWUX9HzujVNl2AMOM(lEB ziIWZ(MqdTgg4dx_JtC=}Ir;dqHlK4`-_YoxNE`af%37`7!+W){g=BTq zg^ePikXRZ(mmqA|+wjYtJpOxo5(%{@&Ohx58Ya1*;nU;?s+}-$1&RMIB%5qEMoa|OF`l0oC0tJwh{-d}E_;bAT* z{y&cD2Bq+~GzBcAxryi{UYVSRw{+S!@#92N%=W?l?>pTgtJ|vZS8ueWQd$DLl(T>SltlxSoVSVA##qLt2^zK-xPIC-KVYHjpvd;KLXLrJe z>RGV7oYf0&mI7HVIU!4nTAVlbCHL?>7_|{z`|#XeBBb0pmz^KieEALE;c%0B9>Wj`#$&)YnbH&;You-UGaa{N*Fdl8Xc8+EBY|g6fYGTbia4_<08YiMda)@JR<2~j zT1CcLc)SGM&>HEdL^Bx zqvyr%NHYj3sfX7SGZffY6MI(`apY@H@pGJ`f{>wyuZr#dzXv%qRC5J6gT#Kfp`jYj zpF%Z@D-F0VeY;(mWN3==vj%=$n)dVnTiLo=n6X=cU7_aTSDhOK7f$_)0<>Ii;pxWy z2a&7#ImE)v`7h&tfvoRYQ{OBu>N+}va8{kt0)1N!qz=^v3Ti|}kUU8Cml;AMgku4K z1VQ}2?*tD=#PUD$>I_wD3tO-o2T1aYCKaL(=q^Ygk1vlWoa=wS`l{OhM?azU{6D5$ z@#on^H8&4r=c-29XvPO?c=hjR!HlnKyJeQt5pQ%a!V@u)Bw~)UE{Iw4U<_l7JghOE z$R*VORsHJ;LlX#w@Zi_?B)D7QN6wQ+7!0Y{ienzOO@k7nuWXSuCrN(923J(jel`0P z|0%G`AnE>zK;$Hd_B^0G#`aX%g)^$Bt^%RJdU>UX~NWoQfbtjypiY zL(FFRm?{UCf{*Oat5p&+W~-uYhN$nfa?0INTtO&?yg+s^00U+FI$12kLI++i2>?)pa)beoeFME%pIk^T*Z zt6&1E(f?B{G5#(j5qlO~z=5J~nznh;7w$(LJ_{}^!P_*rH`0GDn(wOkWL~ugfx8IE zVlpX?h*>|HCbu13Q#rW`$FFQUT%#a>_);n`^?9z7=7&-$p;wBaPc%Ugv_h*UJC^jx zEHf|Q#J12|m*&dYU0OpC`XNVJcC(DM=h^H^y7m6v@LgDqXEg>4pB@&x1`<@bZDmvw z8gFl}7JG<#FSv|wjD&1!aDpR?uL-oUarFoYqZQIz#I8ph>@Uu_B7su%? z%JTA!Q!WK$z!xJyvwcicIe_ zt?xgyH%$33b-j(C`+eU`>p>d5^n9`0n@h+*&1W59F=w+ccd+w zni$g~;$Q9h=$t*k5>gOIZrM-U|HAn8WIFSfvEY+BaA51fES{*Ur!`aVI}CKnhzvv5 z4+n7W3LjCLJlE|mKGJ@WfuDMg-m^{Eg3VI)A+9X|Qd#h-M@d2UWrucRJ@Fl)?vDGa z$zl~{;@|jEBpDrOf94EVZ*swomB88=Th2C2`0q(2l%(%eD2miSJJyKBmYOPwQze6Q z(P8mN93h2gkIyHQv0WK&e^^0~<{2{xL%D5#FYRH46WPcESbWdSbbk0!KO5TfXUvcQ zcDD#j5z7-+Wz-#OAG=U&>{eL(t*y`oMF(&(9(CDkm!NcY5DljJ^;)63`7x~1+fJpXemg>Ei%map!5)VDp9w-0q+s!h z=U=dFC%MJqM2LYlTpw!2&=wfz8RqMS<;T)oOAhbD;&C7q8>3s_l|lF14+HZ8Gnd{5 zvZO%b``kxp4v4~S9>d~^mG5F0NcNVXG>?m^An{NNj|!SwkEEW~VX@Pd%_ak3@hp!< z??|vG|KKxeQ|!WIKy`SssQ3VKDRs_ap9p9BNDvm!?wn*DUUK55M)j10svMibxlX5- zi@l7lrgXfKMeX@RSiI;+cJ92$ZjPpU^*7^{pw3sjj_!Bed|b5Ro$>8PMBHHUvO}n5 z3`@va;R|=|cUUKIPJ8qn?LY9**mRMxE;H-T!{S}`6Cq=?^8T8IGUnyCGcNjZsJ*a{ z@NL$YXW9n8TX?|YgFoCGsXa!O9LdS(dKWRAttUP#yoQ6N3t^en=GQT?hQ&uu%IWQ; z)g8q>f0l}2XJ%b7`5@9MK_7%9x) zQ8qs(ccurx;s>y~t%w`Gd<)6Y#2?7m!*JWY6EK|*Y+P<_>$NWb5Ce<1)G?UB^Uh)? zsMJ2@p;CWte+v921@PAMSl?Au-mJ_qH2--^-b!9JSL*sTlr1lu=qyi{meO3#BA?A z_vA?}G8f3zs_Gkl(*9Yajl<-#1 zHzCR#SiInePR95{MUymc)>mH3xCm=vA4&o(6iShg23`P=N#J4eTt}(Ef}Cl*f)44= z7g3g0jF&@x4Bw`NG>lzGc`jWNX==^P5s~+uw6ZR15iplFKWXwJ-RCXKG&M*VMa*D} z(}KmnTt()=ZnM`3&)`l$$-P}~Uj#;3Hcq0b=3{0aUU!y<#pjY(Z0itrrPi|VpfV<`KB0Ov)esv+5wCIsP|kORSJ1I*5Z623>%a;jOQi8Op~mKU2V{*_Zjbo zJ^Aqb36i6*fk1tj21ubLGT6Tba0+bfTg(`4(WM>cbbzG~K4{M)3xyvyZ**nPJTW$Y zMCm}{l%nFx!fyZhQ$Jt}7H@DnK1tXmOjx+M>SJ7%V$XvlmpeKF#OEf1Y~cla{WtXU zjt>}nS$uz#vNS{ngID|6bFZhE_Ho^z10V`AcZZWYSo+Nr?;JG%s1^`9I)taC5aG-8 z+|WqEb{$2$&Z&qW1ER2a-~tWc*w6peM0uMp0lv*SSpZ##?oHD708&ZJ)M_9pEIth} z7fYPKFR^;e(rAHJXlPFj`{AU`wH#?SaVpPRiTd!xtUKH;nCmZ9NdLL)Jw4z|Bh&nQI2`M)kc~JNER8uu9J_k^B zf8v37U&x%?fkeA!X9t7_|8Q(x^i7m@o(o zpBVC`6_QEp)EyPU(%<)bu97{M6up*PXxQ;mnJ4o;VpRs1i&dyvUPp;f^@cyi?7Z)> zd22_zaqn*9C)1^^{BAV>&r)LZONV20&1||G{yIcAXunv8%~`Lm-$Io{i!pg!+8lyw zGVlha;-qy==LSDb^G7SYKc3<`lb4>;u5=5~EK|||kJuQFSblHeR8M!{D8K`eNyg;{H% zSpv(8C3Y?emcH-6pr*wLHXKzQs&PY;*Sm_bkZw^09aEtW{C(EV9v@iz8bHwKH5Q^y z&>BF^ySC}5Kxfy9Fo~wbPtU||i5~eoES|h}?#+Hb-sscXlz4oXA1vuf*efVBkQq%z zYc>aeHzHWP$OyyW%PlE^p;fv@hVEUHIYYg>{8k?_?;A@#5IxSfhsE1`mEr1pO>WgM z67?}<<11b&VOE=TZD$|b!#??}f;>rB{E{N4z7~;-oN!E{+e@}ZGNr{$_HvqA-`O5> z<{lZNzJBP8O8?+S(t@af&@dr&S>fh>AiM(U4?)+t|_8GkZEZ)B&u#B+({>1Yw zizvhyE3*S-valmyBZP2I3~c%4fZY-XaBsF&_3 z?VgBFhs(^Erc1xujMYE45JcoOg2mrW+Wof57*O!&{=*au)?3Dl_tzHtK?*Brl|8ZD z(n2@%OOR7zm2UGmBq79X#%Ge>x;KC)V}&cxXw@tH_y9Q#;)=;@lPdRLKN zItDC0x9B~*=!D3dO9?=ef1IQSeGZGiv1=Wg(`6vTq$AD^eHeFbe|z|S;E4SR72SpQ zS66Wb;se#UBPE@7yd_;U5Ab2>8|osF+J&w2M@c&qPkh_7VQlmhAIvTppQ9SWHBoT))pfWqH>kk#q@W> zk+I#x8r684p)uSUgZ|DiPA1f-CQ7R2m*EVbA*GiCxjYtHwqx0GEJk`6(@UJ7S|J2d>ZQ();c07GkX!uKrj zs_mYwY&OiFetL+C8Eg#>zVs44FRMdJBHwhDsI8zId3ud7^t>qgI*4$G^Xa05{i7S(An$70T zT^_18@DDgwLn1jVSy5zUBkdgK_lZBhXiCDk44ZopQI&0+35(|kPuaE`e2bCr<;6|B zN5j8Xlnn{XLEqEcwhQ;RE8&5~3pm;u&a+8-E|9$$I$C++J*)Qokyd-dnI|&;J%CT@ zOIZ9}75CTAt5{M(DuW5fxJyQbkpf=!E#a?ayxx(}I{SJfe!Kg{LHdpJIth?aFOy2b zoNY|4CI9?$BU}%A2a#Jf?+yENZ|%z_PaJPYasp|eZK!qRBO>v4$D?R!_w(UxQ&ima zVEGXdytCVoum3(@+`8HFL8y?hB+ar>i`3j&KfibY8{>`mQw+V=QSViCYS}UdTuCe3 z-Af9P4tB^FJq`(q*CvNe39$6V!-Adr*E zfq(b)g;zV5GVw>S&OzuZ*C*i7Ex0Txd$^sKYAy6RUa)xS2z#Yzvk8N{sevf&@DGe? z_2p`wGKr(1){ApQN37rQ*D}^^^uVc(Jo`}hUi{$~^On&8x^9p*owr6152JGH8}Wne zC7HzwvHAN!S~ zS%b|A58)MU)aT*#oR>x>A;+{|;U2%;4wx1ns=Se3n~iiAdbR1nxBsYGcIIizc;DiL zOt^HHe7@=P^3l1_jrh}o3RS0;M4FE^u{RS#5vRMJaY^{~?fP{Gyy)e*>h~3}{DW)0 z43W$rbaBq(s?WQg` z^JQ46BJ#)!4q<-}mcEVK*fBX%tNOa;*GoOGXCc;-k1~R8nP1YdrUr5M#@(=Qj?Eim zBC+AX)7k*{^NV6?rRAlVNPPTe3d*55S=kh2So)3|@3?g4yM}s;UOE#sC3%>vFKkhX ztAbM5^;=|j{UTxU&iT^l`;~%Pww35VUd(jRb1AQ*ZwYqlM#Aw-M6s!r!{S{#A;Er| z$(b3M>14fC?r{W^NaLHM^+t)}HC6-EuY+On-o%zTG?AsXFWe?dkG4{$87*D3(E=Xv zKG3B!SLFA&QLpe02`TF1ZjKmhQ?nNC6G@&YEPtpr=c3I}N)Pb_-q^a#G0~ zlO&ots{$Bc`46sWl6z0*FnR*cx**U~`kKfxiORlLh>nr18qPS%b7Oo(DR~R>C2(a9 zCF!rZvmbz_3alO->dD6Lv$ELNgu&gYhsPqwPoe7ET75>-fo~y4$A!X`F>SM-sG9_4 z+UcR*xe*V?rAz{CN%g=4o~v^*ii^x)XX=6VN4F>PyDkRa%8lNLuM#be&U;oL)PHhF zjU+IoUUYro`Mz9dqCXeg6pQ!=+Y)SllfZUGJM#AgZs)za!zH(}G^tbEFBcaHtT%vj zL*qKvxPi|gC&*}vH|Px&tmuxj*lai}|L&%s8kQ=q3AUC<4E$SCb;!kwhrX*RM$npGxjl4a}e9hP^!xP@S}OvA&m z0!#l9BlYL4Sn=5^#p!anqhOnL$r9&r!{VjZVG+Oksd=t9@NB$UPm52Y#%vnz<2K6a z+mnBmG_T&Sl_DP^@e{Q4y@A)vFU!$ddl6Mm_C{PW={S#=l*&P@)E**oVDm8?zzK`b zey-v6RDZir6yZ(|5@J;-6{=Zww0;xKk6V%T3_xcedup-@cdxD2t#r|1LHj6bbv87%(E zxF~iD2}V2DY2xF8?s6WI?XJ7h#hCOog>?~jg&VA}_@Wu_SKY1on!N8(PaE~vJBusN z@iu%b3G8^c>OiTMH|nKjx5wX1&Pu!z%udfs%Y%>{zbG$maI1cQkoT3wtv1F1mVV{E z)u?t^<%~}THErA)@^Y{28xTC_=X78En6j?RH@JYsH%!)j3G!GiPiU7psi+|1}> z!m75?7nZ%NxT!XG0E=%FMSi505JP>2S<%6IaY03I<0I1i8r?c&(NnB%j#(d7g>d#=g3BgP+$YR`*snl-j0koNhZ)B0%mVoCgeB zm-JX|r;ea?OWm+hUKSA)!<+Y zr)QZdvKogeV-yyjHWWgp(J{q zwb>`F1LG)i0+xPnj%9I!;0js3wS>AqF_In0h!6v0%!w!Q7FplhW!f9{)j=Kr?(
uuKlV$H|keI@mo%fG^}k=5A;X;qhD_=qU7Fk+(GwF zOBy7U-P;X?3u8BU1^{2ZM}|R>CY!sgq5ib1J8rBTK!(1RS-1ve09tC!P>7E zD*c2#|3>_?p!OOMlt%!X<}>pmRBE zBQo>}qjWhJ1QPH?8A~JEUvrv@?}q(c&P+OtY3WI6*bW~F9T zv)}M9U#Av!_P4d3F#CMvqk3fi{2t|_B+g}wSKpy;4pyPNTEp_QS9`2>4^vaYCJw){ zGij%^CszVkJXa%vp^tp#kBKS_i{H<8E$kac0B;k)HY1#{z3 zrvfbgfNH|5XFUx^Omx7HqF}mgaLHNkAy?CU!lb>Iyh&UtEdDUwaoQz5?Vf3Y3hV0< z^fa1JRn{NqB@7h@+& zJmb&c#4{s8j|XYRJlyc^D}lv}#l#37l~+ru-;(F0hv)Pt$1{8Ji3VB8eqVNkfJUPc z7O#m4_mRh_qf6wF^QFOI`{$T((mJok^2M^zy}_=dWHNy?PxB5s+y6#`}vj zI-{DKB$PK!Bj6 z_$w0DF@~PrYX4IJaDLj1ubYV_UI*+}=|58?4wtJ-QrqYQi}+DNd;$kh+M#a=MM}%A zS=^dOZiishUFcn5m&ZYa9=qDE)@Qofey`x80$tC?61t*~>$Qa7pxpkI=g(&xFC@78 zt48Jq^*z~a-a!z(pkEv`4LvMD{rre@K!od?C^1jBR!Twsm-qI3o^Vz((`X%KKtMM0 z69x&yU|OzwYA2PYvzkS62W)4$c1h?Di|GRw+QN0urBPBypKXfg2c!o+NU|w`@&wEC zZ(cpGIsSuZ=!@LYAMR^T&94_o@BlbnulfXi#&FC4>?=IuuZvWFzKDlnw)0pS>%LT^ z;Hb+BdQ3xjctk`VfFX2&5gC9ybbqzX!fz^u05^aQbmb^V==TkL03HB4R6bVFHUJQC zi3lSf+M?sHS;rspD0mq^)hoK!1z(V`U;sEXUQ>dw^Gz{HLc5Au6%z9`k=p8HM%f*X z(M)3bm{WiNy2`u&b+bJVp1jt08Ba9x$=dgxMMQf)@_Q9~wO@?ISDYX|_`Gi2lQ32m zbLQTe=>)y|Ka-Ehude=nra$Ea0-!-3B`ZJ+%DFhe8Ttd24hjKaptZqo^OQ&B*@no< zb1+dpA~FGh<{7IDfhU4=h*Na^p%oqH&3;mBe^~1lXTkZF83A}Sf$Y0H%YTRgD6Iy2 z!?Rw#zWittdn8TmcMBmMRBi>HVlIoL_uK!#2LwFMgXBS4`Se6}+ELT*P78*)D5bln zD@(b`G8*(^NHRK+FE|#XQ$yu2!eA zhOPj1wc?lRwRXEfrQinD5%9I9NL{z=p=Y7v6AlP?D~@oz+!Y)g^eamQ1bEbInpaX# zu0RdK&DB#1!&ppRm=G(T5^`2J zO0zE`6C33EJFQjvS+jx_&qFgRnt*^nlKfA8<5Llq2@hDkiKX9o*FKy%F636L!eUsk zaKpVNWng_UBXv+=RKlY;cxsCh@-L*K@wZapy6yqZKUPH3fUezjB?Ct2$YF(!9aiX` z3EKbPk^lgZ;3%$a72xXCbPWqPTSgEoH!FyVTFTbV{#x;IuMH{Gp#Cyv!`L6BIZL+0 zUo&VlA>QGiTs_&>#sCOgyVjm6Pk5wFF|*z``A&G$?AoUqumoYQTI$Ww=7x6OD{r=j zlSP?Qr&K9ipJuh@Yn=518aU?Jpd9qf%s}t)DY0W7`yc2{Wdd)gC9~pOu12z?nS%rL z(--QikNU-(ouMx~U$3`AZRHAay#9iQTE+Ql0iG*a{CCa$fA8*B5AVNs_n!{-zvXDJ z`u*SQJM@$6|Ki=RJ`Dfw_8rQ>FPpFvsWtx1m&pm`S((LY6gptqy(bU@u!mK3?-l>1 zil(TK%gH(oQbH?1*N|p){Exmj%wI}u%z%JUK~VWdXb@({7Xe3Bd}b1Go{ZIMYrc>hHHrhP@{e{+*Fv!Ri24#Sz} z^$c~5%QXm!I5bplJp3KcT{8S{-t`Y!jBd;wRHtLOO^SfL0g-`wuwm5iFzeFmx5WOq z_J8BAUwZvZyJ+XdCYRY{Y4&Qw>{%4;i?8*^yZ^GK!A!o9?oon-tOafV7gkR8upOsdfcuTGTP(S-XEp$Wy?v`ye_;) zKR9dKW-;nh2u&P`}?+T z?ts5?uoT*+C#0QfFo@)5Z|Pj{L+3%qYYcz`Q{TDJlRzvAqSs?*k4ut%RJ4Gi^oDn; zb`|s$mhiiQ06p(EyP}XI^EQ%0C(3YR-h=u>Mp^DYDFtL?`1bWAgp9+<`8Ox1jHx4` ziC%k*9al-rFAj9CmmXdChv6ZNFcNHt;E2Awn|zV`M6AN&PCOz8AelWSOAG81ZM?^^ zkP{={mUb&XAS!R@X)zI>t+05Z5)iN_xs)1baWO8%9!mDo&YuL;Ww$gHES^ra{*K-G zt*f`YDVp{jr6vtZ_Ky)vJ(~hjP!?3njZ9@00FveP!qYe(W9WY8R(Q~JSDOYjmoS6I zn)jj6rYH2*0pMnC=FZB=dbK7fh#UH!0Qz4QTO}RwGfonkR%$15e-YyI#fUQca120o zDc_IIv%|92d5gt+sRsRya|jigBj}5++u4*Fjvi@1K=bfyv||Ka*b7v6N#%x5xB42{ znm+EubWCmBzUU*9W}>JY@=ZZ!8sI^itQvlW9HI;5jzo;^TCoH9Z(Vcy`#*tSfBdVw z$Qqg_US&#umls`0;SZ&xc%YDw^nNngF~E2f$1a@xp4WXl3;@p8LNtSbglvA2r&=^M zXx<1lz*PRHZShE<&-4pDq;CTOcMe7xNJOI`49pNtZzQ7^ijR9JE3?m1tcMSz5D{jL zD8Q6nXh9EiBpXPO$+OwtQbX^`Xk!UtwRU#r(xz@dJ|MazoF+SejG%vWwJDpvOe9S+%OmOzKQU?@0R%e zJ`*V=tso%aZ0olA7klD^+%FNH?*P6F1hr`Xk4F5yT`0z8do_xM*+&|D8l-SzwmN8} zN1^5HmV|P4#e#{2qvc&{H?Wzjg$=uvn~8^qttGXUnWY6cAGaBsl^K|qjmMmak4@0r zikFQW#BBxw@o@8Sg3PI1pFh79(VY)?-@td&tj<{!`xY7Rm&`k`0b*A*IOk7ih zxvweF{tSILZ1pZnDx(( z{!i?1cnk2E@bR!g`Q?DFX9)e;*OJ`$xS>(PiHf?shN^kt}g@F?$wuu+fk;11Xqsv?}YYeF0I`DhQUj~SP+3=>|UNa zS8D3y-I2|N{VWUsnI}Y`OrGIKwr|H8+Ag1nS3E&4+#29)gW(pt$M}UL^ijXPwMu{} zehXYZW@mZ}Zt`A|vb$HXk@0XuC_10yeft@0S55H-W~+K#a=uo9vk8`egFy>dA7^*S z-!N(Q>Q3*ZVh7rIYIGXo5&TAKN<6eIAafeo!@<||t)9)aB@S7_j#HshAN$l!(!7kE z9xs3XF*E^2z5N|eX%B1TyL}U1PkPtg^E!rQfW2-APFIzPY zzfXT+`!|?`uIS)s>tyC|&E}P}`eV%Fg}z?3dCty-Wrr}g3@1gx^5s1x1|UKSS>*G3 zFUL^#i>7VQ;RzKk9kx(S?t~o|0UrNw$A>^bd8|goknH7-R(Cy$tAXNd-=@XNwtwe) zu<9m8hQg{$-F*EE(#BrxTv`6gtf`#ltHsg(81ohoCo5ZPD_iK=6@RM%|1eO0)l7$s zJZ?U0@gzGnpZAStCl3e<&Q~x18;`UA=~|O52$m%&E_OO6GyJm!a}EUH@$hG)G(X;n z0s(8`4Z~JrkKYu`y{ygbfb?vUdVEgCe3<|E;Vf_4x92_Lc;8JZEXV3h?xEnnKBJDL z{AV)#2VZ{`qKM(t2KF2~3rCux_%}4HWjBrnZVZ4w3r|W@;kT9EQa(mDN~^js?PQ{y zuTm3`B~0889d1y=sogvrE?ctN_NCti!iO_*d03HO+eNXXFmo92z~QS+a|qRnJG>R> z_0(I9MdmUOO7_19(SVxG?VpPe?Bq#p1T(U0{9kK@C2(eBTk1m#1qb0wHSMRH5mq@B>jbIV@(m1s# zORSLMd$(}Je@w}59e>6O!OTAvLWSozrXj!pn{jziHM@lE~ysD8fs(Gm4u#ODTfr?xTk1e;tv zR47xz?yeqS7|x`HzdEe3Ok;re2Lh^(IOW*Cu`f1dy?1MSY9IH2o@T83X6I=D_ML zR%1VoC->UDi@*+Lp8NKMi#yBGnH zNQ^Iy;MY+CqT0g*FaW_t`O1<-CuSs77K}#dyZU>A`=)2BzO2-456CGF1XzH8Djc(J z10nkU#~Y##Kdo3|$9tKEpG!>lgodN*oOPbPEbQi+gBsjan}*$$=@);d4m}j zU>luZRx8T?Y46J8p=#g$ky6aiCS+@pwTvxUBV?z=7AdB|3=@W!vC9%=j}WqEmpvq; z@Kh2)vZpNBvu|a6&yYN(XX$z0-}`*}eBSpDoHNdx`?{~|zQ6aie9wIt(-@_<3n&6l zD{~ehz#BK#Ck(rvKnrRWj{C(`HqFYK+XrK1#b8W#bMK^-g5#Qnht0B&*Qz99dOWNe z&-CuYZZS=*8^dSNBo|zbPvJ^9NEzy1U(PG=Vf$?N=C-05A*;WMt)OOzwSt!lg2^2# z8RJXu@y-sDtOYB1rVv1Euea1Qc0AxbE#&v;-Q_8~g@C^#zJ2aq7}HyZh9^2uz;uq4 zHz4P=746I3q<1fqd31DSw;2t}->o&~!%lVh&9Q~T5p85l4?Zl@?GaT7lcL)q2w{R5 zq0mUY8BT(a$WF64#(hyVr;KwWZ&*AX8ce)(KdKV~$e9QoD%4@%PlOxk76|h37R}3K zJ`gTk?p8mnhv~Vv2nF`!eyJDAS{8U?OS*R$kik+rN@Vrgb&}a;s@ z_t5aJK5bf(njvMHEfQUV+1Z1`2K+^=p;C47J}5bA_tI=d!%^Qsj_apgk3azON#`?* zDq)ib@`l`pb2ARJRb8g`iWuu7i!EUg6w=xc1#TikPpSEN`xQw!-8hs?rn#IQzWuFU zMD=fn8q~E41d8ire+w*37Ux2aH4Ht?K$9NXB9A!=iwEBvVr7rO7$Gdy(zFtAIL3%b zSq6$1BeN*&YD({Wj`F@CaUYfL34;L26D7jX7;$^|ZO+@eRD<;envSWv?o=>cI^Sr{ zaMMj63WUPnh*G8X+!%9|7=L86!G&pg<^=RHhM-?cdUjYGa`MsOT^1AgDOhyA_@aTrxXMsE`ezKdpo z$Njl%zZ7QvYQUglukU%MZB^ViBTZ*~Rv{h&AYUh)t58YJ8;I;bC9Jy(e4^y+ z*$)AfS6s;`5*83HB~T#NrZ&Z*l}AM`Za3Qv?UX(8v^*&vJ_(aJ)VHZ9#yb0MJG5_) z?0^?aX7;@g z{WWBF3j3pM%2pYNV#}tzrDmn_QIAcTZ)=%&j_B45O;VYSGf)!JA)BM>cfv{V@$eJL zq*d1}FF7rk{wUwoHBYk4Fs)1tjKk{^jV)I2Oa~MO9Q@I7#|t7QM+Jelyo4QZuh0dh zQ(c4t!OGcHQ8_8q%wJCGGUqVzH9`vKV3~gBZmjJ1C$!&;I!xOM&@3(`#N~r-zAS=27=&^QG>7SwinD6u(eEz9h;I zydXg!Cry~;DvNCf zoIf7#Obrng*v}HJ!9ns`O;)`lPmHtCnciTA z^}$Dz#>aNFZ%SRv8g7hK96U6`kyNvHd~2{puoni4!C4uZp{%VDgyaMQ4OR^ekcOrR zoE65{7-fYr`eBJ4*?ZpQpli#p-9bPqKgzyN%*-?x0+6gGCJpyL4G&Xgzz>Sf$c(kM z&6YP`CT-N}I`@i+(;5l{kfGVlvJK2eUy)?ku|`r^*2D*2?bl&X%_+`Ed-)*p)!Drl za*o+5WiUImguPt3Dzrs$)&!575WD=n#6$y+QhS%Cx2|qfkKW6Q^XwdcaC$>y@C95> z?V-z_LEiN=l@&FlMP(PP!sWa_xyCTP=|?ql)q#;L#_3A!M`sb!pm;{pCP2;2)>*xo zEsJ9rNs673QPqC;un4c7??LNqa0{7mm)bvrkX+d`G(ow9B@$t1VP;{4z*<|?t=7d$UfB@0a;KU3ww z7y=cSm!z)Hmz9wh^f?Lz&W?R~|2&yS#)8ckjvz+2DQ{!c^Dn?gKSIZtf`Gd5U;EP}g`9KLF zLBZolAtVZpI)M^}3mTz?;i5=z(^(^M6Ma$C2|o1k`gaoM+P=|F0eBFf( zYgmlg2LUGX^D6jB-2>tmc5GMXUg{gKYS52ZEqcjhtyIn@ES(Jn9CXXUE_gjU zEb94if2&=;k{8+42py2TQ|I|&#?}W&sPhQrrb~X^IPIxXO}#~G(CP?IupqPJQo2mz4r+C0u&qqhNWBN&;h}K))sWk*d|WFqS=kQ- zlDeFh?q0Job%}f|V*PSeWz>1Gh@&ZoL*nR25no55AygQKkGs>+@E(lGwRRm4v*Hv-v-H8noBMsy2b~>7ANB~p}{Y4{#@<)S^YD+9i4R9 z_f`eA!@UfsYUyv9lYWVLbyUlgK*rjfNG7)CNSvX`pCmMhWj;=1a?`rB;@G~-s!-~q zjXPD)Qt+~rWC)O8-en(~WjPD2inS?oT zw4K!F6qU>poK{vk)tmB!b}W5XNXbgt>(gO2QO{vLw<|^w`9L?AePgaREpKn}HYmz)I&=2*A=M&Bk1C zc0|CERr}%tN#Djo2P5YquSagV!%LVe59FZ0Y@d)GHq0nwuMqc*okYS z%6IZC1km3zLxmT2Z{z!Hk{gqUt0n2I@xIn#Vq=coS%5L|04=CJL0xFfg0TpFa+jae zD9MWib$p;RFO*;8hqj3=C{p*E$8hGYf|X z*C0ZaYlp(Z^u%E}6Y%f1FW7-!5Z^d4bFi=^oT4$`Z%9C01XwTn{sGDkC-A)mGzy6W z_vJ-wG=f+!-5|i1g5kb})$7eski))}bwIsfE#PP~3rkCT@EC0kUn}y!;oxwUAXIT+ zKUMIdAV-;5qyEWle@68bu!aoyn{7{QqZ>^1lZZLN3hTVv}d zJQ#Ch;`TPR{5SnYZuV=_OK_9b(A0WJa@d{?!B|`9hjsP zsgTcR%G@2YU89Lpn#9T%z({1OKWLW1&2##n>X$T|8LMHgkxD!FuG`K-Y&jqVOxbRt zi#6VW05C9VBO4^v5ZoepJ;!4W1E=UF;QSsqkl(KSY3SGlFphNu<6a+Xs)VHgMl_%} zz9ZH@g*Vpk?QEv1U>x7^j;I~@Kk5bt41~Zf7`O!l{~QIk!r*@d2RClH34|M;tRvw@ zBmV#j|MOV*4GjOmjeiae*Wi$ReeSD*H3$N3{oy!*@$e8P`nody5;{Q{{{~Bl0OTjI z6TIiY2cF+Mu%Qrwyclp3Y%8R>5y=1DP{lt0*-i8PjcWcHX8%Ps{0?W=$H=MIOH3 z-zNF?xaw7p189g~Xf1Qq;9Z_Ww+v%j>!hpB`Y3uZbl*ExPTCFdZ;67zoG|*2(;J3( zYn+8Sfsyw^G9f|0eEOgaiMGDlZ$e<4K!r9(@Ql**G$v#HW`atP! zw`ruAKyL4C@qBt!Vo@FbP*fNk`QPaUZRJ(eNc+`k>=Lld~KqPLwG&<%WA!RakWS; z8J*u#m!ZrQkR6v^XKv9l((`jCU!_M zc7sn~=4sT0AKwu*ohPO+_^xL*)Xha) z!F-IU;{MdjD85fuoB0HKKuZyDtXa{P~~b9K4^$* zQlncI0@$#pw?4(mRP^D6lqEx}#l$sE>SUKBZhKpr{_%?*S0xmvE+lU_mF-M38HA_r z!A~6pPLPVk@F-DSshjs5IoTx70>5~0d(**NiY}zJrP815w~p)0ycLl+zgk82;+w|P zIadllYA!g&tBv2Xm%73Xk_cP&Ys?A-JS^wj5qQUqGc2+Vo7%zb=caVZ&Q3(!CS4o~ zP&<~^?%duGa_sQ6xUhko8y=HnuPZH_wT1gudY8G(Q=GJpyyDh!!;7W>d|Z+@l}sVa1y*|*-Ks6{!O`{+1UQgH;!9#% z7o}8IWWV>L@xWAha3fOk)bpy5@c4pyiyA24q<=pbl6>a?ITdSQ_wHzT!CX?#2zFN^ zx@N?uTGr0fN`{4T*6>JTa6?|2&cc2tqQMRNJfKjPNPEI?`lAH4x^%(Eq?`8MdZF{N z3ls>MVim1n2vDHsQIZq4n^wQ%YGSG{%gJd<@81G#RU>n%+~;wfE9DW8Eu5o`-pWo7MC8fi|#Y< z)PLK-h571nVWOS((E~=G_@0%(CkKqVv~Q-K)VQ{_B>%eziAWy!pxpbxB*xpF#c}dC zZGd2bOL&m)Nq1AzWa?9CEcE$m=l$adDLt}}{uYxr@~mg6b`2i71JV{E^qv{qd>^ea zG1jG&i1KjE{ZxG@jcI%l=o}Py+XdMZs8lvJ+MJ12SLeXHi6oN{+t3c=y?;-P6Umg= z{c?7PeZJFO>AelZhb{ZR9;uQBAE2tWX=F@jpv3XWzg(r=Bmd@LXW%q4m1E_lHuJ>_ zg%Bw4x@@9Ia$q=7U#K==VY)tPcInRNGpxU5E4S&$V=mqnd_-EY_aUs$wC`BQZ}Icz z7PrduO-CCcACXMir*@`i#9Y4cn3p^~T)=zBgOa&%2=G`W@$F5h+YYxKi@AXghYIH) zsEZ8bk>UVlB!BDMMHpB}l1U0_^IA?yzC_KMnCQnnlOxn=8?D?Eku6u)C=OZKnV5!Y zENi!_DAxEoHawsFhjt_6yNKlZ)sQ?bu242uINU{I6n9;GNjRdAJ-r74*kiI&1PgZ{ z&x#g~RPJ>i*D2${4bY=%heVZL@u9GEP{1WBk*>naMvkY!OG{x$kW5MqAO9}+DfjRT z$4Iiz8JFHQr1U1`vAfu2B(9v^%U`TbH17z{tNeXo<7aYiL<;_;m{=s5u)FT?n}Adu z>YU;AV(KvUAyB&wB`r7r ztbxSa?|SQPn+Ps0!y>p;>oA{ZzJN!P<0*;78yVzsBb-^5orq;M55jX}o9+!EB?kM` zLd#!d#E4XRI6AGKd0fED4I)Fq_63rvZ1DzUgSb=9!ah#FGtZcNe#LL5ttidD`$etw zq`|)FJiDjy5CJGKCu*;j#b~;cVVPupuC-~5{!v4qv(drJ%f-3_5~{{k9PVAizIA&3 z{E}R_{P;(~j$5Q(%S*!kH;OvnXoc%Fo$ui;5ktJG&v}`#m#4@_Af!nWt29fEsbGfy z3Vq>)MY1bi&C)b!o?omQhFhKKI5K^Pnrn^i4Hsugpg;p$H!e;&JmCn*lsPx}Hp+OG z@Y2{a;dE;UoPWYdOUL`ia2dI0wYwtA)78R#$hruN_Fs0A$QU(!c^w?-uJ|kNpL~oK z^mY}ZQ+9!iHjTASP&BQ4Dk_(kHICwJ^lce0O5SL-!Ri4&ONm$BAlo;)Wf>QljD4!` z7KPT=amYJ=^^GUJ?#fumExY9ct^winCdcLQeY!N5yPh_8#svw+FhyBmQD%fk%RpnG z#QsfVY^9?6VPs#7#vY*YIMp=!L?DD=KiNPB=!QQrGq-#r7_ZXKe!^pvw0>DH6TBQx!dYHQD zQqJ`gd%T#iNa(~RU}~cA%7;!hx9KG)aAJP<^7(tZ+KTE1=cR?l{7spb>Z=wNQqLBDOlf7-#ME6}tG$(8w#Li*8A{O)iI`t0^0Yj}?hRc^1q8!I-xmf+ zyi#d$Yyfq~9X7X9s+hUe`qh0wg*#a*;%SntQz0JqyygXcIR)6cRz+_^P`Avm0y!|R7s!LLNL zj6Hb1;;v&E+8rZ%HI0Fn`PeQm0|*eOBf1>9@>KkTt?0+A2XDjy{=z-F3aiQYjq>AR z=U?rH0)gyo^~*C?;<%v^l0{dl9%mk{<%<|TvVG*#untWgyF{C}*0geJNWeD1L8C$i zXeLqgvJskZY6&20fU&tTjI5ZcqkCcYg>yWjC)=75yb2eT!y!QHb_r8Q&&(46d5^NL z-V!SuKN4@K{^I?)2fAbJb^7@X;F_ue8Q*V@zp__Q(H3{={ZS3~;+F%Y2FeRTBjjmTsEIH&8S`pL-4QZu}=$sHqc;B%=w zB(L;_2k4UcGX2b9sZ!*{PtCl&*<(T}{br 0 { - req.ContainerImageSignatures = signatures - a.logger.Printf("Found container image signatures: %v\n", signatures) - } - } - - resp, err := a.client.VerifyAttestation(ctx, req) - if err != nil { - return nil, err - } - if len(resp.PartialErrs) > 0 { - a.logger.Printf("Partial errors from VerifyAttestation: %v", resp.PartialErrs) - } - return resp.ClaimsToken, nil -} - -func (a *agent) getAttestation(nonce []byte) (*pb.Attestation, error) { - ak, err := a.akFetcher(a.tpm) - if err != nil { - return nil, fmt.Errorf("failed to get AK: %v", err) - } - defer ak.Close() - - var buf bytes.Buffer - if err := a.cosCel.EncodeCEL(&buf); err != nil { - return nil, err - } - - attestation, err := ak.Attest(client.AttestOpts{Nonce: nonce, CanonicalEventLog: buf.Bytes(), CertChainFetcher: http.DefaultClient}) - if err != nil { - return nil, fmt.Errorf("failed to attest: %v", err) - } - return attestation, nil -} - -// TODO: cache signatures so we don't need to fetch every time. -func fetchContainerImageSignatures(ctx context.Context, fetcher signaturediscovery.Fetcher, targetRepos []string, logger *log.Logger) []oci.Signature { - signatures := make([][]oci.Signature, len(targetRepos)) - - var wg sync.WaitGroup - for i, repo := range targetRepos { - wg.Add(1) - go func(targetRepo string, index int) { - defer wg.Done() - sigs, err := fetcher.FetchImageSignatures(ctx, targetRepo) - if err != nil { - logger.Printf("Failed to fetch signatures from the target repo [%s]: %v", targetRepo, err) - } else { - signatures[index] = sigs - } - }(repo, i) - } - wg.Wait() - - var foundSigs []oci.Signature - for _, sigs := range signatures { - foundSigs = append(foundSigs, sigs...) - } - return foundSigs -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/agent/agent_test.go b/vendor/github.com/google/go-tpm-tools/launcher/agent/agent_test.go deleted file mode 100644 index 259b4142f..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/agent/agent_test.go +++ /dev/null @@ -1,257 +0,0 @@ -package agent - -import ( - "context" - "crypto/rand" - "crypto/rsa" - "encoding/base64" - "fmt" - "log" - "testing" - - "github.com/golang-jwt/jwt/v4" - "github.com/google/go-cmp/cmp" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm-tools/launcher/internal/experiments" - "github.com/google/go-tpm-tools/launcher/internal/signaturediscovery" - "github.com/google/go-tpm-tools/launcher/spec" - "github.com/google/go-tpm-tools/launcher/verifier" - "github.com/google/go-tpm-tools/launcher/verifier/fake" -) - -func TestAttest(t *testing.T) { - testCases := []struct { - name string - launchSpec spec.LaunchSpec - principalIDTokenFetcher func(string) ([][]byte, error) - containerSignaturesFetcher signaturediscovery.Fetcher - }{ - { - name: "all experiment flags disabled", - launchSpec: spec.LaunchSpec{}, - principalIDTokenFetcher: placeholderPrincipalFetcher, - containerSignaturesFetcher: signaturediscovery.NewFakeClient(), - }, - { - name: "enable signed container", - launchSpec: spec.LaunchSpec{ - SignedImageRepos: []string{signaturediscovery.FakeRepoWithSignatures}, - Experiments: experiments.Experiments{EnableSignedContainerImage: true}, - }, - principalIDTokenFetcher: placeholderPrincipalFetcher, - containerSignaturesFetcher: signaturediscovery.NewFakeClient(), - }, - } - - for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - fakeSigner, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Errorf("Failed to generate signing key %v", err) - } - - verifierClient := fake.NewClient(fakeSigner) - - agent := CreateAttestationAgent(tpm, client.AttestationKeyECC, verifierClient, tc.principalIDTokenFetcher, tc.containerSignaturesFetcher, tc.launchSpec, log.Default()) - - tokenBytes, err := agent.Attest(context.Background()) - if err != nil { - t.Errorf("failed to attest to Attestation Service: %v", err) - } - - claims := &fake.Claims{} - keyFunc := func(token *jwt.Token) (interface{}, error) { return fakeSigner.Public(), nil } - token, err := jwt.ParseWithClaims(string(tokenBytes), claims, keyFunc) - if err != nil { - t.Errorf("Failed to parse token %s", err) - } - - if err = claims.Valid(); err != nil { - t.Errorf("Invalid exp, iat, or nbf: %s", err) - } - - if !claims.VerifyAudience("https://sts.googleapis.com/", true) { - t.Errorf("Invalid aud") - } - - if !claims.VerifyIssuer("https://confidentialcomputing.googleapis.com/", true) { - t.Errorf("Invalid iss") - } - - if claims.Subject != "https://www.googleapis.com/compute/v1/projects/fakeProject/zones/fakeZone/instances/fakeInstance" { - t.Errorf("Invalid sub") - } - if tc.launchSpec.Experiments.EnableSignedContainerImage { - got := claims.ContainerImageSignatures - want := []fake.ContainerImageSignatureClaims{ - { - Payload: "test data", - Signature: base64.StdEncoding.EncodeToString([]byte("test data")), - PubKey: "test data", - SigAlg: "ECDSA_P256_SHA256", - }, - { - Payload: "hello world", - Signature: base64.StdEncoding.EncodeToString([]byte("hello world")), - PubKey: "hello world", - SigAlg: "RSASSA_PKCS1V15_SHA256", - }, - } - if !cmp.Equal(got, want) { - t.Errorf("ContainerImageSignatureClaims does not match expected value: got %v, want %v", got, want) - } - } - fmt.Printf("token.Claims: %v\n", token.Claims) - }) - } -} - -func placeholderPrincipalFetcher(_ string) ([][]byte, error) { - return [][]byte{}, nil -} - -func TestFetchContainerImageSignatures(t *testing.T) { - ctx := context.Background() - - testCases := []struct { - name string - targetRepos []string - wantBase64Sigs []string - wantSignatureClaims []fake.ContainerImageSignatureClaims - wantPartialErrLen int - }{ - { - name: "fetchContainerImageSignatures with repos that have signatures", - targetRepos: []string{signaturediscovery.FakeRepoWithSignatures}, - wantBase64Sigs: []string{ - "dGVzdCBkYXRh", // base64 encoded "test data". - "aGVsbG8gd29ybGQ=", // base64 encoded "hello world". - }, - wantSignatureClaims: []fake.ContainerImageSignatureClaims{ - { - Payload: "test data", - Signature: base64.StdEncoding.EncodeToString([]byte("test data")), - PubKey: "test data", - SigAlg: "ECDSA_P256_SHA256", - }, - { - Payload: "hello world", - Signature: base64.StdEncoding.EncodeToString([]byte("hello world")), - PubKey: "hello world", - SigAlg: "RSASSA_PKCS1V15_SHA256", - }, - }, - wantPartialErrLen: 0, - }, - { - name: "fetchContainerImageSignatures with nil target repos", - targetRepos: nil, - wantBase64Sigs: nil, - wantSignatureClaims: nil, - wantPartialErrLen: 0, - }, - { - name: "fetchContainerImageSignatures with empty target repos", - targetRepos: []string{}, - wantBase64Sigs: nil, - wantSignatureClaims: nil, - wantPartialErrLen: 0, - }, - { - name: "fetchContainerImageSignatures with non exist repos", - targetRepos: []string{signaturediscovery.FakeNonExistRepo}, - wantBase64Sigs: nil, - wantSignatureClaims: nil, - wantPartialErrLen: 0, - }, - { - name: "fetchContainerImageSignatures with repos that don't have signatures", - targetRepos: []string{signaturediscovery.FakeRepoWithNoSignatures}, - wantBase64Sigs: nil, - wantSignatureClaims: nil, - wantPartialErrLen: 0, - }, - { - name: "fetchContainerImageSignatures with repos that have all invalid signatures", - targetRepos: []string{signaturediscovery.FakeRepoWithAllInvalidSignatures}, - wantBase64Sigs: []string{ - "aW52YWxpZCBzaWduYXR1cmU=", // base64 encoded "invalid signature". - "aW52YWxpZCBzaWduYXR1cmU=", // base64 encoded "invalid signature". - }, - wantSignatureClaims: nil, - wantPartialErrLen: 2, - }, - { - name: "fetchContainerImageSignatures with repos that have partial valid signatures", - targetRepos: []string{signaturediscovery.FakeRepoWithPartialValidSignatures}, - wantBase64Sigs: []string{ - "dGVzdCBkYXRh", // base64 encoded "test data". - "aW52YWxpZCBzaWduYXR1cmU=", // base64 encoded "invalid signature". - }, - wantSignatureClaims: []fake.ContainerImageSignatureClaims{ - { - Payload: "test data", - Signature: base64.StdEncoding.EncodeToString([]byte("test data")), - PubKey: "test data", - SigAlg: "ECDSA_P256_SHA256", - }, - }, - wantPartialErrLen: 1, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - sdClient := signaturediscovery.NewFakeClient() - gotSigs := fetchContainerImageSignatures(ctx, sdClient, tc.targetRepos, log.Default()) - if len(gotSigs) != len(tc.wantBase64Sigs) { - t.Errorf("fetchContainerImageSignatures did not return expected signatures for test case %s, got signatures length %d, but want %d", tc.name, len(gotSigs), len(tc.wantBase64Sigs)) - } - var gotBase64Sigs []string - for _, gotSig := range gotSigs { - base64Sig, err := gotSig.Base64Encoded() - if err != nil { - t.Fatalf("fetchContainerImageSignatures did not return expected base64 signatures for test case %s: %v", tc.name, err) - } - gotBase64Sigs = append(gotBase64Sigs, base64Sig) - } - if !cmp.Equal(gotBase64Sigs, tc.wantBase64Sigs) { - t.Errorf("fetchContainerImageSignatures did not return expected signatures for test case %s, got signatures %v, but want %v", tc.name, gotBase64Sigs, tc.wantBase64Sigs) - } - - fakeSigner, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Errorf("Failed to generate signing key %v", err) - } - verifierClient := fake.NewClient(fakeSigner) - req := verifier.VerifyAttestationRequest{ - ContainerImageSignatures: gotSigs, - } - got, err := verifierClient.VerifyAttestation(context.Background(), req) - if err != nil { - t.Fatalf("VerifyAttestation failed: %v", err) - } - claims := &fake.Claims{} - keyFunc := func(token *jwt.Token) (interface{}, error) { return fakeSigner.Public(), nil } - _, err = jwt.ParseWithClaims(string(got.ClaimsToken), claims, keyFunc) - if err != nil { - t.Errorf("Failed to parse token %s", err) - } - - gotSignatureClaims := claims.ContainerImageSignatures - if !cmp.Equal(gotSignatureClaims, tc.wantSignatureClaims) { - t.Errorf("ContainerImageSignatureClaims does not match expected value: got %v, want %v", gotSignatureClaims, tc.wantSignatureClaims) - } - if len(got.PartialErrs) != tc.wantPartialErrLen { - t.Errorf("VerifyAttestation did not return expected partial error length for test case %s, got partial errors length %d, but want %d", tc.name, len(got.ClaimsToken), tc.wantPartialErrLen) - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/auth.go b/vendor/github.com/google/go-tpm-tools/launcher/auth.go deleted file mode 100644 index 5d2130e3a..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/auth.go +++ /dev/null @@ -1,45 +0,0 @@ -package launcher - -import ( - "encoding/json" - "strings" - - "cloud.google.com/go/compute/metadata" - "github.com/containerd/containerd/remotes" - "github.com/containerd/containerd/remotes/docker" - "golang.org/x/oauth2" -) - -// RetrieveAuthToken takes in a metadata server client, and uses it to read the -// default service account token from a GCE VM and returns the token. -func RetrieveAuthToken(client *metadata.Client) (oauth2.Token, error) { - data, err := client.Get("instance/service-accounts/default/token") - if err != nil { - return oauth2.Token{}, err - } - - var token oauth2.Token - if err := json.Unmarshal([]byte(data), &token); err != nil { - return oauth2.Token{}, err - } - - return token, nil -} - -// Resolver returns a custom resolver that can use the token to authenticate with -// the repo. -func Resolver(token string) remotes.Resolver { - options := docker.ResolverOptions{} - - credentials := func(host string) (string, string, error) { - // append the token if is talking to Artifact Registry or GCR Registry - if strings.HasSuffix(host, "docker.pkg.dev") || strings.HasSuffix(host, "gcr.io") { - return "_token", token, nil - } - return "", "", nil - } - authOpts := []docker.AuthorizerOpt{docker.WithAuthCreds(credentials)} - options.Authorizer = docker.NewDockerAuthorizer(authOpts...) - - return docker.NewResolver(options) -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/container_runner.go b/vendor/github.com/google/go-tpm-tools/launcher/container_runner.go deleted file mode 100644 index 6105230e1..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/container_runner.go +++ /dev/null @@ -1,647 +0,0 @@ -// Package launcher contains functionalities to start a measured workload -package launcher - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "io" - "log" - "math/rand" - "net/url" - "os" - "os/exec" - "path" - "strconv" - "strings" - "time" - - "cloud.google.com/go/compute/metadata" - "github.com/cenkalti/backoff/v4" - "github.com/containerd/containerd" - "github.com/containerd/containerd/cio" - "github.com/containerd/containerd/containers" - "github.com/containerd/containerd/content" - "github.com/containerd/containerd/images" - "github.com/containerd/containerd/oci" - "github.com/golang-jwt/jwt/v4" - "github.com/google/go-tpm-tools/cel" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/launcher/agent" - "github.com/google/go-tpm-tools/launcher/internal/signaturediscovery" - "github.com/google/go-tpm-tools/launcher/launcherfile" - "github.com/google/go-tpm-tools/launcher/spec" - "github.com/google/go-tpm-tools/launcher/verifier" - "github.com/google/go-tpm-tools/launcher/verifier/rest" - v1 "github.com/opencontainers/image-spec/specs-go/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" - "golang.org/x/oauth2" - "golang.org/x/oauth2/google" - "google.golang.org/api/impersonate" - "google.golang.org/api/option" -) - -// ContainerRunner contains information about the container settings -type ContainerRunner struct { - container containerd.Container - launchSpec spec.LaunchSpec - attestAgent agent.AttestationAgent - logger *log.Logger - serialConsole *os.File -} - -const tokenFileTmp = ".token.tmp" - -// Since we only allow one container on a VM, using a deterministic id is probably fine -const ( - containerID = "tee-container" - snapshotID = "tee-snapshot" -) - -const ( - nofile = 131072 // Max number of file descriptor -) - -const ( - // defaultRefreshMultiplier is a multiplier on the current token expiration - // time, at which the refresher goroutine will collect a new token. - // defaultRefreshMultiplier+defaultRefreshJitter should be <1. - defaultRefreshMultiplier = 0.8 - // defaultRefreshJitter is a random component applied additively to the - // refresh multiplier. The refresher will wait for some time in the range - // [defaultRefreshMultiplier-defaultRefreshJitter, defaultRefreshMultiplier+defaultRefreshJitter] - defaultRefreshJitter = 0.1 -) - -func fetchImpersonatedToken(ctx context.Context, serviceAccount string, audience string, opts ...option.ClientOption) ([]byte, error) { - config := impersonate.IDTokenConfig{ - Audience: audience, - TargetPrincipal: serviceAccount, - IncludeEmail: true, - } - - tokenSource, err := impersonate.IDTokenSource(ctx, config, opts...) - if err != nil { - return nil, fmt.Errorf("error creating token source: %v", err) - } - - token, err := tokenSource.Token() - if err != nil { - return nil, fmt.Errorf("error retrieving token: %v", err) - } - - return []byte(token.AccessToken), nil -} - -// NewRunner returns a runner. -func NewRunner(ctx context.Context, cdClient *containerd.Client, token oauth2.Token, launchSpec spec.LaunchSpec, mdsClient *metadata.Client, tpm io.ReadWriteCloser, logger *log.Logger, serialConsole *os.File) (*ContainerRunner, error) { - image, err := initImage(ctx, cdClient, launchSpec, token) - if err != nil { - return nil, err - } - - mounts := make([]specs.Mount, 0) - mounts = appendTokenMounts(mounts) - envs, err := formatEnvVars(launchSpec.Envs) - if err != nil { - return nil, err - } - // Check if there is already a container - container, err := cdClient.LoadContainer(ctx, containerID) - if err == nil { - // container exists, delete it first - container.Delete(ctx, containerd.WithSnapshotCleanup) - } - - logger.Printf("Operator Input Image Ref : %v\n", image.Name()) - logger.Printf("Image Digest : %v\n", image.Target().Digest) - logger.Printf("Operator Override Env Vars : %v\n", envs) - logger.Printf("Operator Override Cmd : %v\n", launchSpec.Cmd) - - imageConfig, err := getImageConfig(ctx, image) - if err != nil { - return nil, err - } - - logger.Printf("Exposed Ports: : %v\n", imageConfig.ExposedPorts) - if err := openPorts(imageConfig.ExposedPorts); err != nil { - return nil, err - } - - logger.Printf("Image Labels : %v\n", imageConfig.Labels) - launchPolicy, err := spec.GetLaunchPolicy(imageConfig.Labels) - if err != nil { - return nil, err - } - if err := launchPolicy.Verify(launchSpec); err != nil { - return nil, err - } - - if imageConfigDescriptor, err := image.Config(ctx); err != nil { - logger.Println(err) - } else { - logger.Printf("Image ID : %v\n", imageConfigDescriptor.Digest) - logger.Printf("Image Annotations : %v\n", imageConfigDescriptor.Annotations) - } - - hostname, err := os.Hostname() - if err != nil { - return nil, &RetryableError{fmt.Errorf("cannot get hostname: [%w]", err)} - } - - rlimits := []specs.POSIXRlimit{{ - Type: "RLIMIT_NOFILE", - Hard: nofile, - Soft: nofile, - }} - - container, err = cdClient.NewContainer( - ctx, - containerID, - containerd.WithImage(image), - containerd.WithNewSnapshot(snapshotID, image), - containerd.WithNewSpec( - oci.WithImageConfigArgs(image, launchSpec.Cmd), - oci.WithEnv(envs), - oci.WithMounts(mounts), - // following 4 options are here to allow the container to have - // the host network (same effect as --net-host in ctr command) - oci.WithHostHostsFile, - oci.WithHostResolvconf, - oci.WithHostNamespace(specs.NetworkNamespace), - oci.WithEnv([]string{fmt.Sprintf("HOSTNAME=%s", hostname)}), - withRlimits(rlimits), - ), - ) - if err != nil { - if container != nil { - container.Delete(ctx, containerd.WithSnapshotCleanup) - } - return nil, &RetryableError{fmt.Errorf("failed to create a container: [%w]", err)} - } - - containerSpec, err := container.Spec(ctx) - if err != nil { - return nil, &RetryableError{err} - } - // Container process Args length should be strictly longer than the Cmd - // override length set by the operator, as we want the Entrypoint filed - // to be mandatory for the image. - // Roughly speaking, Args = Entrypoint + Cmd - if len(containerSpec.Process.Args) <= len(launchSpec.Cmd) { - return nil, - fmt.Errorf("length of Args [%d] is shorter or equal to the length of the given Cmd [%d], maybe the Entrypoint is set to empty in the image?", - len(containerSpec.Process.Args), len(launchSpec.Cmd)) - } - - // Fetch ID token with specific audience. - // See https://cloud.google.com/functions/docs/securing/authenticating#functions-bearer-token-example-go. - principalFetcher := func(audience string) ([][]byte, error) { - u := url.URL{ - Path: "instance/service-accounts/default/identity", - RawQuery: url.Values{ - "audience": {audience}, - "format": {"full"}, - }.Encode(), - } - idToken, err := mdsClient.Get(u.String()) - if err != nil { - return nil, fmt.Errorf("failed to get principal tokens: %w", err) - } - - tokens := [][]byte{[]byte(idToken)} - - // Fetch impersonated ID tokens. - for _, sa := range launchSpec.ImpersonateServiceAccounts { - idToken, err := fetchImpersonatedToken(ctx, sa, audience) - if err != nil { - return nil, fmt.Errorf("failed to get impersonated token for %v: %w", sa, err) - } - - tokens = append(tokens, idToken) - } - return tokens, nil - } - - asAddr := launchSpec.AttestationServiceAddr - - verifierClient, err := getRESTClient(ctx, asAddr, launchSpec) - if err != nil { - return nil, fmt.Errorf("failed to create REST verifier client: %v", err) - } - - // Create a new signaturediscovery cleint to fetch signatures. - sdClient := getSignatureDiscoveryClient(cdClient, token, image.Target()) - return &ContainerRunner{ - container, - launchSpec, - agent.CreateAttestationAgent(tpm, client.GceAttestationKeyECC, verifierClient, principalFetcher, sdClient, launchSpec, logger), - logger, - serialConsole, - }, nil -} - -func getSignatureDiscoveryClient(cdClient *containerd.Client, token oauth2.Token, imageDesc v1.Descriptor) signaturediscovery.Fetcher { - var remoteOpt containerd.RemoteOpt - if token.Valid() { - remoteOpt = containerd.WithResolver(Resolver(token.AccessToken)) - } - return signaturediscovery.New(cdClient, imageDesc, remoteOpt) -} - -// getRESTClient returns a REST verifier.Client that points to the given address. -// It defaults to the Attestation Verifier instance at -// https://confidentialcomputing.googleapis.com. -func getRESTClient(ctx context.Context, asAddr string, spec spec.LaunchSpec) (verifier.Client, error) { - httpClient, err := google.DefaultClient(ctx) - if err != nil { - return nil, fmt.Errorf("failed to create HTTP client: %v", err) - } - - opts := []option.ClientOption{option.WithHTTPClient(httpClient)} - if asAddr != "" { - opts = append(opts, option.WithEndpoint(asAddr)) - } - - restClient, err := rest.NewClient(ctx, spec.ProjectID, spec.Region, opts...) - if err != nil { - return nil, err - } - return restClient, nil -} - -// formatEnvVars formats the environment variables to the oci format -func formatEnvVars(envVars []spec.EnvVar) ([]string, error) { - var result []string - for _, envVar := range envVars { - ociFormat, err := cel.FormatEnvVar(envVar.Name, envVar.Value) - if err != nil { - return nil, fmt.Errorf("failed to format env var: %v", err) - } - result = append(result, ociFormat) - } - return result, nil -} - -// appendTokenMounts appends the default mount specs for the OIDC token -func appendTokenMounts(mounts []specs.Mount) []specs.Mount { - m := specs.Mount{} - m.Destination = launcherfile.ContainerRuntimeMountPath - m.Type = "bind" - m.Source = launcherfile.HostTmpPath - m.Options = []string{"rbind", "ro"} - - return append(mounts, m) -} - -// measureContainerClaims will measure various container claims into the COS -// eventlog in the AttestationAgent. -func (r *ContainerRunner) measureContainerClaims(ctx context.Context) error { - image, err := r.container.Image(ctx) - if err != nil { - return err - } - if err := r.attestAgent.MeasureEvent(cel.CosTlv{EventType: cel.ImageRefType, EventContent: []byte(image.Name())}); err != nil { - return err - } - if err := r.attestAgent.MeasureEvent(cel.CosTlv{EventType: cel.ImageDigestType, EventContent: []byte(image.Target().Digest)}); err != nil { - return err - } - if err := r.attestAgent.MeasureEvent(cel.CosTlv{EventType: cel.RestartPolicyType, EventContent: []byte(r.launchSpec.RestartPolicy)}); err != nil { - return err - } - if imageConfigDescriptor, err := image.Config(ctx); err == nil { // if NO error - if err := r.attestAgent.MeasureEvent(cel.CosTlv{EventType: cel.ImageIDType, EventContent: []byte(imageConfigDescriptor.Digest)}); err != nil { - return err - } - } - - containerSpec, err := r.container.Spec(ctx) - if err != nil { - return err - } - for _, arg := range containerSpec.Process.Args { - if err := r.attestAgent.MeasureEvent(cel.CosTlv{EventType: cel.ArgType, EventContent: []byte(arg)}); err != nil { - return err - } - } - for _, env := range containerSpec.Process.Env { - if err := r.attestAgent.MeasureEvent(cel.CosTlv{EventType: cel.EnvVarType, EventContent: []byte(env)}); err != nil { - return err - } - } - - // Measure the input overridden Env Vars and Args separately, these should be subsets of the Env Vars and Args above. - envs, err := formatEnvVars(r.launchSpec.Envs) - if err != nil { - return err - } - for _, env := range envs { - if err := r.attestAgent.MeasureEvent(cel.CosTlv{EventType: cel.OverrideEnvType, EventContent: []byte(env)}); err != nil { - return err - } - } - for _, arg := range r.launchSpec.Cmd { - if err := r.attestAgent.MeasureEvent(cel.CosTlv{EventType: cel.OverrideArgType, EventContent: []byte(arg)}); err != nil { - return err - } - } - - separator := cel.CosTlv{ - EventType: cel.LaunchSeparatorType, - EventContent: nil, // Success - } - return r.attestAgent.MeasureEvent(separator) -} - -// Retrieves an OIDC token from the attestation service, and returns how long -// to wait before attemping to refresh it. -// The token file will be written to a tmp file and then renamed. -func (r *ContainerRunner) refreshToken(ctx context.Context) (time.Duration, error) { - r.logger.Print("refreshing attestation verifier OIDC token") - token, err := r.attestAgent.Attest(ctx) - if err != nil { - return 0, fmt.Errorf("failed to retrieve attestation service token: %v", err) - } - - // Get token expiration. - claims := &jwt.RegisteredClaims{} - _, _, err = jwt.NewParser().ParseUnverified(string(token), claims) - if err != nil { - return 0, fmt.Errorf("failed to parse token: %w", err) - } - - now := time.Now() - if !now.Before(claims.ExpiresAt.Time) { - return 0, errors.New("token is expired") - } - - // Write to a temp file first. - tmpTokenPath := path.Join(launcherfile.HostTmpPath, tokenFileTmp) - if err = os.WriteFile(tmpTokenPath, token, 0644); err != nil { - return 0, fmt.Errorf("failed to write a tmp token file: %v", err) - } - - // Rename the temp file to the token file (to avoid race conditions). - if err = os.Rename(tmpTokenPath, path.Join(launcherfile.HostTmpPath, launcherfile.AttestationVerifierTokenFilename)); err != nil { - return 0, fmt.Errorf("failed to rename the token file: %v", err) - } - - // Print out the claims in the jwt payload - mapClaims := jwt.MapClaims{} - _, _, err = jwt.NewParser().ParseUnverified(string(token), mapClaims) - if err != nil { - return 0, fmt.Errorf("failed to parse token: %w", err) - } - claimsString, err := json.MarshalIndent(mapClaims, "", " ") - if err != nil { - return 0, fmt.Errorf("failed to format claims: %w", err) - } - r.logger.Println(string(claimsString)) - - return getNextRefreshFromExpiration(time.Until(claims.ExpiresAt.Time), rand.Float64()), nil -} - -// ctx must be a cancellable context. -func (r *ContainerRunner) fetchAndWriteToken(ctx context.Context) error { - return r.fetchAndWriteTokenWithRetry(ctx, defaultRetryPolicy()) -} - -// ctx must be a cancellable context. -// retry specifies the refresher goroutine's retry policy. -func (r *ContainerRunner) fetchAndWriteTokenWithRetry(ctx context.Context, - retry *backoff.ExponentialBackOff) error { - if err := os.MkdirAll(launcherfile.HostTmpPath, 0744); err != nil { - return err - } - duration, err := r.refreshToken(ctx) - if err != nil { - return err - } - - // Set a timer to refresh the token before it expires. - timer := time.NewTimer(duration) - go func() { - for { - select { - case <-ctx.Done(): - timer.Stop() - r.logger.Println("token refreshing stopped") - return - case <-timer.C: - var duration time.Duration - // Refresh token with default retry policy. - err := backoff.RetryNotify( - func() error { - duration, err = r.refreshToken(ctx) - return err - }, - retry, - func(err error, t time.Duration) { - r.logger.Printf("failed to refresh attestation service token at time %v: %v", t, err) - }) - if err != nil { - r.logger.Printf("failed all attempts to refresh attestation service token, stopping refresher: %v", err) - return - } - - timer.Reset(duration) - } - } - }() - - return nil -} - -// getNextRefreshFromExpiration returns the Duration for the next run of the -// token refresher goroutine. It expects pre-validation that expiration is in -// the future (e.g., time.Now < expiration). -func getNextRefreshFromExpiration(expiration time.Duration, random float64) time.Duration { - diff := defaultRefreshJitter * float64(expiration) - center := defaultRefreshMultiplier * float64(expiration) - minRange := center - diff - return time.Duration(minRange + random*2*diff) -} - -/* -defaultRetryPolicy retries as follows: - -Given the following arguments, the retry sequence will be: - - RetryInterval = 60 sec - RandomizationFactor = 0.5 - Multiplier = 2 - MaxInterval = 3600 sec - MaxElapsedTime = 0 (never stops retrying) - - Request # RetryInterval (seconds) Randomized Interval (seconds) - RetryInterval*[1-RandFactor, 1+RandFactor] - 1 60 [30, 90] - 2 120 [60, 180] - 3 240 [120, 360] - 4 480 [240, 720] - 5 960 [480, 1440] - 6 1920 [960, 2880] - 7 3600 (MaxInterval) [1800, 5400] - 8 3600 (MaxInterval) [1800, 5400] - ... -*/ -func defaultRetryPolicy() *backoff.ExponentialBackOff { - expBack := backoff.NewExponentialBackOff() - expBack.InitialInterval = time.Minute - expBack.RandomizationFactor = 0.5 - expBack.Multiplier = 2 - expBack.MaxInterval = time.Hour - // Never stop retrying. - expBack.MaxElapsedTime = 0 - return expBack -} - -// Run the container -// Container output will always be redirected to logger writer for now -func (r *ContainerRunner) Run(ctx context.Context) error { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - if err := r.measureContainerClaims(ctx); err != nil { - return fmt.Errorf("failed to measure container claims: %v", err) - } - if err := r.fetchAndWriteToken(ctx); err != nil { - return fmt.Errorf("failed to fetch and write OIDC token: %v", err) - } - - r.logger.Printf("EnableTestFeatureForImage is set to %v\n", r.launchSpec.Experiments.EnableTestFeatureForImage) - - var streamOpt cio.Opt - switch r.launchSpec.LogRedirect { - case spec.Nowhere: - streamOpt = cio.WithStreams(nil, nil, nil) - r.logger.Println("Container stdout/stderr will not be redirected.") - case spec.Everywhere: - w := io.MultiWriter(os.Stdout, r.serialConsole) - streamOpt = cio.WithStreams(nil, w, w) - r.logger.Println("Container stdout/stderr will be redirected to serial and Cloud Logging. " + - "This may result in performance issues due to slow serial console writes.") - case spec.CloudLogging: - streamOpt = cio.WithStreams(nil, os.Stdout, os.Stdout) - r.logger.Println("Container stdout/stderr will be redirected to Cloud Logging.") - case spec.Serial: - streamOpt = cio.WithStreams(nil, r.serialConsole, r.serialConsole) - r.logger.Println("Container stdout/stderr will be redirected to serial logging. " + - "This may result in performance issues due to slow serial console writes.") - default: - return fmt.Errorf("unknown logging redirect location: %v", r.launchSpec.LogRedirect) - } - - task, err := r.container.NewTask(ctx, cio.NewCreator(streamOpt)) - if err != nil { - return &RetryableError{err} - } - defer task.Delete(ctx) - - exitStatusC, err := task.Wait(ctx) - if err != nil { - r.logger.Println(err) - } - r.logger.Println("workload task started") - - if err := task.Start(ctx); err != nil { - return &RetryableError{err} - } - status := <-exitStatusC - - code, _, err := status.Result() - if err != nil { - return err - } - - if code != 0 { - r.logger.Println("workload task ended and returned non-zero") - return &WorkloadError{code} - } - r.logger.Println("workload task ended and returned 0") - return nil -} - -func initImage(ctx context.Context, cdClient *containerd.Client, launchSpec spec.LaunchSpec, token oauth2.Token) (containerd.Image, error) { - if token.Valid() { - remoteOpt := containerd.WithResolver(Resolver(token.AccessToken)) - - image, err := cdClient.Pull(ctx, launchSpec.ImageRef, containerd.WithPullUnpack, remoteOpt) - if err != nil { - return nil, fmt.Errorf("cannot pull the image: %w", err) - } - return image, nil - } - image, err := cdClient.Pull(ctx, launchSpec.ImageRef, containerd.WithPullUnpack) - if err != nil { - return nil, fmt.Errorf("cannot pull the image (no token, only works for a public image): %w", err) - } - return image, nil -} - -// openPorts writes firewall rules to accept all traffic into that port and protocol using iptables. -func openPorts(ports map[string]struct{}) error { - for k := range ports { - portAndProtocol := strings.Split(k, "/") - if len(portAndProtocol) != 2 { - return fmt.Errorf("failed to parse port and protocol: got %s, expected [port]/[protocol] 80/tcp", portAndProtocol) - } - - port := portAndProtocol[0] - _, err := strconv.ParseUint(port, 10, 16) - if err != nil { - return fmt.Errorf("received invalid port number: %v, %w", port, err) - } - - protocol := portAndProtocol[1] - if protocol != "tcp" && protocol != "udp" { - return fmt.Errorf("received unknown protocol: got %s, expected tcp or udp", protocol) - } - - // This command will write a firewall rule to accept all INPUT packets for the given port/protocol. - cmd := exec.Command("iptables", "-A", "INPUT", "-p", protocol, "--dport", port, "-j", "ACCEPT") - out, err := cmd.CombinedOutput() - if err != nil { - return fmt.Errorf("failed to open port %s %s: %v %s", port, protocol, err, out) - } - } - - return nil -} - -func getImageConfig(ctx context.Context, image containerd.Image) (v1.ImageConfig, error) { - ic, err := image.Config(ctx) - if err != nil { - return v1.ImageConfig{}, err - } - switch ic.MediaType { - case v1.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config: - p, err := content.ReadBlob(ctx, image.ContentStore(), ic) - if err != nil { - return v1.ImageConfig{}, err - } - var ociimage v1.Image - if err := json.Unmarshal(p, &ociimage); err != nil { - return v1.ImageConfig{}, err - } - return ociimage.Config, nil - } - return v1.ImageConfig{}, fmt.Errorf("unknown image config media type %s", ic.MediaType) -} - -// Close the container runner -func (r *ContainerRunner) Close(ctx context.Context) { - // Exit gracefully: - // Delete container and close connection to attestation service. - r.container.Delete(ctx, containerd.WithSnapshotCleanup) -} - -// withRlimits sets the rlimit (like the max file descriptor) for the container process -func withRlimits(rlimits []specs.POSIXRlimit) oci.SpecOpts { - return func(_ context.Context, _ oci.Client, _ *containers.Container, s *oci.Spec) error { - s.Process.Rlimits = rlimits - return nil - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/container_runner_test.go b/vendor/github.com/google/go-tpm-tools/launcher/container_runner_test.go deleted file mode 100644 index 20bd7680d..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/container_runner_test.go +++ /dev/null @@ -1,500 +0,0 @@ -package launcher - -import ( - "bytes" - "context" - "crypto/rand" - "crypto/rsa" - "encoding/json" - "errors" - "fmt" - "io" - "log" - "net/http" - "os" - "path" - "strconv" - "testing" - "time" - - "github.com/cenkalti/backoff/v4" - "github.com/containerd/containerd" - "github.com/containerd/containerd/defaults" - "github.com/containerd/containerd/namespaces" - "github.com/golang-jwt/jwt/v4" - "github.com/google/go-tpm-tools/cel" - "github.com/google/go-tpm-tools/launcher/launcherfile" - "github.com/google/go-tpm-tools/launcher/spec" - "golang.org/x/oauth2" - "google.golang.org/api/option" -) - -const ( - idTokenEndpoint = "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/%s:generateIdToken" -) - -// Fake attestation agent. -type fakeAttestationAgent struct { - measureEventFunc func(cel.Content) error - attestFunc func(context.Context) ([]byte, error) -} - -func (f *fakeAttestationAgent) MeasureEvent(event cel.Content) error { - if f.measureEventFunc != nil { - return f.measureEventFunc(event) - } - - return fmt.Errorf("unimplemented") -} - -func (f *fakeAttestationAgent) Attest(ctx context.Context) ([]byte, error) { - if f.attestFunc != nil { - return f.attestFunc(ctx) - } - - return nil, fmt.Errorf("unimplemented") -} - -func createJWT(t *testing.T, ttl time.Duration) []byte { - return createJWTWithID(t, "test token", ttl) -} - -func createJWTWithID(t *testing.T, id string, ttl time.Duration) []byte { - t.Helper() - - privkey, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Fatalf("Error creating token key: %v", err) - } - - now := jwt.TimeFunc() - claims := &jwt.RegisteredClaims{ - ID: id, - IssuedAt: jwt.NewNumericDate(now), - NotBefore: jwt.NewNumericDate(now), - ExpiresAt: jwt.NewNumericDate(now.Add(ttl)), - } - - token := jwt.NewWithClaims(jwt.SigningMethodRS256, claims) - signed, err := token.SignedString(privkey) - if err != nil { - t.Fatalf("Error creating signed string: %v", err) - } - - return []byte(signed) -} - -func extractJWTClaims(t *testing.T, token []byte) *jwt.RegisteredClaims { - claims := &jwt.RegisteredClaims{} - _, _, err := jwt.NewParser().ParseUnverified(string(token), claims) - if err != nil { - t.Fatalf("failed to parse JWT: %v", token) - } - return claims -} - -func TestRefreshToken(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - ttl := 5 * time.Second - expectedToken := createJWT(t, ttl) - - runner := ContainerRunner{ - attestAgent: &fakeAttestationAgent{ - attestFunc: func(context.Context) ([]byte, error) { - return expectedToken, nil - }, - }, - logger: log.Default(), - } - - if err := os.MkdirAll(launcherfile.HostTmpPath, 0744); err != nil { - t.Fatalf("Error creating host token path directory: %v", err) - } - - refreshTime, err := runner.refreshToken(ctx) - if err != nil { - t.Fatalf("refreshToken returned with error: %v", err) - } - - filepath := path.Join(launcherfile.HostTmpPath, launcherfile.AttestationVerifierTokenFilename) - data, err := os.ReadFile(filepath) - if err != nil { - t.Fatalf("Failed to read from %s: %v", filepath, err) - } - - if !bytes.Equal(data, expectedToken) { - t.Errorf("Initial token written to file does not match expected token: got %v, want %v", data, expectedToken) - } - - // Expect refreshTime to be no greater than expectedTTL. - if refreshTime >= time.Duration(float64(ttl)) { - t.Errorf("Refresh time cannot exceed ttl: got %v, expect no greater than %v", refreshTime, time.Duration(float64(ttl))) - } -} - -func TestRefreshTokenError(t *testing.T) { - if err := os.MkdirAll(launcherfile.HostTmpPath, 0744); err != nil { - t.Fatalf("Error creating host token path directory: %v", err) - } - - testcases := []struct { - name string - agent *fakeAttestationAgent - }{ - { - name: "Attest fails", - agent: &fakeAttestationAgent{ - attestFunc: func(context.Context) ([]byte, error) { - return nil, errors.New("attest error") - }, - }, - }, - { - name: "Attest returns expired token", - agent: &fakeAttestationAgent{ - attestFunc: func(context.Context) ([]byte, error) { - return createJWT(t, -5*time.Second), nil - }, - }, - }, - } - - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - runner := ContainerRunner{ - attestAgent: tc.agent, - logger: log.Default(), - } - - if _, err := runner.refreshToken(context.Background()); err == nil { - t.Error("refreshToken succeeded, expected error.") - } - - }) - } -} - -func TestFetchAndWriteTokenSucceeds(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - expectedToken := createJWT(t, 5*time.Second) - - runner := ContainerRunner{ - attestAgent: &fakeAttestationAgent{ - attestFunc: func(context.Context) ([]byte, error) { - return expectedToken, nil - }, - }, - logger: log.Default(), - } - - if err := runner.fetchAndWriteToken(ctx); err != nil { - t.Fatalf("fetchAndWriteToken failed: %v", err) - } - - filepath := path.Join(launcherfile.HostTmpPath, launcherfile.AttestationVerifierTokenFilename) - data, err := os.ReadFile(filepath) - if err != nil { - t.Fatalf("Failed to read from %s: %v", filepath, err) - } - - if !bytes.Equal(data, expectedToken) { - t.Errorf("Token written to file does not match expected token: got %v, want %v", data, expectedToken) - } -} - -func TestTokenIsNotChangedIfRefreshFails(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - expectedToken := createJWT(t, 5*time.Second) - ttl := 5 * time.Second - successfulAttestFunc := func(context.Context) ([]byte, error) { - return expectedToken, nil - } - - errorAttestFunc := func(context.Context) ([]byte, error) { - return nil, errors.New("attest unsuccessful") - } - - runner := ContainerRunner{ - attestAgent: &fakeAttestationAgent{attestFunc: successfulAttestFunc}, - logger: log.Default(), - } - - if err := runner.fetchAndWriteToken(ctx); err != nil { - t.Fatalf("fetchAndWriteToken failed: %v", err) - } - - filepath := path.Join(launcherfile.HostTmpPath, launcherfile.AttestationVerifierTokenFilename) - data, err := os.ReadFile(filepath) - if err != nil { - t.Fatalf("Failed to read from %s: %v", filepath, err) - } - - if !bytes.Equal(data, expectedToken) { - t.Errorf("Initial token written to file does not match expected token: got %v, want %v", data, expectedToken) - } - - // Change attest agent to return error. - runner.attestAgent = &fakeAttestationAgent{attestFunc: errorAttestFunc} - - time.Sleep(ttl) - - data, err = os.ReadFile(filepath) - if err != nil { - t.Fatalf("Failed to read from %s: %v", filepath, err) - } - - if !bytes.Equal(data, expectedToken) { - t.Errorf("Expected token to remain the same after unsuccessful refresh attempt: got %v", data) - } -} - -// testRetryPolicy tries the operation at the following times: -// t=0s, .5s, 1.25s. It is canceled before the fourth try. -func testRetryPolicyThreeTimes() *backoff.ExponentialBackOff { - expBack := backoff.NewExponentialBackOff() - expBack.InitialInterval = 500 * time.Millisecond - expBack.RandomizationFactor = 0 - expBack.Multiplier = 1.5 - expBack.MaxInterval = 1 * time.Second - expBack.MaxElapsedTime = 2249 * time.Millisecond - return expBack -} - -func TestTokenRefreshRetryPolicyFail(t *testing.T) { - testRetryPolicyWithNTries(t, 4 /*numTries*/, false /*expectRefresh*/) -} - -func TestTokenRefreshRetryPolicy(t *testing.T) { - // Test retry policy tries 3 times. - for numTries := 1; numTries <= 3; numTries++ { - t.Run("RetryPolicyWith"+strconv.Itoa(numTries)+"Tries", - func(t *testing.T) { testRetryPolicyWithNTries(t, numTries /*numTries*/, true /*expectRefresh*/) }) - } -} - -func testRetryPolicyWithNTries(t *testing.T, numTries int, expectRefresh bool) { - strNum := strconv.Itoa(numTries) - t.Logf("testing with %d tries", numTries) - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - expectedInitialToken := createJWTWithID(t, "initial token"+strNum, 5*time.Second) - expectedRefreshToken := createJWTWithID(t, "refresh token"+strNum, 100*time.Second) - // Wait the initial token's 5s plus a second per retry (MaxInterval). - ttl := time.Duration(numTries)*time.Second + 5*time.Second - retry := -1 - attestFunc := func(context.Context) ([]byte, error) { - retry++ - // Success on the initial fetch (subsequent calls use refresher goroutine). - if retry == 0 { - return expectedInitialToken, nil - } - if retry == numTries { - return expectedRefreshToken, nil - } - return nil, errors.New("attest unsuccessful") - } - runner := ContainerRunner{ - attestAgent: &fakeAttestationAgent{attestFunc: attestFunc}, - logger: log.Default(), - } - if err := runner.fetchAndWriteTokenWithRetry(ctx, testRetryPolicyThreeTimes()); err != nil { - t.Fatalf("fetchAndWriteTokenWithRetry failed: %v", err) - } - filepath := path.Join(launcherfile.HostTmpPath, launcherfile.AttestationVerifierTokenFilename) - data, err := os.ReadFile(filepath) - if err != nil { - t.Fatalf("failed to read from %s: %v", filepath, err) - } - - if !bytes.Equal(data, expectedInitialToken) { - gotClaims := extractJWTClaims(t, data) - wantClaims := extractJWTClaims(t, expectedInitialToken) - t.Errorf("initial token written to file does not match expected token: got ID %v, want ID %v", gotClaims.ID, wantClaims.ID) - } - time.Sleep(ttl) - - data, err = os.ReadFile(filepath) - if err != nil { - t.Fatalf("failed to read from %s: %v", filepath, err) - } - - // No refresh: the token should match initial token. - if !expectRefresh && !bytes.Equal(data, expectedInitialToken) { - gotClaims := extractJWTClaims(t, data) - wantClaims := extractJWTClaims(t, expectedInitialToken) - t.Errorf("token refresher should fail and received token should be the initial token: got ID %v, want ID %v", gotClaims.ID, wantClaims.ID) - } - - // Should Refresh: the token should match refreshed token. - if expectRefresh && !bytes.Equal(data, expectedRefreshToken) { - gotClaims := extractJWTClaims(t, data) - wantClaims := extractJWTClaims(t, expectedRefreshToken) - t.Errorf("refreshed token did not match expected token: got ID %v, want ID %v", gotClaims.ID, wantClaims.ID) - } -} - -func TestFetchAndWriteTokenWithTokenRefresh(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - expectedToken := createJWT(t, 5*time.Second) - - ttl := 5 * time.Second - - runner := ContainerRunner{ - attestAgent: &fakeAttestationAgent{ - attestFunc: func(context.Context) ([]byte, error) { - return expectedToken, nil - }, - }, - logger: log.Default(), - } - - if err := runner.fetchAndWriteToken(ctx); err != nil { - t.Fatalf("fetchAndWriteToken failed: %v", err) - } - - filepath := path.Join(launcherfile.HostTmpPath, launcherfile.AttestationVerifierTokenFilename) - data, err := os.ReadFile(filepath) - if err != nil { - t.Fatalf("Failed to read from %s: %v", filepath, err) - } - - if !bytes.Equal(data, expectedToken) { - t.Errorf("Initial token written to file does not match expected token: got %v, want %v", data, expectedToken) - } - - // Change attest agent to return new token. - expectedRefreshedToken := createJWT(t, 10*time.Second) - runner.attestAgent = &fakeAttestationAgent{ - attestFunc: func(context.Context) ([]byte, error) { - return expectedRefreshedToken, nil - }, - } - - // Check that token has not been refreshed yet. - data, err = os.ReadFile(filepath) - if err != nil { - t.Fatalf("Failed to read from %s: %v", filepath, err) - } - - if !bytes.Equal(data, expectedToken) { - t.Errorf("Token unexpectedly refreshed: got %v, want %v", data, expectedRefreshedToken) - } - - time.Sleep(ttl) - - // Check that token has changed. - data, err = os.ReadFile(filepath) - if err != nil { - t.Fatalf("Failed to read from %s: %v", filepath, err) - } - - if !bytes.Equal(data, expectedRefreshedToken) { - t.Errorf("Refreshed token written to file does not match expected token: got %v, want %v", data, expectedRefreshedToken) - } -} - -type testRoundTripper struct { - roundTripFunc func(*http.Request) *http.Response -} - -func (t *testRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - return t.roundTripFunc(req), nil -} - -type idTokenResp struct { - Token string `json:"token"` -} - -func TestFetchImpersonatedToken(t *testing.T) { - expectedEmail := "test2@google.com" - - expectedToken := []byte("test_token") - - expectedURL := fmt.Sprintf(idTokenEndpoint, expectedEmail) - client := &http.Client{ - Transport: &testRoundTripper{ - roundTripFunc: func(req *http.Request) *http.Response { - if req.URL.String() != expectedURL { - t.Errorf("HTTP call was not made to a endpoint: got %v, want %v", req.URL.String(), expectedURL) - } - - resp := idTokenResp{ - Token: string(expectedToken), - } - - respBody, err := json.Marshal(resp) - if err != nil { - t.Fatalf("Unable to marshal HTTP response: %v", err) - } - - return &http.Response{ - StatusCode: http.StatusOK, - Header: make(http.Header), - Body: io.NopCloser(bytes.NewBuffer(respBody)), - } - }, - }, - } - - token, err := fetchImpersonatedToken(context.Background(), expectedEmail, "test_aud", option.WithHTTPClient(client)) - if err != nil { - t.Fatalf("fetchImpersonatedToken returned error: %v", err) - } - - if !bytes.Equal(token, expectedToken) { - t.Errorf("fetchImpersonatedToken did not return expected token: got %v, want %v", token, expectedToken) - } -} - -func TestGetNextRefresh(t *testing.T) { - // 0 <= random < 1. - for _, randNum := range []float64{0, .1415926, .5, .75, .999999999} { - // expiration should always be >0. - // 0 or negative expiration means the token has already expired. - for _, expInt := range []int64{1, 10, 100, 1000, 10000, 1000000} { - expDuration := time.Duration(expInt) - next := getNextRefreshFromExpiration(expDuration, randNum) - if next >= expDuration { - t.Errorf("getNextRefreshFromExpiration(%v, %v) = %v next refresh. expected %v (next refresh) < %v (expiration)", - expDuration, randNum, next, next, expDuration) - } - } - } -} - -func TestInitImageDockerPublic(t *testing.T) { - // testing image fetching using a dummy token and a docker repo url - containerdClient, err := containerd.New(defaults.DefaultAddress) - if err != nil { - t.Skipf("test needs containerd daemon: %v", err) - } - - ctx := namespaces.WithNamespace(context.Background(), "test") - // This is a "valid" token (formatwise) - validToken := oauth2.Token{AccessToken: "000000", Expiry: time.Now().Add(time.Hour)} - if _, err := initImage(ctx, containerdClient, spec.LaunchSpec{ImageRef: "docker.io/library/hello-world:latest"}, validToken); err != nil { - t.Error(err) - } else { - if err := containerdClient.ImageService().Delete(ctx, "docker.io/library/hello-world:latest"); err != nil { - t.Error(err) - } - } - - invalidToken := oauth2.Token{} - if _, err := initImage(ctx, containerdClient, spec.LaunchSpec{ImageRef: "docker.io/library/hello-world:latest"}, invalidToken); err != nil { - t.Error(err) - } else { - if err := containerdClient.ImageService().Delete(ctx, "docker.io/library/hello-world:latest"); err != nil { - t.Error(err) - } - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/errors.go b/vendor/github.com/google/go-tpm-tools/launcher/errors.go deleted file mode 100644 index 5650aa4e2..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/errors.go +++ /dev/null @@ -1,21 +0,0 @@ -package launcher - -import "fmt" - -// RetryableError means launcher should reboot the VM to retry. -type RetryableError struct { - Err error -} - -// WorkloadError represents the result of an workload/task that is non-zero. -type WorkloadError struct { - ReturnCode uint32 -} - -func (e *RetryableError) Error() string { - return fmt.Sprintf("failed with retryable error: %v", e.Err.Error()) -} - -func (e *WorkloadError) Error() string { - return "workload finished with a non-zero return code" -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/go.mod b/vendor/github.com/google/go-tpm-tools/launcher/go.mod deleted file mode 100644 index 90eec861f..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/go.mod +++ /dev/null @@ -1,67 +0,0 @@ -module github.com/google/go-tpm-tools/launcher - -go 1.20 - -require ( - cloud.google.com/go/compute/metadata v0.2.3 - cloud.google.com/go/confidentialcomputing v1.3.0 - github.com/cenkalti/backoff/v4 v4.1.3 - github.com/containerd/containerd v1.6.18 - github.com/golang-jwt/jwt/v4 v4.4.1 - github.com/google/go-cmp v0.5.9 - github.com/google/go-tpm v0.9.0 - github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba - github.com/opencontainers/go-digest v1.0.0 - github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 - github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 - go.uber.org/multierr v1.11.0 - golang.org/x/oauth2 v0.8.0 - google.golang.org/api v0.128.0 - google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc -) - -require ( - cloud.google.com/go/compute v1.19.3 // indirect - github.com/Microsoft/go-winio v0.5.2 // indirect - github.com/Microsoft/hcsshim v0.9.6 // indirect - github.com/containerd/cgroups v1.0.4 // indirect - github.com/containerd/continuity v0.3.0 // indirect - github.com/containerd/fifo v1.0.0 // indirect - github.com/containerd/ttrpc v1.1.0 // indirect - github.com/containerd/typeurl v1.0.2 // indirect - github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect - github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/certificate-transparency-go v1.1.2 // indirect - github.com/google/go-attestation v0.5.0 // indirect - github.com/google/go-sev-guest v0.9.3 // indirect - github.com/google/go-tspi v0.3.0 // indirect - github.com/google/logger v1.1.1 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect - github.com/klauspost/compress v1.15.9 // indirect - github.com/moby/locker v1.0.1 // indirect - github.com/moby/sys/mountinfo v0.6.1 // indirect - github.com/moby/sys/signal v0.7.0 // indirect - github.com/opencontainers/runc v1.1.5 // indirect - github.com/opencontainers/selinux v1.10.1 // indirect - github.com/pborman/uuid v1.2.1 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/sirupsen/logrus v1.8.1 // indirect - github.com/stretchr/testify v1.8.3 // indirect - go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.1 // indirect - google.golang.org/protobuf v1.31.0 // indirect -) diff --git a/vendor/github.com/google/go-tpm-tools/launcher/go.sum b/vendor/github.com/google/go-tpm-tools/launcher/go.sum deleted file mode 100644 index 8e081db3c..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/go.sum +++ /dev/null @@ -1,1789 +0,0 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -bitbucket.org/creachadair/shell v0.0.6/go.mod h1:8Qqi/cYk7vPnsOePHroKXDJYmb5x7ENhtiFtfZq8K+M= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.39.0/go.mod h1:rVLT6fkc8chs9sfPtFc1SBH6em7n+ZoXaG+87tDISts= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.92.2/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.92.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.19.3 h1:DcTwsFgGev/wV5+q8o2fzgcHOaac+DKGC91ZlvpsQds= -cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/confidentialcomputing v1.3.0 h1:LHpXM+LwLHxssLpyo0eA0E7lZpf8dibL3H8NIIxFT24= -cloud.google.com/go/confidentialcomputing v1.3.0/go.mod h1:TfAE7KR3GWwpoNrM2ivLSL6edcr7amU5BxfPxviwY/U= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/monitoring v0.1.0/go.mod h1:Hpm3XfzJv+UTiXzCG5Ffp0wijzHTC7Cv4eR7o3x/fEE= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/spanner v1.17.0/go.mod h1:+17t2ixFwRG4lWRwE+5kipDR9Ef07Jkmc8z0IbMDKUs= -cloud.google.com/go/spanner v1.18.0/go.mod h1:LvAjUXPeJRGNuGpikMULjhLj/t9cRvdc+fxRoLiugXA= -cloud.google.com/go/spanner v1.25.0/go.mod h1:kQUft3x355hzzaeFbObjsvkzZDgpDkesp3v75WBnI8w= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/trace v0.1.0/go.mod h1:wxEwsoeRVPbeSkt7ZC9nWCgmoKQRAoySN7XHW2AmI7g= -code.gitea.io/sdk/gitea v0.11.3/go.mod h1:z3uwDV/b9Ls47NGukYM9XhnHtqPh/J+t40lsUrR6JDY= -contrib.go.opencensus.io/exporter/aws v0.0.0-20181029163544-2befc13012d0/go.mod h1:uu1P0UCM/6RbsMrgPa98ll8ZcHM858i/AD06a9aLRCA= -contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0= -contrib.go.opencensus.io/exporter/stackdriver v0.12.1/go.mod h1:iwB6wGarfphGGe/e5CWqyUk/cLzKnWsOKPVW3no6OTw= -contrib.go.opencensus.io/exporter/stackdriver v0.13.5/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= -contrib.go.opencensus.io/exporter/stackdriver v0.13.8/go.mod h1:huNtlWx75MwO7qMs0KrMxPZXzNNWebav1Sq/pm02JdQ= -contrib.go.opencensus.io/integrations/ocsql v0.1.4/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE= -contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-amqp-common-go/v2 v2.1.0/go.mod h1:R8rea+gJRuJR6QxTir/XuEd+YuKoUiazDC/N96FiDEU= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v29.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v30.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-service-bus-go v0.9.1/go.mod h1:yzBx6/BUGfjfeqbRZny9AQIbIe3AcV9WZbAdpkoXOa0= -github.com/Azure/azure-storage-blob-go v0.8.0/go.mod h1:lPI3aLPpuLTeUwh1sViKXFxwl2B6teiRqI0deQUvsw0= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v12.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= -github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= -github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= -github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= -github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= -github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20191009163259-e802c2cb94ae/go.mod h1:mjwGPas4yKduTyubHvD1Atl9r1rUq8DfVy+gkVvZ+oo= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/semver/v3 v3.1.0/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= -github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= -github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= -github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= -github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= -github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= -github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= -github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= -github.com/Microsoft/hcsshim v0.9.6 h1:VwnDOgLeoi2du6dAznfmspNqTiwczvjv4K7NxuY9jsY= -github.com/Microsoft/hcsshim v0.9.6/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= -github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= -github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= -github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= -github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= -github.com/apache/beam v2.28.0+incompatible/go.mod h1:/8NX3Qi8vGstDLLaeaU7+lzVEu/ACaQhYjeefzQ0y1o= -github.com/apache/beam v2.32.0+incompatible/go.mod h1:/8NX3Qi8vGstDLLaeaU7+lzVEu/ACaQhYjeefzQ0y1o= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apex/log v1.1.4/go.mod h1:AlpoD9aScyQfJDVHmLMEcx4oU6LqzkWp4Mg9GdAcEvQ= -github.com/apex/logs v0.0.4/go.mod h1:XzxuLZ5myVHDy9SAmYpamKKRNApGj54PfYLcFrXqDwo= -github.com/aphistic/golf v0.0.0-20180712155816-02c07f170c5a/go.mod h1:3NqKYiepwy8kCu4PNA+aP7WUV72eXWJeP9/r3/K9aLE= -github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.19.45/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.25.11/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= -github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI= -github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= -github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= -github.com/caarlos0/ctrlc v1.0.0/go.mod h1:CdXpj4rmq0q/1Eb44M9zi2nKB0QraNKuRGYGrrHhcQw= -github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e/go.mod h1:9IOqJGCPMSc6E5ydlp5NIonxObaeu/Iub/X03EKPVYo= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= -github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= -github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= -github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= -github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= -github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= -github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= -github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= -github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= -github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= -github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= -github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= -github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= -github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E= -github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= -github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= -github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601/go.mod h1:X9rLEHIqSf/wfK8NsPqxJmeZgW4pcfzdXITDrUSJ6uI= -github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= -github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= -github.com/containerd/cgroups v0.0.0-20200710171044-318312a37340/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= -github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= -github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= -github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= -github.com/containerd/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA= -github.com/containerd/cgroups v1.0.4/go.mod h1:nLNQtsF7Sl2HxNebu77i1R0oDlhiTG+kO4JTrUzo6IA= -github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= -github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4qcS3XoQ5xkw= -github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= -github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/containerd/containerd v1.2.10/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.1-0.20191213020239-082f7e3aed57/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.0-beta.2.0.20200729163537-40b22ef07410/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= -github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= -github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= -github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= -github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= -github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= -github.com/containerd/containerd v1.6.18 h1:qZbsLvmyu+Vlty0/Ex5xc0z2YtKpIsb5n45mAMI+2Ns= -github.com/containerd/containerd v1.6.18/go.mod h1:1RdCUu95+gc2v9t3IL+zIlpClSmew7/0YS8O5eQZrOw= -github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= -github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= -github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= -github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= -github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= -github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= -github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= -github.com/containerd/fifo v0.0.0-20201026212402-0724c46b320c/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= -github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= -github.com/containerd/fifo v1.0.0 h1:6PirWBr9/L7GDamKr+XM0IeUFXu5mf3M/BPpH9gaLBU= -github.com/containerd/fifo v1.0.0/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= -github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU= -github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk= -github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/go-runc v0.0.0-20190911050354-e029b79d8cda/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g= -github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= -github.com/containerd/go-runc v1.0.0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= -github.com/containerd/imgcrypt v1.0.1/go.mod h1:mdd8cEPW7TPgNG4FpuP3sGBiQ7Yi/zak9TYCG3juvb0= -github.com/containerd/imgcrypt v1.0.4-0.20210301171431-0ae5c75f59ba/go.mod h1:6TNsg0ctmizkrOgXRNQjAPFWpMYRWuiB6dSF4Pfa5SA= -github.com/containerd/imgcrypt v1.1.1-0.20210312161619-7ed62a527887/go.mod h1:5AZJNI6sLHJljKuI9IHnw1pWqo/F0nGDOuR9zgTs7ow= -github.com/containerd/imgcrypt v1.1.1/go.mod h1:xpLnwiQmEUJPvQoAapeb2SNCxz7Xr6PJrXQb0Dpc4ms= -github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c= -github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= -github.com/containerd/nri v0.1.0/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= -github.com/containerd/stargz-snapshotter/estargz v0.4.1/go.mod h1:x7Q9dg9QYb4+ELgxmo4gBUeJB0tl5dqH1Sdz0nJU1QM= -github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= -github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= -github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= -github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= -github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= -github.com/containerd/ttrpc v1.1.0 h1:GbtyLRxb0gOLR0TYQWt3O6B0NvT8tMdorEHqIQo/lWI= -github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ= -github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= -github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk= -github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= -github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY= -github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= -github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw= -github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y= -github.com/containerd/zfs v0.0.0-20210315114300-dde8f0fda960/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containerd/zfs v1.0.0/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM= -github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8= -github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc= -github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgUV4GP9qXPfu4= -github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= -github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= -github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= -github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= -github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= -github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= -github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= -github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/devigned/tab v0.1.1/go.mod h1:XG9mPq0dFghrYvoBF3xdRrJzSTX1b7IQrvaL9mzjeJY= -github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= -github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= -github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c h1:+pKlWGMw7gf6bQ+oDZB4KHQFypsfjYlq/C4rfL7D3g8= -github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= -github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= -github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.3.0-java/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/etcd-io/gofail v0.0.0-20190801230047-ad7f989257ca/go.mod h1:49H/RkXP8pKaZy4h0d+NW16rSLhyVBt4o6VLJbmOqDE= -github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -github.com/fullstorydev/grpcurl v1.8.0/go.mod h1:Mn2jWbdMrQGJQ8UD62uNyMumT2acsZUCkZIqFxsQf1o= -github.com/fullstorydev/grpcurl v1.8.1/go.mod h1:3BWhvHZwNO7iLXaQlojdg5NA6SxUDePli4ecpK1N7gw= -github.com/fullstorydev/grpcurl v1.8.2/go.mod h1:YvWNT3xRp2KIRuvCphFodG0fKkMXwaxA9CJgKCcyzUQ= -github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= -github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= -github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= -github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= -github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= -github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= -github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= -github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= -github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= -github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= -github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= -github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ= -github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= -github.com/google/certificate-transparency-go v1.1.2-0.20210422104406-9f33727a7a18/go.mod h1:6CKh9dscIRoqc2kC6YUFICHZMT9NrClyPrRVFrdw1QQ= -github.com/google/certificate-transparency-go v1.1.2-0.20210512142713-bed466244fa6/go.mod h1:aF2dp7Dh81mY8Y/zpzyXps4fQW5zQbDu2CxfpJB6NkI= -github.com/google/certificate-transparency-go v1.1.2 h1:4hE0GEId6NAW28dFpC+LrRGwQX5dtmXQGDbg8+/MZOM= -github.com/google/certificate-transparency-go v1.1.2/go.mod h1:3OL+HKDqHPUfdKrHVQxO6T8nDLO0HF7LRTlkIWXaWvQ= -github.com/google/go-attestation v0.5.0 h1:jXtAWT2sw2Yu8mYU0BC7FDidR+ngxFPSE+pl6IUu3/0= -github.com/google/go-attestation v0.5.0/go.mod h1:0Tik9y3rzV649Jcr7evbljQHQAsIlJucyqQjYDBqktU= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= -github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM= -github.com/google/go-licenses v0.0.0-20210329231322-ce1d9163b77d/go.mod h1:+TYOmkVoJOpwnS0wfdsJCV9CoD5nJYsHoFk/0CrTK4M= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/go-replayers/grpcreplay v0.1.0/go.mod h1:8Ig2Idjpr6gifRd6pNVggX6TC1Zw6Jx74AKp7QNH2QE= -github.com/google/go-replayers/httpreplay v0.1.0/go.mod h1:YKZViNhiGgqdBlUbI2MwGpq4pXxNmhJLPHQ7cv2b5no= -github.com/google/go-sev-guest v0.9.3 h1:GOJ+EipURdeWFl/YYdgcCxyPeMgQUWlI056iFkBD8UU= -github.com/google/go-tpm v0.9.0 h1:sQF6YqWMi+SCXpsmS3fd21oPy/vSddwZry4JnmltHVk= -github.com/google/go-tpm v0.9.0/go.mod h1:FkNVkc6C+IsvDI9Jw1OveJmxGZUUaKxtrpOS47QWKfU= -github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba h1:qJEJcuLzH5KDR0gKc0zcktin6KSAwL7+jWKBYceddTc= -github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba/go.mod h1:EFYHy8/1y2KfgTAsx7Luu7NGhoxtuVHnNo8jE7FikKc= -github.com/google/go-tspi v0.3.0 h1:ADtq8RKfP+jrTyIWIZDIYcKOMecRqNJFOew2IT0Inus= -github.com/google/go-tspi v0.3.0/go.mod h1:xfMGI3G0PhxCdNVcYr1C4C+EizojDg/TXuX5by8CiHI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/licenseclassifier v0.0.0-20210325184830-bb04aff29e72/go.mod h1:qsqn2hxC+vURpyBRygGUuinTO42MFRLcsmQ/P8v94+M= -github.com/google/logger v1.1.1 h1:+6Z2geNxc9G+4D4oDO9njjjn2d0wN5d7uOo0vOIW1NQ= -github.com/google/logger v1.1.1/go.mod h1:BkeJZ+1FhQ+/d087r4dzojEg1u2ZX+ZqG1jTUrLM+zQ= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/rpmpack v0.0.0-20191226140753-aa36bfddb3a0/go.mod h1:RaTPr0KUf2K7fnZYLNDrr8rxAamWs3iNywJLtQ2AzBg= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= -github.com/google/trillian v1.3.14-0.20210409160123-c5ea3abd4a41/go.mod h1:1dPv0CUjNQVFEDuAUFhZql16pw/VlPgaX8qj+g5pVzQ= -github.com/google/trillian v1.3.14-0.20210511103300-67b5f349eefa/go.mod h1:s4jO3Ai4NSvxucdvqUHON0bCqJyoya32eNw6XJwsmNc= -github.com/google/trillian v1.4.0/go.mod h1:1Bja2nEgMDlEJWWRXBUemSPG9qYw84ZYX2gHRVHlR+g= -github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/wire v0.3.0/go.mod h1:i1DMg/Lu8Sz5yYl25iOdmc5CT5qusaa+zmRWs16741s= -github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= -github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go v2.0.2+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= -github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= -github.com/goreleaser/goreleaser v0.134.0/go.mod h1:ZT6Y2rSYa6NxQzIsdfWWNWAlYGXGbreo66NmE+3X3WQ= -github.com/goreleaser/nfpm v1.2.1/go.mod h1:TtWrABZozuLOttX2uDlYyECfQX7x5XYkVxhjYcR6G9w= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= -github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= -github.com/jhump/protoreflect v1.8.2/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= -github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= -github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= -github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= -github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= -github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= -github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= -github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= -github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= -github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= -github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= -github.com/moby/sys/mountinfo v0.6.1 h1:+H/KnGEAGRpTrEAqNVQ2AM3SiwMgJUt/TXj+Z8cmCIc= -github.com/moby/sys/mountinfo v0.6.1/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= -github.com/moby/sys/signal v0.7.0 h1:25RW3d5TnQEoKvRbEKUGay6DCQ46IxAVTT9CUMgmsSI= -github.com/moby/sys/signal v0.7.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= -github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= -github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= -github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= -github.com/mwitkow/go-proto-validators v0.2.0/go.mod h1:ZfA1hW+UH/2ZHOWvQ3HnQaU0DtnpXu850MZiy+YUgcc= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= -github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= -github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= -github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= -github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= -github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 h1:3snG66yBm59tKhhSPQrQ/0bCrv1LQbKt40LnUPiUxdc= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= -github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= -github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= -github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= -github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= -github.com/opencontainers/selinux v1.10.1 h1:09LIPVRP3uuZGQvgR+SgMSNBd1Eb3vlRbGqQpoHsF8w= -github.com/opencontainers/selinux v1.10.1/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= -github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= -github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/pseudomuto/protoc-gen-doc v1.4.1/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= -github.com/pseudomuto/protoc-gen-doc v1.5.0/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr2sn6hBC1WIYH/UbIg= -github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.0/go.mod h1:EBwu+T5AvHOcXwvZIkQFjUN6s8Czyqw12GL/Y0tUyRM= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b/go.mod h1:am+Fp8Bt506lA3Rk3QCmSqmYmLMnPDhdDUcosQCAx+I= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= -github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= -github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/soheilhy/cmux v0.1.5-0.20210205191134-5ec6847320e5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= -github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= -github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= -github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0= -github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0= -github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao= -github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= -github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= -github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= -github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= -github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= -github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= -github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug= -github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= -github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= -go.etcd.io/etcd/api/v3 v3.5.0-alpha.0/go.mod h1:mPcW6aZJukV6Aa81LSKpBjQXTWlXB5r74ymPoSWa3Sw= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0-alpha.0/go.mod h1:kdV+xzCJ3luEBSIeQyB/OEKkWKd8Zkux4sbDeANrosU= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.etcd.io/etcd/client/v3 v3.5.0-alpha.0/go.mod h1:wKt7jgDgf/OfKiYmCq5WFGxOFAkVMLxiiXgLDFhECr8= -go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= -go.etcd.io/etcd/etcdctl/v3 v3.5.0-alpha.0/go.mod h1:YPwSaBciV5G6Gpt435AasAG3ROetZsKNUzibRa/++oo= -go.etcd.io/etcd/etcdctl/v3 v3.5.0/go.mod h1:vGTfKdsh87RI7kA2JHFBEGxjQEYx+pi299wqEOdi34M= -go.etcd.io/etcd/etcdutl/v3 v3.5.0/go.mod h1:o98rKMCibbFAG8QS9KmvlYDGDShmmIbmRE8vSofzYNg= -go.etcd.io/etcd/pkg/v3 v3.5.0-alpha.0/go.mod h1:tV31atvwzcybuqejDoY3oaNRTtlD2l/Ot78Pc9w7DMY= -go.etcd.io/etcd/pkg/v3 v3.5.0/go.mod h1:UzJGatBQ1lXChBkQF0AuAtkRQMYnHubxAEYIrC3MSsE= -go.etcd.io/etcd/raft/v3 v3.5.0-alpha.0/go.mod h1:FAwse6Zlm5v4tEWZaTjmNhe17Int4Oxbu7+2r0DiD3w= -go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD00Szc= -go.etcd.io/etcd/server/v3 v3.5.0-alpha.0/go.mod h1:tsKetYpt980ZTpzl/gb+UOJj9RkIyCb1u4wjzMg90BQ= -go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4= -go.etcd.io/etcd/tests/v3 v3.5.0-alpha.0/go.mod h1:HnrHxjyCuZ8YDt8PYVyQQ5d1ZQfzJVEtQWllr5Vp/30= -go.etcd.io/etcd/tests/v3 v3.5.0/go.mod h1:f+mtZ1bE1YPvgKdOJV2BKy4JQW0nAFnQehgOE7+WyJE= -go.etcd.io/etcd/v3 v3.5.0-alpha.0/go.mod h1:JZ79d3LV6NUfPjUxXrpiFAYcjhT+06qqw+i28snx8To= -go.etcd.io/etcd/v3 v3.5.0/go.mod h1:FldM0/VzcxYWLvWx1sdA7ghKw7C3L2DvUTzGrcEtsC4= -go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= -go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.22.6/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E= -go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= -go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= -go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= -go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= -go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= -go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= -go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= -go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -gocloud.dev v0.19.0/go.mod h1:SmKwiR8YwIMMJvQBKLsC3fHNyMwXLw3PMDO+VVteJMI= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210126194326-f9ce19ea3013/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190620070143-6f217b454f45/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190812073006-9eafafc0a87e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191119060738-e882bf8e40c2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= -golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201014170642-d1624618ad65/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.6.0/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.10.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.37.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.45.0/go.mod h1:ISLIJCedJolbZvDfAk+Ctuq5hf+aJ33WgtUsfyFoLXA= -google.golang.org/api v0.46.0/go.mod h1:ceL4oozhkAiTID8XMmJBsIxID/9wMXJVVFXPg4ylg3I= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= -google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= -google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190522204451-c2c4e71fbf69/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190620144150-6af8c5fc6601/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210331142528-b7513248f0ba/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210413151531-c14fb6ef47c3/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210427215850-f767ed18ee4d/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc h1:8DyZCyvI8mE1IdLy/60bS+52xfymkE72wv1asokgtao= -google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98= -gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= -gopkg.in/src-d/go-git.v4 v4.13.1/go.mod h1:nx5NYcxdKxq5fpltdHnPa2Exj4Sx0EclMWZQbYDu2z8= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= -gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= -k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= -k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= -k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= -k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= -k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= -k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= -k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= -k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= -k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= -k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0= -k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= -k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= -k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= -k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= -k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= -k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= -k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= -k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= -k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= -k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= -k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= -k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -pack.ag/amqp v0.11.2/go.mod h1:4/cbmt4EJXSKlG6LCfWHoqmN0uFdy5i/+YFz+fTfhV4= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/cloudbuild.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/cloudbuild.yaml deleted file mode 100644 index 5bdf05dfa..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/cloudbuild.yaml +++ /dev/null @@ -1,59 +0,0 @@ -substitutions: - '_BASE_IMAGE': '' - '_OUTPUT_IMAGE_NAME': '' - '_OUTPUT_IMAGE_FAMILY': '' - '_BASE_IMAGE_PROJECT': 'cos-cloud' - '_IMAGE_ENV': '' - '_BUCKET_NAME': '${PROJECT_ID}_cloudbuild' - '_CS_LICENSE': '' - -steps: - - name: golang:1.20 - entrypoint: /bin/bash - args: - - -c - - | - cd launcher/launcher - CGO_ENABLED=0 go build -o ../image/launcher - - name: 'gcr.io/cloud-builders/gcloud' - id: DownloadExpBinary - entrypoint: 'gcloud' - args: ['storage', - 'cp', - 'gs://confidential-space-images_third-party/confidential_space_experiments', - './launcher/image/confidential_space_experiments'] - - name: 'gcr.io/cos-cloud/cos-customizer' - args: ['start-image-build', - '-build-context=launcher/image', - '-gcs-bucket=${_BUCKET_NAME}', - '-gcs-workdir=customizer-${BUILD_ID}', - '-image-name=${_BASE_IMAGE}', - '-image-project=${_BASE_IMAGE_PROJECT}'] - - name: 'gcr.io/cos-cloud/cos-customizer' - args: ['run-script', - '-script=preload.sh', - '-env=IMAGE_ENV=${_IMAGE_ENV}'] - - name: 'gcr.io/cos-cloud/cos-customizer' - args: ['seal-oem'] - - name: 'gcr.io/cos-cloud/cos-customizer' - args: ['run-script', - '-script=fixup_oem.sh'] - - name: 'gcr.io/cos-cloud/cos-customizer' - args: ['finish-image-build', - '-oem-size=500M', - '-disk-size-gb=11', - '-image-name=${_OUTPUT_IMAGE_NAME}', - '-image-family=${_OUTPUT_IMAGE_FAMILY}', - '-image-project=${PROJECT_ID}', - '-licenses=${_CS_LICENSE}', - '-licenses=projects/confidential-space-images/global/licenses/ek-certificate-license', - '-zone=us-central1-a', - '-project=${PROJECT_ID}'] - -timeout: '3000s' - -options: - logging: CLOUD_LOGGING_ONLY - dynamic_substitutions: true - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/container-runner.service b/vendor/github.com/google/go-tpm-tools/launcher/image/container-runner.service deleted file mode 100644 index 3f0d7a575..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/container-runner.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Confidential Space Launcher -Wants=network-online.target gcr-online.target containerd.service -After=network-online.target gcr-online.target containerd.service - -[Service] -ExecStart=/usr/share/oem/confidential_space/cs_container_launcher -ExecStopPost=/usr/share/oem/confidential_space/exit_script.sh -Restart=no -StandardOutput=journal -StandardError=journal - -[Install] -WantedBy=multi-user.target diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/debug.conf b/vendor/github.com/google/go-tpm-tools/launcher/image/debug.conf deleted file mode 100644 index 06c8f51b7..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/debug.conf +++ /dev/null @@ -1,3 +0,0 @@ -[Service] -# debug image machine won't shutdown -ExecStopPost= diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/entrypoint.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/entrypoint.sh deleted file mode 100644 index 4ac3fef0a..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/entrypoint.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -main() { - # Copy service files. - cp /usr/share/oem/confidential_space/container-runner.service /etc/systemd/system/container-runner.service - # Override default fluent-bit config. - cp /usr/share/oem/confidential_space/fluent-bit-cs.conf /etc/fluent-bit/fluent-bit.conf - - systemctl daemon-reload - systemctl enable container-runner.service - systemctl start container-runner.service - systemctl start fluent-bit.service - -} - -main diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/exit_script.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/exit_script.sh deleted file mode 100755 index 9c12dd04c..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/exit_script.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash - -if [[ $EXIT_STATUS -eq 3 ]] -then - # reboot after 2 min - shutdown --reboot +2 -fi - -if [[ $EXIT_STATUS -eq 0 ]] || [[ $EXIT_STATUS -eq 1 ]] || [[ $EXIT_STATUS -eq 2 ]] -then - # poweroff after 2 min - shutdown --poweroff +2 -fi - diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/fixup_oem.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/fixup_oem.sh deleted file mode 100644 index fe6fbc80a..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/fixup_oem.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -main() { - if [[ ! -d /mnt/disks/efi ]]; then - mkdir /mnt/disks/efi - fi - mount /dev/sda12 /mnt/disks/efi - sed -i -e 's|systemd.mask=usr-share-oem.mount||g' /mnt/disks/efi/efi/boot/grub.cfg - - # TODO: Remove this fix once the upstream customizer fixed the bug. - # Fix a string manipulation bug in the dm part of the kernel cmd. - if grep -q "dm-m2d" /mnt/disks/efi/efi/boot/grub.cfg; then - sed -i -e 's|dm-m2d|dm-mod|g' /mnt/disks/efi/efi/boot/grub.cfg - sed -i -e 's|,oemroot|;oemroot|g' /mnt/disks/efi/efi/boot/grub.cfg - fi - - # Print grub.cfg's kernel command line. - grep -i '^\s*linux' /mnt/disks/efi/efi/boot/grub.cfg | \ - sed -e 's|.*|[BEGIN_CS_GRUB_CMDLINE]&[END_CS_GRUB_CMDLINE]|g' - - # Convert grub.cfg's kernel command line into what GRUB passes to the kernel. - grep -i '^\s*linux' /mnt/disks/efi/efi/boot/grub.cfg | \ - sed -e "s|'ds=nocloud;s=/usr/share/oem/'|ds=nocloud;s=/usr/share/oem/|g" | \ - sed -e 's|\\"|"|g' | \ - sed -e 's|dm-mod.create="|"dm-mod.create=|g' | \ - sed -e 's|.*|[BEGIN_CS_CMDLINE]&[END_CS_CMDLINE]|g' - - umount /mnt/disks/efi -} - -main diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/fluent-bit-cs.conf b/vendor/github.com/google/go-tpm-tools/launcher/image/fluent-bit-cs.conf deleted file mode 100644 index f1bdd14ca..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/fluent-bit-cs.conf +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Forked from https://cos.googlesource.com/cos/overlays/board-overlays/+/refs/heads/master/project-lakitu/app-admin/fluent-bit/files/fluent-bit.conf - -[SERVICE] - # Flush - # ===== - # set an interval of seconds before to flush records to a destination - flush 1 - # Daemon - # ====== - # instruct Fluent Bit to run in foreground or background mode. - daemon Off - # Log_Level - # ========= - # Set the verbosity level of the service, values can be: - # - # - error - # - warning - # - info - # - debug - # - trace - # - # by default 'info' is set, that means it includes 'error' and 'warning'. - log_level info - # Storage - # ======= - # Fluent Bit can use memory and filesystem buffering based mechanisms - # - # - https://docs.fluentbit.io/manual/administration/buffering-and-storage - # - # storage metrics - # --------------- - # publish storage pipeline metrics in '/api/v1/storage'. The metrics are - # exported only if the 'http_server' option is enabled. - # - storage.metrics on - -# Collects CS launcher and workload logs. -[INPUT] - Name systemd - Tag confidential-space-launcher - Systemd_Filter _SYSTEMD_UNIT=container-runner.service - DB /var/log/google-fluentbit/container-runner.log.db - Read_From_Tail False - -[OUTPUT] - Name stackdriver - Match * - Resource gce_instance - severity_key severity diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/hardened.conf b/vendor/github.com/google/go-tpm-tools/launcher/image/hardened.conf deleted file mode 100644 index 60baec03c..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/hardened.conf +++ /dev/null @@ -1,5 +0,0 @@ -[Service] -# hardened image should exit after workflow finished -ExecStopPost= -ExecStopPost=/bin/sleep 60 -ExecStopPost=/usr/bin/systemctl poweroff diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/preload.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/preload.sh deleted file mode 100644 index a2759d43b..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/preload.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - -readonly OEM_PATH='/usr/share/oem' -readonly CS_PATH="${OEM_PATH}/confidential_space" -readonly EXPERIMENTS_BINARY="confidential_space_experiments" - -copy_launcher() { - cp launcher "${CS_PATH}/cs_container_launcher" -} - -copy_experiment_client() { - # DownloadExpBinary creates the file at EXPERIMENTS_BINARY. - cp $EXPERIMENTS_BINARY "${CS_PATH}/${EXPERIMENTS_BINARY}" - chmod +x "${CS_PATH}/${EXPERIMENTS_BINARY}" -} - -setup_launcher_systemd_unit() { - cp container-runner.service "${CS_PATH}/container-runner.service" - cp exit_script.sh "${CS_PATH}/exit_script.sh" -} - -append_cmdline() { - local arg="$1" - if [[ ! -d /mnt/disks/efi ]]; then - mkdir /mnt/disks/efi - fi - mount /dev/sda12 /mnt/disks/efi - sed -i -e "s|cros_efi|cros_efi ${arg}|g" /mnt/disks/efi/efi/boot/grub.cfg - umount /mnt/disks/efi -} - -set_default_boot_target() { - append_cmdline "systemd.unit=$1" -} - -disable_unit() { - append_cmdline "systemd.mask=$1" -} - -enable_unit() { - append_cmdline "systemd.wants=$1" -} - -configure_entrypoint() { - cp "$1" ${OEM_PATH}/user-data - touch ${OEM_PATH}/meta-data - append_cmdline "'ds=nocloud;s=${OEM_PATH}/'" -} - -configure_necessary_systemd_units() { - # Include basic services. - enable_unit "basic.target" - - # gcr-wait-online.service is WantedBy=gcr-online.target. - # The hostname gcr.io does not resolve until systemd-resolved is enabled. - enable_unit "systemd-resolved.service" - - # Dependencies of container-runner.service. - enable_unit "network-online.target" - enable_unit "gcr-online.target" - -} - -configure_cloud_logging() { - # Copy CS-specific fluent-bit config to OEM partition. - cp fluent-bit-cs.conf "${CS_PATH}" -} - -configure_systemd_units_for_debug() { - configure_cloud_logging -} -configure_systemd_units_for_hardened() { - configure_necessary_systemd_units - configure_cloud_logging - # Make entrypoint (via cloud-init) the default unit. - set_default_boot_target "cloud-final.service" - - disable_unit "var-lib-docker.mount" - disable_unit "docker.service" - disable_unit "google-guest-agent.service" - disable_unit "google-osconfig-init.service" - disable_unit "google-osconfig-agent.service" - disable_unit "google-startup-scripts.service" - disable_unit "google-shutdown-scripts.service" - disable_unit "konlet-startup.service" - disable_unit "crash-reporter.service" - disable_unit "device_policy_manager.service" - disable_unit "node-problem-detector.service" - disable_unit "docker-events-collector-fluent-bit.service" - disable_unit "sshd.service" - disable_unit "var-lib-toolbox.mount" -} - -main() { - mount -o remount,rw ${OEM_PATH} - mkdir ${CS_PATH} - - # Install container launcher entrypoint. - configure_entrypoint "entrypoint.sh" - # Install experiment client. - copy_experiment_client - # Install container launcher. - copy_launcher - setup_launcher_systemd_unit - append_cmdline "cos.protected_stateful_partition=e" - # Increase wait timeout of the protected stateful partition. - append_cmdline "systemd.default_timeout_start_sec=900s" - - if [[ "${IMAGE_ENV}" == "debug" ]]; then - configure_systemd_units_for_debug - append_cmdline "confidential-space.hardened=false" - elif [[ "${IMAGE_ENV}" == "hardened" ]]; then - configure_systemd_units_for_hardened - append_cmdline "confidential-space.hardened=true" - else - echo "Unknown image env: ${IMAGE_ENV}." \ - "Only 'debug' and 'hardened' are supported." - exit 1 - fi -} - -main diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/README.md b/vendor/github.com/google/go-tpm-tools/launcher/image/test/README.md deleted file mode 100644 index 8fb8eacfb..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/README.md +++ /dev/null @@ -1,66 +0,0 @@ -This directory contains the image integration tests. - -# Tests -Integration tests run on [Cloud Build](https://cloud.google.com/build). -Run the test with `gcloud builds submit --config=test_{image_type}_cloudbuild.yaml` - -# Development -When writing a test, determine whether it should target the hardened image, -debug image, or both. Add it to the corresponding test `test_{image_type}_cloudbuild.yaml` -file. - -If there need to be multiple scripts, please suffix the script with the test name in each script. - -For example, testing `new_feature` might use three scripts: -`test_newfeature_initresource.sh`, `test_newfeature_validate.sh`, and `test_newfeature_cleanupresource.sh`. - -## Common Steps -Hardened and debug tests will include common steps that do test setup and cleanup activities. -They look like: - -```yaml -- name: 'gcr.io/cloud-builders/gcloud' - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh'] -``` - -* `create_vm.sh` creates a VM with the given image project, image name, and metadata. It then caches the VM name in the Cloud Build workspace. -* `cleanup.sh` deletes the VM created in create_vm.sh. -* `check_failure.sh` checks for a failure message in the status.txt file from a previous test step. This runs last due to Cloud Build exiting on previous step failures. - -## Data -`data/` contains data that will be loaded as Metadata or onto the VM directly. - -## Utils -Scripts in `util/` contain functions that can be sourced from other test scripts. - -* `read_serial.sh` contains a helper to pull the entire serial log for a VM. - -## Sharing Data Between Steps -`/workspace` is used in Cloud Build as a scratch space for specific builds. Some conventions for Confidential Space tests: - -* `/workspace/status.txt` contains the success/failure message from test steps. -`check_failure.sh` looks for a failed message in the step to determine whether -the cloud build is successful. -* `workspace/next_start.txt` is used when reading the serial logs. - -## Test Failures -Due to the sequential/only-proceed-with-success nature of Cloud Build, tests -with non-zero exit codes will cause subsequent steps to fail. This is -problematic when cleanup of a VM or other resources do not occur. - -To avoid this issue, test assertions with non-zero exit codes should shell OR (`||`) the result -and place a "Test failed" message in `/workspace/status.txt`. - -For example, `echo $SERIAL_OUTPUT | grep 'Expected output'` will fail and cancel -the rest of the Cloud Build on not finding the string "Expected output" in the -serial log. -The test writer should modify this line to do: - -```bash -echo $SERIAL_OUTPUT | grep 'Expected output' || echo 'TEST FAILED' > /workspace/status.txt -# Optionally, for debugging: -echo $SERIAL_OUTPUT > /workspace/status.txt -``` diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/check_failure.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/check_failure.sh deleted file mode 100644 index 5f4397827..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/check_failure.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail - -echo "Checking the status.txt file for test results:" -if [ -f /workspace/status.txt ]; then - cat /workspace/status.txt - if grep -qi 'failed' /workspace/status.txt; then - echo "The test failed for build $BUILD_ID." - exit 1 - else - echo "No test failure found." - exit - fi -else - echo "No status.txt file found." -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/cleanup.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/cleanup.sh deleted file mode 100644 index 06667691a..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/cleanup.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# cleanup.sh -set -euo pipefail - -if [ $CLEANUP != "true" ]; then - echo "NOT cleaning up." - exit 0 -fi -echo "Cleaning up." - -echo 'Deleting VM' $1 'in zone' $2 -gcloud compute instances delete $1 --zone $2 -q diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/create_vm.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/create_vm.sh deleted file mode 100644 index 9cc2a5752..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/create_vm.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -local OPTIND -set -euxo pipefail - -print_usage() { - echo "usage: test_launcher.sh [-i imageName] [-p projectName] [-m metadata]" - echo " -i : which image name to use for the VM" - echo " -p : which image project to use for the VM" - echo " -m : metadata variables on VM creation; passed directly into gcloud" - echo " -f : read a metadata value from a file; specified in format key=filePath" - echo " -n : instance name" - echo " -z : instance zone" - exit 1 -} - -create_vm() { - if [ -z "$IMAGE_NAME" ]; then - echo "Empty image name supplied." - exit 1 - fi - - APPEND_METADATA='' - if ! [ -z "$METADATA" ]; then - APPEND_METADATA="--metadata ${METADATA}" - fi - - APPEND_METADATA_FILE='' - if ! [ -z "$METADATA_FILE" ]; then - APPEND_METADATA_FILE="--metadata-from-file ${METADATA_FILE}" - fi - - echo 'Creating VM' ${VM_NAME} 'with image' $IMAGE_NAME - - # check the active account - gcloud auth list - - gcloud compute instances create $VM_NAME --confidential-compute --maintenance-policy=TERMINATE \ - --scopes=cloud-platform --zone $ZONE --image=$IMAGE_NAME --image-project=$PROJECT_NAME \ - --shielded-secure-boot $APPEND_METADATA $APPEND_METADATA_FILE -} - -IMAGE_NAME='' -METADATA_FILE='' -METADATA='' -PROJECT_NAME='' -VM_NAME='' -ZONE='' - -# In getopts, a ':' following a letter means that that flag takes an argument. -# For example, i: means -i takes an additional argument. -while getopts 'i:f:m:p:n:z:' flag; do - case "${flag}" in - i) IMAGE_NAME=${OPTARG} ;; - f) METADATA_FILE=${OPTARG} ;; - m) METADATA=${OPTARG} ;; - p) PROJECT_NAME=${OPTARG} ;; - n) VM_NAME=${OPTARG} ;; - z) ZONE=${OPTARG} ;; - *) print_usage ;; - esac -done - -create_vm diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/data/cloud-init-config.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/data/cloud-init-config.yaml deleted file mode 100644 index e661ad40c..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/data/cloud-init-config.yaml +++ /dev/null @@ -1,6 +0,0 @@ -#cloud-config - -# will print the string to serial console if cloud-init executed -# this config in user-data -bootcmd: - - echo "user-data in metadata executed" > /dev/ttyS0 diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/data/echo_startupscript.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/data/echo_startupscript.sh deleted file mode 100644 index 5da1a7036..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/data/echo_startupscript.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -echo "Executing startup script" -sudo chmod 666 /dev/ttyS0 -sudo echo "Executing startup script: logging to serial" > /dev/ttyS0 diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_cloud_init_userdata_disabled.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_cloud_init_userdata_disabled.sh deleted file mode 100644 index 980200e87..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_cloud_init_userdata_disabled.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_serial.sh - -echo 'Running cloud-init userdata test' - -echo 'Reading from serial port' -SERIAL_OUTPUT=$(read_serial $1 $2) - -# check whether ./data/cloud-init-config.yaml is executed, will print "user-data in metadata executed" -# in serial console if it was executed -if echo $SERIAL_OUTPUT | grep -q 'user-data in metadata executed' -then - echo 'TEST FAILED: user-data executed on the VM' - echo 'TEST FAILED.' > /workspace/status.txt -else - echo 'user-data not executed on the VM' -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_experiment_value.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_experiment_value.sh deleted file mode 100644 index 424a127c1..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_experiment_value.sh +++ /dev/null @@ -1,21 +0,0 @@ - #!/bin/bash -set -euo pipefail -source util/read_serial.sh - -# This test requires the workload to run and print -# corresponding messages to the serial console. -SERIAL_OUTPUT=$(read_serial $2 $3) -print_serial=false - -if echo $SERIAL_OUTPUT | grep -q "EnableTestFeatureForImage:$1" -then - echo "- test experiment verified $1" -else - echo "FAILED: experiment status expected to be $1" - echo "TEST FAILED. Test experiment status expected to be $1" > /workspace/status.txt - print_serial=true -fi - -if $print_serial; then - echo $SERIAL_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launcher_workload.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launcher_workload.sh deleted file mode 100644 index 2686a4422..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launcher_workload.sh +++ /dev/null @@ -1,111 +0,0 @@ - #!/bin/bash -set -euo pipefail -source util/read_serial.sh - -# This test requires the workload to run and printing -# corresponding messages to the serial console. -SERIAL_OUTPUT=$(read_serial $1 $2) -print_serial=false - -if echo $SERIAL_OUTPUT | grep -q 'Workload running' -then - echo "- workload running verified" -else - echo "FAILED: workload not running" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'Workload args: \[/main newCmd\]' -then - echo "- arguments verified" -else - echo "FAILED: arguments not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'env_bar=val_bar' -then - echo "- env_bar env var verified" -else - echo "FAILED: env_bar env not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'ALLOWED_OVERRIDE=overridden' -then - echo "- ALLOWED_OVERRIDE env var verified" -else - echo "FAILED: ALLOWED_OVERRIDE env not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'aud: https://sts.googleapis.com' -then - echo "- token aud verified" -else - echo "FAILED: token aud not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'iss: https://confidentialcomputing.googleapis.com' -then - echo "- token iss verified" -else - echo "FAILED: token iss not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'secboot: true' -then - echo "- token secboot verified" -else - echo "FAILED: token secboot not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'oemid: 11129' -then - echo "- token oemid verified" -else - echo "FAILED: token oemid not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'hwmodel: GCP_AMD_SEV' -then - echo "- token hwmodel verified" -else - echo "FAILED: token hwmodel not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'swname: GCE' -then - echo "- token swname verified" -else - echo "FAILED: token swname not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if echo $SERIAL_OUTPUT | grep -q 'Token looks okay' -then - echo "- OIDC token accessible" -else - echo "FAILED: OIDC token not accessible" - echo 'TEST FAILED.' > /workspace/status.txt - print_serial=true -fi - -if $print_serial; then - echo $SERIAL_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launcher_workload_cloudlogging.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launcher_workload_cloudlogging.sh deleted file mode 100644 index 176777111..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launcher_workload_cloudlogging.sh +++ /dev/null @@ -1,114 +0,0 @@ - #!/bin/bash -set -euo pipefail -source util/read_cloud_logging.sh - -# Allow VM some time to boot and write to cloud logging. -sleep 120 - -# This test requires the workload to run and print -# corresponding messages to cloud logging. -CLOUD_LOGGING_OUTPUT=$(read_cloud_logging $1) -print_logs=false - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'Workload running' -then - echo "- workload running verified" -else - echo "FAILED: workload not running" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'Workload args: \[/main newCmd\]' -then - echo "- arguments verified" -else - echo "FAILED: arguments not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'env_bar=val_bar' -then - echo "- env_bar env var verified" -else - echo "FAILED: env_bar env not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'ALLOWED_OVERRIDE=overridden' -then - echo "- ALLOWED_OVERRIDE env var verified" -else - echo "FAILED: ALLOWED_OVERRIDE env not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'aud: https://sts.googleapis.com' -then - echo "- token aud verified" -else - echo "FAILED: token aud not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'iss: https://confidentialcomputing.googleapis.com' -then - echo "- token iss verified" -else - echo "FAILED: token iss not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'secboot: true' -then - echo "- token secboot verified" -else - echo "FAILED: token secboot not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'oemid: 11129' -then - echo "- token oemid verified" -else - echo "FAILED: token oemid not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'hwmodel: GCP_AMD_SEV' -then - echo "- token hwmodel verified" -else - echo "FAILED: token hwmodel not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'swname: GCE' -then - echo "- token swname verified" -else - echo "FAILED: token swname not verified" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'Token looks okay' -then - echo "- OIDC token accessible" -else - echo "FAILED: OIDC token not accessible" - echo 'TEST FAILED.' > /workspace/status.txt - print_logs=true -fi - -if $print_logs; then - echo $CLOUD_LOGGING_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_cmd.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_cmd.sh deleted file mode 100644 index e4ffd1dbc..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_cmd.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_serial.sh - -# Allow VM some time to boot and write to serial console. -sleep 120 - -SERIAL_OUTPUT=$(read_serial $1 $2) -if echo $SERIAL_OUTPUT | grep -q 'CMD is not allowed to be overridden on this image' -then - echo "- CMD launch policy verified" -else - echo "FAILED: CMD launch policy verification" - echo 'TEST FAILED' > /workspace/status.txt - echo $SERIAL_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_cmd_cloudlogging.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_cmd_cloudlogging.sh deleted file mode 100644 index 544e41f6e..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_cmd_cloudlogging.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_cloud_logging.sh - -# Allow VM some time to boot and write to serial console. -sleep 120 - -CLOUD_LOGGING_OUTPUT=$(read_cloud_logging $1) -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'CMD is not allowed to be overridden on this image' -then - echo "- CMD launch policy verified" -else - echo "FAILED: CMD launch policy verification" - echo 'TEST FAILED' > /workspace/status.txt - echo $CLOUD_LOGGING_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_env.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_env.sh deleted file mode 100644 index 66f20d676..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_env.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_serial.sh - -# Allow VM some time to boot and write to serial console. -sleep 120 - -SERIAL_OUTPUT=$(read_serial $1 $2) -if echo $SERIAL_OUTPUT | grep -q --fixed-strings 'env var {OUT a} is not allowed to be overridden on this image; allowed envs to be overridden: [ALLOWED_OVERRIDE]' -then - echo "- Env launch policy verified" -else - echo "FAILED: Env launch policy verification" - echo 'TEST FAILED' > /workspace/status.txt - echo $SERIAL_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_env_cloudlogging.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_env_cloudlogging.sh deleted file mode 100644 index 0898f4193..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_env_cloudlogging.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_cloud_logging.sh - -# Allow VM some time to boot and write to cloud logging. -sleep 120 - -CLOUD_LOGGING_OUTPUT=$(read_cloud_logging $1) -if echo $CLOUD_LOGGING_OUTPUT | grep -q --fixed-strings 'env var {OUT a} is not allowed to be overridden on this image; allowed envs to be overridden: [ALLOWED_OVERRIDE]' -then - echo "- Env launch policy verified" -else - echo "FAILED: Env launch policy verification" - echo 'TEST FAILED' > /workspace/status.txt - echo $CLOUD_LOGGING_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_debug.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_debug.sh deleted file mode 100644 index df540bd9f..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_debug.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_serial.sh - -# Allow VM some time to boot and write to serial console. -sleep 120 - -SERIAL_OUTPUT=$(read_serial $1 $2) -if echo $SERIAL_OUTPUT | grep -q 'logging redirection not allowed by image' -then - echo "- Log launch policy verified" -else - echo "FAILED: Log launch policy verification" - echo 'TEST FAILED' > /workspace/status.txt - echo $SERIAL_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_debug_cloudlogging.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_debug_cloudlogging.sh deleted file mode 100644 index 2c0740c65..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_debug_cloudlogging.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_cloud_logging.sh - -# Allow VM some time to boot and write to cloud logging. -sleep 120 - -CLOUD_LOGGING_OUTPUT=$(read_cloud_logging $1) -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'logging redirection not allowed by image' -then - echo "- Log launch policy verified" -else - echo "FAILED: Log launch policy verification" - echo 'TEST FAILED' > /workspace/status.txt - echo $CLOUD_LOGGING_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_never.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_never.sh deleted file mode 100644 index df540bd9f..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_never.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_serial.sh - -# Allow VM some time to boot and write to serial console. -sleep 120 - -SERIAL_OUTPUT=$(read_serial $1 $2) -if echo $SERIAL_OUTPUT | grep -q 'logging redirection not allowed by image' -then - echo "- Log launch policy verified" -else - echo "FAILED: Log launch policy verification" - echo 'TEST FAILED' > /workspace/status.txt - echo $SERIAL_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_never_cloudlogging.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_never_cloudlogging.sh deleted file mode 100644 index 2c0740c65..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_launchpolicy_log_never_cloudlogging.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_cloud_logging.sh - -# Allow VM some time to boot and write to cloud logging. -sleep 120 - -CLOUD_LOGGING_OUTPUT=$(read_cloud_logging $1) -if echo $CLOUD_LOGGING_OUTPUT | grep -q 'logging redirection not allowed by image' -then - echo "- Log launch policy verified" -else - echo "FAILED: Log launch policy verification" - echo 'TEST FAILED' > /workspace/status.txt - echo $CLOUD_LOGGING_OUTPUT -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_log_redirect.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_log_redirect.sh deleted file mode 100644 index 3b3ac4b75..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_log_redirect.sh +++ /dev/null @@ -1,30 +0,0 @@ - #!/bin/bash -set -euxo pipefail -source util/read_serial.sh -source util/read_cloud_logging.sh - -# Allow VM some time to boot and write to serial console. -sleep 120 - -output="" -if [[ "$1" == "serial" ]]; then - echo "Reading from serial console for VM $3 in zone $4" - output=$(read_serial $3 $4) -elif [[ "$1" == "cloud_logging" ]]; then - echo "Reading from cloud logging for VM $3" - output=$(read_cloud_logging $3) -else - echo "Usage: test_log_redirect.sh " - return 1 -fi - -if [[ $output != *"Token looks okay"* ]] && [[ "$2" == "true" ]]; then - echo "FAILED: did not find workload logs in $1, but expected to:" - echo $output - echo 'TEST FAILED.' > /workspace/status.txt -elif [[ $output == *"Token looks okay"* ]] && [[ "$2" == "false" ]]; then - echo "FAILED: found workload logs in $1, but did not expect to:" - echo $output - echo 'TEST FAILED.' > /workspace/status.txt -fi - diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_mds_var_change.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_mds_var_change.sh deleted file mode 100644 index aac451e10..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_mds_var_change.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_serial.sh - -SERIAL_OUTPUT=$(read_serial $1 $2) -# Check MDS variables haven't been changed to use the wrong workload image. -if echo $SERIAL_OUTPUT | grep -v 'Hello from Cloud Run!' -then - echo "- verified changed MDS vars have no effect" -else - echo "FAILED: MDS variables changed" - echo 'TEST FAILED' > /workspace/status.txt -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_multiwriterpd_disabled.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_multiwriterpd_disabled.sh deleted file mode 100644 index 025775aa5..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_multiwriterpd_disabled.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -set -euo pipefail - -echo 'Running multi-writer PD test' - -# grep -z reads the whole input, and -v inverts matches. -from_src_image=$(gcloud beta compute disks create --image-family confidential-space --image-project confidential-space-images --multi-writer test-multi-writer-img --zone us-west1-a 2>&1 || true) -if echo "$from_src_image" | grep -vz 'Cannot create a multi-writer disk from a source image'; then - echo "$from_src_image" - echo 'Multi-writer PD creation from image source enabled.' - echo 'TEST FAILED.' > /workspace/status.txt -fi - -DISK_NAME="source-boot-disk-$BUILD_ID" -echo "Creating PD $DISK_NAME" -gcloud compute disks create --image-family confidential-space --image-project confidential-space-images $DISK_NAME --zone us-west1-a - -from_src_disk=$(gcloud beta compute disks create test-multi-writer-disk --source-disk=$DISK_NAME --multi-writer --zone us-west1-a 2>&1 || true) -# Cleanup disk before seeing test result. -gcloud compute disks delete $DISK_NAME -q --zone us-west1-a -if echo "$from_src_disk" | grep -vz 'Cannot create a multi-writer disk from a source disk'; then - echo "$from_src_disk" - echo 'Multi-writer PD creation from boot disk source enabled.' - echo 'TEST FAILED.' > /workspace/status.txt -fi diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_os_config_os_policy.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_os_config_os_policy.sh deleted file mode 100644 index 655147d16..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_os_config_os_policy.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -set -euo pipefail - -if $1 == 'debug' -then - echo 'Running OS Config OS Policy enabled test' -else - echo 'Running OS Config OS Policy disabled test' -fi - -cat <> shutdown-ospolicy.yaml -osPolicies: - - id: shutdown-policy - mode: ENFORCEMENT - resourceGroups: - - resources: - id: shutdown-vm - exec: - validate: - interpreter: SHELL - script: if true; then sudo shutdown now; else exit 101; fi - enforce: - interpreter: SHELL - script: exit 100 -instanceFilter: - inclusionLabels: - - labels: - shutdown-label: $2 -rollout: - disruptionBudget: - percent: 100 - minWaitDuration: 1s -EOT - -gcloud compute instances add-labels $2 --labels=shutdown-label=$2 --zone=$3 || true -GCLOUD_OUTPUT=$(gcloud compute os-config os-policy-assignments create shutdown-policy --location=$3 --file=shutdown-ospolicy.yaml | tail -1 || true) - -if echo $GCLOUD_OUTPUT | grep -q 'Created OS policy assignment [shutdown-policy]' -then - GCLOUD_OUTPUT=$(gcloud compute instances describe $2 --zone=$3 --format="value(status)" || true) -else - echo 'TEST FAILED: OS policy assignment could not be created' - echo 'TEST FAILED.' > /workspace/status.txt - exit 1 -fi - -if $1 == 'debug' -then - if echo $GCLOUD_OUTPUT | grep -q 'TERMINATED' - then - echo 'Success: OS policy assignment stops the VM' - else - echo 'TEST FAILED: VM did not terminate' - echo 'TEST FAILED.' > /workspace/status.txt - fi -else - if echo $GCLOUD_OUTPUT | grep -q 'TERMINATED' - then - echo 'TEST FAILED: VM incorrectly terminated' - echo 'TEST FAILED.' > /workspace/status.txt - else - echo 'Success: OS policy assignment does not affect VM' - fi -fi - -gcloud compute os-config os-policy-assignments delete shutdown-policy --location=$3 --quiet || true diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_ssh_manual.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_ssh_manual.sh deleted file mode 100755 index 452b6a456..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_ssh_manual.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -set -euxo pipefail - -print_usage() { - echo "usage: test_ssh_manual.sh [-i imageName] [-p imageProject]" - echo " -i : which image name to use for the VM" - echo " -p : which image project to use for the VM" - exit 1 -} - -run_ssh_test() { - BUILD_ID=$(date +%s) - HOME_DIR=$(echo ~) - VM_NAME="cs-ssh-test-$BUILD_ID" - WORKLOAD_IMAGE='us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest' - ZONE="us-central1-a" - - ACCOUNT_NAME=$(gcloud config list account --format "value(core.account)" | tr @. _) - PROJECT_NAME=$(gcloud config get-value project) - - # Create a new VM - source create_vm.sh -n $VM_NAME -i $IMAGE_NAME -p $IMAGE_PROJECT -m tee-image-reference=$WORKLOAD_IMAGE,tee-container-log-redirect=true,enable-osconfig=TRUE -z $ZONE - - # Add an SSH public key to an OS Login profile - gcloud compute os-login ssh-keys add --key-file=$HOME_DIR/.ssh/google_compute_engine.pub || true - - echo "Sleeping so settings have time to propagate." - sleep 30 - - # SSH into VM with script - if [[ $IMAGE_NAME == *"debug"* ]]; then - if ssh -i ~/.ssh/google_compute_engine -o StrictHostKeyChecking=no $ACCOUNT_NAME@nic0.$VM_NAME.$ZONE.c.$PROJECT_NAME.internal.gcpnode.com "echo 'SSHABLE'; exit" ; then - echo "Success: SSH to host was successful" - sed -i '$ d' ~/.ssh/known_hosts - else - echo "TEST FAILED: SSH to host was ussuccessful" - fi - else - if ssh -i ~/.ssh/google_compute_engine -o StrictHostKeyChecking=no $ACCOUNT_NAME@nic0.$VM_NAME.$ZONE.c.$PROJECT_NAME.internal.gcpnode.com "echo 'SSHABLE'; exit" ; then - echo "TEST FAILED: SSH to host was successful" - sed -i '$ d' ~/.ssh/known_hosts - else - echo "Success: SSH to host was ussuccessful" - fi - fi - - - # Clean up - CLEANUP=true - source cleanup.sh $VM_NAME $ZONE -} - -IMAGE_NAME='' -IMAGE_PROJECT='' - -# In getopts, a ':' following a letter means that that flag takes an argument. -# For example, i: means -i takes an additional argument. -while getopts 'i:p:' flag; do - case "${flag}" in - i) IMAGE_NAME=${OPTARG} ;; - p) IMAGE_PROJECT=${OPTARG} ;; - *) print_usage ;; - esac -done - -if [ -z "$IMAGE_NAME" ]; then - echo "Empty image name supplied." - exit 1 -fi - -if [ -z "$IMAGE_PROJECT" ]; then - echo "Empty image project supplied." - exit 1 -fi - -run_ssh_test diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_startupscript_disabled.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_startupscript_disabled.sh deleted file mode 100644 index fcdf27d79..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/scripts/test_startupscript_disabled.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -euo pipefail -source util/read_serial.sh - -echo 'Running startup script test' - -echo 'Reading from serial port:' -SERIAL_OUTPUT=$(read_serial $1 $2) -echo $SERIAL_OUTPUT - -# Without the or logic, this step will fail and cleanup does not run. -# Instead, we put the test assertion output in /workspace/status.txt. -echo $SERIAL_OUTPUT | grep -v 'Executing startup script' || echo 'TEST FAILED' > /workspace/status.txt diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_debug_cloudbuild.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_debug_cloudbuild.yaml deleted file mode 100644 index 0bfe1201a..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_debug_cloudbuild.yaml +++ /dev/null @@ -1,58 +0,0 @@ -substitutions: - '_IMAGE_NAME': '' - '_IMAGE_PROJECT': '' - '_CLEANUP': 'true' - '_VM_NAME_PREFIX': 'cs-debug-test' - '_ZONE': 'us-central1-a' - '_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest,tee-cmd=["newCmd"],tee-env-ALLOWED_OVERRIDE=overridden' -steps: -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVM - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=true', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}', - '-z', '${_ZONE}', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: BasicWorkloadTest - entrypoint: 'bash' - args: ['scripts/test_launcher_workload.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: BasicWorkloadTestCloudLogging - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_launcher_workload_cloudlogging.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: ChangeMDSVariables - entrypoint: 'bash' - args: ['util/change_metadata_vars.sh', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}', - '-z', '${_ZONE}', - '-m', 'tee-image-reference=gcr.io/cloudrun/hello:latest', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: ChangeMDSVariablesTest - entrypoint: 'bash' - args: ['scripts/test_mds_var_change.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUp - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -# Must come after cleanup. -- name: 'gcr.io/cloud-builders/gcloud' - id: CheckFailure - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['check_failure.sh'] - -options: - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_debug_unstable_cloudbuild.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_debug_unstable_cloudbuild.yaml deleted file mode 100644 index fd0bf9a4c..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_debug_unstable_cloudbuild.yaml +++ /dev/null @@ -1,40 +0,0 @@ -substitutions: - '_IMAGE_NAME': '' - '_IMAGE_PROJECT': '' - '_CLEANUP': 'true' - '_VM_NAME_PREFIX': 'cs-debug-test' - '_ZONE': 'us-central1-a' - '_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest' -steps: -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVM - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=true,tee-cmd=["newCmd"],tee-env-ALLOWED_OVERRIDE=overridden,enable-osconfig=TRUE', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}', - '-z', '${_ZONE}', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: OsConfigOsPolicyEnabledTest - entrypoint: 'bash' - args: ['scripts/test_os_config_os_policy.sh', 'debug', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUp - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -# Must come after cleanup. -- name: 'gcr.io/cloud-builders/gcloud' - id: CheckFailure - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['check_failure.sh'] - -options: - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_experiments_client.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_experiments_client.yaml deleted file mode 100644 index 6c620cd30..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_experiments_client.yaml +++ /dev/null @@ -1,40 +0,0 @@ -substitutions: - '_IMAGE_NAME': '' - '_IMAGE_PROJECT': '' - '_CLEANUP': 'true' - '_VM_NAME_PREFIX': 'cs-experiments-test' - '_ZONE': 'us-central1-a' - '_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest' -steps: -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVM - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=true', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}', - '-z', '${_ZONE}', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: TestExperimentTrue - entrypoint: 'bash' - args: ['scripts/test_experiment_value.sh', "true", '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUp - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -# Must come after cleanup. -- name: 'gcr.io/cloud-builders/gcloud' - id: CheckFailure - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['check_failure.sh'] - -options: - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_hardened_cloudbuild.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_hardened_cloudbuild.yaml deleted file mode 100644 index 04871de71..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_hardened_cloudbuild.yaml +++ /dev/null @@ -1,77 +0,0 @@ -substitutions: - # Expects hardened image (not debug) and should have startup-script service - # disabled. google-startup-scripts.service is only enabled with multi-user.target. - '_IMAGE_NAME': '' - '_IMAGE_PROJECT': '' - # Add user-data in the metadata to test if it is disabled. - '_METADATA_FILE': 'startup-script=data/echo_startupscript.sh,user-data=data/cloud-init-config.yaml' - '_CLEANUP': 'true' - '_VM_NAME_PREFIX': 'cs-hardened-test' - '_ZONE': 'us-central1-a' - '_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest' -steps: -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVM - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-f', '${_METADATA_FILE}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=true,tee-cmd=["newCmd"],tee-env-ALLOWED_OVERRIDE=overridden', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}', - '-z', '${_ZONE}', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: BasicWorkloadTest - entrypoint: 'bash' - args: ['scripts/test_launcher_workload.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: BasicWorkloadTestCloudLogging - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_launcher_workload_cloudlogging.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: ChangeMDSVariables - entrypoint: 'bash' - args: ['util/change_metadata_vars.sh', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}', - '-z', '${_ZONE}', - '-m', 'tee-image-reference=gcr.io/cloudrun/hello:latest', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: ChangeMDSVariablesTest - entrypoint: 'bash' - args: ['scripts/test_mds_var_change.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: MultiWriterPDTest - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['scripts/test_multiwriterpd_disabled.sh'] -- name: 'gcr.io/cloud-builders/gcloud' - id: StartupScriptDisabledTest - entrypoint: 'bash' - args: ['scripts/test_startupscript_disabled.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CloudInitUserDataDisabledTest - entrypoint: 'bash' - args: ['scripts/test_cloud_init_userdata_disabled.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUp - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -# Must come after cleanup. -- name: 'gcr.io/cloud-builders/gcloud' - id: CheckFailure - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['check_failure.sh'] - -options: - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_hardened_unstable_cloudbuild.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_hardened_unstable_cloudbuild.yaml deleted file mode 100644 index 49ad31c72..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_hardened_unstable_cloudbuild.yaml +++ /dev/null @@ -1,40 +0,0 @@ -substitutions: - '_IMAGE_NAME': '' - '_IMAGE_PROJECT': '' - '_CLEANUP': 'true' - '_VM_NAME_PREFIX': 'cs-hardened-test' - '_ZONE': 'us-central1-a' - '_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest' -steps: -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVM - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=true,tee-cmd=["newCmd"],tee-env-ALLOWED_OVERRIDE=overridden,enable-osconfig=TRUE', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}', - '-z', '${_ZONE}', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: OsConfigOsPolicyDisabledTest - entrypoint: 'bash' - args: ['scripts/test_os_config_os_policy.sh', 'hardened', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUp - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}'] -# Must come after cleanup. -- name: 'gcr.io/cloud-builders/gcloud' - id: CheckFailure - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['check_failure.sh'] - -options: - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_ingress_network.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_ingress_network.yaml deleted file mode 100644 index 4410165d9..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_ingress_network.yaml +++ /dev/null @@ -1,67 +0,0 @@ -# This test needs to be run in a private Cloud Build pool, so the Cloud Build instance -# can be in the same network as the test VM. -substitutions: - '_IMAGE_NAME': '' - '_IMAGE_PROJECT': '' - '_CLEANUP': 'true' - '_ZONE': 'us-central1-a' - '_WORKLOAD_IMAGE': 'docker.io/library/nginx:latest' - -steps: - - name: 'gcr.io/cloud-builders/gcloud' - id: CreateServerWorkload - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE}', - '-n', 'ingress-network-test-${BUILD_ID}', - '-z', '${_ZONE}', - ] - - - name: 'gcr.io/cloud-builders/gcloud' - id: CheckReachability - waitFor: ['CreateServerWorkload'] - entrypoint: 'bash' - args: - - -c - - | - echo "sleeping 200s, waiting for workload server to setup..." - sleep 200 - internalIP=$(gcloud -q compute instances describe ingress-network-test-${BUILD_ID} --zone=${_ZONE} --format='get(networkInterfaces[0].networkIP)') - echo "workload internal IP: "${internalIP} - - # try to connect to the nginx server - response=$(curl -v ${internalIP}:80) - echo "got response [${response}]" - - # check nginx default response - if [[ "${response}" == *"Welcome to nginx!"* ]]; - then - echo "workload reachable through the internal network" - else - echo "FAILED: workload not reachable through the internal network" - echo 'TEST FAILED' > /workspace/status.txt - fi - - - name: 'gcr.io/cloud-builders/gcloud' - id: CleanUp - waitFor: ['CheckReachability'] - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', 'ingress-network-test-${BUILD_ID}', '${_ZONE}'] - - # Must come after cleanup. - - name: 'gcr.io/cloud-builders/gcloud' - id: CheckFailure - waitFor: ['CleanUp'] - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['check_failure.sh'] - -options: - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_launchpolicy_cloudbuild.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_launchpolicy_cloudbuild.yaml deleted file mode 100644 index f741c3158..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_launchpolicy_cloudbuild.yaml +++ /dev/null @@ -1,154 +0,0 @@ -substitutions: - '_HARDENED_IMAGE_NAME': '' - '_IMAGE_PROJECT': '' - # Add user-data in the metadata to test if it is disabled. - '_METADATA_FILE': 'startup-script=data/echo_startupscript.sh,user-data=data/cloud-init-config.yaml' - '_CLEANUP': 'true' - '_VM_NAME_PREFIX': 'cs-launchpolicy-test' - '_ZONE': 'us-central1-a' - '_WORKLOAD_IMAGE_LOG_NEVER': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/launchpolicylognever:latest' - '_WORKLOAD_IMAGE_LOG_DEBUG': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/launchpolicylogdebug:latest' - '_WORKLOAD_IMAGE_ENV': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest' - '_WORKLOAD_IMAGE_CMD': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/launchpolicycmd:latest' -steps: -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVMLogOverride - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_HARDENED_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-f', '${_METADATA_FILE}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE_LOG_NEVER},tee-container-log-redirect=true', - '-n', '${_VM_NAME_PREFIX}-log-${BUILD_ID}', - '-z', '${_ZONE}', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogOverrideTest - entrypoint: 'bash' - args: ['scripts/test_launchpolicy_log_never.sh', '${_VM_NAME_PREFIX}-log-${BUILD_ID}', '${_ZONE}'] - waitFor: ['CreateVMLogOverride'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogOverrideTestCloudLogging - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_launchpolicy_log_never_cloudlogging.sh', '${_VM_NAME_PREFIX}-log-${BUILD_ID}'] - waitFor: ['CreateVMLogOverride'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUpLogOverride - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-log-${BUILD_ID}', '${_ZONE}'] - waitFor: ['LogOverrideTest', 'LogOverrideTestCloudLogging'] - -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVMLogOverrideDebug - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_HARDENED_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-f', '${_METADATA_FILE}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE_LOG_DEBUG},tee-container-log-redirect=true', - '-n', '${_VM_NAME_PREFIX}-log-${BUILD_ID}', - '-z', '${_ZONE}', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogOverrideDebugTest - entrypoint: 'bash' - args: ['scripts/test_launchpolicy_log_debug.sh', '${_VM_NAME_PREFIX}-log-${BUILD_ID}', '${_ZONE}'] - waitFor: ['CreateVMLogOverrideDebug'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogOverrideDebugTestCloudLogging - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_launchpolicy_log_debug_cloudlogging.sh', '${_VM_NAME_PREFIX}-log-${BUILD_ID}'] - waitFor: ['CreateVMLogOverrideDebug'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUpLogOverrideDebug - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-log-${BUILD_ID}', '${_ZONE}'] - waitFor: ['LogOverrideDebugTest', 'LogOverrideDebugTestCloudLogging'] - -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVMEnvOverride - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_HARDENED_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-f', '${_METADATA_FILE}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE_ENV},tee-env-OUT=a', - '-n', '${_VM_NAME_PREFIX}-env-${BUILD_ID}', - '-z', '${_ZONE}', - ] - waitFor: ['-'] # The '-' indicates that this step begins immediately. -- name: 'gcr.io/cloud-builders/gcloud' - id: EnvOverrideTest - entrypoint: 'bash' - args: ['scripts/test_launchpolicy_env.sh', '${_VM_NAME_PREFIX}-env-${BUILD_ID}', '${_ZONE}'] - waitFor: ['CreateVMEnvOverride'] -- name: 'gcr.io/cloud-builders/gcloud' - id: EnvOverrideTestCloudLogging - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_launchpolicy_env_cloudlogging.sh', '${_VM_NAME_PREFIX}-env-${BUILD_ID}'] - waitFor: ['CreateVMEnvOverride'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUpEnvOverride - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-env-${BUILD_ID}', '${_ZONE}'] - waitFor: ['EnvOverrideTest', 'EnvOverrideTestCloudLogging'] - -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVMCmdOverride - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_HARDENED_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-f', '${_METADATA_FILE}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE_CMD},tee-cmd=["newCmd"]', - '-n', '${_VM_NAME_PREFIX}-cmd-${BUILD_ID}', - '-z', '${_ZONE}', - ] - waitFor: ['-'] # The '-' indicates that this step begins immediately. -- name: 'gcr.io/cloud-builders/gcloud' - id: CmdOverrideTest - entrypoint: 'bash' - args: ['scripts/test_launchpolicy_cmd.sh', '${_VM_NAME_PREFIX}-cmd-${BUILD_ID}', '${_ZONE}'] - waitFor: ['CreateVMCmdOverride'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CmdOverrideTestCloudLogging - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_launchpolicy_cmd_cloudlogging.sh', '${_VM_NAME_PREFIX}-cmd-${BUILD_ID}'] - waitFor: ['CreateVMCmdOverride'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUpCmdOverride - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-cmd-${BUILD_ID}', '${_ZONE}'] - waitFor: ['CmdOverrideTest', 'CmdOverrideTestCloudLogging'] - -# Must come after cleanup. -- name: 'gcr.io/cloud-builders/gcloud' - id: CheckFailure - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['check_failure.sh'] - -options: - pool: - name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_log_redirection.yaml b/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_log_redirection.yaml deleted file mode 100644 index 64ad5a974..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/test_log_redirection.yaml +++ /dev/null @@ -1,143 +0,0 @@ -substitutions: - '_HARDENED_IMAGE_NAME': '' - '_IMAGE_PROJECT': '' - '_CLEANUP': 'true' - '_VM_NAME_PREFIX': 'cs-logredirect-test' - '_ZONE': 'us-central1-a' - '_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic_test:latest' - -steps: -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVMRedirectAll - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_HARDENED_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=true', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}-all', - '-z', '${_ZONE}', - ] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogAllCheckSerialTest - entrypoint: 'bash' - args: ['scripts/test_log_redirect.sh', 'serial', 'true', '${_VM_NAME_PREFIX}-${BUILD_ID}-all', '${_ZONE}'] - waitFor: ['CreateVMRedirectAll'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogAllCheckCloudLoggingTest - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_log_redirect.sh', 'cloud_logging', 'true', '${_VM_NAME_PREFIX}-${BUILD_ID}-all', '${_ZONE}'] - waitFor: ['CreateVMRedirectAll'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUpLogAllTest - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}-all', '${_ZONE}'] - waitFor: ['LogAllCheckSerialTest', 'LogAllCheckCloudLoggingTest'] - -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVMRedirectSerial - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_HARDENED_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=serial', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}-serial', - '-z', '${_ZONE}', - ] - waitFor: ['-'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogSerialCheckSerialTest - entrypoint: 'bash' - args: ['scripts/test_log_redirect.sh', 'serial', 'true', '${_VM_NAME_PREFIX}-${BUILD_ID}-serial', '${_ZONE}'] - waitFor: ['CreateVMRedirectSerial'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogSerialCheckCloudLoggingTest - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_log_redirect.sh', 'cloud_logging', 'false', '${_VM_NAME_PREFIX}-${BUILD_ID}-serial', '${_ZONE}'] - waitFor: ['CreateVMRedirectSerial'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUpLogSerialTest - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}-serial', '${_ZONE}'] - waitFor: ['LogSerialCheckCloudLoggingTest', 'LogSerialCheckCloudLoggingTest'] - -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVMRedirectCloudLogging - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_HARDENED_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=cloud_logging', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}-clog', - '-z', '${_ZONE}', - ] - waitFor: ['-'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogCloudLoggingCheckSerialTest - entrypoint: 'bash' - args: ['scripts/test_log_redirect.sh', 'serial', 'false', '${_VM_NAME_PREFIX}-${BUILD_ID}-clog', '${_ZONE}'] - waitFor: ['CreateVMRedirectCloudLogging'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogCloudLoggingCheckCloudLoggingTest - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_log_redirect.sh', 'cloud_logging', 'true', '${_VM_NAME_PREFIX}-${BUILD_ID}-clog', '${_ZONE}'] - waitFor: ['CreateVMRedirectCloudLogging'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUpLogCloudLoggingTest - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}-clog', '${_ZONE}'] - waitFor: ['LogCloudLoggingCheckSerialTest', 'LogCloudLoggingCheckCloudLoggingTest'] - -- name: 'gcr.io/cloud-builders/gcloud' - id: CreateVMRedirectNone - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['create_vm.sh','-i', '${_HARDENED_IMAGE_NAME}', - '-p', '${_IMAGE_PROJECT}', - '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=false', - '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}-none', - '-z', '${_ZONE}', - ] - waitFor: ['-'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogNoneCheckSerialTest - entrypoint: 'bash' - args: ['scripts/test_log_redirect.sh', 'serial', 'false', '${_VM_NAME_PREFIX}-${BUILD_ID}-none', '${_ZONE}'] - waitFor: ['CreateVMRedirectNone'] -- name: 'gcr.io/cloud-builders/gcloud' - id: LogNoneCheckCloudLoggingTest - entrypoint: 'bash' - env: - - 'PROJECT_ID=$PROJECT_ID' - args: ['scripts/test_log_redirect.sh', 'cloud_logging', 'false', '${_VM_NAME_PREFIX}-${BUILD_ID}-none', '${_ZONE}'] - waitFor: ['CreateVMRedirectNone'] -- name: 'gcr.io/cloud-builders/gcloud' - id: CleanUpLogNoneTest - entrypoint: 'bash' - env: - - 'CLEANUP=$_CLEANUP' - args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}-none', '${_ZONE}'] - waitFor: ['LogNoneCheckSerialTest', 'LogNoneCheckCloudLoggingTest'] - -# Must come after cleanup. -- name: 'gcr.io/cloud-builders/gcloud' - id: CheckFailure - entrypoint: 'bash' - env: - - 'BUILD_ID=$BUILD_ID' - args: ['check_failure.sh'] diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/change_metadata_vars.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/change_metadata_vars.sh deleted file mode 100755 index 048015a0d..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/change_metadata_vars.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -set -euxo pipefail - -print_usage() { - echo "usage: change_metadata_vars.sh -n instanceName -z instanceZone [-m metadata] [-f metadataFromFile]" - echo " -m : metadata variables on VM creation; passed directly into gcloud" - echo " -f : read a metadata value from a file; specified in format key=filePath" - echo " -n : instance name" - echo " -z : instance zone" - exit 1 -} - -update_metadata() { - if [ -z "${VM_NAME}" ]; then - echo "Empty VM name supplied." - exit 1 - fi - - if [ -z "${ZONE}" ]; then - echo "Empty zone supplied." - exit 1 - fi - APPEND_ZONE="--zone ${ZONE}" - - if [ -z "${METADATA}${METADATA_FILE}" ]; then - echo "Empty metadata supplied." - exit 1 - fi - - APPEND_METADATA='' - if ! [ -z "${METADATA}" ]; then - APPEND_METADATA="--metadata ${METADATA}" - fi - - APPEND_METADATA_FILE='' - if ! [ -z "${METADATA_FILE}" ]; then - APPEND_METADATA_FILE="--metadata-from-file ${METADATA_FILE}" - fi - - echo "Updating VM ${VM_NAME} in ${ZONE} with metadata: ${METADATA_FILE} ${METADATA}" - - # check the active account - gcloud auth list - - gcloud compute instances add-metadata $VM_NAME \ - $APPEND_ZONE $APPEND_METADATA $APPEND_METADATA_FILE -} - -METADATA_FILE='' -METADATA='' -VM_NAME='' -ZONE='' - -# In getopts, a ':' following a letter means that that flag takes an argument. -# For example, i: means -i takes an additional argument. -while getopts 'f:m:n:z:' flag; do - case "${flag}" in - f) METADATA_FILE=${OPTARG} ;; - m) METADATA=${OPTARG} ;; - n) VM_NAME=${OPTARG} ;; - z) ZONE=${OPTARG} ;; - *) print_usage ;; - esac -done - -update_metadata diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/read_cloud_logging.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/read_cloud_logging.sh deleted file mode 100644 index d4a6defb0..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/read_cloud_logging.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# read_cloud_logging reads the cloud logging of a test VM. It reads the logs for 1 day. -# It assumes the PROJECT_ID environment variable is set. -# Use var=$(read_cloud_logging ) to capture the output of this command into a variable. -read_cloud_logging() { - gcloud logging read "resource.type=\"gce_instance\" jsonPayload._HOSTNAME=\"$1\" -log_name=\"projects/$PROJECT_ID/logs/confidential-space-launcher\"" \ ---format="value(jsonPayload.MESSAGE)" --order asc -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/read_serial.sh b/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/read_serial.sh deleted file mode 100644 index 80f05ec91..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/test/util/read_serial.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# read_serial attempts to read the serial output until the workload is finished -# Use var=$(read_serial ) to capture the output of this command into a variable. -read_serial() { - local base_cmd='gcloud compute instances get-serial-port-output $1 --zone $2 2>/workspace/next_start.txt' - local serial_out=$(eval ${base_cmd}) - local last='' - - # timeout after 10 min - timeout="10 minute" - endtime=$(date -ud "$timeout" +%s) - - echo "Reading serial console..." - while [ -s /workspace/next_start.txt ]; do - if [[ $(date -u +%s) -ge $endtime ]]; then - echo "timed out reading serial console" - break - fi - - next=$(cat /workspace/next_start.txt | sed -n 2p | cut -d ' ' -f2) - local next_cmd="${base_cmd} ${next}" - - # sleeping 5s for the next serial console read" - sleep 5 - - local tmp=$(eval ${next_cmd}) - serial_out="$serial_out $tmp" - - # break the loop if the workload is finished - if echo ${serial_out} | grep -qi "TEE container launcher exiting"; then - break - fi - - last=$next - done - - echo $serial_out -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/basic/Dockerfile b/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/basic/Dockerfile deleted file mode 100644 index 3c6ac5765..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/basic/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# From current directory: -# GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main . -# gcloud builds submit --tag us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic_test:latest -FROM alpine - -COPY main / - -ENV env_bar="val_bar" - -LABEL "tee.launch_policy.allow_env_override"="ALLOWED_OVERRIDE" -LABEL "tee.launch_policy.allow_cmd_override"="true" -LABEL "tee.launch_policy.log_redirect"="always" - -ENTRYPOINT ["/main"] - -# Can be overridden because of the launch policy. -CMD ["arg_foo"] diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/basic/main.go b/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/basic/main.go deleted file mode 100644 index 024f71cb8..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/basic/main.go +++ /dev/null @@ -1,46 +0,0 @@ -// package main is a binary that will print out the MDS vars and check the token. -package main - -import ( - "fmt" - "os" - - "github.com/golang-jwt/jwt/v4" -) - -const tokendir = "/run/container_launcher/attestation_verifier_claims_token" - -func main() { - fmt.Println("Workload running") - fmt.Println("Workload args:", os.Args) - fmt.Println("Workload env vars:") - for _, e := range os.Environ() { - fmt.Println(e) - } - - filedata, err := os.ReadFile(tokendir) - if err != nil { - fmt.Println(err) - return - } - - token, _, err := new(jwt.Parser).ParseUnverified(string(filedata), jwt.MapClaims{}) - if err != nil { - fmt.Println(err) - return - } - - claims, ok := token.Claims.(jwt.MapClaims) - if !ok { - fmt.Println(err) - return - } - fmt.Println("aud: ", claims["aud"]) - fmt.Println("iss: ", claims["iss"]) - fmt.Println("secboot: ", claims["secboot"]) - fmt.Println("oemid: ", claims["oemid"]) - fmt.Println("hwmodel: ", claims["hwmodel"]) - fmt.Println("swname: ", claims["swname"]) - - fmt.Println("Token looks okay") -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicycmd/Dockerfile b/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicycmd/Dockerfile deleted file mode 100644 index 4dda35340..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicycmd/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -# From current directory: -# GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main ../basic -# gcloud builds submit --tag us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/launchpolicycmd:latest --project confidential-space-images-dev -FROM alpine - -COPY main / - -ENV env_bar="val_bar" - -LABEL "tee.launch_policy.log_redirect"="always" - -ENTRYPOINT ["/main"] - -CMD ["arg_foo"] diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicylogdebug/Dockerfile b/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicylogdebug/Dockerfile deleted file mode 100644 index c01e0fe69..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicylogdebug/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -# From current directory: -# GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main ../basic -# gcloud builds submit --tag us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/launchpolicylogdebug:latest --project confidential-space-images-dev -FROM alpine - -COPY main / - -ENV env_bar="val_bar" - -LABEL "tee.launch_policy.log_redirect"="never" - -ENTRYPOINT ["/main"] - -CMD ["arg_foo"] diff --git a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicylognever/Dockerfile b/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicylognever/Dockerfile deleted file mode 100644 index 0058083e6..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/image/testworkloads/launchpolicylognever/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -# From current directory: -# GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main ../basic -# gcloud builds submit --tag us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/launchpolicylognever:latest --project confidential-space-images-dev -FROM alpine - -COPY main / - -ENV env_bar="val_bar" - -LABEL "tee.launch_policy.log_redirect"="never" - -ENTRYPOINT ["/main"] - -CMD ["arg_foo"] diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/experiments/experiments.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/experiments/experiments.go deleted file mode 100644 index 1d6aec365..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/experiments/experiments.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package experiments contains functionalities to retrieve synced experiments -package experiments - -import ( - "encoding/json" - "fmt" - "os" -) - -// Experiments contains the experiments flags this version of the launcher expects to receive. -// Failure to unmarshal the experiment JSON data will result in an empty object being returned -// to treat experiment flags as their default value. The error should still be checked. -type Experiments struct { - EnableTestFeatureForImage bool - EnableSignedContainerImage bool -} - -// New takes a filepath, opens the file, and calls ReadJsonInput with the contents -// of the file. -// If the file cannot be opened, the experiments map is set to an empty map. -func New(fpath string) (Experiments, error) { - f, err := os.ReadFile(fpath) - if err != nil { - // Return default values on failure. - return Experiments{}, err - } - - r, err := readJSONInput(f) - - return r, err -} - -// ReadJSONInput takes a reader and unmarshals the contents into the experiments map. -// If the unmarsahlling fails, the experiments map is set to an empty map. -func readJSONInput(b []byte) (Experiments, error) { - var experiments Experiments - if err := json.Unmarshal(b, &experiments); err != nil { - // Return default values on failure. - return Experiments{}, fmt.Errorf("failed to unmarshal json: %w", err) - } - return experiments, nil -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/experiments/experiments_test.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/experiments/experiments_test.go deleted file mode 100644 index 656353a08..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/experiments/experiments_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package experiments - -import ( - "testing" -) - -func TestExperiments(t *testing.T) { - tests := []struct { - input string - }{ - {input: "{\"EnableTestFeatureForImage\":true,\"EnableSignedContainerImage\":true}"}, - {input: "{\"EnableTestFeatureForImage\":true,\"EnableSignedContainerImage\":true,\"FloatFeature\":-5.6,\"OtherTestFeatureForImage\":false}"}, - } - - for i, test := range tests { - e, err := readJSONInput([]byte(test.input)) - - if err != nil { - t.Errorf("testcase %d: failed to create experiments object: %v", i, err) - } - - if e.EnableTestFeatureForImage == false { - t.Errorf("testcase %d: expected EnableTestFeatureForImage to be true, got false", i) - } - - if e.EnableSignedContainerImage == false { - t.Errorf("testcase %d: expected EnableSignedContainerImage to be true, got false", i) - } - } -} - -func TestExperimentsBadJson(t *testing.T) { - tests := []struct { - input string - }{ - {input: "{\"EnableTestFeatureForImage\":true,\"EnableSignedContainerImage\":true"}, - {input: "{}"}, - {input: ""}, - } - - for i, test := range tests { - e, _ := readJSONInput([]byte(test.input)) - - if e.EnableTestFeatureForImage == true { - t.Errorf("testcase %d: expected EnableTestFeatureForImage to be false, got true", i) - } - - if e.EnableSignedContainerImage == true { - t.Errorf("testcase %d: expected EnableSignedContainerImage to be false, got true", i) - } - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/fakesignature.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/fakesignature.go deleted file mode 100644 index db16a4ec2..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/fakesignature.go +++ /dev/null @@ -1,43 +0,0 @@ -package cosign - -import ( - "encoding/base64" - "fmt" - - "github.com/google/go-tpm-tools/launcher/internal/oci" -) - -type fakeSig struct { - data string - sigAlg oci.SigningAlgorithm -} - -// NewFakeSignature constructs a new fake oci.Signature given data and signature algorithm. -func NewFakeSignature(data string, sigAlg oci.SigningAlgorithm) oci.Signature { - return &fakeSig{data, sigAlg} -} - -// Payload returns a fake payload. -func (f fakeSig) Payload() ([]byte, error) { - return []byte(f.data), nil -} - -// Base64Encoded returns a fake base64 encoded signature. -func (f fakeSig) Base64Encoded() (string, error) { - return base64.StdEncoding.EncodeToString([]byte(f.data)), nil -} - -// PublicKey returns a fake public key. -func (f fakeSig) PublicKey() ([]byte, error) { - return []byte(f.data), nil -} - -// SigningAlgorithm returns a fake signature algorithm. -func (f fakeSig) SigningAlgorithm() (oci.SigningAlgorithm, error) { - switch f.sigAlg { - case oci.ECDSAP256SHA256, oci.RSASSAPKCS1V152048SHA256, oci.RSASSAPSS2048SHA256: - return f.sigAlg, nil - default: - return "", fmt.Errorf("unsupported signing algorithm: %v", f.sigAlg) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/signature.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/signature.go deleted file mode 100644 index 91f59dd7b..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/signature.go +++ /dev/null @@ -1,81 +0,0 @@ -// Package cosign contains functionalities to interact with signatures generated by cosign. -// https://github.com/sigstore/cosign/blob/main/specs/SIGNATURE_SPEC.md. -package cosign - -import ( - "encoding/base64" - "errors" - "fmt" - - "github.com/google/go-tpm-tools/launcher/internal/oci" - "github.com/opencontainers/go-digest" - v1 "github.com/opencontainers/image-spec/specs-go/v1" -) - -// Sig implements oci.Signature interface for cosign-generated signatures. -type Sig struct { - // Layer represents a layer descriptor for OCI image manifest. - // This contains the simple signing payload digest and Cosign signature, - // collected from the OCI image manifest object found using https://github.com/sigstore/cosign/blob/main/specs/SIGNATURE_SPEC.md#tag-based-discovery. - Layer v1.Descriptor - // Blob represents the opaque data uploaded to OCI registry associated with the layer. - // This contains the Simple Signing Payload as described in https://github.com/sigstore/cosign/blob/main/specs/SIGNATURE_SPEC.md#tag-based-discovery. - Blob []byte - // SourceRepo represents the location that stores this signature. - SourceRepo string -} - -// CosignSigKey is the key of the cosign-generated signature embedded in OCI image manifest. -const CosignSigKey = "dev.cosignproject.cosign/signature" - -var ( - // Verify that our Sig struct implements the expected public interface. - _ oci.Signature = Sig{} - encoding = base64.StdEncoding -) - -// Payload implements oci.Signature interface. -func (s Sig) Payload() ([]byte, error) { - // The payload bytes are uploaded to an OCI registry as blob, and are referenced by digest. - // This digiest is embedded into the OCI image manifest as a layer via a descriptor (see https://github.com/opencontainers/image-spec/blob/main/descriptor.md). - // Here we compare the digest of the blob data with the layer digest to verify if this blob is associated with the layer. - if digest.FromBytes(s.Blob) != s.Layer.Digest { - return nil, errors.New("an unmatched payload digest is paired with a layer descriptor digest") - } - return s.Blob, nil -} - -// Base64Encoded implements oci.Signature interface. -func (s Sig) Base64Encoded() (string, error) { - sig, ok := s.Layer.Annotations[CosignSigKey] - if !ok { - return "", errors.New("cosign signature not found in the layer annotations") - } - if _, err := encoding.DecodeString(sig); err != nil { - return "", fmt.Errorf("invalid base64 encoded signature: %w", err) - } - return sig, nil -} - -// PublicKey implements oci.Signature interface. -// Since public key is attached to the `optional` field of payload, we don't actually implement this method. -// Instead we send payload directly to the Attestation service and let the service parse the payload. -func (s Sig) PublicKey() ([]byte, error) { - return nil, fmt.Errorf("not implemented") -} - -// SigningAlgorithm implements oci.Signature interface. -// Since signing algorithm is attached to the `optional` field of payload, we don't actually implement this method. -// Instead we send payload directly to the Attestation service and let the service parse the payload. -func (s Sig) SigningAlgorithm() (oci.SigningAlgorithm, error) { - return "", fmt.Errorf("not implemented") -} - -// String returns signature details -func (s Sig) String() string { - sig, err := s.Base64Encoded() - if err != nil { - return fmt.Sprintf("[signature error: %s]", err.Error()) - } - return fmt.Sprintf("[signature: %q, sourceRepo: %q]", sig, s.SourceRepo) -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/signature_test.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/signature_test.go deleted file mode 100644 index 399d503fa..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/cosign/signature_test.go +++ /dev/null @@ -1,180 +0,0 @@ -package cosign - -import ( - "bytes" - "crypto/rand" - "strings" - "testing" - - "github.com/opencontainers/go-digest" - v1 "github.com/opencontainers/image-spec/specs-go/v1" -) - -func TestPayload(t *testing.T) { - testCases := []struct { - name string - blob []byte - wantDigest digest.Digest - wantPayload []byte - wantPass bool - }{ - { - name: "cosign signature Payload() success", - blob: []byte(`{"critical":{"identity":{"docker-reference":"us-docker.pkg.dev/confidential-space-images-dev/cs-cosign-tests/base"},"image":{"docker-manifest-digest":"sha256:9494e567c7c44e8b9f8808c1658a47c9b7979ef3cceef10f48754fc2706802ba"},"type":"cosign container image signature"},"optional":null}`), - wantDigest: "sha256:d1e44a76902409836227b982beb920189949927c2011f196594bd34c5bb8f8b1", - wantPayload: []byte(`{"critical":{"identity":{"docker-reference":"us-docker.pkg.dev/confidential-space-images-dev/cs-cosign-tests/base"},"image":{"docker-manifest-digest":"sha256:9494e567c7c44e8b9f8808c1658a47c9b7979ef3cceef10f48754fc2706802ba"},"type":"cosign container image signature"},"optional":null}`), - wantPass: true, - }, - { - name: "cosign signature Payload() failed with unmatched digest", - blob: []byte(`{"critical":{"identity":{"docker-reference":"us-docker.pkg.dev/confidential-space-images-dev/cs-cosign-tests/base"},"image":{"docker-manifest-digest":"sha256:9494e567c7c44e8b9f8808c1658a47c9b7979ef3cceef10f48754fc2706802ba"},"type":"cosign container image signature"},"optional":null}`), - wantDigest: "sha256:unmatched digest", - wantPayload: []byte{}, - wantPass: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - sig := &Sig{ - Layer: v1.Descriptor{ - Digest: tc.wantDigest, - }, - Blob: tc.blob, - } - gotPayload, err := sig.Payload() - if err != nil && tc.wantPass { - t.Errorf("Payload() failed for test case %v: %v", tc.name, err) - } - if !bytes.Equal(gotPayload, tc.wantPayload) { - t.Errorf("Payload() failed for test case %v: got %v, but want %v", tc.name, gotPayload, tc.wantPayload) - } - }) - } -} - -func TestBase64Encoded(t *testing.T) { - testCases := []struct { - name string - wantSignatureKey string - wantSignature string - wantPass bool - }{ - { - name: "cosign signature Base64Encoded() success", - wantSignatureKey: CosignSigKey, - wantSignature: randomBase64EncodedString(32), - wantPass: true, - }, - { - name: "cosign signature Base64Encoded() failed with mismatched signature key", - wantSignatureKey: "mismatched signature key", - wantSignature: "", - wantPass: false, - }, - { - name: "cosign signature Base64Encoded() failed with invalid base64 encoded signature", - wantSignatureKey: CosignSigKey, - wantSignature: "", - wantPass: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - sig := &Sig{ - Layer: v1.Descriptor{ - Annotations: map[string]string{ - tc.wantSignatureKey: tc.wantSignature, - }, - }, - } - gotSignature, err := sig.Base64Encoded() - if err != nil && tc.wantPass { - t.Errorf("Base64Encoded() failed for test case %v: %v", tc.name, err) - } - if gotSignature != tc.wantSignature { - t.Errorf("Base64Encoded() failed for test case %v: got %v, but want %v", tc.name, gotSignature, tc.wantSignature) - } - }) - } -} - -func TestWorkflow(t *testing.T) { - wantSig := randomBase64EncodedString(32) - blob := []byte(`{"critical":{"identity":{"docker-reference":"us-docker.pkg.dev/confidential-space-images-dev/cs-cosign-tests/base"},"image":{"docker-manifest-digest":"sha256:9494e567c7c44e8b9f8808c1658a47c9b7979ef3cceef10f48754fc2706802ba"},"type":"cosign container image signature"},"optional":null}`) - - sig := &Sig{ - Layer: v1.Descriptor{ - Digest: digest.FromBytes(blob), - Annotations: map[string]string{ - CosignSigKey: wantSig, - }, - }, - Blob: blob, - } - - gotPayload, err := sig.Payload() - if err != nil { - t.Errorf("Payload() failed: %v", err) - } - if !bytes.Equal(gotPayload, blob) { - t.Errorf("Payload() failed: got %v, but want %v", gotPayload, blob) - } - - gotSig, err := sig.Base64Encoded() - if err != nil { - t.Errorf("Base64Encoded() failed: %v", err) - } - if gotSig != wantSig { - t.Errorf("Base64Encoded() failed, got %s, but want %s", gotSig, wantSig) - } -} - -func TestString(t *testing.T) { - testCases := []struct { - name string - sourceRepo string - b64Sig string - wantString string - }{ - { - name: "successful signature details", - sourceRepo: "gcr.io/hello_world", - b64Sig: "aGVsbG8gd29ybGQ=", // base64 encoded "hello world" - wantString: `signature: "aGVsbG8gd29ybGQ=", sourceRepo: "gcr.io/hello_world"`, - }, - { - name: "erronous signature details", - sourceRepo: "gcr.io/hello_world", - b64Sig: "invalid", - wantString: `signature error: invalid base64 encoded signature`, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - sig := &Sig{ - Layer: v1.Descriptor{ - Annotations: map[string]string{ - CosignSigKey: tc.b64Sig, - }, - }, - SourceRepo: tc.sourceRepo, - } - gotString := sig.String() - if !strings.Contains(gotString, tc.wantString) { - t.Errorf("String() failed, got %s, but want %s", gotString, tc.wantString) - } - }) - } -} - -func randomBase64EncodedString(n int) string { - b := make([]byte, n) - _, err := rand.Read(b) - if err != nil { - return "" - } - return encoding.EncodeToString(b) -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/interface.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/interface.go deleted file mode 100644 index 064a73ef5..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/oci/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -// Package oci contains functionalities to interact with OCI image signatures. -// https://github.com/opencontainers/image-spec/tree/main#readme. -package oci - -// SigningAlgorithm is a specific type for string constants used for sigature signing and verification. -type SigningAlgorithm string - -const ( - // RSASSAPSS2048SHA256 is RSASSA-PSS 2048 bit key with a SHA256 digest supported for cosign sign. - RSASSAPSS2048SHA256 SigningAlgorithm = "RSASSA_PSS_SHA256" - // RSASSAPSS3072SHA256 is RSASSA-PSS 3072 bit key with a SHA256 digest supported for cosign sign. - RSASSAPSS3072SHA256 SigningAlgorithm = "RSASSA_PSS_SHA256" - // RSASSAPSS4096SHA256 is RSASSA-PSS 4096 bit key with a SHA256 digest supported for cosign sign. - RSASSAPSS4096SHA256 SigningAlgorithm = "RSASSA_PSS_SHA256" - // RSASSAPKCS1V152048SHA256 is RSASSA-PKCS1 v1.5 2048 bit key with a SHA256 digest supported for cosign sign. - RSASSAPKCS1V152048SHA256 SigningAlgorithm = "RSASSA_PKCS1V15_SHA256" - // RSASSAPKCS1V153072SHA256 is RSASSA-PKCS1 v1.5 3072 bit key with a SHA256 digest supported for cosign sign. - RSASSAPKCS1V153072SHA256 SigningAlgorithm = "RSASSA_PKCS1V15_SHA256" - // RSASSAPKCS1V154096SHA256 is RSASSA-PKCS1 v1.5 4096 bit key with a SHA256 digest supported for cosign sign. - RSASSAPKCS1V154096SHA256 SigningAlgorithm = "RSASSA_PKCS1V15_SHA256" - // ECDSAP256SHA256 is ECDSA on the P-256 Curve with a SHA256 digest supported for cosign sign. - ECDSAP256SHA256 SigningAlgorithm = "ECDSA_P256_SHA256" -) - -// Signature represents a single OCI image signature. -type Signature interface { - // Payload returns the blob data associated with a signature uploaded to an OCI registry. - Payload() ([]byte, error) - - // Base64Encoded returns the base64-encoded signature of the signed payload. - Base64Encoded() (string, error) - - // PublicKey returns a public key in the format of PEM-encoded byte slice. - PublicKey() ([]byte, error) - - // SigningAlgorithm returns the signing algorithm specifications in the format of: - // 1. RSASSAPSS2048SHA256 (RSASSA algorithm with PSS padding 2048 bit key with a SHA256 digest) - // 2. RSASSAPSS3072SHA256 (RSASSA algorithm with PSS padding 3072 bit key with a SHA256 digest) - // 3. RSASSAPSS4096SHA256 (RSASSA algorithm with PSS padding 4096 bit key with a SHA256 digest) - // 4. RSASSAPKCS1V152048SHA256 (RSASSA algorithm with PKCS #1 v1.5 padding 2048 bit key with a SHA256 digest) - // 5. RSASSAPKCS1V153072SHA256 (RSASSA algorithm with PKCS #1 v1.5 padding 3072 bit key with a SHA256 digest) - // 6. RSASSAPKCS1V154096SHA256 (RSASSA algorithm with PKCS #1 v1.5 padding 4096 bit key with a SHA256 digest) - // 7. ECDSAP256SHA256 (ECDSA on the P-256 Curve with a SHA256 digest) - SigningAlgorithm() (SigningAlgorithm, error) -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/client.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/client.go deleted file mode 100644 index 0e9cdb8ea..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/client.go +++ /dev/null @@ -1,97 +0,0 @@ -// Package signaturediscovery contains functionalities to discover container image signatures. -package signaturediscovery - -import ( - "context" - "fmt" - - "github.com/containerd/containerd" - "github.com/containerd/containerd/content" - "github.com/containerd/containerd/images" - "github.com/google/go-tpm-tools/launcher/internal/oci" - "github.com/google/go-tpm-tools/launcher/internal/oci/cosign" - v1 "github.com/opencontainers/image-spec/specs-go/v1" -) - -const signatureTagSuffix = "sig" - -// Fetcher discovers and fetches OCI signatures from the target repository. -type Fetcher interface { - FetchImageSignatures(ctx context.Context, targetRepository string) ([]oci.Signature, error) -} - -// Client is a wrapper of containerd.Client to interact with signed image manifest. -type Client struct { - cdClient *containerd.Client - OriginalImageDesc v1.Descriptor - RemoteOpts []containerd.RemoteOpt -} - -// New creates a new client that implements Fetcher interface. -func New(cdClient *containerd.Client, originalImageDesc v1.Descriptor, opts ...containerd.RemoteOpt) Fetcher { - return &Client{ - cdClient: cdClient, - OriginalImageDesc: originalImageDesc, - RemoteOpts: opts, - } -} - -// FetchSignedImageManifest fetches a signed image manifest using a tag-based discovery mechanism. -func (c *Client) FetchSignedImageManifest(ctx context.Context, targetRepository string) (v1.Manifest, error) { - image, err := c.pullTargetImage(ctx, targetRepository) - if err != nil { - return v1.Manifest{}, err - } - return getManifest(ctx, image) -} - -// FetchImageSignatures returns a list of valid image signatures associated with the target OCI image. -func (c *Client) FetchImageSignatures(ctx context.Context, targetRepository string) ([]oci.Signature, error) { - image, err := c.pullTargetImage(ctx, targetRepository) - if err != nil { - return nil, err - } - manifest, err := getManifest(ctx, image) - if err != nil { - return nil, err - } - signatures := make([]oci.Signature, 0, len(manifest.Layers)) - for _, layer := range manifest.Layers { - blob, err := content.ReadBlob(ctx, image.ContentStore(), layer) - if err != nil { - return nil, err - } - sig := &cosign.Sig{ - Layer: layer, - Blob: blob, - SourceRepo: targetRepository, - } - signatures = append(signatures, sig) - } - return signatures, nil -} - -func (c *Client) pullTargetImage(ctx context.Context, targetRepository string) (containerd.Image, error) { - targetImageRef := fmt.Sprint(targetRepository, ":", formatSigTag(c.OriginalImageDesc)) - image, err := c.cdClient.Pull(ctx, targetImageRef, c.RemoteOpts...) - if err != nil { - return nil, fmt.Errorf("cannot pull the signature object [%s] from target repository [%s]: %w", targetImageRef, targetRepository, err) - } - return image, nil -} - -// formatSigTag turns image digests into tags with signatureTagSuffix: -// sha256:9ecc53c2 -> sha256-9ecc53c2.sig -func formatSigTag(imageDesc v1.Descriptor) string { - digest := imageDesc.Digest - return fmt.Sprint(digest.Algorithm(), "-", digest.Encoded(), ".", signatureTagSuffix) -} - -func getManifest(ctx context.Context, image containerd.Image) (v1.Manifest, error) { - cs := image.ContentStore() - manifest, err := images.Manifest(ctx, cs, image.Target(), image.Platform()) - if err != nil { - return v1.Manifest{}, err - } - return manifest, nil -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/client_test.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/client_test.go deleted file mode 100644 index fe740de4a..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/client_test.go +++ /dev/null @@ -1,106 +0,0 @@ -package signaturediscovery - -import ( - "context" - "testing" - - "github.com/containerd/containerd" - "github.com/containerd/containerd/defaults" - "github.com/containerd/containerd/namespaces" - "github.com/google/go-cmp/cmp" - v1 "github.com/opencontainers/image-spec/specs-go/v1" -) - -func TestFormatSigTag(t *testing.T) { - testCases := []struct { - name string - imageDesc v1.Descriptor - wantSigTag string - wantPass bool - }{ - { - name: "formatSigTag success", - imageDesc: v1.Descriptor{Digest: "sha256:9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f"}, - wantSigTag: "sha256-9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f.sig", - wantPass: true, - }, - { - name: "formatSigTag failed with wrong image digest", - imageDesc: v1.Descriptor{Digest: "sha256:9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f"}, - wantSigTag: "sha256-18740b995b4eac1b5706392a96ff8c4f30cefac18772058a71449692f1581f0f.sig", - wantPass: false, - }, - { - name: "formatSigTag failed with wrong tag format", - imageDesc: v1.Descriptor{Digest: "sha256:9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f"}, - wantSigTag: "sha256@9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f.sig", - wantPass: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - if got := formatSigTag(tc.imageDesc) == tc.wantSigTag; got != tc.wantPass { - t.Errorf("formatSigTag() failed for test case %v: got %v, wantPass %v", tc.name, got, tc.wantPass) - } - }) - } -} - -func TestFetchSignedImageManifestDockerPublic(t *testing.T) { - ctx := namespaces.WithNamespace(context.Background(), "test") - - targetRepository := "gcr.io/distroless/static" - originalImageDesc := v1.Descriptor{Digest: "sha256:9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f"} - client := createTestClient(t, originalImageDesc) - // testing image manifest fetching using a public docker repo url - if _, err := client.FetchSignedImageManifest(ctx, targetRepository); err != nil { - t.Errorf("failed to fetch signed image manifest from targetRepository [%s]: %v", targetRepository, err) - } -} - -func TestFetchImageSignaturesDockerPublic(t *testing.T) { - ctx := namespaces.WithNamespace(context.Background(), "test") - originalImageDesc := v1.Descriptor{Digest: "sha256:905a0f3b3d6d0fb37bfa448b9e78f833b73f0b19fc97fed821a09cf49e255df1"} - targetRepository := "us-docker.pkg.dev/vegas-codelab-5/cosign-test/base" - - client := createTestClient(t, originalImageDesc) - signatures, err := client.FetchImageSignatures(ctx, targetRepository) - if err != nil { - t.Errorf("failed to fetch image signatures from targetRepository [%s]: %v", targetRepository, err) - } - if len(signatures) == 0 { - t.Errorf("no image signatures found for the original image %v", originalImageDesc) - } - var gotBase64Sigs []string - for _, sig := range signatures { - if _, err := sig.Payload(); err != nil { - t.Errorf("Payload() failed: %v", err) - } - base64Sig, err := sig.Base64Encoded() - if err != nil { - t.Errorf("Base64Encoded() failed: %v", err) - } - gotBase64Sigs = append(gotBase64Sigs, base64Sig) - } - - // Check signatures from the OCI image manifest at https://pantheon.corp.google.com/artifacts/docker/vegas-codelab-5/us/cosign-test/base/sha256:1febaa6ac3a5c095435d5276755fb8efcb7f029fefe85cd9bf3ec7de91685b9f;tab=manifest?project=vegas-codelab-5. - wantBase64Sigs := []string{"MEUCIQDgoiwMiVl1SAI1iePhH6Oeqztms3IwNtN+w0P92HTqQgIgKjJNcHEy0Ep4g4MH1Vd0gAHvbwH9ahD+jlnMP/rXSGE="} - if !cmp.Equal(gotBase64Sigs, wantBase64Sigs) { - t.Errorf("signatures did not return expected base64 signatures, got %v, want %v", gotBase64Sigs, wantBase64Sigs) - } -} - -func createTestClient(t *testing.T, originalImageDesc v1.Descriptor) *Client { - t.Helper() - - containerdClient, err := containerd.New(defaults.DefaultAddress) - if err != nil { - t.Skipf("test needs containerd daemon: %v", err) - } - t.Cleanup(func() { containerdClient.Close() }) - return &Client{ - cdClient: containerdClient, - OriginalImageDesc: originalImageDesc, - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/fakeclient.go b/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/fakeclient.go deleted file mode 100644 index 6d9b4da89..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/internal/signaturediscovery/fakeclient.go +++ /dev/null @@ -1,54 +0,0 @@ -package signaturediscovery - -import ( - "context" - "fmt" - - "github.com/google/go-tpm-tools/launcher/internal/oci" - "github.com/google/go-tpm-tools/launcher/internal/oci/cosign" -) - -const ( - // FakeRepoWithSignatures represents an OCI registry with container image signatures for testing. - FakeRepoWithSignatures = "repo with signatures" - // FakeRepoWithNoSignatures represents an OCI registry with no container image signatures for testing. - FakeRepoWithNoSignatures = "repo with no signatures" - // FakeNonExistRepo represents a non-exist OCI registry for testing. - FakeNonExistRepo = "nonexist repo" - // FakeRepoWithAllInvalidSignatures represents an OCI registry with all invalid container image signatures for testing. - FakeRepoWithAllInvalidSignatures = "repo with all invalid signatures" - // FakeRepoWithPartialValidSignatures represents an OCI registry with parital valid container image signatures for testing. - FakeRepoWithPartialValidSignatures = "repo with parital valid signatures" -) - -type fakeClient struct{} - -// NewFakeClient constructs a new fake signature discovery client. -func NewFakeClient() Fetcher { - return &fakeClient{} -} - -// FetchImageSignatures returns hardcoded signatures based on the given target repository. -func (f *fakeClient) FetchImageSignatures(_ context.Context, targetRepository string) ([]oci.Signature, error) { - switch targetRepository { - case FakeRepoWithSignatures: - return []oci.Signature{ - cosign.NewFakeSignature("test data", oci.ECDSAP256SHA256), - cosign.NewFakeSignature("hello world", oci.RSASSAPKCS1V152048SHA256), - }, nil - case FakeRepoWithNoSignatures, FakeNonExistRepo: - return nil, fmt.Errorf("cannot fetch the signature object from target repository [%s]", targetRepository) - case FakeRepoWithAllInvalidSignatures: - return []oci.Signature{ - cosign.NewFakeSignature("invalid signature", "unsupported"), - cosign.NewFakeSignature("invalid signature", "unsupported"), - }, nil - case FakeRepoWithPartialValidSignatures: - return []oci.Signature{ - cosign.NewFakeSignature("test data", oci.ECDSAP256SHA256), - cosign.NewFakeSignature("invalid signature", "unsupported"), - }, nil - default: - return []oci.Signature{}, nil - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/launcher/main.go b/vendor/github.com/google/go-tpm-tools/launcher/launcher/main.go deleted file mode 100644 index 6c798446a..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/launcher/main.go +++ /dev/null @@ -1,253 +0,0 @@ -// package main is a program that will start a container with attestation. -package main - -import ( - "context" - "errors" - "fmt" - "io" - "log" - "os" - "os/exec" - "path" - "regexp" - "strings" - - "cloud.google.com/go/compute/metadata" - "github.com/containerd/containerd" - "github.com/containerd/containerd/defaults" - "github.com/containerd/containerd/namespaces" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/launcher" - "github.com/google/go-tpm-tools/launcher/internal/experiments" - "github.com/google/go-tpm-tools/launcher/launcherfile" - "github.com/google/go-tpm-tools/launcher/spec" - "github.com/google/go-tpm/legacy/tpm2" -) - -const ( - successRC = 0 // workload successful (no reboot) - failRC = 1 // workload or launcher internal failed (no reboot) - // panic() returns 2 - rebootRC = 3 // reboot - holdRC = 4 // hold - // experimentDataFile defines where the experiment sync output data is expected to be. - experimentDataFile = "experiment_data" - // binaryPath contains the path to the experiments binary. - binaryPath = "/usr/share/oem/confidential_space/confidential_space_experiments" -) - -var rcMessage = map[int]string{ - successRC: "workload finished successfully, shutting down the VM", - failRC: "workload or launcher error, shutting down the VM", - rebootRC: "rebooting VM", - holdRC: "VM remains running", -} - -var logger *log.Logger -var mdsClient *metadata.Client - -func main() { - var exitCode int - var err error - - logger = log.Default() - // log.Default() outputs to stderr; change to stdout. - log.SetOutput(os.Stdout) - serialConsole, err := os.OpenFile("/dev/console", os.O_WRONLY, 0) - if err != nil { - log.Fatalf("failed to open serial console for writing: %v", err) - } - defer serialConsole.Close() - logger.SetOutput(io.MultiWriter(os.Stdout, serialConsole)) - - logger.Println("TEE container launcher initiating") - - if err := verifyFsAndMount(); err != nil { - logger.Print(err) - exitCode = rebootRC - return - } - - // Get RestartPolicy and IsHardened from spec - mdsClient = metadata.NewClient(nil) - launchSpec, err := spec.GetLaunchSpec(mdsClient) - if err != nil { - logger.Println(err) - // if cannot get launchSpec, exit directly - exitCode = failRC - return - } - - if err := os.MkdirAll(launcherfile.HostTmpPath, 0744); err != nil { - logger.Printf("failed to create %s: %v", launcherfile.HostTmpPath, err) - } - experimentsFile := path.Join(launcherfile.HostTmpPath, experimentDataFile) - - args := fmt.Sprintf("-output=%s", experimentsFile) - err = exec.Command(binaryPath, args).Run() - if err != nil { - logger.Printf("failure during experiment sync: %v\n", err) - } - - e, err := experiments.New(experimentsFile) - if err != nil { - logger.Printf("failed to read experiment file: %v\n", err) - // do not fail if experiment retrieval fails - } - launchSpec.Experiments = e - - defer func() { - // Catch panic to attempt to output to Cloud Logging. - if r := recover(); r != nil { - logger.Println("Panic:", r) - exitCode = 2 - } - msg, ok := rcMessage[exitCode] - if ok { - logger.Printf("TEE container launcher exiting with exit code: %d (%s)\n", exitCode, msg) - } else { - logger.Printf("TEE container launcher exiting with exit code: %d\n", exitCode) - } - }() - if err = startLauncher(launchSpec, serialConsole); err != nil { - logger.Println(err) - } - - exitCode = getExitCode(launchSpec.Hardened, launchSpec.RestartPolicy, err) -} - -func getExitCode(isHardened bool, restartPolicy spec.RestartPolicy, err error) int { - exitCode := 0 - - // if in a debug image, will always hold - if !isHardened { - return holdRC - } - - if err != nil { - switch err.(type) { - default: - // non-retryable error - exitCode = failRC - case *launcher.RetryableError, *launcher.WorkloadError: - if restartPolicy == spec.Always || restartPolicy == spec.OnFailure { - exitCode = rebootRC - } else { - exitCode = failRC - } - } - } else { - // if no error - if restartPolicy == spec.Always { - exitCode = rebootRC - } else { - exitCode = successRC - } - } - - return exitCode -} - -func startLauncher(launchSpec spec.LaunchSpec, serialConsole *os.File) error { - logger.Printf("Launch Spec: %+v\n", launchSpec) - containerdClient, err := containerd.New(defaults.DefaultAddress) - if err != nil { - return &launcher.RetryableError{Err: err} - } - defer containerdClient.Close() - - tpm, err := tpm2.OpenTPM("/dev/tpmrm0") - if err != nil { - return &launcher.RetryableError{Err: err} - } - defer tpm.Close() - - // check AK (EK signing) cert - gceAk, err := client.GceAttestationKeyECC(tpm) - if err != nil { - return err - } - if gceAk.Cert() == nil { - return errors.New("failed to find AKCert on this VM: try creating a new VM or contacting support") - } - gceAk.Close() - - token, err := launcher.RetrieveAuthToken(mdsClient) - if err != nil { - logger.Printf("failed to retrieve auth token: %v, using empty auth for image pulling\n", err) - } - - ctx := namespaces.WithNamespace(context.Background(), namespaces.Default) - r, err := launcher.NewRunner(ctx, containerdClient, token, launchSpec, mdsClient, tpm, logger, serialConsole) - if err != nil { - return err - } - defer r.Close(ctx) - - return r.Run(ctx) -} - -// verifyFsAndMount checks the partitions/mounts are as expected, based on the command output reported by OS. -// These checks are not security guarantee. -func verifyFsAndMount() error { - // check protected_stateful_partition is encrypted and is on integrity protection - cryptsetupOutput, err := exec.Command("cryptsetup", "status", "/dev/mapper/protected_stateful_partition").Output() - if err != nil { - return err - } - matched := regexp.MustCompile(`type:\s+LUKS2`).FindString(string(cryptsetupOutput)) - if len(matched) == 0 { - return fmt.Errorf("stateful partition is not LUKS2 formatted: \n%s", cryptsetupOutput) - } - matched = regexp.MustCompile(`integrity:\s+aead`).FindString(string(cryptsetupOutput)) - if len(matched) == 0 { - return fmt.Errorf("stateful partition is not integrity protected: \n%s", cryptsetupOutput) - } - matched = regexp.MustCompile(`cipher:\s+aes-gcm-random`).FindString(string(cryptsetupOutput)) - if len(matched) == 0 { - return fmt.Errorf("stateful partition is not using the aes-gcm-random cipher: \n%s", cryptsetupOutput) - } - - // make sure /var/lib/containerd is on protected_stateful_partition - findmountOutput, err := exec.Command("findmnt", "/dev/mapper/protected_stateful_partition").Output() - if err != nil { - return err - } - matched = regexp.MustCompile(`/var/lib/containerd\s+/dev/mapper/protected_stateful_partition\[/var/lib/containerd\]\s+ext4\s+rw,nosuid,nodev,relatime,commit=30`).FindString(string(findmountOutput)) - if len(matched) == 0 { - return fmt.Errorf("/var/lib/containerd was not mounted on the protected_stateful_partition: \n%s", findmountOutput) - } - matched = regexp.MustCompile(`/var/lib/google\s+/dev/mapper/protected_stateful_partition\[/var/lib/google\]\s+ext4\s+rw,nosuid,nodev,relatime,commit=30`).FindString(string(findmountOutput)) - if len(matched) == 0 { - return fmt.Errorf("/var/lib/google was not mounted on the protected_stateful_partition: \n%s", findmountOutput) - } - - // check /tmp is on tmpfs - findmntOutput, err := exec.Command("findmnt", "tmpfs").Output() - if err != nil { - return err - } - matched = regexp.MustCompile(`/tmp\s+tmpfs\s+tmpfs`).FindString(string(findmntOutput)) - if len(matched) == 0 { - return fmt.Errorf("/tmp was not mounted on the tmpfs: \n%s", findmntOutput) - } - - // check verity status on vroot and oemroot - cryptSetupOutput, err := exec.Command("cryptsetup", "status", "vroot").Output() - if err != nil { - return err - } - if !strings.Contains(string(cryptSetupOutput), "/dev/mapper/vroot is active and is in use.") { - return fmt.Errorf("/dev/mapper/vroot was not mounted correctly: \n%s", cryptSetupOutput) - } - cryptSetupOutput, err = exec.Command("cryptsetup", "status", "oemroot").Output() - if err != nil { - return err - } - if !strings.Contains(string(cryptSetupOutput), "/dev/mapper/oemroot is active and is in use.") { - return fmt.Errorf("/dev/mapper/oemroot was not mounted correctly: \n%s", cryptSetupOutput) - } - - return nil -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/launcher/main_test.go b/vendor/github.com/google/go-tpm-tools/launcher/launcher/main_test.go deleted file mode 100644 index 8e28022c4..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/launcher/main_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package main - -import ( - "errors" - "testing" - - "github.com/google/go-tpm-tools/launcher" - "github.com/google/go-tpm-tools/launcher/spec" -) - -func TestGetExitCode(t *testing.T) { - testcases := []struct { - name string - isHardened bool - restartPolicy spec.RestartPolicy - err error - expectedReturnCode int - }{ - // no error, debug image - { - "debug, always restart, nil error", - false, spec.Always, nil, holdRC, - }, - { - "debug, never restart, nil error", - false, spec.Never, nil, holdRC, - }, - { - "debug, onfailure restart, nil error", - false, spec.OnFailure, nil, holdRC, - }, - // no error, hardened image - { - "hardened, always restart, nil error", - true, spec.Always, nil, rebootRC, - }, - { - "hardened, never restart, nil error", - true, spec.Never, nil, successRC, - }, - { - "hardened, onfailure restart, nil error", - true, spec.OnFailure, nil, successRC, - }, - // retryable error, debug image - { - "debug, always restart, retryable error", - false, spec.Always, &launcher.RetryableError{}, holdRC, - }, - { - "debug, never restart, retryable error", - false, spec.Never, &launcher.RetryableError{}, holdRC, - }, - { - "debug, onfailure restart, retryable error", - false, spec.OnFailure, &launcher.RetryableError{}, holdRC, - }, - // workload error, debug image (same as retryable error) - { - "debug, always restart, workload error", - false, spec.Always, &launcher.WorkloadError{}, holdRC, - }, - { - "debug, never restart, workload error", - false, spec.Never, &launcher.WorkloadError{}, holdRC, - }, - { - "debug, onfailure restart, workload error", - false, spec.OnFailure, &launcher.WorkloadError{}, holdRC, - }, - // retryable error, hardened image - { - "hardened, always restart, retryable error", - true, spec.Always, &launcher.RetryableError{}, rebootRC, - }, - { - "hardened, never restart, retryable error", - true, spec.Never, &launcher.RetryableError{}, failRC, - }, - { - "hardened, onfailure restart, retryable error", - true, spec.OnFailure, &launcher.RetryableError{}, rebootRC, - }, - // workload error, hardened image (same as retryable error) - { - "hardened, always restart, workload error", - true, spec.Always, &launcher.WorkloadError{}, rebootRC, - }, - { - "hardened, never restart, workload error", - true, spec.Never, &launcher.WorkloadError{}, failRC, - }, - { - "hardened, onfailure restart, workload error", - true, spec.OnFailure, &launcher.WorkloadError{}, rebootRC, - }, - // non-retryable error, debug image - { - "debug, always restart, non-retryable error", - false, spec.Always, errors.New(""), holdRC, - }, - { - "debug, never restart, non-retryable error", - false, spec.Never, errors.New(""), holdRC, - }, - { - "debug, onfailure restart, non-retryable error", - false, spec.OnFailure, errors.New(""), holdRC, - }, - // non-retryable error, hardened image - { - "hardened, always restart, non-retryable error", - true, spec.Always, errors.New(""), failRC, - }, - { - "hardened, never restart, non-retryable error", - true, spec.Never, errors.New(""), failRC, - }, - { - "hardened, onfailure restart, non-retryable error", - true, spec.OnFailure, errors.New(""), failRC, - }, - } - - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - if rc := getExitCode(tc.isHardened, tc.restartPolicy, tc.err); rc != tc.expectedReturnCode { - t.Errorf("got %d, wanted %d", rc, tc.expectedReturnCode) - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/launcherfile/launcherfile.go b/vendor/github.com/google/go-tpm-tools/launcher/launcherfile/launcherfile.go deleted file mode 100644 index 0e9fee600..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/launcherfile/launcherfile.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package launcherfile contains functions and constants for interacting with -// launcher files. -package launcherfile - -const ( - // HostTmpPath defined the directory in the host that will store attestation tokens - HostTmpPath = "/tmp/container_launcher/" - // ContainerRuntimeMountPath defined the directory in the container stores attestation tokens - ContainerRuntimeMountPath = "/run/container_launcher/" - // AttestationVerifierTokenFilename defines the name of the file the attestation token is stored in. - AttestationVerifierTokenFilename = "attestation_verifier_claims_token" -) diff --git a/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_policy.go b/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_policy.go deleted file mode 100644 index da53fd10c..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_policy.go +++ /dev/null @@ -1,109 +0,0 @@ -package spec - -import ( - "fmt" - "strconv" - "strings" -) - -// LaunchPolicy contains policies on starting the container. -// The policy comes from the labels of the image. -type LaunchPolicy struct { - AllowedEnvOverride []string - AllowedCmdOverride bool - AllowedLogRedirect logRedirectPolicy -} - -type logRedirectPolicy int - -const ( - debugOnly logRedirectPolicy = iota - always - never -) - -func toLogRedirectPolicy(s string) (logRedirectPolicy, error) { - s = strings.ToLower(s) - s = strings.TrimSpace(s) - - if s == "always" { - return always, nil - } - if s == "never" { - return never, nil - } - if s == "debugonly" { - return debugOnly, nil - } - return 0, fmt.Errorf("not a valid LogRedirectPolicy %s (must be one of [always, never, debugonly])", s) -} - -const ( - envOverride = "tee.launch_policy.allow_env_override" - cmdOverride = "tee.launch_policy.allow_cmd_override" - logRedirect = "tee.launch_policy.log_redirect" -) - -// GetLaunchPolicy takes in a map[string] string which should come from image labels, -// and will try to parse it into a LaunchPolicy. Extra fields will be ignored. -func GetLaunchPolicy(imageLabels map[string]string) (LaunchPolicy, error) { - var err error - launchPolicy := LaunchPolicy{} - if v, ok := imageLabels[envOverride]; ok { - envs := strings.Split(v, ",") - for _, env := range envs { - // strip out empty env name - if env != "" { - launchPolicy.AllowedEnvOverride = append(launchPolicy.AllowedEnvOverride, env) - } - } - } - - if v, ok := imageLabels[cmdOverride]; ok { - if launchPolicy.AllowedCmdOverride, err = strconv.ParseBool(v); err != nil { - return LaunchPolicy{}, fmt.Errorf("invalid image LABEL '%s' (not a boolean); contact the image author", cmdOverride) - } - } - - // default is debug only - if v, ok := imageLabels[logRedirect]; ok { - launchPolicy.AllowedLogRedirect, err = toLogRedirectPolicy(v) - if err != nil { - return LaunchPolicy{}, fmt.Errorf("invalid image LABEL '%s'; contact the image author", logRedirect) - } - } - - return launchPolicy, nil -} - -// Verify will use the LaunchPolicy to verify the given LaunchSpec. If the verification passed, will return nil. -// If there are multiple violations, the function will return the first error. -func (p LaunchPolicy) Verify(ls LaunchSpec) error { - for _, e := range ls.Envs { - if !contains(p.AllowedEnvOverride, e.Name) { - return fmt.Errorf("env var %s is not allowed to be overridden on this image; allowed envs to be overridden: %v", e, p.AllowedEnvOverride) - } - } - if !p.AllowedCmdOverride && len(ls.Cmd) > 0 { - return fmt.Errorf("CMD is not allowed to be overridden on this image") - } - - if p.AllowedLogRedirect == never && ls.LogRedirect.enabled() { - return fmt.Errorf("logging redirection not allowed by image") - } - - if p.AllowedLogRedirect == debugOnly && ls.LogRedirect.enabled() && ls.Hardened { - return fmt.Errorf("logging redirection only allowed on debug environment by image") - } - - return nil -} - -func contains(strs []string, target string) bool { - for _, s := range strs { - if s == target { - return true - } - } - return false -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_policy_test.go b/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_policy_test.go deleted file mode 100644 index 1de95cc17..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_policy_test.go +++ /dev/null @@ -1,435 +0,0 @@ -package spec - -import ( - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestLaunchPolicy(t *testing.T) { - testCases := []struct { - testName string - imageLabels map[string]string - expectedPolicy LaunchPolicy - }{ - { - "single ENV override, CMD override", - map[string]string{ - envOverride: "foo", - cmdOverride: "true", - }, - LaunchPolicy{ - AllowedEnvOverride: []string{"foo"}, - AllowedCmdOverride: true, - }, - }, - { - "multiple ENV override, no CMD override", - map[string]string{ - envOverride: "foo,bar", - }, - LaunchPolicy{ - AllowedEnvOverride: []string{"foo", "bar"}, - AllowedCmdOverride: false, - }, - }, - { - "no ENV override, no CMD override", - nil, - LaunchPolicy{ - AllowedEnvOverride: nil, - AllowedCmdOverride: false, - }, - }, - { - "empty string in ENV override", - map[string]string{ - envOverride: ",,,foo", - cmdOverride: "false", - }, - LaunchPolicy{ - AllowedEnvOverride: []string{"foo"}, - AllowedCmdOverride: false, - }, - }, - } - - for _, testcase := range testCases { - t.Run(testcase.testName, func(t *testing.T) { - got, err := GetLaunchPolicy(testcase.imageLabels) - if err != nil { - t.Fatal(err) - } - - if !cmp.Equal(got, testcase.expectedPolicy) { - t.Errorf("Launchspec got %+v, want %+v", got, testcase.expectedPolicy) - } - }) - } -} - -func TestVerify(t *testing.T) { - testCases := []struct { - testName string - policy LaunchPolicy - spec LaunchSpec - expectErr bool - }{ - { - "allows everything", - LaunchPolicy{ - AllowedEnvOverride: []string{"foo"}, - AllowedCmdOverride: true, - AllowedLogRedirect: always, - }, - LaunchSpec{ - Envs: []EnvVar{{Name: "foo", Value: "foo"}}, - Cmd: []string{"foo"}, - LogRedirect: Everywhere, - }, - false, - }, - { - "default case", - LaunchPolicy{}, - LaunchSpec{}, - false, - }, - { - "env override violation", - LaunchPolicy{ - AllowedEnvOverride: []string{"foo"}, - }, - LaunchSpec{ - Envs: []EnvVar{{Name: "bar", Value: ""}}, - }, - true, - }, - { - "cmd violation", - LaunchPolicy{ - AllowedCmdOverride: false, - }, - LaunchSpec{ - Cmd: []string{"foo"}, - }, - true, - }, - { - "log redirect (never, everywhere, hardened): err", - LaunchPolicy{ - AllowedLogRedirect: never, - }, - LaunchSpec{ - LogRedirect: Everywhere, - Hardened: true, - }, - true, - }, - { - "log redirect (never, cloudlogging, hardened): err", - LaunchPolicy{ - AllowedLogRedirect: never, - }, - LaunchSpec{ - LogRedirect: CloudLogging, - Hardened: true, - }, - true, - }, - { - "log redirect (never, serial, hardened): err", - LaunchPolicy{ - AllowedLogRedirect: never, - }, - LaunchSpec{ - LogRedirect: Serial, - Hardened: true, - }, - true, - }, - { - "log redirect (never, nowhere, hardened): noerr", - LaunchPolicy{ - AllowedLogRedirect: never, - }, - LaunchSpec{ - LogRedirect: Nowhere, - Hardened: true, - }, - false, - }, - { - "log redirect (never, everywhere, debug): err", - LaunchPolicy{ - AllowedLogRedirect: never, - }, - LaunchSpec{ - LogRedirect: Everywhere, - Hardened: false, - }, - true, - }, - { - "log redirect (never, cloudlogging, debug): err", - LaunchPolicy{ - AllowedLogRedirect: never, - }, - LaunchSpec{ - LogRedirect: CloudLogging, - Hardened: false, - }, - true, - }, - { - "log redirect (never, serial, debug): err", - LaunchPolicy{ - AllowedLogRedirect: never, - }, - LaunchSpec{ - LogRedirect: Serial, - Hardened: false, - }, - true, - }, - { - "log redirect (never, nowhere, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: never, - }, - LaunchSpec{ - LogRedirect: Nowhere, - Hardened: false, - }, - false, - }, - { - "log redirect (debugOnly, everywhere, hardened): err", - LaunchPolicy{ - AllowedLogRedirect: debugOnly, - }, - LaunchSpec{ - LogRedirect: Everywhere, - Hardened: true, - }, - true, - }, - { - "log redirect (debugOnly, cloudlogging, hardened): err", - LaunchPolicy{ - AllowedLogRedirect: debugOnly, - }, - LaunchSpec{ - LogRedirect: CloudLogging, - Hardened: true, - }, - true, - }, - { - "log redirect (debugOnly, serial, hardened): err", - LaunchPolicy{ - AllowedLogRedirect: debugOnly, - }, - LaunchSpec{ - LogRedirect: Serial, - Hardened: true, - }, - true, - }, - { - "log redirect (debugOnly, nowhere, hardened): noerr", - LaunchPolicy{ - AllowedLogRedirect: debugOnly, - }, - LaunchSpec{ - LogRedirect: Nowhere, - Hardened: true, - }, - false, - }, - { - "log redirect (debugOnly, everywhere, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: debugOnly, - }, - LaunchSpec{ - LogRedirect: Everywhere, - Hardened: false, - }, - false, - }, - { - "log redirect (debugOnly, cloudlogging, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: debugOnly, - }, - LaunchSpec{ - LogRedirect: CloudLogging, - Hardened: false, - }, - false, - }, - { - "log redirect (debugOnly, serial, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: debugOnly, - }, - LaunchSpec{ - LogRedirect: Serial, - Hardened: false, - }, - false, - }, - { - "log redirect (debugOnly, nowhere, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: debugOnly, - }, - LaunchSpec{ - LogRedirect: Nowhere, - Hardened: false, - }, - false, - }, - { - "log redirect (always, everywhere, hardened): noerr", - LaunchPolicy{ - AllowedLogRedirect: always, - }, - LaunchSpec{ - LogRedirect: Everywhere, - Hardened: true, - }, - false, - }, - { - "log redirect (always, cloudlogging, hardened): noerr", - LaunchPolicy{ - AllowedLogRedirect: always, - }, - LaunchSpec{ - LogRedirect: CloudLogging, - Hardened: true, - }, - false, - }, - { - "log redirect (always, serial, hardened): noerr", - LaunchPolicy{ - AllowedLogRedirect: always, - }, - LaunchSpec{ - LogRedirect: Serial, - Hardened: true, - }, - false, - }, - { - "log redirect (always, nowhere, hardened): noerr", - LaunchPolicy{ - AllowedLogRedirect: always, - }, - LaunchSpec{ - LogRedirect: Nowhere, - Hardened: true, - }, - false, - }, - { - "log redirect (always, everywhere, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: always, - }, - LaunchSpec{ - LogRedirect: Everywhere, - Hardened: false, - }, - false, - }, - { - "log redirect (always, cloudlogging, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: always, - }, - LaunchSpec{ - LogRedirect: CloudLogging, - Hardened: false, - }, - false, - }, - { - "log redirect (always, serial, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: always, - }, - LaunchSpec{ - LogRedirect: Serial, - Hardened: false, - }, - false, - }, - { - "log redirect (always, nowhere, debug): noerr", - LaunchPolicy{ - AllowedLogRedirect: always, - }, - LaunchSpec{ - LogRedirect: Nowhere, - Hardened: false, - }, - false, - }, - } - for _, testCase := range testCases { - t.Run(testCase.testName, func(t *testing.T) { - err := testCase.policy.Verify(testCase.spec) - if testCase.expectErr { - if err == nil { - t.Errorf("expected error, but got nil") - } - } else { - if err != nil { - t.Errorf("expected no error, but got %v", err) - } - } - }) - } -} - -func TestIsHardened(t *testing.T) { - testCases := []struct { - testName string - kernelCmd string - expectHardened bool - }{ - { - "empty kernel cmd", - "", - false, - }, - { - "no confidential-space.hardened arg", - "BOOT_IMAGE=/syslinux/vmlinuz.B init=/usr/lib/systemd/systemd boot=local rootwait ro noresume loglevel=7 console=tty1 console=ttyS0 security=apparmor virtio_net.napi_tx=1 nmi_watchdog=0 csm.disabled=1 loadpin.exclude=kernel-module modules-load=loadpin_trigger module.sig_enforce=1 dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 i915.modeset=1 cros_efi cos.protected_stateful_partition=e systemd.mask=update-engine.service ds=nocloud;s=/usr/share/oem/ cros_debug root=/dev/dm-0 \"dm=2 vroot none ro 1,0 4077568 verity payload=PARTUUID=DC7DB0DC-DDCC-AA45-BAE3-A41CA1698E83 hashtree=PARTUUID=DC7DB0DC-DDCC-AA45-BAE3-A41CA1698E83 hashstart=4077568 alg=sha256 root_hexdigest=6d5887660805db1b366319bd1c2161600d11b9e53f059b0e44b760a7277e1b0a salt=f4a41993832655a00d48f5769351370bebafd7de906df068bc1b1929b175ee43,oemroot none ro 1, 0 1024000 verity payload=PARTUUID=fd5af56a-7b25-c448-a616-19eb240b3260 hashtree=PARTUUID=fd5af56a-7b25-c448-a616-19eb240b3260 hashstart=1024000 alg=sha256 root_hexdigest=50c406c129054649a432fa144eeff56aa8b707d4c86f3ab44edde589356e8b23 salt=2a3461269a26ad6247f4b64cacd84f64e5a3311cd4b2f742bab6442291bf4977\"", - false, - }, - { - "has kernel arg confidential-space.hardened=true", - "BOOT_IMAGE=/syslinux/vmlinuz.B init=/usr/lib/systemd/systemd boot=local rootwait ro noresume loglevel=7 console=tty1 console=ttyS0 security=apparmor virtio_net.napi_tx=1 nmi_watchdog=0 csm.disabled=1 loadpin.exclude=kernel-module modules-load=loadpin_trigger module.sig_enforce=1 dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 i915.modeset=1 cros_efi confidential-space.hardened=true cos.protected_stateful_partition=e systemd.mask=update-engine.service ds=nocloud;s=/usr/share/oem/ cros_debug root=/dev/dm-0 \"dm=2 vroot none ro 1,0 4077568 verity payload=PARTUUID=DC7DB0DC-DDCC-AA45-BAE3-A41CA1698E83 hashtree=PARTUUID=DC7DB0DC-DDCC-AA45-BAE3-A41CA1698E83 hashstart=4077568 alg=sha256 root_hexdigest=6d5887660805db1b366319bd1c2161600d11b9e53f059b0e44b760a7277e1b0a salt=f4a41993832655a00d48f5769351370bebafd7de906df068bc1b1929b175ee43,oemroot none ro 1, 0 1024000 verity payload=PARTUUID=fd5af56a-7b25-c448-a616-19eb240b3260 hashtree=PARTUUID=fd5af56a-7b25-c448-a616-19eb240b3260 hashstart=1024000 alg=sha256 root_hexdigest=50c406c129054649a432fa144eeff56aa8b707d4c86f3ab44edde589356e8b23 salt=2a3461269a26ad6247f4b64cacd84f64e5a3311cd4b2f742bab6442291bf4977\"", - true, - }, - { - "has kernel arg confidential-space.hardened=false", - "BOOT_IMAGE=/syslinux/vmlinuz.B init=/usr/lib/systemd/systemd boot=local rootwait ro noresume loglevel=7 console=tty1 console=ttyS0 security=apparmor virtio_net.napi_tx=1 nmi_watchdog=0 csm.disabled=1 loadpin.exclude=kernel-module modules-load=loadpin_trigger module.sig_enforce=1 dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 i915.modeset=1 cros_efi confidential-space.hardened=false cos.protected_stateful_partition=e systemd.mask=update-engine.service ds=nocloud;s=/usr/share/oem/ cros_debug root=/dev/dm-0 \"dm=2 vroot none ro 1,0 4077568 verity payload=PARTUUID=DC7DB0DC-DDCC-AA45-BAE3-A41CA1698E83 hashtree=PARTUUID=DC7DB0DC-DDCC-AA45-BAE3-A41CA1698E83 hashstart=4077568 alg=sha256 root_hexdigest=6d5887660805db1b366319bd1c2161600d11b9e53f059b0e44b760a7277e1b0a salt=f4a41993832655a00d48f5769351370bebafd7de906df068bc1b1929b175ee43,oemroot none ro 1, 0 1024000 verity payload=PARTUUID=fd5af56a-7b25-c448-a616-19eb240b3260 hashtree=PARTUUID=fd5af56a-7b25-c448-a616-19eb240b3260 hashstart=1024000 alg=sha256 root_hexdigest=50c406c129054649a432fa144eeff56aa8b707d4c86f3ab44edde589356e8b23 salt=2a3461269a26ad6247f4b64cacd84f64e5a3311cd4b2f742bab6442291bf4977\"", - false, - }, - } - - for _, testCase := range testCases { - t.Run(testCase.testName, func(t *testing.T) { - hardened := isHardened(testCase.kernelCmd) - if testCase.expectHardened != hardened { - t.Errorf("expected %t, but got %t", testCase.expectHardened, hardened) - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_spec.go b/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_spec.go deleted file mode 100644 index c275bf5cb..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_spec.go +++ /dev/null @@ -1,220 +0,0 @@ -// Package spec contains definition of some basic container launch specs needed to -// launch a container, provided by the operator. -package spec - -import ( - "encoding/json" - "fmt" - "os" - "strings" - - "cloud.google.com/go/compute/metadata" - "github.com/google/go-tpm-tools/launcher/internal/experiments" -) - -// RestartPolicy is the enum for the container restart policy. -type RestartPolicy string - -func (p RestartPolicy) isValid() error { - switch p { - case Always, OnFailure, Never: - return nil - } - return fmt.Errorf("invalid restart policy: %s", p) -} - -// Restart Policy enum values. -const ( - Always RestartPolicy = "Always" - OnFailure RestartPolicy = "OnFailure" - Never RestartPolicy = "Never" -) - -// LogRedirectLocation specifies the workload logging redirect location. -type LogRedirectLocation string - -func (l LogRedirectLocation) isValid() error { - switch l { - case Everywhere, CloudLogging, Serial, Nowhere: - return nil - } - return fmt.Errorf("invalid logging redirect location %s, expect one of %s", l, - []LogRedirectLocation{Everywhere, CloudLogging, Serial, Nowhere}) -} - -func (l LogRedirectLocation) enabled() bool { - return l != Nowhere -} - -// LogRedirectLocation acceptable values. -const ( - Everywhere LogRedirectLocation = "true" - CloudLogging LogRedirectLocation = "cloud_logging" - Serial LogRedirectLocation = "serial" - Nowhere LogRedirectLocation = "false" -) - -// Metadata variable names. -const ( - imageRefKey = "tee-image-reference" - signedImageRepos = "tee-signed-image-repos" - restartPolicyKey = "tee-restart-policy" - cmdKey = "tee-cmd" - envKeyPrefix = "tee-env-" - impersonateServiceAccounts = "tee-impersonate-service-accounts" - attestationServiceAddrKey = "tee-attestation-service-endpoint" - logRedirectKey = "tee-container-log-redirect" -) - -const ( - instanceAttributesQuery = "instance/attributes/?recursive=true" -) - -var errImageRefNotSpecified = fmt.Errorf("%s is not specified in the custom metadata", imageRefKey) - -// EnvVar represent a single environment variable key/value pair. -type EnvVar struct { - Name string - Value string -} - -// LaunchSpec contains specification set by the operator who wants to -// launch a container. -type LaunchSpec struct { - // MDS-based values. - ImageRef string - SignedImageRepos []string - RestartPolicy RestartPolicy - Cmd []string - Envs []EnvVar - AttestationServiceAddr string - ImpersonateServiceAccounts []string - ProjectID string - Region string - Hardened bool - LogRedirect LogRedirectLocation - Experiments experiments.Experiments -} - -// UnmarshalJSON unmarshals an instance attributes list in JSON format from the metadata -// server set by an operator to a LaunchSpec. -func (s *LaunchSpec) UnmarshalJSON(b []byte) error { - var unmarshaledMap map[string]string - if err := json.Unmarshal(b, &unmarshaledMap); err != nil { - return err - } - - s.ImageRef = unmarshaledMap[imageRefKey] - if s.ImageRef == "" { - return errImageRefNotSpecified - } - - s.RestartPolicy = RestartPolicy(unmarshaledMap[restartPolicyKey]) - // set the default restart policy to "Never" for now - if s.RestartPolicy == "" { - s.RestartPolicy = Never - } - if err := s.RestartPolicy.isValid(); err != nil { - return err - } - - if val, ok := unmarshaledMap[impersonateServiceAccounts]; ok && val != "" { - impersonateAccounts := strings.Split(val, ",") - s.ImpersonateServiceAccounts = append(s.ImpersonateServiceAccounts, impersonateAccounts...) - } - - if val, ok := unmarshaledMap[signedImageRepos]; ok && val != "" { - imageRepos := strings.Split(val, ",") - s.SignedImageRepos = append(s.SignedImageRepos, imageRepos...) - } - - // populate cmd override - if val, ok := unmarshaledMap[cmdKey]; ok && val != "" { - if err := json.Unmarshal([]byte(val), &s.Cmd); err != nil { - return err - } - } - - // populate all env vars - for k, v := range unmarshaledMap { - if strings.HasPrefix(k, envKeyPrefix) { - s.Envs = append(s.Envs, EnvVar{strings.TrimPrefix(k, envKeyPrefix), v}) - } - } - - s.LogRedirect = LogRedirectLocation(unmarshaledMap[logRedirectKey]) - // Default log redirect location is Nowhere ("false"). - if s.LogRedirect == "" { - s.LogRedirect = Nowhere - } - if err := s.LogRedirect.isValid(); err != nil { - return err - } - - s.AttestationServiceAddr = unmarshaledMap[attestationServiceAddrKey] - - return nil -} - -func getRegion(client *metadata.Client) (string, error) { - zone, err := client.Zone() - if err != nil { - return "", fmt.Errorf("failed to retrieve zone from MDS: %v", err) - } - lastDash := strings.LastIndex(zone, "-") - if lastDash == -1 { - return "", fmt.Errorf("got malformed zone from MDS: %v", zone) - } - return zone[:lastDash], nil -} - -// GetLaunchSpec takes in a metadata server client, reads and parse operator's -// input to the GCE instance custom metadata and return a LaunchSpec. -// ImageRef (tee-image-reference) is required, will return an error if -// ImageRef is not presented in the metadata. -func GetLaunchSpec(client *metadata.Client) (LaunchSpec, error) { - data, err := client.Get(instanceAttributesQuery) - if err != nil { - return LaunchSpec{}, err - } - - spec := &LaunchSpec{} - if err := spec.UnmarshalJSON([]byte(data)); err != nil { - return LaunchSpec{}, err - } - - spec.ProjectID, err = client.ProjectID() - if err != nil { - return LaunchSpec{}, fmt.Errorf("failed to retrieve projectID from MDS: %v", err) - } - - spec.Region, err = getRegion(client) - if err != nil { - return LaunchSpec{}, err - } - - kernelCmd, err := readCmdline() - if err != nil { - return LaunchSpec{}, err - } - spec.Hardened = isHardened(kernelCmd) - - return *spec, nil -} - -func isHardened(kernelCmd string) bool { - for _, arg := range strings.Fields(kernelCmd) { - if arg == "confidential-space.hardened=true" { - return true - } - } - return false -} - -func readCmdline() (string, error) { - kernelCmd, err := os.ReadFile("/proc/cmdline") - if err != nil { - return "", err - } - return string(kernelCmd), nil -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_spec_test.go b/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_spec_test.go deleted file mode 100644 index 96c16da53..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/spec/launch_spec_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package spec - -import ( - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestLaunchSpecUnmarshalJSONHappyCases(t *testing.T) { - var testCases = []struct { - testName string - mdsJSON string - }{ - { - "HappyCase", - `{ - "tee-cmd":"[\"--foo\",\"--bar\",\"--baz\"]", - "tee-env-foo":"bar", - "tee-image-reference":"docker.io/library/hello-world:latest", - "tee-signed-image-repos":"docker.io/library/hello-world,gcr.io/cloudrun/hello", - "tee-restart-policy":"Always", - "tee-impersonate-service-accounts":"sv1@developer.gserviceaccount.com,sv2@developer.gserviceaccount.com", - "tee-container-log-redirect":"true" - }`, - }, - { - "HappyCaseWithExtraUnknownFields", - `{ - "tee-cmd":"[\"--foo\",\"--bar\",\"--baz\"]", - "tee-env-foo":"bar", - "tee-unknown":"unknown", - "unknown":"unknown", - "tee-image-reference":"docker.io/library/hello-world:latest", - "tee-signed-image-repos":"docker.io/library/hello-world,gcr.io/cloudrun/hello", - "tee-restart-policy":"Always", - "tee-impersonate-service-accounts":"sv1@developer.gserviceaccount.com,sv2@developer.gserviceaccount.com", - "tee-container-log-redirect":"true" - }`, - }, - } - - want := &LaunchSpec{ - ImageRef: "docker.io/library/hello-world:latest", - SignedImageRepos: []string{"docker.io/library/hello-world", "gcr.io/cloudrun/hello"}, - RestartPolicy: Always, - Cmd: []string{"--foo", "--bar", "--baz"}, - Envs: []EnvVar{{"foo", "bar"}}, - ImpersonateServiceAccounts: []string{"sv1@developer.gserviceaccount.com", "sv2@developer.gserviceaccount.com"}, - LogRedirect: Everywhere, - } - - for _, testcase := range testCases { - t.Run(testcase.testName, func(t *testing.T) { - spec := &LaunchSpec{} - if err := spec.UnmarshalJSON([]byte(testcase.mdsJSON)); err != nil { - t.Fatal(err) - } - if !cmp.Equal(spec, want) { - t.Errorf("LaunchSpec UnmarshalJSON got %+v, want %+v", spec, want) - } - }) - } -} - -func TestLaunchSpecUnmarshalJSONBadInput(t *testing.T) { - var testCases = []struct { - testName string - mdsJSON string - }{ - // not likely to happen for MDS - { - "BadJSON", - `{ - BadJSONFormat - }`, - }, - // when there is no MDS values - { - "EmptyJSON", - `{}`, - }, - // not likely to happen, since MDS will always use string as the value - { - "JSONWithPrimitives", - `{ - "tee-env-bool":true, - "tee-image-reference":"docker.io/library/hello-world:latest" - }`, - }, - { - "WrongRestartPolicy", - `{ - "tee-image-reference":"docker.io/library/hello-world:latest", - "tee-restart-policy":"noway", - }`, - }, - { - "WrongLogRedirectLocation", - `{ - "tee-image-reference":"docker.io/library/hello-world:latest", - "tee-container-log-redirect":"badideas", - }`, - }, - } - - for _, testcase := range testCases { - t.Run(testcase.testName, func(t *testing.T) { - spec := &LaunchSpec{} - if err := spec.UnmarshalJSON([]byte(testcase.mdsJSON)); err == nil { - t.Fatal("expected JSON parsing err") - } - }) - } -} - -func TestLaunchSpecUnmarshalJSONWithDefaultValue(t *testing.T) { - mdsJSON := `{ - "tee-image-reference":"docker.io/library/hello-world:latest", - "tee-impersonate-service-accounts":"", - "tee-signed-image-repos":"", - "tee-container-log-redirect":"", - "tee-restart-policy":"" - }` - - spec := &LaunchSpec{} - if err := spec.UnmarshalJSON([]byte(mdsJSON)); err != nil { - t.Fatal(err) - } - - want := &LaunchSpec{ - ImageRef: "docker.io/library/hello-world:latest", - RestartPolicy: Never, - LogRedirect: Nowhere, - } - - if !cmp.Equal(spec, want) { - t.Errorf("LaunchSpec UnmarshalJSON got %+v, want %+v", spec, want) - } -} - -func TestLaunchSpecUnmarshalJSONWithoutImageReference(t *testing.T) { - mdsJSON := `{ - "tee-cmd":"[\"--foo\",\"--bar\",\"--baz\"]", - "tee-env-foo":"bar", - "tee-restart-policy":"Never" - }` - - spec := &LaunchSpec{} - if err := spec.UnmarshalJSON([]byte(mdsJSON)); err == nil || err != errImageRefNotSpecified { - t.Fatalf("got %v error, but expected %v error", err, errImageRefNotSpecified) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/verifier/client.go b/vendor/github.com/google/go-tpm-tools/launcher/verifier/client.go deleted file mode 100644 index 15469de5b..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/verifier/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Package verifier contains clients for various attestation verifiers. -// It is meant for launcher use and testing; the API is not stable. -package verifier - -import ( - "context" - - "github.com/google/go-tpm-tools/launcher/internal/oci" - attestpb "github.com/google/go-tpm-tools/proto/attest" - "google.golang.org/genproto/googleapis/rpc/status" -) - -// Client is a common interface to various attestation verifiers. -type Client interface { - CreateChallenge(ctx context.Context) (*Challenge, error) - VerifyAttestation(ctx context.Context, request VerifyAttestationRequest) (*VerifyAttestationResponse, error) -} - -// Challenge is the response for CreateChallenge. It is used in the -// get challenge part of a remote attestation protocol. The challenge -// will be verified as part of VerifyAttestation. -type Challenge struct { - Name string - Nonce []byte - ConnID string -} - -// VerifyAttestationRequest is passed in on VerifyAttestation. It contains the -// Challenge from CreateChallenge, optional GcpCredentials linked to the -// attestation, the Attestation generated from the TPM, and optional container image signatures associated with the workload. -type VerifyAttestationRequest struct { - Challenge *Challenge - GcpCredentials [][]byte - Attestation *attestpb.Attestation - ContainerImageSignatures []oci.Signature -} - -// VerifyAttestationResponse is the response from a successful -// VerifyAttestation call. -type VerifyAttestationResponse struct { - ClaimsToken []byte - PartialErrs []*status.Status -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/verifier/fake/fakeclaims.go b/vendor/github.com/google/go-tpm-tools/launcher/verifier/fake/fakeclaims.go deleted file mode 100644 index 7fd538b64..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/verifier/fake/fakeclaims.go +++ /dev/null @@ -1,25 +0,0 @@ -package fake - -import "github.com/golang-jwt/jwt/v4" - -// Verify that Claims implements jwt.Claims. -var _ jwt.Claims = Claims{} - -// Claims contains information to be formatted into a fake JWT. -type Claims struct { - jwt.RegisteredClaims - ContainerImageSignatures []ContainerImageSignatureClaims `json:"container_image_signatures"` -} - -// ContainerImageSignatureClaims contains claims about a container image signature. -type ContainerImageSignatureClaims struct { - Payload string `json:"payload"` - Signature string `json:"signature"` - PubKey string `json:"public_key"` - SigAlg string `json:"signature_algorithm"` -} - -// Valid is necessary to implement the jwt.Claims interface. -func (c Claims) Valid() error { - return nil -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/verifier/fake/fakeverifier.go b/vendor/github.com/google/go-tpm-tools/launcher/verifier/fake/fakeverifier.go deleted file mode 100644 index ee28c3ca0..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/verifier/fake/fakeverifier.go +++ /dev/null @@ -1,111 +0,0 @@ -// Package fake is a fake implementation of the Client interface for testing. -package fake - -import ( - "context" - "crypto" - "encoding/binary" - "time" - - "github.com/golang-jwt/jwt/v4" - "github.com/google/go-tpm-tools/launcher/internal/oci" - "github.com/google/go-tpm-tools/launcher/verifier" - "go.uber.org/multierr" - "google.golang.org/genproto/googleapis/rpc/code" - "google.golang.org/genproto/googleapis/rpc/status" -) - -type fakeClient struct { - signer crypto.Signer -} - -// NewClient constructs a new fake client given a crypto.Signer. -func NewClient(signer crypto.Signer) verifier.Client { - return &fakeClient{signer} -} - -// CreateChallenge returns a hard coded, basic challenge. -// -// If you have found this method is insufficient for your tests, this class must be updated to -// allow for better testing. -func (fc *fakeClient) CreateChallenge(_ context.Context) (*verifier.Challenge, error) { - bs := make([]byte, 2) - binary.LittleEndian.PutUint16(bs, 15) - return &verifier.Challenge{ - Name: "projects/fakeProject/locations/fakeRegion/challenges/d882c62f-452f-4709-9335-0cccaf64eee1", - Nonce: bs, - }, nil -} - -// VerifyAttestation does basic checks and returns a hard coded attestation response. -// -// If you have found this method is insufficient for your tests, this class must be updated to -// allow for better testing. -func (fc *fakeClient) VerifyAttestation(_ context.Context, req verifier.VerifyAttestationRequest) (*verifier.VerifyAttestationResponse, error) { - // Determine signing algorithm. - signingMethod := jwt.SigningMethodRS256 - now := jwt.TimeFunc() - claims := Claims{ - RegisteredClaims: jwt.RegisteredClaims{ - IssuedAt: &jwt.NumericDate{Time: now}, - NotBefore: &jwt.NumericDate{Time: now}, - ExpiresAt: &jwt.NumericDate{Time: now.Add(time.Hour)}, - Audience: []string{"https://sts.googleapis.com/"}, - Issuer: "https://confidentialcomputing.googleapis.com/", - Subject: "https://www.googleapis.com/compute/v1/projects/fakeProject/zones/fakeZone/instances/fakeInstance", - }, - } - - var signatureClaims []ContainerImageSignatureClaims - var partialErrs []*status.Status - for _, signature := range req.ContainerImageSignatures { - sc, err := verifyContainerImageSignature(signature) - if err != nil { - partialErrs = append(partialErrs, &status.Status{Code: int32(code.Code_INVALID_ARGUMENT), Message: err.Error()}) - } else { - signatureClaims = append(signatureClaims, sc) - } - } - claims.ContainerImageSignatures = signatureClaims - - token := jwt.NewWithClaims(signingMethod, claims) - - // Instead of a private key, provide the signer. - signed, err := token.SignedString(fc.signer) - if err != nil { - return nil, err - } - - response := verifier.VerifyAttestationResponse{ - ClaimsToken: []byte(signed), - PartialErrs: partialErrs, - } - - return &response, nil -} - -func verifyContainerImageSignature(signature oci.Signature) (ContainerImageSignatureClaims, error) { - var err error - payload, e := signature.Payload() - if e != nil { - err = multierr.Append(err, e) - } - b64Sig, e := signature.Base64Encoded() - if e != nil { - err = multierr.Append(err, e) - } - pubKey, e := signature.PublicKey() - if e != nil { - err = multierr.Append(err, e) - } - sigAlg, e := signature.SigningAlgorithm() - if e != nil { - err = multierr.Append(err, e) - } - return ContainerImageSignatureClaims{ - Payload: string(payload), - Signature: b64Sig, - PubKey: string(pubKey), - SigAlg: string(sigAlg), - }, err -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest.go b/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest.go deleted file mode 100644 index 22fea85a4..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest.go +++ /dev/null @@ -1,211 +0,0 @@ -// Package rest contains the code to use the REST-based Google API -package rest - -import ( - "context" - "encoding/base64" - "fmt" - "log" - "strings" - - "github.com/google/go-tpm-tools/launcher/internal/oci" - "github.com/google/go-tpm-tools/launcher/verifier" - - v1 "cloud.google.com/go/confidentialcomputing/apiv1" - confidentialcomputingpb "cloud.google.com/go/confidentialcomputing/apiv1/confidentialcomputingpb" - "google.golang.org/api/iterator" - "google.golang.org/api/option" - locationpb "google.golang.org/genproto/googleapis/cloud/location" -) - -// BadRegionError indicates that: -// - the requested Region cannot be used with this API -// - other Regions _can_ be used with this API -type BadRegionError struct { - RequestedRegion string - AvailableRegions []string - err error -} - -func (e *BadRegionError) Error() string { - return fmt.Sprintf( - "invalid region %q, available regions are [%s]: %v", - e.RequestedRegion, strings.Join(e.AvailableRegions, ", "), e.err, - ) -} - -func (e *BadRegionError) Unwrap() error { - return e.err -} - -// NewClient creates a new REST client which is configured to perform -// attestations in a particular project and region. Returns a *BadRegionError -// if the requested project is valid, but the region is invalid. -func NewClient(ctx context.Context, projectID string, region string, opts ...option.ClientOption) (verifier.Client, error) { - client, err := v1.NewRESTClient(ctx, opts...) - if err != nil { - return nil, fmt.Errorf("can't create ConfidentialComputing v1 API client: %w", err) - } - - projectName := fmt.Sprintf("projects/%s", projectID) - locationName := fmt.Sprintf("%s/locations/%v", projectName, region) - - getReq := &locationpb.GetLocationRequest{ - Name: locationName, - } - location, getErr := client.GetLocation(ctx, getReq) - if getErr == nil { - return &restClient{client, location}, nil - } - - // If we can't get the location, try to list the locations. This handles - // situations where the projectID is invalid. - listReq := &locationpb.ListLocationsRequest{ - Name: projectName, - } - listIter := client.ListLocations(ctx, listReq) - - // The project is valid, but can't get the desired region. - var regions []string - for { - resp, err := listIter.Next() - if err == iterator.Done { - break - } - if err != nil { - return nil, fmt.Errorf("listing regions in project %q: %w", projectID, err) - } - regions = append(regions, resp.LocationId) - } - return nil, &BadRegionError{ - RequestedRegion: region, - AvailableRegions: regions, - err: getErr, - } -} - -type restClient struct { - v1Client *v1.Client - location *locationpb.Location -} - -// CreateChallenge implements verifier.Client -func (c *restClient) CreateChallenge(ctx context.Context) (*verifier.Challenge, error) { - // Pass an empty Challenge for the input (all params are output-only) - req := &confidentialcomputingpb.CreateChallengeRequest{ - Parent: c.location.Name, - Challenge: &confidentialcomputingpb.Challenge{}, - } - chal, err := c.v1Client.CreateChallenge(ctx, req) - if err != nil { - return nil, fmt.Errorf("calling v1.CreateChallenge: %w", err) - } - return convertChallengeFromREST(chal) -} - -// VerifyAttestation implements verifier.Client -func (c *restClient) VerifyAttestation(ctx context.Context, request verifier.VerifyAttestationRequest) (*verifier.VerifyAttestationResponse, error) { - if request.Challenge == nil || request.Attestation == nil { - return nil, fmt.Errorf("nil value provided in challenge") - } - req := convertRequestToREST(request) - req.Challenge = request.Challenge.Name - response, err := c.v1Client.VerifyAttestation(ctx, req) - if err != nil { - return nil, fmt.Errorf("calling v1.VerifyAttestation: %w", err) - } - return convertResponseFromREST(response) -} - -var encoding = base64.StdEncoding - -func convertChallengeFromREST(chal *confidentialcomputingpb.Challenge) (*verifier.Challenge, error) { - nonce, err := encoding.DecodeString(chal.TpmNonce) - if err != nil { - return nil, fmt.Errorf("failed to decode Challenge.Nonce: %w", err) - } - return &verifier.Challenge{ - Name: chal.Name, - Nonce: nonce, - }, nil -} - -func convertRequestToREST(request verifier.VerifyAttestationRequest) *confidentialcomputingpb.VerifyAttestationRequest { - idTokens := make([]string, len(request.GcpCredentials)) - for i, token := range request.GcpCredentials { - idTokens[i] = string(token) - } - - quotes := make([]*confidentialcomputingpb.TpmAttestation_Quote, len(request.Attestation.GetQuotes())) - for i, quote := range request.Attestation.GetQuotes() { - pcrVals := map[int32][]byte{} - for idx, val := range quote.GetPcrs().GetPcrs() { - pcrVals[int32(idx)] = val - } - - quotes[i] = &confidentialcomputingpb.TpmAttestation_Quote{ - RawQuote: quote.GetQuote(), - RawSignature: quote.GetRawSig(), - HashAlgo: int32(quote.GetPcrs().GetHash()), - PcrValues: pcrVals, - } - } - - certs := make([][]byte, len(request.Attestation.GetIntermediateCerts())) - for i, cert := range request.Attestation.GetIntermediateCerts() { - certs[i] = cert - } - - signatures := make([]*confidentialcomputingpb.ContainerImageSignature, len(request.ContainerImageSignatures)) - for i, sig := range request.ContainerImageSignatures { - signature, err := convertOCISignatureToREST(sig) - if err != nil { - log.Printf("failed to convert OCI signature [%v] to ContainerImageSignature proto: %v", sig, err) - continue - } - signatures[i] = signature - } - - return &confidentialcomputingpb.VerifyAttestationRequest{ - GcpCredentials: &confidentialcomputingpb.GcpCredentials{ - ServiceAccountIdTokens: idTokens, - }, - TpmAttestation: &confidentialcomputingpb.TpmAttestation{ - Quotes: quotes, - TcgEventLog: request.Attestation.GetEventLog(), - CanonicalEventLog: request.Attestation.GetCanonicalEventLog(), - AkCert: request.Attestation.GetAkCert(), - CertChain: certs, - }, - ConfidentialSpaceInfo: &confidentialcomputingpb.ConfidentialSpaceInfo{ - SignedEntities: []*confidentialcomputingpb.SignedEntity{{ContainerImageSignatures: signatures}}, - }, - } -} - -func convertResponseFromREST(resp *confidentialcomputingpb.VerifyAttestationResponse) (*verifier.VerifyAttestationResponse, error) { - token := []byte(resp.GetOidcClaimsToken()) - return &verifier.VerifyAttestationResponse{ - ClaimsToken: token, - PartialErrs: resp.PartialErrors, - }, nil -} - -func convertOCISignatureToREST(signature oci.Signature) (*confidentialcomputingpb.ContainerImageSignature, error) { - payload, err := signature.Payload() - if err != nil { - return nil, err - } - b64Sig, err := signature.Base64Encoded() - if err != nil { - return nil, err - } - sigBytes, err := encoding.DecodeString(b64Sig) - if err != nil { - return nil, err - } - return &confidentialcomputingpb.ContainerImageSignature{ - Payload: payload, - Signature: sigBytes, - }, nil -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest_network_test.go b/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest_network_test.go deleted file mode 100644 index bb56688b3..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest_network_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package rest - -import ( - "context" - "log" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm-tools/launcher/agent" - "github.com/google/go-tpm-tools/launcher/internal/signaturediscovery" - "github.com/google/go-tpm-tools/launcher/spec" - "github.com/google/go-tpm-tools/launcher/verifier" - "golang.org/x/oauth2/google" - "google.golang.org/api/option" -) - -var ( - fakeProject = "confidentialcomputing-e2e" - fakeRegion = "us-central1" -) - -// Skip the test if we are not running in an environment with Google API -func testClient(t *testing.T) verifier.Client { - // TODO: Connect to the autopush endpoint by default. - hClient, err := google.DefaultClient(context.Background()) - if err != nil { - t.Skipf("Getting HTTP Client: %v", err) - } - - vClient, err := NewClient(context.Background(), - fakeProject, - fakeRegion, - option.WithHTTPClient(hClient), - ) - if err != nil { - t.Fatalf("Creating Verifier Client: %v", err) - } - return vClient -} - -func testPrincipalIDTokenFetcher(_ string) ([][]byte, error) { - return [][]byte{}, nil -} - -func TestWithAgent(t *testing.T) { - vClient := testClient(t) - - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - agent := agent.CreateAttestationAgent(tpm, client.AttestationKeyECC, vClient, testPrincipalIDTokenFetcher, signaturediscovery.NewFakeClient(), spec.LaunchSpec{}, log.Default()) - token, err := agent.Attest(context.Background()) - if err != nil { - t.Errorf("failed to attest to Attestation Service: %v", err) - } - t.Logf("Got Token: |%v|", string(token)) -} diff --git a/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest_test.go b/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest_test.go deleted file mode 100644 index 8b0f97a9a..000000000 --- a/vendor/github.com/google/go-tpm-tools/launcher/verifier/rest/rest_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package rest - -import ( - "testing" - - confidentialcomputingpb "cloud.google.com/go/confidentialcomputing/apiv1/confidentialcomputingpb" - "github.com/google/go-tpm-tools/launcher/verifier" -) - -// Make sure our conversion function can handle empty values. -func TestConvertEmpty(t *testing.T) { - if _, err := convertChallengeFromREST(&confidentialcomputingpb.Challenge{}); err != nil { - t.Errorf("Converting empty challenge: %v", err) - } - _ = convertRequestToREST(verifier.VerifyAttestationRequest{}) - if _, err := convertResponseFromREST(&confidentialcomputingpb.VerifyAttestationResponse{}); err != nil { - t.Errorf("Converting empty challenge: %v", err) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/proto/attest.proto b/vendor/github.com/google/go-tpm-tools/proto/attest.proto deleted file mode 100644 index fae794322..000000000 --- a/vendor/github.com/google/go-tpm-tools/proto/attest.proto +++ /dev/null @@ -1,252 +0,0 @@ -syntax = "proto3"; - -package attest; - -import "proto/sevsnp.proto"; -import "proto/tdx.proto"; -import "tpm.proto"; - -option go_package = "github.com/google/go-tpm-tools/proto/attest"; - -// Information uniquely identifying a GCE instance. Can be used to create an -// instance URL, which can then be used with GCE APIs. Formatted like: -// https://www.googleapis.com/compute/v1/projects/{project_id}/zones/{zone}/instances/{instance_name} -message GCEInstanceInfo { - string zone = 1; - string project_id = 2; - uint64 project_number = 3; - string instance_name = 4; - uint64 instance_id = 5; -} - -message Attestation { - // Attestation Key (AK) Public Area, encoded as a TPMT_PUBLIC - bytes ak_pub = 1; - // Quotes over all supported PCR banks - repeated tpm.Quote quotes = 2; - // TCG Event Log, encoded in the raw binary format. - // Can be SHA-1 or crypto-agile. - bytes event_log = 3; - // Optional information about a GCE instance, unused outside of GCE - GCEInstanceInfo instance_info = 4; - // A TCG Canonical Event Log. - bytes canonical_event_log = 5; - // Attestation Key (AK) Certificate, encoded as ASN.1 DER. - // Optional. - bytes ak_cert = 6; - // Intermediate Certificates for verifying the AK Certificate, encoded as - // ASN.1 DER. Optional. - repeated bytes intermediate_certs = 7; - // Trusted execution environment attestation is a secondary platform - // attestation that the machine is running within a particular confidential - // environment. - oneof tee_attestation { - sevsnp.Attestation sev_snp_attestation = 8; - tdx.QuoteV4 tdx_attestation = 9; - } -} - -// Type of hardware technology used to protect this instance -enum GCEConfidentialTechnology { - NONE = 0; - AMD_SEV = 1; - AMD_SEV_ES = 2; - INTEL_TDX = 3; - AMD_SEV_SNP = 4; -} - -// The platform/firmware state for this instance -message PlatformState { - oneof firmware { - // Raw S-CRTM version identifier (EV_S_CRTM_VERSION) - bytes scrtm_version_id = 1; - // Virtual GCE firmware version (parsed from S-CRTM version id) - uint32 gce_version = 2; - } - // Set to NONE on non-GCE instances or non-Confidential Shielded GCE instances - GCEConfidentialTechnology technology = 3; - // Only set for GCE instances - GCEInstanceInfo instance_info = 4; -} - -message GrubFile { - // The digest of the file (pulled from the raw event digest). - bytes digest = 1; - // The event data. This is not measured, so it is untrusted. - bytes untrusted_filename = 2; -} - -message GrubState { - // All GRUB-read and measured files, including grub.cfg. - repeated GrubFile files = 1; - // A list of executed GRUB commands and command lines passed to the kernel - // and kernel modules. - repeated string commands = 2; -} - -// The state of the Linux kernel. -// At the moment, parsing LinuxKernelState relies on parsing the GrubState. -// To do so, use ParseOpts{Loader: GRUB} when calling ParseMachineState. -message LinuxKernelState { - // The kernel command line. - string command_line = 1; -} - -// A parsed event from the TCG event log -message Event { - // The Platform Control Register (PCR) this event was extended into. - uint32 pcr_index = 1; - // The type of this event. Note that this value is not verified, so it should - // only be used as a hint during event parsing. - uint32 untrusted_type = 2; - // The raw data associated to this event. The meaning of this data is - // specific to the type of the event. - bytes data = 3; - // The event digest actually extended into the TPM. This is often the hash of - // the data field, but in some cases it may have a type-specific calculation. - bytes digest = 4; - // This is true if hash(data) == digest. - bool digest_verified = 5; -} - -// Common, publicly-listed certificates by different vendors. -enum WellKnownCertificate { - UNKNOWN = 0; - - // Microsoft certs: - // https://go.microsoft.com/fwlink/p/?linkid=321192 - MS_WINDOWS_PROD_PCA_2011 = 1; - // https://go.microsoft.com/fwlink/p/?linkid=321194 - MS_THIRD_PARTY_UEFI_CA_2011 = 2; -} - -message Certificate { - // The representation of the certificate. If the certificate matches a - // well-known certificate above, representation should contain the value in - // the enum. Otherwise, it will contain the raw DER. - oneof representation { - // DER representation of the certificate. - bytes der = 1; - WellKnownCertificate well_known = 2; - } -} - -// A Secure Boot database containing lists of hashes and certificates, -// as defined by section 32.4.1 Signature Database in the UEFI spec. -message Database { - repeated Certificate certs = 1; - repeated bytes hashes = 2; -} - -// The Secure Boot state for this instance. -message SecureBootState { - // Whether Secure Boot is enabled. - bool enabled = 1; - // The Secure Boot signature (allowed) database. - Database db = 2; - // The Secure Boot revoked signature (forbidden) database. - Database dbx = 3; - // Authority events post-separator. Pre-separator authorities - // are currently not supported. - Database authority = 4; -} - -// The container's restart policy. -// See the following Kubernetes documentation for more details: -// https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy -// Note that these enum variants do not conform to the standard Protocol Buffers -// Style Guide so that RestartPolicy_name, RestartPolicy_value, and -// RestartPolicy.String() match the values used by Kubernetes and others. -enum RestartPolicy { - Always = 0; - OnFailure = 1; - Never = 2; -} - -message ContainerState { - string image_reference = 1; - // Digest of the registry's image manifest, which contains a list of the - // layers comprising the image. - string image_digest = 2; - RestartPolicy restart_policy = 3; - // Digest of the local image configuration object, containing config items - // such as local layer digests. - string image_id = 4; - repeated string args = 5; - map env_vars = 6; - // Record operator input Env Vars and Args, should be subsets of the above - // Env Vars and Args. - repeated string overridden_args = 7; - map overridden_env_vars = 8; -} - -message SemanticVersion { - uint32 major = 1; - uint32 minor = 2; - uint32 patch = 3; -} - -message AttestedCosState { - ContainerState container = 1; - SemanticVersion cos_version = 2; - SemanticVersion launcher_version = 3; -} - -message EfiApp { - // The PE/COFF digest of the EFI application (pulled from the raw event digest). - bytes digest = 1; -} - -// The verified state of EFI Applications. Policy usage on this machine state -// should check the entire set of EFI App digests matches, not a subset. -message EfiState { - // UEFI's OS Loader code is required to measure attempts to load and execute - // UEFI applications. - // UEFI applications are typically bootloaders such as shim and GRUB. - // These run and are measured using the UEFI LoadImage() service. - repeated EfiApp apps = 1; -} - -// The verified state of a booted machine, obtained from an Attestation -message MachineState { - PlatformState platform = 1; - - SecureBootState secure_boot = 2; - - // The complete parsed TCG Event Log, including those events used to - // create the PlatformState. - repeated Event raw_events = 3; - // The hash algorithm used when verifying the Attestation. This indicates: - // - which PCR bank was used for for quote validation and event log replay - // - the hash algorithm used to calculate event digests - tpm.HashAlgo hash = 4; - - GrubState grub = 5; - - LinuxKernelState linux_kernel = 6; - - AttestedCosState cos = 7; - - EfiState efi = 8; -} - -// A policy dictating which values of PlatformState to allow -message PlatformPolicy { - // If PlatformState.firmware contains a scrtm_version_id, it must appear - // in this list. For use with a GCE VM, minimum_gce_firmware_version is - // often a better alternative. - repeated bytes allowed_scrtm_version_ids = 1; - // If PlatformState.firmware contains a minimum_gce_firmware_version, it must - // be greater than or equal to this value. Currently, the max version is 1. - uint32 minimum_gce_firmware_version = 2; - // The PlatformState's technology must be at least as secure as - // the specified minimum_technology (i.e. AMD_SEV_ES > AMD_SEV > NONE). - GCEConfidentialTechnology minimum_technology = 3; -} - -// A policy dictating which type of MachineStates to allow -message Policy { - PlatformPolicy platform = 1; - - // SecureBootPolicy secure_boot = 2; -} diff --git a/vendor/github.com/google/go-tpm-tools/proto/attest/attest.pb.go b/vendor/github.com/google/go-tpm-tools/proto/attest/attest.pb.go deleted file mode 100644 index 6de28cfaa..000000000 --- a/vendor/github.com/google/go-tpm-tools/proto/attest/attest.pb.go +++ /dev/null @@ -1,2125 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc v3.21.12 -// source: attest.proto - -package attest - -import ( - sevsnp "github.com/google/go-sev-guest/proto/sevsnp" - tdx "github.com/google/go-tdx-guest/proto/tdx" - tpm "github.com/google/go-tpm-tools/proto/tpm" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Type of hardware technology used to protect this instance -type GCEConfidentialTechnology int32 - -const ( - GCEConfidentialTechnology_NONE GCEConfidentialTechnology = 0 - GCEConfidentialTechnology_AMD_SEV GCEConfidentialTechnology = 1 - GCEConfidentialTechnology_AMD_SEV_ES GCEConfidentialTechnology = 2 - GCEConfidentialTechnology_INTEL_TDX GCEConfidentialTechnology = 3 - GCEConfidentialTechnology_AMD_SEV_SNP GCEConfidentialTechnology = 4 -) - -// Enum value maps for GCEConfidentialTechnology. -var ( - GCEConfidentialTechnology_name = map[int32]string{ - 0: "NONE", - 1: "AMD_SEV", - 2: "AMD_SEV_ES", - 3: "INTEL_TDX", - 4: "AMD_SEV_SNP", - } - GCEConfidentialTechnology_value = map[string]int32{ - "NONE": 0, - "AMD_SEV": 1, - "AMD_SEV_ES": 2, - "INTEL_TDX": 3, - "AMD_SEV_SNP": 4, - } -) - -func (x GCEConfidentialTechnology) Enum() *GCEConfidentialTechnology { - p := new(GCEConfidentialTechnology) - *p = x - return p -} - -func (x GCEConfidentialTechnology) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (GCEConfidentialTechnology) Descriptor() protoreflect.EnumDescriptor { - return file_attest_proto_enumTypes[0].Descriptor() -} - -func (GCEConfidentialTechnology) Type() protoreflect.EnumType { - return &file_attest_proto_enumTypes[0] -} - -func (x GCEConfidentialTechnology) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use GCEConfidentialTechnology.Descriptor instead. -func (GCEConfidentialTechnology) EnumDescriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{0} -} - -// Common, publicly-listed certificates by different vendors. -type WellKnownCertificate int32 - -const ( - WellKnownCertificate_UNKNOWN WellKnownCertificate = 0 - // Microsoft certs: - // https://go.microsoft.com/fwlink/p/?linkid=321192 - WellKnownCertificate_MS_WINDOWS_PROD_PCA_2011 WellKnownCertificate = 1 - // https://go.microsoft.com/fwlink/p/?linkid=321194 - WellKnownCertificate_MS_THIRD_PARTY_UEFI_CA_2011 WellKnownCertificate = 2 -) - -// Enum value maps for WellKnownCertificate. -var ( - WellKnownCertificate_name = map[int32]string{ - 0: "UNKNOWN", - 1: "MS_WINDOWS_PROD_PCA_2011", - 2: "MS_THIRD_PARTY_UEFI_CA_2011", - } - WellKnownCertificate_value = map[string]int32{ - "UNKNOWN": 0, - "MS_WINDOWS_PROD_PCA_2011": 1, - "MS_THIRD_PARTY_UEFI_CA_2011": 2, - } -) - -func (x WellKnownCertificate) Enum() *WellKnownCertificate { - p := new(WellKnownCertificate) - *p = x - return p -} - -func (x WellKnownCertificate) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (WellKnownCertificate) Descriptor() protoreflect.EnumDescriptor { - return file_attest_proto_enumTypes[1].Descriptor() -} - -func (WellKnownCertificate) Type() protoreflect.EnumType { - return &file_attest_proto_enumTypes[1] -} - -func (x WellKnownCertificate) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use WellKnownCertificate.Descriptor instead. -func (WellKnownCertificate) EnumDescriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{1} -} - -// The container's restart policy. -// See the following Kubernetes documentation for more details: -// https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy -// Note that these enum variants do not conform to the standard Protocol Buffers -// Style Guide so that RestartPolicy_name, RestartPolicy_value, and -// RestartPolicy.String() match the values used by Kubernetes and others. -type RestartPolicy int32 - -const ( - RestartPolicy_Always RestartPolicy = 0 - RestartPolicy_OnFailure RestartPolicy = 1 - RestartPolicy_Never RestartPolicy = 2 -) - -// Enum value maps for RestartPolicy. -var ( - RestartPolicy_name = map[int32]string{ - 0: "Always", - 1: "OnFailure", - 2: "Never", - } - RestartPolicy_value = map[string]int32{ - "Always": 0, - "OnFailure": 1, - "Never": 2, - } -) - -func (x RestartPolicy) Enum() *RestartPolicy { - p := new(RestartPolicy) - *p = x - return p -} - -func (x RestartPolicy) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RestartPolicy) Descriptor() protoreflect.EnumDescriptor { - return file_attest_proto_enumTypes[2].Descriptor() -} - -func (RestartPolicy) Type() protoreflect.EnumType { - return &file_attest_proto_enumTypes[2] -} - -func (x RestartPolicy) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RestartPolicy.Descriptor instead. -func (RestartPolicy) EnumDescriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{2} -} - -// Information uniquely identifying a GCE instance. Can be used to create an -// instance URL, which can then be used with GCE APIs. Formatted like: -// -// https://www.googleapis.com/compute/v1/projects/{project_id}/zones/{zone}/instances/{instance_name} -type GCEInstanceInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Zone string `protobuf:"bytes,1,opt,name=zone,proto3" json:"zone,omitempty"` - ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` - ProjectNumber uint64 `protobuf:"varint,3,opt,name=project_number,json=projectNumber,proto3" json:"project_number,omitempty"` - InstanceName string `protobuf:"bytes,4,opt,name=instance_name,json=instanceName,proto3" json:"instance_name,omitempty"` - InstanceId uint64 `protobuf:"varint,5,opt,name=instance_id,json=instanceId,proto3" json:"instance_id,omitempty"` -} - -func (x *GCEInstanceInfo) Reset() { - *x = GCEInstanceInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GCEInstanceInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GCEInstanceInfo) ProtoMessage() {} - -func (x *GCEInstanceInfo) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GCEInstanceInfo.ProtoReflect.Descriptor instead. -func (*GCEInstanceInfo) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{0} -} - -func (x *GCEInstanceInfo) GetZone() string { - if x != nil { - return x.Zone - } - return "" -} - -func (x *GCEInstanceInfo) GetProjectId() string { - if x != nil { - return x.ProjectId - } - return "" -} - -func (x *GCEInstanceInfo) GetProjectNumber() uint64 { - if x != nil { - return x.ProjectNumber - } - return 0 -} - -func (x *GCEInstanceInfo) GetInstanceName() string { - if x != nil { - return x.InstanceName - } - return "" -} - -func (x *GCEInstanceInfo) GetInstanceId() uint64 { - if x != nil { - return x.InstanceId - } - return 0 -} - -type Attestation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Attestation Key (AK) Public Area, encoded as a TPMT_PUBLIC - AkPub []byte `protobuf:"bytes,1,opt,name=ak_pub,json=akPub,proto3" json:"ak_pub,omitempty"` - // Quotes over all supported PCR banks - Quotes []*tpm.Quote `protobuf:"bytes,2,rep,name=quotes,proto3" json:"quotes,omitempty"` - // TCG Event Log, encoded in the raw binary format. - // Can be SHA-1 or crypto-agile. - EventLog []byte `protobuf:"bytes,3,opt,name=event_log,json=eventLog,proto3" json:"event_log,omitempty"` - // Optional information about a GCE instance, unused outside of GCE - InstanceInfo *GCEInstanceInfo `protobuf:"bytes,4,opt,name=instance_info,json=instanceInfo,proto3" json:"instance_info,omitempty"` - // A TCG Canonical Event Log. - CanonicalEventLog []byte `protobuf:"bytes,5,opt,name=canonical_event_log,json=canonicalEventLog,proto3" json:"canonical_event_log,omitempty"` - // Attestation Key (AK) Certificate, encoded as ASN.1 DER. - // Optional. - AkCert []byte `protobuf:"bytes,6,opt,name=ak_cert,json=akCert,proto3" json:"ak_cert,omitempty"` - // Intermediate Certificates for verifying the AK Certificate, encoded as - // ASN.1 DER. Optional. - IntermediateCerts [][]byte `protobuf:"bytes,7,rep,name=intermediate_certs,json=intermediateCerts,proto3" json:"intermediate_certs,omitempty"` - // Trusted execution environment attestation is a secondary platform - // attestation that the machine is running within a particular confidential - // environment. - // - // Types that are assignable to TeeAttestation: - // - // *Attestation_SevSnpAttestation - // *Attestation_TdxAttestation - TeeAttestation isAttestation_TeeAttestation `protobuf_oneof:"tee_attestation"` -} - -func (x *Attestation) Reset() { - *x = Attestation{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Attestation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Attestation) ProtoMessage() {} - -func (x *Attestation) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Attestation.ProtoReflect.Descriptor instead. -func (*Attestation) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{1} -} - -func (x *Attestation) GetAkPub() []byte { - if x != nil { - return x.AkPub - } - return nil -} - -func (x *Attestation) GetQuotes() []*tpm.Quote { - if x != nil { - return x.Quotes - } - return nil -} - -func (x *Attestation) GetEventLog() []byte { - if x != nil { - return x.EventLog - } - return nil -} - -func (x *Attestation) GetInstanceInfo() *GCEInstanceInfo { - if x != nil { - return x.InstanceInfo - } - return nil -} - -func (x *Attestation) GetCanonicalEventLog() []byte { - if x != nil { - return x.CanonicalEventLog - } - return nil -} - -func (x *Attestation) GetAkCert() []byte { - if x != nil { - return x.AkCert - } - return nil -} - -func (x *Attestation) GetIntermediateCerts() [][]byte { - if x != nil { - return x.IntermediateCerts - } - return nil -} - -func (m *Attestation) GetTeeAttestation() isAttestation_TeeAttestation { - if m != nil { - return m.TeeAttestation - } - return nil -} - -func (x *Attestation) GetSevSnpAttestation() *sevsnp.Attestation { - if x, ok := x.GetTeeAttestation().(*Attestation_SevSnpAttestation); ok { - return x.SevSnpAttestation - } - return nil -} - -func (x *Attestation) GetTdxAttestation() *tdx.QuoteV4 { - if x, ok := x.GetTeeAttestation().(*Attestation_TdxAttestation); ok { - return x.TdxAttestation - } - return nil -} - -type isAttestation_TeeAttestation interface { - isAttestation_TeeAttestation() -} - -type Attestation_SevSnpAttestation struct { - SevSnpAttestation *sevsnp.Attestation `protobuf:"bytes,8,opt,name=sev_snp_attestation,json=sevSnpAttestation,proto3,oneof"` -} - -type Attestation_TdxAttestation struct { - TdxAttestation *tdx.QuoteV4 `protobuf:"bytes,9,opt,name=tdx_attestation,json=tdxAttestation,proto3,oneof"` -} - -func (*Attestation_SevSnpAttestation) isAttestation_TeeAttestation() {} - -func (*Attestation_TdxAttestation) isAttestation_TeeAttestation() {} - -// The platform/firmware state for this instance -type PlatformState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Firmware: - // - // *PlatformState_ScrtmVersionId - // *PlatformState_GceVersion - Firmware isPlatformState_Firmware `protobuf_oneof:"firmware"` - // Set to NONE on non-GCE instances or non-Confidential Shielded GCE instances - Technology GCEConfidentialTechnology `protobuf:"varint,3,opt,name=technology,proto3,enum=attest.GCEConfidentialTechnology" json:"technology,omitempty"` - // Only set for GCE instances - InstanceInfo *GCEInstanceInfo `protobuf:"bytes,4,opt,name=instance_info,json=instanceInfo,proto3" json:"instance_info,omitempty"` -} - -func (x *PlatformState) Reset() { - *x = PlatformState{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PlatformState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PlatformState) ProtoMessage() {} - -func (x *PlatformState) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PlatformState.ProtoReflect.Descriptor instead. -func (*PlatformState) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{2} -} - -func (m *PlatformState) GetFirmware() isPlatformState_Firmware { - if m != nil { - return m.Firmware - } - return nil -} - -func (x *PlatformState) GetScrtmVersionId() []byte { - if x, ok := x.GetFirmware().(*PlatformState_ScrtmVersionId); ok { - return x.ScrtmVersionId - } - return nil -} - -func (x *PlatformState) GetGceVersion() uint32 { - if x, ok := x.GetFirmware().(*PlatformState_GceVersion); ok { - return x.GceVersion - } - return 0 -} - -func (x *PlatformState) GetTechnology() GCEConfidentialTechnology { - if x != nil { - return x.Technology - } - return GCEConfidentialTechnology_NONE -} - -func (x *PlatformState) GetInstanceInfo() *GCEInstanceInfo { - if x != nil { - return x.InstanceInfo - } - return nil -} - -type isPlatformState_Firmware interface { - isPlatformState_Firmware() -} - -type PlatformState_ScrtmVersionId struct { - // Raw S-CRTM version identifier (EV_S_CRTM_VERSION) - ScrtmVersionId []byte `protobuf:"bytes,1,opt,name=scrtm_version_id,json=scrtmVersionId,proto3,oneof"` -} - -type PlatformState_GceVersion struct { - // Virtual GCE firmware version (parsed from S-CRTM version id) - GceVersion uint32 `protobuf:"varint,2,opt,name=gce_version,json=gceVersion,proto3,oneof"` -} - -func (*PlatformState_ScrtmVersionId) isPlatformState_Firmware() {} - -func (*PlatformState_GceVersion) isPlatformState_Firmware() {} - -type GrubFile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The digest of the file (pulled from the raw event digest). - Digest []byte `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` - // The event data. This is not measured, so it is untrusted. - UntrustedFilename []byte `protobuf:"bytes,2,opt,name=untrusted_filename,json=untrustedFilename,proto3" json:"untrusted_filename,omitempty"` -} - -func (x *GrubFile) Reset() { - *x = GrubFile{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrubFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrubFile) ProtoMessage() {} - -func (x *GrubFile) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrubFile.ProtoReflect.Descriptor instead. -func (*GrubFile) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{3} -} - -func (x *GrubFile) GetDigest() []byte { - if x != nil { - return x.Digest - } - return nil -} - -func (x *GrubFile) GetUntrustedFilename() []byte { - if x != nil { - return x.UntrustedFilename - } - return nil -} - -type GrubState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // All GRUB-read and measured files, including grub.cfg. - Files []*GrubFile `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` - // A list of executed GRUB commands and command lines passed to the kernel - // and kernel modules. - Commands []string `protobuf:"bytes,2,rep,name=commands,proto3" json:"commands,omitempty"` -} - -func (x *GrubState) Reset() { - *x = GrubState{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GrubState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrubState) ProtoMessage() {} - -func (x *GrubState) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrubState.ProtoReflect.Descriptor instead. -func (*GrubState) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{4} -} - -func (x *GrubState) GetFiles() []*GrubFile { - if x != nil { - return x.Files - } - return nil -} - -func (x *GrubState) GetCommands() []string { - if x != nil { - return x.Commands - } - return nil -} - -// The state of the Linux kernel. -// At the moment, parsing LinuxKernelState relies on parsing the GrubState. -// To do so, use ParseOpts{Loader: GRUB} when calling ParseMachineState. -type LinuxKernelState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The kernel command line. - CommandLine string `protobuf:"bytes,1,opt,name=command_line,json=commandLine,proto3" json:"command_line,omitempty"` -} - -func (x *LinuxKernelState) Reset() { - *x = LinuxKernelState{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LinuxKernelState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LinuxKernelState) ProtoMessage() {} - -func (x *LinuxKernelState) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LinuxKernelState.ProtoReflect.Descriptor instead. -func (*LinuxKernelState) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{5} -} - -func (x *LinuxKernelState) GetCommandLine() string { - if x != nil { - return x.CommandLine - } - return "" -} - -// A parsed event from the TCG event log -type Event struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The Platform Control Register (PCR) this event was extended into. - PcrIndex uint32 `protobuf:"varint,1,opt,name=pcr_index,json=pcrIndex,proto3" json:"pcr_index,omitempty"` - // The type of this event. Note that this value is not verified, so it should - // only be used as a hint during event parsing. - UntrustedType uint32 `protobuf:"varint,2,opt,name=untrusted_type,json=untrustedType,proto3" json:"untrusted_type,omitempty"` - // The raw data associated to this event. The meaning of this data is - // specific to the type of the event. - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - // The event digest actually extended into the TPM. This is often the hash of - // the data field, but in some cases it may have a type-specific calculation. - Digest []byte `protobuf:"bytes,4,opt,name=digest,proto3" json:"digest,omitempty"` - // This is true if hash(data) == digest. - DigestVerified bool `protobuf:"varint,5,opt,name=digest_verified,json=digestVerified,proto3" json:"digest_verified,omitempty"` -} - -func (x *Event) Reset() { - *x = Event{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Event) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Event) ProtoMessage() {} - -func (x *Event) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Event.ProtoReflect.Descriptor instead. -func (*Event) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{6} -} - -func (x *Event) GetPcrIndex() uint32 { - if x != nil { - return x.PcrIndex - } - return 0 -} - -func (x *Event) GetUntrustedType() uint32 { - if x != nil { - return x.UntrustedType - } - return 0 -} - -func (x *Event) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *Event) GetDigest() []byte { - if x != nil { - return x.Digest - } - return nil -} - -func (x *Event) GetDigestVerified() bool { - if x != nil { - return x.DigestVerified - } - return false -} - -type Certificate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The representation of the certificate. If the certificate matches a - // well-known certificate above, representation should contain the value in - // the enum. Otherwise, it will contain the raw DER. - // - // Types that are assignable to Representation: - // - // *Certificate_Der - // *Certificate_WellKnown - Representation isCertificate_Representation `protobuf_oneof:"representation"` -} - -func (x *Certificate) Reset() { - *x = Certificate{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Certificate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Certificate) ProtoMessage() {} - -func (x *Certificate) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Certificate.ProtoReflect.Descriptor instead. -func (*Certificate) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{7} -} - -func (m *Certificate) GetRepresentation() isCertificate_Representation { - if m != nil { - return m.Representation - } - return nil -} - -func (x *Certificate) GetDer() []byte { - if x, ok := x.GetRepresentation().(*Certificate_Der); ok { - return x.Der - } - return nil -} - -func (x *Certificate) GetWellKnown() WellKnownCertificate { - if x, ok := x.GetRepresentation().(*Certificate_WellKnown); ok { - return x.WellKnown - } - return WellKnownCertificate_UNKNOWN -} - -type isCertificate_Representation interface { - isCertificate_Representation() -} - -type Certificate_Der struct { - // DER representation of the certificate. - Der []byte `protobuf:"bytes,1,opt,name=der,proto3,oneof"` -} - -type Certificate_WellKnown struct { - WellKnown WellKnownCertificate `protobuf:"varint,2,opt,name=well_known,json=wellKnown,proto3,enum=attest.WellKnownCertificate,oneof"` -} - -func (*Certificate_Der) isCertificate_Representation() {} - -func (*Certificate_WellKnown) isCertificate_Representation() {} - -// A Secure Boot database containing lists of hashes and certificates, -// as defined by section 32.4.1 Signature Database in the UEFI spec. -type Database struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Certs []*Certificate `protobuf:"bytes,1,rep,name=certs,proto3" json:"certs,omitempty"` - Hashes [][]byte `protobuf:"bytes,2,rep,name=hashes,proto3" json:"hashes,omitempty"` -} - -func (x *Database) Reset() { - *x = Database{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Database) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Database) ProtoMessage() {} - -func (x *Database) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Database.ProtoReflect.Descriptor instead. -func (*Database) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{8} -} - -func (x *Database) GetCerts() []*Certificate { - if x != nil { - return x.Certs - } - return nil -} - -func (x *Database) GetHashes() [][]byte { - if x != nil { - return x.Hashes - } - return nil -} - -// The Secure Boot state for this instance. -type SecureBootState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Whether Secure Boot is enabled. - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - // The Secure Boot signature (allowed) database. - Db *Database `protobuf:"bytes,2,opt,name=db,proto3" json:"db,omitempty"` - // The Secure Boot revoked signature (forbidden) database. - Dbx *Database `protobuf:"bytes,3,opt,name=dbx,proto3" json:"dbx,omitempty"` - // Authority events post-separator. Pre-separator authorities - // are currently not supported. - Authority *Database `protobuf:"bytes,4,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (x *SecureBootState) Reset() { - *x = SecureBootState{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecureBootState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecureBootState) ProtoMessage() {} - -func (x *SecureBootState) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecureBootState.ProtoReflect.Descriptor instead. -func (*SecureBootState) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{9} -} - -func (x *SecureBootState) GetEnabled() bool { - if x != nil { - return x.Enabled - } - return false -} - -func (x *SecureBootState) GetDb() *Database { - if x != nil { - return x.Db - } - return nil -} - -func (x *SecureBootState) GetDbx() *Database { - if x != nil { - return x.Dbx - } - return nil -} - -func (x *SecureBootState) GetAuthority() *Database { - if x != nil { - return x.Authority - } - return nil -} - -type ContainerState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ImageReference string `protobuf:"bytes,1,opt,name=image_reference,json=imageReference,proto3" json:"image_reference,omitempty"` - // Digest of the registry's image manifest, which contains a list of the - // layers comprising the image. - ImageDigest string `protobuf:"bytes,2,opt,name=image_digest,json=imageDigest,proto3" json:"image_digest,omitempty"` - RestartPolicy RestartPolicy `protobuf:"varint,3,opt,name=restart_policy,json=restartPolicy,proto3,enum=attest.RestartPolicy" json:"restart_policy,omitempty"` - // Digest of the local image configuration object, containing config items - // such as local layer digests. - ImageId string `protobuf:"bytes,4,opt,name=image_id,json=imageId,proto3" json:"image_id,omitempty"` - Args []string `protobuf:"bytes,5,rep,name=args,proto3" json:"args,omitempty"` - EnvVars map[string]string `protobuf:"bytes,6,rep,name=env_vars,json=envVars,proto3" json:"env_vars,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Record operator input Env Vars and Args, should be subsets of the above - // Env Vars and Args. - OverriddenArgs []string `protobuf:"bytes,7,rep,name=overridden_args,json=overriddenArgs,proto3" json:"overridden_args,omitempty"` - OverriddenEnvVars map[string]string `protobuf:"bytes,8,rep,name=overridden_env_vars,json=overriddenEnvVars,proto3" json:"overridden_env_vars,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *ContainerState) Reset() { - *x = ContainerState{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContainerState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContainerState) ProtoMessage() {} - -func (x *ContainerState) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContainerState.ProtoReflect.Descriptor instead. -func (*ContainerState) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{10} -} - -func (x *ContainerState) GetImageReference() string { - if x != nil { - return x.ImageReference - } - return "" -} - -func (x *ContainerState) GetImageDigest() string { - if x != nil { - return x.ImageDigest - } - return "" -} - -func (x *ContainerState) GetRestartPolicy() RestartPolicy { - if x != nil { - return x.RestartPolicy - } - return RestartPolicy_Always -} - -func (x *ContainerState) GetImageId() string { - if x != nil { - return x.ImageId - } - return "" -} - -func (x *ContainerState) GetArgs() []string { - if x != nil { - return x.Args - } - return nil -} - -func (x *ContainerState) GetEnvVars() map[string]string { - if x != nil { - return x.EnvVars - } - return nil -} - -func (x *ContainerState) GetOverriddenArgs() []string { - if x != nil { - return x.OverriddenArgs - } - return nil -} - -func (x *ContainerState) GetOverriddenEnvVars() map[string]string { - if x != nil { - return x.OverriddenEnvVars - } - return nil -} - -type SemanticVersion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` - Patch uint32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` -} - -func (x *SemanticVersion) Reset() { - *x = SemanticVersion{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SemanticVersion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SemanticVersion) ProtoMessage() {} - -func (x *SemanticVersion) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SemanticVersion.ProtoReflect.Descriptor instead. -func (*SemanticVersion) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{11} -} - -func (x *SemanticVersion) GetMajor() uint32 { - if x != nil { - return x.Major - } - return 0 -} - -func (x *SemanticVersion) GetMinor() uint32 { - if x != nil { - return x.Minor - } - return 0 -} - -func (x *SemanticVersion) GetPatch() uint32 { - if x != nil { - return x.Patch - } - return 0 -} - -type AttestedCosState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Container *ContainerState `protobuf:"bytes,1,opt,name=container,proto3" json:"container,omitempty"` - CosVersion *SemanticVersion `protobuf:"bytes,2,opt,name=cos_version,json=cosVersion,proto3" json:"cos_version,omitempty"` - LauncherVersion *SemanticVersion `protobuf:"bytes,3,opt,name=launcher_version,json=launcherVersion,proto3" json:"launcher_version,omitempty"` -} - -func (x *AttestedCosState) Reset() { - *x = AttestedCosState{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AttestedCosState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AttestedCosState) ProtoMessage() {} - -func (x *AttestedCosState) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AttestedCosState.ProtoReflect.Descriptor instead. -func (*AttestedCosState) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{12} -} - -func (x *AttestedCosState) GetContainer() *ContainerState { - if x != nil { - return x.Container - } - return nil -} - -func (x *AttestedCosState) GetCosVersion() *SemanticVersion { - if x != nil { - return x.CosVersion - } - return nil -} - -func (x *AttestedCosState) GetLauncherVersion() *SemanticVersion { - if x != nil { - return x.LauncherVersion - } - return nil -} - -type EfiApp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The PE/COFF digest of the EFI application (pulled from the raw event digest). - Digest []byte `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` -} - -func (x *EfiApp) Reset() { - *x = EfiApp{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EfiApp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EfiApp) ProtoMessage() {} - -func (x *EfiApp) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EfiApp.ProtoReflect.Descriptor instead. -func (*EfiApp) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{13} -} - -func (x *EfiApp) GetDigest() []byte { - if x != nil { - return x.Digest - } - return nil -} - -// The verified state of EFI Applications. Policy usage on this machine state -// should check the entire set of EFI App digests matches, not a subset. -type EfiState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // UEFI's OS Loader code is required to measure attempts to load and execute - // UEFI applications. - // UEFI applications are typically bootloaders such as shim and GRUB. - // These run and are measured using the UEFI LoadImage() service. - Apps []*EfiApp `protobuf:"bytes,1,rep,name=apps,proto3" json:"apps,omitempty"` -} - -func (x *EfiState) Reset() { - *x = EfiState{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EfiState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EfiState) ProtoMessage() {} - -func (x *EfiState) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EfiState.ProtoReflect.Descriptor instead. -func (*EfiState) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{14} -} - -func (x *EfiState) GetApps() []*EfiApp { - if x != nil { - return x.Apps - } - return nil -} - -// The verified state of a booted machine, obtained from an Attestation -type MachineState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Platform *PlatformState `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` - SecureBoot *SecureBootState `protobuf:"bytes,2,opt,name=secure_boot,json=secureBoot,proto3" json:"secure_boot,omitempty"` - // The complete parsed TCG Event Log, including those events used to - // create the PlatformState. - RawEvents []*Event `protobuf:"bytes,3,rep,name=raw_events,json=rawEvents,proto3" json:"raw_events,omitempty"` - // The hash algorithm used when verifying the Attestation. This indicates: - // - which PCR bank was used for for quote validation and event log replay - // - the hash algorithm used to calculate event digests - Hash tpm.HashAlgo `protobuf:"varint,4,opt,name=hash,proto3,enum=tpm.HashAlgo" json:"hash,omitempty"` - Grub *GrubState `protobuf:"bytes,5,opt,name=grub,proto3" json:"grub,omitempty"` - LinuxKernel *LinuxKernelState `protobuf:"bytes,6,opt,name=linux_kernel,json=linuxKernel,proto3" json:"linux_kernel,omitempty"` - Cos *AttestedCosState `protobuf:"bytes,7,opt,name=cos,proto3" json:"cos,omitempty"` - Efi *EfiState `protobuf:"bytes,8,opt,name=efi,proto3" json:"efi,omitempty"` -} - -func (x *MachineState) Reset() { - *x = MachineState{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MachineState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MachineState) ProtoMessage() {} - -func (x *MachineState) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MachineState.ProtoReflect.Descriptor instead. -func (*MachineState) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{15} -} - -func (x *MachineState) GetPlatform() *PlatformState { - if x != nil { - return x.Platform - } - return nil -} - -func (x *MachineState) GetSecureBoot() *SecureBootState { - if x != nil { - return x.SecureBoot - } - return nil -} - -func (x *MachineState) GetRawEvents() []*Event { - if x != nil { - return x.RawEvents - } - return nil -} - -func (x *MachineState) GetHash() tpm.HashAlgo { - if x != nil { - return x.Hash - } - return tpm.HashAlgo(0) -} - -func (x *MachineState) GetGrub() *GrubState { - if x != nil { - return x.Grub - } - return nil -} - -func (x *MachineState) GetLinuxKernel() *LinuxKernelState { - if x != nil { - return x.LinuxKernel - } - return nil -} - -func (x *MachineState) GetCos() *AttestedCosState { - if x != nil { - return x.Cos - } - return nil -} - -func (x *MachineState) GetEfi() *EfiState { - if x != nil { - return x.Efi - } - return nil -} - -// A policy dictating which values of PlatformState to allow -type PlatformPolicy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // If PlatformState.firmware contains a scrtm_version_id, it must appear - // in this list. For use with a GCE VM, minimum_gce_firmware_version is - // often a better alternative. - AllowedScrtmVersionIds [][]byte `protobuf:"bytes,1,rep,name=allowed_scrtm_version_ids,json=allowedScrtmVersionIds,proto3" json:"allowed_scrtm_version_ids,omitempty"` - // If PlatformState.firmware contains a minimum_gce_firmware_version, it must - // be greater than or equal to this value. Currently, the max version is 1. - MinimumGceFirmwareVersion uint32 `protobuf:"varint,2,opt,name=minimum_gce_firmware_version,json=minimumGceFirmwareVersion,proto3" json:"minimum_gce_firmware_version,omitempty"` - // The PlatformState's technology must be at least as secure as - // the specified minimum_technology (i.e. AMD_SEV_ES > AMD_SEV > NONE). - MinimumTechnology GCEConfidentialTechnology `protobuf:"varint,3,opt,name=minimum_technology,json=minimumTechnology,proto3,enum=attest.GCEConfidentialTechnology" json:"minimum_technology,omitempty"` -} - -func (x *PlatformPolicy) Reset() { - *x = PlatformPolicy{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PlatformPolicy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PlatformPolicy) ProtoMessage() {} - -func (x *PlatformPolicy) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PlatformPolicy.ProtoReflect.Descriptor instead. -func (*PlatformPolicy) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{16} -} - -func (x *PlatformPolicy) GetAllowedScrtmVersionIds() [][]byte { - if x != nil { - return x.AllowedScrtmVersionIds - } - return nil -} - -func (x *PlatformPolicy) GetMinimumGceFirmwareVersion() uint32 { - if x != nil { - return x.MinimumGceFirmwareVersion - } - return 0 -} - -func (x *PlatformPolicy) GetMinimumTechnology() GCEConfidentialTechnology { - if x != nil { - return x.MinimumTechnology - } - return GCEConfidentialTechnology_NONE -} - -// A policy dictating which type of MachineStates to allow -type Policy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Platform *PlatformPolicy `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` -} - -func (x *Policy) Reset() { - *x = Policy{} - if protoimpl.UnsafeEnabled { - mi := &file_attest_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Policy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Policy) ProtoMessage() {} - -func (x *Policy) ProtoReflect() protoreflect.Message { - mi := &file_attest_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Policy.ProtoReflect.Descriptor instead. -func (*Policy) Descriptor() ([]byte, []int) { - return file_attest_proto_rawDescGZIP(), []int{17} -} - -func (x *Policy) GetPlatform() *PlatformPolicy { - if x != nil { - return x.Platform - } - return nil -} - -var File_attest_proto protoreflect.FileDescriptor - -var file_attest_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x65, - 0x76, 0x73, 0x6e, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x74, 0x64, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x09, 0x74, 0x70, 0x6d, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb1, 0x01, 0x0a, 0x0f, 0x47, 0x43, 0x45, 0x49, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, - 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x1d, - 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x25, 0x0a, - 0x0e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, - 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x22, 0xae, 0x03, 0x0a, 0x0b, 0x41, - 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x61, 0x6b, - 0x5f, 0x70, 0x75, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x61, 0x6b, 0x50, 0x75, - 0x62, 0x12, 0x22, 0x0a, 0x06, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0a, 0x2e, 0x74, 0x70, 0x6d, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x06, 0x71, - 0x75, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, - 0x6f, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, - 0x6f, 0x67, 0x12, 0x3c, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, - 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x74, 0x74, 0x65, - 0x73, 0x74, 0x2e, 0x47, 0x43, 0x45, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x2e, 0x0a, 0x13, 0x63, 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x65, 0x76, - 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x63, - 0x61, 0x6e, 0x6f, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, - 0x12, 0x17, 0x0a, 0x07, 0x61, 0x6b, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x06, 0x61, 0x6b, 0x43, 0x65, 0x72, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, - 0x61, 0x74, 0x65, 0x43, 0x65, 0x72, 0x74, 0x73, 0x12, 0x45, 0x0a, 0x13, 0x73, 0x65, 0x76, 0x5f, - 0x73, 0x6e, 0x70, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x65, 0x76, 0x73, 0x6e, 0x70, 0x2e, 0x41, - 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x11, 0x73, 0x65, - 0x76, 0x53, 0x6e, 0x70, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x37, 0x0a, 0x0f, 0x74, 0x64, 0x78, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x64, 0x78, 0x2e, 0x51, - 0x75, 0x6f, 0x74, 0x65, 0x56, 0x34, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x64, 0x78, 0x41, 0x74, 0x74, - 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x11, 0x0a, 0x0f, 0x74, 0x65, 0x65, 0x5f, - 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xeb, 0x01, 0x0a, 0x0d, - 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x0a, - 0x10, 0x73, 0x63, 0x72, 0x74, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x63, 0x72, 0x74, 0x6d, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0b, 0x67, 0x63, 0x65, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, - 0x52, 0x0a, 0x67, 0x63, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0a, - 0x74, 0x65, 0x63, 0x68, 0x6e, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x21, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x43, 0x45, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x54, 0x65, 0x63, 0x68, 0x6e, 0x6f, 0x6c, - 0x6f, 0x67, 0x79, 0x52, 0x0a, 0x74, 0x65, 0x63, 0x68, 0x6e, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x12, - 0x3c, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, - 0x47, 0x43, 0x45, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x0a, 0x0a, - 0x08, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x22, 0x51, 0x0a, 0x08, 0x47, 0x72, 0x75, - 0x62, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, - 0x12, 0x75, 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x75, 0x6e, 0x74, 0x72, 0x75, - 0x73, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4f, 0x0a, 0x09, - 0x47, 0x72, 0x75, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x66, 0x69, 0x6c, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x47, 0x72, 0x75, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, - 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x22, 0x35, 0x0a, - 0x10, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x4b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x6c, 0x69, 0x6e, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x4c, 0x69, 0x6e, 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1b, - 0x0a, 0x09, 0x70, 0x63, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x08, 0x70, 0x63, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x25, 0x0a, 0x0e, 0x75, - 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x75, 0x6e, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x27, - 0x0a, 0x0f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, - 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x56, - 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x22, 0x72, 0x0a, 0x0b, 0x43, 0x65, 0x72, 0x74, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x03, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x03, 0x64, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0a, 0x77, 0x65, - 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, - 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, - 0x6e, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x09, - 0x77, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x42, 0x10, 0x0a, 0x0e, 0x72, 0x65, 0x70, - 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4d, 0x0a, 0x08, 0x44, - 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x63, 0x65, 0x72, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, - 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x05, 0x63, 0x65, 0x72, - 0x74, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0c, 0x52, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x22, 0xa1, 0x01, 0x0a, 0x0f, 0x53, - 0x65, 0x63, 0x75, 0x72, 0x65, 0x42, 0x6f, 0x6f, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x64, 0x62, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x61, - 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x02, 0x64, 0x62, 0x12, 0x22, 0x0a, 0x03, 0x64, 0x62, - 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, - 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x03, 0x64, 0x62, 0x78, 0x12, 0x2e, - 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, - 0x61, 0x73, 0x65, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x93, - 0x04, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x6d, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6d, - 0x61, 0x67, 0x65, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, - 0x0e, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x52, - 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0d, 0x72, 0x65, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x69, - 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, - 0x6d, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x05, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x3e, 0x0a, 0x08, 0x65, 0x6e, - 0x76, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, - 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x2e, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x07, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x76, - 0x65, 0x72, 0x72, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x41, - 0x72, 0x67, 0x73, 0x12, 0x5d, 0x0a, 0x13, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x64, 0x65, - 0x6e, 0x5f, 0x65, 0x6e, 0x76, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2d, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x64, 0x65, 0x6e, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x11, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x45, 0x6e, 0x76, 0x56, 0x61, - 0x72, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x45, 0x6e, 0x76, 0x56, 0x61, 0x72, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x44, - 0x0a, 0x16, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x45, 0x6e, 0x76, 0x56, - 0x61, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0x53, 0x0a, 0x0f, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, - 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, - 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x22, 0xc6, 0x01, 0x0a, 0x10, 0x41, 0x74, - 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, - 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x0b, 0x63, 0x6f, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x74, 0x74, 0x65, - 0x73, 0x74, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42, - 0x0a, 0x10, 0x6c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, - 0x74, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x0f, 0x6c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x20, 0x0a, 0x06, 0x45, 0x66, 0x69, 0x41, 0x70, 0x70, 0x12, 0x16, 0x0a, 0x06, - 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x64, 0x69, - 0x67, 0x65, 0x73, 0x74, 0x22, 0x2e, 0x0a, 0x08, 0x45, 0x66, 0x69, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x12, 0x22, 0x0a, 0x04, 0x61, 0x70, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x66, 0x69, 0x41, 0x70, 0x70, 0x52, 0x04, - 0x61, 0x70, 0x70, 0x73, 0x22, 0x80, 0x03, 0x0a, 0x0c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, - 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, - 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08, - 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x42, 0x6f, 0x6f, - 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x42, 0x6f, - 0x6f, 0x74, 0x12, 0x2c, 0x0a, 0x0a, 0x72, 0x61, 0x77, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x09, 0x72, 0x61, 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, - 0x12, 0x21, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, - 0x2e, 0x74, 0x70, 0x6d, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x04, 0x68, - 0x61, 0x73, 0x68, 0x12, 0x25, 0x0a, 0x04, 0x67, 0x72, 0x75, 0x62, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x72, 0x75, 0x62, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x52, 0x04, 0x67, 0x72, 0x75, 0x62, 0x12, 0x3b, 0x0a, 0x0c, 0x6c, 0x69, - 0x6e, 0x75, 0x78, 0x5f, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x4b, - 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0b, 0x6c, 0x69, 0x6e, 0x75, - 0x78, 0x4b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x12, 0x2a, 0x0a, 0x03, 0x63, 0x6f, 0x73, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x74, - 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x03, - 0x63, 0x6f, 0x73, 0x12, 0x22, 0x0a, 0x03, 0x65, 0x66, 0x69, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x66, 0x69, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x52, 0x03, 0x65, 0x66, 0x69, 0x22, 0xde, 0x01, 0x0a, 0x0e, 0x50, 0x6c, 0x61, 0x74, - 0x66, 0x6f, 0x72, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x39, 0x0a, 0x19, 0x61, 0x6c, - 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x72, 0x74, 0x6d, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x16, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x53, 0x63, 0x72, 0x74, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x3f, 0x0a, 0x1c, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, - 0x5f, 0x67, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x19, 0x6d, 0x69, 0x6e, - 0x69, 0x6d, 0x75, 0x6d, 0x47, 0x63, 0x65, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x50, 0x0a, 0x12, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, - 0x6d, 0x5f, 0x74, 0x65, 0x63, 0x68, 0x6e, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x43, 0x45, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x54, 0x65, 0x63, 0x68, 0x6e, - 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x52, 0x11, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x54, 0x65, - 0x63, 0x68, 0x6e, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x22, 0x3c, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x12, 0x32, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x6c, - 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x70, 0x6c, - 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2a, 0x62, 0x0a, 0x19, 0x47, 0x43, 0x45, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x54, 0x65, 0x63, 0x68, 0x6e, 0x6f, 0x6c, - 0x6f, 0x67, 0x79, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0b, 0x0a, - 0x07, 0x41, 0x4d, 0x44, 0x5f, 0x53, 0x45, 0x56, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x4d, - 0x44, 0x5f, 0x53, 0x45, 0x56, 0x5f, 0x45, 0x53, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, - 0x54, 0x45, 0x4c, 0x5f, 0x54, 0x44, 0x58, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x4d, 0x44, - 0x5f, 0x53, 0x45, 0x56, 0x5f, 0x53, 0x4e, 0x50, 0x10, 0x04, 0x2a, 0x62, 0x0a, 0x14, 0x57, 0x65, - 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, - 0x1c, 0x0a, 0x18, 0x4d, 0x53, 0x5f, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x50, 0x52, - 0x4f, 0x44, 0x5f, 0x50, 0x43, 0x41, 0x5f, 0x32, 0x30, 0x31, 0x31, 0x10, 0x01, 0x12, 0x1f, 0x0a, - 0x1b, 0x4d, 0x53, 0x5f, 0x54, 0x48, 0x49, 0x52, 0x44, 0x5f, 0x50, 0x41, 0x52, 0x54, 0x59, 0x5f, - 0x55, 0x45, 0x46, 0x49, 0x5f, 0x43, 0x41, 0x5f, 0x32, 0x30, 0x31, 0x31, 0x10, 0x02, 0x2a, 0x35, - 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, - 0x0a, 0x0a, 0x06, 0x41, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4f, - 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x65, - 0x76, 0x65, 0x72, 0x10, 0x02, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x67, 0x6f, 0x2d, 0x74, 0x70, - 0x6d, 0x2d, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x74, - 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_attest_proto_rawDescOnce sync.Once - file_attest_proto_rawDescData = file_attest_proto_rawDesc -) - -func file_attest_proto_rawDescGZIP() []byte { - file_attest_proto_rawDescOnce.Do(func() { - file_attest_proto_rawDescData = protoimpl.X.CompressGZIP(file_attest_proto_rawDescData) - }) - return file_attest_proto_rawDescData -} - -var file_attest_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_attest_proto_msgTypes = make([]protoimpl.MessageInfo, 20) -var file_attest_proto_goTypes = []interface{}{ - (GCEConfidentialTechnology)(0), // 0: attest.GCEConfidentialTechnology - (WellKnownCertificate)(0), // 1: attest.WellKnownCertificate - (RestartPolicy)(0), // 2: attest.RestartPolicy - (*GCEInstanceInfo)(nil), // 3: attest.GCEInstanceInfo - (*Attestation)(nil), // 4: attest.Attestation - (*PlatformState)(nil), // 5: attest.PlatformState - (*GrubFile)(nil), // 6: attest.GrubFile - (*GrubState)(nil), // 7: attest.GrubState - (*LinuxKernelState)(nil), // 8: attest.LinuxKernelState - (*Event)(nil), // 9: attest.Event - (*Certificate)(nil), // 10: attest.Certificate - (*Database)(nil), // 11: attest.Database - (*SecureBootState)(nil), // 12: attest.SecureBootState - (*ContainerState)(nil), // 13: attest.ContainerState - (*SemanticVersion)(nil), // 14: attest.SemanticVersion - (*AttestedCosState)(nil), // 15: attest.AttestedCosState - (*EfiApp)(nil), // 16: attest.EfiApp - (*EfiState)(nil), // 17: attest.EfiState - (*MachineState)(nil), // 18: attest.MachineState - (*PlatformPolicy)(nil), // 19: attest.PlatformPolicy - (*Policy)(nil), // 20: attest.Policy - nil, // 21: attest.ContainerState.EnvVarsEntry - nil, // 22: attest.ContainerState.OverriddenEnvVarsEntry - (*tpm.Quote)(nil), // 23: tpm.Quote - (*sevsnp.Attestation)(nil), // 24: sevsnp.Attestation - (*tdx.QuoteV4)(nil), // 25: tdx.QuoteV4 - (tpm.HashAlgo)(0), // 26: tpm.HashAlgo -} -var file_attest_proto_depIdxs = []int32{ - 23, // 0: attest.Attestation.quotes:type_name -> tpm.Quote - 3, // 1: attest.Attestation.instance_info:type_name -> attest.GCEInstanceInfo - 24, // 2: attest.Attestation.sev_snp_attestation:type_name -> sevsnp.Attestation - 25, // 3: attest.Attestation.tdx_attestation:type_name -> tdx.QuoteV4 - 0, // 4: attest.PlatformState.technology:type_name -> attest.GCEConfidentialTechnology - 3, // 5: attest.PlatformState.instance_info:type_name -> attest.GCEInstanceInfo - 6, // 6: attest.GrubState.files:type_name -> attest.GrubFile - 1, // 7: attest.Certificate.well_known:type_name -> attest.WellKnownCertificate - 10, // 8: attest.Database.certs:type_name -> attest.Certificate - 11, // 9: attest.SecureBootState.db:type_name -> attest.Database - 11, // 10: attest.SecureBootState.dbx:type_name -> attest.Database - 11, // 11: attest.SecureBootState.authority:type_name -> attest.Database - 2, // 12: attest.ContainerState.restart_policy:type_name -> attest.RestartPolicy - 21, // 13: attest.ContainerState.env_vars:type_name -> attest.ContainerState.EnvVarsEntry - 22, // 14: attest.ContainerState.overridden_env_vars:type_name -> attest.ContainerState.OverriddenEnvVarsEntry - 13, // 15: attest.AttestedCosState.container:type_name -> attest.ContainerState - 14, // 16: attest.AttestedCosState.cos_version:type_name -> attest.SemanticVersion - 14, // 17: attest.AttestedCosState.launcher_version:type_name -> attest.SemanticVersion - 16, // 18: attest.EfiState.apps:type_name -> attest.EfiApp - 5, // 19: attest.MachineState.platform:type_name -> attest.PlatformState - 12, // 20: attest.MachineState.secure_boot:type_name -> attest.SecureBootState - 9, // 21: attest.MachineState.raw_events:type_name -> attest.Event - 26, // 22: attest.MachineState.hash:type_name -> tpm.HashAlgo - 7, // 23: attest.MachineState.grub:type_name -> attest.GrubState - 8, // 24: attest.MachineState.linux_kernel:type_name -> attest.LinuxKernelState - 15, // 25: attest.MachineState.cos:type_name -> attest.AttestedCosState - 17, // 26: attest.MachineState.efi:type_name -> attest.EfiState - 0, // 27: attest.PlatformPolicy.minimum_technology:type_name -> attest.GCEConfidentialTechnology - 19, // 28: attest.Policy.platform:type_name -> attest.PlatformPolicy - 29, // [29:29] is the sub-list for method output_type - 29, // [29:29] is the sub-list for method input_type - 29, // [29:29] is the sub-list for extension type_name - 29, // [29:29] is the sub-list for extension extendee - 0, // [0:29] is the sub-list for field type_name -} - -func init() { file_attest_proto_init() } -func file_attest_proto_init() { - if File_attest_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_attest_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GCEInstanceInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Attestation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PlatformState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrubFile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GrubState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LinuxKernelState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Event); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Certificate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Database); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecureBootState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContainerState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SemanticVersion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AttestedCosState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EfiApp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EfiState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MachineState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PlatformPolicy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_attest_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Policy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_attest_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*Attestation_SevSnpAttestation)(nil), - (*Attestation_TdxAttestation)(nil), - } - file_attest_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*PlatformState_ScrtmVersionId)(nil), - (*PlatformState_GceVersion)(nil), - } - file_attest_proto_msgTypes[7].OneofWrappers = []interface{}{ - (*Certificate_Der)(nil), - (*Certificate_WellKnown)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_attest_proto_rawDesc, - NumEnums: 3, - NumMessages: 20, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_attest_proto_goTypes, - DependencyIndexes: file_attest_proto_depIdxs, - EnumInfos: file_attest_proto_enumTypes, - MessageInfos: file_attest_proto_msgTypes, - }.Build() - File_attest_proto = out.File - file_attest_proto_rawDesc = nil - file_attest_proto_goTypes = nil - file_attest_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/go-tpm-tools/proto/doc.go b/vendor/github.com/google/go-tpm-tools/proto/doc.go deleted file mode 100644 index 01fe4bd4a..000000000 --- a/vendor/github.com/google/go-tpm-tools/proto/doc.go +++ /dev/null @@ -1,31 +0,0 @@ -// Package proto contains protocol buffers that are exchanged between the client -// and server. -// -// # Generating Protocol Buffer Code -// -// Anytime the Protocol Buffer definitions change, the generated Go code must be -// regenerated. This can be done with "go generate". Just run: -// -// go generate ./... -// -// Upstream documentation: -// https://developers.google.com/protocol-buffers/docs/reference/go-generated -// -// # Code Generation Dependencies -// -// To generate the Go code, your system must have "protoc" installed. See: -// https://github.com/protocolbuffers/protobuf#protocol-compiler-installation -// -// The "protoc-gen-go" tool must also be installed. To install it, run: -// -// go install google.golang.org/protobuf/cmd/protoc-gen-go -// -// If you see a 'protoc-gen-go: program not found or is not executable' error -// for the 'go generate' command, run the following: -// -// echo 'export PATH=$PATH:$GOPATH/bin' >> $HOME/.bashrc -// source $HOME/.bashrc -package proto - -//go:generate ./gen_attest.sh -//go:generate protoc --go_out=. --go_opt=module=github.com/google/go-tpm-tools/proto tpm.proto diff --git a/vendor/github.com/google/go-tpm-tools/proto/gen_attest.sh b/vendor/github.com/google/go-tpm-tools/proto/gen_attest.sh deleted file mode 100755 index 44461ae1c..000000000 --- a/vendor/github.com/google/go-tpm-tools/proto/gen_attest.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -protoc -I. -I`go list -m -f "{{.Dir}}" github.com/google/go-sev-guest` -I`go list -m -f "{{.Dir}}" github.com/google/go-tdx-guest` --go_out=. --go_opt=module=github.com/google/go-tpm-tools/proto attest.proto diff --git a/vendor/github.com/google/go-tpm-tools/proto/tpm.proto b/vendor/github.com/google/go-tpm-tools/proto/tpm.proto deleted file mode 100644 index 2692d6a10..000000000 --- a/vendor/github.com/google/go-tpm-tools/proto/tpm.proto +++ /dev/null @@ -1,54 +0,0 @@ -syntax = "proto3"; - -package tpm; -option go_package = "github.com/google/go-tpm-tools/proto/tpm"; - -// Enum values come from TCG Algorithm Registry - v1.27 - Table 3 -enum ObjectType { - OBJECT_INVALID = 0x0000; - RSA = 0x0001; - ECC = 0x0023; -} - -enum HashAlgo { - HASH_INVALID = 0x0000; - SHA1 = 0x0004; - SHA256 = 0x000B; - SHA384 = 0x000C; - SHA512 = 0x000D; -} - -// SealedBytes stores the result of a TPM2_Seal. The private portion (priv) has -// already been encrypted and is no longer sensitive. The hash algorithm is -// assumed to be SHA256. -message SealedBytes { - bytes priv = 1; - bytes pub = 2; - repeated uint32 pcrs = 3; - HashAlgo hash = 4; - ObjectType srk = 5; - PCRs certified_pcrs = 6; - bytes creation_data = 7; - bytes ticket = 8; -} - -message ImportBlob { - bytes duplicate = 1; - bytes encrypted_seed = 2; - bytes public_area = 3; - PCRs pcrs = 4; -} - -message Quote { - // TPM2 quote, encoded as a TPMS_ATTEST - bytes quote = 1; - // TPM2 signature, encoded as a TPMT_SIGNATURE - bytes raw_sig = 2; - // PCR values of the bank being quoted - PCRs pcrs = 3; -} - -message PCRs { - HashAlgo hash = 1; - map pcrs = 2; -} diff --git a/vendor/github.com/google/go-tpm-tools/proto/tpm/tpm.pb.go b/vendor/github.com/google/go-tpm-tools/proto/tpm/tpm.pb.go deleted file mode 100644 index 2079ad92f..000000000 --- a/vendor/github.com/google/go-tpm-tools/proto/tpm/tpm.pb.go +++ /dev/null @@ -1,595 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc v3.21.12 -// source: tpm.proto - -package tpm - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Enum values come from TCG Algorithm Registry - v1.27 - Table 3 -type ObjectType int32 - -const ( - ObjectType_OBJECT_INVALID ObjectType = 0 - ObjectType_RSA ObjectType = 1 - ObjectType_ECC ObjectType = 35 -) - -// Enum value maps for ObjectType. -var ( - ObjectType_name = map[int32]string{ - 0: "OBJECT_INVALID", - 1: "RSA", - 35: "ECC", - } - ObjectType_value = map[string]int32{ - "OBJECT_INVALID": 0, - "RSA": 1, - "ECC": 35, - } -) - -func (x ObjectType) Enum() *ObjectType { - p := new(ObjectType) - *p = x - return p -} - -func (x ObjectType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ObjectType) Descriptor() protoreflect.EnumDescriptor { - return file_tpm_proto_enumTypes[0].Descriptor() -} - -func (ObjectType) Type() protoreflect.EnumType { - return &file_tpm_proto_enumTypes[0] -} - -func (x ObjectType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ObjectType.Descriptor instead. -func (ObjectType) EnumDescriptor() ([]byte, []int) { - return file_tpm_proto_rawDescGZIP(), []int{0} -} - -type HashAlgo int32 - -const ( - HashAlgo_HASH_INVALID HashAlgo = 0 - HashAlgo_SHA1 HashAlgo = 4 - HashAlgo_SHA256 HashAlgo = 11 - HashAlgo_SHA384 HashAlgo = 12 - HashAlgo_SHA512 HashAlgo = 13 -) - -// Enum value maps for HashAlgo. -var ( - HashAlgo_name = map[int32]string{ - 0: "HASH_INVALID", - 4: "SHA1", - 11: "SHA256", - 12: "SHA384", - 13: "SHA512", - } - HashAlgo_value = map[string]int32{ - "HASH_INVALID": 0, - "SHA1": 4, - "SHA256": 11, - "SHA384": 12, - "SHA512": 13, - } -) - -func (x HashAlgo) Enum() *HashAlgo { - p := new(HashAlgo) - *p = x - return p -} - -func (x HashAlgo) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HashAlgo) Descriptor() protoreflect.EnumDescriptor { - return file_tpm_proto_enumTypes[1].Descriptor() -} - -func (HashAlgo) Type() protoreflect.EnumType { - return &file_tpm_proto_enumTypes[1] -} - -func (x HashAlgo) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HashAlgo.Descriptor instead. -func (HashAlgo) EnumDescriptor() ([]byte, []int) { - return file_tpm_proto_rawDescGZIP(), []int{1} -} - -// SealedBytes stores the result of a TPM2_Seal. The private portion (priv) has -// already been encrypted and is no longer sensitive. The hash algorithm is -// assumed to be SHA256. -type SealedBytes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Priv []byte `protobuf:"bytes,1,opt,name=priv,proto3" json:"priv,omitempty"` - Pub []byte `protobuf:"bytes,2,opt,name=pub,proto3" json:"pub,omitempty"` - Pcrs []uint32 `protobuf:"varint,3,rep,packed,name=pcrs,proto3" json:"pcrs,omitempty"` - Hash HashAlgo `protobuf:"varint,4,opt,name=hash,proto3,enum=tpm.HashAlgo" json:"hash,omitempty"` - Srk ObjectType `protobuf:"varint,5,opt,name=srk,proto3,enum=tpm.ObjectType" json:"srk,omitempty"` - CertifiedPcrs *PCRs `protobuf:"bytes,6,opt,name=certified_pcrs,json=certifiedPcrs,proto3" json:"certified_pcrs,omitempty"` - CreationData []byte `protobuf:"bytes,7,opt,name=creation_data,json=creationData,proto3" json:"creation_data,omitempty"` - Ticket []byte `protobuf:"bytes,8,opt,name=ticket,proto3" json:"ticket,omitempty"` -} - -func (x *SealedBytes) Reset() { - *x = SealedBytes{} - if protoimpl.UnsafeEnabled { - mi := &file_tpm_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SealedBytes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SealedBytes) ProtoMessage() {} - -func (x *SealedBytes) ProtoReflect() protoreflect.Message { - mi := &file_tpm_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SealedBytes.ProtoReflect.Descriptor instead. -func (*SealedBytes) Descriptor() ([]byte, []int) { - return file_tpm_proto_rawDescGZIP(), []int{0} -} - -func (x *SealedBytes) GetPriv() []byte { - if x != nil { - return x.Priv - } - return nil -} - -func (x *SealedBytes) GetPub() []byte { - if x != nil { - return x.Pub - } - return nil -} - -func (x *SealedBytes) GetPcrs() []uint32 { - if x != nil { - return x.Pcrs - } - return nil -} - -func (x *SealedBytes) GetHash() HashAlgo { - if x != nil { - return x.Hash - } - return HashAlgo_HASH_INVALID -} - -func (x *SealedBytes) GetSrk() ObjectType { - if x != nil { - return x.Srk - } - return ObjectType_OBJECT_INVALID -} - -func (x *SealedBytes) GetCertifiedPcrs() *PCRs { - if x != nil { - return x.CertifiedPcrs - } - return nil -} - -func (x *SealedBytes) GetCreationData() []byte { - if x != nil { - return x.CreationData - } - return nil -} - -func (x *SealedBytes) GetTicket() []byte { - if x != nil { - return x.Ticket - } - return nil -} - -type ImportBlob struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Duplicate []byte `protobuf:"bytes,1,opt,name=duplicate,proto3" json:"duplicate,omitempty"` - EncryptedSeed []byte `protobuf:"bytes,2,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` - PublicArea []byte `protobuf:"bytes,3,opt,name=public_area,json=publicArea,proto3" json:"public_area,omitempty"` - Pcrs *PCRs `protobuf:"bytes,4,opt,name=pcrs,proto3" json:"pcrs,omitempty"` -} - -func (x *ImportBlob) Reset() { - *x = ImportBlob{} - if protoimpl.UnsafeEnabled { - mi := &file_tpm_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImportBlob) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImportBlob) ProtoMessage() {} - -func (x *ImportBlob) ProtoReflect() protoreflect.Message { - mi := &file_tpm_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImportBlob.ProtoReflect.Descriptor instead. -func (*ImportBlob) Descriptor() ([]byte, []int) { - return file_tpm_proto_rawDescGZIP(), []int{1} -} - -func (x *ImportBlob) GetDuplicate() []byte { - if x != nil { - return x.Duplicate - } - return nil -} - -func (x *ImportBlob) GetEncryptedSeed() []byte { - if x != nil { - return x.EncryptedSeed - } - return nil -} - -func (x *ImportBlob) GetPublicArea() []byte { - if x != nil { - return x.PublicArea - } - return nil -} - -func (x *ImportBlob) GetPcrs() *PCRs { - if x != nil { - return x.Pcrs - } - return nil -} - -type Quote struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // TPM2 quote, encoded as a TPMS_ATTEST - Quote []byte `protobuf:"bytes,1,opt,name=quote,proto3" json:"quote,omitempty"` - // TPM2 signature, encoded as a TPMT_SIGNATURE - RawSig []byte `protobuf:"bytes,2,opt,name=raw_sig,json=rawSig,proto3" json:"raw_sig,omitempty"` - // PCR values of the bank being quoted - Pcrs *PCRs `protobuf:"bytes,3,opt,name=pcrs,proto3" json:"pcrs,omitempty"` -} - -func (x *Quote) Reset() { - *x = Quote{} - if protoimpl.UnsafeEnabled { - mi := &file_tpm_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Quote) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Quote) ProtoMessage() {} - -func (x *Quote) ProtoReflect() protoreflect.Message { - mi := &file_tpm_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Quote.ProtoReflect.Descriptor instead. -func (*Quote) Descriptor() ([]byte, []int) { - return file_tpm_proto_rawDescGZIP(), []int{2} -} - -func (x *Quote) GetQuote() []byte { - if x != nil { - return x.Quote - } - return nil -} - -func (x *Quote) GetRawSig() []byte { - if x != nil { - return x.RawSig - } - return nil -} - -func (x *Quote) GetPcrs() *PCRs { - if x != nil { - return x.Pcrs - } - return nil -} - -type PCRs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Hash HashAlgo `protobuf:"varint,1,opt,name=hash,proto3,enum=tpm.HashAlgo" json:"hash,omitempty"` - Pcrs map[uint32][]byte `protobuf:"bytes,2,rep,name=pcrs,proto3" json:"pcrs,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *PCRs) Reset() { - *x = PCRs{} - if protoimpl.UnsafeEnabled { - mi := &file_tpm_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PCRs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PCRs) ProtoMessage() {} - -func (x *PCRs) ProtoReflect() protoreflect.Message { - mi := &file_tpm_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PCRs.ProtoReflect.Descriptor instead. -func (*PCRs) Descriptor() ([]byte, []int) { - return file_tpm_proto_rawDescGZIP(), []int{3} -} - -func (x *PCRs) GetHash() HashAlgo { - if x != nil { - return x.Hash - } - return HashAlgo_HASH_INVALID -} - -func (x *PCRs) GetPcrs() map[uint32][]byte { - if x != nil { - return x.Pcrs - } - return nil -} - -var File_tpm_proto protoreflect.FileDescriptor - -var file_tpm_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x74, 0x70, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x74, 0x70, 0x6d, - 0x22, 0xfc, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, - 0x12, 0x12, 0x0a, 0x04, 0x70, 0x72, 0x69, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, - 0x70, 0x72, 0x69, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x75, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x03, 0x70, 0x75, 0x62, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x63, 0x72, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x04, 0x70, 0x63, 0x72, 0x73, 0x12, 0x21, 0x0a, 0x04, 0x68, 0x61, - 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x74, 0x70, 0x6d, 0x2e, 0x48, - 0x61, 0x73, 0x68, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x21, 0x0a, - 0x03, 0x73, 0x72, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x74, 0x70, 0x6d, - 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x03, 0x73, 0x72, 0x6b, - 0x12, 0x30, 0x0a, 0x0e, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x70, 0x63, - 0x72, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x74, 0x70, 0x6d, 0x2e, 0x50, - 0x43, 0x52, 0x73, 0x52, 0x0d, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x50, 0x63, - 0x72, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, - 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x22, - 0x91, 0x01, 0x0a, 0x0a, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x1c, - 0x0a, 0x09, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x0e, - 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x65, 0x65, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x53, - 0x65, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x72, - 0x65, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x41, 0x72, 0x65, 0x61, 0x12, 0x1d, 0x0a, 0x04, 0x70, 0x63, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x74, 0x70, 0x6d, 0x2e, 0x50, 0x43, 0x52, 0x73, 0x52, 0x04, 0x70, - 0x63, 0x72, 0x73, 0x22, 0x55, 0x0a, 0x05, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x71, 0x75, 0x6f, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x6f, - 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x61, 0x77, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x61, 0x77, 0x53, 0x69, 0x67, 0x12, 0x1d, 0x0a, 0x04, 0x70, - 0x63, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x74, 0x70, 0x6d, 0x2e, - 0x50, 0x43, 0x52, 0x73, 0x52, 0x04, 0x70, 0x63, 0x72, 0x73, 0x22, 0x8b, 0x01, 0x0a, 0x04, 0x50, - 0x43, 0x52, 0x73, 0x12, 0x21, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x0d, 0x2e, 0x74, 0x70, 0x6d, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x41, 0x6c, 0x67, 0x6f, - 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x27, 0x0a, 0x04, 0x70, 0x63, 0x72, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x74, 0x70, 0x6d, 0x2e, 0x50, 0x43, 0x52, 0x73, 0x2e, - 0x50, 0x63, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x70, 0x63, 0x72, 0x73, 0x1a, - 0x37, 0x0a, 0x09, 0x50, 0x63, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x32, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, - 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x52, 0x53, - 0x41, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x45, 0x43, 0x43, 0x10, 0x23, 0x2a, 0x4a, 0x0a, 0x08, - 0x48, 0x61, 0x73, 0x68, 0x41, 0x6c, 0x67, 0x6f, 0x12, 0x10, 0x0a, 0x0c, 0x48, 0x41, 0x53, 0x48, - 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x48, - 0x41, 0x31, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x0b, - 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x48, 0x41, 0x33, 0x38, 0x34, 0x10, 0x0c, 0x12, 0x0a, 0x0a, 0x06, - 0x53, 0x48, 0x41, 0x35, 0x31, 0x32, 0x10, 0x0d, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x67, 0x6f, - 0x2d, 0x74, 0x70, 0x6d, 0x2d, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x74, 0x70, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_tpm_proto_rawDescOnce sync.Once - file_tpm_proto_rawDescData = file_tpm_proto_rawDesc -) - -func file_tpm_proto_rawDescGZIP() []byte { - file_tpm_proto_rawDescOnce.Do(func() { - file_tpm_proto_rawDescData = protoimpl.X.CompressGZIP(file_tpm_proto_rawDescData) - }) - return file_tpm_proto_rawDescData -} - -var file_tpm_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_tpm_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_tpm_proto_goTypes = []interface{}{ - (ObjectType)(0), // 0: tpm.ObjectType - (HashAlgo)(0), // 1: tpm.HashAlgo - (*SealedBytes)(nil), // 2: tpm.SealedBytes - (*ImportBlob)(nil), // 3: tpm.ImportBlob - (*Quote)(nil), // 4: tpm.Quote - (*PCRs)(nil), // 5: tpm.PCRs - nil, // 6: tpm.PCRs.PcrsEntry -} -var file_tpm_proto_depIdxs = []int32{ - 1, // 0: tpm.SealedBytes.hash:type_name -> tpm.HashAlgo - 0, // 1: tpm.SealedBytes.srk:type_name -> tpm.ObjectType - 5, // 2: tpm.SealedBytes.certified_pcrs:type_name -> tpm.PCRs - 5, // 3: tpm.ImportBlob.pcrs:type_name -> tpm.PCRs - 5, // 4: tpm.Quote.pcrs:type_name -> tpm.PCRs - 1, // 5: tpm.PCRs.hash:type_name -> tpm.HashAlgo - 6, // 6: tpm.PCRs.pcrs:type_name -> tpm.PCRs.PcrsEntry - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_tpm_proto_init() } -func file_tpm_proto_init() { - if File_tpm_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_tpm_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SealedBytes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_tpm_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImportBlob); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_tpm_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Quote); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_tpm_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PCRs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_tpm_proto_rawDesc, - NumEnums: 2, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_tpm_proto_goTypes, - DependencyIndexes: file_tpm_proto_depIdxs, - EnumInfos: file_tpm_proto_enumTypes, - MessageInfos: file_tpm_proto_msgTypes, - }.Build() - File_tpm_proto = out.File - file_tpm_proto_rawDesc = nil - file_tpm_proto_goTypes = nil - file_tpm_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/go-tpm-tools/run_cloudbuild.sh b/vendor/github.com/google/go-tpm-tools/run_cloudbuild.sh deleted file mode 100755 index 74e2023b5..000000000 --- a/vendor/github.com/google/go-tpm-tools/run_cloudbuild.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Run the script: ./run_cloudbuild.sh -set -euxo pipefail - -# Append a timestamp, as there is a check in finish-image-build that checks if -# the image already exists. -IMAGE_SUFFIX="$USER-test-image-`date +%s`" - -DIR=$(dirname -- "${BASH_SOURCE[0]}") -echo "Running Cloud Build on directory $DIR" - -# If you get the error: -# googleapi: Error 403: Required 'compute.images.get' permission for 'foo', forbidden -# -# Ensure you grant Cloud Build access to Compute Images: -# https://pantheon.corp.google.com/compute/images?referrer=search&tab=exports&project=$PROJECT_ID -gcloud beta builds submit --config=${DIR}/cloudbuild.yaml \ - --substitutions=_OUTPUT_IMAGE_SUFFIX="${IMAGE_SUFFIX}" - -echo "Image creation successful." -echo "Create a VM using the debug image confidential-space-debug-${IMAGE_SUFFIX}" -echo "gcloud compute instances create confidential-space-test --image=confidential-space-debug-${IMAGE_SUFFIX} --metadata ..." -echo "Or use the hardened image confidential-space-hardened-${IMAGE_SUFFIX}" diff --git a/vendor/github.com/google/go-tpm-tools/server/ca-certs/tpm_ek_intermediate_2.crt b/vendor/github.com/google/go-tpm-tools/server/ca-certs/tpm_ek_intermediate_2.crt deleted file mode 100644 index ef9699dfe1ac4854b039a9fd03f5a42fedace712..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1560 zcmXqLViPfFV*ay$nTe5!NkAhpue`I)FKz$5<3B$#3$HQYW#iOp^Jx3d%gD&h%3#pA z&yd@IlZ`o)g-w_#G}utsKoG>?5ax1D%*jm4FUreIG!!!s0SU4T^ZMqO=9MI7<|%|_ zrk2ALa|v^~=jW&Aq$>FMI2-aA@PHI^3$r@s!x#u`L}_{=;ZB?Y`5C)FNF2T_XcS3ta;fT?4ZaLjx;Q3o9ctT?2C~0|NzbD?=Rx zL#u#t0|R4^Vz)?t6DtENLkj~1abBP%10y3NAYot;CBbiGh$3LnxRcgij4%j;c+nr5 z7mBO4;Ak8Y;F#nK@m&+65^{_&vNA9?G4eAQ zG%<29H8C!7J-luv)2FG&F5wA8rHNQPg87>@*BI~fd;Ms=ZJ5CQ%=J;8!TL>=pKH}0ykuZoes{~?Umt}# zuI>w|4qLyAIliKlpOcNt-kL(afXKV`^9y6_b2>pk#iO- zjEI}3V7O;@ga71P^)pLP)GgsDf4XvQqVBcn`3|9ii_{y;GYW;gxWCWO5YxW(`u2fd zQyaNu4f%2FqC_V-u4%s%dYg%vk%4h>6C*D$L^uujfUzLU&&c?ng$0=U*$f0gd{q`s z19mpn^hQ<=Mgt*`h%iV6hXEUqVq#=4kOhhHv52vV2%jz76|spcaIpqo>dtBNcFXb# zPBxGSNh`BR7>G59q<(qwY}L2FQI|UAtOySM&d|s4eW`&j8;3R6^SlxH{CC^Yomn z@j`|=1-DN6EmO(ZyiP@B?ty1>(`^1+Ran=0N?BEq?LgUvOBPp_3yA4YDr|Andbp%x zcl{;ljm(~pIX3Z~U}rX8CACbRW$~^<`jcf_`16bB)8T;M!(mu4#lkekvCiJ#fQ4;$?r?@CP?K73 z-=-h$etEvU7@Z|YBZyD$9l#(b*TK8N! u=}S*;wpdiktfsg;rZ?h2ula5VuABVo|p?In8jR-k~9F-WmbSyh0;<3WGyv1u7CKg;Q{5aU$4$%m}*OOpjVS_8y$1Dl^r z_#V%3JgCjBcM>GFZnC1;k2N+72OeI0>3=(~pSeD;8Od8DQW{=pPZuh=yN=KbGTD05 zRKgcElDNqLU;34g5ym~Td9Wuv+P0L`j7p~y?qzI~DH`o{{+g;(84v54X&OHp>{^R7 zx;0A$l$W)=&4`7vGS`ZHl;@O}hl=vl&@tN@>+XaMYe;BoiFBB^40hG$Txm*8yXRH$ z)+|$5zlC@44QuyL!)557HIk55;=x5^z5mTGdCn&^GQc|!#TIRDE2d< ziafF+GuCv!cqd`Oru1l2@VB=5LAo=#NdsYQA<1dC9-J1CRbDdp>FS6f`7ye=e$yI1 zZfAiAq=$VU-#6cq-&&ria7VQx_P=Fnls;pDqw~&ktu^gls*wDa{!tsUkS*r>|a7GnAe-YG5!oGBX5DJVi9;V}4B4u}TWjZ4#1gu~ZSsEzYa0ZJ0Bi;@9S7<5nq zS{e=%B?KpNpaF6t0Zj?OqEt~TjOE{_ZmfKz_oe+(;^wgmJ0rb%4QNTq+9-9Pdg{Lo z|NbW%iwTG6o~i3k(=fI7saaZY9m!Y}UCV`!mkB!CbGbuq=sYW%Eob}sC;Sp8LTit3 z6?<}jZP|LB>iM|kCa0i2MvG`y&}d*39a1_#=VcvuvFmg~MLcB?YN*RGI>_q`IQNv+ zhQXYNH{zekUT?EzfV}oLo}qIrXro> zYe>87=eq4Kx*i)2S=(RfzSy$l*j+fmAWB z9ru$S6tYJ0TvJ0cQ+lL>%M(KEd+IGg!+rtGP+;Yx8OqK*$M zYt$P*>nM;f;T 0 { - t.Fatalf("pem.Decode found unexpected trailing data in certificate file: %s", certPEM) - } - cert, err := x509.ParseCertificate(block.Bytes) - if err != nil { - t.Fatalf("x509.ParseCertificate failed: %v", err) - } - return cert -} diff --git a/vendor/github.com/google/go-tpm-tools/server/ecc_utils.go b/vendor/github.com/google/go-tpm-tools/server/ecc_utils.go deleted file mode 100644 index 349dfd73e..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/ecc_utils.go +++ /dev/null @@ -1,47 +0,0 @@ -package server - -import ( - "crypto/elliptic" - "fmt" - "math/big" - - "github.com/google/go-tpm/legacy/tpm2" -) - -// ECC coordinates need to maintain a specific size based on the curve, so we pad the front with zeros. -// This is particularly an issue for NIST-P521 coordinates, as they are frequently missing their first byte. -func eccIntToBytes(curve elliptic.Curve, i *big.Int) []byte { - bytes := i.Bytes() - curveBytes := (curve.Params().BitSize + 7) / 8 - return append(make([]byte, curveBytes-len(bytes)), bytes...) -} - -func curveIDToGoCurve(curve tpm2.EllipticCurve) (elliptic.Curve, error) { - switch curve { - case tpm2.CurveNISTP224: - return elliptic.P224(), nil - case tpm2.CurveNISTP256: - return elliptic.P256(), nil - case tpm2.CurveNISTP384: - return elliptic.P384(), nil - case tpm2.CurveNISTP521: - return elliptic.P521(), nil - default: - return nil, fmt.Errorf("unsupported TPM2 curve: %v", curve) - } -} - -func goCurveToCurveID(curve elliptic.Curve) (tpm2.EllipticCurve, error) { - switch curve.Params().Name { - case elliptic.P224().Params().Name: - return tpm2.CurveNISTP224, nil - case elliptic.P256().Params().Name: - return tpm2.CurveNISTP256, nil - case elliptic.P384().Params().Name: - return tpm2.CurveNISTP384, nil - case elliptic.P521().Params().Name: - return tpm2.CurveNISTP521, nil - default: - return 0, fmt.Errorf("unsupported Go curve: %v", curve.Params().Name) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/server/eventlog.go b/vendor/github.com/google/go-tpm-tools/server/eventlog.go deleted file mode 100644 index d39cee8b3..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/eventlog.go +++ /dev/null @@ -1,594 +0,0 @@ -package server - -import ( - "bytes" - "crypto" - "crypto/x509" - "encoding/hex" - "errors" - "fmt" - - "github.com/google/go-attestation/attest" - "github.com/google/go-tpm-tools/cel" - pb "github.com/google/go-tpm-tools/proto/attest" - tpmpb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" -) - -var ( - newGrubKernelCmdlinePrefix = []byte("kernel_cmdline: ") - oldGrubKernelCmdlinePrefix = []byte("grub_kernel_cmdline ") - // See https://www.gnu.org/software/grub/manual/grub/grub.html#Measured-Boot. - validPrefixes = [][]byte{[]byte("grub_cmd: "), - newGrubKernelCmdlinePrefix, - []byte("module_cmdline: "), - // Older style prefixes: - // https://src.fedoraproject.org/rpms/grub2/blob/c789522f7cfa19a10cd716a1db24dab5499c6e5c/f/0224-Rework-TPM-measurements.patch - oldGrubKernelCmdlinePrefix, - []byte("grub_cmd ")} -) - -// parsePCClientEventLog parses a raw event log and replays the parsed event -// log against the given PCR values. It returns the corresponding MachineState -// containing the events verified by particular PCR indexes/digests. It returns -// an error if the replay for any PCR index does not match the provided value. -// -// The returned MachineState may be a partial MachineState where fields can be -// the zero value. In this case, an error of type MachineStateError will be -// returned. Callers can inspect individual parsing errors by examining -// `MachineStateError.Errors`. -// -// It is the caller's responsibility to ensure that the passed PCR values can be -// trusted. Users can establish trust in PCR values by either calling -// client.ReadPCRs() themselves or by verifying the values via a PCR quote. -func parsePCClientEventLog(rawEventLog []byte, pcrs *tpmpb.PCRs, loader Bootloader) (*pb.MachineState, error) { - var errors []error - events, err := parseReplayHelper(rawEventLog, pcrs) - if err != nil { - return nil, createGroupedError("", []error{err}) - } - // error is already checked in convertToAttestPcrs - cryptoHash, _ := tpm2.Algorithm(pcrs.GetHash()).Hash() - - rawEvents := convertToPbEvents(cryptoHash, events) - platform, err := getPlatformState(cryptoHash, rawEvents) - if err != nil { - errors = append(errors, err) - } - sbState, err := getSecureBootState(events) - if err != nil { - errors = append(errors, err) - } - efiState, err := getEfiState(cryptoHash, rawEvents) - if err != nil { - errors = append(errors, err) - } - - var grub *pb.GrubState - var kernel *pb.LinuxKernelState - if loader == GRUB { - grub, err = getGrubState(cryptoHash, rawEvents) - if err != nil { - errors = append(errors, err) - } - kernel, err = getLinuxKernelStateFromGRUB(grub) - if err != nil { - errors = append(errors, err) - } - } - - return &pb.MachineState{ - Platform: platform, - SecureBoot: sbState, - Efi: efiState, - RawEvents: rawEvents, - Hash: pcrs.GetHash(), - Grub: grub, - LinuxKernel: kernel, - }, createGroupedError("failed to fully parse MachineState:", errors) -} - -func parseCanonicalEventLog(rawCanonicalEventLog []byte, pcrs *tpmpb.PCRs) (*pb.MachineState, error) { - decodedCEL, err := cel.DecodeToCEL(bytes.NewBuffer(rawCanonicalEventLog)) - if err != nil { - return nil, err - } - // Validate the COS event log first. - if err := decodedCEL.Replay(pcrs); err != nil { - return nil, err - } - - cosState, err := getVerifiedCosState(decodedCEL) - if err != nil { - return nil, err - } - - return &pb.MachineState{ - Cos: cosState, - }, err -} - -func contains(set [][]byte, value []byte) bool { - for _, setItem := range set { - if bytes.Equal(value, setItem) { - return true - } - } - return false -} - -func getVerifiedCosState(coscel cel.CEL) (*pb.AttestedCosState, error) { - cosState := &pb.AttestedCosState{} - cosState.Container = &pb.ContainerState{} - cosState.Container.Args = make([]string, 0) - cosState.Container.EnvVars = make(map[string]string) - cosState.Container.OverriddenEnvVars = make(map[string]string) - - seenSeparator := false - for _, record := range coscel.Records { - // COS State only comes from the CosEventPCR - if record.PCR != cel.CosEventPCR { - return nil, fmt.Errorf("found unexpected PCR %d in CEL log", record.PCR) - } - - // The Content.Type is not verified at this point, so we have to fail - // if we see any events that we do not understand. This ensures that - // we either verify the digest of event event in this PCR, or we fail - // to replay the event log. - // TODO: See if we can fix this to have the Content Type be verified. - cosTlv, err := record.Content.ParseToCosTlv() - if err != nil { - return nil, err - } - - // verify digests for the cos cel content - if err := cel.VerifyDigests(cosTlv, record.Digests); err != nil { - return nil, err - } - - // TODO: Add support for post-separator container data - if seenSeparator { - return nil, fmt.Errorf("found COS Event Type %v after LaunchSeparator event", cosTlv.EventType) - } - - switch cosTlv.EventType { - case cel.ImageRefType: - if cosState.Container.GetImageReference() != "" { - return nil, fmt.Errorf("found more than one ImageRef event") - } - cosState.Container.ImageReference = string(cosTlv.EventContent) - - case cel.ImageDigestType: - if cosState.Container.GetImageDigest() != "" { - return nil, fmt.Errorf("found more than one ImageDigest event") - } - cosState.Container.ImageDigest = string(cosTlv.EventContent) - - case cel.RestartPolicyType: - restartPolicy, ok := pb.RestartPolicy_value[string(cosTlv.EventContent)] - if !ok { - return nil, fmt.Errorf("unknown restart policy in COS eventlog: %s", string(cosTlv.EventContent)) - } - cosState.Container.RestartPolicy = pb.RestartPolicy(restartPolicy) - - case cel.ImageIDType: - if cosState.Container.GetImageId() != "" { - return nil, fmt.Errorf("found more than one ImageId event") - } - cosState.Container.ImageId = string(cosTlv.EventContent) - - case cel.EnvVarType: - envName, envVal, err := cel.ParseEnvVar(string(cosTlv.EventContent)) - if err != nil { - return nil, err - } - cosState.Container.EnvVars[envName] = envVal - - case cel.ArgType: - cosState.Container.Args = append(cosState.Container.Args, string(cosTlv.EventContent)) - - case cel.OverrideArgType: - cosState.Container.OverriddenArgs = append(cosState.Container.OverriddenArgs, string(cosTlv.EventContent)) - - case cel.OverrideEnvType: - envName, envVal, err := cel.ParseEnvVar(string(cosTlv.EventContent)) - if err != nil { - return nil, err - } - cosState.Container.OverriddenEnvVars[envName] = envVal - case cel.LaunchSeparatorType: - seenSeparator = true - default: - return nil, fmt.Errorf("found unknown COS Event Type %v", cosTlv.EventType) - } - - } - return cosState, nil -} - -type separatorInfo struct { - separatorData [][]byte - separatorDigests [][]byte -} - -// getSeparatorInfo is used to return the valid event data and their corresponding -// digests. This is useful for events like separators, where the data is known -// ahead of time. -func getSeparatorInfo(hash crypto.Hash) *separatorInfo { - hasher := hash.New() - // From the PC Client Firmware Profile spec, on the separator event: - // The event field MUST contain the hex value 00000000h or FFFFFFFFh. - sepData := [][]byte{{0, 0, 0, 0}, {0xff, 0xff, 0xff, 0xff}} - sepDigests := make([][]byte, 0, len(sepData)) - for _, value := range sepData { - hasher.Write(value) - sepDigests = append(sepDigests, hasher.Sum(nil)) - } - return &separatorInfo{separatorData: sepData, separatorDigests: sepDigests} -} - -// checkIfValidSeparator returns true if both the separator event's type and -// digest match the expected event data. -// If the event type is Separator, but the data is invalid, it returns false -// and an error. -// checkIfValidSeparator returns false and a nil error on other event types. -func checkIfValidSeparator(event *pb.Event, sepInfo *separatorInfo) (bool, error) { - evtType := event.GetUntrustedType() - index := event.GetPcrIndex() - if (evtType != Separator) && !contains(sepInfo.separatorDigests, event.GetDigest()) { - return false, nil - } - // To make sure we have a valid event, we check any event (e.g., separator) - // that claims to be of the event type or "looks like" the event to prevent - // certain vulnerabilities in event parsing. For more info see: - // https://github.com/google/go-attestation/blob/master/docs/event-log-disclosure.md - if evtType != Separator { - return false, fmt.Errorf("PCR%d event contains separator data but non-separator type %d", index, evtType) - } - if !event.GetDigestVerified() { - return false, fmt.Errorf("unverified separator digest for PCR%d", index) - } - if !contains(sepInfo.separatorData, event.GetData()) { - return false, fmt.Errorf("invalid separator data for PCR%d", index) - } - return true, nil -} - -func getPlatformState(hash crypto.Hash, events []*pb.Event) (*pb.PlatformState, error) { - // We pre-compute the separator and EFI Action event hash. - // We check if these events have been modified, since the event type is - // untrusted. - sepInfo := getSeparatorInfo(hash) - var versionString []byte - var nonHostInfo []byte - for _, event := range events { - index := event.GetPcrIndex() - if index != 0 { - continue - } - evtType := event.GetUntrustedType() - - isSeparator, err := checkIfValidSeparator(event, sepInfo) - if err != nil { - return nil, err - } - if isSeparator { - // Don't trust any PCR0 events after the separator - break - } - - if evtType == SCRTMVersion { - if !event.GetDigestVerified() { - return nil, fmt.Errorf("invalid SCRTM version event for PCR%d", index) - } - versionString = event.GetData() - } - - if evtType == NonhostInfo { - if !event.GetDigestVerified() { - return nil, fmt.Errorf("invalid Non-Host info event for PCR%d", index) - } - nonHostInfo = event.GetData() - } - } - - state := &pb.PlatformState{} - if gceVersion, err := ConvertSCRTMVersionToGCEFirmwareVersion(versionString); err == nil { - state.Firmware = &pb.PlatformState_GceVersion{GceVersion: gceVersion} - } else { - state.Firmware = &pb.PlatformState_ScrtmVersionId{ScrtmVersionId: versionString} - } - - if tech, err := ParseGCENonHostInfo(nonHostInfo); err == nil { - state.Technology = tech - } - - return state, nil -} - -// Separate helper function so we can use attest.ParseSecurebootState without -// needing to reparse the entire event log. -func parseReplayHelper(rawEventLog []byte, pcrs *tpmpb.PCRs) ([]attest.Event, error) { - // Similar to parseCanonicalEventLog, just return an empty array of events for an empty log - if len(rawEventLog) == 0 { - return nil, nil - } - - attestPcrs, err := convertToAttestPcrs(pcrs) - if err != nil { - return nil, fmt.Errorf("received bad PCR proto: %v", err) - } - eventLog, err := attest.ParseEventLog(rawEventLog) - if err != nil { - return nil, fmt.Errorf("failed to parse event log: %v", err) - } - events, err := eventLog.Verify(attestPcrs) - if err != nil { - return nil, fmt.Errorf("failed to replay event log: %v", err) - } - return events, nil -} - -func convertToAttestPcrs(pcrProto *tpmpb.PCRs) ([]attest.PCR, error) { - hash := tpm2.Algorithm(pcrProto.GetHash()) - cryptoHash, err := hash.Hash() - if err != nil { - return nil, err - } - - attestPcrs := make([]attest.PCR, 0, len(pcrProto.GetPcrs())) - for index, digest := range pcrProto.GetPcrs() { - attestPcrs = append(attestPcrs, attest.PCR{ - Index: int(index), - Digest: digest, - DigestAlg: cryptoHash, - }) - } - return attestPcrs, nil -} - -func convertToPbEvents(hash crypto.Hash, events []attest.Event) []*pb.Event { - pbEvents := make([]*pb.Event, len(events)) - for i, event := range events { - hasher := hash.New() - hasher.Write(event.Data) - digest := hasher.Sum(nil) - - pbEvents[i] = &pb.Event{ - PcrIndex: uint32(event.Index), - UntrustedType: uint32(event.Type), - Data: event.Data, - Digest: event.Digest, - DigestVerified: bytes.Equal(digest, event.Digest), - } - } - return pbEvents -} - -func convertToPbDatabase(certs []x509.Certificate, hashes [][]byte) *pb.Database { - protoCerts := make([]*pb.Certificate, 0, len(certs)) - for _, cert := range certs { - wkEnum, err := matchWellKnown(cert) - var pbCert pb.Certificate - if err == nil { - pbCert.Representation = &pb.Certificate_WellKnown{WellKnown: wkEnum} - } else { - pbCert.Representation = &pb.Certificate_Der{Der: cert.Raw} - } - protoCerts = append(protoCerts, &pbCert) - } - return &pb.Database{ - Certs: protoCerts, - Hashes: hashes, - } -} - -func matchWellKnown(cert x509.Certificate) (pb.WellKnownCertificate, error) { - if bytes.Equal(WindowsProductionPCA2011Cert, cert.Raw) { - return pb.WellKnownCertificate_MS_WINDOWS_PROD_PCA_2011, nil - } - if bytes.Equal(MicrosoftUEFICA2011Cert, cert.Raw) { - return pb.WellKnownCertificate_MS_THIRD_PARTY_UEFI_CA_2011, nil - } - return pb.WellKnownCertificate_UNKNOWN, errors.New("failed to find matching well known certificate") -} - -func getSecureBootState(attestEvents []attest.Event) (*pb.SecureBootState, error) { - attestSbState, err := attest.ParseSecurebootState(attestEvents) - if err != nil { - return nil, fmt.Errorf("failed to parse SecureBootState: %v", err) - } - if len(attestSbState.PreSeparatorAuthority) != 0 { - return nil, fmt.Errorf("event log contained %v pre-separator authorities, which are not expected or supported", len(attestSbState.PreSeparatorAuthority)) - } - return &pb.SecureBootState{ - Enabled: attestSbState.Enabled, - Db: convertToPbDatabase(attestSbState.PermittedKeys, attestSbState.PermittedHashes), - Dbx: convertToPbDatabase(attestSbState.ForbiddenKeys, attestSbState.ForbiddenHashes), - Authority: convertToPbDatabase(attestSbState.PostSeparatorAuthority, nil), - }, nil -} - -func getGrubState(hash crypto.Hash, events []*pb.Event) (*pb.GrubState, error) { - var files []*pb.GrubFile - var commands []string - for idx, event := range events { - index := event.GetPcrIndex() - if index != 8 && index != 9 { - continue - } - - if event.GetUntrustedType() != IPL { - return nil, fmt.Errorf("invalid event type for PCR%d, expected EV_IPL", index) - } - - if index == 9 { - files = append(files, &pb.GrubFile{Digest: event.GetDigest(), - UntrustedFilename: event.GetData()}) - } else if index == 8 { - hasher := hash.New() - suffixAt := -1 - rawData := event.GetData() - for _, prefix := range validPrefixes { - if bytes.HasPrefix(rawData, prefix) { - suffixAt = len(prefix) - break - } - } - if suffixAt == -1 { - return nil, fmt.Errorf("invalid prefix seen for PCR%d event: %s", index, rawData) - } - hasher.Write(rawData[suffixAt : len(rawData)-1]) - if !bytes.Equal(event.Digest, hasher.Sum(nil)) { - // Older GRUBs measure "grub_cmd " with the null terminator. - // However, "grub_kernel_cmdline " measurements also ignore the null terminator. - hasher.Reset() - hasher.Write(rawData[suffixAt:]) - if !bytes.Equal(event.Digest, hasher.Sum(nil)) { - return nil, fmt.Errorf("invalid digest seen for GRUB event log in event %d: %s", idx, hex.EncodeToString(event.Digest)) - } - } - hasher.Reset() - commands = append(commands, string(rawData)) - } - } - if len(files) == 0 && len(commands) == 0 { - return nil, errors.New("no GRUB measurements found") - } - return &pb.GrubState{Files: files, Commands: commands}, nil -} - -func getEfiState(hash crypto.Hash, events []*pb.Event) (*pb.EfiState, error) { - // We pre-compute various event digests, and check if those event type have - // been modified. We only trust events that come before the - // ExitBootServices() request. - separatorInfo := getSeparatorInfo(hash) - - hasher := hash.New() - hasher.Write([]byte(CallingEFIApplication)) - callingEFIAppDigest := hasher.Sum(nil) - - hasher.Reset() - hasher.Write([]byte(ExitBootServicesInvocation)) - exitBootSvcDigest := hasher.Sum(nil) - - var efiAppStates []*pb.EfiApp - var seenSeparator4 bool - var seenSeparator5 bool - var seenCallingEfiApp bool - var seenExitBootServices bool - for _, event := range events { - index := event.GetPcrIndex() - // getEfiState should only ever process PCRs 4 and 5. - if index != 4 && index != 5 { - continue - } - evtType := event.GetUntrustedType() - - switch index { - case 4: - // Process Calling EFI Application event. - if bytes.Equal(callingEFIAppDigest, event.GetDigest()) { - if evtType != EFIAction { - return nil, fmt.Errorf("PCR%d contains CallingEFIApp event but non EFIAction type: %d", - index, evtType) - } - if !event.GetDigestVerified() { - return nil, fmt.Errorf("unverified CallingEFIApp digest for PCR%d", index) - } - // We don't support calling more than one boot device. - if seenCallingEfiApp { - return nil, fmt.Errorf("found duplicate CallingEFIApp event in PCR%d", index) - } - if seenSeparator4 { - return nil, fmt.Errorf("found CallingEFIApp event in PCR%d after separator event", index) - } - seenCallingEfiApp = true - } - - if evtType == EFIBootServicesApplication { - if !seenCallingEfiApp { - return nil, fmt.Errorf("found EFIBootServicesApplication in PCR%d before CallingEFIApp event", index) - } - efiAppStates = append(efiAppStates, &pb.EfiApp{Digest: event.GetDigest()}) - } - - isSeparator, err := checkIfValidSeparator(event, separatorInfo) - if err != nil { - return nil, err - } - if !isSeparator { - continue - } - if seenSeparator4 { - return nil, errors.New("found duplicate Separator event in PCR4") - } - seenSeparator4 = true - case 5: - // Process ExitBootServices event. - if bytes.Equal(exitBootSvcDigest, event.GetDigest()) { - if evtType != EFIAction { - return nil, fmt.Errorf("PCR%d contains ExitBootServices event but non EFIAction type: %d", - index, evtType) - } - if !event.GetDigestVerified() { - return nil, fmt.Errorf("unverified ExitBootServices digest for PCR%d", index) - } - // Don't process any PCR4 or PCR5 events after Boot Manager has - // requested ExitBootServices(). - seenExitBootServices = true - break - } - - isSeparator, err := checkIfValidSeparator(event, separatorInfo) - if err != nil { - return nil, err - } - if !isSeparator { - continue - } - if seenSeparator5 { - return nil, errors.New("found duplicate Separator event in PCR5") - } - seenSeparator5 = true - } - } - // Only write EFI digests if we see an ExitBootServices invocation. - // Otherwise, software further down the bootchain could extend bad - // PCR4 measurements. - if seenExitBootServices { - return &pb.EfiState{Apps: efiAppStates}, nil - } - return nil, nil -} - -func getLinuxKernelStateFromGRUB(grub *pb.GrubState) (*pb.LinuxKernelState, error) { - var cmdline string - seen := false - - for _, command := range grub.GetCommands() { - // GRUB config is always in UTF-8: https://www.gnu.org/software/grub/manual/grub/html_node/Internationalisation.html. - cmdBytes := []byte(command) - suffixAt := getGrubKernelCmdlineSuffix(cmdBytes) - if suffixAt == -1 { - continue - } - - if seen { - return nil, fmt.Errorf("more than one kernel commandline in GRUB commands") - } - seen = true - cmdline = command[suffixAt:] - } - - return &pb.LinuxKernelState{CommandLine: cmdline}, nil -} - -func getGrubKernelCmdlineSuffix(grubCmd []byte) int { - for _, prefix := range [][]byte{oldGrubKernelCmdlinePrefix, newGrubKernelCmdlinePrefix} { - if bytes.HasPrefix(grubCmd, prefix) { - return len(prefix) - } - } - return -1 -} diff --git a/vendor/github.com/google/go-tpm-tools/server/eventlog_test.go b/vendor/github.com/google/go-tpm-tools/server/eventlog_test.go deleted file mode 100644 index 34a39b332..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/eventlog_test.go +++ /dev/null @@ -1,935 +0,0 @@ -package server - -import ( - "bytes" - "crypto" - "crypto/rand" - "encoding/hex" - "fmt" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-tpm-tools/cel" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - attestpb "github.com/google/go-tpm-tools/proto/attest" - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" - "google.golang.org/protobuf/testing/protocmp" -) - -type eventLog struct { - RawLog []byte - Banks []*pb.PCRs - ExpectedEFIAppDigests map[pb.HashAlgo][]string -} - -// The Arch Linux event log has two known failures due to our parser's strict checks. -var archLinuxKnownParsingFailures = []string{ - "SecureBoot data len is 0, expected 1", - "found EFIBootServicesApplication in PCR4 before CallingEFIApp event", -} - -// Agile Event Log from a RHEL 8 GCE instance with Secure Boot enabled -var Rhel8GCE = eventLog{ - RawLog: test.Rhel8EventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0f2d3a2a1adaa479aeeca8f5df76aadc41b862ea"), - 1: decodeHex("5cc549378bafaa92e965c7e9c287925cfff33abd"), - 2: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("7fbe2df30156ca4934109f48d850ab327110f8fa"), - 5: decodeHex("3258daa13f4cccf245c170481c76e2a4602e5a7b"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("d7a632f8990b2171e987041b0a3c69fc1b2a4f27"), - 8: decodeHex("15aab2077008f8325e7c61ee39fedd7118aad5d7"), - 9: decodeHex("25de9455ef4e8180b76bbb9bb54a82f9a73abb0a"), - 14: decodeHex("1f5149668c40524e01be9cbc3ad527645943f148"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("24af52a4f429b71a3184a6d64cddad17e54ea030e2aa6576bf3a5a3d8bd3328f"), - 1: decodeHex("454220afaa80c83c3839f6cccd8b3c88bf4f562316a9dda1121c578c9e005a53"), - 2: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("758a3d35f1b0ff5b135dacd07db0c8132c0ac665d944090d4bf96e66447a245c"), - 5: decodeHex("53d0ee36163219201e686167bbb71ec505b3ba2917b9d9183ed84aad26cfeb89"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("5fd54361d580eb7592adb8deb236ff35444ceeac7148f24b3de63c041f12b3da"), - 8: decodeHex("25c3874041ebd4e9a21b6ed71b624a7bfa99907a8dcea7f129a4c64cbaf5829a"), - 9: decodeHex("d43b2f61eb18b4791812ff5f20ab20e4ef621ba683370bedf5dbdf518b3a8078"), - 14: decodeHex("d8f57ebcc1a23cc46832696e1a657f720e1be8f5b405bb7204682114e363b455"), - }, - }}, - ExpectedEFIAppDigests: map[pb.HashAlgo][]string{ - pb.HashAlgo_SHA1: { - "95f400d9003b4e8c0cb4734efcf547e36fc4100c", - "4f60d11ad6ac9a76837834f1371bc9521d018779", - "075f3bc8c7363c35a87ce56c604fa9201a97f79d", - }, - pb.HashAlgo_SHA256: { - "40d6cae02973789080cf4c3a9ad11b5a0a4d8bba4438ab96e276cc784454dee7", - "e8a268c431da72caaae407f729f602b9dbf5d1d43492d4a51cc2b688a08586e3", - "e4c0382f98feaebfd43923a85fd6da9a20e1a48524a4d5928c31850ca1a96a6e", - }, - pb.HashAlgo_SHA384: { - "66de9a210659294720af06838309fc1f4d0de82c646a62c1dd9f068cd331d2e05fd666377dbc11e84a796ce00108ab19", - "c1d031b07446588fa50f4eec3d8520d99ed01f21350b9c581e13f4c5a8c712cb5e3cbecc41ccab74465543439f7eb1e6", - "d844e63b32a73aadde4f78dda7cb7df73d75114f3a5964401847eb716142a06607ea95efee20f51283e85afca8da3afd", - }, - }, -} - -// Agile Event Log from a Ubuntu 18.04 GCE instance with Secure Boot and -// Confidential Computing enabled. -var UbuntuAmdSevGCE = eventLog{ - RawLog: test.Ubuntu1804AmdSevEventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("c032c3b51dbb6f96b047421512fd4b4dfde496f3"), - 1: decodeHex("35f38e5ce90728b02a0f66d836eef53d287e69bf"), - 2: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("41c68947aeee8a59110c7989a9b7a55df547f003"), - 5: decodeHex("baee22b5cce9029300f909add54d75d5d7475cfd"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("6530ed2dcba68801c78ca08753f239118bead7c8"), - 8: decodeHex("4e5533d878287970f3ef8d374fb140d93bcb2c37"), - 9: decodeHex("1b79f2140a84462cb13d1a0c1904daefd24d7938"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0f35c214608d93c7a6e68ae7359b4a8be5a0e99eea9107ece427c4dea4e439cf"), - 1: decodeHex("add81cbc06b154716ac7bd5999c84cbc520184d57c58102657d270274508d9ce"), - 2: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("b4b94e840fc9352e20bdb5b456b4c242af0fb146755b6935d8eda000ea368a31"), - 5: decodeHex("0b75168095fd6464ff1f9943b762ec009a3ae84c5e76cf67361e16b9db30d28e"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("61af3f499f1a86be54458fd30d193fa913a7e23ca3103fa3d0abaefd3cd4f9b8"), - 8: decodeHex("c324da9d0c54252c37af697cdd58b066f2bb0f4a69752d27623bc738d02e9486"), - 9: decodeHex("2d334f1eeb9a16dabaccaa746ff1c0dce2e9aeb3f3a4a314e5e1e61b01e940d0"), - }, - }}, - ExpectedEFIAppDigests: map[pb.HashAlgo][]string{ - pb.HashAlgo_SHA1: { - "21e79438580ec89df674dfe12653d77d132c3936", - "9a4c7c895a5d40c3906121ff59c6fe267a4c32e0", - }, - pb.HashAlgo_SHA256: { - "2ea4cb6a1f1eb1d3dce82d54fde26ded243ba3e18de7c6d211902a594fe56788", - "835f940e97bac2f7c171819b1fcc4bebe72a1c4ea7d7245088ef32d253085bb3", - }, - pb.HashAlgo_SHA384: { - "9b2baf7073fd9b7df3091b69ae7e48453450ae7b5311b37de11b79da75f175b8b2ed69f7d39406501653b35cbe90a030", - "b0a19b24395a4690eea97916483dc291a38c6023df20aa296d85064194cebe9097f6b5e8490fd57a4e6b01167a8c9c7c", - }, - }, -} - -// Agile Event Log from a Ubuntu 21.04 GCE instance without a DBX and with Secure Boot disabled -var Ubuntu2104NoDbxGCE = eventLog{ - RawLog: test.Ubuntu2104NoDbxEventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0f2d3a2a1adaa479aeeca8f5df76aadc41b862ea"), - 1: decodeHex("36c6b7436c37243c5f6744b73ced4df1287cd16a"), - 2: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("8d9868b66afcf4039eaf8ef5228556d9f313659f"), - 5: decodeHex("b0eaa45a496e0d933f63e97fd2362192dd48e369"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("777795cbdeca679f7749d8d09fc12941dcc9912a"), - 8: decodeHex("5dfae5320ea06ddd1c62d296844a9b4b32b49972"), - 9: decodeHex("f53869ab9015b5ad736e5f00e44fdfee2fdfde27"), - 14: decodeHex("cd3734d2bdfcfba9e443ac02c03c812ffcceb255"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("24af52a4f429b71a3184a6d64cddad17e54ea030e2aa6576bf3a5a3d8bd3328f"), - 1: decodeHex("f7dab5fda6b082e0ec1a12c43dd996ee409111422cda752a784620313039db19"), - 2: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("295aeaeacad1d507930bab18418f905eeda633ea67b2ab94c5e5fd3a4d47ac58"), - 5: decodeHex("e4f1359accfe48b19af7d38e98a3f373116b55b7f7a6f58f826f409a91d9fd28"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("ca37324eeffabd318d30a20f15bf27ce25dc33e2c9856279ff6c2ced58b02efa"), - 8: decodeHex("2f2559cae74bb441d75afea5edb78d9a645db9f4bf8dea84bab0861ce6032e18"), - 9: decodeHex("9f27883322aaaf043662c27542d9685790c687ea554e4e2ae30f0e099a2e4889"), - 14: decodeHex("8351c65483c5419079e8c96758dd2130bee075d71fea226f68ec4eb5bfc71983"), - }, - }}, - ExpectedEFIAppDigests: map[pb.HashAlgo][]string{ - pb.HashAlgo_SHA1: { - "92e6ec17937f600b9ec7f23adf4ea5553b4e2364", - "4f9604e61091095594c206c8a404afe187a92586", - }, - pb.HashAlgo_SHA256: { - "d99c93fcb042dbe52707bbde371c75fcf081dd5b0c88a195d44cc57536f6f521", - "b0a836fec2faf4a9bea0e1a5f1945bc86ddc03ac98ce0ae172ed9b1e536d7595", - }, - pb.HashAlgo_SHA384: { - "d8811e9c08119168b156255c6d695614d1593422bc5044186d29c1aaaa86fff0a633f324ac1ac1122e547479ce50a75a", - "bbcdda8a6d872385b10802434eb8de1ac7b92dbaddf18bc1d7ea24fcc71b45291db5cc7b930a29c93405d6aecdb70683", - }, - }, -} - -// Agile Event Log from a Ubuntu 21.04 GCE instance with Secure Boot disabled -var Ubuntu2104NoSecureBootGCE = eventLog{ - RawLog: test.Ubuntu2104NoSecureBootEventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0f2d3a2a1adaa479aeeca8f5df76aadc41b862ea"), - 1: decodeHex("f5310dfcfcec5571cbf730064d526906c9cea2f0"), - 2: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("e53d909941dcbc699b273fc4c0d817a41c6ab975"), - 5: decodeHex("9e2af4bac1432830594b1ae90c68c52a20a9700e"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("ede7204673f41ac2592b0d3b4cd429b43f39dc61"), - 8: decodeHex("bda59abe1c7d18e0b85edfcb4381f10d4dcc88f7"), - 9: decodeHex("39fd49224476f4d7eea26a53e264c9c33e47649c"), - 14: decodeHex("cd3734d2bdfcfba9e443ac02c03c812ffcceb255"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("24af52a4f429b71a3184a6d64cddad17e54ea030e2aa6576bf3a5a3d8bd3328f"), - 1: decodeHex("45ed8540f34db53220ef197e5fb8a3835b2095454349e445f397f13d91c509a5"), - 2: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("ebc7ae25d0347868250995c9a8fff16bf79e048453262d0ef2756e213c76181c"), - 5: decodeHex("47715f9f2c10769da6ee23be5633fd88e247caf162f4eeb0b6f8482ccfeadfb5"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("0d8847bc5eca06452df10e2f214363845c7ac11d47525a5474e225e72ce25dfe"), - 8: decodeHex("b9a324947de94ec2fd4b04483ecfcb37dfdd520a7c0ecf73c77bf2595549c84f"), - 9: decodeHex("adb87be3efd96cc3a2f66b8aa7564f9727563ef494a95d571a3f38ff4afb25dd"), - 14: decodeHex("8351c65483c5419079e8c96758dd2130bee075d71fea226f68ec4eb5bfc71983"), - }, - }}, - ExpectedEFIAppDigests: map[pb.HashAlgo][]string{ - pb.HashAlgo_SHA1: { - "22df40d6e32d4721f1b2406b2b4a3bb0ca10ead5", - "4f9604e61091095594c206c8a404afe187a92586", - }, - pb.HashAlgo_SHA256: { - "6265b732b005b3f330bcd1843374e5ec6ec5aef27cdb97a23daeb8580abbf526", - "b0a836fec2faf4a9bea0e1a5f1945bc86ddc03ac98ce0ae172ed9b1e536d7595", - }, - pb.HashAlgo_SHA384: { - "4f491210da8f59f09cd16523b44db22e83d8b611c3b14656d3b078dd451347ab195177fc78cf8d5578376f1f5f9bb821", - "bbcdda8a6d872385b10802434eb8de1ac7b92dbaddf18bc1d7ea24fcc71b45291db5cc7b930a29c93405d6aecdb70683", - }, - }, -} - -// Agile Event Log from Alex's gLinux laptop with secure boot disabled -var GlinuxNoSecureBootLaptop = eventLog{ - RawLog: test.GlinuxAlexEventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("29d236609a5f9cc6912af44ba5f57b13a17c8a84"), - 1: decodeHex("db16852a369b2503d6cc6c0007501c837dbe1170"), - 2: decodeHex("0c8ef58d40b8cd1fe15f6b45fc1b385dd251eec0"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("c56cddf3dcf59a473a239efd17b130391e24b0df"), - 5: decodeHex("23606963a2813421f5b6e76e32a337ff8940e413"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("9221b8fc57b60cb7de507dc016f88d4600cde9c5"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0e5ea849d7647a1ac1becc096fee4df98f00f8015f934afadaab0b8aa20b38a5"), - 1: decodeHex("9750400838980c9419764b9cf19c975c0e159c18ebe21cb897c6e834a8d8d433"), - 2: decodeHex("970096d49105b0404999173e49c3f6b8597b9c4c5ff6a9e364b55ce01037578e"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("ddb124ca9013f1e42f98537f7f381e47c5e6caa988cf2b4088f452c5a8dd912d"), - 5: decodeHex("fb58603615cfec59c0428e71913d30d45f38e4280380cc814135a7659c246b13"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("9d1be46302bc4f5055c90a0376d9142e397ca8744f387c9824170f1bc855fde5"), - }, - }}, -} - -// Agile Event Log from an Arch Linux worksation with systemd-boot and Secure Boot Disabled -var ArchLinuxWorkstation = eventLog{ - RawLog: test.ArchLinuxWorkstationEventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("a0487b0d95387d4a30560edf5f041307bf4a1dcc"), - 1: decodeHex("56b71c334a5b67d3b7b3343e3241dff5a1ad87bf"), - 2: decodeHex("01098a68e44e4fbd0af3b9a836b1b79e78c4f6f5"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("4c8b6f359b5e5cb9d09e825009a98e1281165b01"), - 5: decodeHex("0dfa5ca60508ac5214515b20ed3e66289514fcb6"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("029c700c2fa2bc83cbf3ce4ee501ad4d984ec5ae"), - 8: decodeHex("aa99fc93faa0777f42da6e1ae77a0653b5005619"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("758b773d94feabf52ef5a4c00a7ad2c80d8d6e6d9d58756150be9bc973da9087"), - 1: decodeHex("bfda688a5d320123fddb3fc70b746bc17647e2e7f2f96e130d429542bf4622d5"), - 2: decodeHex("65dee4a48cde677aa89fa83c5c35e883fda658f743853e3ebad504ca6702f7c5"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("925d453d3dfef4ac0c72c957402163d45fa95d05e6d53f047263a3a60b598325"), - 5: decodeHex("202522f005ef625588bb7c9e21335ba96a63c5086306138885b3bb2c381730ca"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("3b4a4db44b7a872524055364e62e897ae678e0d47ab0809f65c3a4ed77f66ab9"), - 8: decodeHex("47591b43af431963eaeb5238a5c42eda1eb0014c27f7de7ae483066a2d2a2e61"), - }, - }}, -} - -// Legacy Event Log from a Debian 10 GCE instance with Secure Boot enabled -var Debian10GCE = eventLog{ - RawLog: test.Debian10EventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0f2d3a2a1adaa479aeeca8f5df76aadc41b862ea"), - 1: decodeHex("b1676439cac1531683990fefe2218a43239d6fe8"), - 2: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("1eb30816474a3f144e99b24e4ad480b2e51fd9e1"), - 5: decodeHex("019079179dbc0eb5992c500dcf8a095910ac590d"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("9e6c57e850f371c2a7fe02bca552149363952318"), - }, - }}, - // We shouldn't use these digests, as this Debian firmware does not measure - // ExitBootService events, which means an attacker could extend additional - // events after UEFI hands off the event log. - ExpectedEFIAppDigests: map[pb.HashAlgo][]string{ - pb.HashAlgo_SHA1: { - "47263679db883d7ad9adbc93d6a1fbf8095f0133", - "3fae23b18d72350207661af3875f2c492e97621c", - "89b08941b47dcfbd4c8b3f2bc0fad984cd836b21", - }, - }, -} - -// Agile Event Log from a Ubuntu 21.04 GCE instance with Secure Boot disabled -var COS85AmdSev = eventLog{ - RawLog: test.Cos85AmdSevEventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("c032c3b51dbb6f96b047421512fd4b4dfde496f3"), - 1: decodeHex("e3e9e1d9deacd95b289bbbd3a1717a57af7d211b"), - 2: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("6168c9ce88a8658920f2cf2f9012d3c6bbfab79b"), - 5: decodeHex("fb6b3a15b220a74b0c4f73416919476702e930e2"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("42e669233f0e826df5093abfd6998c020df2de88"), - 8: decodeHex("72778b0ba3c491db25eb7c8368cb1fb51f0ce458"), - 9: decodeHex("08bd04f0dbadf591510340d94a0019c0ddcb779f"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0f35c214608d93c7a6e68ae7359b4a8be5a0e99eea9107ece427c4dea4e439cf"), - 1: decodeHex("6eb40f5b6bfafcb9914d486ce59404acd24bc13a6a3c45cda3b44c9d7053d638"), - 2: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("d690bdac2aa8b73a1d718cb91990df07d0747b07ea57b3b2d0f0d511f0d90491"), - 5: decodeHex("e9e0b32564b6f8215b1bd43954d9f910682d39c3b18abd4737ac3b797cf269e0"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("3365d7fa2b024c852913c06e04ffbfa6ea5289f743bbf1a76f7ffdf21ed84793"), - 8: decodeHex("9e9b6511ae6ad443aae4c7bf998ffffbcd271c874f1efab9d692f129eb6e6c18"), - 9: decodeHex("f4f2d92d6d54f6c41f2706fd98091317642e0680a7902c72893d41e3464a93b7"), - }, - }}, - ExpectedEFIAppDigests: map[pb.HashAlgo][]string{ - pb.HashAlgo_SHA1: { - "bfeec15d9359fe0aa8b5fb6451d1f73e5144c6d3", - "860848ad3f129051f1e252749011cf7f7df837ee", - "91cd5aa9c3e407237e8aeb122d4ab94494034a90", - }, - pb.HashAlgo_SHA256: { - "dba8d69ffb244496ac8ab2950695d3da539d6ac5ec660fc6b4bdde245284cf23", - "f7bad83f87940312e4642530a9a6242e88529dc37a497d7d4e7c1c070566d542", - "6f6afb3caed004e727200a0c310731bd8ab4cd391b2d95cedf67d08e1e8e5e7e", - }, - pb.HashAlgo_SHA384: { - "778bd7d6385d8ca0da5e504e3e554b67d98d9a712d957cb4cbb4d9b2e66ca96e31ddc18680af02b03a3a8a1b08da6aca", - "d014c8c69b17ceb0f46be22b928f52684e717f40288246a61dadba00b1368c883cdde4e98762cc6788d94d0bcbd3f7ca", - "ff8ff1db8fc98d02d944a90c58103b1b2ad3ba893ba4f302a006a572951491622341bb9387de20dd072cb8b6b3583cd0", - }, - }, -} - -var COS93AmdSev = eventLog{ - RawLog: test.Cos93AmdSevEventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("c032c3b51dbb6f96b047421512fd4b4dfde496f3"), - 1: decodeHex("e3e9e1d9deacd95b289bbbd3a1717a57af7d211b"), - 2: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("1e4b998edfb4d62fb88337a66b3af8be26159498"), - 5: decodeHex("3421f02e05d71fe4bd002cbe22e68c230397821d"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("42e669233f0e826df5093abfd6998c020df2de88"), - 8: decodeHex("ec84952e0c5c96cd4404122131b8f86d5ac7df7d"), - 9: decodeHex("7a406f847075a86a55aa184cfe3fcef7eaff40a7"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0f35c214608d93c7a6e68ae7359b4a8be5a0e99eea9107ece427c4dea4e439cf"), - 1: decodeHex("6eb40f5b6bfafcb9914d486ce59404acd24bc13a6a3c45cda3b44c9d7053d638"), - 2: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("871e8343044ae4c87b402dcb94b5e49715b1b8dc1b19c43ba0801422fabb39d4"), - 5: decodeHex("74be59dc8066011eade913db9a3db7978f93852c04816cba9427dd59b87042cc"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("3365d7fa2b024c852913c06e04ffbfa6ea5289f743bbf1a76f7ffdf21ed84793"), - 8: decodeHex("ba18b7028111f1f193967cad3c23b5050f73061c0f119182ac0f42efd6a9159e"), - 9: decodeHex("0b1e4f9ca7bc8535c4c33f0025969d7abea008aa51dcd7f7c2d1068470e4bce4"), - }, - }}, - ExpectedEFIAppDigests: map[pb.HashAlgo][]string{ - pb.HashAlgo_SHA1: { - "d582c2803fd716f09e50c82967079ff593e1bc6b", - "e3de6a97421ba8f329d4ba55e39df80013415a23", - "03221584436f78e488cdaec3c691b7a18ff2f621", - }, - pb.HashAlgo_SHA256: { - "27cce48e55b3bfb6eb6206a4cc2b53a497846496a6264495006ab28dffa5623e", - "e3e226fb8c8e3b3fdb56c706a0fbfda080f34068aef5a1889c1bfa95f04c2e72", - "dc0aca594caee03705bcfa817e7f666692d89b713815f4793b7abbc2a0e00b6c", - }, - pb.HashAlgo_SHA384: { - "da419d9c92eb55b6e14f5665d81644fa163b908b1b1e317740f7a605f1734994dd90f4ea3373400c59fd7683751e30ef", - "794e6206fe520d3b0bcbfd3e14b0dc8e41f6a8c3b131faef69442a11625fde690a1b77c46dcddcb443a8d3c1e3ea669c", - "64b218ab263625b49da1172a9ab37cedbcd20d668beac1c3baac4cae640a1a7f77a07c05682b4147ec649c51243f6bbf", - }, - }, -} - -var COS101AmdSev = eventLog{ - RawLog: test.Cos101AmdSevEventLog, - Banks: []*pb.PCRs{{ - Hash: pb.HashAlgo_SHA1, - Pcrs: map[uint32][]byte{ - 0: decodeHex("c032c3b51dbb6f96b047421512fd4b4dfde496f3"), - 1: decodeHex("e3e9e1d9deacd95b289bbbd3a1717a57af7d211b"), - 2: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 3: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 4: decodeHex("1ebe08ea6c45e0dfbd2aad903d2e0d3ab69fd7ad"), - 5: decodeHex("1c7ca47e5c09a78a747b0e0f051cc8cad6431400"), - 6: decodeHex("b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236"), - 7: decodeHex("6847f752ad1795c279f289e1eecf0040cd53c1d4"), - 8: decodeHex("a243d82bd1fa01ae487b7ba77dd73ebb7a17800a"), - 9: decodeHex("fbbb8a8f120369810e7e161504556f0080afadac"), - 14: decodeHex("1ba610b2d80967338649a8f88f45810448814bfc"), - }, - }, { - Hash: pb.HashAlgo_SHA256, - Pcrs: map[uint32][]byte{ - 0: decodeHex("0f35c214608d93c7a6e68ae7359b4a8be5a0e99eea9107ece427c4dea4e439cf"), - 1: decodeHex("6eb40f5b6bfafcb9914d486ce59404acd24bc13a6a3c45cda3b44c9d7053d638"), - 2: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 3: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 4: decodeHex("6d9f1a1d461cf77517e8d4c488c53f338a71c5a8e2b81ab7011c14f72cbc9a80"), - 5: decodeHex("d1a1ab23a5c3d98fbacff3891bad42d8e9257d61e1f683f42c6c9fa949bf96c5"), - 6: decodeHex("3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969"), - 7: decodeHex("2bc6edaa921f953cec0ffb28dad4f87114886603d6a782036502d28e69d97a48"), - 8: decodeHex("ebb7c847c4ade99849bcffca236d32331224a530087a7ae4cb9f7db4c2e571b5"), - 9: decodeHex("b5ad662e5eb9165825ee39ad66e851a67a193e0b87b27858f25ac58afa72ac57"), - 14: decodeHex("d0d95459205afae879514db7b85630f5d6b8272ed8c731bf92933dbc9fe99969"), - }, - }}, - ExpectedEFIAppDigests: map[pb.HashAlgo][]string{ - pb.HashAlgo_SHA1: { - "dc41c297c4ed857e9b6354cad8b448995c3052ea", - "06ae09413b5107bb26aa68602ba4fe787d22f82e", - "f894ac3a351baa3a5ce4dd8d6f497eb616723461", - "f894ac3a351baa3a5ce4dd8d6f497eb616723461", - }, - pb.HashAlgo_SHA256: { - "c7ac5d44444affd8d4a7c5d3dea0ce20a71e05812fc18777a428d092f78ae3ff", - "c5d3b47de11a9a2a4a15ef5cb7202d7800a10609c0dcecc46e3e963d476b76ce", - "af4161084115c9d5c1872f4473fe974b535e3a9a767688293720ac2cc6f7f9a3", - "af4161084115c9d5c1872f4473fe974b535e3a9a767688293720ac2cc6f7f9a3", - }, - pb.HashAlgo_SHA384: { - "72bf185794a865eb14fcdf93a2daa8ed281c932e2a7009d8489c38056389b3f3776d755ec703c95fb9c396f79dbd52c7", - "5b38df39c7beec3bfd9c4cbd40c217bcbee190d1fa099a64c5f063d20efc3def26e48cbbd86d730c8eb4696a29759490", - "968f2f6cb5bae537adfca30942803ddcda773bae368c042258e8818788265cd0e119936c9fcdb782785154a6705c5143", - "968f2f6cb5bae537adfca30942803ddcda773bae368c042258e8818788265cd0e119936c9fcdb782785154a6705c5143", - }, - }, -} - -func TestParseEventLogs(t *testing.T) { - sbatErrorStr := "asn1: structure error: tags don't match (16 vs {class:0 tag:24 length:10 isCompound:true})" - logs := []struct { - eventLog - name string - Bootloader - // This field handles known issues with event log parsing or bad event - // logs. - // Set to nil when the event log has no known issues. - errorSubstrs []string - }{ - {Debian10GCE, "Debian10GCE", UnsupportedLoader, nil}, - {Rhel8GCE, "Rhel8GCE", GRUB, nil}, - {UbuntuAmdSevGCE, "UbuntuAmdSevGCE", GRUB, nil}, - // TODO: remove once the fix is pulled in - // https://github.com/google/go-attestation/pull/222 - {Ubuntu2104NoDbxGCE, "Ubuntu2104NoDbxGCE", GRUB, []string{sbatErrorStr}}, - {Ubuntu2104NoSecureBootGCE, "Ubuntu2104NoSecureBootGCE", GRUB, []string{sbatErrorStr}}, - // This event log has a SecureBoot variable length of 0. - {ArchLinuxWorkstation, "ArchLinuxWorkstation", UnsupportedLoader, archLinuxKnownParsingFailures}, - {COS85AmdSev, "COS85AmdSev", GRUB, nil}, - {COS93AmdSev, "COS93AmdSev", GRUB, nil}, - {COS101AmdSev, "COS101AmdSev", GRUB, nil}, - } - - for _, log := range logs { - rawLog := log.RawLog - for _, bank := range log.Banks { - hashName := pb.HashAlgo_name[int32(bank.Hash)] - subtestName := fmt.Sprintf("%s-%s", log.name, hashName) - t.Run(subtestName, func(t *testing.T) { - if _, err := parsePCClientEventLog(rawLog, bank, UnsupportedLoader); err != nil { - gErr, ok := err.(*GroupedError) - if !ok { - t.Errorf("ParseMachineState should return a GroupedError") - } - if len(log.errorSubstrs) == 0 { - t.Errorf("expected no errors in GroupedError, received (%v)", err) - } - if !gErr.containsKnownSubstrings(log.errorSubstrs) { - t.Errorf("failed to parse and replay log: %v", err) - } - } - }) - } - } -} - -func TestParseMachineStateReplayFail(t *testing.T) { - badPcrs := pb.PCRs{Hash: pb.HashAlgo_SHA1} - pcrMap := make(map[uint32][]byte) - pcrMap[0] = []byte{0, 0, 0, 0} - badPcrs.Pcrs = pcrMap - - _, err := parsePCClientEventLog(Debian10GCE.RawLog, &badPcrs, UnsupportedLoader) - if err == nil { - t.Errorf("ParseMachineState should fail to replay the event log") - } - _, ok := err.(*GroupedError) - if !ok { - t.Errorf("ParseMachineState should return a GroupedError") - } -} - -func TestSystemParseEventLog(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - evtLog, err := client.GetEventLog(rwc) - if err != nil { - t.Fatalf("failed to retrieve Event Log: %v", err) - } - - sel := client.FullPcrSel(tpm2.AlgSHA1) - pcrs, err := client.ReadPCRs(rwc, sel) - if err != nil { - t.Fatalf("failed to read PCRs: %v", err) - } - - if _, err = parsePCClientEventLog(evtLog, pcrs, UnsupportedLoader); err != nil { - t.Errorf("failed to parse MachineState: %v", err) - } -} - -func TestEmptyEventlog(t *testing.T) { - emptyLog := []byte{} - emptyState := &attestpb.MachineState{ - Hash: pb.HashAlgo_SHA1, - Platform: &attestpb.PlatformState{Firmware: &attestpb.PlatformState_ScrtmVersionId{}}, - SecureBoot: &attestpb.SecureBootState{}, - } - - // SHA-1 PCR data consisting of all zero digests (i.e. the reset state) - zeroDigest := make([]byte, crypto.SHA1.Size()) - zeroPCRs := &pb.PCRs{Hash: pb.HashAlgo_SHA1, Pcrs: make(map[uint32][]byte)} - for i := uint32(0); i < 24; i++ { - zeroPCRs.Pcrs[i] = zeroDigest - } - - // For our "Real" PCR data, use the simulated TPM (which has extended events) - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - realPCRs, err := client.ReadPCRs(rwc, client.FullPcrSel(tpm2.AlgSHA1)) - if err != nil { - t.Fatalf("failed to read PCRs: %v", err) - } - - cases := []struct { - name string - pcrs *pb.PCRs - }{ - {"Empty", &pb.PCRs{Hash: pb.HashAlgo_SHA1}}, - {"AllZero", zeroPCRs}, - {"Real", realPCRs}, - } - for _, c := range cases { - t.Run(c.name, func(t *testing.T) { - state, err := parsePCClientEventLog(emptyLog, c.pcrs, UnsupportedLoader) - if err != nil { - t.Errorf("parsing empty eventlog: %v", err) - } - if diff := cmp.Diff(state, emptyState, protocmp.Transform(), protocmp.IgnoreEmptyMessages()); diff != "" { - t.Errorf("unexpected non-empty MachineState:\n%v", diff) - } - }) - } -} - -func TestParseSecureBootState(t *testing.T) { - for _, bank := range UbuntuAmdSevGCE.Banks { - msState, err := parsePCClientEventLog(UbuntuAmdSevGCE.RawLog, bank, UnsupportedLoader) - if err != nil { - t.Errorf("failed to parse and replay log: %v", err) - } - containsWinProdPCA := false - contains3PUEFI := false - if len(msState.GetSecureBoot().GetDb().GetHashes()) != 0 { - t.Error("found hashes in db") - } - for _, cert := range msState.GetSecureBoot().GetDb().GetCerts() { - switch c := cert.GetRepresentation().(type) { - case *attestpb.Certificate_WellKnown: - if c.WellKnown == attestpb.WellKnownCertificate_UNKNOWN { - t.Error(("found WellKnownCertificate_UNKNOWN in db")) - } - if c.WellKnown == attestpb.WellKnownCertificate_MS_THIRD_PARTY_UEFI_CA_2011 { - contains3PUEFI = true - } else if c.WellKnown == attestpb.WellKnownCertificate_MS_WINDOWS_PROD_PCA_2011 { - containsWinProdPCA = true - } - } - } - if !contains3PUEFI || !containsWinProdPCA { - t.Error("expected to see both WinProdPCA and ThirdPartyUEFI certs") - } - } -} - -func TestParsingCELEventLog(t *testing.T) { - test.SkipForRealTPM(t) - tpm := test.GetTPM(t) - defer client.CheckedClose(t, tpm) - - coscel := &cel.CEL{} - emptyCosState := attestpb.ContainerState{} - - var buf bytes.Buffer - // First, encode an empty CEL and try to parse it. - if err := coscel.EncodeCEL(&buf); err != nil { - t.Fatal(err) - } - banks, err := client.ReadAllPCRs(tpm) - if err != nil { - t.Fatal(err) - } - - implementedHashes := []crypto.Hash{} - // get all implmented hash algo in the TPM - for _, h := range banks { - hsh, err := tpm2.Algorithm(h.Hash).Hash() - if err != nil { - t.Fatal(err) - } - implementedHashes = append(implementedHashes, crypto.Hash(hsh)) - } - - for _, bank := range banks { - // pcrs can have any value here, since the coscel has no records, the replay should always success. - msState, err := parseCanonicalEventLog(buf.Bytes(), bank) - if err != nil { - t.Errorf("expecting no error from parseCanonicalEventLog(), but get %v", err) - } - if diff := cmp.Diff(msState.Cos.Container, &emptyCosState, protocmp.Transform()); diff != "" { - t.Errorf("unexpected difference:\n%v", diff) - } - } - - // Secondly, append some real COS events to the CEL. This time we should get content in the CosState. - testCELEvents := []struct { - cosNestedEventType cel.CosType - pcr int - eventPayload []byte - }{ - {cel.ImageRefType, cel.CosEventPCR, []byte("docker.io/bazel/experimental/test:latest")}, - {cel.ImageDigestType, cel.CosEventPCR, []byte("sha256:781d8dfdd92118436bd914442c8339e653b83f6bf3c1a7a98efcfb7c4fed7483")}, - {cel.RestartPolicyType, cel.CosEventPCR, []byte(attestpb.RestartPolicy_Always.String())}, - {cel.ImageIDType, cel.CosEventPCR, []byte("sha256:5DF4A1AC347DCF8CF5E9D0ABC04B04DB847D1B88D3B1CC1006F0ACB68E5A1F4B")}, - {cel.EnvVarType, cel.CosEventPCR, []byte("foo=bar")}, - {cel.EnvVarType, cel.CosEventPCR, []byte("bar=baz")}, - {cel.EnvVarType, cel.CosEventPCR, []byte("baz=foo=bar")}, - {cel.EnvVarType, cel.CosEventPCR, []byte("empty=")}, - {cel.ArgType, cel.CosEventPCR, []byte("--x")}, - {cel.ArgType, cel.CosEventPCR, []byte("--y")}, - {cel.ArgType, cel.CosEventPCR, []byte("")}, - } - - expectedEnvVars := make(map[string]string) - expectedEnvVars["foo"] = "bar" - expectedEnvVars["bar"] = "baz" - expectedEnvVars["baz"] = "foo=bar" - expectedEnvVars["empty"] = "" - - want := attestpb.ContainerState{ - ImageReference: string(testCELEvents[0].eventPayload), - ImageDigest: string(testCELEvents[1].eventPayload), - RestartPolicy: attestpb.RestartPolicy_Always, - ImageId: string(testCELEvents[3].eventPayload), - EnvVars: expectedEnvVars, - Args: []string{string(testCELEvents[8].eventPayload), string(testCELEvents[9].eventPayload), string(testCELEvents[10].eventPayload)}, - } - for _, testEvent := range testCELEvents { - cos := cel.CosTlv{EventType: testEvent.cosNestedEventType, EventContent: testEvent.eventPayload} - if err := coscel.AppendEvent(tpm, testEvent.pcr, implementedHashes, cos); err != nil { - t.Fatal(err) - } - } - buf = bytes.Buffer{} - if err := coscel.EncodeCEL(&buf); err != nil { - t.Fatal(err) - } - banks, err = client.ReadAllPCRs(tpm) - if err != nil { - t.Fatal(err) - } - for _, bank := range banks { - if msState, err := parseCanonicalEventLog(buf.Bytes(), bank); err != nil { - t.Errorf("expecting no error from parseCanonicalEventLog(), but get %v", err) - } else { - if diff := cmp.Diff(msState.Cos.Container, &want, protocmp.Transform()); diff != "" { - t.Errorf("unexpected difference:\n%v", diff) - } - } - } - - // Thirdly, append a random non-COS event, encode and try to parse it. - // Because there is no COS TLV event, attestation should fail as we do not - // understand the content type. - event, err := generateNonCosCelEvent(implementedHashes) - if err != nil { - t.Fatal(err) - } - coscel.Records = append(coscel.Records, event) - buf = bytes.Buffer{} - if err := coscel.EncodeCEL(&buf); err != nil { - t.Fatal(err) - } - // extend digests to the PCR - for _, hash := range implementedHashes { - algo, err := tpm2.HashToAlgorithm(hash) - if err != nil { - t.Fatal(err) - } - if err := tpm2.PCRExtend(tpm, tpmutil.Handle(cel.CosEventPCR), algo, event.Digests[hash], ""); err != nil { - t.Fatal(err) - } - } - banks, err = client.ReadAllPCRs(tpm) - if err != nil { - t.Fatal(err) - } - for _, bank := range banks { - _, err := parseCanonicalEventLog(buf.Bytes(), bank) - if err == nil { - t.Errorf("expected error when parsing event log with unknown content type") - } - } -} - -func generateNonCosCelEvent(hashAlgoList []crypto.Hash) (cel.Record, error) { - randRecord := cel.Record{} - randRecord.RecNum = 0 - randRecord.PCR = cel.CosEventPCR - contentValue := make([]byte, 10) - rand.Read(contentValue) - randRecord.Content = cel.TLV{Type: 250, Value: contentValue} - contentBytes, err := randRecord.Content.MarshalBinary() - if err != nil { - return cel.Record{}, err - } - - digestMap := make(map[crypto.Hash][]byte) - for _, hash := range hashAlgoList { - h := hash.New() - h.Write(contentBytes) - digestMap[hash] = h.Sum(nil) - } - randRecord.Digests = digestMap - - return randRecord, nil -} - -func TestParseLinuxKernelState(t *testing.T) { - logs := []struct { - eventLog - name string - expectedCmdline string - }{ - {COS85AmdSev, "COS85AmdSev", test.Cos85AmdSevCmdline}, - {COS93AmdSev, "COS93AmdSev", test.Cos93AmdSevCmdline}, - {COS101AmdSev, "COS101AmdSev", test.Cos101AmdSevCmdline}, - } - for _, log := range logs { - for _, bank := range log.Banks { - hashName := pb.HashAlgo_name[int32(bank.Hash)] - subtestName := fmt.Sprintf("%s-%s", log.name, hashName) - t.Run(subtestName, func(t *testing.T) { - msState, err := parsePCClientEventLog(log.RawLog, bank, GRUB) - if err != nil { - t.Errorf("failed to parse and replay log: %v", err) - } - - if msState.LinuxKernel == nil || len(msState.LinuxKernel.CommandLine) == 0 { - t.Errorf("expected %s to have a LinuxKernelState", log.name) - } - - if msState.LinuxKernel.CommandLine != log.expectedCmdline { - t.Errorf("kernel command line for log %s:\n'%s'\n did not match expected cmdline:\n'%s'", - log.name, - msState.LinuxKernel.CommandLine, - log.expectedCmdline) - } - }) - } - } -} - -func TestParseGrubState(t *testing.T) { - logs := []struct { - eventLog - name string - }{ - {COS85AmdSev, "COS85AmdSev"}, - {COS93AmdSev, "COS93AmdSev"}, - {COS101AmdSev, "COS101AmdSev"}, - } - for _, log := range logs { - for _, bank := range log.Banks { - hashName := pb.HashAlgo_name[int32(bank.Hash)] - subtestName := fmt.Sprintf("%s-%s", log.name, hashName) - t.Run(subtestName, func(t *testing.T) { - msState, err := parsePCClientEventLog(log.RawLog, bank, GRUB) - if err != nil { - t.Errorf("failed to parse and replay log: %v", err) - } - - if len(msState.Grub.GetCommands()) == 0 { - t.Errorf("expected COS85 to run GRUB commands!") - } - if len(msState.Grub.GetFiles()) != 2 { - t.Errorf("expected COS85 to read two files (grub.cfg and kernel)!") - } - }) - } - } -} - -func TestParseGrubStateFail(t *testing.T) { - // No GRUB measurements for this event log. - eventlog := GlinuxNoSecureBootLaptop - for _, bank := range eventlog.Banks { - hashName := pb.HashAlgo_name[int32(bank.Hash)] - subtestName := fmt.Sprintf("GlinuxNoSecureBootLaptop-%s", hashName) - t.Run(subtestName, func(t *testing.T) { - _, err := parsePCClientEventLog(eventlog.RawLog, bank, GRUB) - if err == nil { - t.Error("expected error when parsing GRUB state") - } - gErr, ok := err.(*GroupedError) - if !ok { - t.Errorf("ParseMachineState should return a GroupedError") - } - if !gErr.containsSubstring("no GRUB measurements found") { - t.Errorf("expected GroupedError (%s) to contain no GRUB measurements error", err) - } - }) - } -} - -func TestParseEfiState(t *testing.T) { - logs := []struct { - eventLog - name string - }{ - {Rhel8GCE, "Rhel8GCE"}, - {UbuntuAmdSevGCE, "UbuntuAmdSevGCE"}, - {Ubuntu2104NoSecureBootGCE, "Ubuntu2104NoSecureBootGCE"}, - {COS85AmdSev, "COS85AmdSev"}, - {COS93AmdSev, "COS93AmdSev"}, - {COS101AmdSev, "COS101AmdSev"}, - } - for _, log := range logs { - for _, bank := range log.Banks { - hashName := pb.HashAlgo_name[int32(bank.Hash)] - subtestName := fmt.Sprintf("%s-%s", log.name, hashName) - t.Run(subtestName, func(t *testing.T) { - msState, err := parsePCClientEventLog(log.RawLog, bank, UnsupportedLoader) - if err != nil { - t.Errorf("parsePCClientEventLog(%v, %v) got err = %v, want nil", log.name, bank.GetHash().String(), err) - } - - if msState.GetEfi() == nil { - t.Error("msState.GetEfi() returned nil, want EFI state") - } - efiApps := msState.GetEfi().GetApps() - if len(efiApps) == 0 { - t.Error("msState.GetEfi().GetApps() returned empty, want non-zero length") - } - expectedDigestStrs := log.ExpectedEFIAppDigests[bank.Hash] - if len(expectedDigestStrs) == 0 { - t.Fatalf("%v log used to test EFIState, but it has no expected EFI App digests", log.name) - } - expectedDigests := make([][]byte, 0, len(expectedDigestStrs)) - for _, digestStr := range log.ExpectedEFIAppDigests[bank.Hash] { - expectedDigests = append(expectedDigests, decodeHex(digestStr)) - } - gotDigests := make([][]byte, 0, len(efiApps)) - for _, app := range efiApps { - gotDigests = append(gotDigests, app.GetDigest()) - } - if !cmp.Equal(gotDigests, expectedDigests) { - t.Errorf("msState.GetEfi().GetApps() digests got %v, want %v", gotDigests, expectedDigests) - } - }) - } - } -} - -func decodeHex(hexStr string) []byte { - bytes, err := hex.DecodeString(hexStr) - if err != nil { - panic(err) - } - return bytes -} diff --git a/vendor/github.com/google/go-tpm-tools/server/example_test.go b/vendor/github.com/google/go-tpm-tools/server/example_test.go deleted file mode 100644 index 12624c0b9..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package server - -import ( - "crypto" - "fmt" - "log" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/simulator" -) - -func ExampleVerifyAttestation() { - // On client machine, generate the TPM quote. - // TODO: use real TPM. - simulator, err := simulator.Get() - if err != nil { - log.Fatalf("failed to initialize simulator: %v", err) - } - defer simulator.Close() - - ak, err := client.AttestationKeyRSA(simulator) - if err != nil { - log.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - nonce := []byte("super secret nonce") - attestation, err := ak.Attest(client.AttestOpts{Nonce: nonce}) - if err != nil { - log.Fatalf("failed to attest: %v", err) - } - - // TODO: send Attestation proto to verifier - - // verify the attesation proto - opts := VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - AllowSHA1: true, - } - state, err := VerifyAttestation(attestation, opts) - if err != nil { - log.Fatalf("failed to verify: %v", err) - } - - fmt.Println(state) -} diff --git a/vendor/github.com/google/go-tpm-tools/server/grouped_error.go b/vendor/github.com/google/go-tpm-tools/server/grouped_error.go deleted file mode 100644 index 26a4f5a06..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/grouped_error.go +++ /dev/null @@ -1,77 +0,0 @@ -package server - -import "strings" - -var fatalError = "fatal: invalid GroupedError" - -// GroupedError collects related errors and exposes them as a single error. -// Users can inspect the `Errors` field for details on the suberrors. -type GroupedError struct { - // The prefix string returned by `Error()`, followed by the grouped errors. - Prefix string - Errors []error -} - -func (gErr *GroupedError) Error() string { - if len(gErr.Errors) == 0 { - return fatalError - } - var sb strings.Builder - for _, err := range gErr.Errors { - sb.WriteString("\n") - sb.WriteString(err.Error()) - } - return gErr.Prefix + sb.String() -} - -func createGroupedError(prefix string, errors []error) error { - if len(errors) == 0 { - return nil - } - return &GroupedError{Prefix: prefix, Errors: errors} -} - -func (gErr *GroupedError) containsSubstring(substr string) bool { - for _, err := range gErr.Errors { - if strings.Contains(err.Error(), substr) { - return true - } - } - return false -} - -// containsKnownSubstrings is used to match a set of known errors. -// Each substring must only match error in the GroupedError. -// In other words, there must not be overlap in the substring matches. -func (gErr *GroupedError) containsKnownSubstrings(substrs []string) bool { - if len(gErr.Errors) != len(substrs) { - return false - } - matchedGErr := make(map[string]bool) - for _, err := range gErr.Errors { - matchedGErr[err.Error()] = false - for _, substr := range substrs { - if strings.Contains(err.Error(), substr) { - if matchedGErr[err.Error()] { - // Duplicated match for the error. - return false - } - matchedGErr[err.Error()] = true - } - } - } - - for _, matched := range matchedGErr { - if !matched { - return false - } - } - return true -} - -func (gErr *GroupedError) containsOnlySubstring(substr string) bool { - if len(gErr.Errors) != 1 { - return false - } - return gErr.containsSubstring(substr) -} diff --git a/vendor/github.com/google/go-tpm-tools/server/grouped_error_test.go b/vendor/github.com/google/go-tpm-tools/server/grouped_error_test.go deleted file mode 100644 index f2600c9b0..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/grouped_error_test.go +++ /dev/null @@ -1,126 +0,0 @@ -package server - -import ( - "errors" - "fmt" - "testing" -) - -func TestGroupedError(t *testing.T) { - var gErr GroupedError - gErr.Errors = append(gErr.Errors, errors.New("error1")) - gErr.Errors = append(gErr.Errors, errors.New("error2")) - gErr.Errors = append(gErr.Errors, fmt.Errorf("fmted error")) - gErr.Errors = append(gErr.Errors, fmt.Errorf("wrapped: %w", errors.New("error3"))) - gErr.Prefix = "failed action:" - - expected := `failed action: -error1 -error2 -fmted error -wrapped: error3` - - if gErr.Error() != expected { - t.Errorf("error string output (%s) did not match expected (%s)", - gErr.Error(), expected) - } -} - -func TestEmptyGroupedError(t *testing.T) { - outErr := GroupedError{Prefix: "foo:", Errors: []error{}} - if outErr.Error() != fatalError { - t.Errorf("error string output (%s) did not match fatal error (%s)", - outErr.Error(), fatalError) - } -} - -func TestCreateGroupedErrorFail(t *testing.T) { - outErr := createGroupedError("foo:", []error{}) - if outErr != nil { - t.Errorf("expected nil error!") - } -} - -func TestContainsOnlySubstring(t *testing.T) { - wholeString := "err error errorz" - err := errors.New(wholeString) - outErr := GroupedError{Prefix: "foo:", Errors: []error{err}} - if !outErr.containsOnlySubstring("error") { - t.Errorf("expected a match for substring") - } - if !outErr.containsOnlySubstring("err") { - t.Errorf("expected a match for substring") - } - if !outErr.containsOnlySubstring("") { - t.Errorf("expected a match for substring") - } - if !outErr.containsOnlySubstring(wholeString) { - t.Errorf("expected a match for substring") - } -} - -func TestContainsOnlySubstringsFalse(t *testing.T) { - wholeString := "err error errorz" - err := errors.New(wholeString) - outErr := GroupedError{Prefix: "foo:", Errors: []error{err}} - - tests := []struct { - name string - substring string - }{ - {"AdditionalCharacterStart", "." + wholeString}, - {"AdditionalCharacterEnd", wholeString + "."}, - {"RemovedCharacter", wholeString[:5] + wholeString[6:]}, - {"ReplacedCharacter", wholeString[:5] + "." + wholeString[6:]}, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - if outErr.containsOnlySubstring(test.substring) { - t.Errorf("expected failed matching for substring") - } - - }) - } -} - -func TestContainsKnownSubstrings(t *testing.T) { - err := errors.New("err error errorz") - err2 := errors.New("new newww newzz") - err3 := errors.New("iss issue issues") - outErr := GroupedError{Prefix: "foo:", Errors: []error{err, err2, err3}} - if !outErr.containsKnownSubstrings([]string{"error", " newzz", " issue "}) { - t.Errorf("expected a match for known substrings") - } -} - -func TestContainsKnownSubstringsFalse(t *testing.T) { - err := errors.New("err error errorz") - err2 := errors.New("new newww newzz") - err3 := errors.New("iss issue issues") - outErr := GroupedError{Prefix: "foo:", Errors: []error{err, err2, err3}} - - tests := []struct { - name string - substrings []string - }{ - {"NoSubstrings", []string{}}, - {"OneEmptySubstring", []string{""}}, - // Should fail, since there is overlap between substrings. - {"AllEmptySubstrings", []string{"", "", ""}}, - {"FewerSubstrings", []string{"err"}}, - {"FewerSubstrings2", []string{"error", " issue "}}, - {"MoreSubstrings", []string{"error", " newzz", " issue ", " issues"}}, - {"MoreSubstrings5", []string{"error", " newzz", " issue ", " issues", "err"}}, - {"OverlappingSubstrings", []string{"error", " err", " issue "}}, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - if outErr.containsKnownSubstrings(test.substrings) { - t.Errorf("expected failed matching for known substrings") - } - - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/server/import.go b/vendor/github.com/google/go-tpm-tools/server/import.go deleted file mode 100644 index 7e2248f45..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/import.go +++ /dev/null @@ -1,246 +0,0 @@ -// Package server contains functions to be ran on a server (no TPM needed), as oppose to a client (with TPM). -package server - -import ( - "crypto" - "crypto/aes" - "crypto/cipher" - "crypto/elliptic" - "crypto/hmac" - "crypto/rand" - "crypto/rsa" - "fmt" - "hash" - "io" - - "github.com/google/go-tpm/legacy/tpm2" - "github.com/google/go-tpm/tpmutil" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal" - pb "github.com/google/go-tpm-tools/proto/tpm" -) - -// CreateImportBlob uses the provided public EK to encrypt the sensitive data. -// The returned ImportBlob can then be decrypted and imported using the -// client Key.Import() method. A non-nil pcrs parameter adds a requirement -// that the TPM must have specific PCR values for Import() to succeed. -func CreateImportBlob(ekPub crypto.PublicKey, sensitive []byte, pcrs *pb.PCRs) (*pb.ImportBlob, error) { - ek, err := CreateEKPublicAreaFromKey(ekPub) - if err != nil { - return nil, err - } - private := createPrivate(sensitive) - public := createPublic(private) - - return createImportBlobHelper(ek, public, private, pcrs) -} - -// CreateSigningKeyImportBlob uses the provided public EK to encrypt the signing -// key into import blob format. The returned import blob can be used to import -// the signing key into the TPM associated with the provided EK without exposing -// the private area to the TPM's OS using the client Key.ImportSigningKey() -// method. A non-nil pcrs parameter adds a requirement that the TPM must have -// specific PCR values to use the signing key. -func CreateSigningKeyImportBlob(ekPub crypto.PublicKey, signingKey crypto.PrivateKey, pcrs *pb.PCRs) (*pb.ImportBlob, error) { - ek, err := CreateEKPublicAreaFromKey(ekPub) - if err != nil { - return nil, err - } - public, private, err := createPublicPrivateSign(signingKey) - if err != nil { - return nil, err - } - - return createImportBlobHelper(ek, public, private, pcrs) -} - -func createImportBlobHelper(ek, public tpm2.Public, private tpm2.Private, pcrs *pb.PCRs) (*pb.ImportBlob, error) { - setPublicAuth(&public, pcrs) - - var seed, encryptedSeed []byte - var err error - switch ek.Type { - case tpm2.AlgRSA: - seed, encryptedSeed, err = createRSASeed(ek) - if err != nil { - return nil, err - } - case tpm2.AlgECC: - seed, encryptedSeed, err = createECCSeed(ek) - if err != nil { - return nil, err - } - default: - return nil, fmt.Errorf("unsupported EK type: %v", ek.Type) - } - duplicate, err := createDuplicate(private, seed, public, ek) - if err != nil { - return nil, err - } - pubEncoded, err := public.Encode() - if err != nil { - return nil, err - } - - return &pb.ImportBlob{ - Duplicate: duplicate, - EncryptedSeed: encryptedSeed, - PublicArea: pubEncoded, - Pcrs: pcrs, - }, nil -} - -func setPublicAuth(public *tpm2.Public, pcrs *pb.PCRs) { - if len(pcrs.GetPcrs()) == 0 { - // Allow password authorization so we can use a nil AuthPolicy. - public.AuthPolicy = nil - public.Attributes |= tpm2.FlagUserWithAuth - } else { - public.AuthPolicy = internal.PCRSessionAuth(pcrs, client.SessionHashAlg) - public.Attributes |= tpm2.FlagAdminWithPolicy - } -} - -func createRSASeed(ek tpm2.Public) (seed, encryptedSeed []byte, err error) { - seedSize := ek.RSAParameters.Symmetric.KeyBits / 8 - seed = make([]byte, seedSize) - if _, err := io.ReadFull(rand.Reader, seed); err != nil { - panic(err) - } - - ekPub, err := ek.Key() - if err != nil { - return nil, nil, err - } - encryptedSeed, err = rsa.EncryptOAEP( - getHash(ek.NameAlg), - rand.Reader, - ekPub.(*rsa.PublicKey), - seed, - []byte("DUPLICATE\x00")) - if err != nil { - return nil, nil, err - } - encryptedSeed, err = tpmutil.Pack(encryptedSeed) - return seed, encryptedSeed, err -} - -func createECCSeed(ek tpm2.Public) (seed, encryptedSeed []byte, err error) { - curve, err := curveIDToGoCurve(ek.ECCParameters.CurveID) - if err != nil { - return nil, nil, err - } - priv, x, y, err := elliptic.GenerateKey(curve, rand.Reader) - if err != nil { - return nil, nil, err - } - ekPoint := ek.ECCParameters.Point - z, _ := curve.ScalarMult(ekPoint.X(), ekPoint.Y(), priv) - xBytes := eccIntToBytes(curve, x) - - seed, err = tpm2.KDFe( - ek.NameAlg, - eccIntToBytes(curve, z), - "DUPLICATE", - xBytes, - eccIntToBytes(curve, ekPoint.X()), - getHash(ek.NameAlg).Size()*8) - if err != nil { - return nil, nil, err - } - encryptedSeed, err = tpmutil.Pack(tpmutil.U16Bytes(xBytes), tpmutil.U16Bytes(eccIntToBytes(curve, y))) - return seed, encryptedSeed, err -} - -func createDuplicate(private tpm2.Private, seed []byte, public, ek tpm2.Public) ([]byte, error) { - nameEncoded, err := getEncodedName(public) - if err != nil { - return nil, err - } - secret, err := private.Encode() - if err != nil { - return nil, err - } - packedSecret, err := tpmutil.Pack(tpmutil.U16Bytes(secret)) - if err != nil { - return nil, err - } - encryptedSecret, err := encryptSecret(packedSecret, seed, nameEncoded, ek) - if err != nil { - return nil, err - } - macSum, err := createHMAC(encryptedSecret, nameEncoded, seed, ek.NameAlg) - if err != nil { - return nil, err - } - return tpmutil.Pack(tpm2.IDObject{ - IntegrityHMAC: macSum, - EncIdentity: encryptedSecret, - }) -} - -func getEncodedName(public tpm2.Public) ([]byte, error) { - name, err := public.Name() - if err != nil { - return nil, err - } - return name.Digest.Encode() -} - -func encryptSecret(secret, seed, nameEncoded []byte, ek tpm2.Public) ([]byte, error) { - var symSize int - switch ek.Type { - case tpm2.AlgRSA: - symSize = int(ek.RSAParameters.Symmetric.KeyBits) - case tpm2.AlgECC: - symSize = int(ek.ECCParameters.Symmetric.KeyBits) - default: - return nil, fmt.Errorf("unsupported EK type: %v", ek.Type) - } - - symmetricKey, err := tpm2.KDFa( - ek.NameAlg, - seed, - "STORAGE", - nameEncoded, - /*contextV=*/ nil, - symSize) - if err != nil { - return nil, err - } - c, err := aes.NewCipher(symmetricKey) - if err != nil { - return nil, err - } - encSecret := make([]byte, len(secret)) - // The TPM spec requires an all-zero IV. - iv := make([]byte, len(symmetricKey)) - cipher.NewCFBEncrypter(c, iv).XORKeyStream(encSecret, secret) - return encSecret, nil -} - -func createHMAC(encryptedSecret, nameEncoded, seed []byte, hashAlg tpm2.Algorithm) ([]byte, error) { - macKey, err := tpm2.KDFa( - hashAlg, - seed, - "INTEGRITY", - /*contextU=*/ nil, - /*contextV=*/ nil, - getHash(hashAlg).Size()*8) - if err != nil { - return nil, err - } - mac := hmac.New(func() hash.Hash { return getHash(hashAlg) }, macKey) - mac.Write(encryptedSecret) - mac.Write(nameEncoded) - return mac.Sum(nil), nil -} - -func getHash(hashAlg tpm2.Algorithm) hash.Hash { - create, err := hashAlg.Hash() - if err != nil { - panic(err) - } - return create.New() -} diff --git a/vendor/github.com/google/go-tpm-tools/server/import_test.go b/vendor/github.com/google/go-tpm-tools/server/import_test.go deleted file mode 100644 index c41baf6af..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/import_test.go +++ /dev/null @@ -1,249 +0,0 @@ -package server - -import ( - "bytes" - "crypto" - "crypto/rand" - "crypto/rsa" - "errors" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - pb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" -) - -func TestImport(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - keys := []struct { - name string - template tpm2.Public - }{ - {"RSA", client.DefaultEKTemplateRSA()}, - {"ECC", client.DefaultEKTemplateECC()}, - {"SRK-RSA", client.SRKTemplateRSA()}, - {"SRK-ECC", client.SRKTemplateECC()}, - {"ECC-P224", getECCTemplate(tpm2.CurveNISTP224)}, - {"ECC-P256", getECCTemplate(tpm2.CurveNISTP256)}, - {"ECC-P384", getECCTemplate(tpm2.CurveNISTP384)}, - {"ECC-P521", getECCTemplate(tpm2.CurveNISTP521)}, - } - for _, k := range keys { - t.Run(k.name, func(t *testing.T) { - ek, err := client.NewKey(rwc, tpm2.HandleEndorsement, k.template) - if err != nil { - t.Fatal(err) - } - defer ek.Close() - pub := ek.PublicKey() - secret := []byte("super secret code") - blob, err := CreateImportBlob(pub, secret, nil) - if err != nil { - t.Fatalf("creating import blob failed: %v", err) - } - - output, err := ek.Import(blob) - if err != nil { - t.Fatalf("import failed: %v", err) - } - if !bytes.Equal(output, secret) { - t.Errorf("got %X, expected %X", output, secret) - } - }) - } -} - -func isExpectedError(err error, expected []error) bool { - for _, candidate := range expected { - if errors.Is(err, candidate) { - return true - } - } - return false -} - -func TestBadImport(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - valueErr := tpm2.ParameterError{ - Code: tpm2.RCValue, - Parameter: tpm2.RC4, - } - // RSA keys lengths are not consistent, so we could also get RCSize - rsaWrongKeyErrs := []error{valueErr, tpm2.ParameterError{ - Code: tpm2.RCSize, - Parameter: tpm2.RC4, - }} - integrityErr := tpm2.ParameterError{ - Code: tpm2.RCIntegrity, - Parameter: tpm2.RC3, - } - pointErr := tpm2.ParameterError{ - Code: tpm2.RCECCPoint, - Parameter: tpm2.RC4, - } - - keys := []struct { - name string - template tpm2.Public - wrongKeyErrs []error - corruptedErrs []error - }{ - {"RSA", client.DefaultEKTemplateRSA(), rsaWrongKeyErrs, []error{valueErr}}, - {"ECC", client.DefaultEKTemplateECC(), []error{integrityErr}, []error{pointErr}}, - {"SRK-RSA", client.SRKTemplateRSA(), rsaWrongKeyErrs, []error{valueErr}}, - {"SRK-ECC", client.SRKTemplateECC(), []error{integrityErr}, []error{pointErr}}, - } - - for _, k := range keys { - t.Run(k.name, func(t *testing.T) { - ek, err := client.NewKey(rwc, tpm2.HandleEndorsement, k.template) - if err != nil { - t.Fatal(err) - } - defer ek.Close() - pub := ek.PublicKey() - - // Create a second, different key - template2 := k.template - template2.Attributes ^= tpm2.FlagNoDA - ek2, err := client.NewKey(rwc, tpm2.HandleEndorsement, template2) - if err != nil { - t.Fatal(err) - } - defer ek2.Close() - - secret := []byte("super secret code") - blob, err := CreateImportBlob(pub, secret, nil) - if err != nil { - t.Fatalf("creating import blob failed: %v", err) - } - - // Try to import this blob under the wrong key - if _, err = ek2.Import(blob); !isExpectedError(err, k.wrongKeyErrs) { - t.Errorf("got error: %v, expected: %v", err, k.wrongKeyErrs) - } - - // Try to import a corrupted blob - blob.EncryptedSeed[10] ^= 0xFF - if _, err = ek.Import(blob); !isExpectedError(err, k.corruptedErrs) { - t.Errorf("got error: %v, expected: %v", err, k.corruptedErrs) - } - }) - } -} - -func TestImportPCRs(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ek, err := client.EndorsementKeyRSA(rwc) - if err != nil { - t.Fatal(err) - } - defer ek.Close() - pcr0, err := tpm2.ReadPCR(rwc, 0, tpm2.AlgSHA256) - if err != nil { - t.Fatal(err) - } - badPCR := append([]byte(nil), pcr0...) - // badPCR increments first value so it doesn't match. - badPCR[0]++ - subtests := []struct { - name string - pcrs *pb.PCRs - expectSuccess bool - }{ - {"No-PCR-nil", nil, true}, - {"No-PCR-empty", &pb.PCRs{Hash: pb.HashAlgo_SHA256}, true}, - {"Good-PCR", &pb.PCRs{Hash: pb.HashAlgo_SHA256, Pcrs: map[uint32][]byte{0: pcr0}}, true}, - {"Bad-PCR", &pb.PCRs{Hash: pb.HashAlgo_SHA256, Pcrs: map[uint32][]byte{0: badPCR}}, false}, - } - for _, subtest := range subtests { - t.Run(subtest.name, func(t *testing.T) { - secret := []byte("super secret code") - blob, err := CreateImportBlob(ek.PublicKey(), secret, subtest.pcrs) - if err != nil { - t.Fatalf("creating import blob failed: %v", err) - } - output, err := ek.Import(blob) - if subtest.expectSuccess { - if err != nil { - t.Fatalf("import failed: %v", err) - } - if !bytes.Equal(output, secret) { - t.Errorf("got %X, expected %X", output, secret) - } - } else if err == nil { - t.Error("expected Import to fail but it did not") - } - }) - } -} - -func TestSigningKeyImport(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ek, err := client.EndorsementKeyRSA(rwc) - if err != nil { - t.Fatal(err) - } - defer ek.Close() - signingKey, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Fatal(err) - } - pcr0, err := tpm2.ReadPCR(rwc, 0, tpm2.AlgSHA256) - if err != nil { - t.Fatal(err) - } - badPCR := append(make([]byte, 0), pcr0...) - // badPCR increments first value so it doesn't match. - badPCR[0]++ - subtests := []struct { - name string - pcrs *pb.PCRs - expectSuccess bool - }{ - {"No-PCR-nil", nil, true}, - {"No-PCR-empty", &pb.PCRs{Hash: pb.HashAlgo_SHA256}, true}, - {"Good-PCR", &pb.PCRs{Hash: pb.HashAlgo_SHA256, Pcrs: map[uint32][]byte{0: pcr0}}, true}, - {"Bad-PCR", &pb.PCRs{Hash: pb.HashAlgo_SHA256, Pcrs: map[uint32][]byte{0: badPCR}}, false}, - } - for _, subtest := range subtests { - t.Run(subtest.name, func(t *testing.T) { - blob, err := CreateSigningKeyImportBlob(ek.PublicKey(), signingKey, subtest.pcrs) - if err != nil { - t.Fatalf("creating import blob failed: %v", err) - } - - importedKey, err := ek.ImportSigningKey(blob) - if err != nil { - t.Fatalf("import failed: %v", err) - } - defer importedKey.Close() - signer, err := importedKey.GetSigner() - if err != nil { - t.Fatalf("could not create signer: %v", err) - } - var digest [32]byte - - sig, err := signer.Sign(nil, digest[:], crypto.SHA256) - if subtest.expectSuccess { - if err != nil { - t.Fatalf("import failed: %v", err) - } - if err = rsa.VerifyPKCS1v15(&signingKey.PublicKey, crypto.SHA256, digest[:], sig); err != nil { - t.Error(err) - } - return - } else if err == nil { - t.Error("expected Import to fail but it did not") - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/server/instance_info.go b/vendor/github.com/google/go-tpm-tools/server/instance_info.go deleted file mode 100644 index 1d0777011..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/instance_info.go +++ /dev/null @@ -1,19 +0,0 @@ -package server - -import ( - "fmt" - "net/url" - - pb "github.com/google/go-tpm-tools/proto/attest" -) - -// GCEInstanceURL returns a Google API URL to the specified instance. This URL -// can then be used with GCE instance APIs. -func GCEInstanceURL(i *pb.GCEInstanceInfo) string { - return fmt.Sprintf( - "https://www.googleapis.com/compute/v1/projects/%s/zones/%s/instances/%s", - url.PathEscape(i.GetProjectId()), - url.PathEscape(i.GetZone()), - url.PathEscape(i.GetInstanceName()), // Can use either the name or id here - ) -} diff --git a/vendor/github.com/google/go-tpm-tools/server/key_conversion.go b/vendor/github.com/google/go-tpm-tools/server/key_conversion.go deleted file mode 100644 index c4aca4fca..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/key_conversion.go +++ /dev/null @@ -1,108 +0,0 @@ -package server - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rand" - "crypto/rsa" - "fmt" - "io" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm/legacy/tpm2" -) - -var defaultNameAlg = client.DefaultEKTemplateRSA().NameAlg - -// CreateEKPublicAreaFromKey creates a public area from a go interface PublicKey. -// Supports RSA and ECC keys. -func CreateEKPublicAreaFromKey(k crypto.PublicKey) (tpm2.Public, error) { - switch key := k.(type) { - case *rsa.PublicKey: - return createEKPublicRSA(key) - case *ecdsa.PublicKey: - return createEKPublicECC(key) - default: - return tpm2.Public{}, fmt.Errorf("unsupported public key type: %T", k) - } -} - -func createEKPublicRSA(rsaKey *rsa.PublicKey) (tpm2.Public, error) { - public := client.DefaultEKTemplateRSA() - if rsaKey.N.BitLen() != int(public.RSAParameters.KeyBits) { - return tpm2.Public{}, fmt.Errorf("unexpected RSA modulus size: %d bits", rsaKey.N.BitLen()) - } - if rsaKey.E != int(public.RSAParameters.Exponent()) { - return tpm2.Public{}, fmt.Errorf("unexpected RSA exponent: %d", rsaKey.E) - } - public.RSAParameters.ModulusRaw = rsaKey.N.Bytes() - return public, nil -} - -func createEKPublicECC(eccKey *ecdsa.PublicKey) (public tpm2.Public, err error) { - public = client.DefaultEKTemplateECC() - public.ECCParameters.Point = tpm2.ECPoint{ - XRaw: eccIntToBytes(eccKey.Curve, eccKey.X), - YRaw: eccIntToBytes(eccKey.Curve, eccKey.Y), - } - public.ECCParameters.CurveID, err = goCurveToCurveID(eccKey.Curve) - return public, err -} - -func createPublic(private tpm2.Private) tpm2.Public { - publicHash := getHash(defaultNameAlg) - publicHash.Write(private.SeedValue) - publicHash.Write(private.Sensitive) - return tpm2.Public{ - Type: tpm2.AlgKeyedHash, - NameAlg: defaultNameAlg, - KeyedHashParameters: &tpm2.KeyedHashParams{ - Alg: tpm2.AlgNull, - Unique: publicHash.Sum(nil), - }, - } -} - -func createPrivate(sensitive []byte) tpm2.Private { - private := tpm2.Private{ - Type: tpm2.AlgKeyedHash, - AuthValue: nil, - SeedValue: make([]byte, getHash(defaultNameAlg).Size()), - Sensitive: sensitive, - } - if _, err := io.ReadFull(rand.Reader, private.SeedValue); err != nil { - panic(err) - } - return private -} - -func createPublicPrivateSign(signingKey crypto.PrivateKey) (tpm2.Public, tpm2.Private, error) { - rsaPriv, ok := signingKey.(*rsa.PrivateKey) - if !ok { - return tpm2.Public{}, tpm2.Private{}, fmt.Errorf("unsupported signing key type: %T", signingKey) - } - - rsaPub := rsaPriv.PublicKey - public := tpm2.Public{ - Type: tpm2.AlgRSA, - NameAlg: defaultNameAlg, - Attributes: tpm2.FlagSign, - RSAParameters: &tpm2.RSAParams{ - KeyBits: uint16(rsaPub.N.BitLen()), - ExponentRaw: uint32(rsaPub.E), - ModulusRaw: rsaPub.N.Bytes(), - Sign: &tpm2.SigScheme{ - Alg: tpm2.AlgRSASSA, - Hash: tpm2.AlgSHA256, - }, - }, - } - private := tpm2.Private{ - Type: tpm2.AlgRSA, - AuthValue: nil, - SeedValue: nil, // Only Storage Keys need a seed value. See part 3 TPM2_CREATE b.3. - Sensitive: rsaPriv.Primes[0].Bytes(), - } - - return public, private, nil -} diff --git a/vendor/github.com/google/go-tpm-tools/server/key_conversion_test.go b/vendor/github.com/google/go-tpm-tools/server/key_conversion_test.go deleted file mode 100644 index c991981f5..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/key_conversion_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package server - -import ( - "crypto" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/rsa" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal/test" - "github.com/google/go-tpm/legacy/tpm2" -) - -func getECCTemplate(curve tpm2.EllipticCurve) tpm2.Public { - public := client.DefaultEKTemplateECC() - public.ECCParameters.CurveID = curve - public.ECCParameters.Point.XRaw = nil - public.ECCParameters.Point.YRaw = nil - return public -} - -func TestCreateEKPublicAreaFromKeyGeneratedKey(t *testing.T) { - keys := []struct { - name string - template tpm2.Public - generateKey func() (crypto.PublicKey, error) - }{ - {"RSA", client.DefaultEKTemplateRSA(), func() (crypto.PublicKey, error) { - priv, err := rsa.GenerateKey(rand.Reader, 2048) - return priv.Public(), err - }}, - {"ECC", client.DefaultEKTemplateECC(), func() (crypto.PublicKey, error) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - return priv.Public(), err - }}, - {"ECC-P224", getECCTemplate(tpm2.CurveNISTP224), func() (crypto.PublicKey, error) { - priv, err := ecdsa.GenerateKey(elliptic.P224(), rand.Reader) - return priv.Public(), err - }}, - {"ECC-P256", getECCTemplate(tpm2.CurveNISTP256), func() (crypto.PublicKey, error) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - return priv.Public(), err - }}, - {"ECC-P384", getECCTemplate(tpm2.CurveNISTP384), func() (crypto.PublicKey, error) { - priv, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader) - return priv.Public(), err - }}, - {"ECC-P521", getECCTemplate(tpm2.CurveNISTP521), func() (crypto.PublicKey, error) { - priv, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader) - return priv.Public(), err - }}, - } - for _, k := range keys { - t.Run(k.name, func(t *testing.T) { - key, err := k.generateKey() - if err != nil { - t.Fatal(err) - } - newArea, err := CreateEKPublicAreaFromKey(key) - if err != nil { - t.Fatalf("failed to create public area from public key: %v", err) - } - if !newArea.MatchesTemplate(k.template) { - t.Errorf("public areas did not match. got: %+v want: %+v", newArea, k.template) - } - }) - } -} - -func TestCreateEKPublicAreaFromKeyTPMKey(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - keys := []struct { - name string - template tpm2.Public - }{ - {"RSA", client.DefaultEKTemplateRSA()}, - {"ECC", client.DefaultEKTemplateECC()}, - {"ECC-P224", getECCTemplate(tpm2.CurveNISTP224)}, - {"ECC-P256", getECCTemplate(tpm2.CurveNISTP256)}, - {"ECC-P384", getECCTemplate(tpm2.CurveNISTP384)}, - {"ECC-P521", getECCTemplate(tpm2.CurveNISTP521)}, - } - for _, k := range keys { - t.Run(k.name, func(t *testing.T) { - ek, err := client.NewKey(rwc, tpm2.HandleEndorsement, k.template) - if err != nil { - t.Fatal(err) - } - defer ek.Close() - newArea, err := CreateEKPublicAreaFromKey(ek.PublicKey()) - if err != nil { - t.Fatalf("failed to create public area from public key: %v", err) - } - if matches, err := ek.Name().MatchesPublic(newArea); err != nil || !matches { - t.Error("public areas did not match or match check failed.") - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/server/policy.go b/vendor/github.com/google/go-tpm-tools/server/policy.go deleted file mode 100644 index 8a12fd703..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/policy.go +++ /dev/null @@ -1,58 +0,0 @@ -package server - -import ( - "bytes" - "errors" - "fmt" - - pb "github.com/google/go-tpm-tools/proto/attest" -) - -// EvaluatePolicy succeeds if the provided MachineState complies with the -// provided policy. If the state does not pass the policy, the returned error -// will describe in what way the state failed. See the Policy documentation for -// more information about the specifics of different policies. -func EvaluatePolicy(state *pb.MachineState, policy *pb.Policy) error { - return evaluatePlatformPolicy(state.GetPlatform(), policy.GetPlatform()) -} - -func evaluatePlatformPolicy(state *pb.PlatformState, policy *pb.PlatformPolicy) error { - allowedVersions := policy.GetAllowedScrtmVersionIds() - if len(allowedVersions) > 0 { - if err := hasAllowedVersion(state, allowedVersions); err != nil { - return err - } - } - - minGceVersion := policy.GetMinimumGceFirmwareVersion() - gceVersion := state.GetGceVersion() - if minGceVersion > gceVersion { - return fmt.Errorf("expected GCE Version %d or later, got %d", minGceVersion, gceVersion) - } - minTech := policy.GetMinimumTechnology() - tech := state.GetTechnology() - if minTech > tech { - return fmt.Errorf("expected a GCE Confidential Technology of %d or later, got %d", minTech, tech) - } - return nil -} - -func hasAllowedVersion(state *pb.PlatformState, allowedVersions [][]byte) error { - firmware := state.GetFirmware() - - // We want the version check to work even for a GCE VM. - var version []byte - if scrtm, ok := firmware.(*pb.PlatformState_ScrtmVersionId); ok { - version = scrtm.ScrtmVersionId - } else if gce, ok := firmware.(*pb.PlatformState_GceVersion); ok { - version = ConvertGCEFirmwareVersionToSCRTMVersion(gce.GceVersion) - } else { - return errors.New("missing SCRTM version in PlatformState") - } - for _, allowed := range allowedVersions { - if bytes.Equal(version, allowed) { - return nil - } - } - return fmt.Errorf("provided SCRTM version (%x) not allowed", version) -} diff --git a/vendor/github.com/google/go-tpm-tools/server/policy_constants.go b/vendor/github.com/google/go-tpm-tools/server/policy_constants.go deleted file mode 100644 index 9d059815b..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/policy_constants.go +++ /dev/null @@ -1,179 +0,0 @@ -package server - -import ( - "bytes" - "crypto/x509" - _ "embed" // Necessary to use go:embed - "errors" - "fmt" - "strconv" - - pb "github.com/google/go-tpm-tools/proto/attest" -) - -// Expected TCG Event Log Event Types. -// -// Taken from TCG PC Client Platform Firmware Profile Specification, -// Table 14 Events. -const ( - NoAction uint32 = 0x00000003 - Separator uint32 = 0x00000004 - SCRTMVersion uint32 = 0x00000008 - IPL uint32 = 0x0000000D - NonhostInfo uint32 = 0x00000011 - EFIBootServicesApplication uint32 = 0x80000003 - EFIAction uint32 = 0x80000007 -) - -// Constant events used with type "EV_EFI_ACTION". -// Taken from TCG PC Client Platform Firmware Profile Specification, -// Table 17 EV_EFI_ACTION Strings. -const ( - // Measured when Boot Manager attempts to execute code from a Boot Option. - CallingEFIApplication string = "Calling EFI Application from Boot Option" - ExitBootServicesInvocation string = "Exit Boot Services Invocation" -) - -var ( - // GCENonHostInfoSignature identifies the GCE Non-Host info event, which - // indicates if memory encryption is enabled. This event is 32-bytes consisting - // of the below signature (16 bytes), followed by a byte indicating whether - // it is confidential, followed by 15 reserved bytes. - GCENonHostInfoSignature = []byte("GCE NonHostInfo\x00") - // GceVirtualFirmwarePrefix is the little-endian UCS-2 encoded string - // "GCE Virtual Firmware v" without a null terminator. All GCE firmware - // versions are UCS-2 encoded, start with this prefix, contain the firmware - // version encoded as an integer, and end with a null terminator. - GceVirtualFirmwarePrefix = []byte{0x47, 0x00, 0x43, 0x00, - 0x45, 0x00, 0x20, 0x00, 0x56, 0x00, 0x69, 0x00, 0x72, 0x00, - 0x74, 0x00, 0x75, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x20, 0x00, - 0x46, 0x00, 0x69, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x77, 0x00, - 0x61, 0x00, 0x72, 0x00, 0x65, 0x00, 0x20, 0x00, 0x76, 0x00} -) - -// Standard Secure Boot certificates (DER encoded) -var ( - //go:embed secure-boot/GcePk.crt - GceDefaultPKCert []byte - //go:embed secure-boot/MicCorKEKCA2011_2011-06-24.crt - MicrosoftKEKCA2011Cert []byte - //go:embed secure-boot/MicWinProPCA2011_2011-10-19.crt - WindowsProductionPCA2011Cert []byte - //go:embed secure-boot/MicCorUEFCA2011_2011-06-27.crt - MicrosoftUEFICA2011Cert []byte -) - -// Revoked Signing certificates (DER encoded) -var ( - //go:embed secure-boot/canonical-boothole.crt - RevokedCanonicalBootholeCert []byte - //go:embed secure-boot/debian-boothole.crt - RevokedDebianBootholeCert []byte - //go:embed secure-boot/cisco-boothole.crt - RevokedCiscoCert []byte -) - -// Known Privacy CA certs. -var ( - //go:embed ca-certs/tpm_ek_root_1.cer - gceEKRootCA []byte - //go:embed ca-certs/tpm_ek_intermediate_2.crt - gceEKIntermediateCA2 []byte -) - -// Certificates corresponding to the known CA certs for GCE. -var ( - GceEKRoots []*x509.Certificate - GceEKIntermediates []*x509.Certificate -) - -func init() { - var err error - GceEKRoots, err = parseCerts([][]byte{gceEKRootCA}) - if err != nil { - panic(fmt.Sprintf("failed to create the root cert pool: %v", err)) - } - GceEKIntermediates, err = parseCerts([][]byte{gceEKIntermediateCA2}) - if err != nil { - panic(fmt.Sprintf("failed to create the intermediate cert pool: %v", err)) - } -} - -func parseCerts(rawCerts [][]byte) ([]*x509.Certificate, error) { - certs := make([]*x509.Certificate, len(rawCerts)) - for i, certBytes := range rawCerts { - cert, err := x509.ParseCertificate(certBytes) - if err != nil { - return nil, fmt.Errorf("failed to parse cert: %w", err) - } - certs[i] = cert - } - return certs, nil -} - -// ConvertSCRTMVersionToGCEFirmwareVersion attempts to parse the Firmware -// Version of a GCE VM from the bytes of the version string of the SCRTM. This -// data should come from a valid and verified EV_S_CRTM_VERSION event. -func ConvertSCRTMVersionToGCEFirmwareVersion(version []byte) (uint32, error) { - prefixLen := len(GceVirtualFirmwarePrefix) - if (len(version) <= prefixLen) || (len(version)%2 != 0) { - return 0, fmt.Errorf("length of GCE version (%d) is invalid", len(version)) - } - if !bytes.Equal(version[:prefixLen], GceVirtualFirmwarePrefix) { - return 0, errors.New("prefix for GCE version is missing") - } - asciiVersion := []byte{} - for i, b := range version[prefixLen:] { - // Skip the UCS-2 null bytes and the null terminator - if b == '\x00' { - continue - } - // All odd bytes in our UCS-2 string should be Null - if i%2 != 0 { - return 0, errors.New("invalid UCS-2 in the version string") - } - asciiVersion = append(asciiVersion, b) - } - - versionNum, err := strconv.Atoi(string(asciiVersion)) - if err != nil { - return 0, fmt.Errorf("when parsing GCE firmware version: %w", err) - } - return uint32(versionNum), nil -} - -// ConvertGCEFirmwareVersionToSCRTMVersion creates the corresponding SCRTM -// version string from a numerical GCE firmware version. The returned string -// is UCS2 encoded with a null terminator. A version of 0 corresponds to an -// empty string (representing old GCE VMs that just used an empty string). -func ConvertGCEFirmwareVersionToSCRTMVersion(version uint32) []byte { - if version == 0 { - return []byte{} - } - versionString := GceVirtualFirmwarePrefix - for _, b := range []byte(strconv.Itoa(int(version))) { - // Convert ACSII to little-endian UCS-2 - versionString = append(versionString, b, 0) - } - // Add the null terminator - return append(versionString, 0, 0) -} - -// ParseGCENonHostInfo attempts to parse the Confidential VM -// technology used by a GCE VM from the GCE Non-Host info event. This data -// should come from a valid and verified EV_NONHOST_INFO event. -func ParseGCENonHostInfo(nonHostInfo []byte) (pb.GCEConfidentialTechnology, error) { - prefixLen := len(GCENonHostInfoSignature) - if len(nonHostInfo) < (prefixLen + 1) { - return pb.GCEConfidentialTechnology_NONE, fmt.Errorf("length of GCE Non-Host info (%d) is too short", len(nonHostInfo)) - } - - if !bytes.Equal(nonHostInfo[:prefixLen], GCENonHostInfoSignature) { - return pb.GCEConfidentialTechnology_NONE, errors.New("prefix for GCE Non-Host info is missing") - } - tech := nonHostInfo[prefixLen] - if tech > byte(pb.GCEConfidentialTechnology_AMD_SEV_SNP) { - return pb.GCEConfidentialTechnology_NONE, fmt.Errorf("unknown GCE Confidential Technology: %d", tech) - } - return pb.GCEConfidentialTechnology(tech), nil -} diff --git a/vendor/github.com/google/go-tpm-tools/server/policy_constants_test.go b/vendor/github.com/google/go-tpm-tools/server/policy_constants_test.go deleted file mode 100644 index 37dca1883..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/policy_constants_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package server - -import ( - "testing" - - pb "github.com/google/go-tpm-tools/proto/attest" -) - -func getGceMemoryEncryptionNonhostEvent(memoryEncrypted bool) []byte { - event := make([]byte, 32) - copy(event[:], []byte(GCENonHostInfoSignature)) - // event[15] is a null byte. - if memoryEncrypted { - event[16] = 0x01 - } - // Last 15 bytes are reserved. - return event -} - -func TestParseGCENonHostInfo(t *testing.T) { - nonconfidentialEvent := getGceMemoryEncryptionNonhostEvent( /*memoryEncrypted=*/ false) - - // Empty events should return NONCONFIDENTIAL. - confTech, err := ParseGCENonHostInfo([]byte{}) - if err == nil { - t.Error("expected error on incorrect size!") - } - if confTech != pb.GCEConfidentialTechnology_NONE { - t.Errorf("expected ConfidentialTechnology %v, received %v", pb.GCEConfidentialTechnology_NONE, confTech) - } - - confTech, err = ParseGCENonHostInfo(nonconfidentialEvent) - if err != nil { - t.Errorf("failed to parse GCE confidential tech: %v", err) - } - if confTech != pb.GCEConfidentialTechnology_NONE { - t.Errorf("expected ConfidentialTechnology %v, received %v", pb.GCEConfidentialTechnology_NONE, confTech) - } - - sevEvent := getGceMemoryEncryptionNonhostEvent( /*memoryEncrypted=*/ true) - confTech, err = ParseGCENonHostInfo(sevEvent) - if err != nil { - t.Errorf("failed to parse GCE confidential tech: %v", err) - } - if confTech != pb.GCEConfidentialTechnology_AMD_SEV { - t.Errorf("expected ConfidentialTechnology %v, received %v", pb.GCEConfidentialTechnology_AMD_SEV, confTech) - } -} - -func TestParseGCENonHostInfoUnknownType(t *testing.T) { - nonconfidentialEvent := getGceMemoryEncryptionNonhostEvent( /*memoryEncrypted=*/ false) - nonconfidentialEvent[16] = 0x99 - if _, err := ParseGCENonHostInfo(nonconfidentialEvent); err == nil { - t.Errorf("expected error parsing GCE confidential nonhost event") - } -} diff --git a/vendor/github.com/google/go-tpm-tools/server/policy_test.go b/vendor/github.com/google/go-tpm-tools/server/policy_test.go deleted file mode 100644 index fbfd0d590..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/policy_test.go +++ /dev/null @@ -1,153 +0,0 @@ -package server - -import ( - "testing" - - pb "github.com/google/go-tpm-tools/proto/attest" -) - -var defaultGcePolicy = pb.Policy{ - Platform: &pb.PlatformPolicy{ - MinimumGceFirmwareVersion: 1, - MinimumTechnology: pb.GCEConfidentialTechnology_NONE, - }, -} - -func TestNilPolicyAlwaysPasses(t *testing.T) { - subtests := []struct { - name string - state *pb.MachineState - }{ - {"NilState", nil}, - {"PlatformState", &pb.MachineState{ - Platform: &pb.PlatformState{ - Firmware: &pb.PlatformState_GceVersion{GceVersion: 1}, - Technology: pb.GCEConfidentialTechnology_AMD_SEV, - }, - }}, - } - for _, subtest := range subtests { - t.Run(subtest.name, func(t *testing.T) { - if err := EvaluatePolicy(subtest.state, nil); err != nil { - t.Errorf("nil policy should always succeed: %v", err) - } - }) - } -} - -func TestGCEFirmwareVersionSimple(t *testing.T) { - zero := ConvertGCEFirmwareVersionToSCRTMVersion(0) - if len(zero) != 0 { - t.Errorf("expected empty SCRTM version, got %x", zero) - } - ver, err := ConvertSCRTMVersionToGCEFirmwareVersion( - ConvertGCEFirmwareVersionToSCRTMVersion(23), - ) - if ver != 23 { - t.Errorf("convert functions aren't inverses, got %d: %v", ver, err) - } -} - -func TestEvaluatePolicy(t *testing.T) { - tests := []struct { - name string - log eventLog - policy *pb.Policy - }{ - {"Debian10-SHA1", Debian10GCE, &defaultGcePolicy}, - {"RHEL8-CryptoAgile", Rhel8GCE, &defaultGcePolicy}, - {"Ubuntu1804AmdSev-CryptoAgile", UbuntuAmdSevGCE, &defaultGcePolicy}, - // TODO: add the tests below back once go-attestation has releases: - // https://github.com/google/go-attestation/pull/222/ - // {"Ubuntu2104NoDbx-CryptoAgile", Ubuntu2104NoDbxGCE, &defaultGcePolicy}, - // {"Ubuntu2104NoSecureBoot-CryptoAgile", Ubuntu2104NoSecureBootGCE, &defaultGcePolicy}, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - machineState, err := parsePCClientEventLog(test.log.RawLog, test.log.Banks[0], UnsupportedLoader) - if err != nil { - t.Fatalf("failed to get machine state: %v", err) - } - if err := EvaluatePolicy(machineState, test.policy); err != nil { - t.Errorf("failed to apply policy: %v", err) - } - }) - } -} - -func TestEvaluatePolicySCRTM(t *testing.T) { - archLinuxWorkstationSCRTMPolicy := pb.Policy{ - Platform: &pb.PlatformPolicy{ - AllowedScrtmVersionIds: [][]byte{{0x1e, 0xfb, 0x6b, 0x54, 0x0c, 0x1d, 0x55, 0x40, 0xa4, 0xad, - 0x4e, 0xf4, 0xbf, 0x17, 0xb8, 0x3a}}, - }, - } - machineState, err := parsePCClientEventLog(ArchLinuxWorkstation.RawLog, ArchLinuxWorkstation.Banks[0], UnsupportedLoader) - if err != nil { - gErr := err.(*GroupedError) - if !gErr.containsKnownSubstrings(archLinuxKnownParsingFailures) { - t.Fatalf("failed to get machine state: %v", err) - } - } - if err := EvaluatePolicy(machineState, &archLinuxWorkstationSCRTMPolicy); err != nil { - t.Errorf("failed to apply policy: %v", err) - } -} - -func TestEvaluatePolicyFailure(t *testing.T) { - badGcePolicyVersion := pb.Policy{ - Platform: &pb.PlatformPolicy{ - MinimumGceFirmwareVersion: 2, - MinimumTechnology: pb.GCEConfidentialTechnology_NONE, - }, - } - badGcePolicySEVES := pb.Policy{ - Platform: &pb.PlatformPolicy{ - MinimumGceFirmwareVersion: 0, - MinimumTechnology: pb.GCEConfidentialTechnology_AMD_SEV_ES, - }, - } - badGcePolicySEV := pb.Policy{ - Platform: &pb.PlatformPolicy{ - MinimumGceFirmwareVersion: 0, - MinimumTechnology: pb.GCEConfidentialTechnology_AMD_SEV_ES, - }, - } - badPhysicalPolicy := pb.Policy{ - Platform: &pb.PlatformPolicy{ - AllowedScrtmVersionIds: [][]byte{{0x00}}, - }, - } - tests := []struct { - name string - log eventLog - policy *pb.Policy - // This field handles known issues with event log parsing or bad event - // logs. - // Set to nil when the event log has no known issues. - errorSubstrs []string - }{ - {"Debian10-SHA1", Debian10GCE, &badGcePolicyVersion, nil}, - {"Debian10-SHA1", Debian10GCE, &badGcePolicySEV, nil}, - {"Ubuntu1804AmdSev-CryptoAgile", UbuntuAmdSevGCE, &badGcePolicySEVES, - nil}, - {"ArchLinuxWorkstation-CryptoAgile", ArchLinuxWorkstation, - &badPhysicalPolicy, archLinuxKnownParsingFailures}, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - machineState, err := parsePCClientEventLog(test.log.RawLog, test.log.Banks[0], UnsupportedLoader) - if err != nil { - gErr := err.(*GroupedError) - if len(test.errorSubstrs) == 0 || !gErr.containsKnownSubstrings(test.errorSubstrs) { - t.Fatalf("failed to get machine state: %v", err) - } - } - if err := EvaluatePolicy(machineState, test.policy); err == nil { - t.Errorf("expected policy failure; got success") - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/server/secure-boot/GcePk.crt b/vendor/github.com/google/go-tpm-tools/server/secure-boot/GcePk.crt deleted file mode 100644 index a46640a555f2de3b5db50d32dae97e3460eff614..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 762 zcmXqLV)|y##CUH3GZP~d6DPw}FOe7N&9Scxc-c6$+C196^D;7WvoaV681fnLurY_S zF!QkHrIr_D8_0?C8d?}w7#SKFni?9KMuEAOMg~wW79CBDO321CvNA9?G4eA2t>NBUV>dC*bNIBo+kpISc*~fl~O7EC*a86%A`$VU6nTq_AYj2g#-)|_c5ODB)gYxfv z)?tsiuDidQYq0)G>`Lb3&P9JLA5L4?e%O{-ZPVpNId4u(zkcqP#H&qHZ8o#8v!7$? zI)BS5P@uzJb%VFvnY%x4-447uQEZm%LiW8Kk3I@*`M8;3()P#c&(`*2-BGufy>rDc z=b+f$_xHlIZV5*wa8_PkSrgv-H*i9t`P};2C)@L;eh8ZFJnxQ&jqKSymh*)czi{Vu z+hKNR(&niv&Urm{Q;zUvVrFDuTpVl=Xdnv=X<0rNF&2>-0WHiz^x5^VeKoXXBT6g}m|4&gaHI@kBCscnipyjAds-l80_rEg})eqc6K zHv4hfpgG;jN?tojQ9MCs*H^ut8hNME3L-Sx()%-8av0PjRObYUu)ZwVk&qYC>b0ID zx8GHIS+vO?HD4K<#)rFA^eP_+Up%p<=4QQxyP$KUWVUfY_~YVv%j(ZSUCajjoU+}I~iMpQxhX2!;u$TyY{aQSKFX=_|@~@;Z-h7vFyCJyq=b5 zJ=?(lCinH5`kjxXl8tHv#r^pnb1%0Lo!ocq>w}h!vu5i&|GItRHO_~R4zR3PV<2R91&S9_(-|4 zw_y7cS>HG7p3eCtcIf)S(^p;`(SJJgok}H`B=nQM3VkEpIuxws!gliCC zV&ReFVhCm^Wk_OhW^gp%2I=Hy0U6U~zz^aGGcx{XVKra|QU>xM0c92m1F;4X*R&w# zhjkHx`>*-UQx4^@wo=MkVGsjSAkPwN5Nr^*z<+^nn|DS@Nr9EVesWQcUM?&x>m}#s z>K9~Zf<*NTitQ<3X)E3>+FDvQfnk;IlCr2*mD_ikX9ZRZqL6?=D`>xf9< zxfXsxa&bKCwcE!oWS;ZzHroC=_L9NZ17COSs$gHN{crYdldzUIO{dm5sus-2e)(?# z|Mh9|PoGbb-=xLU>-}FtQ=t0$^_ry@%XYG!sC>&mVbYvK|L*74oX7zgh@9nG?To0`c7HO3KZNRe1+$`~ySEjVd zjf}U~n9k=+;kkT1N2zk{#t(a#7r7;@Ji>lRvFYRAPcJHs687I%vs6jM`_#c3-mh!z z!%a6m^Do`9A%R&bc-_QG*=w^Md87gG}>Bg0aT9G~N^oLSyHOAfTxvz78VGlrx*5UXc@ zJE@j?Q}KQtu47)Vi3^U3=}x=+ReQm2U(eZ&4HIm3hWvfD=i=NWOC-AL9lK&8n=_1d z_qd;YSGY&fe^yt`e;51Sexprl9_vcCzB}n7=OtP9q-mCHMY%7}hP~hTFNkO^jv05GgVcV&l|i zV`O1$G8biJVFk+>C?mv}Sj1RFejLo+USA&U^;y+i)^DL&HNQeZgMlnCMr8Rw(!y)^ zJ9F-BDwxxA)!#7hs?v-u=_>}3a5F@hSa{^P7=jr}8Il;B85|9`K|1+aSb!Oz&43@o z5oTok&%$cJ45SR?K?2Gw5(Z)oBCcsc&JXJ%1ovO_o2MMgVQr<9wZb3jRSyFfRa;I52$! z6E`qT#{<)hfi4gknCbzQ8YHlB0KUE;q>3&%(?GnJZl9qB1|>ijLOt&-U~UZJ4t)3%5Ajph!hU}{4&C1 znHYD|s@Sznw;Gxq+4{H0eq!GFSt?fgW59%;n?qZiG-MR^Zdw;8a`eEO=~ESDCfw%# zQ$BBM@x+c(d-n$IWDVfGA3kqE;#=OQxvDoE_{AMgoLlU5$anoLAz6-){=LWd?9{gP z)Rs5;lckvHKl?QI|H^}7P`p3e|O3K zJ97OESKmr}(H9ZR*1wn5vqAak@s=BJUmY}VS{vpqq5CmoD*M^8kH{0YRa-%tSY$V?b_=s>rUTrh+NQeajH+!L?x*b*&bVWK9^-r zHq16L-S}%;@Cu#AH%nLxPt4u1>xHyS+7tH>zP_;f&GW@(Y-+oZVK+f}tA1R6Kx^-@ z-lllRgN1MfA-&c}SF>PgInqRZZ2P+zbh(mdgZ#grWnDhht= h@@Z?I^6kMoCf9eVhqf)Q%M>eRpEUdHvOST_5de>mHUaBvrw&v?L?HD6^ze z!N|bSz(7u%*U-?=z|hjr!o<+TC`z2y$PB_Y1#t};TWI1`Jp&zxQ&ka84bRL=$uBQf z2q?-=DNP3XNFl)45#&rmgC<5L{yk8AUeRmzWhZyaSqGceJiYuzeP_GO zznv$QIrCSzO+1)4&BpQa>BaW3Oj*8fGUZh@V$A;kbr$8C@<4LS`TK{29vzBSf2Uqy z&>gMCnXS|roFJxiAVW5I*Bj5za}#@7GdPP~Vrv(LXy2{;E_&WHHb+J~=G>k+%H8>S zTh(rw2_N>qroL{ck+tI_orlNImcLjP;`cpmjt1Nyo%}2yW7-V(K^$R5#{Vp=2FyUpKprHZ z%pzeR)*y2ATiEIT7mH$&GA`OqnGk*b+$@PB24Nrt@+|%az6Rb4JQujPxn`7<6jrfX!Z2UKJb#l`{j zA}cF9BO{BSfscU~jBmiyW(T#Ryu2Kn6~N4Z&+HQ9ga*v5%uT=m6!}wA7`U|ZP~N8Z zmUeq=g81{a?FEF3|EFLizEK78Zu;`nWUQnsi*c*pB~ z$qyde8m4Y&eEMn4S+OPaZC7lZeaPv;gqHXa+5erdcFDR=$lp-x=Q!VCe*DvgTAKtX z7I!IXd^mTn*fQR3bxgvW`^*9>E_1&8@@-n{w)()1Ge@>ec3(c~3GG&F?i{ z{8lQ-ntpk5c$}uR<%xH?56?bvEsnl$>0H%nG07&khzoIZ8#kw~&oTY9=c&EQBhy7( zrEK3M!e(Bn(7DJe{rW-&EB)G3mq&^vrrU323H zMVl`&2aoQYFqyBzb#mLwjS4gO%{YB@>XO)`YYUP&6!w-1l-JsRcHKFD`ux-34f)0^ NSsC%f_kI=F#?@mywa1mBFB~#gN;8lZ`o)g-w{r-N{hI zKnTR);NkWx&Pi3sPgC$s%rg`)-~)-W^RT<*m!{_=78{Bih=N48c=((X^YZgDlM{0k zd`eRE3{4D-KoZP6+NcshbBaq+ixiwwi%K%nfa*(96&y=TGV+TuODYZI#CZ*k3``7- z3=NGf4J@L>c}+lEAOLd>>WOhBPB%e4#m&PVoSIx(l&avApI>6AZJ-HpsS=t?krXKe zXQt<6=A|1nF)ASk9V06Pa}y&!15licsfm%1;bi>mq<-!VDNSqkoqUw^*!$9axvr~; zQrfW=U$&pyIctaW4(I9RtNrVF3f#E=)aM?{ebo@hcxii@T>CxV+zXD=S1eu6lkES! z=1|a?1%@kkcgD_?bIT7c-dUFU=K8@uir0>@Klk6ObnnTEXx-aWO(dsZ)9_aGIkj81 za+!F2)X(&1F%_=10=XN+Bh>_thCi@BdcO7WW5lt!wJ{tbfVKx|}Ef z@XOxC=k_goeAZ@bgwDJ}%rXf|=9d2*nGR|$Ne%pOY_iHp^yk!yKe}IUb+y(s&HZhz zlf87s{hCnj20fb%$q&z3cyzuHVdHMv^Y;pShBUw3P0_nk1f`jn85tNCH!d(}oNK@X z3|3iTM#ldvOa=@F@*tini-ds~8;3Rq&kwTYoY)J2c*DpJQV$!y7n%N-9^2NBWaRKbCoYcz*Wm-YJhcFU9JLNwbP_ zpLW?|m*}K)L@UPcsO;iL4}vzm{?e^|$HFr9cgMo8)Oc-wwf}4t0z$8QVvQajb6u}G zd%^#{_wJmFUv`^Mnv_{qXJS2xHQjH6>f1eW@%>w_opSj90a&Pu=70 zNAD3aethh!#I~E??{40*(C~6pOl+;)ey%4^UTlf1wcgURSbD3%;+=La`8|pZhb;kr CZGF-J diff --git a/vendor/github.com/google/go-tpm-tools/server/secure-boot/cisco-boothole.crt b/vendor/github.com/google/go-tpm-tools/server/secure-boot/cisco-boothole.crt deleted file mode 100644 index 8524be328412c2b211ec99bdb33af1697864b790..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1164 zcmXqLV(BnwVlG&~%*4pV#K|jT8MAy+Rlp$wUN%mxHjlRNyo`+8tPBQ@h5`nBY|No7 z+`{Z3`8k=niFt;620S1UE@4*Z%;MyHLs1T>U=KHv2WlkDQXY24ypqJC)M7(v z14*zYJVGdz1eYcOt!QFYLUuSKD+6;ABR>OBoQtW6k&$7CZ`%dMMcR_{CvYt*pJ5my z6@K8gaIf9u#80Vp7oT+~o#j~CE#W^`|A)6+#>DqNfrq}=r+<-jTi*HCiT~k}bKY5+ z=?*8--}JwHaPQBDM{8X_Tv`#nyPJD)S8?d$@XLP=9qE4+@TI@-s62XJG-xKAV9MFkoecL3|DaHXy~s$Y4;%#-Yu|$jZvj$jDM;P+;Hy z;~OxwnPild6jIpY z9*}FG12=)OO#x~GP-${mF_Ix5z4^(-1qSjUHz~777>G59Jdi%VYS-~wf*dco@&`y0!j`)2+xA_FiO=V@ zJ^k*ggy5UDuLak>a;s0__r6q`x$Csk`R$o(A=f1S^)#(nqx3HEUf;dx36g$~{GamA zKbtWB1n1#z@-Zr$C(hS1mTbHs5wH&ELqD6P?QAe*BPjN^8r>eUBET@a;-V_^YV% z!|}m&7xQyP@g^##%uev%{FeGTEc#UQsXvWh_}qW|>b#=;?Xq}JsNAK$#rjh^OV?Z% a{rYx-$R5$?TRkZ}YR9*I**bsLj_Uv$xu*93 diff --git a/vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate-2014-08-11.bin b/vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate-2014-08-11.bin deleted file mode 100644 index e79929f7ed1fb13d39a4f87eeceeb0f9376e22ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4011 zcmd6pc|4TcAIE2x8DlWEl1#QT8lG9~b)!K_B1^O}n2E8Corx@SMVnhB6^f7$vZPS5 zwh`e9ZC6Cr8WgUC-!t8NyIsF~fA^2y>%Lz1c|EUZ=6lZPe9w8#`JDH2o(sWIcyTGn zZx;>={)0`5UhKHOz1RKyw&QuU!#cZJR{@^L2N)De#sOHAFeBCs%7PTFJ{1DP#6qP1=C?>JRVh??H+6W(g{Y8;nyZm445H0ii`n- zQE)p13J#pYL9hakws#J2XZyGXa(u{QfT*BQ2rp#KVtR9YnB+CUYC#DaFJ-}Y z_2&d|4h9nF9DiSqzjGiPY(WIp3+mzcwSQVqFgGzL(2WQbfJ_F~$Y9A-GI&ua6e@+f z7Ywxk%GVHxPWnfNC<34bL&V_WMwWCk0BHO&;B~(b*q-gf`Y9z5zJX!f=Q^W zyR(lQOAr7&sN%Pi2`&em2gO0aax{zwg+iXpJ+&E0kv)BH)#O-R3B`TMoEbko+99l(5I>H_l)BR7{IA94>5Yn`dAYBOX+7!#Z(;ehQexTK=TG%T2o{=hw=}eVvMFrjw){n!B$YS5!Wd{ARJtI3y`4 z(=JrHnOh`&;mXAb%L}3LCfn?Cnx9>~qI|5)%A4sT%2`vv`Jc^nMgEO3YDa*t9y`iP|KC&!qlSaQC(aC1wlq7ge)K( zCF$~+-jeZMcC(vA$G&HF1!0eG9(Mw41Of%b4q!WAmSLJ<9J|FmFwj?DQ!^waM8o?x zuWPt+yfuA2*&N>hO;>*}P0%x-`$1FFjRcl<59~khzdk6$X1jEKdp-TuD0QuII;2sBU35D>i#ne+TPM}qGQY&3T z)4iHTCKHC%`?;PPJ)Ii=G&1VaiW$%je-U7T@4 zWh~J#sO2V$y{=o1iBeMqws^>OOTctCd07&+O7)Ry{bnJf%0pofA`DKwXF@wZYUK~` zBb?>idJ7ccCrw<$v;6C+GfDUe@zm7)A|-_CxiVkAfu7^@oJ-FqH|18=>?j+}Ukstj ze?UpprPmZX6)I%d^;RV7HvrLel6ziZ3B`3W9ZSn*IVM(D0>3=u_9 zOKZM1qwM5Js?YX23$ZKVJ(AI`l3zO&FHwFpK@H>9k*)-iaTp|H+b?89JEPl=egPtU z*<=CH3I7Of3;;cWTj6-h?|k_Nm;_sQwm*|#G8$j z7QSm@-F2>E3^y+Fjdkwu#V{fEDXHIRXbIBL91!~oK`AH#{8mH0A>p55Y30`jk}!nG z8Z^WP5(II9&>==3P{FN_LkQBu0=TanKmu?O2Y&#b$w6y+Uxb5rP1nv#N_Hy@^c6jF zf&GFO3J5#E2H2HhnPCxY{wt6`aQ!#%zR=FspTi7t{R$<}x}a}C(}G?VkPje%H=yzBOPvg3i6$Xcr6iSIA@#ahG)x^SPyTh-v2Uj8= za^K-jC#Kae_HrV;aABQwCa-9_lJ#(dj=Otgk;xy0a<-IZgeU+bDKUwETKP0Wb{o1-0BK~vA zraDG(AGJK|Xgg~qdeu-tcy=8xZl`XECib3W9A_b3FNWS(iL&{M&xG7>9)88a~I?g@cz!trgwVHrD_j8kE5v05EL#?D(kS8reuKWVy z!~WuX_B*vZC^0pc$UJBxxXo(8BQp?v{$D`HzdVV5dzSy^U=E%o5j-fwp}wy!BIfCi ztt!Fs1A!>jfuyI6{xZpz^L2s!?$9uG@fwfj_{Y^hUk=qM?c@ix9_Q1_pPG8k89Ivk z?V8n$qf13j3?(r($ayu_9ZPsHB^p00t5Nd#s-)66+UvDwfR(!e)0>c2Z*z&PZKegW%^e*d&qdtxd#&&x4#xcx}fs^~?lHS{yFPp*im9^vOYU6OnOX&Z zCfD`T!eqc>(**VOF3tW@Pl$|%cF)WEmq%IW5VxNpMYHy-MA#~ZjdiOgYU&p6glnAL zVmZep+9nFyHlbs$=?3pg+1vktsh;zb!IsP)m1aEbJ+r1c+dmVZ6b4^Zm2RxtVU=iD zkY_ZfeTKgNB<#y48v=ko)hVAs_P{9?)r|EYhfal>N8NbFCf8tL3kf-ER<>KpXIsDZ zE;T%v%djv~NMxm>m+PlBzt8%VHs6(q^Ixz0VgPPJ>)3ZhNZHfi?BN0*xzk6$wJ#UBBpLYhW$brR&FyW*5>t)%L2RQOosjo7_i? zOkGkYHnZ!0_VMJq%mHQLoI4LgZ^h4@gwqC>>l^Y?OtIO_4EqKL@9$fuKNhXHC8o!H zcZ?E9ns{d;a&WocVLoXU|7_+SdfB{_idaVP=7Aj!j~vkzh&Z(%_iN|;mg{X28Zzg_ z*TQo0*Su6I3h7Hfz!7c{eqU;JL9wP~PvYoueV3|KguI8}i8|$L@tNVbSwb5!^us(= z4p%o{^=kLWtZ!`8 zzkFgt&pV%7MmT@tr@pF1aaPd&skf3b+l`m&PtOmDvb(5;@!!daxKmz~b_l;-r?Rg1 O=B8~OXZ>?N?)VSM+ZQ_k diff --git a/vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate_x64-2020-10-12.bin b/vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate_x64-2020-10-12.bin deleted file mode 100644 index aa7b71627b0132d1fde03861cd54e87b9872d111..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15281 zcmd6t1yodR*Y_E^yOc(eh8aQ{N$KteVQ3h-M7l#d1nCf@l?LgQQb0nH20=QP?~#Bm^cgq=cLNy&f)If5(6P)Ta1|cJp@WRc}-y{p+D(Q>P_;nNdYYTr}0>Xh?2o8eafU(d~bWqVrkae^m zBw(WJ1ttl$o`t)uowJPx%o#!m#=ky@L4u(PwQ_}EZt!4Fl!Hb zX_%V}%+12X4t@n2nC1FB3JJr1d7fTLR*7C(lAZ?)fq-c#@OZ#rUN9d-kPpl!Xb4|I z;7i`Wmf+xs{}mU(V6NXTGXLYEo}IH5%-fw_NA|t~y%N-yUe?Fb*238adc6RLfEfRL zeef>;B?Lr(1V4_A90CF%Euu_`GU-h)+`QlT4?tex4Jky&O8X zthcd1E8wzH!@ubS-oMv8xbyOY-RAZo*9X5_w==sPK7xj4-0aKC-K$kc3@(HZ-%Z^VD;zcSX=e$8kpH?NDjEqM508-0T?jiLzaX!G5SZ@T;w@B4FnJK^gA3`g zeDUHD8{$c$d7a9Kqm40UV6AI_4pkYf2$s*kpDz<3W$WSLBFxS0?d{Fw^mlY~S;CyS zT^#ISF7DixZjRh=f8g;B4`XS`>mW9}{)ZEMmy?H&3w|1Gj*ba`W;8Sm5C~NptOC%-((zIds$qsY^U>Bcw1 zF;B!8Lg3?V;n%^vM=2%IPQfYsIUDjFlg)!TPVkZLJ@k_kr?#s3Fq_$EYHcsKb*V;^ zNKFe_UF|DjHj%d<-ze5ieZ=3Y4;U#nqvdIONtH3SME`PhUzM=%%so?tu=>j8IP0x` zjd49D{-M8C;*2TU6AzA#;l=q@%p3+|=R3_QlY5-CscfI5;aa!_*TOfywGi6^`)$-O z2}A+BEO2nr|BAkdfQ7DO7lnl9pV<9FBI&hl?cA*B)h*mSeCbsz+#H}DE{+zKPmOTDM6l(ZuIL`#hQXUVSEQi%)WpjKwX-b;GT3PKvEvp1m zFUcRFt7lm~(+C_2S4*Ie82`z=l6Mu-wYNPseynBxKp025WtHjjC))SvKGF)J)mzc= zE=|QWD!bJiPk)g2%yy4VZ}o9+JlVe;i?SPk82haPpR=6{ILpO@d z&}Kdiys;aXSK?{fF_{FPbe%M}`d}2X|IGftryI5#^151*$>piT_RmCu*>t*%PpNb- z*l^>Ou2@(JAD+$nm%R0AK^yYjBS=hs+VgV>7T`$maJpOeBcDdP5W$A2?i?jr`Y}eS z)XRMDOUxUGuDYXn5x0sXM@ldC1E%e4$dUqr4+BXy@M2>`Bg1yq#$QQqRB?u-Jho>y z^q2Xe`8;@tle%qLa|wy)Tb5Y2dF={sLs8UQ=nd?fpDO)}yF(&X1?#x+`bi^Um+@Tf zLXDp`dzaV8n8OZIr4CqQ6Yook1XJ0}eU~#YGsqK;skl=Uj*Pxlbzj<1 z3h$ej_hIxfgnYd`-16ly@0_bFVI)<0-94wY^XQ%)|BFpE&-z+(6h^J;Bww1DY)Lw@ z2yK@ai+KD5{A;sy)$qjp$hfv&PxbC3PgrLzBm~q4-)3F#A{iW<`Tv1B{O*e>LIg9jS80YQ`NID<)a4f(mvo{s!wP z4i9;X?PYAEI*{vU*G}$A#c_mnkx|&q{9dDjq2^A)`yIJ^iL=P`Y}U=WmnANy9P{_* zQsPD?6Qj5%VtKwJtHiY46I_}X{Rxf5*!jRn0m>C93aG`8Xv_9OC2symBjKrq!eY`W zRPeU1=@#k!CG7D*r?HP8xGk<9>N>1Qb(kkI{o^cGBA@p(?(0h!9X?srVgSchu-Z@3 zl>jZ8PVTA&e)mVXbWGgIa@BUW!bJ^f3pWk7IW_y=yqdB`$w?KaUcI#0UR;mG#5h0EI{8l{w4trvx7* za0n_rJilZ9&hPLq{*TxBtFsCFBdyCxK}f;G*ZCL|7e~R}5lRoUhG*S>S{qyp8JMSy zqlG(!0!((zVdLUUTR6j6JaKxFCFBp6e4Rxa|La0&d6M1L{UE4c9L_YdG%# zrI+;du!XtVdHDXyzV2>*<#fnjOK{--jhFwePk%iW4la%s)Y8)pN-qVk z9w6*s*595o0zCZ#qSvysafbJI@NM%ycQwOi*$)zMYOO*lJBC*utSL?A(Z;;9xXErJ zc-%DJlGQBTES=$9p%#eiav$d+&}qQwbC4-$vdNk@auLtzjbuhyNe!;0+L?ck=4d{o zye-<~3GIEDj(dxj-R^An1;fk$#wWE`jEn1KMw}ng_-?12i=u}H#aEGX0Z!J(Yr1g|Tbx1(vDx54#Zh23{Kd`-K8-(@@7uLHSUo_rPx;7@- zpwE%pgFe<$Eqg_C3w#g7f5kOt^nY&ba`GLrK|^zYb0imuRi! z%9x;h^cE>PPDuOZG=?n|f%rVx$5bM!-+4SZ9~_(mD7t^O7EITz#oyIE3JN;*U%d`C z3ObnMceft#O$vmEN=HruZ(W?Vw3O-Ppw8Dl4Akn+nE9h1u#jgf48_BKQDyiQ$4&ix zBJaoXFaMU;tCF7J^sv>PP@u-$YJ?izdCX^M35fq+JwQTC0XiLP6Sm^J{>$JBrq5lE zRxj++^LPCA8Gp4(0C;NmOGS&tYwkWVMf7bxM*PZfvR!C zca%_x;DyMiqW7rrH1blR*kSTE>xJJ+6~BBM8+(f?&28t98!#KT~53`o5~Ks{;xOHZEu*Lo5K*AtiDdV+;V zEoA&G*-yO(@Ls`^e~&|ONHDZvj&@FP6~X@%8SrrknzWreycwkdQ~lb2B&51_ZXTX+ z1^G2mxGwGCV-GMryt)?z^T9_P0(=6ze1?<+JYXTAUkC0&gm}S*;CufviTjtyzh*Ev zxEPYo9u{s;cL){u#_wHD{BJkW@_Ycl#edq>%_QmW-}e^a8hO*&B4=s63tIlgiKS@fk8!AkMCl0B=9#E{Ky!uImw z#h2A8*)Nl2dTp^dMKSI=YkE@`J$(tE)qjL2$XnO>uoued$ctK8))T&VC>0^`WYI=xu*8$)Sr zW+M1J7dIv~MTzh|1`OFXXH7WeqV1)4M%3HyT2ZN zcQ$2wC;CD0k=)LSbOrU(TqGBX0{*XKKA-#R{;tl0;cx2EukjWQ!F4lzT~wq0$`rqw zYfLaY{P1C5&-)neF&-X`5Z+RU7zs3db*OCm+0oQYbzp7g=PpGw> zo23O8yx4`y!{0*zPz3#77T~C*mpj)#My{`gS-QLY+x}ms8hqY5_?`%J8yiOUUX#`m zdruy$36BOEdQ>Gae0uVi3}KOh*pa|OV1d8ygbX5Q|IfahVs7sgW1_hRRuh{q;+?ERwn( zn}|eup+-?gEm+Tm?O(C}0(Y5d+S52*2V#fRG7~4_$JFg(}ca+vq zN?>*9jz&;ixxpTGtMIVlj@5iC{8nr8O9qZ_lFPF)0^@FGe79fU9U_=Ng&ye|y$*eS z5qyj<_w7gYH2dikMVt=p5JO#k=57KMaN2KvCx!kPZhQUIwsSTZ;ZGm& z9$HjNykjIXK6HMsz)dN4NxdJ1w-}e*Y(^3luW=$xelO-l)yxJ+K-GNgg`yzpOPQe5 znmlLi4`pp6DCbwyL-^jap9=fLm0cWaieg_psMU~#d z^v7$`7A8;IGxar1RQ);jd@bcR>~_zEL?+RxS7%%s^tbB3_al7D{%eqbT^fL{MF*AeSJ??4 zm|o|Se~JjuAKgAi5a4_LwO910ip`Z-w+|mV7^i#~bXg-cNMrIhheK-PnD1O9f_1d<-_{jL-KJsi0cK;q(I{|z7 zhxpDwSXE(Dzlx&V%WmDoMv6P+ecj6H$r6?2lHc#9NV7OH{@yEK_y=&W1l7;mK|1k} zFOy1XZ@g8bDc0O{dLa>4X09ShmkiCr2J$D|p+!HQp3fu`xUt;+u#O_jH)#}(aoa&8 z?NOyO)wmy!@1LJ5h*%xs#HxAD1`FhJkHizVI^$5qJh1V#4|q;hBYfWLQ9D0 z%R5|y(>1{icn@Z#MCG46bzn7Q$3_S8z2#Z=@rteT^?LQ4LdQ>zt1+7hg?#s-c|173 z>}laz19|=P)SCxsg$B|u&&`+!^Ox?eE9(!NVmG5kvU=K9WVix(t)$+Q5Lu#|)A`1NoUdWC1kxuCd*>E8+|N+n^X6`N9t!m>#_vd1ZcT zdh`~^zp>n9ISpvl`fA15`RIywpor~bM4maxPjW5}p06VtPC%Y@U`MlFRJb6PV{Xs6 z%-sJ#^v6o;Pa>$N@!=+En4%1jPdxvGZ#Tm$5id@GYs>TD#U$1;GZXVtqnN^Enp^3y zGLR>PReqk>y;KE@cpL}i2W76l31UxyJs$KJXE-8{uzd>TDO81VjHCxjG1{gi)X?~7 z#U_Lv*o>!sYryBaRsKF17s#_enYbgxmHhLrS*KDj9y6w6?uwEh>`LaG+aVET_e2QD zbGanhM3kPnYtTKTq^lsHacR&S;NdF2^`dO5gwE z7bg#4cVAbX$1WuHUTzfAf_W7^D`HvL;ecbB@LRv3lf#F*47R;g9BXWbOF-WB zFcCJ%s1TrCbpJuc?Tm{dLV9n46B66)wfWAGOG{56AM!zDy#5qZdORni_if}@wt?iB z*cKtaK8*dnu7IAI4UmtSkvI67)^HME^E?&D-omDG#xKe_;eLu0g&RY^fouzqkAGYk zJ@E;f8l%D;I>NHAu{R}psP42CbzU`t-x(xN4dknLsv#Q8#O`}(&$(=fg!Uli;Wl7l zUdGIC0$Anm3=4pKAJ(f%InS!O56RCN8=5H3<5COmbI@%Uled_}@J97q0Qmum?y|al zwqRFr&B_9K*}gMu*B3cb2WHX!ha8eXMmJp95zVAit7R9ooeOV z-g!&oeXIWDGd{mB#yc6Y-Tv>Qv^hXt=tB?7<6|YWG+vG-?=>QnEr}1ML6(YT=qJN< zNa&QvK%VC$6}K>Fj<~Q}cJm_I%9`bB)Zb6)^#(ETqj=Un90a{3oHiRNO0Pa56W==B zt=6yElCx*QroVIHddl!u|uP&Se`QcrDRP;kR6ui}) zMQwgGW&ZL^bEAX_)C|se9U%X51D%hc(?KsHgEs{u?{=d@F%)CXG>NA6E*sm}wu=Ig z&!e>5)1&B3t>^lRZH-YUQ)*N|*Ql5CUFq?QFMVU?-9Y}ML5(h^4EkD}<@s_r0XTn* z*!w;kL$U!utx=D`CNYAZe5lDqa}qNWYz)@|E4D|41hgZ4!)+N{$rx+bXB>k#0_{VO zy7H;Qkf$EBxN&8knVLSKb)OpgtQCfjcz|q5_1g~6Dz6y7@wuo@0a9y zM^BLA+-!t1qVVewLVVuwg%Yeu9!}7fh2F>E*L_~&{S40`zAtPTOhe`2c-8>4-$wJ+ zNecfYT1uyHiM5knu4x-E_n=3_!VBL{KXr1dJfQ)bMFV-{O$Phd z2UZ{nx)Pn;j(Lf?l0)6Bz2r0tfogquuCGl%-udTG93zli?88)L!l|;#!qH;-sHj!6 zycqNm{oAvxwLm@xsakp3PjWDHLHy9Iq3NPMe_Z7&^9v9+^rA>`{&{ounAJx&*c zh9OIJN*$KuZP^DfBD3Mw7?o$Qw)7DEX zH~@Lu{rfzF9n{uC;?W;dKJOE!l4W(u*7po@J{nZWD$JJ#@~cV^LmhHgd9m0;_m`Y2 zR4OYwTonvAFFBt=@=i=K-vIefJvhSk!MjoLX6%^3Xw-StI@>ZGUyb5-Lba}779DnnI3WMYmW~X<@R`=;OsTzgtbYU9 zg@Y=t->lKZh4Z{zzTp_iFN}(=bm6bp)}cmDx#j7P@j#JTd>ZRUD{4I)>sOmLQH_XaMG9W8!Ul^Pm~{};BeeDT~Xdz z83HS=r&aaG^~s7N#G8T^k}tkv_Mrw|MM=)fcL6!<;j^<=sC>JgtwrI~9veXW!DTOo zJ#X&NRXqE!Xu54j)Af0u4bmG+np8$=qg&eK0^}cS9W0Q2(;VL@-DZWfOKp;iP7$0c zj6U0P)9fuaNXG&4dByLL?@f!pzLG*}4TzW4V#;9;Fm-Fda=r>;o^c{Xh=(b+t~bY* z!zWz1bhj>a_uV8FDUQ_NjFlnZ8|$Opun*rBh?aGsnEt+F%hKX6Ig(vE zwLmvYWTxqdkRO9o`IRkg+nCDq6(YH5D-Zzfqns+Trp82d zTzx<>#ldn!e z_>zrP2>kb$a)R(1ad__EvY!P+?!pWl6-d<26JlF~O1ayTlz=?8=Vu%mm(RshM;^DG z8q@~s#RCoO`FXKgdL7i}J>5)!Jg&xUBCIckNWsgbEFwh8f#YYceet22*5`U8B2u2U zXF#5ys4(k|26*5(`6wl!T?!kQf<_jQC-nx`a})hkxVMem$V8hl z#t!3~vOh@yf2Bb#=1#@KK;RQr5?l@QCRU1N#tE(h!y|I*8F}%#lpx9ktR_y+a)CTm zViH-|wEG4LOPSBDR}ZK+b(X5Nf3W{>yX<0(Aew0g@-(sf-IvYpV|hpSY0WZ(&-mu? zk0{penbhftvgb#YA?#l|ilm5xCDX%2P>5_ReswTkL)(uzl)lMdp5E>1rt9d-%mCWwoOm1` z>~ibv){5*+G25A4@O;O-a(i>&jgQ@$7 zG7*WTPHMCloNu;(`nkHv-D~*~^hadt(+*!ee|K`ijX}FGo2Vz`l5bBZur!nlknK{` z+zo*Khzs5M(p+Hpu0YbJ&B`xKR7{#-&7@ssVQWZ0GLVx6q5hP>9&j>fs!c6l!vU4P z0tsKyfb|GMKN)aK(R7#{wR z4dq`vW0l0hY?S1ViQGoW*Y|BYnQ&*j^BuxG21v&0maJj|_1$5edT&f%o+cGG2=#;9 z6_sV3MB@eOo-YXrWK-k45f?WFfl2i-nOM(xKTjRdAHB^a;UA-#jIX@LY9QbCqN25} zn6x|&u>3-1PqL=c(t*5w;txhwhC!#qyHs8bCRP~2>rFicwdosrvY-;&+0W7zRrwy?at_A ztHRVvt($8n=b{MprzIVxUOlDkU5>ogxxdC6=9$c+c;XS<4+BTO_y|GJH|ysl`FlM#1XZ3&nFuj&?kSqwkm&z3 zrcxPo;tfJM{0g*h>ppo(&H74nTYLY?!25Zqjr5a@;F}Mw7&uacc?aSV^v$X5GyE5> zBXGaf2YQ@el+dfJt;R-?khIazjxNZ_rKke!JAHo3qqo#MI#B%5g}gP%(`3F+8XVgIa~?`Gmr-NxP(>d}t^@l8i_YE%Guw;ouC|4wpd zMrJzIK($9aDJ|O6&P1b0qT~zfVfu~`An!wAMaU3UR$u2nU3RjYI>%z=s*4r)gx^n} z_JNXsC&IkKCp5Hpkhd*zvQxuGY*0LTiLBz0#)7LZbG5gvQ~WK2{>Z0(?{&q{JeD~9 zDn$@Sb^VvzTSY?3ilfevTSr=H5QO?FP+{~X7LN$EUmbPIuuk)!%$LF@V+fssDP^L$ zi#ifB(EpIiR{3|g94F48Sr?=RD*K7-Gniaoi?DIB)gxFY_z?D2w2F_=-2|S@(Imqy z53VEdY@zj&V*|OkLk@O_7vUg;d3YR(!YroV&5h>_-6WRsw|FpkGUjX#6ZMmztOxz{ z2MG0We98>2-3Wp5=kbHa;Zle*%9gF8& z3xUs|Ce7%4Y%~xiRM{7Axzqfk;?hfHWQ$v*-23&=gguZ?b@BP`Z;_rJC%pYM%S7Kg zAR>z6bZGcpv`uk(o8Pf0kWXJ%PgS1^df)rt>M^TMG;s_a^@e`7hOU1T2d+LG@s%IoufpV15EtL_G1JR1juLCsCmsg zoXnJEbiOi^$}UhrU5=IS-H-Q5!465d5=58}JY~uo0n?Zb3I)9Ld}6tL;Ba@HUhmQ! z)!E@qENPx6HPC*}_r@rRBG$UeCOjY7)v$&ri#TQJ&USlr+27zB|g_XK=5Nbp+b464{9El2grC zG2oulaan_xx6%hK7cF*sGS3Cs94Nr2d+on;}6gLElxt9+3$*HyE z*Q{3&<}I(@5Z&3H(<7Yv=~+YF?ZU?TCAj|d^0e>;i7|3U`FKCj{|;%BvoV(EZ2s}} z7s2jwM&270N6BXn{$4-s*~K;8MDVBM%vxmQvr6Zjt@CXcS`?Tv%6Z_JO=-XNUg|hj zpA3S&_1w=e=uQnFJ#I8}D?fQz6AN>8duZE+mn3N1DMeu)1N5g?-RNkSu!N>^onp`- z_AQoBKJ@L8s%LW%y6GDAKsG{s(#J_Oh&y2#cXXa~c}No_!B7?ISQ@j$(dL`hjdKz; z4YWUyV^z{Dv`$rEBc&NYfo4xRF3Jp>bmmLENj3OpjS*qKI>LuURI`KU(N_}n(z&%* zGMyZAYw}0XLRq(<+mO01!u)FV@vd_V14n1HpW%2wOvmmDM&3=Q18kqPq!BW?uV2D| z{!EY*N_UTOiN@^&xDcX5j*py&qA|67f768PTXnQ0$pYl(vWVU~%EwQiw`I7*2 zJ-_)SE>DAU==9-LL?X&0W{O?q;ZQo}x0+|t4nOWA%tMxtpVx;*maj|?XtH2FZLC;H zA3A=SKDgf2o3=<|=Y0yazm!xNUamHVdmgOw%D>}BC24d2zI(<`jv<3E*<7vyg!*S$ zqbX{)b*}_`e-PjP6fGf*kptC2ueq|Xw}y3-8s&{#vSYNqDa$?{?Cb>E-wcP5 z1o}SV99Anl=E>OQnVf$Hd$?&qI#3{fAu@I{1mr(o#fA4^wyGF81l>QG!K9Fz^=*Cc zZM&)PM(!$`&KjYA-w!RZRrsa3Ej<)lXu$RE*7Tl8vPh>P#9N|Id##?Yug$+f5L$F>BuqS#*uPP zxjy8&x@87u|z60xyjCl$5Qnl}~rnUEo#6~q>Giwx*04u^8%qzqauKwcXY^pVe`yI1@e b^3v$IYcqE0MuT@t#Y*|a*OA^l?S%gW_`RYA diff --git a/vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate_x64-2021-04-29.bin b/vendor/github.com/google/go-tpm-tools/server/secure-boot/dbxupdate_x64-2021-04-29.bin deleted file mode 100644 index 7c282d1c1ddb1b0010c2a2a453d196baf2e9fd0b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13501 zcmd6sbyOVBm-ZRlT@qY_!=MQoG`K^6;O-3W?h**@1h?P>cZc8>APEWX7BmE1^3(73 z?7sWQd-j~=a2Trl(@)>7zV+0tny*N3hzF#r4kVLbi^dxDugQ!Tq}c_b56#_jw3 zwOI)`2z?V41meH~V<4g!hDn3W;NW3F2rytYL=>hl>9AiIAS6(35b6~;2mu)!1otx+ z4i*Fpi^ugSM-yG?|8%ddh3IcLq4}fmk4r#kj|zbS9B5z^L^ut2L_AmxH4Z#5&YuP{ z9;&91v!#{2g$u-<0~?I_=O7XulB$`h9mL+0gB(oy=Ljkufr6EZ6T}%}?m{UJadLn- z8M#mkON#0!Tp(f%#B$NkEM&&1F*FtoO{6LK^c==CYT`5W&l z_DVd1mPks26v`SUS8W~hhYiP&DvMHKb7X-nhNh7ucW3{f%V#K~H)jhuH6cy!7==nq z9R|!pve-?=1ng96>Z7AVq#}ej@52;}y=J1&khd#|8eeKlHjFA6mn*m5jl(l-8_eDl zVH_O^UJrKAzVy$IOjkvJ5%!Vd`(x|0awwW%Sa^lVp zOx^V5EuSo6+vHJNTkNrt{z0apVC6rjao}aZQiYOWaSlc>{hxP)hDZ7DcckQC_V*-n zrc`z{b8>-Ds#=*qI0*lCLwE!{3{FlyK3)!HZeA`hm* za}4jS^pU4#qmf8bQFE{k(ouTtice0bB;Qg*PLrR^q;27H+kNXCkwM?LZJ4E4XgYrA zFMGQ;Uu8ye|Em|T$w))s1KFJ z-VdI4$r$PXSjx2T95YUpx@Z(0W_iO?LH>*K#g*sxc57eKb2{y=cM>Qj*$m#|rwg#! zyjgo#>T4{dZlMhcu``$r%pk(EbmWQf%wyOx^euKVGv`My+~aR*2u(+QWXMm z`QwR?&dAHj%?ak_;N<(`iM)Sr^89K3U$E`}$qoB=8lt)?HJ{Zy>)YGD(e#pl)kDJg zD!b{zv{i$3V7GtZ-?IM3gwqFyNC|Ttt>gtkV(j3>N=R)+Cd>9kQ~W&2>RLB^X$6>c zS^5l7Im5I>#eXgR0G}Yr@`zp3%9Te)i4uBid-VgP7Cky*}9+aU5JUzXquU+odh|$o&g0_K7*`l$7;zZUM?-xa`dILPWWvB$|MCF@Fx;aZ{3pYcG*=a0_0z)X znpb>Jqk$~IPiKWr{wpIsCN1 z0Ac>y;FQ&bv>a#CzTOP@qWhw`)dQ)3`9AX-_v?^@pphz3I)^Nq-TOGKg%pa-?Iemi zCiED&2L?uL?_Uc(MbmCA2*aL-SaAtiz4yxyKU*yCxgN>y+$t%2SeyE<7oQ-coFf&B zeav;gLwMl+6+VSMLE(xoYS}Rc@WUZ@F>LL8 zjoVv&D;wkVA;(E#$BfZ&uS5j`Nh}tBi))*WVzl4EBq*J`3Y3)5-YScVc&@N2p<2_s z*{dF=Sb0}t{R&5zlI*Qi!w;mm0mFZI&TI5l){2CC(eiK}cG5NpeRk58+Ox9uXFFW} zE5ovWq+Y6^le^O$Pfo+G#flJ#6a-=F z4s|~;c(8nGxSd*44F!IB?&sH$>g5wQhY#$MTsEZAL0;sn$6rTzruA82HWiRkBBWl8 z;8(#c^q+O(W4qdL=aMv}8=mRb3}`Cy&Txiwz2^u5^*;`??#Ch-9GLchz#aeF+WW87 z`(H}&$669T2n6FxG?EBMf`cpi@>+aI=u#E*wTSedHo z`%`cBx$`^JXN3Jd^2!M!6=kBoc@xDMD(L?I36*>$V&bQxr$OY7Y zvEt~$fW3<^CVx7uL{_M}WmhNiw$xBTlp?__2NlR)um=}hXWh&vU^y|+e%pYPiEV-&dCL3Zu|8SF=ycE_mYNyb8Gqo6qww zlGBCt=b;+9Igr=7Ng_T@&es6F2>i&b9iw|_%VY9=+RTtxa{0Y&=zKdy zI}9)N&!&O=l*s|ZrC+Psi79KB?*rFh0n_)e97DW&LN*r8lhI8(AkR3suUaq2pBK%t zcxYd0=yNQ1z1n(@W9F)Rx`iJiD*@!=ZniP4=D9>-go)5CIltA-psdi-(Jwa&$;>1> z6`#ukd2C3<-sHiZB3QuXJRmn9ZEY%mIS~>&}ho`O$R52aA!~W<`_` zxXFbk`HU?llCBys*=WkXCZGd(=Jd&DVr&WbyaruzeHiq}w(nQvydVz}H|#cXAggpf zAkXFyZxL4f%UOk@j`0JATKqBY(&3?m=U(ZZ*$BthkZ5h#?Iy&FO_8<3ClXun`I#H zcp3+pp_cJeFL-5KPMdl=j7{l|b%AHOyZ)tX^v=W;$OnBBn5e%*7N5vY?VAoC&(szj z7uvzb)PgX7ef?b1zyioe%}Z;aBsW~dRDVc9vo^A*nD>gXfA=cUl*ox{KwGi}$j8Ly zM^0{|k|LEmn~gFYsT|GdR*tje zelF^?tLG?XpWoyG`F@m+3Mtph#cv58s2iG|+`LW7d&NSrTS(ZV7sVCPdkf?TiF!(F zkC*~U85&ASae#?zDdNSa zS{TG9ut1*kA_+Y|dl5IkM{?^n($t*cVa&%%Y-AIc%QuFx9}UWHvF8j%3sS1i2!wYo z5301PcciQtP${3?I$l!wPRg{h1NG&?EQ{vM+P^=RgE6-cV(?0%Q&kh3w+=X^!tsVX zIVeCr@@)EYBeaiu93dMed42q@8^N(QBuzcUOJYewdTr?j$bUNEfk!;G*T{INhr?Lg z|Dn!ax)cOXW&L%AswvDKtY`*N-Qw;bmeP-*u1y z@;OgT4mFATlIqz`P|cBQC5mk}hf6K+z{p=q%>;dxMwX0tvOCYYlHMv;{#RBJ! z~b}zxOiRlmd1STVKvHjHm)Ndo3 zwo`*aHi6L4z?GCjgdS3ILLvydHRW)77sBs9y#(^;D^xI-K7LmQiif=KV7nX=UZ4un zjKtshKNZJFszHAW$;(r04bZoNGaZoKoEW##F>5rKxvP^j^^IJfova)Z^S zxQKVp_zst7gAom1_q{G}asi3hal=I+Q2*4uS}AiWK58eYK)2_kB6pfRd{wF$CyQW> zjHUvwGSqyE(JSw|Pkj8k<%GZGhvC{mUcU+q_gY-rN83wO^-LP5`8rrD@U%#i)j_*q z*hKk>21CNGq%j1?;L`|F#jlPXO{jQUmoGMc-k0Dwke1$1Z}h*QS|_JMzhEU(a`~=& zGR4;pjK5#CJjBp>`OO5~Sh0eQ7s?kza1^oGzN*N2|NcnX7}WfJ5+*#{bpA4_68{D* zTGmR&>#f;AJCnvrn;51$^V_9(puYE~QFW6EED%KlvVL=``*g)jaQ{nLO+&#Ryi=C_ z0Z$;m1H-4+i3zV6xC5i&QQvxzulduSAfBq&N87-9jSle+$dlGDjhqhSPL|Xs#^O2N zGpEF3Z6HxWzNj-;u-f`L69ReR3Hs5G2NEyFHfdVu`+piN>1y*oH~*FdzB)d*{C{fAJl)KdjaH^ z#spWpF*j;z;lpR0a<8Q>dLfzx+MV9?0p$3K6|Mb19#-?g5sQg%Bl4q5Vz(Q7$#|I& z<6`NZ2_HO%9+2mc|M`29!9PD;-Zv4Ag;;-8erI(UEW43hIqNzXRWQnnvOj+I%VrK;STKd>K5%U<2qksd1nLKt)_rm%-lr%p`SwG9*NUur?}&+` zFB(6-6yM@?agzg(k5xNfBDhkW*eu><O_sE7VRw1M=ytJQ*cL zzanQWTjX(Cq~F+(ZiyS$9M(&ajy>_=GxY}YIfb8LU(N}SJcz-x`o)N=(PcCH={q%` z*gpi&&)Z=`z28}I+|HLyF@XDW1#8!|z5R%c*r~FzD^;2O zE~L@=aqRPClcn3B&40+kZ7Z83jR_y9kK9Hbxw}iEK>6^Jz*xn)#xFIK#rAlu++lFJ z=V?w%5s*h=_$dtrLe3LV|S|~Ar_23^G_P(B)3!__(LmrD!&#vS>kSB?YCn%kB-o#@l^`Pl6Cf(9l zu2R2dzIM9nW(>obZwB&Y(ONxs&0nLr#*WAhQu%*zf5AK>T7Rimt0~Bw8&L{1ekq9J z!;Y8rPk(@dBwI170=dJ&K&==&4?<~XJ!(FOi9mgN^pLvjuoDy98tV@m`_0Q&KYWof zf^;JI9*E586(6L4JmXlQx?%x%o*;fG#7Y-G%LX2Xy24v0a&&6 zligpa5w*+aU9)kednR`!eRs**-9ypYpOy;LXPu0V33Q;D-dU9-7P6c_0DtNHBH!NZ z|MYv$7>KZf7|3%FGY#k{cV~h>jwQAvym${%iw0%k2P(pcu#B-LQ_vgP>}(iwWpm9+vH zt=d7l_o2Xec-dyjC~H^X5*Tnf${?tylRsdMBGtB%KOM8xwD!3wL-Af5o52wrl`KfF zq#~?smrsedYFp#c9zvJA!mBd%(}4VQvjwYeo!`-7-aI&Q0#wg;3Ns<0*{CPlht^>p z*2UaF{)L^D?lP;S+X~6Z*u}On zuHs1{1pkjiYj``UoyTGt*GEwG75}!aqun zl>Z3qZ0~c&@bo0SdpcwlViA!}C^~&PiJ~H(2Wyq60pYud5+DyGd z1ck(@*7e#YmUf1pi~6%NK-GsLsDpOeO*Khn>u8|j4iNtX8CVl5cw3uYjI7h(y!9PW zUoI}-$>V$Fp8oeH;S@Hh3`Vm*RL$P z=+GB>a&1Cf2JyygmrbMmwVWYcnp1iZSG{tJbD+M|1BpqkNaHR1p(h?5$Ck=h9X56% zEWN680-@fU0nS<=uelY^e?6v3-QhM~&2e=Y5vguUr{;2u;uW-TkujT`0_3&guBjcV zhV0@F-5+anUJ@slpMZmnP32tw6|CKSk;^-m;u zS>guM(B!cD8yVJwI%yksZE>U4mufy&0OL2S+a7!J1+I@{8Ao;5c?9DV=S&V!x=Y{y z1RP%Xode3>%s=4e9`-(cp^zn}$49?)D698WWMF$-p(5hK9RzoJ0@Sy3p1CAt>`>iR zKYGx1{}5~;o}L;=Z2UmQk`%}_7z5>Rc5Qnz!f(USuj>6>Zf=Vx71r0HBk=Ir$jHZ* zq@)rRf%iePe@#9~}r=<6RAQR}LsdmBC4DZ`!4P`a}SEhdfEt(@H)Kt4h@S z+AlqHoQk`s2YkI+5g_ilNLH0{An()*3G&%bNJ~viAsMW4iNPmFnBAXj)Qc0XGyg={ z83g1#h)l7mB1-FPo##p~4w4obOdVgN_^0!DX^|VtJ$HrLPw)s1E*#=&3!mvyu@D*( zPFN-=_f=VPd`(~FZfO@o1GRqfs6QMjAO3tulpP zs|GY)(9Y%c-F}*qo`kBe;!G}X1~$DKf7m8P;2Tn|I@P*;F4vqJ&cQOoB)Vr^13quO znRVf@jKB-p+@@!o(i>~@nnlCXF%jsEIv{5h&Kor-K9v+dwJTO2st-VM?3Vxgd~F*-%bW zo(=fgXZ#S$s1b=9MM1i$6*_|v+3THOHiZI}KdHeDM-mCUJMn`WC+7h?$=Q{Xf|$nq zKkvOyyNf(R*Ma(}MZ_o)62=&3Zx;tuSSsQ&T<^raRySrC83WvmXab?~A+>a%6=$B} zxJ}O*;j1D+s}yVh;JA#_Eis(lIu$qj22ekpfpY8Mt?1V(xy5qniy+Hg@nVNr-J-RQ zabX|%q+BN`UOlfYTVtm-vYcc@R4)E9m*^>ltw^a2MEK0|dl(D{kk71Ea$B&um@iH3 z>M#(?%u|40iI(m=ig8Os4SM(R0%|>;MVB)QCNmh~^ZV?YZnAQ0!@EJLdFKpoZ!;B* zpW{jj)X$z-YGT)SA*4UuUE!|{g)0ydyexw+^ep^_@Wqc>xeUm^pM8nd{sgU?^C~VY zzrURO$zdPAWDy1(RY60zb-^ABkT3k=(bV6Or_S>k`Km>mt+%N126xZ965pEVpaGm@ z3bj93Mmsw)|5dDsFEb@KIT!NevbMaa*}3NPS?&>)bA7ZeP`^@OGqPJsG4+Q|T^E;{ zjC7MtGo0Jr}LM&z~-Jp*P^98tphn6L>}(Of83&Y!2B?20;OL9%CCA~ zrE2#i`Qe{88aS0*e5{U!*gJV!wqeA-(Crcc2g^iN8A~ix8oz47M$fT4rhUOzuIuh?oQF4`!Pd zHS=wdmKba7uhs@Y>#}ShZO|4Ty?Prd1!{Ai!W4QDeMSQexEfh^5MBbUX z4p=JfdEqpy>qw5@c^+)cYWnH^D6&OZ4|l^x$G2a!s(}Jl&eRz#OnF5Llq45G{jWTRcj%lA z^1*Yb4`Fd|GsuZn6{o`~$XC@R;x^Z>p!O@4VL#LdhnKC+4XQFAXEm0urVO8dOc~l} z>r4KDXXSng)L)LT2rW|@N52Ww=q0L zUkzbeUn0Cqre=XR(roVUY3ZFDGiwJqoAX&}{f%tDLVyb2O zsV`FSLiy)^Y=_={iKwC z&Y60^IrF6i;=N^rKbR+cD=>aB4CMD7-iG!fw<_q^1iZSKM<$Y5@NE6+Zn-5hCH0U= zVGgw(KMF1~moY*qQL-M~z+Q%FW6Y0Rfh8cU5{RNdS!w98O5B@z-}_O$jeVYWciC_ zqiYV@zMQSg@8)gXWej4Hfc$x^-J)Y`vVdW}5=&<>YBJT2DvNJ)VmiM36M`zfU!eB? zhY<_~m2zLW+l!r=48qrEr-Z;!uO_g*Ml7poYv{U%0QD&dk={HLCqVg{WY2Dm8&mrPc!E)saEpx%GPbgwHuX>YR6PMbAEM zaBnGJEt@cTiS%< zDU$o;f(WlHAg{}G&)pH_wcjS5MMrjHEv5vs$y1?lN#2tx*?58($q(ey7b;X%*yRWV!YBI=%w!a7OUp~O?pwbC`C{Z!f0d43YRqy0*U5X!%OqDdqYY8Me0-ly zNO8AGq4sk+=8$bcIeITb)CRwByUu24nmM&TxEir=lDsN-qsCYZ)E`Zk6G4b;wC&Qk zHRsV7`8jto@yx|^N|J@fXhnZ@9BTh({wSs?Xx+B@MjqKMF`7V8MUE9lCWaDb6@AtQ8?0Sxn z_n`RW@Xp9WJTu=NC;T)GmftI9J-S+7l6PIcPNcTA!D;bJG@yM2G}k84>OT@&(c;97zv0b(%Pnt?NqYwC-@J{eRLeZj^Q=G&1e9>?eJSd^|+n1sq{6Az9!xXHu9d|`$g0)9K;uS^*U1!B4Qha{bm<`lV z*FIE4*pzO_p-Mz9)G*l#ZKIYa{$h84nbN&YaXTIev{sJ3QHCOQ?zVrTuMqNDk!xP zAC6q!v}iGH6a~r;bs|qb(DLL8J^4}xH|<}4Q+RcOWP9?vdHzfDGiqucsPF4x{N?SV@md!2= zQ`XPV3%R{Q-e$YE!9B&se9pybyRx*WU7M9y&U59h&4t3Db$jeGm{>C#gBiU)<~^v^ZF4K_5G;rHw( zC^xS#*<%ZSu*R|ZY2OFr@+)10k znSZhFYrU=Al|@+{kxcsfwkM8h+;jSOGssru&>x2xg5S#a_v}t(VrFDuTx@AzZXn3U znb79J*!IJTk&%UknTbWfKol6fvZ^e620UzB+H8z0j7{cT%!~%yAYp!x8ukX{zy-!D zFmM?e!ljoa_-MZTRGS?$`SzKd`4aY-9_fYorKiu-@ArN3 zqSLlc(5cvFZ^xWTOOrC}H9&a(<` z`SMxw=k3|Sm-gzf%_>!MP1&_eV_JLP_79cezpD6byeuZ|`84&@bBzn%Z_JR2vz)gz zwPEk)TSE2$W$BvpFLHCqwNH;Jy8W54#Op5muCkX|f9@*Xc4NA}p6lpa(LMayD{uGi Vug_n*X!}uLFZay{!zOGK2LKf_J{bT2 diff --git a/vendor/github.com/google/go-tpm-tools/server/verify.go b/vendor/github.com/google/go-tpm-tools/server/verify.go deleted file mode 100644 index 89a6cf26f..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/verify.go +++ /dev/null @@ -1,374 +0,0 @@ -package server - -import ( - "crypto" - "crypto/x509" - "crypto/x509/pkix" - "encoding/asn1" - "errors" - "fmt" - - "github.com/google/go-tpm-tools/internal" - pb "github.com/google/go-tpm-tools/proto/attest" - tpmpb "github.com/google/go-tpm-tools/proto/tpm" - "github.com/google/go-tpm/legacy/tpm2" - "google.golang.org/protobuf/proto" -) - -// We conditinally support SHA-1 for PCR hashes, but at the lowest priority. -var pcrHashAlgs = append(internal.SignatureHashAlgs, tpm2.AlgSHA1) - -var oidExtensionSubjectAltName = []int{2, 5, 29, 17} - -var cloudComputeInstanceIdentifierOID asn1.ObjectIdentifier = []int{1, 3, 6, 1, 4, 1, 11129, 2, 1, 21} - -// VerifyOpts allows for customizing the functionality of VerifyAttestation. -type VerifyOpts struct { - // The nonce used when calling client.Attest - Nonce []byte - // Trusted public keys that can be used to directly verify the key used for - // attestation. This option should be used if you already know the AK, as - // it provides the highest level of assurance. - TrustedAKs []crypto.PublicKey - // Allow using SHA-1 PCRs to verify attestations. This defaults to false - // because SHA-1 is a weak hash algorithm with known collision attacks. - // However, setting this to true may be necessary if the client only - // supports the legacy event log format. This is the case on older Linux - // distributions (such as Debian 10). Note that this will NOT allow - // SHA-1 signatures to be used, just SHA-1 PCRs. - AllowSHA1 bool - // A collection of trusted root CAs that are used to sign AK certificates. - // The TrustedAKs are used first, followed by TrustRootCerts and - // IntermediateCerts. - // Adding a specific TPM manufacturer's root and intermediate CAs means all - // TPMs signed by that CA will be trusted. - TrustedRootCerts []*x509.Certificate - IntermediateCerts []*x509.Certificate - // Which bootloader the instance uses. Pick UNSUPPORTED to skip this - // parsing or for unsupported bootloaders (e.g., systemd). - Loader Bootloader - // TEEOpts allows customizing the functionality of VerifyTEEAttestation. - // Its type can be *VerifySnpOpts if the TEEAttestation is a SevSnpAttestation - // or can be *VerifyTdxOpts if the TEEAttestation is a TdxAttestation - // If nil, uses Nonce for ReportData and the TEE's verification library's - // embedded root certs for its roots of trust. - TEEOpts interface{} -} - -// Bootloader refers to the second-stage bootloader that loads and transfers -// execution to the OS kernel. -type Bootloader int - -const ( - // UnsupportedLoader refers to a second-stage bootloader that is of an - // unsupported type. VerifyAttestation will not parse the PCClient Event Log - // for bootloader events. - UnsupportedLoader Bootloader = iota - // GRUB (https://www.gnu.org/software/grub/). - GRUB -) - -// TODO: Change int64 fields to uint64 when compatible with ASN1 parsing. -type gceSecurityProperties struct { - SecurityVersion int64 `asn1:"explicit,tag:0,optional"` - IsProduction bool `asn1:"explicit,tag:1,optional"` -} - -type gceInstanceInfo struct { - Zone string `asn1:"utf8"` - ProjectNumber int64 - ProjectID string `asn1:"utf8"` - InstanceID int64 - InstanceName string `asn1:"utf8"` - SecurityProperties gceSecurityProperties `asn1:"explicit,optional"` -} - -// VerifyAttestation performs the following checks on an Attestation: -// - the AK used to generate the attestation is trusted (based on VerifyOpts) -// - the provided signature is generated by the trusted AK public key -// - the signature signs the provided quote data -// - the quote data starts with TPM_GENERATED_VALUE -// - the quote data is a valid TPMS_QUOTE_INFO -// - the quote data was taken over the provided PCRs -// - the provided PCR values match the quote data internal digest -// - the provided opts.Nonce matches that in the quote data -// - the provided eventlog matches the provided PCR values -// -// After this, the eventlog is parsed and the corresponding MachineState is -// returned. This design prevents unverified MachineStates from being used. -func VerifyAttestation(attestation *pb.Attestation, opts VerifyOpts) (*pb.MachineState, error) { - if err := validateOpts(opts); err != nil { - return nil, fmt.Errorf("bad options: %w", err) - } - - var akPubKey crypto.PublicKey - var machineState *pb.MachineState - if len(attestation.GetAkCert()) == 0 { - // If the AK Cert is not in the attestation, use the AK Public Area. - akPubArea, err := tpm2.DecodePublic(attestation.GetAkPub()) - if err != nil { - return nil, fmt.Errorf("failed to decode AK public area: %w", err) - } - akPubKey, err = akPubArea.Key() - if err != nil { - return nil, fmt.Errorf("failed to get AK public key: %w", err) - } - machineState, err = validateAKPub(akPubKey, opts) - if err != nil { - return nil, fmt.Errorf("failed to validate AK public key: %w", err) - } - } else { - // If AK Cert is presented, ignore the AK Public Area. - akCert, err := x509.ParseCertificate(attestation.GetAkCert()) - if err != nil { - return nil, fmt.Errorf("failed to parse AK certificate: %w", err) - } - // Use intermediate certs from the attestation if they exist. - certs, err := parseCerts(attestation.IntermediateCerts) - if err != nil { - return nil, fmt.Errorf("attestation intermediates: %w", err) - } - opts.IntermediateCerts = append(opts.IntermediateCerts, certs...) - - machineState, err = validateAKCert(akCert, opts) - if err != nil { - return nil, fmt.Errorf("failed to validate AK certificate: %w", err) - } - akPubKey = akCert.PublicKey.(crypto.PublicKey) - } - - // Attempt to replay the log against our PCRs in order of hash preference - var lastErr error - for _, quote := range supportedQuotes(attestation.GetQuotes()) { - // Verify the Quote - if err := internal.VerifyQuote(quote, akPubKey, opts.Nonce); err != nil { - lastErr = fmt.Errorf("failed to verify quote: %w", err) - continue - } - - // Parse event logs and replay the events against the provided PCRs - pcrs := quote.GetPcrs() - state, err := parsePCClientEventLog(attestation.GetEventLog(), pcrs, opts.Loader) - if err != nil { - lastErr = fmt.Errorf("failed to validate the PCClient event log: %w", err) - continue - } - - if err := VerifyGceTechnology(attestation, state.Platform.GetTechnology(), &opts); err != nil { - lastErr = fmt.Errorf("failed to verify memory encryption technology: %w", err) - continue - } - - celState, err := parseCanonicalEventLog(attestation.GetCanonicalEventLog(), pcrs) - if err != nil { - lastErr = fmt.Errorf("failed to validate the Canonical event log: %w", err) - continue - } - - // Verify the PCR hash algorithm. We have this check here (instead of at - // the start of the loop) so that the user gets a "SHA-1 not supported" - // error only if allowing SHA-1 support would actually allow the log - // to be verified. This makes debugging failed verifications easier. - if !opts.AllowSHA1 && tpm2.Algorithm(pcrs.GetHash()) == tpm2.AlgSHA1 { - lastErr = fmt.Errorf("SHA-1 is not allowed for verification (set VerifyOpts.AllowSHA1 to true to allow)") - continue - } - - proto.Merge(machineState, celState) - proto.Merge(machineState, state) - - return machineState, nil - } - - if lastErr != nil { - return nil, lastErr - } - return nil, fmt.Errorf("attestation does not contain a supported quote") -} - -// GetGCEInstanceInfo takes a GCE-issued x509 EK/AK certificate and tries to -// extract its GCE instance information. It returns an error if the cert is nil -// or malformed, but it does not return an error if the cert does not contain -// the GCE Instance OID. -func GetGCEInstanceInfo(cert *x509.Certificate) (*pb.GCEInstanceInfo, error) { - if cert == nil { - return nil, errors.New("cannot extract GCEInstanceInfo from a nil cert") - } - return getInstanceInfoFromExtensions(cert.Extensions) -} - -func getInstanceInfoFromExtensions(extensions []pkix.Extension) (*pb.GCEInstanceInfo, error) { - var rawInfo []byte - for _, ext := range extensions { - if ext.Id.Equal(cloudComputeInstanceIdentifierOID) { - rawInfo = ext.Value - break - } - } - - // If GCE Instance Info extension is not found. - if len(rawInfo) == 0 { - return nil, nil - } - - info := gceInstanceInfo{} - if _, err := asn1.Unmarshal(rawInfo, &info); err != nil { - return nil, fmt.Errorf("failed to parse GCE Instance Information Extension: %w", err) - } - - // TODO: Remove when fields are changed to uint64. - if info.ProjectNumber < 0 || info.InstanceID < 0 || info.SecurityProperties.SecurityVersion < 0 { - return nil, fmt.Errorf("negative integer fields found in GCE Instance Information Extension") - } - - // Check production. - if !info.SecurityProperties.IsProduction { - return nil, nil - } - - return &pb.GCEInstanceInfo{ - Zone: info.Zone, - ProjectId: info.ProjectID, - ProjectNumber: uint64(info.ProjectNumber), - InstanceName: info.InstanceName, - InstanceId: uint64(info.InstanceID), - }, nil -} - -// Check that we are passing in a valid VerifyOpts structure -func validateOpts(opts VerifyOpts) error { - checkPub := len(opts.TrustedAKs) > 0 - checkCert := len(opts.TrustedRootCerts) > 0 - if !checkPub && !checkCert { - return fmt.Errorf("no trust mechanism provided, either use TrustedAKs or TrustedRootCerts") - } - if checkPub && checkCert { - return fmt.Errorf("multiple trust mechanisms provided, only use one of TrustedAKs or TrustedRootCerts") - } - return nil -} - -func validateAKPub(ak crypto.PublicKey, opts VerifyOpts) (*pb.MachineState, error) { - for _, trusted := range opts.TrustedAKs { - if internal.PubKeysEqual(ak, trusted) { - return &pb.MachineState{}, nil - } - } - return nil, fmt.Errorf("key not trusted") -} - -func validateAKCert(akCert *x509.Certificate, opts VerifyOpts) (*pb.MachineState, error) { - if len(opts.TrustedRootCerts) == 0 { - return validateAKPub(akCert.PublicKey.(crypto.PublicKey), opts) - } - - // We manually handle the SAN extension because x509 marks it unhandled if - // SAN does not parse any of DNSNames, EmailAddresses, IPAddresses, or URIs. - // https://cs.opensource.google/go/go/+/master:src/crypto/x509/parser.go;l=668-678 - var exts []asn1.ObjectIdentifier - for _, ext := range akCert.UnhandledCriticalExtensions { - if ext.Equal(oidExtensionSubjectAltName) { - continue - } - exts = append(exts, ext) - } - akCert.UnhandledCriticalExtensions = exts - - x509Opts := x509.VerifyOptions{ - Roots: makePool(opts.TrustedRootCerts), - Intermediates: makePool(opts.IntermediateCerts), - // The default key usage (ExtKeyUsageServerAuth) is not appropriate for - // an Attestation Key: ExtKeyUsage of - // - https://oidref.com/2.23.133.8.1 - // - https://oidref.com/2.23.133.8.3 - // https://pkg.go.dev/crypto/x509#VerifyOptions - KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsage(x509.ExtKeyUsageAny)}, - } - if _, err := akCert.Verify(x509Opts); err != nil { - return nil, fmt.Errorf("certificate did not chain to a trusted root: %v", err) - } - - instanceInfo, err := getInstanceInfoFromExtensions(akCert.Extensions) - if err != nil { - return nil, fmt.Errorf("error getting instance info: %v", err) - } - - return &pb.MachineState{Platform: &pb.PlatformState{InstanceInfo: instanceInfo}}, nil -} - -// Retrieve the supported quotes in order of hash preference. -func supportedQuotes(quotes []*tpmpb.Quote) []*tpmpb.Quote { - out := make([]*tpmpb.Quote, 0, len(quotes)) - for _, alg := range pcrHashAlgs { - for _, quote := range quotes { - if tpm2.Algorithm(quote.GetPcrs().GetHash()) == alg { - out = append(out, quote) - break - } - } - } - return out -} - -func makePool(certs []*x509.Certificate) *x509.CertPool { - pool := x509.NewCertPool() - for _, cert := range certs { - pool.AddCert(cert) - } - return pool -} - -// VerifyGceTechnology checks the GCE-specific GceNonHost event's Trusted Execution Technology (TEE) -// claim using attestation reports if the technology supports them, and only then validates that a -// particular technology has proven that it is in use. -func VerifyGceTechnology(attestation *pb.Attestation, tech pb.GCEConfidentialTechnology, opts *VerifyOpts) error { - switch tech { - case pb.GCEConfidentialTechnology_NONE: // Nothing to verify - if opts.TEEOpts != nil { - return fmt.Errorf("memory encryption technology %v does not support TEEOpts", tech) - } - return nil - case pb.GCEConfidentialTechnology_AMD_SEV: // Not verifiable on GCE - if opts.TEEOpts != nil { - return fmt.Errorf("memory encryption technology %v does not support TEEOpts", tech) - } - return nil - case pb.GCEConfidentialTechnology_AMD_SEV_ES: // Not verifiable on GCE - if opts.TEEOpts != nil { - return fmt.Errorf("memory encryption technology %v does not support TEEOpts", tech) - } - return nil - case pb.GCEConfidentialTechnology_AMD_SEV_SNP: - var snpOpts *VerifySnpOpts - tee, ok := attestation.TeeAttestation.(*pb.Attestation_SevSnpAttestation) - if !ok { - return fmt.Errorf("TEE attestation is %T, expected a SevSnpAttestation", attestation.GetTeeAttestation()) - } - if opts.TEEOpts == nil { - snpOpts = SevSnpDefaultOptions(opts.Nonce) - } else { - snpOpts, ok = opts.TEEOpts.(*VerifySnpOpts) - if !ok { - return fmt.Errorf("unexpected value for TEEOpts given a SEV-SNP attestation report: %v", - opts.TEEOpts) - } - } - return VerifySevSnpAttestation(tee.SevSnpAttestation, snpOpts) - case pb.GCEConfidentialTechnology_INTEL_TDX: - var tdxOpts *VerifyTdxOpts - tee, ok := attestation.TeeAttestation.(*pb.Attestation_TdxAttestation) - if !ok { - return fmt.Errorf("TEE attestation is %T, expected a TdxAttestation", attestation.GetTeeAttestation()) - } - if opts.TEEOpts == nil { - tdxOpts = TdxDefaultOptions() - } else { - tdxOpts, ok = opts.TEEOpts.(*VerifyTdxOpts) - if !ok { - return fmt.Errorf("unexpected value for TEEOpts given a TDX attestation quote: %v", opts.TEEOpts) - } - } - return VerifyTdxAttestation(tee.TdxAttestation, tdxOpts) - } - return fmt.Errorf("unknown GCEConfidentialTechnology: %v", tech) -} diff --git a/vendor/github.com/google/go-tpm-tools/server/verify_sev.go b/vendor/github.com/google/go-tpm-tools/server/verify_sev.go deleted file mode 100644 index e056891c4..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/verify_sev.go +++ /dev/null @@ -1,58 +0,0 @@ -package server - -import ( - sabi "github.com/google/go-sev-guest/abi" - spb "github.com/google/go-sev-guest/proto/sevsnp" - "github.com/google/go-sev-guest/validate" - sv "github.com/google/go-sev-guest/verify" -) - -// The policy on GCE is to allow SMT, and eventually MigrateMA, but no debug bit. -var defaultSevSnpGuestPolicy = sabi.SnpPolicy{ - SMT: true, - MigrateMA: true, -} - -// VerifySnpOpts allows for customizing the functionality of VerifyAttestation's SEV-SNP verification. -type VerifySnpOpts struct { - Validation *validate.Options - Verification *sv.Options -} - -// SevSnpDefaultValidateOpts returns a default validation policy for SEV-SNP attestation reports on GCE. -func SevSnpDefaultValidateOpts(tpmNonce []byte) *validate.Options { - policy := &validate.Options{GuestPolicy: defaultSevSnpGuestPolicy} - policy.ReportData = make([]byte, sabi.ReportDataSize) - copy(policy.ReportData, tpmNonce) - return policy -} - -// SevSnpDefaultValidateOptsForTest is a non-production policy only meant for testing. It is more -// permissive in the kinds of reports it validates, including whether the host is allowed to -// forcibly decrypt data (for debugging purposes). -func SevSnpDefaultValidateOptsForTest(tpmNonce []byte) *validate.Options { - policy := SevSnpDefaultValidateOpts(tpmNonce) - policy.GuestPolicy.Debug = true - return policy -} - -// SevSnpDefaultOptions returns a default validation policy and verification options for SEV-SNP -// attestation reports on GCE. -func SevSnpDefaultOptions(tpmNonce []byte) *VerifySnpOpts { - return &VerifySnpOpts{ - Validation: SevSnpDefaultValidateOpts(tpmNonce), - Verification: sv.DefaultOptions(), - } -} - -// VerifySevSnpAttestation checks that the SEV-SNP attestation report matches expectations for the -// product. -func VerifySevSnpAttestation(attestation *spb.Attestation, opts *VerifySnpOpts) error { - // Check that the report is signed by a valid AMD key. Do not check revocations. This must be - // done before validation to ensure the certificates are filled in by the verify library. - if err := sv.SnpAttestation(attestation, opts.Verification); err != nil { - return err - } - // Check that the fields of the report are acceptable. - return validate.SnpAttestation(attestation, opts.Validation) -} diff --git a/vendor/github.com/google/go-tpm-tools/server/verify_tdx.go b/vendor/github.com/google/go-tpm-tools/server/verify_tdx.go deleted file mode 100644 index 8867e4ed2..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/verify_tdx.go +++ /dev/null @@ -1,25 +0,0 @@ -package server - -import ( - tpb "github.com/google/go-tdx-guest/proto/tdx" - tv "github.com/google/go-tdx-guest/verify" -) - -// VerifyTdxOpts allows for customizing the functionality of VerifyAttestation's TDX verification. -type VerifyTdxOpts struct { - Verification *tv.Options -} - -// TdxDefaultOptions returns a default verification options for TDX -// attestation quote on GCE. -func TdxDefaultOptions() *VerifyTdxOpts { - return &VerifyTdxOpts{ - Verification: tv.DefaultOptions(), - } -} - -// VerifyTdxAttestation checks that the TDX attestation quote is valid -func VerifyTdxAttestation(attestation *tpb.QuoteV4, opts *VerifyTdxOpts) error { - // Check that the quote contains valid signature and certificates. Do not check revocations. - return tv.TdxQuote(attestation, opts.Verification) -} diff --git a/vendor/github.com/google/go-tpm-tools/server/verify_test.go b/vendor/github.com/google/go-tpm-tools/server/verify_test.go deleted file mode 100644 index 2de92944b..000000000 --- a/vendor/github.com/google/go-tpm-tools/server/verify_test.go +++ /dev/null @@ -1,1255 +0,0 @@ -package server - -import ( - "bytes" - "crypto" - "crypto/rand" - "crypto/rsa" - "crypto/sha256" - "crypto/x509/pkix" - "encoding/asn1" - "encoding/binary" - "fmt" - "io" - "os" - "strings" - "testing" - "time" - - "github.com/google/go-cmp/cmp" - sgclient "github.com/google/go-sev-guest/client" - sgtest "github.com/google/go-sev-guest/testing" - testclient "github.com/google/go-sev-guest/testing/client" - sv "github.com/google/go-sev-guest/verify" - tgtest "github.com/google/go-tdx-guest/testing" - tgtestclient "github.com/google/go-tdx-guest/testing/client" - tgtestdata "github.com/google/go-tdx-guest/testing/testdata" - tv "github.com/google/go-tdx-guest/verify" - "github.com/google/go-tdx-guest/verify/trust" - "github.com/google/go-tpm-tools/cel" - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm-tools/internal" - "github.com/google/go-tpm-tools/internal/test" - attestpb "github.com/google/go-tpm-tools/proto/attest" - "github.com/google/go-tpm/legacy/tpm2" - tpm "github.com/google/go-tpm/tpm2" - "github.com/google/go-tpm/tpmutil" - "github.com/google/logger" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/testing/protocmp" -) - -var measuredHashes = []crypto.Hash{crypto.SHA1, crypto.SHA256} - -func createTpm2EventLog(gceConfidentialTechnologyEnum byte) []byte { - pcr0 := uint32(0) - algorithms := []tpm.TPMIAlgHash{tpm.TPMAlgSHA1, tpm.TPMAlgSHA256, tpm.TPMAlgSHA384} - specEventInfo := []byte{ - 'S', 'p', 'e', 'c', ' ', 'I', 'D', ' ', 'E', 'v', 'e', 'n', 't', '0', '3', 0, - 0, 0, 0, 0, // platformClass - 0, // specVersionMinor, - 2, // specVersionMajor, - 0, // specErrata - 2, // uintnSize - byte(len(algorithms)), 0, 0, 0} // NumberOfAlgorithms - for _, alg := range algorithms { - var algInfo [4]byte - algo, _ := alg.Hash() - binary.LittleEndian.PutUint16(algInfo[0:2], uint16(alg)) - binary.LittleEndian.PutUint16(algInfo[2:4], uint16(algo.Size())) - specEventInfo = append(specEventInfo, algInfo[:]...) - } - vendorInfoSize := byte(0) - specEventInfo = append(specEventInfo, vendorInfoSize) - - specEventHeader := make([]byte, 32) - evNoAction := uint32(0x03) - binary.LittleEndian.PutUint32(specEventHeader[0:4], pcr0) - binary.LittleEndian.PutUint32(specEventHeader[4:8], evNoAction) - binary.LittleEndian.PutUint32(specEventHeader[28:32], uint32(len(specEventInfo))) - specEvent := append(specEventHeader, specEventInfo...) - - // After the Spec ID Event, all events must use all the specified digest algorithms. - extendHashes := func(buffer []byte, info []byte) []byte { - var numberOfDigests [4]byte - binary.LittleEndian.PutUint32(numberOfDigests[:], uint32(len(algorithms))) - buffer = append(buffer, numberOfDigests[:]...) - for _, alg := range algorithms { - algo, _ := alg.Hash() - digest := make([]byte, 2+algo.Size()) - binary.LittleEndian.PutUint16(digest[0:2], uint16(alg)) - h := algo.New() - h.Write(info) - copy(digest[2:], h.Sum(nil)) - buffer = append(buffer, digest...) - } - return buffer - } - writeTpm2Event := func(buffer []byte, pcr uint32, eventType uint32, info []byte) []byte { - header := make([]byte, 8) - binary.LittleEndian.PutUint32(header[0:4], pcr) - binary.LittleEndian.PutUint32(header[4:8], eventType) - buffer = append(buffer, header...) - - buffer = extendHashes(buffer, info) - - var eventSize [4]byte - binary.LittleEndian.PutUint32(eventSize[:], uint32(len(info))) - buffer = append(buffer, eventSize[:]...) - - return append(buffer, info...) - } - evSCRTMversion := uint32(0x08) - versionEventInfo := []byte{ - 'G', 0, 'C', 0, 'E', 0, ' ', 0, - 'V', 0, 'i', 0, 'r', 0, 't', 0, 'u', 0, 'a', 0, 'l', 0, ' ', 0, - 'F', 0, 'i', 0, 'r', 0, 'm', 0, 'w', 0, 'a', 0, 'r', 0, 'e', 0, ' ', 0, - 'v', 0, '1', 0, 0, 0} - withVersionEvent := writeTpm2Event(specEvent, pcr0, evSCRTMversion, versionEventInfo) - - nonHostEventInfo := []byte{ - 'G', 'C', 'E', ' ', 'N', 'o', 'n', 'H', 'o', 's', 't', 'I', 'n', 'f', 'o', 0, - gceConfidentialTechnologyEnum, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - evNonHostInfo := uint32(0x11) - return writeTpm2Event(withVersionEvent, pcr0, evNonHostInfo, nonHostEventInfo) -} - -func getDigestHash(input string) []byte { - inputDigestHash := sha256.New() - inputDigestHash.Write([]byte(input)) - return inputDigestHash.Sum(nil) -} - -func extendPCRsRandomly(rwc io.ReadWriteCloser, selpcr tpm2.PCRSelection) error { - var pcrExtendValue []byte - if selpcr.Hash == tpm2.AlgSHA256 { - pcrExtendValue = make([]byte, 32) - } else if selpcr.Hash == tpm2.AlgSHA1 { - pcrExtendValue = make([]byte, 20) - } - - for _, v := range selpcr.PCRs { - _, err := rand.Read(pcrExtendValue) - if err != nil { - return fmt.Errorf("random bytes read fail %v", err) - } - err = tpm2.PCRExtend(rwc, tpmutil.Handle(v), selpcr.Hash, pcrExtendValue, "") - if err != nil { - return fmt.Errorf("PCR extend fail %v", err) - } - } - return nil -} - -func TestMain(m *testing.M) { - logger.Init("TestLog", false, false, os.Stderr) - os.Exit(m.Run()) -} - -func TestVerifyHappyCases(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - onePCR := []int{test.DebugPCR} - twoPCR := append(onePCR, test.ApplicationPCR) - dupePCR := append(twoPCR, twoPCR...) - - subtests := []struct { - name string - getKey func(io.ReadWriter) (*client.Key, error) - pcrHashAlgo tpm2.Algorithm - quotePCRList []int - extraData []byte - }{ - {"AK-RSA_SHA1_2PCRs_nonce", client.AttestationKeyRSA, tpm2.AlgSHA1, twoPCR, getDigestHash("test")}, - {"AK-RSA_SHA1_1PCR_nonce", client.AttestationKeyRSA, tpm2.AlgSHA1, onePCR, getDigestHash("t")}, - {"AK-RSA_SHA1_1PCR_no-nonce", client.AttestationKeyRSA, tpm2.AlgSHA1, onePCR, nil}, - {"AK-RSA_SHA256_2PCRs_nonce", client.AttestationKeyRSA, tpm2.AlgSHA256, twoPCR, getDigestHash("test")}, - {"AK-RSA_SHA256_2PCR_empty-nonce", client.AttestationKeyRSA, tpm2.AlgSHA256, twoPCR, []byte{}}, - {"AK-RSA_SHA256_dupePCrSel_nonce", client.AttestationKeyRSA, tpm2.AlgSHA256, dupePCR, getDigestHash("")}, - - {"AK-ECC_SHA1_2PCRs_nonce", client.AttestationKeyECC, tpm2.AlgSHA1, twoPCR, getDigestHash("test")}, - {"AK-ECC_SHA1_1PCR_nonce", client.AttestationKeyECC, tpm2.AlgSHA1, onePCR, getDigestHash("t")}, - {"AK-ECC_SHA1_1PCR_no-nonce", client.AttestationKeyECC, tpm2.AlgSHA1, onePCR, nil}, - {"AK-ECC_SHA256_2PCRs_nonce", client.AttestationKeyECC, tpm2.AlgSHA256, twoPCR, getDigestHash("test")}, - {"AK-ECC_SHA256_2PCR_empty-nonce", client.AttestationKeyECC, tpm2.AlgSHA256, twoPCR, []byte{}}, - {"AK-ECC_SHA256_dupePCrSel_nonce", client.AttestationKeyECC, tpm2.AlgSHA256, dupePCR, getDigestHash("")}, - } - for _, subtest := range subtests { - t.Run(subtest.name, func(t *testing.T) { - ak, err := subtest.getKey(rwc) - if err != nil { - t.Errorf("failed to generate AK: %v", err) - } - defer ak.Close() - - selpcr := tpm2.PCRSelection{ - Hash: subtest.pcrHashAlgo, - PCRs: subtest.quotePCRList, - } - err = extendPCRsRandomly(rwc, selpcr) - if err != nil { - t.Fatalf("failed to extend test PCRs: %v", err) - } - quote, err := ak.Quote(selpcr, subtest.extraData) - if err != nil { - t.Fatalf("failed to quote: %v", err) - } - err = internal.VerifyQuote(quote, ak.PublicKey(), subtest.extraData) - if err != nil { - t.Fatalf("failed to verify: %v", err) - } - }) - } -} - -func TestVerifyPCRChanged(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Errorf("failed to generate AK: %v", err) - } - defer ak.Close() - - selpcr := tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: []int{test.DebugPCR}, - } - err = extendPCRsRandomly(rwc, selpcr) - if err != nil { - t.Errorf("failed to extend test PCRs: %v", err) - } - nonce := getDigestHash("test") - quote, err := ak.Quote(selpcr, nonce) - if err != nil { - t.Error(err) - } - - // change the PCR value - err = extendPCRsRandomly(rwc, selpcr) - if err != nil { - t.Errorf("failed to extend test PCRs: %v", err) - } - - quote.Pcrs, err = client.ReadPCRs(rwc, selpcr) - if err != nil { - t.Errorf("failed to read PCRs: %v", err) - } - err = internal.VerifyQuote(quote, ak.PublicKey(), nonce) - if err == nil { - t.Errorf("Verify should fail as Verify read a modified PCR") - } -} - -func TestVerifyUsingDifferentPCR(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Errorf("failed to generate AK: %v", err) - } - defer ak.Close() - - err = extendPCRsRandomly(rwc, tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: []int{test.DebugPCR, test.ApplicationPCR}, - }) - if err != nil { - t.Errorf("failed to extend test PCRs: %v", err) - } - - nonce := getDigestHash("test") - quote, err := ak.Quote(tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: []int{test.DebugPCR}, - }, nonce) - if err != nil { - t.Error(err) - } - - quote.Pcrs, err = client.ReadPCRs(rwc, tpm2.PCRSelection{ - Hash: tpm2.AlgSHA256, - PCRs: []int{test.ApplicationPCR}, - }) - if err != nil { - t.Errorf("failed to read PCRs: %v", err) - } - err = internal.VerifyQuote(quote, ak.PublicKey(), nonce) - if err == nil { - t.Errorf("Verify should fail as Verify read a different PCR") - } -} - -func TestVerifyBasicAttestationWithSevSnp(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - // When running on hardware, ak.Attest will collect an attestation report regardless of - // AttestOpts. We test the default behavior here by not passing in a device. - sevTestDevice, goodSnpRoot, _, kdsGetter := testclient.GetSevGuest(nil, &sgtest.DeviceOptions{}, t) - defer sevTestDevice.Close() - - nonce := []byte("super secret nonce") - attestation, err := ak.Attest(client.AttestOpts{ - Nonce: nonce, - }) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - teeopts := &VerifySnpOpts{ - Validation: SevSnpDefaultValidateOpts(nonce), - Verification: &sv.Options{ - Getter: kdsGetter, - TrustedRoots: goodSnpRoot, - }, - } - if _, err := VerifyAttestation(attestation, VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - }); err != nil { - t.Errorf("failed to verify: %v", err) - } - - if _, err := VerifyAttestation(attestation, VerifyOpts{ - Nonce: append(nonce, 0), - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - TEEOpts: teeopts, - }); err == nil { - t.Error("using the wrong nonce should make verification fail") - } - - if _, err := VerifyAttestation(attestation, VerifyOpts{ - Nonce: nonce, - TEEOpts: teeopts, - }); err == nil { - t.Error("using no trusted AKs should make verification fail") - } - - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Fatal(err) - } - if _, err := VerifyAttestation(attestation, VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{priv.Public()}, - TEEOpts: teeopts, - }); err == nil { - t.Error("using a random trusted AKs should make verification fail") - } -} - -func TestVerifyBasicAttestationWithTdx(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - nonce := []byte("super secret nonce") - var nonce64 [64]byte - copy(nonce64[:], nonce) - tdxTestDevice := tgtestclient.GetTdxGuest([]tgtest.TestCase{ - { - Input: nonce64, - Quote: tgtestdata.RawQuote, - }, - }, t) - - defer tdxTestDevice.Close() - attestation, err := ak.Attest(client.AttestOpts{ - Nonce: nonce, - TEEDevice: &client.TdxDevice{Device: tdxTestDevice}, - TEENonce: nonce64[:], - }) - - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - teeopts := &VerifyTdxOpts{ - Verification: tv.DefaultOptions(), - } - if _, err := VerifyAttestation(attestation, VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - }); err != nil { - t.Errorf("failed to verify: %v", err) - } - - if _, err := VerifyAttestation(attestation, VerifyOpts{ - Nonce: nonce, - TEEOpts: teeopts, - }); err == nil { - t.Error("using no trusted AKs should make verification fail") - } - - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Fatal(err) - } - if _, err := VerifyAttestation(attestation, VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{priv.Public()}, - TEEOpts: teeopts, - }); err == nil { - t.Error("using a random trusted AKs should make verification fail") - } -} - -func TestVerifyWithTrustedAK(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - nonce := []byte("super secret nonce") - attestation, err := ak.Attest(client.AttestOpts{Nonce: nonce}) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - opts := VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - } - _, err = VerifyAttestation(attestation, opts) - if err != nil { - t.Errorf("failed to verify: %v", err) - } -} - -func TestVerifySHA1Attestation(t *testing.T) { - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - nonce := []byte("super secret nonce") - attestation, err := ak.Attest(client.AttestOpts{Nonce: nonce}) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - // We should get a SHA-256 state, even if we allow SHA-1 - opts := VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - AllowSHA1: true, - } - state, err := VerifyAttestation(attestation, opts) - if err != nil { - t.Errorf("failed to verify: %v", err) - } - h := tpm2.Algorithm(state.GetHash()) - if h != tpm2.AlgSHA256 { - t.Errorf("expected SHA-256 state, got: %v", h) - } - - // Now we mess up the SHA-256 state to force SHA-1 fallback - for _, quote := range attestation.GetQuotes() { - if tpm2.Algorithm(quote.GetPcrs().GetHash()) == tpm2.AlgSHA256 { - quote.Quote = nil - } - } - state, err = VerifyAttestation(attestation, opts) - if err != nil { - t.Errorf("failed to verify: %v", err) - } - h = tpm2.Algorithm(state.GetHash()) - if h != tpm2.AlgSHA1 { - t.Errorf("expected SHA-1 state, got: %v", h) - } - - // SHA-1 fallback can then be disabled - opts.AllowSHA1 = false - if _, err = VerifyAttestation(attestation, opts); err == nil { - t.Error("expected attestation to fail with only SHA-1") - } -} - -func TestVerifyAttestationWithCEL(t *testing.T) { - test.SkipForRealTPM(t) - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - coscel := &cel.CEL{} - testEvents := []struct { - cosNestedEventType cel.CosType - pcr int - eventPayload []byte - }{ - {cel.ImageRefType, cel.CosEventPCR, []byte("docker.io/bazel/experimental/test:latest")}, - {cel.ImageDigestType, cel.CosEventPCR, []byte("sha256:781d8dfdd92118436bd914442c8339e653b83f6bf3c1a7a98efcfb7c4fed7483")}, - {cel.RestartPolicyType, cel.CosEventPCR, []byte(attestpb.RestartPolicy_Never.String())}, - {cel.ImageIDType, cel.CosEventPCR, []byte("sha256:5DF4A1AC347DCF8CF5E9D0ABC04B04DB847D1B88D3B1CC1006F0ACB68E5A1F4B")}, - {cel.EnvVarType, cel.CosEventPCR, []byte("foo=bar")}, - {cel.EnvVarType, cel.CosEventPCR, []byte("bar=baz")}, - {cel.EnvVarType, cel.CosEventPCR, []byte("baz=foo=bar")}, - {cel.EnvVarType, cel.CosEventPCR, []byte("empty=")}, - {cel.ArgType, cel.CosEventPCR, []byte("--x")}, - {cel.ArgType, cel.CosEventPCR, []byte("--y")}, - {cel.OverrideArgType, cel.CosEventPCR, []byte("--x")}, - {cel.OverrideEnvType, cel.CosEventPCR, []byte("empty=")}, - } - for _, testEvent := range testEvents { - cos := cel.CosTlv{EventType: testEvent.cosNestedEventType, EventContent: testEvent.eventPayload} - if err := coscel.AppendEvent(rwc, testEvent.pcr, measuredHashes, cos); err != nil { - t.Fatal(err) - } - } - - var buf bytes.Buffer - if err := coscel.EncodeCEL(&buf); err != nil { - t.Fatal(err) - } - - nonce := []byte("super secret nonce") - attestation, err := ak.Attest(client.AttestOpts{Nonce: nonce, CanonicalEventLog: buf.Bytes()}) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - opts := VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - } - state, err := VerifyAttestation(attestation, opts) - if err != nil { - t.Fatalf("failed to verify: %v", err) - } - - expectedEnvVars := make(map[string]string) - expectedEnvVars["foo"] = "bar" - expectedEnvVars["bar"] = "baz" - expectedEnvVars["baz"] = "foo=bar" - expectedEnvVars["empty"] = "" - - expectedOverriddenEnvVars := make(map[string]string) - expectedOverriddenEnvVars["empty"] = "" - - want := attestpb.ContainerState{ - ImageReference: string(testEvents[0].eventPayload), - ImageDigest: string(testEvents[1].eventPayload), - RestartPolicy: attestpb.RestartPolicy_Never, - ImageId: string(testEvents[3].eventPayload), - EnvVars: expectedEnvVars, - Args: []string{string(testEvents[8].eventPayload), string(testEvents[9].eventPayload)}, - OverriddenEnvVars: expectedOverriddenEnvVars, - OverriddenArgs: []string{string(testEvents[10].eventPayload)}, - } - if diff := cmp.Diff(state.Cos.Container, &want, protocmp.Transform()); diff != "" { - t.Errorf("unexpected difference:\n%v", diff) - } -} - -func TestVerifyFailWithTamperedCELContent(t *testing.T) { - test.SkipForRealTPM(t) - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - c := &cel.CEL{} - - cosEvent := cel.CosTlv{EventType: cel.ImageRefType, EventContent: []byte("docker.io/bazel/experimental/test:latest")} - cosEvent2 := cel.CosTlv{EventType: cel.ImageDigestType, EventContent: []byte("sha256:781d8dfdd92118436bd914442c8339e653b83f6bf3c1a7a98efcfb7c4fed7483")} - if err := c.AppendEvent(rwc, cel.CosEventPCR, measuredHashes, cosEvent); err != nil { - t.Fatalf("failed to append event: %v", err) - } - if err := c.AppendEvent(rwc, cel.CosEventPCR, measuredHashes, cosEvent2); err != nil { - t.Fatalf("failed to append event: %v", err) - } - - // modify the first record content, but not the record digest - modifiedRecord := cel.CosTlv{EventType: cel.ImageDigestType, EventContent: []byte("sha256:000000000000000000000000000000000000000000000000000000000000000")} - modifiedTLV, err := modifiedRecord.GetTLV() - if err != nil { - t.Fatal(err) - } - c.Records[0].Content = modifiedTLV - - var buf bytes.Buffer - if err := c.EncodeCEL(&buf); err != nil { - t.Fatal(err) - } - - nonce := []byte("super secret nonce") - attestation, err := ak.Attest(client.AttestOpts{Nonce: nonce, CanonicalEventLog: buf.Bytes()}) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - opts := VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - } - if _, err := VerifyAttestation(attestation, opts); err == nil { - t.Fatalf("VerifyAttestation should fail due to modified content") - } else if !strings.Contains(err.Error(), "CEL record content digest verification failed") { - t.Fatalf("expect to get digest verification failed error, but got %v", err) - } -} - -func TestVerifyAttestationWithCerts(t *testing.T) { - tests := []struct { - name string - attestation []byte - nonce []byte - }{ - { - "no-nonce", - test.COS85NoNonce, - nil, - }, - { - "nonce-9009", - test.COS85Nonce9009, - []byte{0x90, 0x09}, - }, - } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - attestBytes := test.attestation - att := &attestpb.Attestation{} - if err := proto.Unmarshal(attestBytes, att); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - - if _, err := VerifyAttestation(att, VerifyOpts{ - Nonce: test.nonce, - TrustedRootCerts: GceEKRoots, - IntermediateCerts: GceEKIntermediates, - }); err != nil { - t.Errorf("failed to VerifyAttestation with AKCert: %v", err) - } - }) - } -} - -func TestVerifyAutomaticallyUsesIntermediatesInAttestation(t *testing.T) { - attestBytes := test.COS85Nonce9009 - att := &attestpb.Attestation{} - if err := proto.Unmarshal(attestBytes, att); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - att.IntermediateCerts = [][]byte{gceEKIntermediateCA2} - - if _, err := VerifyAttestation(att, VerifyOpts{ - Nonce: []byte{0x90, 0x09}, - TrustedRootCerts: GceEKRoots, - }); err != nil { - t.Errorf("failed to VerifyAttestation with intermediates provided in attestation: %v", err) - } -} - -func TestVerifySucceedsWithOverlappingIntermediatesInOptionsAndAttestation(t *testing.T) { - attestBytes := test.COS85Nonce9009 - att := &attestpb.Attestation{} - if err := proto.Unmarshal(attestBytes, att); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - att.IntermediateCerts = [][]byte{gceEKIntermediateCA2} - - if _, err := VerifyAttestation(att, VerifyOpts{ - Nonce: []byte{0x90, 0x09}, - TrustedRootCerts: GceEKRoots, - IntermediateCerts: GceEKIntermediates, - }); err != nil { - t.Errorf("failed to VerifyAttestation with overlapping intermediates provided in attestation and options: %v", err) - } -} - -func TestVerifyFailWithCertsAndPubkey(t *testing.T) { - att := &attestpb.Attestation{} - if err := proto.Unmarshal(test.COS85NoNonce, att); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Fatal(err) - } - opts := VerifyOpts{ - Nonce: nil, - TrustedRootCerts: GceEKRoots, - IntermediateCerts: GceEKIntermediates, - TrustedAKs: []crypto.PublicKey{priv.Public()}, - } - if _, err := VerifyAttestation(att, opts); err == nil { - t.Error("Verified attestation even with multiple trust methods") - } -} - -func TestVerifyAttestationEmptyRootsIntermediates(t *testing.T) { - attestBytes := test.COS85NoNonce - att := &attestpb.Attestation{} - if err := proto.Unmarshal(attestBytes, att); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - - if _, err := VerifyAttestation(att, VerifyOpts{ - TrustedRootCerts: nil, - IntermediateCerts: nil, - }); err == nil { - t.Error("expected error when calling VerifyAttestation with empty roots and intermediates") - } - - if _, err := VerifyAttestation(att, VerifyOpts{}); err == nil { - t.Error("expected error when calling VerifyAttestation with empty VerifyOpts") - } -} - -func TestVerifyAttestationMissingRoots(t *testing.T) { - attestBytes := test.COS85NoNonce - att := &attestpb.Attestation{} - if err := proto.Unmarshal(attestBytes, att); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - - if _, err := VerifyAttestation(att, VerifyOpts{ - IntermediateCerts: GceEKIntermediates, - }); err == nil { - t.Error("expected error when calling VerifyAttestation with missing roots") - } -} - -func TestVerifyAttestationMissingIntermediates(t *testing.T) { - attestBytes := test.COS85NoNonce - att := &attestpb.Attestation{} - if err := proto.Unmarshal(attestBytes, att); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - - if _, err := VerifyAttestation(att, VerifyOpts{ - TrustedRootCerts: GceEKRoots, - }); err == nil { - t.Error("expected error when calling VerifyAttestation with missing intermediates") - } -} - -func TestVerifyIgnoreAKPubWithAKCert(t *testing.T) { - // Make sure that we ignore the AKPub if the AKCert is presented - rwc := test.GetTPM(t) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - nonce := []byte{0x90, 0x09} - badAtt, err := ak.Attest(client.AttestOpts{Nonce: nonce}) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - // Copy "good" certificate into "bad" attestation - goodAtt := &attestpb.Attestation{} - if err := proto.Unmarshal(test.COS85Nonce9009, goodAtt); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - badAtt.AkCert = goodAtt.GetAkCert() - - opts := VerifyOpts{ - Nonce: nonce, - TrustedRootCerts: GceEKRoots, - IntermediateCerts: GceEKIntermediates, - } - if _, err := VerifyAttestation(badAtt, opts); err == nil { - t.Error("expected error when calling VerifyAttestation, because the cert is replaced") - } -} - -func TestVerifyFailsWithMalformedIntermediatesInAttestation(t *testing.T) { - attestBytes := test.COS85Nonce9009 - att := &attestpb.Attestation{} - if err := proto.Unmarshal(attestBytes, att); err != nil { - t.Fatalf("failed to unmarshal attestation: %v", err) - } - att.IntermediateCerts = [][]byte{[]byte("Not an intermediate cert.")} - - if _, err := VerifyAttestation(att, VerifyOpts{ - Nonce: []byte{0x90, 0x09}, - TrustedRootCerts: GceEKRoots, - }); err == nil { - t.Error("expected error when calling VerifyAttestation with malformed intermediate") - } -} - -func TestGetInstanceInfo(t *testing.T) { - expectedInstanceInfo := &attestpb.GCEInstanceInfo{ - Zone: "expected zone", - ProjectId: "expected project id", - ProjectNumber: 0, - InstanceName: "expected instance name", - InstanceId: 1, - } - - extStruct := gceInstanceInfo{ - Zone: expectedInstanceInfo.Zone, - ProjectID: expectedInstanceInfo.ProjectId, - ProjectNumber: int64(expectedInstanceInfo.ProjectNumber), - InstanceName: expectedInstanceInfo.InstanceName, - InstanceID: int64(expectedInstanceInfo.InstanceId), - SecurityProperties: gceSecurityProperties{ - SecurityVersion: 0, - IsProduction: true, - }, - } - - marshaledExt, err := asn1.Marshal(extStruct) - if err != nil { - t.Fatalf("Error marshaling test extension: %v", err) - } - - ext := []pkix.Extension{{ - Id: cloudComputeInstanceIdentifierOID, - Value: marshaledExt, - }} - - instanceInfo, err := getInstanceInfoFromExtensions(ext) - if err != nil { - t.Fatalf("getInstanceInfo returned with error: %v", err) - } - if instanceInfo == nil { - t.Fatal("getInstanceInfo returned nil instance info.") - } - - if !proto.Equal(instanceInfo, expectedInstanceInfo) { - t.Errorf("getInstanceInfo did not return expected instance info: got %v, want %v", instanceInfo, expectedInstanceInfo) - } -} - -func TestGetInstanceInfoReturnsNil(t *testing.T) { - extStruct := gceInstanceInfo{ - Zone: "zone", - ProjectID: "project id", - ProjectNumber: 0, - InstanceName: "instance name", - InstanceID: 1, - SecurityProperties: gceSecurityProperties{IsProduction: false}, - } - - marshaledExt, err := asn1.Marshal(extStruct) - if err != nil { - t.Fatalf("Error marshaling test extension: %v", err) - } - - testcases := []struct { - name string - ext []pkix.Extension - }{ - { - name: "No extension with expected OID", - ext: []pkix.Extension{{ - Id: asn1.ObjectIdentifier([]int{1, 2, 3, 4}), - Value: []byte("fake extension"), - }}, - }, - { - name: "IsProduction is false", - ext: []pkix.Extension{{ - Id: cloudComputeInstanceIdentifierOID, - Value: marshaledExt, - }}, - }, - } - - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - instanceInfo, err := getInstanceInfoFromExtensions(tc.ext) - if err != nil { - t.Fatalf("getInstanceInfo returned with error: %v", err) - } - - if instanceInfo != nil { - t.Error("getInstanceInfo returned instance information, expected nil") - } - }) - } -} - -func TestGetInstanceInfoError(t *testing.T) { - testcases := []struct { - name string - instanceInfo *gceInstanceInfo - }{ - { - name: "Extension value is not valid ASN1", - instanceInfo: nil, - }, - { - name: "Negative ProjectNumber", - instanceInfo: &gceInstanceInfo{ - Zone: "zone", - ProjectID: "project id", - ProjectNumber: -1, - InstanceName: "instance name", - InstanceID: 1, - SecurityProperties: gceSecurityProperties{IsProduction: false}, - }, - }, - { - name: "Negative InstanceID", - instanceInfo: &gceInstanceInfo{ - Zone: "zone", - ProjectID: "project id", - ProjectNumber: 0, - InstanceName: "instance name", - InstanceID: -1, - SecurityProperties: gceSecurityProperties{IsProduction: false}, - }, - }, - { - name: "Negative SecurityVersion", - instanceInfo: &gceInstanceInfo{ - Zone: "zone", - ProjectID: "project id", - ProjectNumber: 0, - InstanceName: "instance name", - InstanceID: 1, - SecurityProperties: gceSecurityProperties{ - SecurityVersion: -1, - IsProduction: false, - }, - }, - }, - } - - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - var extensionVal []byte - var err error - if tc.instanceInfo != nil { - extensionVal, err = asn1.Marshal(*tc.instanceInfo) - if err != nil { - t.Fatalf("Error marshaling test extension: %v", err) - } - } else { - extensionVal = []byte("Not a valid ASN1 extension.") - } - - _, err = getInstanceInfoFromExtensions([]pkix.Extension{{ - Id: cloudComputeInstanceIdentifierOID, - Value: extensionVal, - }}) - - if err == nil { - t.Error("getInstanceInfo returned successfully, expected error") - } - }) - } - - ext := []pkix.Extension{{ - Id: cloudComputeInstanceIdentifierOID, - Value: []byte("not valid ASN1"), - }} - - _, err := getInstanceInfoFromExtensions(ext) - if err == nil { - t.Error("getInstanceInfo returned successfully, expected error") - } -} - -func TestGetInstanceInfoASN(t *testing.T) { - expectedInstanceInfo := &attestpb.GCEInstanceInfo{ - Zone: "us-west1-b", - ProjectId: "jiankun-vm-test", - ProjectNumber: 620438545889, - InstanceName: "jkltest42102", - InstanceId: 3560342035431930290, - } - - // The payload is extract from a real AK cert, the ASN1 encoding requires gceSecurityProperties - // to have explicit ASN tag. - extPayload := []byte{48, 95, 12, 10, 117, 115, 45, 119, 101, 115, 116, 49, 45, 98, 2, 6, 0, 144, 117, 4, 229, 225, 12, 15, 106, 105, 97, 110, 107, 117, 110, 45, 118, 109, 45, 116, 101, 115, 116, 2, 8, 49, 104, 224, 55, 188, 207, 185, 178, 12, 12, 106, 107, 108, 116, 101, 115, 116, 52, 50, 49, 48, 50, 160, 32, 48, 30, 160, 3, 2, 1, 0, 161, 3, 1, 1, 255, 162, 3, 1, 1, 0, 163, 3, 1, 1, 0, 164, 3, 1, 1, 0, 165, 3, 1, 1, 0} - - ext := []pkix.Extension{{ - Id: cloudComputeInstanceIdentifierOID, - Value: extPayload, - }} - - instanceInfo, err := getInstanceInfoFromExtensions(ext) - if err != nil { - t.Fatalf("getInstanceInfo returned with error: %v", err) - } - if instanceInfo == nil { - t.Fatal("getInstanceInfo returned nil instance info.") - } - - if !proto.Equal(instanceInfo, expectedInstanceInfo) { - t.Errorf("getInstanceInfo did not return expected instance info: got %v, want %v", instanceInfo, expectedInstanceInfo) - } -} - -func TestVerifyAttestationWithSevSnp(t *testing.T) { - - snpEventLog := createTpm2EventLog(4) - rwc := test.GetSimulatorWithLog(t, snpEventLog) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - nonce := []byte("super secret nonce") - altNonce := []byte("alternate secret nonce") - var nonce64 [64]byte - copy(nonce64[:], altNonce) - sevTestDevice, goodSnpRoot, badSnpRoot, kdsGetter := testclient.GetSevGuest([]sgtest.TestCase{ - { - Input: nonce64, - Output: sgtest.TestRawReport(nonce64), - }, - }, &sgtest.DeviceOptions{Now: time.Now()}, t) - defer sevTestDevice.Close() - attestation, err := ak.Attest(client.AttestOpts{ - Nonce: nonce, - TEEDevice: &client.SevSnpDevice{Device: sevTestDevice}, - TEENonce: nonce64[:], - }) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - type testCase struct { - name string - opts VerifyOpts - wantErr string - } - tcs := []testCase{ - { - name: "Happy path", - opts: VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - TEEOpts: &VerifySnpOpts{ - Validation: SevSnpDefaultValidateOptsForTest(altNonce), - Verification: &sv.Options{ - Getter: kdsGetter, - TrustedRoots: goodSnpRoot, - }, - }, - }, - }, - { - name: "Wrong TEE nonce", - opts: VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - TEEOpts: &VerifySnpOpts{ - Validation: SevSnpDefaultValidateOptsForTest([]byte("soooo baaad")), - Verification: &sv.Options{ - Getter: kdsGetter, - TrustedRoots: goodSnpRoot, - }, - }, - }, - wantErr: "report field REPORT_DATA", - }, - { - name: "Bad sev root", - opts: VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - TEEOpts: &VerifySnpOpts{ - Validation: SevSnpDefaultValidateOptsForTest(altNonce), - Verification: &sv.Options{ - Getter: kdsGetter, - TrustedRoots: badSnpRoot, - }, - }, - }, - wantErr: "error verifying VCEK certificate", - }, - } - // Production SEV VMs are not run with debug enabled, so this test must be skipped when the - // sev-guest device is passed in, indicating the test is running in a real SEV-SNP VM. - if sgclient.UseDefaultSevGuest() { - tcs = append(tcs, testCase{ - name: "woops all debug", - opts: VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - TEEOpts: &VerifySnpOpts{ - // The Debug bit is not set. If run in a production environment, - // this test will still pass validation and thus not fail - // in the expected way. - Validation: SevSnpDefaultValidateOpts(altNonce), - Verification: &sv.Options{ - Getter: kdsGetter, - TrustedRoots: goodSnpRoot, - }, - }, - }, - wantErr: "found unauthorized debug capability", - }) - } - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - if _, err := VerifyAttestation(attestation, tc.opts); (err == nil && tc.wantErr != "") || - (err != nil && !strings.Contains(err.Error(), tc.wantErr)) { - t.Errorf("VerifyAttestation(_, %v) = %v, want %q", tc.opts, err, tc.wantErr) - } - }) - } -} - -func TestVerifyAttestationWithTdx(t *testing.T) { - - tdxEventLog := createTpm2EventLog(3) - rwc := test.GetSimulatorWithLog(t, tdxEventLog) - defer client.CheckedClose(t, rwc) - - ak, err := client.AttestationKeyRSA(rwc) - if err != nil { - t.Fatalf("failed to generate AK: %v", err) - } - defer ak.Close() - - nonce := []byte("super secret nonce") - altNonce := []byte("alternate secret nonce") - var nonce64 [64]byte - copy(nonce64[:], altNonce) - tdxTestDevice := tgtestclient.GetTdxGuest([]tgtest.TestCase{ - { - Input: nonce64, - Quote: tgtestdata.RawQuote, - }, - }, t) - defer tdxTestDevice.Close() - attestation, err := ak.Attest(client.AttestOpts{ - Nonce: nonce, - TEEDevice: &client.TdxDevice{Device: tdxTestDevice}, - TEENonce: nonce64[:], - }) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - alterQuote1 := make([]byte, len(tgtestdata.RawQuote)) - copy(alterQuote1[:], tgtestdata.RawQuote) - alterQuote1[0x1E] = 0x32 - tdxTestDevice1 := tgtestclient.GetTdxGuest([]tgtest.TestCase{ - { - Input: nonce64, - Quote: alterQuote1, - }, - }, t) - defer tdxTestDevice1.Close() - attestation1, err := ak.Attest(client.AttestOpts{ - Nonce: nonce, - TEEDevice: &client.TdxDevice{Device: tdxTestDevice1}, - TEENonce: nonce64[:], - }) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - - alterQuote2 := make([]byte, len(tgtestdata.RawQuote)) - copy(alterQuote2[:], tgtestdata.RawQuote) - alterQuote1[0x1024] = 0x32 - tdxTestDevice2 := tgtestclient.GetTdxGuest([]tgtest.TestCase{ - { - Input: nonce64, - Quote: alterQuote1, - }, - }, t) - defer tdxTestDevice1.Close() - attestation2, err := ak.Attest(client.AttestOpts{ - Nonce: nonce, - TEEDevice: &client.TdxDevice{Device: tdxTestDevice2}, - TEENonce: nonce64[:], - }) - if err != nil { - t.Fatalf("failed to attest: %v", err) - } - type testCase struct { - name string - opts VerifyOpts - wantErr string - attest *attestpb.Attestation - } - tcs := []testCase{ - { - name: "Happy path", - opts: VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - TEEOpts: &VerifyTdxOpts{ - Verification: tv.DefaultOptions(), - }, - }, - attest: attestation, - }, - { - name: "Wrong TDX attestation quote", - opts: VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - TEEOpts: &VerifyTdxOpts{ - Verification: tv.DefaultOptions(), - }, - }, - attest: attestation1, - wantErr: "failed to verify memory encryption technology: unable to verify message digest using quote's signature and ecdsa attestation key", - }, - { - name: "Bad Roots Certificate", - opts: VerifyOpts{ - Nonce: nonce, - TrustedAKs: []crypto.PublicKey{ak.PublicKey()}, - TEEOpts: &VerifyTdxOpts{ - Verification: &tv.Options{ - Getter: trust.DefaultHTTPSGetter(), - Now: time.Now(), - TrustedRoots: nil, - }, - }, - }, - attest: attestation2, - wantErr: "failed to verify memory encryption technology: could not interpret Root CA certificate DER bytes: x509: invalid RDNSequence: invalid attribute value", - }, - } - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - if _, err := VerifyAttestation(tc.attest, tc.opts); (err == nil && tc.wantErr != "") || - (err != nil && !strings.Contains(err.Error(), tc.wantErr)) { - t.Errorf("VerifyAttestation(_, %v) = %v, want %q", tc.opts, err, tc.wantErr) - } - }) - } -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/CONTRIBUTING.md b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/CONTRIBUTING.md deleted file mode 100644 index e7ae53660..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/CONTRIBUTING.md +++ /dev/null @@ -1,42 +0,0 @@ -# Guidelines for reporting bugs: -Non-security-critical bugs can be filed on the Issues tracker: - -https://github.com/Microsoft/ms-tpm-20-ref/issues - -Security sensitive bugs should be reported to secure@microsoft.com - -# Guideline for submitting changes: - -This repository tracks official TPM Library Specification releases and errata from -the Trusted Computing Group: - -https://trustedcomputinggroup.org/tpm-library-specification/ - -All changes to core TPM logic, particularly changes to files in -TPMCmd/tpm and its subdirectories, must be approved by TCG voting -members.  Github pull requests may be used to propose changes, but changes -will not be incorporated without TCG member approval. - -Other changes (e.g. new files or changes to TPMCmd/Platform or TPMCmd/Simulator), -particularly to support new platforms, scenarios, build environments or -crypto-libraries, will be considered if they are expected to be widely useful. - -Contributors that wish to be involved in -the future evolution of the TPM specification and reference implementation -should consider joining the Trusted Computing Group.  Information about -membership and liaison programs is available at https://trustedcomputinggroup.org/membership/ - -# Contributing - -This project welcomes contributions and suggestions. Most contributions require you to -agree to a Contributor License Agreement (CLA) declaring that you have the right to, -and actually do, grant us the rights to use your contribution. For details, visit -https://cla.microsoft.com. - -When you submit a pull request, a CLA-bot will automatically determine whether you need -to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the -instructions provided by the bot. You will only need to do this once across all repositories using our CLA. - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) -or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/LICENSE b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/LICENSE deleted file mode 100644 index 3dea085cf..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -Microsoft Reference Implementation for TPM 2.0 - -The copyright in this software is being made available under the BSD License, included below. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license. - -Copyright (c) Microsoft Corporation - -All rights reserved. - -BSD License - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/README.md b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/README.md deleted file mode 100644 index bacd4bd88..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# MS TPM 2.0 Reference Implementation # - -[![Build Status](https://travis-ci.org/Microsoft/ms-tpm-20-ref.svg?branch=master)](https://travis-ci.org/Microsoft/ms-tpm-20-ref) - -This is the official TCG reference implementation of the [TPM 2.0 Specification](https://trustedcomputinggroup.org/tpm-library-specification). The project contains complete source code of the reference implementation with a Microsoft Visual Studio solution and Linux autotools build scripts. - -See the definition of the `SPEC_VERSION`, `SPEC_YEAR` and `SPEC_DAY_OF_YEAR` values in the [TpmTypes.h](TPMCmd/tpm/include/TpmTypes.h) header for the exact revision/date of the TPM 2.0 specification, which the given source tree snapshot corresponds to. - -## Visual Studio build ## - -Before building the Visual Studio solution: - -1. Uncomment and update the definitions of the following macros in the [VendorString.h](TPMCmd/tpm/include/VendorString.h) header: - - MANUFACTURER - - VENDOR_STRING_1 - - FIRMWARE_V1 and FIRMWARE_V2 - -2. Setup the underlying cryptographic library: - -### OpenSSL library ### - -1. Create `TPMCmd/lib` folder and place a static OpenSSL library (`libeay32.lib` or `libcrypto.lib`) there. This may be either complete static library, or import library accompanying the corresponding DLL. In the latter case you'll need to copy the OpenSSL DLL into the standard Windows search path, so that it is available when you run the simulator executable (e.g. copy it into the same folder where simulator.exe is located). - - If you use `libcrypto.lib`, you'll need to either update `Linker|Input|Additional Dependencies` property of the Tpm project in the simulator solution or, alternatively, rename `libcrypto.lib` to `libeay32.lib`. - - Recommended version of OpenSSL is 1.0.2d or higher. - -2. Create `TPMCmd/OsslInclude/openssl` folder and copy there the contents of the `openssl/include/openssl` folder of the OpenSSL source tree used to build the static library used on the step 2). - -3. Build the solution with either Debug or Release as the active configuration. - -### Wolfcrypt library (wolfSSL) ### - -1. WolfSSL is included as a submodule. Initialize and update the submodule to fetch the project and checkout the appropriate commit. - - > git submodule init - > git submodule update - - The current commit will point the minimum recommended version of wolfSSL. Moving to a more recent tag or commit should also be supported but might not be tested. - -2. Build the solution with either WolfDebug or WolfRelease as the active configuration, either from inside the Visual Studio or with the following command line: - - > msbuild TPMCmd\simulator.sln /p:Configuration=WolfDebug - -## Linux build - -Follows the common `./bootstrap && ./configure && make` convention. - -Note that autotools scripts require the following prerequisite packages: `autoconf-archive`, `pkg-config`. Their absence is not automatically detected. The build also requires `libssl-dev` package to be installed. diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Clock.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Clock.c deleted file mode 100644 index bb8e4bba0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Clock.c +++ /dev/null @@ -1,174 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD - * License, included below. This software may be subject to other third party - * and contributor rights, including patent rights, and no such rights are - * granted under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS - * IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// -// This file contains the routines that are used by the simulator to mimic -// a hardware clock on a TPM. -// -// In this implementation, all the time values are measured in millisecond. -// However, the precision of the clock functions may be implementation -// dependent. - -#ifdef _WIN32 -#include -#include -#else -#include -#endif - -#include "PlatformData.h" -#include "Platform_fp.h" - -unsigned int s_adjustRate; -bool s_timerReset; - -clock64_t s_realTimePrevious; -clock64_t s_tpmTime; -clock64_t s_lastSystemTime; -clock64_t s_lastReportedTime; - -void _plat__TimerReset() { - s_lastSystemTime = 0; - s_tpmTime = 0; - s_adjustRate = CLOCK_NOMINAL; - s_timerReset = true; - return; -} - -static clock64_t _plat__RealTime() { -#ifdef _WIN32 // On Windows we might be using msvcrt, which only has _ftime. - struct _timeb sysTime; - _ftime_s(&sysTime); - return (clock64_t)(sysTime.time) * 1000 + sysTime.millitm; -#else - struct timespec systime; - clock_gettime(CLOCK_MONOTONIC, &systime); - return (clock64_t)systime.tv_sec * 1000 + (systime.tv_nsec / 1000000); -#endif -} - -uint64_t _plat__TimerRead() { - clock64_t timeDiff; - clock64_t adjustedTimeDiff; - clock64_t timeNow; - clock64_t readjustedTimeDiff; - - // This produces a timeNow that is basically locked to the system clock. - timeNow = _plat__RealTime(); - - // if this hasn't been initialized, initialize it - if (s_lastSystemTime == 0) { - s_lastSystemTime = timeNow; - s_lastReportedTime = 0; - s_realTimePrevious = 0; - } - // The system time can bounce around and that's OK as long as we don't allow - // time to go backwards. When the time does appear to go backwards, set - // lastSystemTime to be the new value and then update the reported time. - if (timeNow < s_lastReportedTime) s_lastSystemTime = timeNow; - s_lastReportedTime = s_lastReportedTime + timeNow - s_lastSystemTime; - s_lastSystemTime = timeNow; - timeNow = s_lastReportedTime; - - // The code above produces a timeNow that is similar to the value returned - // by Clock(). The difference is that timeNow does not max out, and it is - // at a ms. rate rather than at a CLOCKS_PER_SEC rate. The code below - // uses that value and does the rate adjustment on the time value. - // If there is no difference in time, then skip all the computations - if (s_realTimePrevious >= timeNow) return s_tpmTime; - // Compute the amount of time since the last update of the system clock - timeDiff = timeNow - s_realTimePrevious; - - // Do the time rate adjustment and conversion from CLOCKS_PER_SEC to mSec - adjustedTimeDiff = (timeDiff * CLOCK_NOMINAL) / ((uint64_t)s_adjustRate); - - // update the TPM time with the adjusted timeDiff - s_tpmTime += (clock64_t)adjustedTimeDiff; - - // Might have some rounding error that would loose CLOCKS. See what is not - // being used. As mentioned above, this could result in putting back more than - // is taken out. Here, we are trying to recreate timeDiff. - readjustedTimeDiff = - (adjustedTimeDiff * (uint64_t)s_adjustRate) / CLOCK_NOMINAL; - - // adjusted is now converted back to being the amount we should advance the - // previous sampled time. It should always be less than or equal to timeDiff. - // That is, we could not have use more time than we started with. - s_realTimePrevious = s_realTimePrevious + readjustedTimeDiff; - - return s_tpmTime; -} - -bool _plat__TimerWasReset() { - bool retVal = s_timerReset; - s_timerReset = false; - return retVal; -} - -void _plat__ClockAdjustRate(int adjust) { - // We expect the caller should only use a fixed set of constant values to - // adjust the rate - switch (adjust) { - case CLOCK_ADJUST_COARSE: - s_adjustRate += CLOCK_ADJUST_COARSE; - break; - case -CLOCK_ADJUST_COARSE: - s_adjustRate -= CLOCK_ADJUST_COARSE; - break; - case CLOCK_ADJUST_MEDIUM: - s_adjustRate += CLOCK_ADJUST_MEDIUM; - break; - case -CLOCK_ADJUST_MEDIUM: - s_adjustRate -= CLOCK_ADJUST_MEDIUM; - break; - case CLOCK_ADJUST_FINE: - s_adjustRate += CLOCK_ADJUST_FINE; - break; - case -CLOCK_ADJUST_FINE: - s_adjustRate -= CLOCK_ADJUST_FINE; - break; - default: - // ignore any other values; - break; - } - - if (s_adjustRate > (CLOCK_NOMINAL + CLOCK_ADJUST_LIMIT)) - s_adjustRate = CLOCK_NOMINAL + CLOCK_ADJUST_LIMIT; - if (s_adjustRate < (CLOCK_NOMINAL - CLOCK_ADJUST_LIMIT)) - s_adjustRate = CLOCK_NOMINAL - CLOCK_ADJUST_LIMIT; - - return; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Entropy.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Entropy.c deleted file mode 100644 index ecaba7950..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Entropy.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -#include "Platform_fp.h" - -// We get entropy from OpenSSL which gets its entropy from the OS. -int32_t _plat__GetEntropy(uint8_t *entropy, uint32_t amount) { - if (RAND_bytes(entropy, amount) != 1) { - return -1; - } - return amount; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/NVMem.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/NVMem.c deleted file mode 100644 index baac11b82..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/NVMem.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD - * License, included below. This software may be subject to other third party - * and contributor rights, including patent rights, and no such rights are - * granted under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS - * IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// -// This file contains the NV read and write access methods. This -// implementation uses RAM/file and does not manage the RAM/file as NV -// blocks. The implementation may become more sophisticated over time. -// - -#include -#include - -#include "PlatformData.h" -#include "Platform_fp.h" - -unsigned char s_NV[NV_MEMORY_SIZE]; - -void _plat__NvMemoryRead(unsigned int start, unsigned int size, void *data) { - assert(start + size <= NV_MEMORY_SIZE); - memcpy(data, &s_NV[start], size); - return; -} - -int _plat__NvIsDifferent(unsigned int start, unsigned int size, void *data) { - return (memcmp(&s_NV[start], data, size) != 0); -} - -bool _plat__NvMemoryWrite(unsigned int start, unsigned int size, void *data) { - if (start + size <= NV_MEMORY_SIZE) { - memcpy(&s_NV[start], data, size); - return true; - } - return false; -} - -void _plat__NvMemoryClear(unsigned int start, unsigned int size) { - assert(start + size <= NV_MEMORY_SIZE); - // In this implementation, assume that the erase value for NV is all 1s - memset(&s_NV[start], 0xff, size); -} - -void _plat__NvMemoryMove(unsigned int sourceOffset, unsigned int destOffset, - unsigned int size) { - assert(sourceOffset + size <= NV_MEMORY_SIZE); - assert(destOffset + size <= NV_MEMORY_SIZE); - memmove(&s_NV[destOffset], &s_NV[sourceOffset], size); - return; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Platform.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Platform.h deleted file mode 100644 index b71713a7a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Platform.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD - * License, included below. This software may be subject to other third party - * and contributor rights, including patent rights, and no such rights are - * granted under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS - * IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// External interface to the vTPM - -#ifndef _PLATFORM_H_ -#define _PLATFORM_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -//***_plat__RunCommand() -// This version of RunCommand will set up a jum_buf and call ExecuteCommand(). -// If the command executes without failing, it will return and RunCommand will -// return. If there is a failure in the command, then _plat__Fail() is called -// and it will longjump back to RunCommand which will call ExecuteCommand again. -// However, this time, the TPM will be in failure mode so ExecuteCommand will -// simply build a failure response and return. -void _plat__RunCommand(uint32_t requestSize, // IN: command buffer size - unsigned char *request, // IN: command buffer - uint32_t *responseSize, // IN/OUT: response buffer size - unsigned char **response // IN/OUT: response buffer -); - -//*** _plat_Reset() -// Reset the TPM. This should always be called before _plat__RunCommand. The -// first time this function is called, the TPM will be manufactured. Pass true -// for forceManufacture to perfrom a manufacturer reset. -void _plat__Reset(bool forceManufacture); - -#ifdef __cplusplus -} -#endif - -#endif // _PLATFORM_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/PlatformData.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/PlatformData.h deleted file mode 100644 index 4d9a276d5..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/PlatformData.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD - * License, included below. This software may be subject to other third party - * and contributor rights, including patent rights, and no such rights are - * granted under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS - * IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// This file contains the instance data for the Platform module. It is collected -// in this file so that the state of the module is easier to manage. - -#ifndef _PLATFORM_DATA_H_ -#define _PLATFORM_DATA_H_ - -#include -#include - -#include "TpmProfile.h" // For NV_MEMORY_SIZE - -typedef uint64_t clock64_t; -// This is the value returned the last time that the system clock was read. This -// is only relevant for a simulator or virtual TPM. -extern clock64_t s_realTimePrevious; - -// These values are used to try to synthesize a long lived version of clock(). -extern clock64_t s_lastSystemTime; -extern clock64_t s_lastReportedTime; - -// This is the rate adjusted value that is the equivalent of what would be read -// from a hardware register that produced rate adjusted time. -extern clock64_t s_tpmTime; - -// This value indicates that the timer was reset -extern bool s_timerReset; -// This variable records the timer adjustment factor. -extern unsigned int s_adjustRate; - -// CLOCK_NOMINAL is the number of hardware ticks per mS. A value of 300000 means -// that the nominal clock rate used to drive the hardware clock is 30 MHz. The -// adjustment rates are used to determine the conversion of the hardware ticks -// to internal hardware clock value. In practice, we would expect that there -// would be a hardware register with accumulated mS. It would be incremented by -// the output of a prescaler. The prescaler would divide the ticks from the -// clock by some value that would compensate for the difference between clock -// time and real time. The code in Clock does the emulation of this function. -#define CLOCK_NOMINAL 30000 -// A 1% change in rate is 300 counts -#define CLOCK_ADJUST_COARSE 300 -// A 0.1% change in rate is 30 counts -#define CLOCK_ADJUST_MEDIUM 30 -// A minimum change in rate is 1 count -#define CLOCK_ADJUST_FINE 1 -// The clock tolerance is +/-15% (4500 counts) -// Allow some guard band (16.7%) -#define CLOCK_ADJUST_LIMIT 5000 - -extern unsigned char s_NV[NV_MEMORY_SIZE]; - -#endif // _PLATFORM_DATA_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Platform_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Platform_fp.h deleted file mode 100644 index e8d63d242..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Platform_fp.h +++ /dev/null @@ -1,197 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD - * License, included below. This software may be subject to other third party - * and contributor rights, including patent rights, and no such rights are - * granted under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS - * IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// Platform functions used by libtpm - -#ifndef _PLATFORM_FP_H_ -#define _PLATFORM_FP_H_ - -#include -#include - -//***_plat__IsCanceled() -// We opt to not support cancellation, so always return false. -// Return values: -// true(1) if cancel flag is set -// false(0) if cancel flag is not set -static inline int _plat__IsCanceled() { return false; } - -//***_plat__TimerReset() -// This function sets current system clock time as t0 for counting TPM time. -// This function is called at a power on event to reset the clock. When the -// clock is reset, the indication that the clock was stopped is also set. -void _plat__TimerReset(); - -//***_plat__TimerRead() -// This function provides access to the tick timer of the platform. The TPM code -// uses this value to drive the TPM Clock. -// -// The tick timer is supposed to run when power is applied to the device. This -// timer should not be reset by time events including _TPM_Init. It should only -// be reset when TPM power is re-applied. -// -// If the TPM is run in a protected environment, that environment may provide -// the tick time to the TPM as long as the time provided by the environment is -// not allowed to go backwards. If the time provided by the system can go -// backwards during a power discontinuity, then the _plat__Signal_PowerOn should -// call _plat__TimerReset(). -uint64_t _plat__TimerRead(); - -//*** _plat__TimerWasReset() -// This function is used to interrogate the flag indicating if the tick timer -// has been reset. -// -// If the resetFlag parameter is SET, then the flag will be CLEAR before the -// function returns. -bool _plat__TimerWasReset(); - -//*** _plat__TimerWasStopped() -// As we have CLOCK_STOPS=NO, we will only stop our timer on resets. -static inline bool _plat__TimerWasStopped() { return _plat__TimerWasReset(); } - -//***_plat__ClockAdjustRate() -// Adjust the clock rate -// IN: the adjust number. It could be positive or negative -void _plat__ClockAdjustRate(int adjust); - -//*** _plat__GetEntropy() -// This function is used to get available hardware entropy. In a hardware -// implementation of this function, there would be no call to the system -// to get entropy. -// Return values: -// < 0 hardware failure of the entropy generator, this is sticky -// >= 0 the returned amount of entropy (bytes) -int32_t _plat__GetEntropy(uint8_t *entropy, // output buffer - uint32_t amount // amount requested -); - -//***_plat__LocalityGet() -// We do not support non-zero localities, so just always return 0. -static inline uint8_t _plat__LocalityGet() { return 0; } - -//***_plat__NVEnable() -// As we just hold the NV data in memory, always return success. -// Return values: -// 0 if success -// > 0 if receive recoverable error -// < 0 if unrecoverable error -static inline int _plat__NVEnable(void *platParameter) { - (void)(platParameter); - return 0; -}; - -//***_plat__IsNvAvailable() -// Our NV Data is always available and has no write limits. -// Return values: -// 0 NV is available -// 1 NV is not available due to write failure -// 2 NV is not available due to rate limit -static inline int _plat__IsNvAvailable() { return 0; } - -//***_plat__NvMemoryRead() -// Function: Read a chunk of NV memory -void _plat__NvMemoryRead(unsigned int startOffset, // IN: read start - unsigned int size, // IN: size of bytes to read - void *data // OUT: data buffer -); - -//*** _plat__NvIsDifferent() -// This function checks to see if the NV is different from the test value. This -// is so that NV will not be written if it has not changed. -// Return Type: int -// TRUE(1) the NV location is different from the test value -// FALSE(0) the NV location is the same as the test value -int _plat__NvIsDifferent(unsigned int startOffset, // IN: read start - unsigned int size, // IN: size of bytes to read - void *data // IN: data buffer -); - -//***_plat__NvMemoryWrite() -// This function is used to update NV memory. The "write" is to a memory copy of -// NV. At the end of the current command, any changes are written to -// the actual NV memory. -// NOTE: A useful optimization would be for this code to compare the current -// contents of NV with the local copy and note the blocks that have changed. -// Then only write those blocks when _plat__NvCommit() is called. -bool _plat__NvMemoryWrite(unsigned int startOffset, // IN: write start - unsigned int size, // IN: size of bytes to write - void *data // OUT: data buffer -); - -//***_plat__NvMemoryClear() -// Function is used to set a range of NV memory bytes to an implementation- -// dependent value. The value represents the erase state of the memory. -void _plat__NvMemoryClear(unsigned int start, // IN: clear start - unsigned int size // IN: number of bytes to clear -); - -//***_plat__NvMemoryMove() -// Function: Move a chunk of NV memory from source to destination -// This function should ensure that if there overlap, the original data is -// copied before it is written -void _plat__NvMemoryMove(unsigned int sourceOffset, // IN: source offset - unsigned int destOffset, // IN: destination offset - unsigned int size // IN: size of data being moved -); - -//***_plat__NvCommit() -// Our NV Data is just in memory, so "committing" it is a no-op. -// Return values: -// 0 NV write success -// != 0 NV write fail -static inline int _plat__NvCommit() { return 0; } - -//*** _plat__WasPowerLost() -// Test whether power was lost before a _TPM_Init. As we use in-memory NV Data, -// there's no reason to to not do the power-loss activities on every _TPM_Init. -// Return values: -// true(1) power was lost -// false(0) power was not lost -static inline int _plat__WasPowerLost() { return true; } - -//** From PPPlat.c - -//***_plat__PhysicalPresenceAsserted() -// Our vTPM has no way to assert physical presence, so we always return true. -// Return values: -// true(1) if physical presence is signaled -// false(0) if physical presence is not signaled -static inline int _plat__PhysicalPresenceAsserted() { return true; } - -//***_plat__Fail() -// This is the platform depended failure exit for the TPM. -_Noreturn void _plat__Fail(); - -#endif // _PLATFORM_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Run.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Run.c deleted file mode 100644 index 044dc043d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/Samples/Google/Run.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD - * License, included below. This software may be subject to other third party - * and contributor rights, including patent rights, and no such rights are - * granted under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS - * IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//**Introduction -// This module provides the platform specific entry and fail processing. The -// _plat__RunCommand() function is used to call to ExecuteCommand() in the TPM -// code. This function does whatever processing is necessary to set up the -// platform in anticipation of the call to the TPM including settup for error -// processing. -// -// The _plat__Fail() function is called when there is a failure in the TPM. The -// TPM code will have set the flag to indicate that the TPM is in failure mode. -// This call will then recursively call ExecuteCommand in order to build the -// failure mode response. When ExecuteCommand() returns to _plat__Fail(), the -// platform will do some platform specif operation to return to the environment -// in which the TPM is executing. For a simulator, setjmp/longjmp is used. For -// an OS, a system exit to the OS would be appropriate. - -#include - -#include "CompilerDependencies.h" -#include "ExecCommand_fp.h" -#include "Manufacture_fp.h" -#include "Platform.h" -#include "Platform_fp.h" -#include "_TPM_Init_fp.h" - -jmp_buf s_jumpBuffer; - -void _plat__RunCommand(uint32_t requestSize, unsigned char *request, - uint32_t *responseSize, unsigned char **response) { - setjmp(s_jumpBuffer); - ExecuteCommand(requestSize, request, responseSize, response); -} - -_Noreturn void _plat__Fail(void) { longjmp(&s_jumpBuffer[0], 1); } - -void _plat__Reset(bool forceManufacture) { - // We ignore errors, as we don't care if the TPM has been Manufactured before. - if (forceManufacture) { - TPM_TearDown(); - } - TPM_Manufacture(0); - _plat__TimerReset(); - _TPM_Init(); -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/Makefile.am b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/Makefile.am deleted file mode 100644 index 1df7a5e2c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -## The copyright in this software is being made available under the BSD License, -## included below. This software may be subject to other third party and -## contributor rights, including patent rights, and no such rights are granted -## under this license. -## -## Copyright (c) Intel Corporation -## -## All rights reserved. -## -## BSD License -## -## Redistribution and use in source and binary forms, with or without modification, -## are permitted provided that the following conditions are met: -## -## Redistributions of source code must retain the above copyright notice, this list -## of conditions and the following disclaimer. -## -## Redistributions in binary form must reproduce the above copyright notice, this -## list of conditions and the following disclaimer in the documentation and/or -## other materials provided with the distribution. -## -## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" -## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -## ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -## ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -include src.mk - -PLATFORM_INC = -I $(srcdir)/Platform/include \ - -I $(srcdir)/Platform/include/prototypes -SIMULATOR_INC = -I $(srcdir)/Simulator/include \ - -I $(srcdir)/Simulator/include/prototypes -TPM_INC = -I $(srcdir)/tpm/include \ - -I $(srcdir)/tpm/include/prototypes - -libplatform = Platform/src/libplatform.a -libtpm = tpm/src/libtpm.a -tpm2_simulator = Simulator/src/tpm2-simulator - -bin_PROGRAMS = $(tpm2_simulator) -noinst_LIBRARIES = $(libplatform) $(libtpm) - -Platform_src_libplatform_a_CFLAGS = $(EXTRA_CFLAGS) $(PLATFORM_INC) $(TPM_INC) -Platform_src_libplatform_a_SOURCES = $(PLATFORM_C) $(PLATFORM_H) - -Simulator_src_tpm2_simulator_CFLAGS = $(EXTRA_CFLAGS) $(PLATFORM_INC) \ - $(TPM_INC) $(SIMULATOR_INC) $(LIBCRYPTO_CFLAGS) $(PTHREAD_CFLAGS) -# the weird / duplicate static library is necessary for dealing with the -# circular dependency beetween libplatform and libtpm -Simulator_src_tpm2_simulator_LDADD = $(libplatform) $(libtpm) \ - $(libplatform) $(LIBCRYPTO_LIBS) $(PTHREAD_LIBS) @ADDITIONAL_LIBS@ -Simulator_src_tpm2_simulator_SOURCES = $(SIMULATOR_C) $(SIMULATOR_H) - -tpm_src_libtpm_a_CFLAGS = $(EXTRA_CFLAGS) $(PLATFORM_INC) $(TPM_INC) \ - $(LIBCRYPTO_CFLAGS) -tpm_src_libtpm_a_SOURCES = $(TPM_C) $(TPM_H) $(PLATFORM_H) diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/configure.ac b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/configure.ac deleted file mode 100644 index 58a74b416..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/configure.ac +++ /dev/null @@ -1,89 +0,0 @@ -dnl The copyright in this software is being made available under the BSD License, -dnl included below. This software may be subject to other third party and -dnl contributor rights, including patent rights, and no such rights are granted -dnl under this license. -dnl -dnl Copyright (c) Intel Corporation -dnl -dnl All rights reserved. -dnl -dnl BSD License -dnl -dnl Redistribution and use in source and binary forms, with or without modification, -dnl are permitted provided that the following conditions are met: -dnl -dnl Redistributions of source code must retain the above copyright notice, this list -dnl of conditions and the following disclaimer. -dnl -dnl Redistributions in binary form must reproduce the above copyright notice, this -dnl list of conditions and the following disclaimer in the documentation and/or -dnl other materials provided with the distribution. -dnl -dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" -dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -dnl DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -dnl ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -dnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -dnl ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -AC_INIT([ms-tpm-20-ref], - [0.1], - [https://github.com/microsoft/ms-tpm-20-ref/issues], - [], - [https://github.com/microsoft/ms-tpm-20-ref]) -AC_CONFIG_MACRO_DIR([.]) -AC_PROG_CC -AC_PROG_LN_S -AC_PROG_RANLIB -AM_INIT_AUTOMAKE([foreign subdir-objects]) -AC_CONFIG_FILES([Makefile]) -AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],[$ac_configure_args]) - -dnl By enabling this feature tpm simulator gets seeds derived from hardware parameters. -dnl It is enabled only for linux devices. -dnl Note that the seeds are not derived from secure hardware source. - -AC_ARG_ENABLE(usedeviceid, - AS_HELP_STRING([--enable-usedeviceid], - [tpm simulator get seeds derived from hardware parameters. Seeds are not derived from secure hardware source.])) - -PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto]) -AS_IF([test "x$enable_usedeviceid" = "xyes"], [ - PKG_CHECK_MODULES([LIBUDEV], [libudev]) - [ADDITIONAL_LIBS="-ludev"] -]) -AX_PTHREAD([], [AC_MSG_ERROR([requires pthread])]) - -AC_DEFINE([HASH_LIB], [Ossl], [Crypto lib for hash algorithms]) -AC_DEFINE([SYM_LIB], [Ossl], [Crypto lib for symmetric encryption algorithms]) -AC_DEFINE([MATH_LIB], [Ossl], [Crypto lib for bignum operations]) - -ADD_COMPILER_FLAG([-std=gnu11]) -ADD_COMPILER_FLAG([-Werror]) -ADD_COMPILER_FLAG([-Wall]) -ADD_COMPILER_FLAG([-Wformat-security]) -ADD_COMPILER_FLAG([-fstack-protector-all]) -ADD_COMPILER_FLAG([-fPIC]) -ADD_COMPILER_FLAG([-Wno-error=empty-body]) -ADD_COMPILER_FLAG([-Wno-error=expansion-to-defined]) -ADD_COMPILER_FLAG([-Wno-error=parentheses]) -ADD_COMPILER_FLAG([-Wno-error=pointer-to-int-cast]) -ADD_COMPILER_FLAG([-Wno-error=missing-braces]) -ADD_COMPILER_FLAG([-Wno-error=unused-result]) - -AS_IF([test "x$enable_usedeviceid" = "xyes"], [ - ADD_COMPILER_FLAG([-DNDEBUG]) - ADD_COMPILER_FLAG([-g]) - ADD_COMPILER_FLAG([-DUSE_PLATFORM_EPS]) - AC_SUBST(ADDITIONAL_LIBS) -]) -ADD_LINK_FLAG([-Wl,--no-undefined]) -ADD_LINK_FLAG([-Wl,-z,noexecstack]) -ADD_LINK_FLAG([-Wl,-z,now]) -ADD_LINK_FLAG([-Wl,-z,relro]) - -AC_OUTPUT diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/flags.m4 b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/flags.m4 deleted file mode 100644 index 286c10bfa..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/flags.m4 +++ /dev/null @@ -1,84 +0,0 @@ -dnl The copyright in this software is being made available under the BSD License, -dnl included below. This software may be subject to other third party and -dnl contributor rights, including patent rights, and no such rights are granted -dnl under this license. -dnl -dnl Copyright (c) Intel Corporation -dnl -dnl All rights reserved. -dnl -dnl BSD License -dnl -dnl Redistribution and use in source and binary forms, with or without modification, -dnl are permitted provided that the following conditions are met: -dnl -dnl Redistributions of source code must retain the above copyright notice, this list -dnl of conditions and the following disclaimer. -dnl -dnl Redistributions in binary form must reproduce the above copyright notice, this -dnl list of conditions and the following disclaimer in the documentation and/or -dnl other materials provided with the distribution. -dnl -dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" -dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -dnl DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -dnl ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -dnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -dnl ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -dnl ADD_COMPILER_FLAG: -dnl A macro to add a CFLAG to the EXTRA_CFLAGS variable. This macro will -dnl check to be sure the compiler supprts the flag. Flags can be made -dnl mandatory (configure will fail). -dnl $1: C compiler flag to add to EXTRA_CFLAGS. -dnl $2: Set to "required" to cause configure failure if flag not supported.. -AC_DEFUN([ADD_COMPILER_FLAG],[ - AX_CHECK_COMPILE_FLAG([$1],[ - EXTRA_CFLAGS="$EXTRA_CFLAGS $1" - AC_SUBST([EXTRA_CFLAGS])],[ - AS_IF([test x$2 != xrequired],[ - AC_MSG_WARN([Optional CFLAG "$1" not supported by your compiler, continuing.])],[ - AC_MSG_ERROR([Required CFLAG "$1" not supported by your compiler, aborting.])] - )],[ - -Wall -Werror] - )] -) -dnl ADD_PREPROC_FLAG: -dnl Add the provided preprocessor flag to the EXTRA_CFLAGS variable. This -dnl macro will check to be sure the preprocessor supports the flag. -dnl The flag can be made mandatory by provideing the string 'required' as -dnl the second parameter. -dnl $1: Preprocessor flag to add to EXTRA_CFLAGS. -dnl $2: Set to "required" t ocause configure failure if preprocesor flag -dnl is not supported. -AC_DEFUN([ADD_PREPROC_FLAG],[ - AX_CHECK_PREPROC_FLAG([$1],[ - EXTRA_CFLAGS="$EXTRA_CFLAGS $1" - AC_SUBST([EXTRA_CFLAGS])],[ - AS_IF([test x$2 != xrequired],[ - AC_MSG_WARN([Optional preprocessor flag "$1" not supported by your compiler, continuing.])],[ - AC_MSG_ERROR([Required preprocessor flag "$1" not supported by your compiler, aborting.])] - )],[ - -Wall -Werror] - )] -) -dnl ADD_LINK_FLAG: -dnl A macro to add a LDLAG to the EXTRA_LDFLAGS variable. This macro will -dnl check to be sure the linker supprts the flag. Flags can be made -dnl mandatory (configure will fail). -dnl $1: linker flag to add to EXTRA_LDFLAGS. -dnl $2: Set to "required" to cause configure failure if flag not supported. -AC_DEFUN([ADD_LINK_FLAG],[ - AX_CHECK_LINK_FLAG([$1],[ - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $1" - AC_SUBST([EXTRA_LDFLAGS])],[ - AS_IF([test x$2 != xrequired],[ - AC_MSG_WARN([Optional LDFLAG "$1" not supported by your linker, continuing.])],[ - AC_MSG_ERROR([Required LDFLAG "$1" not supported by your linker, aborting.])] - )] - )] -) diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BaseTypes.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BaseTypes.h deleted file mode 100644 index afcfef974..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BaseTypes.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.2 Feb 22, 2019 - * Date: Mar 20, 2019 Time: 08:27:26PM - */ - -#ifndef _BASE_TYPES_H_ -#define _BASE_TYPES_H_ - -// NULL definition -#ifndef NULL -#define NULL (0) -#endif - -typedef uint8_t UINT8; -typedef uint8_t BYTE; -typedef int8_t INT8; -typedef int BOOL; -typedef uint16_t UINT16; -typedef int16_t INT16; -typedef uint32_t UINT32; -typedef int32_t INT32; -typedef uint64_t UINT64; -typedef int64_t INT64; - - -#endif // _BASE_TYPES_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h deleted file mode 100644 index bb3fe3fa9..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/BnValues.h +++ /dev/null @@ -1,320 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction - -// This file contains the definitions needed for defining the internal BIGNUM -// structure. - -// A BIGNUM is a pointer to a structure. The structure has three fields. The -// last field is and array (d) of crypt_uword_t. Each word is in machine format -// (big- or little-endian) with the words in ascending significance (i.e. words -// in little-endian order). This is the order that seems to be used in every -// big number library in the worlds, so... -// -// The first field in the structure (allocated) is the number of words in 'd'. -// This is the upper limit on the size of the number that can be held in the -// structure. This differs from libraries like OpenSSL as this is not intended -// to deal with numbers of arbitrary size; just numbers that are needed to deal -// with the algorithms that are defined in the TPM implementation. -// -// The second field in the structure (size) is the number of significant words -// in 'n'. When this number is zero, the number is zero. The word at used-1 should -// never be zero. All words between d[size] and d[allocated-1] should be zero. - -//** Defines - -#ifndef _BN_NUMBERS_H -#define _BN_NUMBERS_H - -#if RADIX_BITS == 64 -# define RADIX_LOG2 6 -#elif RADIX_BITS == 32 -#define RADIX_LOG2 5 -#else -# error "Unsupported radix" -#endif - -#define RADIX_MOD(x) ((x) & ((1 << RADIX_LOG2) - 1)) -#define RADIX_DIV(x) ((x) >> RADIX_LOG2) -#define RADIX_MASK ((((crypt_uword_t)1) << RADIX_LOG2) - 1) - -#define BITS_TO_CRYPT_WORDS(bits) RADIX_DIV((bits) + (RADIX_BITS - 1)) -#define BYTES_TO_CRYPT_WORDS(bytes) BITS_TO_CRYPT_WORDS(bytes * 8) -#define SIZE_IN_CRYPT_WORDS(thing) BYTES_TO_CRYPT_WORDS(sizeof(thing)) - -#if RADIX_BITS == 64 -#define SWAP_CRYPT_WORD(x) REVERSE_ENDIAN_64(x) - typedef uint64_t crypt_uword_t; - typedef int64_t crypt_word_t; -# define TO_CRYPT_WORD_64 BIG_ENDIAN_BYTES_TO_UINT64 -# define TO_CRYPT_WORD_32(a, b, c, d) TO_CRYPT_WORD_64(0, 0, 0, 0, a, b, c, d) -#elif RADIX_BITS == 32 -# define SWAP_CRYPT_WORD(x) REVERSE_ENDIAN_32((x)) - typedef uint32_t crypt_uword_t; - typedef int32_t crypt_word_t; -# define TO_CRYPT_WORD_64(a, b, c, d, e, f, g, h) \ - BIG_ENDIAN_BYTES_TO_UINT32(e, f, g, h), \ - BIG_ENDIAN_BYTES_TO_UINT32(a, b, c, d) -#endif - -#define MAX_CRYPT_UWORD (~((crypt_uword_t)0)) -#define MAX_CRYPT_WORD ((crypt_word_t)(MAX_CRYPT_UWORD >> 1)) -#define MIN_CRYPT_WORD (~MAX_CRYPT_WORD) - -#define LARGEST_NUMBER (MAX((ALG_RSA * MAX_RSA_KEY_BYTES), \ - MAX((ALG_ECC * MAX_ECC_KEY_BYTES), MAX_DIGEST_SIZE))) -#define LARGEST_NUMBER_BITS (LARGEST_NUMBER * 8) - -#define MAX_ECC_PARAMETER_BYTES (MAX_ECC_KEY_BYTES * ALG_ECC) - -// These are the basic big number formats. This is convertible to the library- -// specific format without to much difficulty. For the math performed using -// these numbers, the value is always positive. -#define BN_STRUCT_DEF(count) struct { \ - crypt_uword_t allocated; \ - crypt_uword_t size; \ - crypt_uword_t d[count]; \ - } - -typedef BN_STRUCT_DEF(1) bignum_t; -#ifndef bigNum -typedef bignum_t *bigNum; -typedef const bignum_t *bigConst; -#endif - -extern const bignum_t BnConstZero; - -// The Functions to access the properties of a big number. -// Get number of allocated words -#define BnGetAllocated(x) (unsigned)((x)->allocated) - -// Get number of words used -#define BnGetSize(x) ((x)->size) - -// Get a pointer to the data array -#define BnGetArray(x) ((crypt_uword_t *)&((x)->d[0])) - -// Get the nth word of a BIGNUM (zero-based) -#define BnGetWord(x, i) (crypt_uword_t)((x)->d[i]) - -// Some things that are done often. - -// Test to see if a bignum_t is equal to zero -#define BnEqualZero(bn) (BnGetSize(bn) == 0) - -// Test to see if a bignum_t is equal to a word type -#define BnEqualWord(bn, word) \ - ((BnGetSize(bn) == 1) && (BnGetWord(bn, 0) == (crypt_uword_t)word)) - -// Determine if a BIGNUM is even. A zero is even. Although the -// indication that a number is zero is that it's size is zero, -// all words of the number are 0 so this test works on zero. -#define BnIsEven(n) ((BnGetWord(n, 0) & 1) == 0) - -// The macros below are used to define BIGNUM values of the required -// size. The values are allocated on the stack so they can be -// treated like simple local values. - -// This will call the initialization function for a defined bignum_t. -// This sets the allocated and used fields and clears the words of 'n'. -#define BN_INIT(name) \ - (bigNum)BnInit((bigNum)&(name), \ - BYTES_TO_CRYPT_WORDS(sizeof(name.d))) - -// In some cases, a function will need the address of the structure -// associated with a variable. The structure for a BIGNUM variable -// of 'name' is 'name_'. Generally, when the structure is created, it -// is initialized and a parameter is created with a pointer to the -// structure. The pointer has the 'name' and the structure it points -// to is 'name_' -#define BN_ADDRESS(name) (bigNum)&name##_ - -#define BN_STRUCT_ALLOCATION(bits) (BITS_TO_CRYPT_WORDS(bits) + 1) - -// Create a structure of the correct size. -#define BN_STRUCT(bits) \ - BN_STRUCT_DEF(BN_STRUCT_ALLOCATION(bits)) - -// Define a BIGNUM type with a specific allocation -#define BN_TYPE(name, bits) \ - typedef BN_STRUCT(bits) bn_##name##_t - -// This creates a local BIGNUM variable of a specific size and -// initializes it from a TPM2B input parameter. -#define BN_INITIALIZED(name, bits, initializer) \ - BN_STRUCT(bits) name##_; \ - bigNum name = BnFrom2B(BN_INIT(name##_), \ - (const TPM2B *)initializer) - -// Create a local variable that can hold a number with 'bits' -#define BN_VAR(name, bits) \ - BN_STRUCT(bits) _##name; \ - bigNum name = BN_INIT(_##name) - -// Create a type that can hold the largest number defined by the -// implementation. -#define BN_MAX(name) BN_VAR(name, LARGEST_NUMBER_BITS) -#define BN_MAX_INITIALIZED(name, initializer) \ - BN_INITIALIZED(name, LARGEST_NUMBER_BITS, initializer) - -// A word size value is useful -#define BN_WORD(name) BN_VAR(name, RADIX_BITS) - -// This is used to created a word-size BIGNUM and initialize it with -// an input parameter to a function. -#define BN_WORD_INITIALIZED(name, initial) \ - BN_STRUCT(RADIX_BITS) name##_; \ - bigNum name = BnInitializeWord((bigNum)&name##_, \ - BN_STRUCT_ALLOCATION(RADIX_BITS), initial) - -// ECC-Specific Values - -// This is the format for a point. It is always in affine format. The Z value is -// carried as part of the point, primarily to simplify the interface to the support -// library. Rather than have the interface layer have to create space for the -// point each time it is used... -// The x, y, and z values are pointers to bigNum values and not in-line versions of -// the numbers. This is a relic of the days when there was no standard TPM format -// for the numbers -typedef struct _bn_point_t -{ - bigNum x; - bigNum y; - bigNum z; -} bn_point_t; - -typedef bn_point_t *bigPoint; -typedef const bn_point_t *pointConst; - -typedef struct constant_point_t -{ - bigConst x; - bigConst y; - bigConst z; -} constant_point_t; - -#define ECC_BITS (MAX_ECC_KEY_BYTES * 8) -BN_TYPE(ecc, ECC_BITS); -#define ECC_NUM(name) BN_VAR(name, ECC_BITS) -#define ECC_INITIALIZED(name, initializer) \ - BN_INITIALIZED(name, ECC_BITS, initializer) - -#define POINT_INSTANCE(name, bits) \ - BN_STRUCT (bits) name##_x = \ - {BITS_TO_CRYPT_WORDS ( bits ), 0,{0}}; \ - BN_STRUCT ( bits ) name##_y = \ - {BITS_TO_CRYPT_WORDS ( bits ), 0,{0}}; \ - BN_STRUCT ( bits ) name##_z = \ - {BITS_TO_CRYPT_WORDS ( bits ), 0,{0}}; \ - bn_point_t name##_ - -#define POINT_INITIALIZER(name) \ - BnInitializePoint(&name##_, (bigNum)&name##_x, \ - (bigNum)&name##_y, (bigNum)&name##_z) - -#define POINT_INITIALIZED(name, initValue) \ - POINT_INSTANCE(name, MAX_ECC_KEY_BITS); \ - bigPoint name = BnPointFrom2B( \ - POINT_INITIALIZER(name), \ - initValue) - -#define POINT_VAR(name, bits) \ - POINT_INSTANCE (name, bits); \ - bigPoint name = POINT_INITIALIZER(name) - -#define POINT(name) POINT_VAR(name, MAX_ECC_KEY_BITS) - -// Structure for the curve parameters. This is an analog to the -// TPMS_ALGORITHM_DETAIL_ECC -typedef struct -{ - bigConst prime; // a prime number - bigConst order; // the order of the curve - bigConst h; // cofactor - bigConst a; // linear coefficient - bigConst b; // constant term - constant_point_t base; // base point -} ECC_CURVE_DATA; - -// Access macros for the ECC_CURVE structure. The parameter 'C' is a pointer -// to an ECC_CURVE_DATA structure. In some libraries, the curve structure contains -// a pointer to an ECC_CURVE_DATA structure as well as some other bits. For those -// cases, the AccessCurveData macro is used in the code to first get the pointer -// to the ECC_CURVE_DATA for access. In some cases, the macro does noting. -#define CurveGetPrime(C) ((C)->prime) -#define CurveGetOrder(C) ((C)->order) -#define CurveGetCofactor(C) ((C)->h) -#define CurveGet_a(C) ((C)->a) -#define CurveGet_b(C) ((C)->b) -#define CurveGetG(C) ((pointConst)&((C)->base)) -#define CurveGetGx(C) ((C)->base.x) -#define CurveGetGy(C) ((C)->base.y) - - -// Convert bytes in initializers according to the endianess of the system. -// This is used for CryptEccData.c. -#define BIG_ENDIAN_BYTES_TO_UINT32(a, b, c, d) \ - ( ((UINT32)(a) << 24) \ - + ((UINT32)(b) << 16) \ - + ((UINT32)(c) << 8) \ - + ((UINT32)(d)) \ - ) - -#define BIG_ENDIAN_BYTES_TO_UINT64(a, b, c, d, e, f, g, h) \ - ( ((UINT64)(a) << 56) \ - + ((UINT64)(b) << 48) \ - + ((UINT64)(c) << 40) \ - + ((UINT64)(d) << 32) \ - + ((UINT64)(e) << 24) \ - + ((UINT64)(f) << 16) \ - + ((UINT64)(g) << 8) \ - + ((UINT64)(h)) \ - ) - -#ifndef RADIX_BYTES -# if RADIX_BITS == 32 -# define RADIX_BYTES 4 -# elif RADIX_BITS == 64 -# define RADIX_BYTES 8 -# else -# error "RADIX_BITS must either be 32 or 64" -# endif -#endif - -// Add implementation dependent definitions for other ECC Values and for linkages. -#include LIB_INCLUDE(MATH_LIB, Math) - - -#endif // _BN_NUMBERS_H \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Capabilities.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Capabilities.h deleted file mode 100644 index 54f620c20..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Capabilities.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _CAPABILITIES_H -#define _CAPABILITIES_H - -#define MAX_CAP_DATA (MAX_CAP_BUFFER - sizeof(TPM_CAP)-sizeof(UINT32)) -#define MAX_CAP_ALGS (MAX_CAP_DATA / sizeof(TPMS_ALG_PROPERTY)) -#define MAX_CAP_HANDLES (MAX_CAP_DATA / sizeof(TPM_HANDLE)) -#define MAX_CAP_CC (MAX_CAP_DATA / sizeof(TPM_CC)) -#define MAX_TPM_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PROPERTY)) -#define MAX_PCR_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PCR_SELECT)) -#define MAX_ECC_CURVES (MAX_CAP_DATA / sizeof(TPM_ECC_CURVE)) -#define MAX_TAGGED_POLICIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_POLICY)) - -#define MAX_AC_CAPABILITIES (MAX_CAP_DATA / sizeof(TPMS_AC_OUTPUT)) - -#endif diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandAttributeData.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandAttributeData.h deleted file mode 100644 index 8c3e5e433..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandAttributeData.h +++ /dev/null @@ -1,916 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 3.0 June 16, 2017 - * Date: Oct 9, 2018 Time: 07:25:18PM - */ -// This file should only be included by CommandCodeAttibutes.c -#ifdef _COMMAND_CODE_ATTRIBUTES_ - -#include "CommandAttributes.h" - -#if COMPRESSED_LISTS -# define PAD_LIST 0 -#else -# define PAD_LIST 1 -#endif - - -// This is the command code attribute array for GetCapability. -// Both this array and s_commandAttributes provides command code attributes, -// but tuned for different purpose -const TPMA_CC s_ccAttr [] = { -#if (PAD_LIST || CC_NV_UndefineSpaceSpecial) - TPMA_CC_INITIALIZER(0x011F, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_EvictControl) - TPMA_CC_INITIALIZER(0x0120, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_HierarchyControl) - TPMA_CC_INITIALIZER(0x0121, 0, 1, 1, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_UndefineSpace) - TPMA_CC_INITIALIZER(0x0122, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST ) - TPMA_CC_INITIALIZER(0x0123, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ChangeEPS) - TPMA_CC_INITIALIZER(0x0124, 0, 1, 1, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ChangePPS) - TPMA_CC_INITIALIZER(0x0125, 0, 1, 1, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Clear) - TPMA_CC_INITIALIZER(0x0126, 0, 1, 1, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ClearControl) - TPMA_CC_INITIALIZER(0x0127, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ClockSet) - TPMA_CC_INITIALIZER(0x0128, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_HierarchyChangeAuth) - TPMA_CC_INITIALIZER(0x0129, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_DefineSpace) - TPMA_CC_INITIALIZER(0x012A, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PCR_Allocate) - TPMA_CC_INITIALIZER(0x012B, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PCR_SetAuthPolicy) - TPMA_CC_INITIALIZER(0x012C, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PP_Commands) - TPMA_CC_INITIALIZER(0x012D, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_SetPrimaryPolicy) - TPMA_CC_INITIALIZER(0x012E, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_FieldUpgradeStart) - TPMA_CC_INITIALIZER(0x012F, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ClockRateAdjust) - TPMA_CC_INITIALIZER(0x0130, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_CreatePrimary) - TPMA_CC_INITIALIZER(0x0131, 0, 0, 0, 0, 1, 1, 0, 0), -#endif -#if (PAD_LIST || CC_NV_GlobalWriteLock) - TPMA_CC_INITIALIZER(0x0132, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_GetCommandAuditDigest) - TPMA_CC_INITIALIZER(0x0133, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_Increment) - TPMA_CC_INITIALIZER(0x0134, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_SetBits) - TPMA_CC_INITIALIZER(0x0135, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_Extend) - TPMA_CC_INITIALIZER(0x0136, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_Write) - TPMA_CC_INITIALIZER(0x0137, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_WriteLock) - TPMA_CC_INITIALIZER(0x0138, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_DictionaryAttackLockReset) - TPMA_CC_INITIALIZER(0x0139, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_DictionaryAttackParameters) - TPMA_CC_INITIALIZER(0x013A, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_ChangeAuth) - TPMA_CC_INITIALIZER(0x013B, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PCR_Event) - TPMA_CC_INITIALIZER(0x013C, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PCR_Reset) - TPMA_CC_INITIALIZER(0x013D, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_SequenceComplete) - TPMA_CC_INITIALIZER(0x013E, 0, 0, 0, 1, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_SetAlgorithmSet) - TPMA_CC_INITIALIZER(0x013F, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_SetCommandCodeAuditStatus) - TPMA_CC_INITIALIZER(0x0140, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_FieldUpgradeData) - TPMA_CC_INITIALIZER(0x0141, 0, 1, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_IncrementalSelfTest) - TPMA_CC_INITIALIZER(0x0142, 0, 1, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_SelfTest) - TPMA_CC_INITIALIZER(0x0143, 0, 1, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Startup) - TPMA_CC_INITIALIZER(0x0144, 0, 1, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Shutdown) - TPMA_CC_INITIALIZER(0x0145, 0, 1, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_StirRandom) - TPMA_CC_INITIALIZER(0x0146, 0, 1, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ActivateCredential) - TPMA_CC_INITIALIZER(0x0147, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Certify) - TPMA_CC_INITIALIZER(0x0148, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyNV) - TPMA_CC_INITIALIZER(0x0149, 0, 0, 0, 0, 3, 0, 0, 0), -#endif -#if (PAD_LIST || CC_CertifyCreation) - TPMA_CC_INITIALIZER(0x014A, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Duplicate) - TPMA_CC_INITIALIZER(0x014B, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_GetTime) - TPMA_CC_INITIALIZER(0x014C, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_GetSessionAuditDigest) - TPMA_CC_INITIALIZER(0x014D, 0, 0, 0, 0, 3, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_Read) - TPMA_CC_INITIALIZER(0x014E, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_ReadLock) - TPMA_CC_INITIALIZER(0x014F, 0, 1, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ObjectChangeAuth) - TPMA_CC_INITIALIZER(0x0150, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicySecret) - TPMA_CC_INITIALIZER(0x0151, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Rewrap) - TPMA_CC_INITIALIZER(0x0152, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Create) - TPMA_CC_INITIALIZER(0x0153, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ECDH_ZGen) - TPMA_CC_INITIALIZER(0x0154, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || (CC_HMAC || CC_MAC)) - TPMA_CC_INITIALIZER(0x0155, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Import) - TPMA_CC_INITIALIZER(0x0156, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Load) - TPMA_CC_INITIALIZER(0x0157, 0, 0, 0, 0, 1, 1, 0, 0), -#endif -#if (PAD_LIST || CC_Quote) - TPMA_CC_INITIALIZER(0x0158, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_RSA_Decrypt) - TPMA_CC_INITIALIZER(0x0159, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST ) - TPMA_CC_INITIALIZER(0x015A, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || (CC_HMAC_Start || CC_MAC_Start)) - TPMA_CC_INITIALIZER(0x015B, 0, 0, 0, 0, 1, 1, 0, 0), -#endif -#if (PAD_LIST || CC_SequenceUpdate) - TPMA_CC_INITIALIZER(0x015C, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Sign) - TPMA_CC_INITIALIZER(0x015D, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Unseal) - TPMA_CC_INITIALIZER(0x015E, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST ) - TPMA_CC_INITIALIZER(0x015F, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicySigned) - TPMA_CC_INITIALIZER(0x0160, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ContextLoad) - TPMA_CC_INITIALIZER(0x0161, 0, 0, 0, 0, 0, 1, 0, 0), -#endif -#if (PAD_LIST || CC_ContextSave) - TPMA_CC_INITIALIZER(0x0162, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ECDH_KeyGen) - TPMA_CC_INITIALIZER(0x0163, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_EncryptDecrypt) - TPMA_CC_INITIALIZER(0x0164, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_FlushContext) - TPMA_CC_INITIALIZER(0x0165, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST ) - TPMA_CC_INITIALIZER(0x0166, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_LoadExternal) - TPMA_CC_INITIALIZER(0x0167, 0, 0, 0, 0, 0, 1, 0, 0), -#endif -#if (PAD_LIST || CC_MakeCredential) - TPMA_CC_INITIALIZER(0x0168, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_ReadPublic) - TPMA_CC_INITIALIZER(0x0169, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyAuthorize) - TPMA_CC_INITIALIZER(0x016A, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyAuthValue) - TPMA_CC_INITIALIZER(0x016B, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyCommandCode) - TPMA_CC_INITIALIZER(0x016C, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyCounterTimer) - TPMA_CC_INITIALIZER(0x016D, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyCpHash) - TPMA_CC_INITIALIZER(0x016E, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyLocality) - TPMA_CC_INITIALIZER(0x016F, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyNameHash) - TPMA_CC_INITIALIZER(0x0170, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyOR) - TPMA_CC_INITIALIZER(0x0171, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyTicket) - TPMA_CC_INITIALIZER(0x0172, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ReadPublic) - TPMA_CC_INITIALIZER(0x0173, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_RSA_Encrypt) - TPMA_CC_INITIALIZER(0x0174, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST ) - TPMA_CC_INITIALIZER(0x0175, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_StartAuthSession) - TPMA_CC_INITIALIZER(0x0176, 0, 0, 0, 0, 2, 1, 0, 0), -#endif -#if (PAD_LIST || CC_VerifySignature) - TPMA_CC_INITIALIZER(0x0177, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ECC_Parameters) - TPMA_CC_INITIALIZER(0x0178, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_FirmwareRead) - TPMA_CC_INITIALIZER(0x0179, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_GetCapability) - TPMA_CC_INITIALIZER(0x017A, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_GetRandom) - TPMA_CC_INITIALIZER(0x017B, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_GetTestResult) - TPMA_CC_INITIALIZER(0x017C, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Hash) - TPMA_CC_INITIALIZER(0x017D, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PCR_Read) - TPMA_CC_INITIALIZER(0x017E, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyPCR) - TPMA_CC_INITIALIZER(0x017F, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyRestart) - TPMA_CC_INITIALIZER(0x0180, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ReadClock) - TPMA_CC_INITIALIZER(0x0181, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PCR_Extend) - TPMA_CC_INITIALIZER(0x0182, 0, 1, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PCR_SetAuthValue) - TPMA_CC_INITIALIZER(0x0183, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_NV_Certify) - TPMA_CC_INITIALIZER(0x0184, 0, 0, 0, 0, 3, 0, 0, 0), -#endif -#if (PAD_LIST || CC_EventSequenceComplete) - TPMA_CC_INITIALIZER(0x0185, 0, 1, 0, 1, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_HashSequenceStart) - TPMA_CC_INITIALIZER(0x0186, 0, 0, 0, 0, 0, 1, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyPhysicalPresence) - TPMA_CC_INITIALIZER(0x0187, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyDuplicationSelect) - TPMA_CC_INITIALIZER(0x0188, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyGetDigest) - TPMA_CC_INITIALIZER(0x0189, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_TestParms) - TPMA_CC_INITIALIZER(0x018A, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Commit) - TPMA_CC_INITIALIZER(0x018B, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyPassword) - TPMA_CC_INITIALIZER(0x018C, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_ZGen_2Phase) - TPMA_CC_INITIALIZER(0x018D, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_EC_Ephemeral) - TPMA_CC_INITIALIZER(0x018E, 0, 0, 0, 0, 0, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyNvWritten) - TPMA_CC_INITIALIZER(0x018F, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyTemplate) - TPMA_CC_INITIALIZER(0x0190, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_CreateLoaded) - TPMA_CC_INITIALIZER(0x0191, 0, 0, 0, 0, 1, 1, 0, 0), -#endif -#if (PAD_LIST || CC_PolicyAuthorizeNV) - TPMA_CC_INITIALIZER(0x0192, 0, 0, 0, 0, 3, 0, 0, 0), -#endif -#if (PAD_LIST || CC_EncryptDecrypt2) - TPMA_CC_INITIALIZER(0x0193, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_AC_GetCapability) - TPMA_CC_INITIALIZER(0x0194, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_AC_Send) - TPMA_CC_INITIALIZER(0x0195, 0, 0, 0, 0, 3, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Policy_AC_SendSelect) - TPMA_CC_INITIALIZER(0x0196, 0, 0, 0, 0, 1, 0, 0, 0), -#endif -#if (PAD_LIST || CC_CertifyX509) - TPMA_CC_INITIALIZER(0x0197, 0, 0, 0, 0, 2, 0, 0, 0), -#endif -#if (PAD_LIST || CC_Vendor_TCG_Test) - TPMA_CC_INITIALIZER(0x0000, 0, 0, 0, 0, 0, 0, 1, 0), -#endif - TPMA_ZERO_INITIALIZER() -}; - - - -// This is the command code attribute structure. -const COMMAND_ATTRIBUTES s_commandAttributes [] = { -#if (PAD_LIST || CC_NV_UndefineSpaceSpecial) - (COMMAND_ATTRIBUTES)(CC_NV_UndefineSpaceSpecial * // 0x011F - (IS_IMPLEMENTED+HANDLE_1_ADMIN+HANDLE_2_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_EvictControl) - (COMMAND_ATTRIBUTES)(CC_EvictControl * // 0x0120 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_HierarchyControl) - (COMMAND_ATTRIBUTES)(CC_HierarchyControl * // 0x0121 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_NV_UndefineSpace) - (COMMAND_ATTRIBUTES)(CC_NV_UndefineSpace * // 0x0122 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST ) - (COMMAND_ATTRIBUTES)(0), // 0x0123 -#endif -#if (PAD_LIST || CC_ChangeEPS) - (COMMAND_ATTRIBUTES)(CC_ChangeEPS * // 0x0124 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_ChangePPS) - (COMMAND_ATTRIBUTES)(CC_ChangePPS * // 0x0125 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_Clear) - (COMMAND_ATTRIBUTES)(CC_Clear * // 0x0126 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_ClearControl) - (COMMAND_ATTRIBUTES)(CC_ClearControl * // 0x0127 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_ClockSet) - (COMMAND_ATTRIBUTES)(CC_ClockSet * // 0x0128 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_HierarchyChangeAuth) - (COMMAND_ATTRIBUTES)(CC_HierarchyChangeAuth * // 0x0129 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_NV_DefineSpace) - (COMMAND_ATTRIBUTES)(CC_NV_DefineSpace * // 0x012A - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_PCR_Allocate) - (COMMAND_ATTRIBUTES)(CC_PCR_Allocate * // 0x012B - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_PCR_SetAuthPolicy) - (COMMAND_ATTRIBUTES)(CC_PCR_SetAuthPolicy * // 0x012C - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_PP_Commands) - (COMMAND_ATTRIBUTES)(CC_PP_Commands * // 0x012D - (IS_IMPLEMENTED+HANDLE_1_USER+PP_REQUIRED)), -#endif -#if (PAD_LIST || CC_SetPrimaryPolicy) - (COMMAND_ATTRIBUTES)(CC_SetPrimaryPolicy * // 0x012E - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_FieldUpgradeStart) - (COMMAND_ATTRIBUTES)(CC_FieldUpgradeStart * // 0x012F - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_ADMIN+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_ClockRateAdjust) - (COMMAND_ATTRIBUTES)(CC_ClockRateAdjust * // 0x0130 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_CreatePrimary) - (COMMAND_ATTRIBUTES)(CC_CreatePrimary * // 0x0131 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+PP_COMMAND+ENCRYPT_2+R_HANDLE)), -#endif -#if (PAD_LIST || CC_NV_GlobalWriteLock) - (COMMAND_ATTRIBUTES)(CC_NV_GlobalWriteLock * // 0x0132 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_GetCommandAuditDigest) - (COMMAND_ATTRIBUTES)(CC_GetCommandAuditDigest * // 0x0133 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+HANDLE_2_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_NV_Increment) - (COMMAND_ATTRIBUTES)(CC_NV_Increment * // 0x0134 - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_NV_SetBits) - (COMMAND_ATTRIBUTES)(CC_NV_SetBits * // 0x0135 - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_NV_Extend) - (COMMAND_ATTRIBUTES)(CC_NV_Extend * // 0x0136 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_NV_Write) - (COMMAND_ATTRIBUTES)(CC_NV_Write * // 0x0137 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_NV_WriteLock) - (COMMAND_ATTRIBUTES)(CC_NV_WriteLock * // 0x0138 - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_DictionaryAttackLockReset) - (COMMAND_ATTRIBUTES)(CC_DictionaryAttackLockReset * // 0x0139 - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_DictionaryAttackParameters) - (COMMAND_ATTRIBUTES)(CC_DictionaryAttackParameters * // 0x013A - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_NV_ChangeAuth) - (COMMAND_ATTRIBUTES)(CC_NV_ChangeAuth * // 0x013B - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_ADMIN)), -#endif -#if (PAD_LIST || CC_PCR_Event) - (COMMAND_ATTRIBUTES)(CC_PCR_Event * // 0x013C - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_PCR_Reset) - (COMMAND_ATTRIBUTES)(CC_PCR_Reset * // 0x013D - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_SequenceComplete) - (COMMAND_ATTRIBUTES)(CC_SequenceComplete * // 0x013E - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_SetAlgorithmSet) - (COMMAND_ATTRIBUTES)(CC_SetAlgorithmSet * // 0x013F - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_SetCommandCodeAuditStatus) - (COMMAND_ATTRIBUTES)(CC_SetCommandCodeAuditStatus * // 0x0140 - (IS_IMPLEMENTED+HANDLE_1_USER+PP_COMMAND)), -#endif -#if (PAD_LIST || CC_FieldUpgradeData) - (COMMAND_ATTRIBUTES)(CC_FieldUpgradeData * // 0x0141 - (IS_IMPLEMENTED+DECRYPT_2)), -#endif -#if (PAD_LIST || CC_IncrementalSelfTest) - (COMMAND_ATTRIBUTES)(CC_IncrementalSelfTest * // 0x0142 - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_SelfTest) - (COMMAND_ATTRIBUTES)(CC_SelfTest * // 0x0143 - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_Startup) - (COMMAND_ATTRIBUTES)(CC_Startup * // 0x0144 - (IS_IMPLEMENTED+NO_SESSIONS)), -#endif -#if (PAD_LIST || CC_Shutdown) - (COMMAND_ATTRIBUTES)(CC_Shutdown * // 0x0145 - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_StirRandom) - (COMMAND_ATTRIBUTES)(CC_StirRandom * // 0x0146 - (IS_IMPLEMENTED+DECRYPT_2)), -#endif -#if (PAD_LIST || CC_ActivateCredential) - (COMMAND_ATTRIBUTES)(CC_ActivateCredential * // 0x0147 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_ADMIN+HANDLE_2_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_Certify) - (COMMAND_ATTRIBUTES)(CC_Certify * // 0x0148 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_ADMIN+HANDLE_2_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_PolicyNV) - (COMMAND_ATTRIBUTES)(CC_PolicyNV * // 0x0149 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_CertifyCreation) - (COMMAND_ATTRIBUTES)(CC_CertifyCreation * // 0x014A - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_Duplicate) - (COMMAND_ATTRIBUTES)(CC_Duplicate * // 0x014B - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_DUP+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_GetTime) - (COMMAND_ATTRIBUTES)(CC_GetTime * // 0x014C - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+HANDLE_2_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_GetSessionAuditDigest) - (COMMAND_ATTRIBUTES)(CC_GetSessionAuditDigest * // 0x014D - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+HANDLE_2_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_NV_Read) - (COMMAND_ATTRIBUTES)(CC_NV_Read * // 0x014E - (IS_IMPLEMENTED+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_NV_ReadLock) - (COMMAND_ATTRIBUTES)(CC_NV_ReadLock * // 0x014F - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_ObjectChangeAuth) - (COMMAND_ATTRIBUTES)(CC_ObjectChangeAuth * // 0x0150 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_ADMIN+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_PolicySecret) - (COMMAND_ATTRIBUTES)(CC_PolicySecret * // 0x0151 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ALLOW_TRIAL+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_Rewrap) - (COMMAND_ATTRIBUTES)(CC_Rewrap * // 0x0152 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_Create) - (COMMAND_ATTRIBUTES)(CC_Create * // 0x0153 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_ECDH_ZGen) - (COMMAND_ATTRIBUTES)(CC_ECDH_ZGen * // 0x0154 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || (CC_HMAC || CC_MAC)) - (COMMAND_ATTRIBUTES)((CC_HMAC || CC_MAC) * // 0x0155 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_Import) - (COMMAND_ATTRIBUTES)(CC_Import * // 0x0156 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_Load) - (COMMAND_ATTRIBUTES)(CC_Load * // 0x0157 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2+R_HANDLE)), -#endif -#if (PAD_LIST || CC_Quote) - (COMMAND_ATTRIBUTES)(CC_Quote * // 0x0158 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_RSA_Decrypt) - (COMMAND_ATTRIBUTES)(CC_RSA_Decrypt * // 0x0159 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST ) - (COMMAND_ATTRIBUTES)(0), // 0x015A -#endif -#if (PAD_LIST || (CC_HMAC_Start || CC_MAC_Start)) - (COMMAND_ATTRIBUTES)((CC_HMAC_Start || CC_MAC_Start) * // 0x015B - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+R_HANDLE)), -#endif -#if (PAD_LIST || CC_SequenceUpdate) - (COMMAND_ATTRIBUTES)(CC_SequenceUpdate * // 0x015C - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_Sign) - (COMMAND_ATTRIBUTES)(CC_Sign * // 0x015D - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_Unseal) - (COMMAND_ATTRIBUTES)(CC_Unseal * // 0x015E - (IS_IMPLEMENTED+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST ) - (COMMAND_ATTRIBUTES)(0), // 0x015F -#endif -#if (PAD_LIST || CC_PolicySigned) - (COMMAND_ATTRIBUTES)(CC_PolicySigned * // 0x0160 - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_ContextLoad) - (COMMAND_ATTRIBUTES)(CC_ContextLoad * // 0x0161 - (IS_IMPLEMENTED+NO_SESSIONS+R_HANDLE)), -#endif -#if (PAD_LIST || CC_ContextSave) - (COMMAND_ATTRIBUTES)(CC_ContextSave * // 0x0162 - (IS_IMPLEMENTED+NO_SESSIONS)), -#endif -#if (PAD_LIST || CC_ECDH_KeyGen) - (COMMAND_ATTRIBUTES)(CC_ECDH_KeyGen * // 0x0163 - (IS_IMPLEMENTED+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_EncryptDecrypt) - (COMMAND_ATTRIBUTES)(CC_EncryptDecrypt * // 0x0164 - (IS_IMPLEMENTED+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_FlushContext) - (COMMAND_ATTRIBUTES)(CC_FlushContext * // 0x0165 - (IS_IMPLEMENTED+NO_SESSIONS)), -#endif -#if (PAD_LIST ) - (COMMAND_ATTRIBUTES)(0), // 0x0166 -#endif -#if (PAD_LIST || CC_LoadExternal) - (COMMAND_ATTRIBUTES)(CC_LoadExternal * // 0x0167 - (IS_IMPLEMENTED+DECRYPT_2+ENCRYPT_2+R_HANDLE)), -#endif -#if (PAD_LIST || CC_MakeCredential) - (COMMAND_ATTRIBUTES)(CC_MakeCredential * // 0x0168 - (IS_IMPLEMENTED+DECRYPT_2+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_NV_ReadPublic) - (COMMAND_ATTRIBUTES)(CC_NV_ReadPublic * // 0x0169 - (IS_IMPLEMENTED+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_PolicyAuthorize) - (COMMAND_ATTRIBUTES)(CC_PolicyAuthorize * // 0x016A - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyAuthValue) - (COMMAND_ATTRIBUTES)(CC_PolicyAuthValue * // 0x016B - (IS_IMPLEMENTED+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyCommandCode) - (COMMAND_ATTRIBUTES)(CC_PolicyCommandCode * // 0x016C - (IS_IMPLEMENTED+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyCounterTimer) - (COMMAND_ATTRIBUTES)(CC_PolicyCounterTimer * // 0x016D - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyCpHash) - (COMMAND_ATTRIBUTES)(CC_PolicyCpHash * // 0x016E - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyLocality) - (COMMAND_ATTRIBUTES)(CC_PolicyLocality * // 0x016F - (IS_IMPLEMENTED+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyNameHash) - (COMMAND_ATTRIBUTES)(CC_PolicyNameHash * // 0x0170 - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyOR) - (COMMAND_ATTRIBUTES)(CC_PolicyOR * // 0x0171 - (IS_IMPLEMENTED+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyTicket) - (COMMAND_ATTRIBUTES)(CC_PolicyTicket * // 0x0172 - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_ReadPublic) - (COMMAND_ATTRIBUTES)(CC_ReadPublic * // 0x0173 - (IS_IMPLEMENTED+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_RSA_Encrypt) - (COMMAND_ATTRIBUTES)(CC_RSA_Encrypt * // 0x0174 - (IS_IMPLEMENTED+DECRYPT_2+ENCRYPT_2)), -#endif -#if (PAD_LIST ) - (COMMAND_ATTRIBUTES)(0), // 0x0175 -#endif -#if (PAD_LIST || CC_StartAuthSession) - (COMMAND_ATTRIBUTES)(CC_StartAuthSession * // 0x0176 - (IS_IMPLEMENTED+DECRYPT_2+ENCRYPT_2+R_HANDLE)), -#endif -#if (PAD_LIST || CC_VerifySignature) - (COMMAND_ATTRIBUTES)(CC_VerifySignature * // 0x0177 - (IS_IMPLEMENTED+DECRYPT_2)), -#endif -#if (PAD_LIST || CC_ECC_Parameters) - (COMMAND_ATTRIBUTES)(CC_ECC_Parameters * // 0x0178 - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_FirmwareRead) - (COMMAND_ATTRIBUTES)(CC_FirmwareRead * // 0x0179 - (IS_IMPLEMENTED+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_GetCapability) - (COMMAND_ATTRIBUTES)(CC_GetCapability * // 0x017A - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_GetRandom) - (COMMAND_ATTRIBUTES)(CC_GetRandom * // 0x017B - (IS_IMPLEMENTED+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_GetTestResult) - (COMMAND_ATTRIBUTES)(CC_GetTestResult * // 0x017C - (IS_IMPLEMENTED+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_Hash) - (COMMAND_ATTRIBUTES)(CC_Hash * // 0x017D - (IS_IMPLEMENTED+DECRYPT_2+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_PCR_Read) - (COMMAND_ATTRIBUTES)(CC_PCR_Read * // 0x017E - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_PolicyPCR) - (COMMAND_ATTRIBUTES)(CC_PolicyPCR * // 0x017F - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyRestart) - (COMMAND_ATTRIBUTES)(CC_PolicyRestart * // 0x0180 - (IS_IMPLEMENTED+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_ReadClock) - (COMMAND_ATTRIBUTES)(CC_ReadClock * // 0x0181 - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_PCR_Extend) - (COMMAND_ATTRIBUTES)(CC_PCR_Extend * // 0x0182 - (IS_IMPLEMENTED+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_PCR_SetAuthValue) - (COMMAND_ATTRIBUTES)(CC_PCR_SetAuthValue * // 0x0183 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER)), -#endif -#if (PAD_LIST || CC_NV_Certify) - (COMMAND_ATTRIBUTES)(CC_NV_Certify * // 0x0184 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+HANDLE_2_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_EventSequenceComplete) - (COMMAND_ATTRIBUTES)(CC_EventSequenceComplete * // 0x0185 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+HANDLE_2_USER)), -#endif -#if (PAD_LIST || CC_HashSequenceStart) - (COMMAND_ATTRIBUTES)(CC_HashSequenceStart * // 0x0186 - (IS_IMPLEMENTED+DECRYPT_2+R_HANDLE)), -#endif -#if (PAD_LIST || CC_PolicyPhysicalPresence) - (COMMAND_ATTRIBUTES)(CC_PolicyPhysicalPresence * // 0x0187 - (IS_IMPLEMENTED+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyDuplicationSelect) - (COMMAND_ATTRIBUTES)(CC_PolicyDuplicationSelect * // 0x0188 - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyGetDigest) - (COMMAND_ATTRIBUTES)(CC_PolicyGetDigest * // 0x0189 - (IS_IMPLEMENTED+ALLOW_TRIAL+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_TestParms) - (COMMAND_ATTRIBUTES)(CC_TestParms * // 0x018A - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_Commit) - (COMMAND_ATTRIBUTES)(CC_Commit * // 0x018B - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_PolicyPassword) - (COMMAND_ATTRIBUTES)(CC_PolicyPassword * // 0x018C - (IS_IMPLEMENTED+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_ZGen_2Phase) - (COMMAND_ATTRIBUTES)(CC_ZGen_2Phase * // 0x018D - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_EC_Ephemeral) - (COMMAND_ATTRIBUTES)(CC_EC_Ephemeral * // 0x018E - (IS_IMPLEMENTED+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_PolicyNvWritten) - (COMMAND_ATTRIBUTES)(CC_PolicyNvWritten * // 0x018F - (IS_IMPLEMENTED+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_PolicyTemplate) - (COMMAND_ATTRIBUTES)(CC_PolicyTemplate * // 0x0190 - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_CreateLoaded) - (COMMAND_ATTRIBUTES)(CC_CreateLoaded * // 0x0191 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+PP_COMMAND+ENCRYPT_2+R_HANDLE)), -#endif -#if (PAD_LIST || CC_PolicyAuthorizeNV) - (COMMAND_ATTRIBUTES)(CC_PolicyAuthorizeNV * // 0x0192 - (IS_IMPLEMENTED+HANDLE_1_USER+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_EncryptDecrypt2) - (COMMAND_ATTRIBUTES)(CC_EncryptDecrypt2 * // 0x0193 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_AC_GetCapability) - (COMMAND_ATTRIBUTES)(CC_AC_GetCapability * // 0x0194 - (IS_IMPLEMENTED)), -#endif -#if (PAD_LIST || CC_AC_Send) - (COMMAND_ATTRIBUTES)(CC_AC_Send * // 0x0195 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_DUP+HANDLE_2_USER)), -#endif -#if (PAD_LIST || CC_Policy_AC_SendSelect) - (COMMAND_ATTRIBUTES)(CC_Policy_AC_SendSelect * // 0x0196 - (IS_IMPLEMENTED+DECRYPT_2+ALLOW_TRIAL)), -#endif -#if (PAD_LIST || CC_CertifyX509) - (COMMAND_ATTRIBUTES)(CC_CertifyX509 * // 0x0197 - (IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_ADMIN+HANDLE_2_USER+ENCRYPT_2)), -#endif -#if (PAD_LIST || CC_Vendor_TCG_Test) - (COMMAND_ATTRIBUTES)(CC_Vendor_TCG_Test * // 0x0000 - (IS_IMPLEMENTED+DECRYPT_2+ENCRYPT_2)), -#endif - 0 -}; - - - -#endif // _COMMAND_CODE_ATTRIBUTES_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandAttributes.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandAttributes.h deleted file mode 100644 index eec0469fc..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandAttributes.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 3.0 June 16, 2017 - * Date: Aug 14, 2017 Time: 02:53:08PM - */ -// The attributes defined in this file are produced by the parser that -// creates the structure definitions from Part 3. The attributes are defined -// in that parser and should track the attributes being tested in -// CommandCodeAttributes.c. Generally, when an attribute is added to this list, -// new code will be needed in CommandCodeAttributes.c to test it. - -#ifndef COMMAND_ATTRIBUTES_H -#define COMMAND_ATTRIBUTES_H - -typedef UINT16 COMMAND_ATTRIBUTES; -#define NOT_IMPLEMENTED (COMMAND_ATTRIBUTES)(0) -#define ENCRYPT_2 ((COMMAND_ATTRIBUTES)1 << 0) -#define ENCRYPT_4 ((COMMAND_ATTRIBUTES)1 << 1) -#define DECRYPT_2 ((COMMAND_ATTRIBUTES)1 << 2) -#define DECRYPT_4 ((COMMAND_ATTRIBUTES)1 << 3) -#define HANDLE_1_USER ((COMMAND_ATTRIBUTES)1 << 4) -#define HANDLE_1_ADMIN ((COMMAND_ATTRIBUTES)1 << 5) -#define HANDLE_1_DUP ((COMMAND_ATTRIBUTES)1 << 6) -#define HANDLE_2_USER ((COMMAND_ATTRIBUTES)1 << 7) -#define PP_COMMAND ((COMMAND_ATTRIBUTES)1 << 8) -#define IS_IMPLEMENTED ((COMMAND_ATTRIBUTES)1 << 9) -#define NO_SESSIONS ((COMMAND_ATTRIBUTES)1 << 10) -#define NV_COMMAND ((COMMAND_ATTRIBUTES)1 << 11) -#define PP_REQUIRED ((COMMAND_ATTRIBUTES)1 << 12) -#define R_HANDLE ((COMMAND_ATTRIBUTES)1 << 13) -#define ALLOW_TRIAL ((COMMAND_ATTRIBUTES)1 << 14) - -#endif // COMMAND_ATTRIBUTES_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandDispatchData.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandDispatchData.h deleted file mode 100644 index 2c2461544..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandDispatchData.h +++ /dev/null @@ -1,5167 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Apr 2, 2019 Time: 11:00:48AM - */ - -// This file should only be included by CommandCodeAttibutes.c -#ifdef _COMMAND_TABLE_DISPATCH_ - - -// Define the stop value -#define END_OF_LIST 0xff -#define ADD_FLAG 0x80 - -// These macros provide some variability in how the data is encoded. They also make -// the lines a little sorter. ;-) -# define UNMARSHAL_DISPATCH(name) (UNMARSHAL_t)name##_Unmarshal -# define MARSHAL_DISPATCH(name) (MARSHAL_t)name##_Marshal -# define _UNMARSHAL_T_ UNMARSHAL_t -# define _MARSHAL_T_ MARSHAL_t - - -// The UnmarshalArray contains the dispatch functions for the unmarshaling code. -// The defines in this array are used to make it easier to cross reference the -// unmarshaling values in the types array of each command - -const _UNMARSHAL_T_ UnmarshalArray[] = { -#define TPMI_DH_CONTEXT_H_UNMARSHAL 0 - UNMARSHAL_DISPATCH(TPMI_DH_CONTEXT), -#define TPMI_RH_AC_H_UNMARSHAL (TPMI_DH_CONTEXT_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_AC), -#define TPMI_RH_CLEAR_H_UNMARSHAL (TPMI_RH_AC_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_CLEAR), -#define TPMI_RH_HIERARCHY_AUTH_H_UNMARSHAL (TPMI_RH_CLEAR_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_HIERARCHY_AUTH), -#define TPMI_RH_LOCKOUT_H_UNMARSHAL (TPMI_RH_HIERARCHY_AUTH_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_LOCKOUT), -#define TPMI_RH_NV_AUTH_H_UNMARSHAL (TPMI_RH_LOCKOUT_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_NV_AUTH), -#define TPMI_RH_NV_INDEX_H_UNMARSHAL (TPMI_RH_NV_AUTH_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_NV_INDEX), -#define TPMI_RH_PLATFORM_H_UNMARSHAL (TPMI_RH_NV_INDEX_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_PLATFORM), -#define TPMI_RH_PROVISION_H_UNMARSHAL (TPMI_RH_PLATFORM_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_PROVISION), -#define TPMI_SH_HMAC_H_UNMARSHAL (TPMI_RH_PROVISION_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_SH_HMAC), -#define TPMI_SH_POLICY_H_UNMARSHAL (TPMI_SH_HMAC_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_SH_POLICY), -// HANDLE_FIRST_FLAG_TYPE is the first handle that needs a flag when called. -#define HANDLE_FIRST_FLAG_TYPE (TPMI_SH_POLICY_H_UNMARSHAL + 1) -#define TPMI_DH_ENTITY_H_UNMARSHAL (TPMI_SH_POLICY_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_DH_ENTITY), -#define TPMI_DH_OBJECT_H_UNMARSHAL (TPMI_DH_ENTITY_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_DH_OBJECT), -#define TPMI_DH_PARENT_H_UNMARSHAL (TPMI_DH_OBJECT_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_DH_PARENT), -#define TPMI_DH_PCR_H_UNMARSHAL (TPMI_DH_PARENT_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_DH_PCR), -#define TPMI_RH_ENDORSEMENT_H_UNMARSHAL (TPMI_DH_PCR_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_ENDORSEMENT), -#define TPMI_RH_HIERARCHY_H_UNMARSHAL (TPMI_RH_ENDORSEMENT_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_HIERARCHY), -// PARAMETER_FIRST_TYPE marks the end of the handle list. -#define PARAMETER_FIRST_TYPE (TPMI_RH_HIERARCHY_H_UNMARSHAL + 1) -#define TPM2B_DATA_P_UNMARSHAL (TPMI_RH_HIERARCHY_H_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_DATA), -#define TPM2B_DIGEST_P_UNMARSHAL (TPM2B_DATA_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_DIGEST), -#define TPM2B_ECC_PARAMETER_P_UNMARSHAL (TPM2B_DIGEST_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_ECC_PARAMETER), -#define TPM2B_ECC_POINT_P_UNMARSHAL (TPM2B_ECC_PARAMETER_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_ECC_POINT), -#define TPM2B_ENCRYPTED_SECRET_P_UNMARSHAL (TPM2B_ECC_POINT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_ENCRYPTED_SECRET), -#define TPM2B_EVENT_P_UNMARSHAL (TPM2B_ENCRYPTED_SECRET_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_EVENT), -#define TPM2B_ID_OBJECT_P_UNMARSHAL (TPM2B_EVENT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_ID_OBJECT), -#define TPM2B_IV_P_UNMARSHAL (TPM2B_ID_OBJECT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_IV), -#define TPM2B_MAX_BUFFER_P_UNMARSHAL (TPM2B_IV_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_MAX_BUFFER), -#define TPM2B_MAX_NV_BUFFER_P_UNMARSHAL (TPM2B_MAX_BUFFER_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_MAX_NV_BUFFER), -#define TPM2B_NAME_P_UNMARSHAL (TPM2B_MAX_NV_BUFFER_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_NAME), -#define TPM2B_NV_PUBLIC_P_UNMARSHAL (TPM2B_NAME_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_NV_PUBLIC), -#define TPM2B_PRIVATE_P_UNMARSHAL (TPM2B_NV_PUBLIC_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_PRIVATE), -#define TPM2B_PUBLIC_KEY_RSA_P_UNMARSHAL (TPM2B_PRIVATE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_PUBLIC_KEY_RSA), -#define TPM2B_SENSITIVE_P_UNMARSHAL (TPM2B_PUBLIC_KEY_RSA_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_SENSITIVE), -#define TPM2B_SENSITIVE_CREATE_P_UNMARSHAL (TPM2B_SENSITIVE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_SENSITIVE_CREATE), -#define TPM2B_SENSITIVE_DATA_P_UNMARSHAL (TPM2B_SENSITIVE_CREATE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_SENSITIVE_DATA), -#define TPM2B_TEMPLATE_P_UNMARSHAL (TPM2B_SENSITIVE_DATA_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_TEMPLATE), -#define TPM2B_TIMEOUT_P_UNMARSHAL (TPM2B_TEMPLATE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_TIMEOUT), -#define TPMI_DH_CONTEXT_P_UNMARSHAL (TPM2B_TIMEOUT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_DH_CONTEXT), -#define TPMI_DH_PERSISTENT_P_UNMARSHAL (TPMI_DH_CONTEXT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_DH_PERSISTENT), -#define TPMI_ECC_CURVE_P_UNMARSHAL (TPMI_DH_PERSISTENT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_ECC_CURVE), -#define TPMI_YES_NO_P_UNMARSHAL (TPMI_ECC_CURVE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_YES_NO), -#define TPML_ALG_P_UNMARSHAL (TPMI_YES_NO_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPML_ALG), -#define TPML_CC_P_UNMARSHAL (TPML_ALG_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPML_CC), -#define TPML_DIGEST_P_UNMARSHAL (TPML_CC_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPML_DIGEST), -#define TPML_DIGEST_VALUES_P_UNMARSHAL (TPML_DIGEST_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPML_DIGEST_VALUES), -#define TPML_PCR_SELECTION_P_UNMARSHAL (TPML_DIGEST_VALUES_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPML_PCR_SELECTION), -#define TPMS_CONTEXT_P_UNMARSHAL (TPML_PCR_SELECTION_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMS_CONTEXT), -#define TPMT_PUBLIC_PARMS_P_UNMARSHAL (TPMS_CONTEXT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_PUBLIC_PARMS), -#define TPMT_TK_AUTH_P_UNMARSHAL (TPMT_PUBLIC_PARMS_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_TK_AUTH), -#define TPMT_TK_CREATION_P_UNMARSHAL (TPMT_TK_AUTH_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_TK_CREATION), -#define TPMT_TK_HASHCHECK_P_UNMARSHAL (TPMT_TK_CREATION_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_TK_HASHCHECK), -#define TPMT_TK_VERIFIED_P_UNMARSHAL (TPMT_TK_HASHCHECK_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_TK_VERIFIED), -#define TPM_AT_P_UNMARSHAL (TPMT_TK_VERIFIED_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM_AT), -#define TPM_CAP_P_UNMARSHAL (TPM_AT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM_CAP), -#define TPM_CLOCK_ADJUST_P_UNMARSHAL (TPM_CAP_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM_CLOCK_ADJUST), -#define TPM_EO_P_UNMARSHAL (TPM_CLOCK_ADJUST_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM_EO), -#define TPM_SE_P_UNMARSHAL (TPM_EO_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM_SE), -#define TPM_SU_P_UNMARSHAL (TPM_SE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM_SU), -#define UINT16_P_UNMARSHAL (TPM_SU_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(UINT16), -#define UINT32_P_UNMARSHAL (UINT16_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(UINT32), -#define UINT64_P_UNMARSHAL (UINT32_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(UINT64), -#define UINT8_P_UNMARSHAL (UINT64_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(UINT8), -// PARAMETER_FIRST_FLAG_TYPE is the first parameter to need a flag. -#define PARAMETER_FIRST_FLAG_TYPE (UINT8_P_UNMARSHAL + 1) -#define TPM2B_PUBLIC_P_UNMARSHAL (UINT8_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPM2B_PUBLIC), -#define TPMI_ALG_CIPHER_MODE_P_UNMARSHAL (TPM2B_PUBLIC_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_ALG_CIPHER_MODE), -#define TPMI_ALG_HASH_P_UNMARSHAL (TPMI_ALG_CIPHER_MODE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_ALG_HASH), -#define TPMI_ALG_MAC_SCHEME_P_UNMARSHAL (TPMI_ALG_HASH_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_ALG_MAC_SCHEME), -#define TPMI_DH_PCR_P_UNMARSHAL (TPMI_ALG_MAC_SCHEME_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_DH_PCR), -#define TPMI_ECC_KEY_EXCHANGE_P_UNMARSHAL (TPMI_DH_PCR_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_ECC_KEY_EXCHANGE), -#define TPMI_RH_ENABLES_P_UNMARSHAL (TPMI_ECC_KEY_EXCHANGE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_ENABLES), -#define TPMI_RH_HIERARCHY_P_UNMARSHAL (TPMI_RH_ENABLES_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMI_RH_HIERARCHY), -#define TPMT_RSA_DECRYPT_P_UNMARSHAL (TPMI_RH_HIERARCHY_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_RSA_DECRYPT), -#define TPMT_SIGNATURE_P_UNMARSHAL (TPMT_RSA_DECRYPT_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_SIGNATURE), -#define TPMT_SIG_SCHEME_P_UNMARSHAL (TPMT_SIGNATURE_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_SIG_SCHEME), -#define TPMT_SYM_DEF_P_UNMARSHAL (TPMT_SIG_SCHEME_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_SYM_DEF), -#define TPMT_SYM_DEF_OBJECT_P_UNMARSHAL (TPMT_SYM_DEF_P_UNMARSHAL + 1) - UNMARSHAL_DISPATCH(TPMT_SYM_DEF_OBJECT) -// PARAMETER_LAST_TYPE is the end of the command parameter list. -#define PARAMETER_LAST_TYPE (TPMT_SYM_DEF_OBJECT_P_UNMARSHAL) -}; - -// The MarshalArray contains the dispatch functions for the marshaling code. -// The defines in this array are used to make it easier to cross reference the -// marshaling values in the types array of each command -const _MARSHAL_T_ MarshalArray[] = { - -#define UINT32_H_MARSHAL 0 - MARSHAL_DISPATCH(UINT32), -// RESPONSE_PARAMETER_FIRST_TYPE marks the end of the response handles. -#define RESPONSE_PARAMETER_FIRST_TYPE (UINT32_H_MARSHAL + 1) -#define TPM2B_ATTEST_P_MARSHAL (UINT32_H_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_ATTEST), -#define TPM2B_CREATION_DATA_P_MARSHAL (TPM2B_ATTEST_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_CREATION_DATA), -#define TPM2B_DATA_P_MARSHAL (TPM2B_CREATION_DATA_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_DATA), -#define TPM2B_DIGEST_P_MARSHAL (TPM2B_DATA_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_DIGEST), -#define TPM2B_ECC_POINT_P_MARSHAL (TPM2B_DIGEST_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_ECC_POINT), -#define TPM2B_ENCRYPTED_SECRET_P_MARSHAL (TPM2B_ECC_POINT_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_ENCRYPTED_SECRET), -#define TPM2B_ID_OBJECT_P_MARSHAL (TPM2B_ENCRYPTED_SECRET_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_ID_OBJECT), -#define TPM2B_IV_P_MARSHAL (TPM2B_ID_OBJECT_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_IV), -#define TPM2B_MAX_BUFFER_P_MARSHAL (TPM2B_IV_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_MAX_BUFFER), -#define TPM2B_MAX_NV_BUFFER_P_MARSHAL (TPM2B_MAX_BUFFER_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_MAX_NV_BUFFER), -#define TPM2B_NAME_P_MARSHAL (TPM2B_MAX_NV_BUFFER_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_NAME), -#define TPM2B_NV_PUBLIC_P_MARSHAL (TPM2B_NAME_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_NV_PUBLIC), -#define TPM2B_PRIVATE_P_MARSHAL (TPM2B_NV_PUBLIC_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_PRIVATE), -#define TPM2B_PUBLIC_P_MARSHAL (TPM2B_PRIVATE_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_PUBLIC), -#define TPM2B_PUBLIC_KEY_RSA_P_MARSHAL (TPM2B_PUBLIC_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_PUBLIC_KEY_RSA), -#define TPM2B_SENSITIVE_DATA_P_MARSHAL (TPM2B_PUBLIC_KEY_RSA_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_SENSITIVE_DATA), -#define TPM2B_TIMEOUT_P_MARSHAL (TPM2B_SENSITIVE_DATA_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPM2B_TIMEOUT), -#define UINT8_P_MARSHAL (TPM2B_TIMEOUT_P_MARSHAL + 1) - MARSHAL_DISPATCH(UINT8), -#define TPML_AC_CAPABILITIES_P_MARSHAL (UINT8_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPML_AC_CAPABILITIES), -#define TPML_ALG_P_MARSHAL (TPML_AC_CAPABILITIES_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPML_ALG), -#define TPML_DIGEST_P_MARSHAL (TPML_ALG_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPML_DIGEST), -#define TPML_DIGEST_VALUES_P_MARSHAL (TPML_DIGEST_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPML_DIGEST_VALUES), -#define TPML_PCR_SELECTION_P_MARSHAL (TPML_DIGEST_VALUES_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPML_PCR_SELECTION), -#define TPMS_AC_OUTPUT_P_MARSHAL (TPML_PCR_SELECTION_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMS_AC_OUTPUT), -#define TPMS_ALGORITHM_DETAIL_ECC_P_MARSHAL (TPMS_AC_OUTPUT_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMS_ALGORITHM_DETAIL_ECC), -#define TPMS_CAPABILITY_DATA_P_MARSHAL \ - (TPMS_ALGORITHM_DETAIL_ECC_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMS_CAPABILITY_DATA), -#define TPMS_CONTEXT_P_MARSHAL (TPMS_CAPABILITY_DATA_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMS_CONTEXT), -#define TPMS_TIME_INFO_P_MARSHAL (TPMS_CONTEXT_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMS_TIME_INFO), -#define TPMT_HA_P_MARSHAL (TPMS_TIME_INFO_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMT_HA), -#define TPMT_SIGNATURE_P_MARSHAL (TPMT_HA_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMT_SIGNATURE), -#define TPMT_TK_AUTH_P_MARSHAL (TPMT_SIGNATURE_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMT_TK_AUTH), -#define TPMT_TK_CREATION_P_MARSHAL (TPMT_TK_AUTH_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMT_TK_CREATION), -#define TPMT_TK_HASHCHECK_P_MARSHAL (TPMT_TK_CREATION_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMT_TK_HASHCHECK), -#define TPMT_TK_VERIFIED_P_MARSHAL (TPMT_TK_HASHCHECK_P_MARSHAL + 1) - MARSHAL_DISPATCH(TPMT_TK_VERIFIED), -#define UINT32_P_MARSHAL (TPMT_TK_VERIFIED_P_MARSHAL + 1) - MARSHAL_DISPATCH(UINT32), -#define UINT16_P_MARSHAL (UINT32_P_MARSHAL + 1) - MARSHAL_DISPATCH(UINT16) -// RESPONSE_PARAMETER_LAST_TYPE is the end of the response parameter list. -#define RESPONSE_PARAMETER_LAST_TYPE (UINT16_P_MARSHAL) -}; - -// This list of aliases allows the types in the _COMMAND_DESCRIPTOR_T to match the -// types in the command/response templates of part 3. -#define INT32_P_UNMARSHAL UINT32_P_UNMARSHAL -#define TPM2B_AUTH_P_UNMARSHAL TPM2B_DIGEST_P_UNMARSHAL -#define TPM2B_NONCE_P_UNMARSHAL TPM2B_DIGEST_P_UNMARSHAL -#define TPM2B_OPERAND_P_UNMARSHAL TPM2B_DIGEST_P_UNMARSHAL -#define TPMA_LOCALITY_P_UNMARSHAL UINT8_P_UNMARSHAL -#define TPM_CC_P_UNMARSHAL UINT32_P_UNMARSHAL -#define TPMI_DH_CONTEXT_H_MARSHAL UINT32_H_MARSHAL -#define TPMI_DH_OBJECT_H_MARSHAL UINT32_H_MARSHAL -#define TPMI_SH_AUTH_SESSION_H_MARSHAL UINT32_H_MARSHAL -#define TPM_HANDLE_H_MARSHAL UINT32_H_MARSHAL -#define TPM2B_NONCE_P_MARSHAL TPM2B_DIGEST_P_MARSHAL -#define TPMI_YES_NO_P_MARSHAL UINT8_P_MARSHAL -#define TPM_RC_P_MARSHAL UINT32_P_MARSHAL - - -#if CC_Startup - -#include "Startup_fp.h" - -typedef TPM_RC (Startup_Entry)( - Startup_In *in -); - -typedef const struct { - Startup_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} Startup_COMMAND_DESCRIPTOR_t; - -Startup_COMMAND_DESCRIPTOR_t _StartupData = { - /* entry */ &TPM2_Startup, - /* inSize */ (UINT16)(sizeof(Startup_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(Startup_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPM_SU_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _StartupDataAddress (&_StartupData) -#else -#define _StartupDataAddress 0 -#endif // CC_Startup - -#if CC_Shutdown - -#include "Shutdown_fp.h" - -typedef TPM_RC (Shutdown_Entry)( - Shutdown_In *in -); - -typedef const struct { - Shutdown_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} Shutdown_COMMAND_DESCRIPTOR_t; - -Shutdown_COMMAND_DESCRIPTOR_t _ShutdownData = { - /* entry */ &TPM2_Shutdown, - /* inSize */ (UINT16)(sizeof(Shutdown_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(Shutdown_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPM_SU_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _ShutdownDataAddress (&_ShutdownData) -#else -#define _ShutdownDataAddress 0 -#endif // CC_Shutdown - -#if CC_SelfTest - -#include "SelfTest_fp.h" - -typedef TPM_RC (SelfTest_Entry)( - SelfTest_In *in -); - -typedef const struct { - SelfTest_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} SelfTest_COMMAND_DESCRIPTOR_t; - -SelfTest_COMMAND_DESCRIPTOR_t _SelfTestData = { - /* entry */ &TPM2_SelfTest, - /* inSize */ (UINT16)(sizeof(SelfTest_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(SelfTest_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_YES_NO_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _SelfTestDataAddress (&_SelfTestData) -#else -#define _SelfTestDataAddress 0 -#endif // CC_SelfTest - -#if CC_IncrementalSelfTest - -#include "IncrementalSelfTest_fp.h" - -typedef TPM_RC (IncrementalSelfTest_Entry)( - IncrementalSelfTest_In *in, - IncrementalSelfTest_Out *out -); - -typedef const struct { - IncrementalSelfTest_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} IncrementalSelfTest_COMMAND_DESCRIPTOR_t; - -IncrementalSelfTest_COMMAND_DESCRIPTOR_t _IncrementalSelfTestData = { - /* entry */ &TPM2_IncrementalSelfTest, - /* inSize */ (UINT16)(sizeof(IncrementalSelfTest_In)), - /* outSize */ (UINT16)(sizeof(IncrementalSelfTest_Out)), - /* offsetOfTypes */ offsetof(IncrementalSelfTest_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPML_ALG_P_UNMARSHAL, - END_OF_LIST, - TPML_ALG_P_MARSHAL, - END_OF_LIST} -}; - -#define _IncrementalSelfTestDataAddress (&_IncrementalSelfTestData) -#else -#define _IncrementalSelfTestDataAddress 0 -#endif // CC_IncrementalSelfTest - -#if CC_GetTestResult - -#include "GetTestResult_fp.h" - -typedef TPM_RC (GetTestResult_Entry)( - GetTestResult_Out *out -); - -typedef const struct { - GetTestResult_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} GetTestResult_COMMAND_DESCRIPTOR_t; - -GetTestResult_COMMAND_DESCRIPTOR_t _GetTestResultData = { - /* entry */ &TPM2_GetTestResult, - /* inSize */ 0, - /* outSize */ (UINT16)(sizeof(GetTestResult_Out)), - /* offsetOfTypes */ offsetof(GetTestResult_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(GetTestResult_Out, testResult))}, - /* types */ {END_OF_LIST, - TPM2B_MAX_BUFFER_P_MARSHAL, - TPM_RC_P_MARSHAL, - END_OF_LIST} -}; - -#define _GetTestResultDataAddress (&_GetTestResultData) -#else -#define _GetTestResultDataAddress 0 -#endif // CC_GetTestResult - -#if CC_StartAuthSession - -#include "StartAuthSession_fp.h" - -typedef TPM_RC (StartAuthSession_Entry)( - StartAuthSession_In *in, - StartAuthSession_Out *out -); - -typedef const struct { - StartAuthSession_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[7]; - BYTE types[11]; -} StartAuthSession_COMMAND_DESCRIPTOR_t; - -StartAuthSession_COMMAND_DESCRIPTOR_t _StartAuthSessionData = { - /* entry */ &TPM2_StartAuthSession, - /* inSize */ (UINT16)(sizeof(StartAuthSession_In)), - /* outSize */ (UINT16)(sizeof(StartAuthSession_Out)), - /* offsetOfTypes */ offsetof(StartAuthSession_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(StartAuthSession_In, bind)), - (UINT16)(offsetof(StartAuthSession_In, nonceCaller)), - (UINT16)(offsetof(StartAuthSession_In, encryptedSalt)), - (UINT16)(offsetof(StartAuthSession_In, sessionType)), - (UINT16)(offsetof(StartAuthSession_In, symmetric)), - (UINT16)(offsetof(StartAuthSession_In, authHash)), - (UINT16)(offsetof(StartAuthSession_Out, nonceTPM))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPMI_DH_ENTITY_H_UNMARSHAL + ADD_FLAG, - TPM2B_NONCE_P_UNMARSHAL, - TPM2B_ENCRYPTED_SECRET_P_UNMARSHAL, - TPM_SE_P_UNMARSHAL, - TPMT_SYM_DEF_P_UNMARSHAL + ADD_FLAG, - TPMI_ALG_HASH_P_UNMARSHAL, - END_OF_LIST, - TPMI_SH_AUTH_SESSION_H_MARSHAL, - TPM2B_NONCE_P_MARSHAL, - END_OF_LIST} -}; - -#define _StartAuthSessionDataAddress (&_StartAuthSessionData) -#else -#define _StartAuthSessionDataAddress 0 -#endif // CC_StartAuthSession - -#if CC_PolicyRestart - -#include "PolicyRestart_fp.h" - -typedef TPM_RC (PolicyRestart_Entry)( - PolicyRestart_In *in -); - -typedef const struct { - PolicyRestart_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} PolicyRestart_COMMAND_DESCRIPTOR_t; - -PolicyRestart_COMMAND_DESCRIPTOR_t _PolicyRestartData = { - /* entry */ &TPM2_PolicyRestart, - /* inSize */ (UINT16)(sizeof(PolicyRestart_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyRestart_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyRestartDataAddress (&_PolicyRestartData) -#else -#define _PolicyRestartDataAddress 0 -#endif // CC_PolicyRestart - -#if CC_Create - -#include "Create_fp.h" - -typedef TPM_RC (Create_Entry)( - Create_In *in, - Create_Out *out -); - -typedef const struct { - Create_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[8]; - BYTE types[12]; -} Create_COMMAND_DESCRIPTOR_t; - -Create_COMMAND_DESCRIPTOR_t _CreateData = { - /* entry */ &TPM2_Create, - /* inSize */ (UINT16)(sizeof(Create_In)), - /* outSize */ (UINT16)(sizeof(Create_Out)), - /* offsetOfTypes */ offsetof(Create_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Create_In, inSensitive)), - (UINT16)(offsetof(Create_In, inPublic)), - (UINT16)(offsetof(Create_In, outsideInfo)), - (UINT16)(offsetof(Create_In, creationPCR)), - (UINT16)(offsetof(Create_Out, outPublic)), - (UINT16)(offsetof(Create_Out, creationData)), - (UINT16)(offsetof(Create_Out, creationHash)), - (UINT16)(offsetof(Create_Out, creationTicket))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_SENSITIVE_CREATE_P_UNMARSHAL, - TPM2B_PUBLIC_P_UNMARSHAL, - TPM2B_DATA_P_UNMARSHAL, - TPML_PCR_SELECTION_P_UNMARSHAL, - END_OF_LIST, - TPM2B_PRIVATE_P_MARSHAL, - TPM2B_PUBLIC_P_MARSHAL, - TPM2B_CREATION_DATA_P_MARSHAL, - TPM2B_DIGEST_P_MARSHAL, - TPMT_TK_CREATION_P_MARSHAL, - END_OF_LIST} -}; - -#define _CreateDataAddress (&_CreateData) -#else -#define _CreateDataAddress 0 -#endif // CC_Create - -#if CC_Load - -#include "Load_fp.h" - -typedef TPM_RC (Load_Entry)( - Load_In *in, - Load_Out *out -); - -typedef const struct { - Load_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} Load_COMMAND_DESCRIPTOR_t; - -Load_COMMAND_DESCRIPTOR_t _LoadData = { - /* entry */ &TPM2_Load, - /* inSize */ (UINT16)(sizeof(Load_In)), - /* outSize */ (UINT16)(sizeof(Load_Out)), - /* offsetOfTypes */ offsetof(Load_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Load_In, inPrivate)), - (UINT16)(offsetof(Load_In, inPublic)), - (UINT16)(offsetof(Load_Out, name))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_PRIVATE_P_UNMARSHAL, - TPM2B_PUBLIC_P_UNMARSHAL, - END_OF_LIST, - TPM_HANDLE_H_MARSHAL, - TPM2B_NAME_P_MARSHAL, - END_OF_LIST} -}; - -#define _LoadDataAddress (&_LoadData) -#else -#define _LoadDataAddress 0 -#endif // CC_Load - -#if CC_LoadExternal - -#include "LoadExternal_fp.h" - -typedef TPM_RC (LoadExternal_Entry)( - LoadExternal_In *in, - LoadExternal_Out *out -); - -typedef const struct { - LoadExternal_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} LoadExternal_COMMAND_DESCRIPTOR_t; - -LoadExternal_COMMAND_DESCRIPTOR_t _LoadExternalData = { - /* entry */ &TPM2_LoadExternal, - /* inSize */ (UINT16)(sizeof(LoadExternal_In)), - /* outSize */ (UINT16)(sizeof(LoadExternal_Out)), - /* offsetOfTypes */ offsetof(LoadExternal_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(LoadExternal_In, inPublic)), - (UINT16)(offsetof(LoadExternal_In, hierarchy)), - (UINT16)(offsetof(LoadExternal_Out, name))}, - /* types */ {TPM2B_SENSITIVE_P_UNMARSHAL, - TPM2B_PUBLIC_P_UNMARSHAL + ADD_FLAG, - TPMI_RH_HIERARCHY_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM_HANDLE_H_MARSHAL, - TPM2B_NAME_P_MARSHAL, - END_OF_LIST} -}; - -#define _LoadExternalDataAddress (&_LoadExternalData) -#else -#define _LoadExternalDataAddress 0 -#endif // CC_LoadExternal - -#if CC_ReadPublic - -#include "ReadPublic_fp.h" - -typedef TPM_RC (ReadPublic_Entry)( - ReadPublic_In *in, - ReadPublic_Out *out -); - -typedef const struct { - ReadPublic_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} ReadPublic_COMMAND_DESCRIPTOR_t; - -ReadPublic_COMMAND_DESCRIPTOR_t _ReadPublicData = { - /* entry */ &TPM2_ReadPublic, - /* inSize */ (UINT16)(sizeof(ReadPublic_In)), - /* outSize */ (UINT16)(sizeof(ReadPublic_Out)), - /* offsetOfTypes */ offsetof(ReadPublic_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ReadPublic_Out, name)), - (UINT16)(offsetof(ReadPublic_Out, qualifiedName))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - END_OF_LIST, - TPM2B_PUBLIC_P_MARSHAL, - TPM2B_NAME_P_MARSHAL, - TPM2B_NAME_P_MARSHAL, - END_OF_LIST} -}; - -#define _ReadPublicDataAddress (&_ReadPublicData) -#else -#define _ReadPublicDataAddress 0 -#endif // CC_ReadPublic - -#if CC_ActivateCredential - -#include "ActivateCredential_fp.h" - -typedef TPM_RC (ActivateCredential_Entry)( - ActivateCredential_In *in, - ActivateCredential_Out *out -); - -typedef const struct { - ActivateCredential_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} ActivateCredential_COMMAND_DESCRIPTOR_t; - -ActivateCredential_COMMAND_DESCRIPTOR_t _ActivateCredentialData = { - /* entry */ &TPM2_ActivateCredential, - /* inSize */ (UINT16)(sizeof(ActivateCredential_In)), - /* outSize */ (UINT16)(sizeof(ActivateCredential_Out)), - /* offsetOfTypes */ offsetof(ActivateCredential_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ActivateCredential_In, keyHandle)), - (UINT16)(offsetof(ActivateCredential_In, credentialBlob)), - (UINT16)(offsetof(ActivateCredential_In, secret))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_ID_OBJECT_P_UNMARSHAL, - TPM2B_ENCRYPTED_SECRET_P_UNMARSHAL, - END_OF_LIST, - TPM2B_DIGEST_P_MARSHAL, - END_OF_LIST} -}; - -#define _ActivateCredentialDataAddress (&_ActivateCredentialData) -#else -#define _ActivateCredentialDataAddress 0 -#endif // CC_ActivateCredential - -#if CC_MakeCredential - -#include "MakeCredential_fp.h" - -typedef TPM_RC (MakeCredential_Entry)( - MakeCredential_In *in, - MakeCredential_Out *out -); - -typedef const struct { - MakeCredential_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} MakeCredential_COMMAND_DESCRIPTOR_t; - -MakeCredential_COMMAND_DESCRIPTOR_t _MakeCredentialData = { - /* entry */ &TPM2_MakeCredential, - /* inSize */ (UINT16)(sizeof(MakeCredential_In)), - /* outSize */ (UINT16)(sizeof(MakeCredential_Out)), - /* offsetOfTypes */ offsetof(MakeCredential_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(MakeCredential_In, credential)), - (UINT16)(offsetof(MakeCredential_In, objectName)), - (UINT16)(offsetof(MakeCredential_Out, secret))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - END_OF_LIST, - TPM2B_ID_OBJECT_P_MARSHAL, - TPM2B_ENCRYPTED_SECRET_P_MARSHAL, - END_OF_LIST} -}; - -#define _MakeCredentialDataAddress (&_MakeCredentialData) -#else -#define _MakeCredentialDataAddress 0 -#endif // CC_MakeCredential - -#if CC_Unseal - -#include "Unseal_fp.h" - -typedef TPM_RC (Unseal_Entry)( - Unseal_In *in, - Unseal_Out *out -); - -typedef const struct { - Unseal_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} Unseal_COMMAND_DESCRIPTOR_t; - -Unseal_COMMAND_DESCRIPTOR_t _UnsealData = { - /* entry */ &TPM2_Unseal, - /* inSize */ (UINT16)(sizeof(Unseal_In)), - /* outSize */ (UINT16)(sizeof(Unseal_Out)), - /* offsetOfTypes */ offsetof(Unseal_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - END_OF_LIST, - TPM2B_SENSITIVE_DATA_P_MARSHAL, - END_OF_LIST} -}; - -#define _UnsealDataAddress (&_UnsealData) -#else -#define _UnsealDataAddress 0 -#endif // CC_Unseal - -#if CC_ObjectChangeAuth - -#include "ObjectChangeAuth_fp.h" - -typedef TPM_RC (ObjectChangeAuth_Entry)( - ObjectChangeAuth_In *in, - ObjectChangeAuth_Out *out -); - -typedef const struct { - ObjectChangeAuth_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} ObjectChangeAuth_COMMAND_DESCRIPTOR_t; - -ObjectChangeAuth_COMMAND_DESCRIPTOR_t _ObjectChangeAuthData = { - /* entry */ &TPM2_ObjectChangeAuth, - /* inSize */ (UINT16)(sizeof(ObjectChangeAuth_In)), - /* outSize */ (UINT16)(sizeof(ObjectChangeAuth_Out)), - /* offsetOfTypes */ offsetof(ObjectChangeAuth_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ObjectChangeAuth_In, parentHandle)), - (UINT16)(offsetof(ObjectChangeAuth_In, newAuth))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_AUTH_P_UNMARSHAL, - END_OF_LIST, - TPM2B_PRIVATE_P_MARSHAL, - END_OF_LIST} -}; - -#define _ObjectChangeAuthDataAddress (&_ObjectChangeAuthData) -#else -#define _ObjectChangeAuthDataAddress 0 -#endif // CC_ObjectChangeAuth - -#if CC_CreateLoaded - -#include "CreateLoaded_fp.h" - -typedef TPM_RC (CreateLoaded_Entry)( - CreateLoaded_In *in, - CreateLoaded_Out *out -); - -typedef const struct { - CreateLoaded_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[9]; -} CreateLoaded_COMMAND_DESCRIPTOR_t; - -CreateLoaded_COMMAND_DESCRIPTOR_t _CreateLoadedData = { - /* entry */ &TPM2_CreateLoaded, - /* inSize */ (UINT16)(sizeof(CreateLoaded_In)), - /* outSize */ (UINT16)(sizeof(CreateLoaded_Out)), - /* offsetOfTypes */ offsetof(CreateLoaded_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(CreateLoaded_In, inSensitive)), - (UINT16)(offsetof(CreateLoaded_In, inPublic)), - (UINT16)(offsetof(CreateLoaded_Out, outPrivate)), - (UINT16)(offsetof(CreateLoaded_Out, outPublic)), - (UINT16)(offsetof(CreateLoaded_Out, name))}, - /* types */ {TPMI_DH_PARENT_H_UNMARSHAL + ADD_FLAG, - TPM2B_SENSITIVE_CREATE_P_UNMARSHAL, - TPM2B_TEMPLATE_P_UNMARSHAL, - END_OF_LIST, - TPM_HANDLE_H_MARSHAL, - TPM2B_PRIVATE_P_MARSHAL, - TPM2B_PUBLIC_P_MARSHAL, - TPM2B_NAME_P_MARSHAL, - END_OF_LIST} -}; - -#define _CreateLoadedDataAddress (&_CreateLoadedData) -#else -#define _CreateLoadedDataAddress 0 -#endif // CC_CreateLoaded - -#if CC_Duplicate - -#include "Duplicate_fp.h" - -typedef TPM_RC (Duplicate_Entry)( - Duplicate_In *in, - Duplicate_Out *out -); - -typedef const struct { - Duplicate_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[9]; -} Duplicate_COMMAND_DESCRIPTOR_t; - -Duplicate_COMMAND_DESCRIPTOR_t _DuplicateData = { - /* entry */ &TPM2_Duplicate, - /* inSize */ (UINT16)(sizeof(Duplicate_In)), - /* outSize */ (UINT16)(sizeof(Duplicate_Out)), - /* offsetOfTypes */ offsetof(Duplicate_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Duplicate_In, newParentHandle)), - (UINT16)(offsetof(Duplicate_In, encryptionKeyIn)), - (UINT16)(offsetof(Duplicate_In, symmetricAlg)), - (UINT16)(offsetof(Duplicate_Out, duplicate)), - (UINT16)(offsetof(Duplicate_Out, outSymSeed))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SYM_DEF_OBJECT_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_DATA_P_MARSHAL, - TPM2B_PRIVATE_P_MARSHAL, - TPM2B_ENCRYPTED_SECRET_P_MARSHAL, - END_OF_LIST} -}; - -#define _DuplicateDataAddress (&_DuplicateData) -#else -#define _DuplicateDataAddress 0 -#endif // CC_Duplicate - -#if CC_Rewrap - -#include "Rewrap_fp.h" - -typedef TPM_RC (Rewrap_Entry)( - Rewrap_In *in, - Rewrap_Out *out -); - -typedef const struct { - Rewrap_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[9]; -} Rewrap_COMMAND_DESCRIPTOR_t; - -Rewrap_COMMAND_DESCRIPTOR_t _RewrapData = { - /* entry */ &TPM2_Rewrap, - /* inSize */ (UINT16)(sizeof(Rewrap_In)), - /* outSize */ (UINT16)(sizeof(Rewrap_Out)), - /* offsetOfTypes */ offsetof(Rewrap_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Rewrap_In, newParent)), - (UINT16)(offsetof(Rewrap_In, inDuplicate)), - (UINT16)(offsetof(Rewrap_In, name)), - (UINT16)(offsetof(Rewrap_In, inSymSeed)), - (UINT16)(offsetof(Rewrap_Out, outSymSeed))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPM2B_PRIVATE_P_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - TPM2B_ENCRYPTED_SECRET_P_UNMARSHAL, - END_OF_LIST, - TPM2B_PRIVATE_P_MARSHAL, - TPM2B_ENCRYPTED_SECRET_P_MARSHAL, - END_OF_LIST} -}; - -#define _RewrapDataAddress (&_RewrapData) -#else -#define _RewrapDataAddress 0 -#endif // CC_Rewrap - -#if CC_Import - -#include "Import_fp.h" - -typedef TPM_RC (Import_Entry)( - Import_In *in, - Import_Out *out -); - -typedef const struct { - Import_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[9]; -} Import_COMMAND_DESCRIPTOR_t; - -Import_COMMAND_DESCRIPTOR_t _ImportData = { - /* entry */ &TPM2_Import, - /* inSize */ (UINT16)(sizeof(Import_In)), - /* outSize */ (UINT16)(sizeof(Import_Out)), - /* offsetOfTypes */ offsetof(Import_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Import_In, encryptionKey)), - (UINT16)(offsetof(Import_In, objectPublic)), - (UINT16)(offsetof(Import_In, duplicate)), - (UINT16)(offsetof(Import_In, inSymSeed)), - (UINT16)(offsetof(Import_In, symmetricAlg))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_DATA_P_UNMARSHAL, - TPM2B_PUBLIC_P_UNMARSHAL, - TPM2B_PRIVATE_P_UNMARSHAL, - TPM2B_ENCRYPTED_SECRET_P_UNMARSHAL, - TPMT_SYM_DEF_OBJECT_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_PRIVATE_P_MARSHAL, - END_OF_LIST} -}; - -#define _ImportDataAddress (&_ImportData) -#else -#define _ImportDataAddress 0 -#endif // CC_Import - -#if CC_RSA_Encrypt - -#include "RSA_Encrypt_fp.h" - -typedef TPM_RC (RSA_Encrypt_Entry)( - RSA_Encrypt_In *in, - RSA_Encrypt_Out *out -); - -typedef const struct { - RSA_Encrypt_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} RSA_Encrypt_COMMAND_DESCRIPTOR_t; - -RSA_Encrypt_COMMAND_DESCRIPTOR_t _RSA_EncryptData = { - /* entry */ &TPM2_RSA_Encrypt, - /* inSize */ (UINT16)(sizeof(RSA_Encrypt_In)), - /* outSize */ (UINT16)(sizeof(RSA_Encrypt_Out)), - /* offsetOfTypes */ offsetof(RSA_Encrypt_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(RSA_Encrypt_In, message)), - (UINT16)(offsetof(RSA_Encrypt_In, inScheme)), - (UINT16)(offsetof(RSA_Encrypt_In, label))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_PUBLIC_KEY_RSA_P_UNMARSHAL, - TPMT_RSA_DECRYPT_P_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - END_OF_LIST, - TPM2B_PUBLIC_KEY_RSA_P_MARSHAL, - END_OF_LIST} -}; - -#define _RSA_EncryptDataAddress (&_RSA_EncryptData) -#else -#define _RSA_EncryptDataAddress 0 -#endif // CC_RSA_Encrypt - -#if CC_RSA_Decrypt - -#include "RSA_Decrypt_fp.h" - -typedef TPM_RC (RSA_Decrypt_Entry)( - RSA_Decrypt_In *in, - RSA_Decrypt_Out *out -); - -typedef const struct { - RSA_Decrypt_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} RSA_Decrypt_COMMAND_DESCRIPTOR_t; - -RSA_Decrypt_COMMAND_DESCRIPTOR_t _RSA_DecryptData = { - /* entry */ &TPM2_RSA_Decrypt, - /* inSize */ (UINT16)(sizeof(RSA_Decrypt_In)), - /* outSize */ (UINT16)(sizeof(RSA_Decrypt_Out)), - /* offsetOfTypes */ offsetof(RSA_Decrypt_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(RSA_Decrypt_In, cipherText)), - (UINT16)(offsetof(RSA_Decrypt_In, inScheme)), - (UINT16)(offsetof(RSA_Decrypt_In, label))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_PUBLIC_KEY_RSA_P_UNMARSHAL, - TPMT_RSA_DECRYPT_P_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - END_OF_LIST, - TPM2B_PUBLIC_KEY_RSA_P_MARSHAL, - END_OF_LIST} -}; - -#define _RSA_DecryptDataAddress (&_RSA_DecryptData) -#else -#define _RSA_DecryptDataAddress 0 -#endif // CC_RSA_Decrypt - -#if CC_ECDH_KeyGen - -#include "ECDH_KeyGen_fp.h" - -typedef TPM_RC (ECDH_KeyGen_Entry)( - ECDH_KeyGen_In *in, - ECDH_KeyGen_Out *out -); - -typedef const struct { - ECDH_KeyGen_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[5]; -} ECDH_KeyGen_COMMAND_DESCRIPTOR_t; - -ECDH_KeyGen_COMMAND_DESCRIPTOR_t _ECDH_KeyGenData = { - /* entry */ &TPM2_ECDH_KeyGen, - /* inSize */ (UINT16)(sizeof(ECDH_KeyGen_In)), - /* outSize */ (UINT16)(sizeof(ECDH_KeyGen_Out)), - /* offsetOfTypes */ offsetof(ECDH_KeyGen_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ECDH_KeyGen_Out, pubPoint))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - END_OF_LIST, - TPM2B_ECC_POINT_P_MARSHAL, - TPM2B_ECC_POINT_P_MARSHAL, - END_OF_LIST} -}; - -#define _ECDH_KeyGenDataAddress (&_ECDH_KeyGenData) -#else -#define _ECDH_KeyGenDataAddress 0 -#endif // CC_ECDH_KeyGen - -#if CC_ECDH_ZGen - -#include "ECDH_ZGen_fp.h" - -typedef TPM_RC (ECDH_ZGen_Entry)( - ECDH_ZGen_In *in, - ECDH_ZGen_Out *out -); - -typedef const struct { - ECDH_ZGen_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[5]; -} ECDH_ZGen_COMMAND_DESCRIPTOR_t; - -ECDH_ZGen_COMMAND_DESCRIPTOR_t _ECDH_ZGenData = { - /* entry */ &TPM2_ECDH_ZGen, - /* inSize */ (UINT16)(sizeof(ECDH_ZGen_In)), - /* outSize */ (UINT16)(sizeof(ECDH_ZGen_Out)), - /* offsetOfTypes */ offsetof(ECDH_ZGen_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ECDH_ZGen_In, inPoint))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_ECC_POINT_P_UNMARSHAL, - END_OF_LIST, - TPM2B_ECC_POINT_P_MARSHAL, - END_OF_LIST} -}; - -#define _ECDH_ZGenDataAddress (&_ECDH_ZGenData) -#else -#define _ECDH_ZGenDataAddress 0 -#endif // CC_ECDH_ZGen - -#if CC_ECC_Parameters - -#include "ECC_Parameters_fp.h" - -typedef TPM_RC (ECC_Parameters_Entry)( - ECC_Parameters_In *in, - ECC_Parameters_Out *out -); - -typedef const struct { - ECC_Parameters_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} ECC_Parameters_COMMAND_DESCRIPTOR_t; - -ECC_Parameters_COMMAND_DESCRIPTOR_t _ECC_ParametersData = { - /* entry */ &TPM2_ECC_Parameters, - /* inSize */ (UINT16)(sizeof(ECC_Parameters_In)), - /* outSize */ (UINT16)(sizeof(ECC_Parameters_Out)), - /* offsetOfTypes */ offsetof(ECC_Parameters_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_ECC_CURVE_P_UNMARSHAL, - END_OF_LIST, - TPMS_ALGORITHM_DETAIL_ECC_P_MARSHAL, - END_OF_LIST} -}; - -#define _ECC_ParametersDataAddress (&_ECC_ParametersData) -#else -#define _ECC_ParametersDataAddress 0 -#endif // CC_ECC_Parameters - -#if CC_ZGen_2Phase - -#include "ZGen_2Phase_fp.h" - -typedef TPM_RC (ZGen_2Phase_Entry)( - ZGen_2Phase_In *in, - ZGen_2Phase_Out *out -); - -typedef const struct { - ZGen_2Phase_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[9]; -} ZGen_2Phase_COMMAND_DESCRIPTOR_t; - -ZGen_2Phase_COMMAND_DESCRIPTOR_t _ZGen_2PhaseData = { - /* entry */ &TPM2_ZGen_2Phase, - /* inSize */ (UINT16)(sizeof(ZGen_2Phase_In)), - /* outSize */ (UINT16)(sizeof(ZGen_2Phase_Out)), - /* offsetOfTypes */ offsetof(ZGen_2Phase_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ZGen_2Phase_In, inQsB)), - (UINT16)(offsetof(ZGen_2Phase_In, inQeB)), - (UINT16)(offsetof(ZGen_2Phase_In, inScheme)), - (UINT16)(offsetof(ZGen_2Phase_In, counter)), - (UINT16)(offsetof(ZGen_2Phase_Out, outZ2))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_ECC_POINT_P_UNMARSHAL, - TPM2B_ECC_POINT_P_UNMARSHAL, - TPMI_ECC_KEY_EXCHANGE_P_UNMARSHAL, - UINT16_P_UNMARSHAL, - END_OF_LIST, - TPM2B_ECC_POINT_P_MARSHAL, - TPM2B_ECC_POINT_P_MARSHAL, - END_OF_LIST} -}; - -#define _ZGen_2PhaseDataAddress (&_ZGen_2PhaseData) -#else -#define _ZGen_2PhaseDataAddress 0 -#endif // CC_ZGen_2Phase - -#if CC_EncryptDecrypt - -#include "EncryptDecrypt_fp.h" - -typedef TPM_RC (EncryptDecrypt_Entry)( - EncryptDecrypt_In *in, - EncryptDecrypt_Out *out -); - -typedef const struct { - EncryptDecrypt_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[9]; -} EncryptDecrypt_COMMAND_DESCRIPTOR_t; - -EncryptDecrypt_COMMAND_DESCRIPTOR_t _EncryptDecryptData = { - /* entry */ &TPM2_EncryptDecrypt, - /* inSize */ (UINT16)(sizeof(EncryptDecrypt_In)), - /* outSize */ (UINT16)(sizeof(EncryptDecrypt_Out)), - /* offsetOfTypes */ offsetof(EncryptDecrypt_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(EncryptDecrypt_In, decrypt)), - (UINT16)(offsetof(EncryptDecrypt_In, mode)), - (UINT16)(offsetof(EncryptDecrypt_In, ivIn)), - (UINT16)(offsetof(EncryptDecrypt_In, inData)), - (UINT16)(offsetof(EncryptDecrypt_Out, ivOut))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_YES_NO_P_UNMARSHAL, - TPMI_ALG_CIPHER_MODE_P_UNMARSHAL + ADD_FLAG, - TPM2B_IV_P_UNMARSHAL, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - END_OF_LIST, - TPM2B_MAX_BUFFER_P_MARSHAL, - TPM2B_IV_P_MARSHAL, - END_OF_LIST} -}; - -#define _EncryptDecryptDataAddress (&_EncryptDecryptData) -#else -#define _EncryptDecryptDataAddress 0 -#endif // CC_EncryptDecrypt - -#if CC_EncryptDecrypt2 - -#include "EncryptDecrypt2_fp.h" - -typedef TPM_RC (EncryptDecrypt2_Entry)( - EncryptDecrypt2_In *in, - EncryptDecrypt2_Out *out -); - -typedef const struct { - EncryptDecrypt2_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[9]; -} EncryptDecrypt2_COMMAND_DESCRIPTOR_t; - -EncryptDecrypt2_COMMAND_DESCRIPTOR_t _EncryptDecrypt2Data = { - /* entry */ &TPM2_EncryptDecrypt2, - /* inSize */ (UINT16)(sizeof(EncryptDecrypt2_In)), - /* outSize */ (UINT16)(sizeof(EncryptDecrypt2_Out)), - /* offsetOfTypes */ offsetof(EncryptDecrypt2_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(EncryptDecrypt2_In, inData)), - (UINT16)(offsetof(EncryptDecrypt2_In, decrypt)), - (UINT16)(offsetof(EncryptDecrypt2_In, mode)), - (UINT16)(offsetof(EncryptDecrypt2_In, ivIn)), - (UINT16)(offsetof(EncryptDecrypt2_Out, ivOut))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - TPMI_YES_NO_P_UNMARSHAL, - TPMI_ALG_CIPHER_MODE_P_UNMARSHAL + ADD_FLAG, - TPM2B_IV_P_UNMARSHAL, - END_OF_LIST, - TPM2B_MAX_BUFFER_P_MARSHAL, - TPM2B_IV_P_MARSHAL, - END_OF_LIST} -}; - -#define _EncryptDecrypt2DataAddress (&_EncryptDecrypt2Data) -#else -#define _EncryptDecrypt2DataAddress 0 -#endif // CC_EncryptDecrypt2 - -#if CC_Hash - -#include "Hash_fp.h" - -typedef TPM_RC (Hash_Entry)( - Hash_In *in, - Hash_Out *out -); - -typedef const struct { - Hash_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} Hash_COMMAND_DESCRIPTOR_t; - -Hash_COMMAND_DESCRIPTOR_t _HashData = { - /* entry */ &TPM2_Hash, - /* inSize */ (UINT16)(sizeof(Hash_In)), - /* outSize */ (UINT16)(sizeof(Hash_Out)), - /* offsetOfTypes */ offsetof(Hash_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Hash_In, hashAlg)), - (UINT16)(offsetof(Hash_In, hierarchy)), - (UINT16)(offsetof(Hash_Out, validation))}, - /* types */ {TPM2B_MAX_BUFFER_P_UNMARSHAL, - TPMI_ALG_HASH_P_UNMARSHAL, - TPMI_RH_HIERARCHY_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_DIGEST_P_MARSHAL, - TPMT_TK_HASHCHECK_P_MARSHAL, - END_OF_LIST} -}; - -#define _HashDataAddress (&_HashData) -#else -#define _HashDataAddress 0 -#endif // CC_Hash - -#if CC_HMAC - -#include "HMAC_fp.h" - -typedef TPM_RC (HMAC_Entry)( - HMAC_In *in, - HMAC_Out *out -); - -typedef const struct { - HMAC_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} HMAC_COMMAND_DESCRIPTOR_t; - -HMAC_COMMAND_DESCRIPTOR_t _HMACData = { - /* entry */ &TPM2_HMAC, - /* inSize */ (UINT16)(sizeof(HMAC_In)), - /* outSize */ (UINT16)(sizeof(HMAC_Out)), - /* offsetOfTypes */ offsetof(HMAC_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(HMAC_In, buffer)), - (UINT16)(offsetof(HMAC_In, hashAlg))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - TPMI_ALG_HASH_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_DIGEST_P_MARSHAL, - END_OF_LIST} -}; - -#define _HMACDataAddress (&_HMACData) -#else -#define _HMACDataAddress 0 -#endif // CC_HMAC - -#if CC_MAC - -#include "MAC_fp.h" - -typedef TPM_RC (MAC_Entry)( - MAC_In *in, - MAC_Out *out -); - -typedef const struct { - MAC_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} MAC_COMMAND_DESCRIPTOR_t; - -MAC_COMMAND_DESCRIPTOR_t _MACData = { - /* entry */ &TPM2_MAC, - /* inSize */ (UINT16)(sizeof(MAC_In)), - /* outSize */ (UINT16)(sizeof(MAC_Out)), - /* offsetOfTypes */ offsetof(MAC_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(MAC_In, buffer)), - (UINT16)(offsetof(MAC_In, inScheme))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - TPMI_ALG_MAC_SCHEME_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_DIGEST_P_MARSHAL, - END_OF_LIST} -}; - -#define _MACDataAddress (&_MACData) -#else -#define _MACDataAddress 0 -#endif // CC_MAC - -#if CC_GetRandom - -#include "GetRandom_fp.h" - -typedef TPM_RC (GetRandom_Entry)( - GetRandom_In *in, - GetRandom_Out *out -); - -typedef const struct { - GetRandom_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} GetRandom_COMMAND_DESCRIPTOR_t; - -GetRandom_COMMAND_DESCRIPTOR_t _GetRandomData = { - /* entry */ &TPM2_GetRandom, - /* inSize */ (UINT16)(sizeof(GetRandom_In)), - /* outSize */ (UINT16)(sizeof(GetRandom_Out)), - /* offsetOfTypes */ offsetof(GetRandom_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {UINT16_P_UNMARSHAL, - END_OF_LIST, - TPM2B_DIGEST_P_MARSHAL, - END_OF_LIST} -}; - -#define _GetRandomDataAddress (&_GetRandomData) -#else -#define _GetRandomDataAddress 0 -#endif // CC_GetRandom - -#if CC_StirRandom - -#include "StirRandom_fp.h" - -typedef TPM_RC (StirRandom_Entry)( - StirRandom_In *in -); - -typedef const struct { - StirRandom_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} StirRandom_COMMAND_DESCRIPTOR_t; - -StirRandom_COMMAND_DESCRIPTOR_t _StirRandomData = { - /* entry */ &TPM2_StirRandom, - /* inSize */ (UINT16)(sizeof(StirRandom_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(StirRandom_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPM2B_SENSITIVE_DATA_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _StirRandomDataAddress (&_StirRandomData) -#else -#define _StirRandomDataAddress 0 -#endif // CC_StirRandom - -#if CC_HMAC_Start - -#include "HMAC_Start_fp.h" - -typedef TPM_RC (HMAC_Start_Entry)( - HMAC_Start_In *in, - HMAC_Start_Out *out -); - -typedef const struct { - HMAC_Start_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} HMAC_Start_COMMAND_DESCRIPTOR_t; - -HMAC_Start_COMMAND_DESCRIPTOR_t _HMAC_StartData = { - /* entry */ &TPM2_HMAC_Start, - /* inSize */ (UINT16)(sizeof(HMAC_Start_In)), - /* outSize */ (UINT16)(sizeof(HMAC_Start_Out)), - /* offsetOfTypes */ offsetof(HMAC_Start_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(HMAC_Start_In, auth)), - (UINT16)(offsetof(HMAC_Start_In, hashAlg))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_AUTH_P_UNMARSHAL, - TPMI_ALG_HASH_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPMI_DH_OBJECT_H_MARSHAL, - END_OF_LIST} -}; - -#define _HMAC_StartDataAddress (&_HMAC_StartData) -#else -#define _HMAC_StartDataAddress 0 -#endif // CC_HMAC_Start - -#if CC_MAC_Start - -#include "MAC_Start_fp.h" - -typedef TPM_RC (MAC_Start_Entry)( - MAC_Start_In *in, - MAC_Start_Out *out -); - -typedef const struct { - MAC_Start_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} MAC_Start_COMMAND_DESCRIPTOR_t; - -MAC_Start_COMMAND_DESCRIPTOR_t _MAC_StartData = { - /* entry */ &TPM2_MAC_Start, - /* inSize */ (UINT16)(sizeof(MAC_Start_In)), - /* outSize */ (UINT16)(sizeof(MAC_Start_Out)), - /* offsetOfTypes */ offsetof(MAC_Start_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(MAC_Start_In, auth)), - (UINT16)(offsetof(MAC_Start_In, inScheme))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_AUTH_P_UNMARSHAL, - TPMI_ALG_MAC_SCHEME_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPMI_DH_OBJECT_H_MARSHAL, - END_OF_LIST} -}; - -#define _MAC_StartDataAddress (&_MAC_StartData) -#else -#define _MAC_StartDataAddress 0 -#endif // CC_MAC_Start - -#if CC_HashSequenceStart - -#include "HashSequenceStart_fp.h" - -typedef TPM_RC (HashSequenceStart_Entry)( - HashSequenceStart_In *in, - HashSequenceStart_Out *out -); - -typedef const struct { - HashSequenceStart_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[5]; -} HashSequenceStart_COMMAND_DESCRIPTOR_t; - -HashSequenceStart_COMMAND_DESCRIPTOR_t _HashSequenceStartData = { - /* entry */ &TPM2_HashSequenceStart, - /* inSize */ (UINT16)(sizeof(HashSequenceStart_In)), - /* outSize */ (UINT16)(sizeof(HashSequenceStart_Out)), - /* offsetOfTypes */ offsetof(HashSequenceStart_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(HashSequenceStart_In, hashAlg))}, - /* types */ {TPM2B_AUTH_P_UNMARSHAL, - TPMI_ALG_HASH_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPMI_DH_OBJECT_H_MARSHAL, - END_OF_LIST} -}; - -#define _HashSequenceStartDataAddress (&_HashSequenceStartData) -#else -#define _HashSequenceStartDataAddress 0 -#endif // CC_HashSequenceStart - -#if CC_SequenceUpdate - -#include "SequenceUpdate_fp.h" - -typedef TPM_RC (SequenceUpdate_Entry)( - SequenceUpdate_In *in -); - -typedef const struct { - SequenceUpdate_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} SequenceUpdate_COMMAND_DESCRIPTOR_t; - -SequenceUpdate_COMMAND_DESCRIPTOR_t _SequenceUpdateData = { - /* entry */ &TPM2_SequenceUpdate, - /* inSize */ (UINT16)(sizeof(SequenceUpdate_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(SequenceUpdate_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(SequenceUpdate_In, buffer))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _SequenceUpdateDataAddress (&_SequenceUpdateData) -#else -#define _SequenceUpdateDataAddress 0 -#endif // CC_SequenceUpdate - -#if CC_SequenceComplete - -#include "SequenceComplete_fp.h" - -typedef TPM_RC (SequenceComplete_Entry)( - SequenceComplete_In *in, - SequenceComplete_Out *out -); - -typedef const struct { - SequenceComplete_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} SequenceComplete_COMMAND_DESCRIPTOR_t; - -SequenceComplete_COMMAND_DESCRIPTOR_t _SequenceCompleteData = { - /* entry */ &TPM2_SequenceComplete, - /* inSize */ (UINT16)(sizeof(SequenceComplete_In)), - /* outSize */ (UINT16)(sizeof(SequenceComplete_Out)), - /* offsetOfTypes */ offsetof(SequenceComplete_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(SequenceComplete_In, buffer)), - (UINT16)(offsetof(SequenceComplete_In, hierarchy)), - (UINT16)(offsetof(SequenceComplete_Out, validation))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - TPMI_RH_HIERARCHY_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_DIGEST_P_MARSHAL, - TPMT_TK_HASHCHECK_P_MARSHAL, - END_OF_LIST} -}; - -#define _SequenceCompleteDataAddress (&_SequenceCompleteData) -#else -#define _SequenceCompleteDataAddress 0 -#endif // CC_SequenceComplete - -#if CC_EventSequenceComplete - -#include "EventSequenceComplete_fp.h" - -typedef TPM_RC (EventSequenceComplete_Entry)( - EventSequenceComplete_In *in, - EventSequenceComplete_Out *out -); - -typedef const struct { - EventSequenceComplete_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} EventSequenceComplete_COMMAND_DESCRIPTOR_t; - -EventSequenceComplete_COMMAND_DESCRIPTOR_t _EventSequenceCompleteData = { - /* entry */ &TPM2_EventSequenceComplete, - /* inSize */ (UINT16)(sizeof(EventSequenceComplete_In)), - /* outSize */ (UINT16)(sizeof(EventSequenceComplete_Out)), - /* offsetOfTypes */ offsetof(EventSequenceComplete_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(EventSequenceComplete_In, sequenceHandle)), - (UINT16)(offsetof(EventSequenceComplete_In, buffer))}, - /* types */ {TPMI_DH_PCR_H_UNMARSHAL + ADD_FLAG, - TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - END_OF_LIST, - TPML_DIGEST_VALUES_P_MARSHAL, - END_OF_LIST} -}; - -#define _EventSequenceCompleteDataAddress (&_EventSequenceCompleteData) -#else -#define _EventSequenceCompleteDataAddress 0 -#endif // CC_EventSequenceComplete - -#if CC_Certify - -#include "Certify_fp.h" - -typedef TPM_RC (Certify_Entry)( - Certify_In *in, - Certify_Out *out -); - -typedef const struct { - Certify_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[4]; - BYTE types[8]; -} Certify_COMMAND_DESCRIPTOR_t; - -Certify_COMMAND_DESCRIPTOR_t _CertifyData = { - /* entry */ &TPM2_Certify, - /* inSize */ (UINT16)(sizeof(Certify_In)), - /* outSize */ (UINT16)(sizeof(Certify_Out)), - /* offsetOfTypes */ offsetof(Certify_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Certify_In, signHandle)), - (UINT16)(offsetof(Certify_In, qualifyingData)), - (UINT16)(offsetof(Certify_In, inScheme)), - (UINT16)(offsetof(Certify_Out, signature))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_ATTEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _CertifyDataAddress (&_CertifyData) -#else -#define _CertifyDataAddress 0 -#endif // CC_Certify - -#if CC_CertifyCreation - -#include "CertifyCreation_fp.h" - -typedef TPM_RC (CertifyCreation_Entry)( - CertifyCreation_In *in, - CertifyCreation_Out *out -); - -typedef const struct { - CertifyCreation_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[6]; - BYTE types[10]; -} CertifyCreation_COMMAND_DESCRIPTOR_t; - -CertifyCreation_COMMAND_DESCRIPTOR_t _CertifyCreationData = { - /* entry */ &TPM2_CertifyCreation, - /* inSize */ (UINT16)(sizeof(CertifyCreation_In)), - /* outSize */ (UINT16)(sizeof(CertifyCreation_Out)), - /* offsetOfTypes */ offsetof(CertifyCreation_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(CertifyCreation_In, objectHandle)), - (UINT16)(offsetof(CertifyCreation_In, qualifyingData)), - (UINT16)(offsetof(CertifyCreation_In, creationHash)), - (UINT16)(offsetof(CertifyCreation_In, inScheme)), - (UINT16)(offsetof(CertifyCreation_In, creationTicket)), - (UINT16)(offsetof(CertifyCreation_Out, signature))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_DATA_P_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - TPMT_TK_CREATION_P_UNMARSHAL, - END_OF_LIST, - TPM2B_ATTEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _CertifyCreationDataAddress (&_CertifyCreationData) -#else -#define _CertifyCreationDataAddress 0 -#endif // CC_CertifyCreation - -#if CC_Quote - -#include "Quote_fp.h" - -typedef TPM_RC (Quote_Entry)( - Quote_In *in, - Quote_Out *out -); - -typedef const struct { - Quote_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[4]; - BYTE types[8]; -} Quote_COMMAND_DESCRIPTOR_t; - -Quote_COMMAND_DESCRIPTOR_t _QuoteData = { - /* entry */ &TPM2_Quote, - /* inSize */ (UINT16)(sizeof(Quote_In)), - /* outSize */ (UINT16)(sizeof(Quote_Out)), - /* offsetOfTypes */ offsetof(Quote_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Quote_In, qualifyingData)), - (UINT16)(offsetof(Quote_In, inScheme)), - (UINT16)(offsetof(Quote_In, PCRselect)), - (UINT16)(offsetof(Quote_Out, signature))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - TPML_PCR_SELECTION_P_UNMARSHAL, - END_OF_LIST, - TPM2B_ATTEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _QuoteDataAddress (&_QuoteData) -#else -#define _QuoteDataAddress 0 -#endif // CC_Quote - -#if CC_GetSessionAuditDigest - -#include "GetSessionAuditDigest_fp.h" - -typedef TPM_RC (GetSessionAuditDigest_Entry)( - GetSessionAuditDigest_In *in, - GetSessionAuditDigest_Out *out -); - -typedef const struct { - GetSessionAuditDigest_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[9]; -} GetSessionAuditDigest_COMMAND_DESCRIPTOR_t; - -GetSessionAuditDigest_COMMAND_DESCRIPTOR_t _GetSessionAuditDigestData = { - /* entry */ &TPM2_GetSessionAuditDigest, - /* inSize */ (UINT16)(sizeof(GetSessionAuditDigest_In)), - /* outSize */ (UINT16)(sizeof(GetSessionAuditDigest_Out)), - /* offsetOfTypes */ offsetof(GetSessionAuditDigest_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(GetSessionAuditDigest_In, signHandle)), - (UINT16)(offsetof(GetSessionAuditDigest_In, sessionHandle)), - (UINT16)(offsetof(GetSessionAuditDigest_In, qualifyingData)), - (UINT16)(offsetof(GetSessionAuditDigest_In, inScheme)), - (UINT16)(offsetof(GetSessionAuditDigest_Out, signature))}, - /* types */ {TPMI_RH_ENDORSEMENT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPMI_SH_HMAC_H_UNMARSHAL, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_ATTEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _GetSessionAuditDigestDataAddress (&_GetSessionAuditDigestData) -#else -#define _GetSessionAuditDigestDataAddress 0 -#endif // CC_GetSessionAuditDigest - -#if CC_GetCommandAuditDigest - -#include "GetCommandAuditDigest_fp.h" - -typedef TPM_RC (GetCommandAuditDigest_Entry)( - GetCommandAuditDigest_In *in, - GetCommandAuditDigest_Out *out -); - -typedef const struct { - GetCommandAuditDigest_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[4]; - BYTE types[8]; -} GetCommandAuditDigest_COMMAND_DESCRIPTOR_t; - -GetCommandAuditDigest_COMMAND_DESCRIPTOR_t _GetCommandAuditDigestData = { - /* entry */ &TPM2_GetCommandAuditDigest, - /* inSize */ (UINT16)(sizeof(GetCommandAuditDigest_In)), - /* outSize */ (UINT16)(sizeof(GetCommandAuditDigest_Out)), - /* offsetOfTypes */ offsetof(GetCommandAuditDigest_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(GetCommandAuditDigest_In, signHandle)), - (UINT16)(offsetof(GetCommandAuditDigest_In, qualifyingData)), - (UINT16)(offsetof(GetCommandAuditDigest_In, inScheme)), - (UINT16)(offsetof(GetCommandAuditDigest_Out, signature))}, - /* types */ {TPMI_RH_ENDORSEMENT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_ATTEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _GetCommandAuditDigestDataAddress (&_GetCommandAuditDigestData) -#else -#define _GetCommandAuditDigestDataAddress 0 -#endif // CC_GetCommandAuditDigest - -#if CC_GetTime - -#include "GetTime_fp.h" - -typedef TPM_RC (GetTime_Entry)( - GetTime_In *in, - GetTime_Out *out -); - -typedef const struct { - GetTime_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[4]; - BYTE types[8]; -} GetTime_COMMAND_DESCRIPTOR_t; - -GetTime_COMMAND_DESCRIPTOR_t _GetTimeData = { - /* entry */ &TPM2_GetTime, - /* inSize */ (UINT16)(sizeof(GetTime_In)), - /* outSize */ (UINT16)(sizeof(GetTime_Out)), - /* offsetOfTypes */ offsetof(GetTime_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(GetTime_In, signHandle)), - (UINT16)(offsetof(GetTime_In, qualifyingData)), - (UINT16)(offsetof(GetTime_In, inScheme)), - (UINT16)(offsetof(GetTime_Out, signature))}, - /* types */ {TPMI_RH_ENDORSEMENT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - TPM2B_ATTEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _GetTimeDataAddress (&_GetTimeData) -#else -#define _GetTimeDataAddress 0 -#endif // CC_GetTime - -#if CC_CertifyX509 - -#include "CertifyX509_fp.h" - -typedef TPM_RC (CertifyX509_Entry)( - CertifyX509_In *in, - CertifyX509_Out *out -); - -typedef const struct { - CertifyX509_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[6]; - BYTE types[10]; -} CertifyX509_COMMAND_DESCRIPTOR_t; - -CertifyX509_COMMAND_DESCRIPTOR_t _CertifyX509Data = { - /* entry */ &TPM2_CertifyX509, - /* inSize */ (UINT16)(sizeof(CertifyX509_In)), - /* outSize */ (UINT16)(sizeof(CertifyX509_Out)), - /* offsetOfTypes */ offsetof(CertifyX509_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(CertifyX509_In, signHandle)), - (UINT16)(offsetof(CertifyX509_In, qualifyingData)), - (UINT16)(offsetof(CertifyX509_In, inScheme)), - (UINT16)(offsetof(CertifyX509_In, partialCertificate)), - (UINT16)(offsetof(CertifyX509_Out, tbsDigest)), - (UINT16)(offsetof(CertifyX509_Out, signature))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - END_OF_LIST, - TPM2B_MAX_BUFFER_P_MARSHAL, - TPM2B_DIGEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _CertifyX509DataAddress (&_CertifyX509Data) -#else -#define _CertifyX509DataAddress 0 -#endif // CC_CertifyX509 - -#if CC_Commit - -#include "Commit_fp.h" - -typedef TPM_RC (Commit_Entry)( - Commit_In *in, - Commit_Out *out -); - -typedef const struct { - Commit_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[6]; - BYTE types[10]; -} Commit_COMMAND_DESCRIPTOR_t; - -Commit_COMMAND_DESCRIPTOR_t _CommitData = { - /* entry */ &TPM2_Commit, - /* inSize */ (UINT16)(sizeof(Commit_In)), - /* outSize */ (UINT16)(sizeof(Commit_Out)), - /* offsetOfTypes */ offsetof(Commit_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Commit_In, P1)), - (UINT16)(offsetof(Commit_In, s2)), - (UINT16)(offsetof(Commit_In, y2)), - (UINT16)(offsetof(Commit_Out, L)), - (UINT16)(offsetof(Commit_Out, E)), - (UINT16)(offsetof(Commit_Out, counter))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_ECC_POINT_P_UNMARSHAL, - TPM2B_SENSITIVE_DATA_P_UNMARSHAL, - TPM2B_ECC_PARAMETER_P_UNMARSHAL, - END_OF_LIST, - TPM2B_ECC_POINT_P_MARSHAL, - TPM2B_ECC_POINT_P_MARSHAL, - TPM2B_ECC_POINT_P_MARSHAL, - UINT16_P_MARSHAL, - END_OF_LIST} -}; - -#define _CommitDataAddress (&_CommitData) -#else -#define _CommitDataAddress 0 -#endif // CC_Commit - -#if CC_EC_Ephemeral - -#include "EC_Ephemeral_fp.h" - -typedef TPM_RC (EC_Ephemeral_Entry)( - EC_Ephemeral_In *in, - EC_Ephemeral_Out *out -); - -typedef const struct { - EC_Ephemeral_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[5]; -} EC_Ephemeral_COMMAND_DESCRIPTOR_t; - -EC_Ephemeral_COMMAND_DESCRIPTOR_t _EC_EphemeralData = { - /* entry */ &TPM2_EC_Ephemeral, - /* inSize */ (UINT16)(sizeof(EC_Ephemeral_In)), - /* outSize */ (UINT16)(sizeof(EC_Ephemeral_Out)), - /* offsetOfTypes */ offsetof(EC_Ephemeral_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(EC_Ephemeral_Out, counter))}, - /* types */ {TPMI_ECC_CURVE_P_UNMARSHAL, - END_OF_LIST, - TPM2B_ECC_POINT_P_MARSHAL, - UINT16_P_MARSHAL, - END_OF_LIST} -}; - -#define _EC_EphemeralDataAddress (&_EC_EphemeralData) -#else -#define _EC_EphemeralDataAddress 0 -#endif // CC_EC_Ephemeral - -#if CC_VerifySignature - -#include "VerifySignature_fp.h" - -typedef TPM_RC (VerifySignature_Entry)( - VerifySignature_In *in, - VerifySignature_Out *out -); - -typedef const struct { - VerifySignature_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} VerifySignature_COMMAND_DESCRIPTOR_t; - -VerifySignature_COMMAND_DESCRIPTOR_t _VerifySignatureData = { - /* entry */ &TPM2_VerifySignature, - /* inSize */ (UINT16)(sizeof(VerifySignature_In)), - /* outSize */ (UINT16)(sizeof(VerifySignature_Out)), - /* offsetOfTypes */ offsetof(VerifySignature_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(VerifySignature_In, digest)), - (UINT16)(offsetof(VerifySignature_In, signature))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPMT_SIGNATURE_P_UNMARSHAL, - END_OF_LIST, - TPMT_TK_VERIFIED_P_MARSHAL, - END_OF_LIST} -}; - -#define _VerifySignatureDataAddress (&_VerifySignatureData) -#else -#define _VerifySignatureDataAddress 0 -#endif // CC_VerifySignature - -#if CC_Sign - -#include "Sign_fp.h" - -typedef TPM_RC (Sign_Entry)( - Sign_In *in, - Sign_Out *out -); - -typedef const struct { - Sign_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} Sign_COMMAND_DESCRIPTOR_t; - -Sign_COMMAND_DESCRIPTOR_t _SignData = { - /* entry */ &TPM2_Sign, - /* inSize */ (UINT16)(sizeof(Sign_In)), - /* outSize */ (UINT16)(sizeof(Sign_Out)), - /* offsetOfTypes */ offsetof(Sign_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Sign_In, digest)), - (UINT16)(offsetof(Sign_In, inScheme)), - (UINT16)(offsetof(Sign_In, validation))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - TPMT_TK_HASHCHECK_P_UNMARSHAL, - END_OF_LIST, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _SignDataAddress (&_SignData) -#else -#define _SignDataAddress 0 -#endif // CC_Sign - -#if CC_SetCommandCodeAuditStatus - -#include "SetCommandCodeAuditStatus_fp.h" - -typedef TPM_RC (SetCommandCodeAuditStatus_Entry)( - SetCommandCodeAuditStatus_In *in -); - -typedef const struct { - SetCommandCodeAuditStatus_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[6]; -} SetCommandCodeAuditStatus_COMMAND_DESCRIPTOR_t; - -SetCommandCodeAuditStatus_COMMAND_DESCRIPTOR_t _SetCommandCodeAuditStatusData = { - /* entry */ &TPM2_SetCommandCodeAuditStatus, - /* inSize */ (UINT16)(sizeof(SetCommandCodeAuditStatus_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(SetCommandCodeAuditStatus_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(SetCommandCodeAuditStatus_In, auditAlg)), - (UINT16)(offsetof(SetCommandCodeAuditStatus_In, setList)), - (UINT16)(offsetof(SetCommandCodeAuditStatus_In, clearList))}, - /* types */ {TPMI_RH_PROVISION_H_UNMARSHAL, - TPMI_ALG_HASH_P_UNMARSHAL + ADD_FLAG, - TPML_CC_P_UNMARSHAL, - TPML_CC_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _SetCommandCodeAuditStatusDataAddress (&_SetCommandCodeAuditStatusData) -#else -#define _SetCommandCodeAuditStatusDataAddress 0 -#endif // CC_SetCommandCodeAuditStatus - -#if CC_PCR_Extend - -#include "PCR_Extend_fp.h" - -typedef TPM_RC (PCR_Extend_Entry)( - PCR_Extend_In *in -); - -typedef const struct { - PCR_Extend_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PCR_Extend_COMMAND_DESCRIPTOR_t; - -PCR_Extend_COMMAND_DESCRIPTOR_t _PCR_ExtendData = { - /* entry */ &TPM2_PCR_Extend, - /* inSize */ (UINT16)(sizeof(PCR_Extend_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PCR_Extend_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PCR_Extend_In, digests))}, - /* types */ {TPMI_DH_PCR_H_UNMARSHAL + ADD_FLAG, - TPML_DIGEST_VALUES_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PCR_ExtendDataAddress (&_PCR_ExtendData) -#else -#define _PCR_ExtendDataAddress 0 -#endif // CC_PCR_Extend - -#if CC_PCR_Event - -#include "PCR_Event_fp.h" - -typedef TPM_RC (PCR_Event_Entry)( - PCR_Event_In *in, - PCR_Event_Out *out -); - -typedef const struct { - PCR_Event_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[5]; -} PCR_Event_COMMAND_DESCRIPTOR_t; - -PCR_Event_COMMAND_DESCRIPTOR_t _PCR_EventData = { - /* entry */ &TPM2_PCR_Event, - /* inSize */ (UINT16)(sizeof(PCR_Event_In)), - /* outSize */ (UINT16)(sizeof(PCR_Event_Out)), - /* offsetOfTypes */ offsetof(PCR_Event_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PCR_Event_In, eventData))}, - /* types */ {TPMI_DH_PCR_H_UNMARSHAL + ADD_FLAG, - TPM2B_EVENT_P_UNMARSHAL, - END_OF_LIST, - TPML_DIGEST_VALUES_P_MARSHAL, - END_OF_LIST} -}; - -#define _PCR_EventDataAddress (&_PCR_EventData) -#else -#define _PCR_EventDataAddress 0 -#endif // CC_PCR_Event - -#if CC_PCR_Read - -#include "PCR_Read_fp.h" - -typedef TPM_RC (PCR_Read_Entry)( - PCR_Read_In *in, - PCR_Read_Out *out -); - -typedef const struct { - PCR_Read_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[6]; -} PCR_Read_COMMAND_DESCRIPTOR_t; - -PCR_Read_COMMAND_DESCRIPTOR_t _PCR_ReadData = { - /* entry */ &TPM2_PCR_Read, - /* inSize */ (UINT16)(sizeof(PCR_Read_In)), - /* outSize */ (UINT16)(sizeof(PCR_Read_Out)), - /* offsetOfTypes */ offsetof(PCR_Read_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PCR_Read_Out, pcrSelectionOut)), - (UINT16)(offsetof(PCR_Read_Out, pcrValues))}, - /* types */ {TPML_PCR_SELECTION_P_UNMARSHAL, - END_OF_LIST, - UINT32_P_MARSHAL, - TPML_PCR_SELECTION_P_MARSHAL, - TPML_DIGEST_P_MARSHAL, - END_OF_LIST} -}; - -#define _PCR_ReadDataAddress (&_PCR_ReadData) -#else -#define _PCR_ReadDataAddress 0 -#endif // CC_PCR_Read - -#if CC_PCR_Allocate - -#include "PCR_Allocate_fp.h" - -typedef TPM_RC (PCR_Allocate_Entry)( - PCR_Allocate_In *in, - PCR_Allocate_Out *out -); - -typedef const struct { - PCR_Allocate_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[4]; - BYTE types[8]; -} PCR_Allocate_COMMAND_DESCRIPTOR_t; - -PCR_Allocate_COMMAND_DESCRIPTOR_t _PCR_AllocateData = { - /* entry */ &TPM2_PCR_Allocate, - /* inSize */ (UINT16)(sizeof(PCR_Allocate_In)), - /* outSize */ (UINT16)(sizeof(PCR_Allocate_Out)), - /* offsetOfTypes */ offsetof(PCR_Allocate_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PCR_Allocate_In, pcrAllocation)), - (UINT16)(offsetof(PCR_Allocate_Out, maxPCR)), - (UINT16)(offsetof(PCR_Allocate_Out, sizeNeeded)), - (UINT16)(offsetof(PCR_Allocate_Out, sizeAvailable))}, - /* types */ {TPMI_RH_PLATFORM_H_UNMARSHAL, - TPML_PCR_SELECTION_P_UNMARSHAL, - END_OF_LIST, - TPMI_YES_NO_P_MARSHAL, - UINT32_P_MARSHAL, - UINT32_P_MARSHAL, - UINT32_P_MARSHAL, - END_OF_LIST} -}; - -#define _PCR_AllocateDataAddress (&_PCR_AllocateData) -#else -#define _PCR_AllocateDataAddress 0 -#endif // CC_PCR_Allocate - -#if CC_PCR_SetAuthPolicy - -#include "PCR_SetAuthPolicy_fp.h" - -typedef TPM_RC (PCR_SetAuthPolicy_Entry)( - PCR_SetAuthPolicy_In *in -); - -typedef const struct { - PCR_SetAuthPolicy_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[6]; -} PCR_SetAuthPolicy_COMMAND_DESCRIPTOR_t; - -PCR_SetAuthPolicy_COMMAND_DESCRIPTOR_t _PCR_SetAuthPolicyData = { - /* entry */ &TPM2_PCR_SetAuthPolicy, - /* inSize */ (UINT16)(sizeof(PCR_SetAuthPolicy_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PCR_SetAuthPolicy_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PCR_SetAuthPolicy_In, authPolicy)), - (UINT16)(offsetof(PCR_SetAuthPolicy_In, hashAlg)), - (UINT16)(offsetof(PCR_SetAuthPolicy_In, pcrNum))}, - /* types */ {TPMI_RH_PLATFORM_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPMI_ALG_HASH_P_UNMARSHAL + ADD_FLAG, - TPMI_DH_PCR_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PCR_SetAuthPolicyDataAddress (&_PCR_SetAuthPolicyData) -#else -#define _PCR_SetAuthPolicyDataAddress 0 -#endif // CC_PCR_SetAuthPolicy - -#if CC_PCR_SetAuthValue - -#include "PCR_SetAuthValue_fp.h" - -typedef TPM_RC (PCR_SetAuthValue_Entry)( - PCR_SetAuthValue_In *in -); - -typedef const struct { - PCR_SetAuthValue_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PCR_SetAuthValue_COMMAND_DESCRIPTOR_t; - -PCR_SetAuthValue_COMMAND_DESCRIPTOR_t _PCR_SetAuthValueData = { - /* entry */ &TPM2_PCR_SetAuthValue, - /* inSize */ (UINT16)(sizeof(PCR_SetAuthValue_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PCR_SetAuthValue_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PCR_SetAuthValue_In, auth))}, - /* types */ {TPMI_DH_PCR_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PCR_SetAuthValueDataAddress (&_PCR_SetAuthValueData) -#else -#define _PCR_SetAuthValueDataAddress 0 -#endif // CC_PCR_SetAuthValue - -#if CC_PCR_Reset - -#include "PCR_Reset_fp.h" - -typedef TPM_RC (PCR_Reset_Entry)( - PCR_Reset_In *in -); - -typedef const struct { - PCR_Reset_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} PCR_Reset_COMMAND_DESCRIPTOR_t; - -PCR_Reset_COMMAND_DESCRIPTOR_t _PCR_ResetData = { - /* entry */ &TPM2_PCR_Reset, - /* inSize */ (UINT16)(sizeof(PCR_Reset_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PCR_Reset_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_DH_PCR_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PCR_ResetDataAddress (&_PCR_ResetData) -#else -#define _PCR_ResetDataAddress 0 -#endif // CC_PCR_Reset - -#if CC_PolicySigned - -#include "PolicySigned_fp.h" - -typedef TPM_RC (PolicySigned_Entry)( - PolicySigned_In *in, - PolicySigned_Out *out -); - -typedef const struct { - PolicySigned_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[7]; - BYTE types[11]; -} PolicySigned_COMMAND_DESCRIPTOR_t; - -PolicySigned_COMMAND_DESCRIPTOR_t _PolicySignedData = { - /* entry */ &TPM2_PolicySigned, - /* inSize */ (UINT16)(sizeof(PolicySigned_In)), - /* outSize */ (UINT16)(sizeof(PolicySigned_Out)), - /* offsetOfTypes */ offsetof(PolicySigned_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicySigned_In, policySession)), - (UINT16)(offsetof(PolicySigned_In, nonceTPM)), - (UINT16)(offsetof(PolicySigned_In, cpHashA)), - (UINT16)(offsetof(PolicySigned_In, policyRef)), - (UINT16)(offsetof(PolicySigned_In, expiration)), - (UINT16)(offsetof(PolicySigned_In, auth)), - (UINT16)(offsetof(PolicySigned_Out, policyTicket))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_NONCE_P_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPM2B_NONCE_P_UNMARSHAL, - INT32_P_UNMARSHAL, - TPMT_SIGNATURE_P_UNMARSHAL, - END_OF_LIST, - TPM2B_TIMEOUT_P_MARSHAL, - TPMT_TK_AUTH_P_MARSHAL, - END_OF_LIST} -}; - -#define _PolicySignedDataAddress (&_PolicySignedData) -#else -#define _PolicySignedDataAddress 0 -#endif // CC_PolicySigned - -#if CC_PolicySecret - -#include "PolicySecret_fp.h" - -typedef TPM_RC (PolicySecret_Entry)( - PolicySecret_In *in, - PolicySecret_Out *out -); - -typedef const struct { - PolicySecret_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[6]; - BYTE types[10]; -} PolicySecret_COMMAND_DESCRIPTOR_t; - -PolicySecret_COMMAND_DESCRIPTOR_t _PolicySecretData = { - /* entry */ &TPM2_PolicySecret, - /* inSize */ (UINT16)(sizeof(PolicySecret_In)), - /* outSize */ (UINT16)(sizeof(PolicySecret_Out)), - /* offsetOfTypes */ offsetof(PolicySecret_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicySecret_In, policySession)), - (UINT16)(offsetof(PolicySecret_In, nonceTPM)), - (UINT16)(offsetof(PolicySecret_In, cpHashA)), - (UINT16)(offsetof(PolicySecret_In, policyRef)), - (UINT16)(offsetof(PolicySecret_In, expiration)), - (UINT16)(offsetof(PolicySecret_Out, policyTicket))}, - /* types */ {TPMI_DH_ENTITY_H_UNMARSHAL, - TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_NONCE_P_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPM2B_NONCE_P_UNMARSHAL, - INT32_P_UNMARSHAL, - END_OF_LIST, - TPM2B_TIMEOUT_P_MARSHAL, - TPMT_TK_AUTH_P_MARSHAL, - END_OF_LIST} -}; - -#define _PolicySecretDataAddress (&_PolicySecretData) -#else -#define _PolicySecretDataAddress 0 -#endif // CC_PolicySecret - -#if CC_PolicyTicket - -#include "PolicyTicket_fp.h" - -typedef TPM_RC (PolicyTicket_Entry)( - PolicyTicket_In *in -); - -typedef const struct { - PolicyTicket_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[8]; -} PolicyTicket_COMMAND_DESCRIPTOR_t; - -PolicyTicket_COMMAND_DESCRIPTOR_t _PolicyTicketData = { - /* entry */ &TPM2_PolicyTicket, - /* inSize */ (UINT16)(sizeof(PolicyTicket_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyTicket_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyTicket_In, timeout)), - (UINT16)(offsetof(PolicyTicket_In, cpHashA)), - (UINT16)(offsetof(PolicyTicket_In, policyRef)), - (UINT16)(offsetof(PolicyTicket_In, authName)), - (UINT16)(offsetof(PolicyTicket_In, ticket))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_TIMEOUT_P_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPM2B_NONCE_P_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - TPMT_TK_AUTH_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyTicketDataAddress (&_PolicyTicketData) -#else -#define _PolicyTicketDataAddress 0 -#endif // CC_PolicyTicket - -#if CC_PolicyOR - -#include "PolicyOR_fp.h" - -typedef TPM_RC (PolicyOR_Entry)( - PolicyOR_In *in -); - -typedef const struct { - PolicyOR_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PolicyOR_COMMAND_DESCRIPTOR_t; - -PolicyOR_COMMAND_DESCRIPTOR_t _PolicyORData = { - /* entry */ &TPM2_PolicyOR, - /* inSize */ (UINT16)(sizeof(PolicyOR_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyOR_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyOR_In, pHashList))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPML_DIGEST_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyORDataAddress (&_PolicyORData) -#else -#define _PolicyORDataAddress 0 -#endif // CC_PolicyOR - -#if CC_PolicyPCR - -#include "PolicyPCR_fp.h" - -typedef TPM_RC (PolicyPCR_Entry)( - PolicyPCR_In *in -); - -typedef const struct { - PolicyPCR_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} PolicyPCR_COMMAND_DESCRIPTOR_t; - -PolicyPCR_COMMAND_DESCRIPTOR_t _PolicyPCRData = { - /* entry */ &TPM2_PolicyPCR, - /* inSize */ (UINT16)(sizeof(PolicyPCR_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyPCR_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyPCR_In, pcrDigest)), - (UINT16)(offsetof(PolicyPCR_In, pcrs))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPML_PCR_SELECTION_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyPCRDataAddress (&_PolicyPCRData) -#else -#define _PolicyPCRDataAddress 0 -#endif // CC_PolicyPCR - -#if CC_PolicyLocality - -#include "PolicyLocality_fp.h" - -typedef TPM_RC (PolicyLocality_Entry)( - PolicyLocality_In *in -); - -typedef const struct { - PolicyLocality_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PolicyLocality_COMMAND_DESCRIPTOR_t; - -PolicyLocality_COMMAND_DESCRIPTOR_t _PolicyLocalityData = { - /* entry */ &TPM2_PolicyLocality, - /* inSize */ (UINT16)(sizeof(PolicyLocality_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyLocality_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyLocality_In, locality))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPMA_LOCALITY_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyLocalityDataAddress (&_PolicyLocalityData) -#else -#define _PolicyLocalityDataAddress 0 -#endif // CC_PolicyLocality - -#if CC_PolicyNV - -#include "PolicyNV_fp.h" - -typedef TPM_RC (PolicyNV_Entry)( - PolicyNV_In *in -); - -typedef const struct { - PolicyNV_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[5]; - BYTE types[8]; -} PolicyNV_COMMAND_DESCRIPTOR_t; - -PolicyNV_COMMAND_DESCRIPTOR_t _PolicyNVData = { - /* entry */ &TPM2_PolicyNV, - /* inSize */ (UINT16)(sizeof(PolicyNV_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyNV_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyNV_In, nvIndex)), - (UINT16)(offsetof(PolicyNV_In, policySession)), - (UINT16)(offsetof(PolicyNV_In, operandB)), - (UINT16)(offsetof(PolicyNV_In, offset)), - (UINT16)(offsetof(PolicyNV_In, operation))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_OPERAND_P_UNMARSHAL, - UINT16_P_UNMARSHAL, - TPM_EO_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyNVDataAddress (&_PolicyNVData) -#else -#define _PolicyNVDataAddress 0 -#endif // CC_PolicyNV - -#if CC_PolicyCounterTimer - -#include "PolicyCounterTimer_fp.h" - -typedef TPM_RC (PolicyCounterTimer_Entry)( - PolicyCounterTimer_In *in -); - -typedef const struct { - PolicyCounterTimer_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[6]; -} PolicyCounterTimer_COMMAND_DESCRIPTOR_t; - -PolicyCounterTimer_COMMAND_DESCRIPTOR_t _PolicyCounterTimerData = { - /* entry */ &TPM2_PolicyCounterTimer, - /* inSize */ (UINT16)(sizeof(PolicyCounterTimer_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyCounterTimer_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyCounterTimer_In, operandB)), - (UINT16)(offsetof(PolicyCounterTimer_In, offset)), - (UINT16)(offsetof(PolicyCounterTimer_In, operation))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_OPERAND_P_UNMARSHAL, - UINT16_P_UNMARSHAL, - TPM_EO_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyCounterTimerDataAddress (&_PolicyCounterTimerData) -#else -#define _PolicyCounterTimerDataAddress 0 -#endif // CC_PolicyCounterTimer - -#if CC_PolicyCommandCode - -#include "PolicyCommandCode_fp.h" - -typedef TPM_RC (PolicyCommandCode_Entry)( - PolicyCommandCode_In *in -); - -typedef const struct { - PolicyCommandCode_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PolicyCommandCode_COMMAND_DESCRIPTOR_t; - -PolicyCommandCode_COMMAND_DESCRIPTOR_t _PolicyCommandCodeData = { - /* entry */ &TPM2_PolicyCommandCode, - /* inSize */ (UINT16)(sizeof(PolicyCommandCode_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyCommandCode_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyCommandCode_In, code))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM_CC_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyCommandCodeDataAddress (&_PolicyCommandCodeData) -#else -#define _PolicyCommandCodeDataAddress 0 -#endif // CC_PolicyCommandCode - -#if CC_PolicyPhysicalPresence - -#include "PolicyPhysicalPresence_fp.h" - -typedef TPM_RC (PolicyPhysicalPresence_Entry)( - PolicyPhysicalPresence_In *in -); - -typedef const struct { - PolicyPhysicalPresence_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} PolicyPhysicalPresence_COMMAND_DESCRIPTOR_t; - -PolicyPhysicalPresence_COMMAND_DESCRIPTOR_t _PolicyPhysicalPresenceData = { - /* entry */ &TPM2_PolicyPhysicalPresence, - /* inSize */ (UINT16)(sizeof(PolicyPhysicalPresence_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyPhysicalPresence_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyPhysicalPresenceDataAddress (&_PolicyPhysicalPresenceData) -#else -#define _PolicyPhysicalPresenceDataAddress 0 -#endif // CC_PolicyPhysicalPresence - -#if CC_PolicyCpHash - -#include "PolicyCpHash_fp.h" - -typedef TPM_RC (PolicyCpHash_Entry)( - PolicyCpHash_In *in -); - -typedef const struct { - PolicyCpHash_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PolicyCpHash_COMMAND_DESCRIPTOR_t; - -PolicyCpHash_COMMAND_DESCRIPTOR_t _PolicyCpHashData = { - /* entry */ &TPM2_PolicyCpHash, - /* inSize */ (UINT16)(sizeof(PolicyCpHash_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyCpHash_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyCpHash_In, cpHashA))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyCpHashDataAddress (&_PolicyCpHashData) -#else -#define _PolicyCpHashDataAddress 0 -#endif // CC_PolicyCpHash - -#if CC_PolicyNameHash - -#include "PolicyNameHash_fp.h" - -typedef TPM_RC (PolicyNameHash_Entry)( - PolicyNameHash_In *in -); - -typedef const struct { - PolicyNameHash_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PolicyNameHash_COMMAND_DESCRIPTOR_t; - -PolicyNameHash_COMMAND_DESCRIPTOR_t _PolicyNameHashData = { - /* entry */ &TPM2_PolicyNameHash, - /* inSize */ (UINT16)(sizeof(PolicyNameHash_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyNameHash_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyNameHash_In, nameHash))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyNameHashDataAddress (&_PolicyNameHashData) -#else -#define _PolicyNameHashDataAddress 0 -#endif // CC_PolicyNameHash - -#if CC_PolicyDuplicationSelect - -#include "PolicyDuplicationSelect_fp.h" - -typedef TPM_RC (PolicyDuplicationSelect_Entry)( - PolicyDuplicationSelect_In *in -); - -typedef const struct { - PolicyDuplicationSelect_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[6]; -} PolicyDuplicationSelect_COMMAND_DESCRIPTOR_t; - -PolicyDuplicationSelect_COMMAND_DESCRIPTOR_t _PolicyDuplicationSelectData = { - /* entry */ &TPM2_PolicyDuplicationSelect, - /* inSize */ (UINT16)(sizeof(PolicyDuplicationSelect_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyDuplicationSelect_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyDuplicationSelect_In, objectName)), - (UINT16)(offsetof(PolicyDuplicationSelect_In, newParentName)), - (UINT16)(offsetof(PolicyDuplicationSelect_In, includeObject))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - TPMI_YES_NO_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyDuplicationSelectDataAddress (&_PolicyDuplicationSelectData) -#else -#define _PolicyDuplicationSelectDataAddress 0 -#endif // CC_PolicyDuplicationSelect - -#if CC_PolicyAuthorize - -#include "PolicyAuthorize_fp.h" - -typedef TPM_RC (PolicyAuthorize_Entry)( - PolicyAuthorize_In *in -); - -typedef const struct { - PolicyAuthorize_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[4]; - BYTE types[7]; -} PolicyAuthorize_COMMAND_DESCRIPTOR_t; - -PolicyAuthorize_COMMAND_DESCRIPTOR_t _PolicyAuthorizeData = { - /* entry */ &TPM2_PolicyAuthorize, - /* inSize */ (UINT16)(sizeof(PolicyAuthorize_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyAuthorize_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyAuthorize_In, approvedPolicy)), - (UINT16)(offsetof(PolicyAuthorize_In, policyRef)), - (UINT16)(offsetof(PolicyAuthorize_In, keySign)), - (UINT16)(offsetof(PolicyAuthorize_In, checkTicket))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPM2B_NONCE_P_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - TPMT_TK_VERIFIED_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyAuthorizeDataAddress (&_PolicyAuthorizeData) -#else -#define _PolicyAuthorizeDataAddress 0 -#endif // CC_PolicyAuthorize - -#if CC_PolicyAuthValue - -#include "PolicyAuthValue_fp.h" - -typedef TPM_RC (PolicyAuthValue_Entry)( - PolicyAuthValue_In *in -); - -typedef const struct { - PolicyAuthValue_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} PolicyAuthValue_COMMAND_DESCRIPTOR_t; - -PolicyAuthValue_COMMAND_DESCRIPTOR_t _PolicyAuthValueData = { - /* entry */ &TPM2_PolicyAuthValue, - /* inSize */ (UINT16)(sizeof(PolicyAuthValue_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyAuthValue_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyAuthValueDataAddress (&_PolicyAuthValueData) -#else -#define _PolicyAuthValueDataAddress 0 -#endif // CC_PolicyAuthValue - -#if CC_PolicyPassword - -#include "PolicyPassword_fp.h" - -typedef TPM_RC (PolicyPassword_Entry)( - PolicyPassword_In *in -); - -typedef const struct { - PolicyPassword_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} PolicyPassword_COMMAND_DESCRIPTOR_t; - -PolicyPassword_COMMAND_DESCRIPTOR_t _PolicyPasswordData = { - /* entry */ &TPM2_PolicyPassword, - /* inSize */ (UINT16)(sizeof(PolicyPassword_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyPassword_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyPasswordDataAddress (&_PolicyPasswordData) -#else -#define _PolicyPasswordDataAddress 0 -#endif // CC_PolicyPassword - -#if CC_PolicyGetDigest - -#include "PolicyGetDigest_fp.h" - -typedef TPM_RC (PolicyGetDigest_Entry)( - PolicyGetDigest_In *in, - PolicyGetDigest_Out *out -); - -typedef const struct { - PolicyGetDigest_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} PolicyGetDigest_COMMAND_DESCRIPTOR_t; - -PolicyGetDigest_COMMAND_DESCRIPTOR_t _PolicyGetDigestData = { - /* entry */ &TPM2_PolicyGetDigest, - /* inSize */ (UINT16)(sizeof(PolicyGetDigest_In)), - /* outSize */ (UINT16)(sizeof(PolicyGetDigest_Out)), - /* offsetOfTypes */ offsetof(PolicyGetDigest_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - END_OF_LIST, - TPM2B_DIGEST_P_MARSHAL, - END_OF_LIST} -}; - -#define _PolicyGetDigestDataAddress (&_PolicyGetDigestData) -#else -#define _PolicyGetDigestDataAddress 0 -#endif // CC_PolicyGetDigest - -#if CC_PolicyNvWritten - -#include "PolicyNvWritten_fp.h" - -typedef TPM_RC (PolicyNvWritten_Entry)( - PolicyNvWritten_In *in -); - -typedef const struct { - PolicyNvWritten_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PolicyNvWritten_COMMAND_DESCRIPTOR_t; - -PolicyNvWritten_COMMAND_DESCRIPTOR_t _PolicyNvWrittenData = { - /* entry */ &TPM2_PolicyNvWritten, - /* inSize */ (UINT16)(sizeof(PolicyNvWritten_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyNvWritten_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyNvWritten_In, writtenSet))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPMI_YES_NO_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyNvWrittenDataAddress (&_PolicyNvWrittenData) -#else -#define _PolicyNvWrittenDataAddress 0 -#endif // CC_PolicyNvWritten - -#if CC_PolicyTemplate - -#include "PolicyTemplate_fp.h" - -typedef TPM_RC (PolicyTemplate_Entry)( - PolicyTemplate_In *in -); - -typedef const struct { - PolicyTemplate_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} PolicyTemplate_COMMAND_DESCRIPTOR_t; - -PolicyTemplate_COMMAND_DESCRIPTOR_t _PolicyTemplateData = { - /* entry */ &TPM2_PolicyTemplate, - /* inSize */ (UINT16)(sizeof(PolicyTemplate_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyTemplate_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyTemplate_In, templateHash))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyTemplateDataAddress (&_PolicyTemplateData) -#else -#define _PolicyTemplateDataAddress 0 -#endif // CC_PolicyTemplate - -#if CC_PolicyAuthorizeNV - -#include "PolicyAuthorizeNV_fp.h" - -typedef TPM_RC (PolicyAuthorizeNV_Entry)( - PolicyAuthorizeNV_In *in -); - -typedef const struct { - PolicyAuthorizeNV_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} PolicyAuthorizeNV_COMMAND_DESCRIPTOR_t; - -PolicyAuthorizeNV_COMMAND_DESCRIPTOR_t _PolicyAuthorizeNVData = { - /* entry */ &TPM2_PolicyAuthorizeNV, - /* inSize */ (UINT16)(sizeof(PolicyAuthorizeNV_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PolicyAuthorizeNV_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PolicyAuthorizeNV_In, nvIndex)), - (UINT16)(offsetof(PolicyAuthorizeNV_In, policySession))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - TPMI_SH_POLICY_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PolicyAuthorizeNVDataAddress (&_PolicyAuthorizeNVData) -#else -#define _PolicyAuthorizeNVDataAddress 0 -#endif // CC_PolicyAuthorizeNV - -#if CC_CreatePrimary - -#include "CreatePrimary_fp.h" - -typedef TPM_RC (CreatePrimary_Entry)( - CreatePrimary_In *in, - CreatePrimary_Out *out -); - -typedef const struct { - CreatePrimary_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[9]; - BYTE types[13]; -} CreatePrimary_COMMAND_DESCRIPTOR_t; - -CreatePrimary_COMMAND_DESCRIPTOR_t _CreatePrimaryData = { - /* entry */ &TPM2_CreatePrimary, - /* inSize */ (UINT16)(sizeof(CreatePrimary_In)), - /* outSize */ (UINT16)(sizeof(CreatePrimary_Out)), - /* offsetOfTypes */ offsetof(CreatePrimary_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(CreatePrimary_In, inSensitive)), - (UINT16)(offsetof(CreatePrimary_In, inPublic)), - (UINT16)(offsetof(CreatePrimary_In, outsideInfo)), - (UINT16)(offsetof(CreatePrimary_In, creationPCR)), - (UINT16)(offsetof(CreatePrimary_Out, outPublic)), - (UINT16)(offsetof(CreatePrimary_Out, creationData)), - (UINT16)(offsetof(CreatePrimary_Out, creationHash)), - (UINT16)(offsetof(CreatePrimary_Out, creationTicket)), - (UINT16)(offsetof(CreatePrimary_Out, name))}, - /* types */ {TPMI_RH_HIERARCHY_H_UNMARSHAL + ADD_FLAG, - TPM2B_SENSITIVE_CREATE_P_UNMARSHAL, - TPM2B_PUBLIC_P_UNMARSHAL, - TPM2B_DATA_P_UNMARSHAL, - TPML_PCR_SELECTION_P_UNMARSHAL, - END_OF_LIST, - TPM_HANDLE_H_MARSHAL, - TPM2B_PUBLIC_P_MARSHAL, - TPM2B_CREATION_DATA_P_MARSHAL, - TPM2B_DIGEST_P_MARSHAL, - TPMT_TK_CREATION_P_MARSHAL, - TPM2B_NAME_P_MARSHAL, - END_OF_LIST} -}; - -#define _CreatePrimaryDataAddress (&_CreatePrimaryData) -#else -#define _CreatePrimaryDataAddress 0 -#endif // CC_CreatePrimary - -#if CC_HierarchyControl - -#include "HierarchyControl_fp.h" - -typedef TPM_RC (HierarchyControl_Entry)( - HierarchyControl_In *in -); - -typedef const struct { - HierarchyControl_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} HierarchyControl_COMMAND_DESCRIPTOR_t; - -HierarchyControl_COMMAND_DESCRIPTOR_t _HierarchyControlData = { - /* entry */ &TPM2_HierarchyControl, - /* inSize */ (UINT16)(sizeof(HierarchyControl_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(HierarchyControl_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(HierarchyControl_In, enable)), - (UINT16)(offsetof(HierarchyControl_In, state))}, - /* types */ {TPMI_RH_HIERARCHY_H_UNMARSHAL, - TPMI_RH_ENABLES_P_UNMARSHAL, - TPMI_YES_NO_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _HierarchyControlDataAddress (&_HierarchyControlData) -#else -#define _HierarchyControlDataAddress 0 -#endif // CC_HierarchyControl - -#if CC_SetPrimaryPolicy - -#include "SetPrimaryPolicy_fp.h" - -typedef TPM_RC (SetPrimaryPolicy_Entry)( - SetPrimaryPolicy_In *in -); - -typedef const struct { - SetPrimaryPolicy_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} SetPrimaryPolicy_COMMAND_DESCRIPTOR_t; - -SetPrimaryPolicy_COMMAND_DESCRIPTOR_t _SetPrimaryPolicyData = { - /* entry */ &TPM2_SetPrimaryPolicy, - /* inSize */ (UINT16)(sizeof(SetPrimaryPolicy_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(SetPrimaryPolicy_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(SetPrimaryPolicy_In, authPolicy)), - (UINT16)(offsetof(SetPrimaryPolicy_In, hashAlg))}, - /* types */ {TPMI_RH_HIERARCHY_AUTH_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPMI_ALG_HASH_P_UNMARSHAL + ADD_FLAG, - END_OF_LIST, - END_OF_LIST} -}; - -#define _SetPrimaryPolicyDataAddress (&_SetPrimaryPolicyData) -#else -#define _SetPrimaryPolicyDataAddress 0 -#endif // CC_SetPrimaryPolicy - -#if CC_ChangePPS - -#include "ChangePPS_fp.h" - -typedef TPM_RC (ChangePPS_Entry)( - ChangePPS_In *in -); - -typedef const struct { - ChangePPS_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} ChangePPS_COMMAND_DESCRIPTOR_t; - -ChangePPS_COMMAND_DESCRIPTOR_t _ChangePPSData = { - /* entry */ &TPM2_ChangePPS, - /* inSize */ (UINT16)(sizeof(ChangePPS_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(ChangePPS_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_RH_PLATFORM_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _ChangePPSDataAddress (&_ChangePPSData) -#else -#define _ChangePPSDataAddress 0 -#endif // CC_ChangePPS - -#if CC_ChangeEPS - -#include "ChangeEPS_fp.h" - -typedef TPM_RC (ChangeEPS_Entry)( - ChangeEPS_In *in -); - -typedef const struct { - ChangeEPS_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} ChangeEPS_COMMAND_DESCRIPTOR_t; - -ChangeEPS_COMMAND_DESCRIPTOR_t _ChangeEPSData = { - /* entry */ &TPM2_ChangeEPS, - /* inSize */ (UINT16)(sizeof(ChangeEPS_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(ChangeEPS_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_RH_PLATFORM_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _ChangeEPSDataAddress (&_ChangeEPSData) -#else -#define _ChangeEPSDataAddress 0 -#endif // CC_ChangeEPS - -#if CC_Clear - -#include "Clear_fp.h" - -typedef TPM_RC (Clear_Entry)( - Clear_In *in -); - -typedef const struct { - Clear_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} Clear_COMMAND_DESCRIPTOR_t; - -Clear_COMMAND_DESCRIPTOR_t _ClearData = { - /* entry */ &TPM2_Clear, - /* inSize */ (UINT16)(sizeof(Clear_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(Clear_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_RH_CLEAR_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _ClearDataAddress (&_ClearData) -#else -#define _ClearDataAddress 0 -#endif // CC_Clear - -#if CC_ClearControl - -#include "ClearControl_fp.h" - -typedef TPM_RC (ClearControl_Entry)( - ClearControl_In *in -); - -typedef const struct { - ClearControl_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} ClearControl_COMMAND_DESCRIPTOR_t; - -ClearControl_COMMAND_DESCRIPTOR_t _ClearControlData = { - /* entry */ &TPM2_ClearControl, - /* inSize */ (UINT16)(sizeof(ClearControl_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(ClearControl_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ClearControl_In, disable))}, - /* types */ {TPMI_RH_CLEAR_H_UNMARSHAL, - TPMI_YES_NO_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _ClearControlDataAddress (&_ClearControlData) -#else -#define _ClearControlDataAddress 0 -#endif // CC_ClearControl - -#if CC_HierarchyChangeAuth - -#include "HierarchyChangeAuth_fp.h" - -typedef TPM_RC (HierarchyChangeAuth_Entry)( - HierarchyChangeAuth_In *in -); - -typedef const struct { - HierarchyChangeAuth_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} HierarchyChangeAuth_COMMAND_DESCRIPTOR_t; - -HierarchyChangeAuth_COMMAND_DESCRIPTOR_t _HierarchyChangeAuthData = { - /* entry */ &TPM2_HierarchyChangeAuth, - /* inSize */ (UINT16)(sizeof(HierarchyChangeAuth_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(HierarchyChangeAuth_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(HierarchyChangeAuth_In, newAuth))}, - /* types */ {TPMI_RH_HIERARCHY_AUTH_H_UNMARSHAL, - TPM2B_AUTH_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _HierarchyChangeAuthDataAddress (&_HierarchyChangeAuthData) -#else -#define _HierarchyChangeAuthDataAddress 0 -#endif // CC_HierarchyChangeAuth - -#if CC_DictionaryAttackLockReset - -#include "DictionaryAttackLockReset_fp.h" - -typedef TPM_RC (DictionaryAttackLockReset_Entry)( - DictionaryAttackLockReset_In *in -); - -typedef const struct { - DictionaryAttackLockReset_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} DictionaryAttackLockReset_COMMAND_DESCRIPTOR_t; - -DictionaryAttackLockReset_COMMAND_DESCRIPTOR_t _DictionaryAttackLockResetData = { - /* entry */ &TPM2_DictionaryAttackLockReset, - /* inSize */ (UINT16)(sizeof(DictionaryAttackLockReset_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(DictionaryAttackLockReset_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_RH_LOCKOUT_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _DictionaryAttackLockResetDataAddress (&_DictionaryAttackLockResetData) -#else -#define _DictionaryAttackLockResetDataAddress 0 -#endif // CC_DictionaryAttackLockReset - -#if CC_DictionaryAttackParameters - -#include "DictionaryAttackParameters_fp.h" - -typedef TPM_RC (DictionaryAttackParameters_Entry)( - DictionaryAttackParameters_In *in -); - -typedef const struct { - DictionaryAttackParameters_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[6]; -} DictionaryAttackParameters_COMMAND_DESCRIPTOR_t; - -DictionaryAttackParameters_COMMAND_DESCRIPTOR_t _DictionaryAttackParametersData = { - /* entry */ &TPM2_DictionaryAttackParameters, - /* inSize */ (UINT16)(sizeof(DictionaryAttackParameters_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(DictionaryAttackParameters_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(DictionaryAttackParameters_In, newMaxTries)), - (UINT16)(offsetof(DictionaryAttackParameters_In, newRecoveryTime)), - (UINT16)(offsetof(DictionaryAttackParameters_In, lockoutRecovery))}, - /* types */ {TPMI_RH_LOCKOUT_H_UNMARSHAL, - UINT32_P_UNMARSHAL, - UINT32_P_UNMARSHAL, - UINT32_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _DictionaryAttackParametersDataAddress (&_DictionaryAttackParametersData) -#else -#define _DictionaryAttackParametersDataAddress 0 -#endif // CC_DictionaryAttackParameters - -#if CC_PP_Commands - -#include "PP_Commands_fp.h" - -typedef TPM_RC (PP_Commands_Entry)( - PP_Commands_In *in -); - -typedef const struct { - PP_Commands_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} PP_Commands_COMMAND_DESCRIPTOR_t; - -PP_Commands_COMMAND_DESCRIPTOR_t _PP_CommandsData = { - /* entry */ &TPM2_PP_Commands, - /* inSize */ (UINT16)(sizeof(PP_Commands_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(PP_Commands_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(PP_Commands_In, setList)), - (UINT16)(offsetof(PP_Commands_In, clearList))}, - /* types */ {TPMI_RH_PLATFORM_H_UNMARSHAL, - TPML_CC_P_UNMARSHAL, - TPML_CC_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _PP_CommandsDataAddress (&_PP_CommandsData) -#else -#define _PP_CommandsDataAddress 0 -#endif // CC_PP_Commands - -#if CC_SetAlgorithmSet - -#include "SetAlgorithmSet_fp.h" - -typedef TPM_RC (SetAlgorithmSet_Entry)( - SetAlgorithmSet_In *in -); - -typedef const struct { - SetAlgorithmSet_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} SetAlgorithmSet_COMMAND_DESCRIPTOR_t; - -SetAlgorithmSet_COMMAND_DESCRIPTOR_t _SetAlgorithmSetData = { - /* entry */ &TPM2_SetAlgorithmSet, - /* inSize */ (UINT16)(sizeof(SetAlgorithmSet_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(SetAlgorithmSet_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(SetAlgorithmSet_In, algorithmSet))}, - /* types */ {TPMI_RH_PLATFORM_H_UNMARSHAL, - UINT32_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _SetAlgorithmSetDataAddress (&_SetAlgorithmSetData) -#else -#define _SetAlgorithmSetDataAddress 0 -#endif // CC_SetAlgorithmSet - -#if CC_FieldUpgradeStart - -#include "FieldUpgradeStart_fp.h" - -typedef TPM_RC (FieldUpgradeStart_Entry)( - FieldUpgradeStart_In *in -); - -typedef const struct { - FieldUpgradeStart_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[6]; -} FieldUpgradeStart_COMMAND_DESCRIPTOR_t; - -FieldUpgradeStart_COMMAND_DESCRIPTOR_t _FieldUpgradeStartData = { - /* entry */ &TPM2_FieldUpgradeStart, - /* inSize */ (UINT16)(sizeof(FieldUpgradeStart_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(FieldUpgradeStart_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(FieldUpgradeStart_In, keyHandle)), - (UINT16)(offsetof(FieldUpgradeStart_In, fuDigest)), - (UINT16)(offsetof(FieldUpgradeStart_In, manifestSignature))}, - /* types */ {TPMI_RH_PLATFORM_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL, - TPM2B_DIGEST_P_UNMARSHAL, - TPMT_SIGNATURE_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _FieldUpgradeStartDataAddress (&_FieldUpgradeStartData) -#else -#define _FieldUpgradeStartDataAddress 0 -#endif // CC_FieldUpgradeStart - -#if CC_FieldUpgradeData - -#include "FieldUpgradeData_fp.h" - -typedef TPM_RC (FieldUpgradeData_Entry)( - FieldUpgradeData_In *in, - FieldUpgradeData_Out *out -); - -typedef const struct { - FieldUpgradeData_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[5]; -} FieldUpgradeData_COMMAND_DESCRIPTOR_t; - -FieldUpgradeData_COMMAND_DESCRIPTOR_t _FieldUpgradeDataData = { - /* entry */ &TPM2_FieldUpgradeData, - /* inSize */ (UINT16)(sizeof(FieldUpgradeData_In)), - /* outSize */ (UINT16)(sizeof(FieldUpgradeData_Out)), - /* offsetOfTypes */ offsetof(FieldUpgradeData_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(FieldUpgradeData_Out, firstDigest))}, - /* types */ {TPM2B_MAX_BUFFER_P_UNMARSHAL, - END_OF_LIST, - TPMT_HA_P_MARSHAL, - TPMT_HA_P_MARSHAL, - END_OF_LIST} -}; - -#define _FieldUpgradeDataDataAddress (&_FieldUpgradeDataData) -#else -#define _FieldUpgradeDataDataAddress 0 -#endif // CC_FieldUpgradeData - -#if CC_FirmwareRead - -#include "FirmwareRead_fp.h" - -typedef TPM_RC (FirmwareRead_Entry)( - FirmwareRead_In *in, - FirmwareRead_Out *out -); - -typedef const struct { - FirmwareRead_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} FirmwareRead_COMMAND_DESCRIPTOR_t; - -FirmwareRead_COMMAND_DESCRIPTOR_t _FirmwareReadData = { - /* entry */ &TPM2_FirmwareRead, - /* inSize */ (UINT16)(sizeof(FirmwareRead_In)), - /* outSize */ (UINT16)(sizeof(FirmwareRead_Out)), - /* offsetOfTypes */ offsetof(FirmwareRead_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {UINT32_P_UNMARSHAL, - END_OF_LIST, - TPM2B_MAX_BUFFER_P_MARSHAL, - END_OF_LIST} -}; - -#define _FirmwareReadDataAddress (&_FirmwareReadData) -#else -#define _FirmwareReadDataAddress 0 -#endif // CC_FirmwareRead - -#if CC_ContextSave - -#include "ContextSave_fp.h" - -typedef TPM_RC (ContextSave_Entry)( - ContextSave_In *in, - ContextSave_Out *out -); - -typedef const struct { - ContextSave_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} ContextSave_COMMAND_DESCRIPTOR_t; - -ContextSave_COMMAND_DESCRIPTOR_t _ContextSaveData = { - /* entry */ &TPM2_ContextSave, - /* inSize */ (UINT16)(sizeof(ContextSave_In)), - /* outSize */ (UINT16)(sizeof(ContextSave_Out)), - /* offsetOfTypes */ offsetof(ContextSave_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_DH_CONTEXT_H_UNMARSHAL, - END_OF_LIST, - TPMS_CONTEXT_P_MARSHAL, - END_OF_LIST} -}; - -#define _ContextSaveDataAddress (&_ContextSaveData) -#else -#define _ContextSaveDataAddress 0 -#endif // CC_ContextSave - -#if CC_ContextLoad - -#include "ContextLoad_fp.h" - -typedef TPM_RC (ContextLoad_Entry)( - ContextLoad_In *in, - ContextLoad_Out *out -); - -typedef const struct { - ContextLoad_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} ContextLoad_COMMAND_DESCRIPTOR_t; - -ContextLoad_COMMAND_DESCRIPTOR_t _ContextLoadData = { - /* entry */ &TPM2_ContextLoad, - /* inSize */ (UINT16)(sizeof(ContextLoad_In)), - /* outSize */ (UINT16)(sizeof(ContextLoad_Out)), - /* offsetOfTypes */ offsetof(ContextLoad_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMS_CONTEXT_P_UNMARSHAL, - END_OF_LIST, - TPMI_DH_CONTEXT_H_MARSHAL, - END_OF_LIST} -}; - -#define _ContextLoadDataAddress (&_ContextLoadData) -#else -#define _ContextLoadDataAddress 0 -#endif // CC_ContextLoad - -#if CC_FlushContext - -#include "FlushContext_fp.h" - -typedef TPM_RC (FlushContext_Entry)( - FlushContext_In *in -); - -typedef const struct { - FlushContext_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} FlushContext_COMMAND_DESCRIPTOR_t; - -FlushContext_COMMAND_DESCRIPTOR_t _FlushContextData = { - /* entry */ &TPM2_FlushContext, - /* inSize */ (UINT16)(sizeof(FlushContext_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(FlushContext_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_DH_CONTEXT_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _FlushContextDataAddress (&_FlushContextData) -#else -#define _FlushContextDataAddress 0 -#endif // CC_FlushContext - -#if CC_EvictControl - -#include "EvictControl_fp.h" - -typedef TPM_RC (EvictControl_Entry)( - EvictControl_In *in -); - -typedef const struct { - EvictControl_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} EvictControl_COMMAND_DESCRIPTOR_t; - -EvictControl_COMMAND_DESCRIPTOR_t _EvictControlData = { - /* entry */ &TPM2_EvictControl, - /* inSize */ (UINT16)(sizeof(EvictControl_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(EvictControl_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(EvictControl_In, objectHandle)), - (UINT16)(offsetof(EvictControl_In, persistentHandle))}, - /* types */ {TPMI_RH_PROVISION_H_UNMARSHAL, - TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_DH_PERSISTENT_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _EvictControlDataAddress (&_EvictControlData) -#else -#define _EvictControlDataAddress 0 -#endif // CC_EvictControl - -#if CC_ReadClock - -#include "ReadClock_fp.h" - -typedef TPM_RC (ReadClock_Entry)( - ReadClock_Out *out -); - -typedef const struct { - ReadClock_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} ReadClock_COMMAND_DESCRIPTOR_t; - -ReadClock_COMMAND_DESCRIPTOR_t _ReadClockData = { - /* entry */ &TPM2_ReadClock, - /* inSize */ 0, - /* outSize */ (UINT16)(sizeof(ReadClock_Out)), - /* offsetOfTypes */ offsetof(ReadClock_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {END_OF_LIST, - TPMS_TIME_INFO_P_MARSHAL, - END_OF_LIST} -}; - -#define _ReadClockDataAddress (&_ReadClockData) -#else -#define _ReadClockDataAddress 0 -#endif // CC_ReadClock - -#if CC_ClockSet - -#include "ClockSet_fp.h" - -typedef TPM_RC (ClockSet_Entry)( - ClockSet_In *in -); - -typedef const struct { - ClockSet_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} ClockSet_COMMAND_DESCRIPTOR_t; - -ClockSet_COMMAND_DESCRIPTOR_t _ClockSetData = { - /* entry */ &TPM2_ClockSet, - /* inSize */ (UINT16)(sizeof(ClockSet_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(ClockSet_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ClockSet_In, newTime))}, - /* types */ {TPMI_RH_PROVISION_H_UNMARSHAL, - UINT64_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _ClockSetDataAddress (&_ClockSetData) -#else -#define _ClockSetDataAddress 0 -#endif // CC_ClockSet - -#if CC_ClockRateAdjust - -#include "ClockRateAdjust_fp.h" - -typedef TPM_RC (ClockRateAdjust_Entry)( - ClockRateAdjust_In *in -); - -typedef const struct { - ClockRateAdjust_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} ClockRateAdjust_COMMAND_DESCRIPTOR_t; - -ClockRateAdjust_COMMAND_DESCRIPTOR_t _ClockRateAdjustData = { - /* entry */ &TPM2_ClockRateAdjust, - /* inSize */ (UINT16)(sizeof(ClockRateAdjust_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(ClockRateAdjust_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(ClockRateAdjust_In, rateAdjust))}, - /* types */ {TPMI_RH_PROVISION_H_UNMARSHAL, - TPM_CLOCK_ADJUST_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _ClockRateAdjustDataAddress (&_ClockRateAdjustData) -#else -#define _ClockRateAdjustDataAddress 0 -#endif // CC_ClockRateAdjust - -#if CC_GetCapability - -#include "GetCapability_fp.h" - -typedef TPM_RC (GetCapability_Entry)( - GetCapability_In *in, - GetCapability_Out *out -); - -typedef const struct { - GetCapability_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} GetCapability_COMMAND_DESCRIPTOR_t; - -GetCapability_COMMAND_DESCRIPTOR_t _GetCapabilityData = { - /* entry */ &TPM2_GetCapability, - /* inSize */ (UINT16)(sizeof(GetCapability_In)), - /* outSize */ (UINT16)(sizeof(GetCapability_Out)), - /* offsetOfTypes */ offsetof(GetCapability_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(GetCapability_In, property)), - (UINT16)(offsetof(GetCapability_In, propertyCount)), - (UINT16)(offsetof(GetCapability_Out, capabilityData))}, - /* types */ {TPM_CAP_P_UNMARSHAL, - UINT32_P_UNMARSHAL, - UINT32_P_UNMARSHAL, - END_OF_LIST, - TPMI_YES_NO_P_MARSHAL, - TPMS_CAPABILITY_DATA_P_MARSHAL, - END_OF_LIST} -}; - -#define _GetCapabilityDataAddress (&_GetCapabilityData) -#else -#define _GetCapabilityDataAddress 0 -#endif // CC_GetCapability - -#if CC_TestParms - -#include "TestParms_fp.h" - -typedef TPM_RC (TestParms_Entry)( - TestParms_In *in -); - -typedef const struct { - TestParms_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} TestParms_COMMAND_DESCRIPTOR_t; - -TestParms_COMMAND_DESCRIPTOR_t _TestParmsData = { - /* entry */ &TPM2_TestParms, - /* inSize */ (UINT16)(sizeof(TestParms_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(TestParms_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMT_PUBLIC_PARMS_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _TestParmsDataAddress (&_TestParmsData) -#else -#define _TestParmsDataAddress 0 -#endif // CC_TestParms - -#if CC_NV_DefineSpace - -#include "NV_DefineSpace_fp.h" - -typedef TPM_RC (NV_DefineSpace_Entry)( - NV_DefineSpace_In *in -); - -typedef const struct { - NV_DefineSpace_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} NV_DefineSpace_COMMAND_DESCRIPTOR_t; - -NV_DefineSpace_COMMAND_DESCRIPTOR_t _NV_DefineSpaceData = { - /* entry */ &TPM2_NV_DefineSpace, - /* inSize */ (UINT16)(sizeof(NV_DefineSpace_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_DefineSpace_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_DefineSpace_In, auth)), - (UINT16)(offsetof(NV_DefineSpace_In, publicInfo))}, - /* types */ {TPMI_RH_PROVISION_H_UNMARSHAL, - TPM2B_AUTH_P_UNMARSHAL, - TPM2B_NV_PUBLIC_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_DefineSpaceDataAddress (&_NV_DefineSpaceData) -#else -#define _NV_DefineSpaceDataAddress 0 -#endif // CC_NV_DefineSpace - -#if CC_NV_UndefineSpace - -#include "NV_UndefineSpace_fp.h" - -typedef TPM_RC (NV_UndefineSpace_Entry)( - NV_UndefineSpace_In *in -); - -typedef const struct { - NV_UndefineSpace_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} NV_UndefineSpace_COMMAND_DESCRIPTOR_t; - -NV_UndefineSpace_COMMAND_DESCRIPTOR_t _NV_UndefineSpaceData = { - /* entry */ &TPM2_NV_UndefineSpace, - /* inSize */ (UINT16)(sizeof(NV_UndefineSpace_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_UndefineSpace_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_UndefineSpace_In, nvIndex))}, - /* types */ {TPMI_RH_PROVISION_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_UndefineSpaceDataAddress (&_NV_UndefineSpaceData) -#else -#define _NV_UndefineSpaceDataAddress 0 -#endif // CC_NV_UndefineSpace - -#if CC_NV_UndefineSpaceSpecial - -#include "NV_UndefineSpaceSpecial_fp.h" - -typedef TPM_RC (NV_UndefineSpaceSpecial_Entry)( - NV_UndefineSpaceSpecial_In *in -); - -typedef const struct { - NV_UndefineSpaceSpecial_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} NV_UndefineSpaceSpecial_COMMAND_DESCRIPTOR_t; - -NV_UndefineSpaceSpecial_COMMAND_DESCRIPTOR_t _NV_UndefineSpaceSpecialData = { - /* entry */ &TPM2_NV_UndefineSpaceSpecial, - /* inSize */ (UINT16)(sizeof(NV_UndefineSpaceSpecial_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_UndefineSpaceSpecial_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_UndefineSpaceSpecial_In, platform))}, - /* types */ {TPMI_RH_NV_INDEX_H_UNMARSHAL, - TPMI_RH_PLATFORM_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_UndefineSpaceSpecialDataAddress (&_NV_UndefineSpaceSpecialData) -#else -#define _NV_UndefineSpaceSpecialDataAddress 0 -#endif // CC_NV_UndefineSpaceSpecial - -#if CC_NV_ReadPublic - -#include "NV_ReadPublic_fp.h" - -typedef TPM_RC (NV_ReadPublic_Entry)( - NV_ReadPublic_In *in, - NV_ReadPublic_Out *out -); - -typedef const struct { - NV_ReadPublic_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[5]; -} NV_ReadPublic_COMMAND_DESCRIPTOR_t; - -NV_ReadPublic_COMMAND_DESCRIPTOR_t _NV_ReadPublicData = { - /* entry */ &TPM2_NV_ReadPublic, - /* inSize */ (UINT16)(sizeof(NV_ReadPublic_In)), - /* outSize */ (UINT16)(sizeof(NV_ReadPublic_Out)), - /* offsetOfTypes */ offsetof(NV_ReadPublic_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_ReadPublic_Out, nvName))}, - /* types */ {TPMI_RH_NV_INDEX_H_UNMARSHAL, - END_OF_LIST, - TPM2B_NV_PUBLIC_P_MARSHAL, - TPM2B_NAME_P_MARSHAL, - END_OF_LIST} -}; - -#define _NV_ReadPublicDataAddress (&_NV_ReadPublicData) -#else -#define _NV_ReadPublicDataAddress 0 -#endif // CC_NV_ReadPublic - -#if CC_NV_Write - -#include "NV_Write_fp.h" - -typedef TPM_RC (NV_Write_Entry)( - NV_Write_In *in -); - -typedef const struct { - NV_Write_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[6]; -} NV_Write_COMMAND_DESCRIPTOR_t; - -NV_Write_COMMAND_DESCRIPTOR_t _NV_WriteData = { - /* entry */ &TPM2_NV_Write, - /* inSize */ (UINT16)(sizeof(NV_Write_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_Write_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_Write_In, nvIndex)), - (UINT16)(offsetof(NV_Write_In, data)), - (UINT16)(offsetof(NV_Write_In, offset))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - TPM2B_MAX_NV_BUFFER_P_UNMARSHAL, - UINT16_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_WriteDataAddress (&_NV_WriteData) -#else -#define _NV_WriteDataAddress 0 -#endif // CC_NV_Write - -#if CC_NV_Increment - -#include "NV_Increment_fp.h" - -typedef TPM_RC (NV_Increment_Entry)( - NV_Increment_In *in -); - -typedef const struct { - NV_Increment_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} NV_Increment_COMMAND_DESCRIPTOR_t; - -NV_Increment_COMMAND_DESCRIPTOR_t _NV_IncrementData = { - /* entry */ &TPM2_NV_Increment, - /* inSize */ (UINT16)(sizeof(NV_Increment_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_Increment_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_Increment_In, nvIndex))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_IncrementDataAddress (&_NV_IncrementData) -#else -#define _NV_IncrementDataAddress 0 -#endif // CC_NV_Increment - -#if CC_NV_Extend - -#include "NV_Extend_fp.h" - -typedef TPM_RC (NV_Extend_Entry)( - NV_Extend_In *in -); - -typedef const struct { - NV_Extend_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} NV_Extend_COMMAND_DESCRIPTOR_t; - -NV_Extend_COMMAND_DESCRIPTOR_t _NV_ExtendData = { - /* entry */ &TPM2_NV_Extend, - /* inSize */ (UINT16)(sizeof(NV_Extend_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_Extend_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_Extend_In, nvIndex)), - (UINT16)(offsetof(NV_Extend_In, data))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - TPM2B_MAX_NV_BUFFER_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_ExtendDataAddress (&_NV_ExtendData) -#else -#define _NV_ExtendDataAddress 0 -#endif // CC_NV_Extend - -#if CC_NV_SetBits - -#include "NV_SetBits_fp.h" - -typedef TPM_RC (NV_SetBits_Entry)( - NV_SetBits_In *in -); - -typedef const struct { - NV_SetBits_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[2]; - BYTE types[5]; -} NV_SetBits_COMMAND_DESCRIPTOR_t; - -NV_SetBits_COMMAND_DESCRIPTOR_t _NV_SetBitsData = { - /* entry */ &TPM2_NV_SetBits, - /* inSize */ (UINT16)(sizeof(NV_SetBits_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_SetBits_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_SetBits_In, nvIndex)), - (UINT16)(offsetof(NV_SetBits_In, bits))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - UINT64_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_SetBitsDataAddress (&_NV_SetBitsData) -#else -#define _NV_SetBitsDataAddress 0 -#endif // CC_NV_SetBits - -#if CC_NV_WriteLock - -#include "NV_WriteLock_fp.h" - -typedef TPM_RC (NV_WriteLock_Entry)( - NV_WriteLock_In *in -); - -typedef const struct { - NV_WriteLock_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} NV_WriteLock_COMMAND_DESCRIPTOR_t; - -NV_WriteLock_COMMAND_DESCRIPTOR_t _NV_WriteLockData = { - /* entry */ &TPM2_NV_WriteLock, - /* inSize */ (UINT16)(sizeof(NV_WriteLock_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_WriteLock_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_WriteLock_In, nvIndex))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_WriteLockDataAddress (&_NV_WriteLockData) -#else -#define _NV_WriteLockDataAddress 0 -#endif // CC_NV_WriteLock - -#if CC_NV_GlobalWriteLock - -#include "NV_GlobalWriteLock_fp.h" - -typedef TPM_RC (NV_GlobalWriteLock_Entry)( - NV_GlobalWriteLock_In *in -); - -typedef const struct { - NV_GlobalWriteLock_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[3]; -} NV_GlobalWriteLock_COMMAND_DESCRIPTOR_t; - -NV_GlobalWriteLock_COMMAND_DESCRIPTOR_t _NV_GlobalWriteLockData = { - /* entry */ &TPM2_NV_GlobalWriteLock, - /* inSize */ (UINT16)(sizeof(NV_GlobalWriteLock_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_GlobalWriteLock_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPMI_RH_PROVISION_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_GlobalWriteLockDataAddress (&_NV_GlobalWriteLockData) -#else -#define _NV_GlobalWriteLockDataAddress 0 -#endif // CC_NV_GlobalWriteLock - -#if CC_NV_Read - -#include "NV_Read_fp.h" - -typedef TPM_RC (NV_Read_Entry)( - NV_Read_In *in, - NV_Read_Out *out -); - -typedef const struct { - NV_Read_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} NV_Read_COMMAND_DESCRIPTOR_t; - -NV_Read_COMMAND_DESCRIPTOR_t _NV_ReadData = { - /* entry */ &TPM2_NV_Read, - /* inSize */ (UINT16)(sizeof(NV_Read_In)), - /* outSize */ (UINT16)(sizeof(NV_Read_Out)), - /* offsetOfTypes */ offsetof(NV_Read_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_Read_In, nvIndex)), - (UINT16)(offsetof(NV_Read_In, size)), - (UINT16)(offsetof(NV_Read_In, offset))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - UINT16_P_UNMARSHAL, - UINT16_P_UNMARSHAL, - END_OF_LIST, - TPM2B_MAX_NV_BUFFER_P_MARSHAL, - END_OF_LIST} -}; - -#define _NV_ReadDataAddress (&_NV_ReadData) -#else -#define _NV_ReadDataAddress 0 -#endif // CC_NV_Read - -#if CC_NV_ReadLock - -#include "NV_ReadLock_fp.h" - -typedef TPM_RC (NV_ReadLock_Entry)( - NV_ReadLock_In *in -); - -typedef const struct { - NV_ReadLock_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} NV_ReadLock_COMMAND_DESCRIPTOR_t; - -NV_ReadLock_COMMAND_DESCRIPTOR_t _NV_ReadLockData = { - /* entry */ &TPM2_NV_ReadLock, - /* inSize */ (UINT16)(sizeof(NV_ReadLock_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_ReadLock_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_ReadLock_In, nvIndex))}, - /* types */ {TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_ReadLockDataAddress (&_NV_ReadLockData) -#else -#define _NV_ReadLockDataAddress 0 -#endif // CC_NV_ReadLock - -#if CC_NV_ChangeAuth - -#include "NV_ChangeAuth_fp.h" - -typedef TPM_RC (NV_ChangeAuth_Entry)( - NV_ChangeAuth_In *in -); - -typedef const struct { - NV_ChangeAuth_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[1]; - BYTE types[4]; -} NV_ChangeAuth_COMMAND_DESCRIPTOR_t; - -NV_ChangeAuth_COMMAND_DESCRIPTOR_t _NV_ChangeAuthData = { - /* entry */ &TPM2_NV_ChangeAuth, - /* inSize */ (UINT16)(sizeof(NV_ChangeAuth_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(NV_ChangeAuth_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_ChangeAuth_In, newAuth))}, - /* types */ {TPMI_RH_NV_INDEX_H_UNMARSHAL, - TPM2B_AUTH_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _NV_ChangeAuthDataAddress (&_NV_ChangeAuthData) -#else -#define _NV_ChangeAuthDataAddress 0 -#endif // CC_NV_ChangeAuth - -#if CC_NV_Certify - -#include "NV_Certify_fp.h" - -typedef TPM_RC (NV_Certify_Entry)( - NV_Certify_In *in, - NV_Certify_Out *out -); - -typedef const struct { - NV_Certify_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[7]; - BYTE types[11]; -} NV_Certify_COMMAND_DESCRIPTOR_t; - -NV_Certify_COMMAND_DESCRIPTOR_t _NV_CertifyData = { - /* entry */ &TPM2_NV_Certify, - /* inSize */ (UINT16)(sizeof(NV_Certify_In)), - /* outSize */ (UINT16)(sizeof(NV_Certify_Out)), - /* offsetOfTypes */ offsetof(NV_Certify_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(NV_Certify_In, authHandle)), - (UINT16)(offsetof(NV_Certify_In, nvIndex)), - (UINT16)(offsetof(NV_Certify_In, qualifyingData)), - (UINT16)(offsetof(NV_Certify_In, inScheme)), - (UINT16)(offsetof(NV_Certify_In, size)), - (UINT16)(offsetof(NV_Certify_In, offset)), - (UINT16)(offsetof(NV_Certify_Out, signature))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL + ADD_FLAG, - TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_NV_INDEX_H_UNMARSHAL, - TPM2B_DATA_P_UNMARSHAL, - TPMT_SIG_SCHEME_P_UNMARSHAL + ADD_FLAG, - UINT16_P_UNMARSHAL, - UINT16_P_UNMARSHAL, - END_OF_LIST, - TPM2B_ATTEST_P_MARSHAL, - TPMT_SIGNATURE_P_MARSHAL, - END_OF_LIST} -}; - -#define _NV_CertifyDataAddress (&_NV_CertifyData) -#else -#define _NV_CertifyDataAddress 0 -#endif // CC_NV_Certify - -#if CC_AC_GetCapability - -#include "AC_GetCapability_fp.h" - -typedef TPM_RC (AC_GetCapability_Entry)( - AC_GetCapability_In *in, - AC_GetCapability_Out *out -); - -typedef const struct { - AC_GetCapability_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} AC_GetCapability_COMMAND_DESCRIPTOR_t; - -AC_GetCapability_COMMAND_DESCRIPTOR_t _AC_GetCapabilityData = { - /* entry */ &TPM2_AC_GetCapability, - /* inSize */ (UINT16)(sizeof(AC_GetCapability_In)), - /* outSize */ (UINT16)(sizeof(AC_GetCapability_Out)), - /* offsetOfTypes */ offsetof(AC_GetCapability_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(AC_GetCapability_In, capability)), - (UINT16)(offsetof(AC_GetCapability_In, count)), - (UINT16)(offsetof(AC_GetCapability_Out, capabilitiesData))}, - /* types */ {TPMI_RH_AC_H_UNMARSHAL, - TPM_AT_P_UNMARSHAL, - UINT32_P_UNMARSHAL, - END_OF_LIST, - TPMI_YES_NO_P_MARSHAL, - TPML_AC_CAPABILITIES_P_MARSHAL, - END_OF_LIST} -}; - -#define _AC_GetCapabilityDataAddress (&_AC_GetCapabilityData) -#else -#define _AC_GetCapabilityDataAddress 0 -#endif // CC_AC_GetCapability - -#if CC_AC_Send - -#include "AC_Send_fp.h" - -typedef TPM_RC (AC_Send_Entry)( - AC_Send_In *in, - AC_Send_Out *out -); - -typedef const struct { - AC_Send_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[3]; - BYTE types[7]; -} AC_Send_COMMAND_DESCRIPTOR_t; - -AC_Send_COMMAND_DESCRIPTOR_t _AC_SendData = { - /* entry */ &TPM2_AC_Send, - /* inSize */ (UINT16)(sizeof(AC_Send_In)), - /* outSize */ (UINT16)(sizeof(AC_Send_Out)), - /* offsetOfTypes */ offsetof(AC_Send_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(AC_Send_In, authHandle)), - (UINT16)(offsetof(AC_Send_In, ac)), - (UINT16)(offsetof(AC_Send_In, acDataIn))}, - /* types */ {TPMI_DH_OBJECT_H_UNMARSHAL, - TPMI_RH_NV_AUTH_H_UNMARSHAL, - TPMI_RH_AC_H_UNMARSHAL, - TPM2B_MAX_BUFFER_P_UNMARSHAL, - END_OF_LIST, - TPMS_AC_OUTPUT_P_MARSHAL, - END_OF_LIST} -}; - -#define _AC_SendDataAddress (&_AC_SendData) -#else -#define _AC_SendDataAddress 0 -#endif // CC_AC_Send - -#if CC_Policy_AC_SendSelect - -#include "Policy_AC_SendSelect_fp.h" - -typedef TPM_RC (Policy_AC_SendSelect_Entry)( - Policy_AC_SendSelect_In *in -); - -typedef const struct { - Policy_AC_SendSelect_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - UINT16 paramOffsets[4]; - BYTE types[7]; -} Policy_AC_SendSelect_COMMAND_DESCRIPTOR_t; - -Policy_AC_SendSelect_COMMAND_DESCRIPTOR_t _Policy_AC_SendSelectData = { - /* entry */ &TPM2_Policy_AC_SendSelect, - /* inSize */ (UINT16)(sizeof(Policy_AC_SendSelect_In)), - /* outSize */ 0, - /* offsetOfTypes */ offsetof(Policy_AC_SendSelect_COMMAND_DESCRIPTOR_t, types), - /* offsets */ {(UINT16)(offsetof(Policy_AC_SendSelect_In, objectName)), - (UINT16)(offsetof(Policy_AC_SendSelect_In, authHandleName)), - (UINT16)(offsetof(Policy_AC_SendSelect_In, acName)), - (UINT16)(offsetof(Policy_AC_SendSelect_In, includeObject))}, - /* types */ {TPMI_SH_POLICY_H_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - TPM2B_NAME_P_UNMARSHAL, - TPMI_YES_NO_P_UNMARSHAL, - END_OF_LIST, - END_OF_LIST} -}; - -#define _Policy_AC_SendSelectDataAddress (&_Policy_AC_SendSelectData) -#else -#define _Policy_AC_SendSelectDataAddress 0 -#endif // CC_Policy_AC_SendSelect - -#if CC_Vendor_TCG_Test - -#include "Vendor_TCG_Test_fp.h" - -typedef TPM_RC (Vendor_TCG_Test_Entry)( - Vendor_TCG_Test_In *in, - Vendor_TCG_Test_Out *out -); - -typedef const struct { - Vendor_TCG_Test_Entry *entry; - UINT16 inSize; - UINT16 outSize; - UINT16 offsetOfTypes; - BYTE types[4]; -} Vendor_TCG_Test_COMMAND_DESCRIPTOR_t; - -Vendor_TCG_Test_COMMAND_DESCRIPTOR_t _Vendor_TCG_TestData = { - /* entry */ &TPM2_Vendor_TCG_Test, - /* inSize */ (UINT16)(sizeof(Vendor_TCG_Test_In)), - /* outSize */ (UINT16)(sizeof(Vendor_TCG_Test_Out)), - /* offsetOfTypes */ offsetof(Vendor_TCG_Test_COMMAND_DESCRIPTOR_t, types), - /* offsets */ // No parameter offsets; - /* types */ {TPM2B_DATA_P_UNMARSHAL, - END_OF_LIST, - TPM2B_DATA_P_MARSHAL, - END_OF_LIST} -}; - -#define _Vendor_TCG_TestDataAddress (&_Vendor_TCG_TestData) -#else -#define _Vendor_TCG_TestDataAddress 0 -#endif // CC_Vendor_TCG_Test - -COMMAND_DESCRIPTOR_t *s_CommandDataArray[] = { -#if (PAD_LIST || CC_NV_UndefineSpaceSpecial) - (COMMAND_DESCRIPTOR_t *)_NV_UndefineSpaceSpecialDataAddress, -#endif // CC_NV_UndefineSpaceSpecial -#if (PAD_LIST || CC_EvictControl) - (COMMAND_DESCRIPTOR_t *)_EvictControlDataAddress, -#endif // CC_EvictControl -#if (PAD_LIST || CC_HierarchyControl) - (COMMAND_DESCRIPTOR_t *)_HierarchyControlDataAddress, -#endif // CC_HierarchyControl -#if (PAD_LIST || CC_NV_UndefineSpace) - (COMMAND_DESCRIPTOR_t *)_NV_UndefineSpaceDataAddress, -#endif // CC_NV_UndefineSpace -#if (PAD_LIST) - (COMMAND_DESCRIPTOR_t *)0, -#endif // -#if (PAD_LIST || CC_ChangeEPS) - (COMMAND_DESCRIPTOR_t *)_ChangeEPSDataAddress, -#endif // CC_ChangeEPS -#if (PAD_LIST || CC_ChangePPS) - (COMMAND_DESCRIPTOR_t *)_ChangePPSDataAddress, -#endif // CC_ChangePPS -#if (PAD_LIST || CC_Clear) - (COMMAND_DESCRIPTOR_t *)_ClearDataAddress, -#endif // CC_Clear -#if (PAD_LIST || CC_ClearControl) - (COMMAND_DESCRIPTOR_t *)_ClearControlDataAddress, -#endif // CC_ClearControl -#if (PAD_LIST || CC_ClockSet) - (COMMAND_DESCRIPTOR_t *)_ClockSetDataAddress, -#endif // CC_ClockSet -#if (PAD_LIST || CC_HierarchyChangeAuth) - (COMMAND_DESCRIPTOR_t *)_HierarchyChangeAuthDataAddress, -#endif // CC_HierarchyChangeAuth -#if (PAD_LIST || CC_NV_DefineSpace) - (COMMAND_DESCRIPTOR_t *)_NV_DefineSpaceDataAddress, -#endif // CC_NV_DefineSpace -#if (PAD_LIST || CC_PCR_Allocate) - (COMMAND_DESCRIPTOR_t *)_PCR_AllocateDataAddress, -#endif // CC_PCR_Allocate -#if (PAD_LIST || CC_PCR_SetAuthPolicy) - (COMMAND_DESCRIPTOR_t *)_PCR_SetAuthPolicyDataAddress, -#endif // CC_PCR_SetAuthPolicy -#if (PAD_LIST || CC_PP_Commands) - (COMMAND_DESCRIPTOR_t *)_PP_CommandsDataAddress, -#endif // CC_PP_Commands -#if (PAD_LIST || CC_SetPrimaryPolicy) - (COMMAND_DESCRIPTOR_t *)_SetPrimaryPolicyDataAddress, -#endif // CC_SetPrimaryPolicy -#if (PAD_LIST || CC_FieldUpgradeStart) - (COMMAND_DESCRIPTOR_t *)_FieldUpgradeStartDataAddress, -#endif // CC_FieldUpgradeStart -#if (PAD_LIST || CC_ClockRateAdjust) - (COMMAND_DESCRIPTOR_t *)_ClockRateAdjustDataAddress, -#endif // CC_ClockRateAdjust -#if (PAD_LIST || CC_CreatePrimary) - (COMMAND_DESCRIPTOR_t *)_CreatePrimaryDataAddress, -#endif // CC_CreatePrimary -#if (PAD_LIST || CC_NV_GlobalWriteLock) - (COMMAND_DESCRIPTOR_t *)_NV_GlobalWriteLockDataAddress, -#endif // CC_NV_GlobalWriteLock -#if (PAD_LIST || CC_GetCommandAuditDigest) - (COMMAND_DESCRIPTOR_t *)_GetCommandAuditDigestDataAddress, -#endif // CC_GetCommandAuditDigest -#if (PAD_LIST || CC_NV_Increment) - (COMMAND_DESCRIPTOR_t *)_NV_IncrementDataAddress, -#endif // CC_NV_Increment -#if (PAD_LIST || CC_NV_SetBits) - (COMMAND_DESCRIPTOR_t *)_NV_SetBitsDataAddress, -#endif // CC_NV_SetBits -#if (PAD_LIST || CC_NV_Extend) - (COMMAND_DESCRIPTOR_t *)_NV_ExtendDataAddress, -#endif // CC_NV_Extend -#if (PAD_LIST || CC_NV_Write) - (COMMAND_DESCRIPTOR_t *)_NV_WriteDataAddress, -#endif // CC_NV_Write -#if (PAD_LIST || CC_NV_WriteLock) - (COMMAND_DESCRIPTOR_t *)_NV_WriteLockDataAddress, -#endif // CC_NV_WriteLock -#if (PAD_LIST || CC_DictionaryAttackLockReset) - (COMMAND_DESCRIPTOR_t *)_DictionaryAttackLockResetDataAddress, -#endif // CC_DictionaryAttackLockReset -#if (PAD_LIST || CC_DictionaryAttackParameters) - (COMMAND_DESCRIPTOR_t *)_DictionaryAttackParametersDataAddress, -#endif // CC_DictionaryAttackParameters -#if (PAD_LIST || CC_NV_ChangeAuth) - (COMMAND_DESCRIPTOR_t *)_NV_ChangeAuthDataAddress, -#endif // CC_NV_ChangeAuth -#if (PAD_LIST || CC_PCR_Event) - (COMMAND_DESCRIPTOR_t *)_PCR_EventDataAddress, -#endif // CC_PCR_Event -#if (PAD_LIST || CC_PCR_Reset) - (COMMAND_DESCRIPTOR_t *)_PCR_ResetDataAddress, -#endif // CC_PCR_Reset -#if (PAD_LIST || CC_SequenceComplete) - (COMMAND_DESCRIPTOR_t *)_SequenceCompleteDataAddress, -#endif // CC_SequenceComplete -#if (PAD_LIST || CC_SetAlgorithmSet) - (COMMAND_DESCRIPTOR_t *)_SetAlgorithmSetDataAddress, -#endif // CC_SetAlgorithmSet -#if (PAD_LIST || CC_SetCommandCodeAuditStatus) - (COMMAND_DESCRIPTOR_t *)_SetCommandCodeAuditStatusDataAddress, -#endif // CC_SetCommandCodeAuditStatus -#if (PAD_LIST || CC_FieldUpgradeData) - (COMMAND_DESCRIPTOR_t *)_FieldUpgradeDataDataAddress, -#endif // CC_FieldUpgradeData -#if (PAD_LIST || CC_IncrementalSelfTest) - (COMMAND_DESCRIPTOR_t *)_IncrementalSelfTestDataAddress, -#endif // CC_IncrementalSelfTest -#if (PAD_LIST || CC_SelfTest) - (COMMAND_DESCRIPTOR_t *)_SelfTestDataAddress, -#endif // CC_SelfTest -#if (PAD_LIST || CC_Startup) - (COMMAND_DESCRIPTOR_t *)_StartupDataAddress, -#endif // CC_Startup -#if (PAD_LIST || CC_Shutdown) - (COMMAND_DESCRIPTOR_t *)_ShutdownDataAddress, -#endif // CC_Shutdown -#if (PAD_LIST || CC_StirRandom) - (COMMAND_DESCRIPTOR_t *)_StirRandomDataAddress, -#endif // CC_StirRandom -#if (PAD_LIST || CC_ActivateCredential) - (COMMAND_DESCRIPTOR_t *)_ActivateCredentialDataAddress, -#endif // CC_ActivateCredential -#if (PAD_LIST || CC_Certify) - (COMMAND_DESCRIPTOR_t *)_CertifyDataAddress, -#endif // CC_Certify -#if (PAD_LIST || CC_PolicyNV) - (COMMAND_DESCRIPTOR_t *)_PolicyNVDataAddress, -#endif // CC_PolicyNV -#if (PAD_LIST || CC_CertifyCreation) - (COMMAND_DESCRIPTOR_t *)_CertifyCreationDataAddress, -#endif // CC_CertifyCreation -#if (PAD_LIST || CC_Duplicate) - (COMMAND_DESCRIPTOR_t *)_DuplicateDataAddress, -#endif // CC_Duplicate -#if (PAD_LIST || CC_GetTime) - (COMMAND_DESCRIPTOR_t *)_GetTimeDataAddress, -#endif // CC_GetTime -#if (PAD_LIST || CC_GetSessionAuditDigest) - (COMMAND_DESCRIPTOR_t *)_GetSessionAuditDigestDataAddress, -#endif // CC_GetSessionAuditDigest -#if (PAD_LIST || CC_NV_Read) - (COMMAND_DESCRIPTOR_t *)_NV_ReadDataAddress, -#endif // CC_NV_Read -#if (PAD_LIST || CC_NV_ReadLock) - (COMMAND_DESCRIPTOR_t *)_NV_ReadLockDataAddress, -#endif // CC_NV_ReadLock -#if (PAD_LIST || CC_ObjectChangeAuth) - (COMMAND_DESCRIPTOR_t *)_ObjectChangeAuthDataAddress, -#endif // CC_ObjectChangeAuth -#if (PAD_LIST || CC_PolicySecret) - (COMMAND_DESCRIPTOR_t *)_PolicySecretDataAddress, -#endif // CC_PolicySecret -#if (PAD_LIST || CC_Rewrap) - (COMMAND_DESCRIPTOR_t *)_RewrapDataAddress, -#endif // CC_Rewrap -#if (PAD_LIST || CC_Create) - (COMMAND_DESCRIPTOR_t *)_CreateDataAddress, -#endif // CC_Create -#if (PAD_LIST || CC_ECDH_ZGen) - (COMMAND_DESCRIPTOR_t *)_ECDH_ZGenDataAddress, -#endif // CC_ECDH_ZGen -#if (PAD_LIST || (CC_HMAC || CC_MAC)) -# if CC_HMAC - (COMMAND_DESCRIPTOR_t *)_HMACDataAddress, -# endif -# if CC_MAC - (COMMAND_DESCRIPTOR_t *)_MACDataAddress, -# endif -# if (CC_HMAC || CC_MAC) > 1 -# error "More than one aliased command defined" -# endif -#endif // CC_HMAC CC_MAC -#if (PAD_LIST || CC_Import) - (COMMAND_DESCRIPTOR_t *)_ImportDataAddress, -#endif // CC_Import -#if (PAD_LIST || CC_Load) - (COMMAND_DESCRIPTOR_t *)_LoadDataAddress, -#endif // CC_Load -#if (PAD_LIST || CC_Quote) - (COMMAND_DESCRIPTOR_t *)_QuoteDataAddress, -#endif // CC_Quote -#if (PAD_LIST || CC_RSA_Decrypt) - (COMMAND_DESCRIPTOR_t *)_RSA_DecryptDataAddress, -#endif // CC_RSA_Decrypt -#if (PAD_LIST) - (COMMAND_DESCRIPTOR_t *)0, -#endif // -#if (PAD_LIST || (CC_HMAC_Start || CC_MAC_Start)) -# if CC_HMAC_Start - (COMMAND_DESCRIPTOR_t *)_HMAC_StartDataAddress, -# endif -# if CC_MAC_Start - (COMMAND_DESCRIPTOR_t *)_MAC_StartDataAddress, -# endif -# if (CC_HMAC_Start || CC_MAC_Start) > 1 -# error "More than one aliased command defined" -# endif -#endif // CC_HMAC_Start CC_MAC_Start -#if (PAD_LIST || CC_SequenceUpdate) - (COMMAND_DESCRIPTOR_t *)_SequenceUpdateDataAddress, -#endif // CC_SequenceUpdate -#if (PAD_LIST || CC_Sign) - (COMMAND_DESCRIPTOR_t *)_SignDataAddress, -#endif // CC_Sign -#if (PAD_LIST || CC_Unseal) - (COMMAND_DESCRIPTOR_t *)_UnsealDataAddress, -#endif // CC_Unseal -#if (PAD_LIST) - (COMMAND_DESCRIPTOR_t *)0, -#endif // -#if (PAD_LIST || CC_PolicySigned) - (COMMAND_DESCRIPTOR_t *)_PolicySignedDataAddress, -#endif // CC_PolicySigned -#if (PAD_LIST || CC_ContextLoad) - (COMMAND_DESCRIPTOR_t *)_ContextLoadDataAddress, -#endif // CC_ContextLoad -#if (PAD_LIST || CC_ContextSave) - (COMMAND_DESCRIPTOR_t *)_ContextSaveDataAddress, -#endif // CC_ContextSave -#if (PAD_LIST || CC_ECDH_KeyGen) - (COMMAND_DESCRIPTOR_t *)_ECDH_KeyGenDataAddress, -#endif // CC_ECDH_KeyGen -#if (PAD_LIST || CC_EncryptDecrypt) - (COMMAND_DESCRIPTOR_t *)_EncryptDecryptDataAddress, -#endif // CC_EncryptDecrypt -#if (PAD_LIST || CC_FlushContext) - (COMMAND_DESCRIPTOR_t *)_FlushContextDataAddress, -#endif // CC_FlushContext -#if (PAD_LIST) - (COMMAND_DESCRIPTOR_t *)0, -#endif // -#if (PAD_LIST || CC_LoadExternal) - (COMMAND_DESCRIPTOR_t *)_LoadExternalDataAddress, -#endif // CC_LoadExternal -#if (PAD_LIST || CC_MakeCredential) - (COMMAND_DESCRIPTOR_t *)_MakeCredentialDataAddress, -#endif // CC_MakeCredential -#if (PAD_LIST || CC_NV_ReadPublic) - (COMMAND_DESCRIPTOR_t *)_NV_ReadPublicDataAddress, -#endif // CC_NV_ReadPublic -#if (PAD_LIST || CC_PolicyAuthorize) - (COMMAND_DESCRIPTOR_t *)_PolicyAuthorizeDataAddress, -#endif // CC_PolicyAuthorize -#if (PAD_LIST || CC_PolicyAuthValue) - (COMMAND_DESCRIPTOR_t *)_PolicyAuthValueDataAddress, -#endif // CC_PolicyAuthValue -#if (PAD_LIST || CC_PolicyCommandCode) - (COMMAND_DESCRIPTOR_t *)_PolicyCommandCodeDataAddress, -#endif // CC_PolicyCommandCode -#if (PAD_LIST || CC_PolicyCounterTimer) - (COMMAND_DESCRIPTOR_t *)_PolicyCounterTimerDataAddress, -#endif // CC_PolicyCounterTimer -#if (PAD_LIST || CC_PolicyCpHash) - (COMMAND_DESCRIPTOR_t *)_PolicyCpHashDataAddress, -#endif // CC_PolicyCpHash -#if (PAD_LIST || CC_PolicyLocality) - (COMMAND_DESCRIPTOR_t *)_PolicyLocalityDataAddress, -#endif // CC_PolicyLocality -#if (PAD_LIST || CC_PolicyNameHash) - (COMMAND_DESCRIPTOR_t *)_PolicyNameHashDataAddress, -#endif // CC_PolicyNameHash -#if (PAD_LIST || CC_PolicyOR) - (COMMAND_DESCRIPTOR_t *)_PolicyORDataAddress, -#endif // CC_PolicyOR -#if (PAD_LIST || CC_PolicyTicket) - (COMMAND_DESCRIPTOR_t *)_PolicyTicketDataAddress, -#endif // CC_PolicyTicket -#if (PAD_LIST || CC_ReadPublic) - (COMMAND_DESCRIPTOR_t *)_ReadPublicDataAddress, -#endif // CC_ReadPublic -#if (PAD_LIST || CC_RSA_Encrypt) - (COMMAND_DESCRIPTOR_t *)_RSA_EncryptDataAddress, -#endif // CC_RSA_Encrypt -#if (PAD_LIST) - (COMMAND_DESCRIPTOR_t *)0, -#endif // -#if (PAD_LIST || CC_StartAuthSession) - (COMMAND_DESCRIPTOR_t *)_StartAuthSessionDataAddress, -#endif // CC_StartAuthSession -#if (PAD_LIST || CC_VerifySignature) - (COMMAND_DESCRIPTOR_t *)_VerifySignatureDataAddress, -#endif // CC_VerifySignature -#if (PAD_LIST || CC_ECC_Parameters) - (COMMAND_DESCRIPTOR_t *)_ECC_ParametersDataAddress, -#endif // CC_ECC_Parameters -#if (PAD_LIST || CC_FirmwareRead) - (COMMAND_DESCRIPTOR_t *)_FirmwareReadDataAddress, -#endif // CC_FirmwareRead -#if (PAD_LIST || CC_GetCapability) - (COMMAND_DESCRIPTOR_t *)_GetCapabilityDataAddress, -#endif // CC_GetCapability -#if (PAD_LIST || CC_GetRandom) - (COMMAND_DESCRIPTOR_t *)_GetRandomDataAddress, -#endif // CC_GetRandom -#if (PAD_LIST || CC_GetTestResult) - (COMMAND_DESCRIPTOR_t *)_GetTestResultDataAddress, -#endif // CC_GetTestResult -#if (PAD_LIST || CC_Hash) - (COMMAND_DESCRIPTOR_t *)_HashDataAddress, -#endif // CC_Hash -#if (PAD_LIST || CC_PCR_Read) - (COMMAND_DESCRIPTOR_t *)_PCR_ReadDataAddress, -#endif // CC_PCR_Read -#if (PAD_LIST || CC_PolicyPCR) - (COMMAND_DESCRIPTOR_t *)_PolicyPCRDataAddress, -#endif // CC_PolicyPCR -#if (PAD_LIST || CC_PolicyRestart) - (COMMAND_DESCRIPTOR_t *)_PolicyRestartDataAddress, -#endif // CC_PolicyRestart -#if (PAD_LIST || CC_ReadClock) - (COMMAND_DESCRIPTOR_t *)_ReadClockDataAddress, -#endif // CC_ReadClock -#if (PAD_LIST || CC_PCR_Extend) - (COMMAND_DESCRIPTOR_t *)_PCR_ExtendDataAddress, -#endif // CC_PCR_Extend -#if (PAD_LIST || CC_PCR_SetAuthValue) - (COMMAND_DESCRIPTOR_t *)_PCR_SetAuthValueDataAddress, -#endif // CC_PCR_SetAuthValue -#if (PAD_LIST || CC_NV_Certify) - (COMMAND_DESCRIPTOR_t *)_NV_CertifyDataAddress, -#endif // CC_NV_Certify -#if (PAD_LIST || CC_EventSequenceComplete) - (COMMAND_DESCRIPTOR_t *)_EventSequenceCompleteDataAddress, -#endif // CC_EventSequenceComplete -#if (PAD_LIST || CC_HashSequenceStart) - (COMMAND_DESCRIPTOR_t *)_HashSequenceStartDataAddress, -#endif // CC_HashSequenceStart -#if (PAD_LIST || CC_PolicyPhysicalPresence) - (COMMAND_DESCRIPTOR_t *)_PolicyPhysicalPresenceDataAddress, -#endif // CC_PolicyPhysicalPresence -#if (PAD_LIST || CC_PolicyDuplicationSelect) - (COMMAND_DESCRIPTOR_t *)_PolicyDuplicationSelectDataAddress, -#endif // CC_PolicyDuplicationSelect -#if (PAD_LIST || CC_PolicyGetDigest) - (COMMAND_DESCRIPTOR_t *)_PolicyGetDigestDataAddress, -#endif // CC_PolicyGetDigest -#if (PAD_LIST || CC_TestParms) - (COMMAND_DESCRIPTOR_t *)_TestParmsDataAddress, -#endif // CC_TestParms -#if (PAD_LIST || CC_Commit) - (COMMAND_DESCRIPTOR_t *)_CommitDataAddress, -#endif // CC_Commit -#if (PAD_LIST || CC_PolicyPassword) - (COMMAND_DESCRIPTOR_t *)_PolicyPasswordDataAddress, -#endif // CC_PolicyPassword -#if (PAD_LIST || CC_ZGen_2Phase) - (COMMAND_DESCRIPTOR_t *)_ZGen_2PhaseDataAddress, -#endif // CC_ZGen_2Phase -#if (PAD_LIST || CC_EC_Ephemeral) - (COMMAND_DESCRIPTOR_t *)_EC_EphemeralDataAddress, -#endif // CC_EC_Ephemeral -#if (PAD_LIST || CC_PolicyNvWritten) - (COMMAND_DESCRIPTOR_t *)_PolicyNvWrittenDataAddress, -#endif // CC_PolicyNvWritten -#if (PAD_LIST || CC_PolicyTemplate) - (COMMAND_DESCRIPTOR_t *)_PolicyTemplateDataAddress, -#endif // CC_PolicyTemplate -#if (PAD_LIST || CC_CreateLoaded) - (COMMAND_DESCRIPTOR_t *)_CreateLoadedDataAddress, -#endif // CC_CreateLoaded -#if (PAD_LIST || CC_PolicyAuthorizeNV) - (COMMAND_DESCRIPTOR_t *)_PolicyAuthorizeNVDataAddress, -#endif // CC_PolicyAuthorizeNV -#if (PAD_LIST || CC_EncryptDecrypt2) - (COMMAND_DESCRIPTOR_t *)_EncryptDecrypt2DataAddress, -#endif // CC_EncryptDecrypt2 -#if (PAD_LIST || CC_AC_GetCapability) - (COMMAND_DESCRIPTOR_t *)_AC_GetCapabilityDataAddress, -#endif // CC_AC_GetCapability -#if (PAD_LIST || CC_AC_Send) - (COMMAND_DESCRIPTOR_t *)_AC_SendDataAddress, -#endif // CC_AC_Send -#if (PAD_LIST || CC_Policy_AC_SendSelect) - (COMMAND_DESCRIPTOR_t *)_Policy_AC_SendSelectDataAddress, -#endif // CC_Policy_AC_SendSelect -#if (PAD_LIST || CC_CertifyX509) - (COMMAND_DESCRIPTOR_t *)_CertifyX509DataAddress, -#endif // CC_CertifyX509 -#if (PAD_LIST || CC_Vendor_TCG_Test) - (COMMAND_DESCRIPTOR_t *)_Vendor_TCG_TestDataAddress, -#endif // CC_Vendor_TCG_Test - 0 -}; - - -#endif // _COMMAND_TABLE_DISPATCH_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandDispatcher.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandDispatcher.h deleted file mode 100644 index 78c3f855a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CommandDispatcher.h +++ /dev/null @@ -1,2051 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmDispatch; Version 4.0 July 8,2017 - * Date: Oct 27, 2018 Time: 06:49:39PM - */ - -// This macro is added just so that the code is only excessively long. -#define EXIT_IF_ERROR_PLUS(x) \ - if(TPM_RC_SUCCESS != result) { result += (x); goto Exit; } -#if CC_Startup -case TPM_CC_Startup: { - Startup_In *in = (Startup_In *) - MemoryGetInBuffer(sizeof(Startup_In)); - result = TPM_SU_Unmarshal(&in->startupType, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Startup_startupType); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Startup (in); -break; -} -#endif // CC_Startup -#if CC_Shutdown -case TPM_CC_Shutdown: { - Shutdown_In *in = (Shutdown_In *) - MemoryGetInBuffer(sizeof(Shutdown_In)); - result = TPM_SU_Unmarshal(&in->shutdownType, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Shutdown_shutdownType); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Shutdown (in); -break; -} -#endif // CC_Shutdown -#if CC_SelfTest -case TPM_CC_SelfTest: { - SelfTest_In *in = (SelfTest_In *) - MemoryGetInBuffer(sizeof(SelfTest_In)); - result = TPMI_YES_NO_Unmarshal(&in->fullTest, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_SelfTest_fullTest); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_SelfTest (in); -break; -} -#endif // CC_SelfTest -#if CC_IncrementalSelfTest -case TPM_CC_IncrementalSelfTest: { - IncrementalSelfTest_In *in = (IncrementalSelfTest_In *) - MemoryGetInBuffer(sizeof(IncrementalSelfTest_In)); - IncrementalSelfTest_Out *out = (IncrementalSelfTest_Out *) - MemoryGetOutBuffer(sizeof(IncrementalSelfTest_Out)); - result = TPML_ALG_Unmarshal(&in->toTest, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_IncrementalSelfTest_toTest); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_IncrementalSelfTest (in, out); - rSize = sizeof(IncrementalSelfTest_Out); - *respParmSize += TPML_ALG_Marshal(&out->toDoList, - responseBuffer, &rSize); -break; -} -#endif // CC_IncrementalSelfTest -#if CC_GetTestResult -case TPM_CC_GetTestResult: { - GetTestResult_Out *out = (GetTestResult_Out *) - MemoryGetOutBuffer(sizeof(GetTestResult_Out)); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_GetTestResult (out); - rSize = sizeof(GetTestResult_Out); - *respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->outData, - responseBuffer, &rSize); - *respParmSize += TPM_RC_Marshal(&out->testResult, - responseBuffer, &rSize); -break; -} -#endif // CC_GetTestResult -#if CC_StartAuthSession -case TPM_CC_StartAuthSession: { - StartAuthSession_In *in = (StartAuthSession_In *) - MemoryGetInBuffer(sizeof(StartAuthSession_In)); - StartAuthSession_Out *out = (StartAuthSession_Out *) - MemoryGetOutBuffer(sizeof(StartAuthSession_Out)); - in->tpmKey = handles[0]; - in->bind = handles[1]; - result = TPM2B_NONCE_Unmarshal(&in->nonceCaller, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_StartAuthSession_nonceCaller); - result = TPM2B_ENCRYPTED_SECRET_Unmarshal(&in->encryptedSalt, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_StartAuthSession_encryptedSalt); - result = TPM_SE_Unmarshal(&in->sessionType, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_StartAuthSession_sessionType); - result = TPMT_SYM_DEF_Unmarshal(&in->symmetric, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_StartAuthSession_symmetric); - result = TPMI_ALG_HASH_Unmarshal(&in->authHash, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_StartAuthSession_authHash); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_StartAuthSession (in, out); - rSize = sizeof(StartAuthSession_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->sessionHandle; - *respParmSize += TPM2B_NONCE_Marshal(&out->nonceTPM, - responseBuffer, &rSize); -break; -} -#endif // CC_StartAuthSession -#if CC_PolicyRestart -case TPM_CC_PolicyRestart: { - PolicyRestart_In *in = (PolicyRestart_In *) - MemoryGetInBuffer(sizeof(PolicyRestart_In)); - in->sessionHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyRestart (in); -break; -} -#endif // CC_PolicyRestart -#if CC_Create -case TPM_CC_Create: { - Create_In *in = (Create_In *) - MemoryGetInBuffer(sizeof(Create_In)); - Create_Out *out = (Create_Out *) - MemoryGetOutBuffer(sizeof(Create_Out)); - in->parentHandle = handles[0]; - result = TPM2B_SENSITIVE_CREATE_Unmarshal(&in->inSensitive, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Create_inSensitive); - result = TPM2B_PUBLIC_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_Create_inPublic); - result = TPM2B_DATA_Unmarshal(&in->outsideInfo, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Create_outsideInfo); - result = TPML_PCR_SELECTION_Unmarshal(&in->creationPCR, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Create_creationPCR); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Create (in, out); - rSize = sizeof(Create_Out); - *respParmSize += TPM2B_PRIVATE_Marshal(&out->outPrivate, - responseBuffer, &rSize); - *respParmSize += TPM2B_PUBLIC_Marshal(&out->outPublic, - responseBuffer, &rSize); - *respParmSize += TPM2B_CREATION_DATA_Marshal(&out->creationData, - responseBuffer, &rSize); - *respParmSize += TPM2B_DIGEST_Marshal(&out->creationHash, - responseBuffer, &rSize); - *respParmSize += TPMT_TK_CREATION_Marshal(&out->creationTicket, - responseBuffer, &rSize); -break; -} -#endif // CC_Create -#if CC_Load -case TPM_CC_Load: { - Load_In *in = (Load_In *) - MemoryGetInBuffer(sizeof(Load_In)); - Load_Out *out = (Load_Out *) - MemoryGetOutBuffer(sizeof(Load_Out)); - in->parentHandle = handles[0]; - result = TPM2B_PRIVATE_Unmarshal(&in->inPrivate, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Load_inPrivate); - result = TPM2B_PUBLIC_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_Load_inPublic); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Load (in, out); - rSize = sizeof(Load_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->objectHandle; - *respParmSize += TPM2B_NAME_Marshal(&out->name, - responseBuffer, &rSize); -break; -} -#endif // CC_Load -#if CC_LoadExternal -case TPM_CC_LoadExternal: { - LoadExternal_In *in = (LoadExternal_In *) - MemoryGetInBuffer(sizeof(LoadExternal_In)); - LoadExternal_Out *out = (LoadExternal_Out *) - MemoryGetOutBuffer(sizeof(LoadExternal_Out)); - result = TPM2B_SENSITIVE_Unmarshal(&in->inPrivate, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_LoadExternal_inPrivate); - result = TPM2B_PUBLIC_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_LoadExternal_inPublic); - result = TPMI_RH_HIERARCHY_Unmarshal(&in->hierarchy, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_LoadExternal_hierarchy); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_LoadExternal (in, out); - rSize = sizeof(LoadExternal_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->objectHandle; - *respParmSize += TPM2B_NAME_Marshal(&out->name, - responseBuffer, &rSize); -break; -} -#endif // CC_LoadExternal -#if CC_ReadPublic -case TPM_CC_ReadPublic: { - ReadPublic_In *in = (ReadPublic_In *) - MemoryGetInBuffer(sizeof(ReadPublic_In)); - ReadPublic_Out *out = (ReadPublic_Out *) - MemoryGetOutBuffer(sizeof(ReadPublic_Out)); - in->objectHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ReadPublic (in, out); - rSize = sizeof(ReadPublic_Out); - *respParmSize += TPM2B_PUBLIC_Marshal(&out->outPublic, - responseBuffer, &rSize); - *respParmSize += TPM2B_NAME_Marshal(&out->name, - responseBuffer, &rSize); - *respParmSize += TPM2B_NAME_Marshal(&out->qualifiedName, - responseBuffer, &rSize); -break; -} -#endif // CC_ReadPublic -#if CC_ActivateCredential -case TPM_CC_ActivateCredential: { - ActivateCredential_In *in = (ActivateCredential_In *) - MemoryGetInBuffer(sizeof(ActivateCredential_In)); - ActivateCredential_Out *out = (ActivateCredential_Out *) - MemoryGetOutBuffer(sizeof(ActivateCredential_Out)); - in->activateHandle = handles[0]; - in->keyHandle = handles[1]; - result = TPM2B_ID_OBJECT_Unmarshal(&in->credentialBlob, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ActivateCredential_credentialBlob); - result = TPM2B_ENCRYPTED_SECRET_Unmarshal(&in->secret, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ActivateCredential_secret); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ActivateCredential (in, out); - rSize = sizeof(ActivateCredential_Out); - *respParmSize += TPM2B_DIGEST_Marshal(&out->certInfo, - responseBuffer, &rSize); -break; -} -#endif // CC_ActivateCredential -#if CC_MakeCredential -case TPM_CC_MakeCredential: { - MakeCredential_In *in = (MakeCredential_In *) - MemoryGetInBuffer(sizeof(MakeCredential_In)); - MakeCredential_Out *out = (MakeCredential_Out *) - MemoryGetOutBuffer(sizeof(MakeCredential_Out)); - in->handle = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->credential, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_MakeCredential_credential); - result = TPM2B_NAME_Unmarshal(&in->objectName, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_MakeCredential_objectName); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_MakeCredential (in, out); - rSize = sizeof(MakeCredential_Out); - *respParmSize += TPM2B_ID_OBJECT_Marshal(&out->credentialBlob, - responseBuffer, &rSize); - *respParmSize += TPM2B_ENCRYPTED_SECRET_Marshal(&out->secret, - responseBuffer, &rSize); -break; -} -#endif // CC_MakeCredential -#if CC_Unseal -case TPM_CC_Unseal: { - Unseal_In *in = (Unseal_In *) - MemoryGetInBuffer(sizeof(Unseal_In)); - Unseal_Out *out = (Unseal_Out *) - MemoryGetOutBuffer(sizeof(Unseal_Out)); - in->itemHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Unseal (in, out); - rSize = sizeof(Unseal_Out); - *respParmSize += TPM2B_SENSITIVE_DATA_Marshal(&out->outData, - responseBuffer, &rSize); -break; -} -#endif // CC_Unseal -#if CC_ObjectChangeAuth -case TPM_CC_ObjectChangeAuth: { - ObjectChangeAuth_In *in = (ObjectChangeAuth_In *) - MemoryGetInBuffer(sizeof(ObjectChangeAuth_In)); - ObjectChangeAuth_Out *out = (ObjectChangeAuth_Out *) - MemoryGetOutBuffer(sizeof(ObjectChangeAuth_Out)); - in->objectHandle = handles[0]; - in->parentHandle = handles[1]; - result = TPM2B_AUTH_Unmarshal(&in->newAuth, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ObjectChangeAuth_newAuth); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ObjectChangeAuth (in, out); - rSize = sizeof(ObjectChangeAuth_Out); - *respParmSize += TPM2B_PRIVATE_Marshal(&out->outPrivate, - responseBuffer, &rSize); -break; -} -#endif // CC_ObjectChangeAuth -#if CC_CreateLoaded -case TPM_CC_CreateLoaded: { - CreateLoaded_In *in = (CreateLoaded_In *) - MemoryGetInBuffer(sizeof(CreateLoaded_In)); - CreateLoaded_Out *out = (CreateLoaded_Out *) - MemoryGetOutBuffer(sizeof(CreateLoaded_Out)); - in->parentHandle = handles[0]; - result = TPM2B_SENSITIVE_CREATE_Unmarshal(&in->inSensitive, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CreateLoaded_inSensitive); - result = TPM2B_TEMPLATE_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CreateLoaded_inPublic); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_CreateLoaded (in, out); - rSize = sizeof(CreateLoaded_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->objectHandle; - *respParmSize += TPM2B_PRIVATE_Marshal(&out->outPrivate, - responseBuffer, &rSize); - *respParmSize += TPM2B_PUBLIC_Marshal(&out->outPublic, - responseBuffer, &rSize); - *respParmSize += TPM2B_NAME_Marshal(&out->name, - responseBuffer, &rSize); -break; -} -#endif // CC_CreateLoaded -#if CC_Duplicate -case TPM_CC_Duplicate: { - Duplicate_In *in = (Duplicate_In *) - MemoryGetInBuffer(sizeof(Duplicate_In)); - Duplicate_Out *out = (Duplicate_Out *) - MemoryGetOutBuffer(sizeof(Duplicate_Out)); - in->objectHandle = handles[0]; - in->newParentHandle = handles[1]; - result = TPM2B_DATA_Unmarshal(&in->encryptionKeyIn, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Duplicate_encryptionKeyIn); - result = TPMT_SYM_DEF_OBJECT_Unmarshal(&in->symmetricAlg, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_Duplicate_symmetricAlg); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Duplicate (in, out); - rSize = sizeof(Duplicate_Out); - *respParmSize += TPM2B_DATA_Marshal(&out->encryptionKeyOut, - responseBuffer, &rSize); - *respParmSize += TPM2B_PRIVATE_Marshal(&out->duplicate, - responseBuffer, &rSize); - *respParmSize += TPM2B_ENCRYPTED_SECRET_Marshal(&out->outSymSeed, - responseBuffer, &rSize); -break; -} -#endif // CC_Duplicate -#if CC_Rewrap -case TPM_CC_Rewrap: { - Rewrap_In *in = (Rewrap_In *) - MemoryGetInBuffer(sizeof(Rewrap_In)); - Rewrap_Out *out = (Rewrap_Out *) - MemoryGetOutBuffer(sizeof(Rewrap_Out)); - in->oldParent = handles[0]; - in->newParent = handles[1]; - result = TPM2B_PRIVATE_Unmarshal(&in->inDuplicate, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Rewrap_inDuplicate); - result = TPM2B_NAME_Unmarshal(&in->name, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Rewrap_name); - result = TPM2B_ENCRYPTED_SECRET_Unmarshal(&in->inSymSeed, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Rewrap_inSymSeed); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Rewrap (in, out); - rSize = sizeof(Rewrap_Out); - *respParmSize += TPM2B_PRIVATE_Marshal(&out->outDuplicate, - responseBuffer, &rSize); - *respParmSize += TPM2B_ENCRYPTED_SECRET_Marshal(&out->outSymSeed, - responseBuffer, &rSize); -break; -} -#endif // CC_Rewrap -#if CC_Import -case TPM_CC_Import: { - Import_In *in = (Import_In *) - MemoryGetInBuffer(sizeof(Import_In)); - Import_Out *out = (Import_Out *) - MemoryGetOutBuffer(sizeof(Import_Out)); - in->parentHandle = handles[0]; - result = TPM2B_DATA_Unmarshal(&in->encryptionKey, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Import_encryptionKey); - result = TPM2B_PUBLIC_Unmarshal(&in->objectPublic, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_Import_objectPublic); - result = TPM2B_PRIVATE_Unmarshal(&in->duplicate, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Import_duplicate); - result = TPM2B_ENCRYPTED_SECRET_Unmarshal(&in->inSymSeed, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Import_inSymSeed); - result = TPMT_SYM_DEF_OBJECT_Unmarshal(&in->symmetricAlg, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_Import_symmetricAlg); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Import (in, out); - rSize = sizeof(Import_Out); - *respParmSize += TPM2B_PRIVATE_Marshal(&out->outPrivate, - responseBuffer, &rSize); -break; -} -#endif // CC_Import -#if CC_RSA_Encrypt -case TPM_CC_RSA_Encrypt: { - RSA_Encrypt_In *in = (RSA_Encrypt_In *) - MemoryGetInBuffer(sizeof(RSA_Encrypt_In)); - RSA_Encrypt_Out *out = (RSA_Encrypt_Out *) - MemoryGetOutBuffer(sizeof(RSA_Encrypt_Out)); - in->keyHandle = handles[0]; - result = TPM2B_PUBLIC_KEY_RSA_Unmarshal(&in->message, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_RSA_Encrypt_message); - result = TPMT_RSA_DECRYPT_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_RSA_Encrypt_inScheme); - result = TPM2B_DATA_Unmarshal(&in->label, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_RSA_Encrypt_label); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_RSA_Encrypt (in, out); - rSize = sizeof(RSA_Encrypt_Out); - *respParmSize += TPM2B_PUBLIC_KEY_RSA_Marshal(&out->outData, - responseBuffer, &rSize); -break; -} -#endif // CC_RSA_Encrypt -#if CC_RSA_Decrypt -case TPM_CC_RSA_Decrypt: { - RSA_Decrypt_In *in = (RSA_Decrypt_In *) - MemoryGetInBuffer(sizeof(RSA_Decrypt_In)); - RSA_Decrypt_Out *out = (RSA_Decrypt_Out *) - MemoryGetOutBuffer(sizeof(RSA_Decrypt_Out)); - in->keyHandle = handles[0]; - result = TPM2B_PUBLIC_KEY_RSA_Unmarshal(&in->cipherText, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_RSA_Decrypt_cipherText); - result = TPMT_RSA_DECRYPT_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_RSA_Decrypt_inScheme); - result = TPM2B_DATA_Unmarshal(&in->label, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_RSA_Decrypt_label); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_RSA_Decrypt (in, out); - rSize = sizeof(RSA_Decrypt_Out); - *respParmSize += TPM2B_PUBLIC_KEY_RSA_Marshal(&out->message, - responseBuffer, &rSize); -break; -} -#endif // CC_RSA_Decrypt -#if CC_ECDH_KeyGen -case TPM_CC_ECDH_KeyGen: { - ECDH_KeyGen_In *in = (ECDH_KeyGen_In *) - MemoryGetInBuffer(sizeof(ECDH_KeyGen_In)); - ECDH_KeyGen_Out *out = (ECDH_KeyGen_Out *) - MemoryGetOutBuffer(sizeof(ECDH_KeyGen_Out)); - in->keyHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ECDH_KeyGen (in, out); - rSize = sizeof(ECDH_KeyGen_Out); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->zPoint, - responseBuffer, &rSize); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->pubPoint, - responseBuffer, &rSize); -break; -} -#endif // CC_ECDH_KeyGen -#if CC_ECDH_ZGen -case TPM_CC_ECDH_ZGen: { - ECDH_ZGen_In *in = (ECDH_ZGen_In *) - MemoryGetInBuffer(sizeof(ECDH_ZGen_In)); - ECDH_ZGen_Out *out = (ECDH_ZGen_Out *) - MemoryGetOutBuffer(sizeof(ECDH_ZGen_Out)); - in->keyHandle = handles[0]; - result = TPM2B_ECC_POINT_Unmarshal(&in->inPoint, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ECDH_ZGen_inPoint); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ECDH_ZGen (in, out); - rSize = sizeof(ECDH_ZGen_Out); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->outPoint, - responseBuffer, &rSize); -break; -} -#endif // CC_ECDH_ZGen -#if CC_ECC_Parameters -case TPM_CC_ECC_Parameters: { - ECC_Parameters_In *in = (ECC_Parameters_In *) - MemoryGetInBuffer(sizeof(ECC_Parameters_In)); - ECC_Parameters_Out *out = (ECC_Parameters_Out *) - MemoryGetOutBuffer(sizeof(ECC_Parameters_Out)); - result = TPMI_ECC_CURVE_Unmarshal(&in->curveID, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ECC_Parameters_curveID); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ECC_Parameters (in, out); - rSize = sizeof(ECC_Parameters_Out); - *respParmSize += TPMS_ALGORITHM_DETAIL_ECC_Marshal(&out->parameters, - responseBuffer, &rSize); -break; -} -#endif // CC_ECC_Parameters -#if CC_ZGen_2Phase -case TPM_CC_ZGen_2Phase: { - ZGen_2Phase_In *in = (ZGen_2Phase_In *) - MemoryGetInBuffer(sizeof(ZGen_2Phase_In)); - ZGen_2Phase_Out *out = (ZGen_2Phase_Out *) - MemoryGetOutBuffer(sizeof(ZGen_2Phase_Out)); - in->keyA = handles[0]; - result = TPM2B_ECC_POINT_Unmarshal(&in->inQsB, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ZGen_2Phase_inQsB); - result = TPM2B_ECC_POINT_Unmarshal(&in->inQeB, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ZGen_2Phase_inQeB); - result = TPMI_ECC_KEY_EXCHANGE_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_ZGen_2Phase_inScheme); - result = UINT16_Unmarshal(&in->counter, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ZGen_2Phase_counter); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ZGen_2Phase (in, out); - rSize = sizeof(ZGen_2Phase_Out); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->outZ1, - responseBuffer, &rSize); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->outZ2, - responseBuffer, &rSize); -break; -} -#endif // CC_ZGen_2Phase -#if CC_EncryptDecrypt -case TPM_CC_EncryptDecrypt: { - EncryptDecrypt_In *in = (EncryptDecrypt_In *) - MemoryGetInBuffer(sizeof(EncryptDecrypt_In)); - EncryptDecrypt_Out *out = (EncryptDecrypt_Out *) - MemoryGetOutBuffer(sizeof(EncryptDecrypt_Out)); - in->keyHandle = handles[0]; - result = TPMI_YES_NO_Unmarshal(&in->decrypt, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt_decrypt); - result = TPMI_ALG_CIPHER_MODE_Unmarshal(&in->mode, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt_mode); - result = TPM2B_IV_Unmarshal(&in->ivIn, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt_ivIn); - result = TPM2B_MAX_BUFFER_Unmarshal(&in->inData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt_inData); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_EncryptDecrypt (in, out); - rSize = sizeof(EncryptDecrypt_Out); - *respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->outData, - responseBuffer, &rSize); - *respParmSize += TPM2B_IV_Marshal(&out->ivOut, - responseBuffer, &rSize); -break; -} -#endif // CC_EncryptDecrypt -#if CC_EncryptDecrypt2 -case TPM_CC_EncryptDecrypt2: { - EncryptDecrypt2_In *in = (EncryptDecrypt2_In *) - MemoryGetInBuffer(sizeof(EncryptDecrypt2_In)); - EncryptDecrypt2_Out *out = (EncryptDecrypt2_Out *) - MemoryGetOutBuffer(sizeof(EncryptDecrypt2_Out)); - in->keyHandle = handles[0]; - result = TPM2B_MAX_BUFFER_Unmarshal(&in->inData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt2_inData); - result = TPMI_YES_NO_Unmarshal(&in->decrypt, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt2_decrypt); - result = TPMI_ALG_CIPHER_MODE_Unmarshal(&in->mode, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt2_mode); - result = TPM2B_IV_Unmarshal(&in->ivIn, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt2_ivIn); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_EncryptDecrypt2 (in, out); - rSize = sizeof(EncryptDecrypt2_Out); - *respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->outData, - responseBuffer, &rSize); - *respParmSize += TPM2B_IV_Marshal(&out->ivOut, - responseBuffer, &rSize); -break; -} -#endif // CC_EncryptDecrypt2 -#if CC_Hash -case TPM_CC_Hash: { - Hash_In *in = (Hash_In *) - MemoryGetInBuffer(sizeof(Hash_In)); - Hash_Out *out = (Hash_Out *) - MemoryGetOutBuffer(sizeof(Hash_Out)); - result = TPM2B_MAX_BUFFER_Unmarshal(&in->data, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Hash_data); - result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_Hash_hashAlg); - result = TPMI_RH_HIERARCHY_Unmarshal(&in->hierarchy, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_Hash_hierarchy); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Hash (in, out); - rSize = sizeof(Hash_Out); - *respParmSize += TPM2B_DIGEST_Marshal(&out->outHash, - responseBuffer, &rSize); - *respParmSize += TPMT_TK_HASHCHECK_Marshal(&out->validation, - responseBuffer, &rSize); -break; -} -#endif // CC_Hash -#if CC_HMAC -case TPM_CC_HMAC: { - HMAC_In *in = (HMAC_In *) - MemoryGetInBuffer(sizeof(HMAC_In)); - HMAC_Out *out = (HMAC_Out *) - MemoryGetOutBuffer(sizeof(HMAC_Out)); - in->handle = handles[0]; - result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_HMAC_buffer); - result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_HMAC_hashAlg); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_HMAC (in, out); - rSize = sizeof(HMAC_Out); - *respParmSize += TPM2B_DIGEST_Marshal(&out->outHMAC, - responseBuffer, &rSize); -break; -} -#endif // CC_HMAC -#if CC_MAC -case TPM_CC_MAC: { - MAC_In *in = (MAC_In *) - MemoryGetInBuffer(sizeof(MAC_In)); - MAC_Out *out = (MAC_Out *) - MemoryGetOutBuffer(sizeof(MAC_Out)); - in->handle = handles[0]; - result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_MAC_buffer); - result = TPMI_ALG_MAC_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_MAC_inScheme); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_MAC (in, out); - rSize = sizeof(MAC_Out); - *respParmSize += TPM2B_DIGEST_Marshal(&out->outMAC, - responseBuffer, &rSize); -break; -} -#endif // CC_MAC -#if CC_GetRandom -case TPM_CC_GetRandom: { - GetRandom_In *in = (GetRandom_In *) - MemoryGetInBuffer(sizeof(GetRandom_In)); - GetRandom_Out *out = (GetRandom_Out *) - MemoryGetOutBuffer(sizeof(GetRandom_Out)); - result = UINT16_Unmarshal(&in->bytesRequested, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_GetRandom_bytesRequested); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_GetRandom (in, out); - rSize = sizeof(GetRandom_Out); - *respParmSize += TPM2B_DIGEST_Marshal(&out->randomBytes, - responseBuffer, &rSize); -break; -} -#endif // CC_GetRandom -#if CC_StirRandom -case TPM_CC_StirRandom: { - StirRandom_In *in = (StirRandom_In *) - MemoryGetInBuffer(sizeof(StirRandom_In)); - result = TPM2B_SENSITIVE_DATA_Unmarshal(&in->inData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_StirRandom_inData); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_StirRandom (in); -break; -} -#endif // CC_StirRandom -#if CC_HMAC_Start -case TPM_CC_HMAC_Start: { - HMAC_Start_In *in = (HMAC_Start_In *) - MemoryGetInBuffer(sizeof(HMAC_Start_In)); - HMAC_Start_Out *out = (HMAC_Start_Out *) - MemoryGetOutBuffer(sizeof(HMAC_Start_Out)); - in->handle = handles[0]; - result = TPM2B_AUTH_Unmarshal(&in->auth, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_HMAC_Start_auth); - result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_HMAC_Start_hashAlg); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_HMAC_Start (in, out); - rSize = sizeof(HMAC_Start_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->sequenceHandle; -break; -} -#endif // CC_HMAC_Start -#if CC_MAC_Start -case TPM_CC_MAC_Start: { - MAC_Start_In *in = (MAC_Start_In *) - MemoryGetInBuffer(sizeof(MAC_Start_In)); - MAC_Start_Out *out = (MAC_Start_Out *) - MemoryGetOutBuffer(sizeof(MAC_Start_Out)); - in->handle = handles[0]; - result = TPM2B_AUTH_Unmarshal(&in->auth, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_MAC_Start_auth); - result = TPMI_ALG_MAC_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_MAC_Start_inScheme); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_MAC_Start (in, out); - rSize = sizeof(MAC_Start_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->sequenceHandle; -break; -} -#endif // CC_MAC_Start -#if CC_HashSequenceStart -case TPM_CC_HashSequenceStart: { - HashSequenceStart_In *in = (HashSequenceStart_In *) - MemoryGetInBuffer(sizeof(HashSequenceStart_In)); - HashSequenceStart_Out *out = (HashSequenceStart_Out *) - MemoryGetOutBuffer(sizeof(HashSequenceStart_Out)); - result = TPM2B_AUTH_Unmarshal(&in->auth, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_HashSequenceStart_auth); - result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_HashSequenceStart_hashAlg); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_HashSequenceStart (in, out); - rSize = sizeof(HashSequenceStart_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->sequenceHandle; -break; -} -#endif // CC_HashSequenceStart -#if CC_SequenceUpdate -case TPM_CC_SequenceUpdate: { - SequenceUpdate_In *in = (SequenceUpdate_In *) - MemoryGetInBuffer(sizeof(SequenceUpdate_In)); - in->sequenceHandle = handles[0]; - result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_SequenceUpdate_buffer); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_SequenceUpdate (in); -break; -} -#endif // CC_SequenceUpdate -#if CC_SequenceComplete -case TPM_CC_SequenceComplete: { - SequenceComplete_In *in = (SequenceComplete_In *) - MemoryGetInBuffer(sizeof(SequenceComplete_In)); - SequenceComplete_Out *out = (SequenceComplete_Out *) - MemoryGetOutBuffer(sizeof(SequenceComplete_Out)); - in->sequenceHandle = handles[0]; - result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_SequenceComplete_buffer); - result = TPMI_RH_HIERARCHY_Unmarshal(&in->hierarchy, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_SequenceComplete_hierarchy); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_SequenceComplete (in, out); - rSize = sizeof(SequenceComplete_Out); - *respParmSize += TPM2B_DIGEST_Marshal(&out->result, - responseBuffer, &rSize); - *respParmSize += TPMT_TK_HASHCHECK_Marshal(&out->validation, - responseBuffer, &rSize); -break; -} -#endif // CC_SequenceComplete -#if CC_EventSequenceComplete -case TPM_CC_EventSequenceComplete: { - EventSequenceComplete_In *in = (EventSequenceComplete_In *) - MemoryGetInBuffer(sizeof(EventSequenceComplete_In)); - EventSequenceComplete_Out *out = (EventSequenceComplete_Out *) - MemoryGetOutBuffer(sizeof(EventSequenceComplete_Out)); - in->pcrHandle = handles[0]; - in->sequenceHandle = handles[1]; - result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EventSequenceComplete_buffer); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_EventSequenceComplete (in, out); - rSize = sizeof(EventSequenceComplete_Out); - *respParmSize += TPML_DIGEST_VALUES_Marshal(&out->results, - responseBuffer, &rSize); -break; -} -#endif // CC_EventSequenceComplete -#if CC_Certify -case TPM_CC_Certify: { - Certify_In *in = (Certify_In *) - MemoryGetInBuffer(sizeof(Certify_In)); - Certify_Out *out = (Certify_Out *) - MemoryGetOutBuffer(sizeof(Certify_Out)); - in->objectHandle = handles[0]; - in->signHandle = handles[1]; - result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Certify_qualifyingData); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_Certify_inScheme); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Certify (in, out); - rSize = sizeof(Certify_Out); - *respParmSize += TPM2B_ATTEST_Marshal(&out->certifyInfo, - responseBuffer, &rSize); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_Certify -#if CC_CertifyCreation -case TPM_CC_CertifyCreation: { - CertifyCreation_In *in = (CertifyCreation_In *) - MemoryGetInBuffer(sizeof(CertifyCreation_In)); - CertifyCreation_Out *out = (CertifyCreation_Out *) - MemoryGetOutBuffer(sizeof(CertifyCreation_Out)); - in->signHandle = handles[0]; - in->objectHandle = handles[1]; - result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CertifyCreation_qualifyingData); - result = TPM2B_DIGEST_Unmarshal(&in->creationHash, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CertifyCreation_creationHash); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_CertifyCreation_inScheme); - result = TPMT_TK_CREATION_Unmarshal(&in->creationTicket, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CertifyCreation_creationTicket); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_CertifyCreation (in, out); - rSize = sizeof(CertifyCreation_Out); - *respParmSize += TPM2B_ATTEST_Marshal(&out->certifyInfo, - responseBuffer, &rSize); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_CertifyCreation -#if CC_Quote -case TPM_CC_Quote: { - Quote_In *in = (Quote_In *) - MemoryGetInBuffer(sizeof(Quote_In)); - Quote_Out *out = (Quote_Out *) - MemoryGetOutBuffer(sizeof(Quote_Out)); - in->signHandle = handles[0]; - result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Quote_qualifyingData); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_Quote_inScheme); - result = TPML_PCR_SELECTION_Unmarshal(&in->PCRselect, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Quote_PCRselect); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Quote (in, out); - rSize = sizeof(Quote_Out); - *respParmSize += TPM2B_ATTEST_Marshal(&out->quoted, - responseBuffer, &rSize); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_Quote -#if CC_GetSessionAuditDigest -case TPM_CC_GetSessionAuditDigest: { - GetSessionAuditDigest_In *in = (GetSessionAuditDigest_In *) - MemoryGetInBuffer(sizeof(GetSessionAuditDigest_In)); - GetSessionAuditDigest_Out *out = (GetSessionAuditDigest_Out *) - MemoryGetOutBuffer(sizeof(GetSessionAuditDigest_Out)); - in->privacyAdminHandle = handles[0]; - in->signHandle = handles[1]; - in->sessionHandle = handles[2]; - result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_GetSessionAuditDigest_qualifyingData); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_GetSessionAuditDigest_inScheme); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_GetSessionAuditDigest (in, out); - rSize = sizeof(GetSessionAuditDigest_Out); - *respParmSize += TPM2B_ATTEST_Marshal(&out->auditInfo, - responseBuffer, &rSize); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_GetSessionAuditDigest -#if CC_GetCommandAuditDigest -case TPM_CC_GetCommandAuditDigest: { - GetCommandAuditDigest_In *in = (GetCommandAuditDigest_In *) - MemoryGetInBuffer(sizeof(GetCommandAuditDigest_In)); - GetCommandAuditDigest_Out *out = (GetCommandAuditDigest_Out *) - MemoryGetOutBuffer(sizeof(GetCommandAuditDigest_Out)); - in->privacyHandle = handles[0]; - in->signHandle = handles[1]; - result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_GetCommandAuditDigest_qualifyingData); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_GetCommandAuditDigest_inScheme); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_GetCommandAuditDigest (in, out); - rSize = sizeof(GetCommandAuditDigest_Out); - *respParmSize += TPM2B_ATTEST_Marshal(&out->auditInfo, - responseBuffer, &rSize); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_GetCommandAuditDigest -#if CC_GetTime -case TPM_CC_GetTime: { - GetTime_In *in = (GetTime_In *) - MemoryGetInBuffer(sizeof(GetTime_In)); - GetTime_Out *out = (GetTime_Out *) - MemoryGetOutBuffer(sizeof(GetTime_Out)); - in->privacyAdminHandle = handles[0]; - in->signHandle = handles[1]; - result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_GetTime_qualifyingData); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_GetTime_inScheme); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_GetTime (in, out); - rSize = sizeof(GetTime_Out); - *respParmSize += TPM2B_ATTEST_Marshal(&out->timeInfo, - responseBuffer, &rSize); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_GetTime -#if CC_CertifyX509 -case TPM_CC_CertifyX509: { - CertifyX509_In *in = (CertifyX509_In *) - MemoryGetInBuffer(sizeof(CertifyX509_In)); - CertifyX509_Out *out = (CertifyX509_Out *) - MemoryGetOutBuffer(sizeof(CertifyX509_Out)); - in->objectHandle = handles[0]; - in->signHandle = handles[1]; - result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CertifyX509_qualifyingData); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_CertifyX509_inScheme); - result = TPM2B_MAX_BUFFER_Unmarshal(&in->partialCertificate, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CertifyX509_partialCertificate); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_CertifyX509 (in, out); - rSize = sizeof(CertifyX509_Out); - *respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->addedToCertificate, - responseBuffer, &rSize); - *respParmSize += TPM2B_DIGEST_Marshal(&out->tbsDigest, - responseBuffer, &rSize); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_CertifyX509 -#if CC_Commit -case TPM_CC_Commit: { - Commit_In *in = (Commit_In *) - MemoryGetInBuffer(sizeof(Commit_In)); - Commit_Out *out = (Commit_Out *) - MemoryGetOutBuffer(sizeof(Commit_Out)); - in->signHandle = handles[0]; - result = TPM2B_ECC_POINT_Unmarshal(&in->P1, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Commit_P1); - result = TPM2B_SENSITIVE_DATA_Unmarshal(&in->s2, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Commit_s2); - result = TPM2B_ECC_PARAMETER_Unmarshal(&in->y2, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Commit_y2); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Commit (in, out); - rSize = sizeof(Commit_Out); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->K, - responseBuffer, &rSize); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->L, - responseBuffer, &rSize); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->E, - responseBuffer, &rSize); - *respParmSize += UINT16_Marshal(&out->counter, - responseBuffer, &rSize); -break; -} -#endif // CC_Commit -#if CC_EC_Ephemeral -case TPM_CC_EC_Ephemeral: { - EC_Ephemeral_In *in = (EC_Ephemeral_In *) - MemoryGetInBuffer(sizeof(EC_Ephemeral_In)); - EC_Ephemeral_Out *out = (EC_Ephemeral_Out *) - MemoryGetOutBuffer(sizeof(EC_Ephemeral_Out)); - result = TPMI_ECC_CURVE_Unmarshal(&in->curveID, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EC_Ephemeral_curveID); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_EC_Ephemeral (in, out); - rSize = sizeof(EC_Ephemeral_Out); - *respParmSize += TPM2B_ECC_POINT_Marshal(&out->Q, - responseBuffer, &rSize); - *respParmSize += UINT16_Marshal(&out->counter, - responseBuffer, &rSize); -break; -} -#endif // CC_EC_Ephemeral -#if CC_VerifySignature -case TPM_CC_VerifySignature: { - VerifySignature_In *in = (VerifySignature_In *) - MemoryGetInBuffer(sizeof(VerifySignature_In)); - VerifySignature_Out *out = (VerifySignature_Out *) - MemoryGetOutBuffer(sizeof(VerifySignature_Out)); - in->keyHandle = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->digest, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_VerifySignature_digest); - result = TPMT_SIGNATURE_Unmarshal(&in->signature, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_VerifySignature_signature); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_VerifySignature (in, out); - rSize = sizeof(VerifySignature_Out); - *respParmSize += TPMT_TK_VERIFIED_Marshal(&out->validation, - responseBuffer, &rSize); -break; -} -#endif // CC_VerifySignature -#if CC_Sign -case TPM_CC_Sign: { - Sign_In *in = (Sign_In *) - MemoryGetInBuffer(sizeof(Sign_In)); - Sign_Out *out = (Sign_Out *) - MemoryGetOutBuffer(sizeof(Sign_Out)); - in->keyHandle = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->digest, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Sign_digest); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_Sign_inScheme); - result = TPMT_TK_HASHCHECK_Unmarshal(&in->validation, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Sign_validation); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Sign (in, out); - rSize = sizeof(Sign_Out); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_Sign -#if CC_SetCommandCodeAuditStatus -case TPM_CC_SetCommandCodeAuditStatus: { - SetCommandCodeAuditStatus_In *in = (SetCommandCodeAuditStatus_In *) - MemoryGetInBuffer(sizeof(SetCommandCodeAuditStatus_In)); - in->auth = handles[0]; - result = TPMI_ALG_HASH_Unmarshal(&in->auditAlg, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_SetCommandCodeAuditStatus_auditAlg); - result = TPML_CC_Unmarshal(&in->setList, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_SetCommandCodeAuditStatus_setList); - result = TPML_CC_Unmarshal(&in->clearList, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_SetCommandCodeAuditStatus_clearList); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_SetCommandCodeAuditStatus (in); -break; -} -#endif // CC_SetCommandCodeAuditStatus -#if CC_PCR_Extend -case TPM_CC_PCR_Extend: { - PCR_Extend_In *in = (PCR_Extend_In *) - MemoryGetInBuffer(sizeof(PCR_Extend_In)); - in->pcrHandle = handles[0]; - result = TPML_DIGEST_VALUES_Unmarshal(&in->digests, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PCR_Extend_digests); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PCR_Extend (in); -break; -} -#endif // CC_PCR_Extend -#if CC_PCR_Event -case TPM_CC_PCR_Event: { - PCR_Event_In *in = (PCR_Event_In *) - MemoryGetInBuffer(sizeof(PCR_Event_In)); - PCR_Event_Out *out = (PCR_Event_Out *) - MemoryGetOutBuffer(sizeof(PCR_Event_Out)); - in->pcrHandle = handles[0]; - result = TPM2B_EVENT_Unmarshal(&in->eventData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PCR_Event_eventData); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PCR_Event (in, out); - rSize = sizeof(PCR_Event_Out); - *respParmSize += TPML_DIGEST_VALUES_Marshal(&out->digests, - responseBuffer, &rSize); -break; -} -#endif // CC_PCR_Event -#if CC_PCR_Read -case TPM_CC_PCR_Read: { - PCR_Read_In *in = (PCR_Read_In *) - MemoryGetInBuffer(sizeof(PCR_Read_In)); - PCR_Read_Out *out = (PCR_Read_Out *) - MemoryGetOutBuffer(sizeof(PCR_Read_Out)); - result = TPML_PCR_SELECTION_Unmarshal(&in->pcrSelectionIn, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PCR_Read_pcrSelectionIn); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PCR_Read (in, out); - rSize = sizeof(PCR_Read_Out); - *respParmSize += UINT32_Marshal(&out->pcrUpdateCounter, - responseBuffer, &rSize); - *respParmSize += TPML_PCR_SELECTION_Marshal(&out->pcrSelectionOut, - responseBuffer, &rSize); - *respParmSize += TPML_DIGEST_Marshal(&out->pcrValues, - responseBuffer, &rSize); -break; -} -#endif // CC_PCR_Read -#if CC_PCR_Allocate -case TPM_CC_PCR_Allocate: { - PCR_Allocate_In *in = (PCR_Allocate_In *) - MemoryGetInBuffer(sizeof(PCR_Allocate_In)); - PCR_Allocate_Out *out = (PCR_Allocate_Out *) - MemoryGetOutBuffer(sizeof(PCR_Allocate_Out)); - in->authHandle = handles[0]; - result = TPML_PCR_SELECTION_Unmarshal(&in->pcrAllocation, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PCR_Allocate_pcrAllocation); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PCR_Allocate (in, out); - rSize = sizeof(PCR_Allocate_Out); - *respParmSize += TPMI_YES_NO_Marshal(&out->allocationSuccess, - responseBuffer, &rSize); - *respParmSize += UINT32_Marshal(&out->maxPCR, - responseBuffer, &rSize); - *respParmSize += UINT32_Marshal(&out->sizeNeeded, - responseBuffer, &rSize); - *respParmSize += UINT32_Marshal(&out->sizeAvailable, - responseBuffer, &rSize); -break; -} -#endif // CC_PCR_Allocate -#if CC_PCR_SetAuthPolicy -case TPM_CC_PCR_SetAuthPolicy: { - PCR_SetAuthPolicy_In *in = (PCR_SetAuthPolicy_In *) - MemoryGetInBuffer(sizeof(PCR_SetAuthPolicy_In)); - in->authHandle = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->authPolicy, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PCR_SetAuthPolicy_authPolicy); - result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_PCR_SetAuthPolicy_hashAlg); - result = TPMI_DH_PCR_Unmarshal(&in->pcrNum, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_PCR_SetAuthPolicy_pcrNum); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PCR_SetAuthPolicy (in); -break; -} -#endif // CC_PCR_SetAuthPolicy -#if CC_PCR_SetAuthValue -case TPM_CC_PCR_SetAuthValue: { - PCR_SetAuthValue_In *in = (PCR_SetAuthValue_In *) - MemoryGetInBuffer(sizeof(PCR_SetAuthValue_In)); - in->pcrHandle = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->auth, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PCR_SetAuthValue_auth); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PCR_SetAuthValue (in); -break; -} -#endif // CC_PCR_SetAuthValue -#if CC_PCR_Reset -case TPM_CC_PCR_Reset: { - PCR_Reset_In *in = (PCR_Reset_In *) - MemoryGetInBuffer(sizeof(PCR_Reset_In)); - in->pcrHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PCR_Reset (in); -break; -} -#endif // CC_PCR_Reset -#if CC_PolicySigned -case TPM_CC_PolicySigned: { - PolicySigned_In *in = (PolicySigned_In *) - MemoryGetInBuffer(sizeof(PolicySigned_In)); - PolicySigned_Out *out = (PolicySigned_Out *) - MemoryGetOutBuffer(sizeof(PolicySigned_Out)); - in->authObject = handles[0]; - in->policySession = handles[1]; - result = TPM2B_NONCE_Unmarshal(&in->nonceTPM, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicySigned_nonceTPM); - result = TPM2B_DIGEST_Unmarshal(&in->cpHashA, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicySigned_cpHashA); - result = TPM2B_NONCE_Unmarshal(&in->policyRef, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicySigned_policyRef); - result = INT32_Unmarshal(&in->expiration, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicySigned_expiration); - result = TPMT_SIGNATURE_Unmarshal(&in->auth, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_PolicySigned_auth); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicySigned (in, out); - rSize = sizeof(PolicySigned_Out); - *respParmSize += TPM2B_TIMEOUT_Marshal(&out->timeout, - responseBuffer, &rSize); - *respParmSize += TPMT_TK_AUTH_Marshal(&out->policyTicket, - responseBuffer, &rSize); -break; -} -#endif // CC_PolicySigned -#if CC_PolicySecret -case TPM_CC_PolicySecret: { - PolicySecret_In *in = (PolicySecret_In *) - MemoryGetInBuffer(sizeof(PolicySecret_In)); - PolicySecret_Out *out = (PolicySecret_Out *) - MemoryGetOutBuffer(sizeof(PolicySecret_Out)); - in->authHandle = handles[0]; - in->policySession = handles[1]; - result = TPM2B_NONCE_Unmarshal(&in->nonceTPM, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicySecret_nonceTPM); - result = TPM2B_DIGEST_Unmarshal(&in->cpHashA, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicySecret_cpHashA); - result = TPM2B_NONCE_Unmarshal(&in->policyRef, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicySecret_policyRef); - result = INT32_Unmarshal(&in->expiration, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicySecret_expiration); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicySecret (in, out); - rSize = sizeof(PolicySecret_Out); - *respParmSize += TPM2B_TIMEOUT_Marshal(&out->timeout, - responseBuffer, &rSize); - *respParmSize += TPMT_TK_AUTH_Marshal(&out->policyTicket, - responseBuffer, &rSize); -break; -} -#endif // CC_PolicySecret -#if CC_PolicyTicket -case TPM_CC_PolicyTicket: { - PolicyTicket_In *in = (PolicyTicket_In *) - MemoryGetInBuffer(sizeof(PolicyTicket_In)); - in->policySession = handles[0]; - result = TPM2B_TIMEOUT_Unmarshal(&in->timeout, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyTicket_timeout); - result = TPM2B_DIGEST_Unmarshal(&in->cpHashA, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyTicket_cpHashA); - result = TPM2B_NONCE_Unmarshal(&in->policyRef, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyTicket_policyRef); - result = TPM2B_NAME_Unmarshal(&in->authName, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyTicket_authName); - result = TPMT_TK_AUTH_Unmarshal(&in->ticket, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyTicket_ticket); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyTicket (in); -break; -} -#endif // CC_PolicyTicket -#if CC_PolicyOR -case TPM_CC_PolicyOR: { - PolicyOR_In *in = (PolicyOR_In *) - MemoryGetInBuffer(sizeof(PolicyOR_In)); - in->policySession = handles[0]; - result = TPML_DIGEST_Unmarshal(&in->pHashList, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyOR_pHashList); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyOR (in); -break; -} -#endif // CC_PolicyOR -#if CC_PolicyPCR -case TPM_CC_PolicyPCR: { - PolicyPCR_In *in = (PolicyPCR_In *) - MemoryGetInBuffer(sizeof(PolicyPCR_In)); - in->policySession = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->pcrDigest, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyPCR_pcrDigest); - result = TPML_PCR_SELECTION_Unmarshal(&in->pcrs, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyPCR_pcrs); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyPCR (in); -break; -} -#endif // CC_PolicyPCR -#if CC_PolicyLocality -case TPM_CC_PolicyLocality: { - PolicyLocality_In *in = (PolicyLocality_In *) - MemoryGetInBuffer(sizeof(PolicyLocality_In)); - in->policySession = handles[0]; - result = TPMA_LOCALITY_Unmarshal(&in->locality, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyLocality_locality); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyLocality (in); -break; -} -#endif // CC_PolicyLocality -#if CC_PolicyNV -case TPM_CC_PolicyNV: { - PolicyNV_In *in = (PolicyNV_In *) - MemoryGetInBuffer(sizeof(PolicyNV_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - in->policySession = handles[2]; - result = TPM2B_OPERAND_Unmarshal(&in->operandB, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyNV_operandB); - result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyNV_offset); - result = TPM_EO_Unmarshal(&in->operation, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyNV_operation); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyNV (in); -break; -} -#endif // CC_PolicyNV -#if CC_PolicyCounterTimer -case TPM_CC_PolicyCounterTimer: { - PolicyCounterTimer_In *in = (PolicyCounterTimer_In *) - MemoryGetInBuffer(sizeof(PolicyCounterTimer_In)); - in->policySession = handles[0]; - result = TPM2B_OPERAND_Unmarshal(&in->operandB, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyCounterTimer_operandB); - result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyCounterTimer_offset); - result = TPM_EO_Unmarshal(&in->operation, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyCounterTimer_operation); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyCounterTimer (in); -break; -} -#endif // CC_PolicyCounterTimer -#if CC_PolicyCommandCode -case TPM_CC_PolicyCommandCode: { - PolicyCommandCode_In *in = (PolicyCommandCode_In *) - MemoryGetInBuffer(sizeof(PolicyCommandCode_In)); - in->policySession = handles[0]; - result = TPM_CC_Unmarshal(&in->code, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyCommandCode_code); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyCommandCode (in); -break; -} -#endif // CC_PolicyCommandCode -#if CC_PolicyPhysicalPresence -case TPM_CC_PolicyPhysicalPresence: { - PolicyPhysicalPresence_In *in = (PolicyPhysicalPresence_In *) - MemoryGetInBuffer(sizeof(PolicyPhysicalPresence_In)); - in->policySession = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyPhysicalPresence (in); -break; -} -#endif // CC_PolicyPhysicalPresence -#if CC_PolicyCpHash -case TPM_CC_PolicyCpHash: { - PolicyCpHash_In *in = (PolicyCpHash_In *) - MemoryGetInBuffer(sizeof(PolicyCpHash_In)); - in->policySession = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->cpHashA, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyCpHash_cpHashA); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyCpHash (in); -break; -} -#endif // CC_PolicyCpHash -#if CC_PolicyNameHash -case TPM_CC_PolicyNameHash: { - PolicyNameHash_In *in = (PolicyNameHash_In *) - MemoryGetInBuffer(sizeof(PolicyNameHash_In)); - in->policySession = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->nameHash, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyNameHash_nameHash); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyNameHash (in); -break; -} -#endif // CC_PolicyNameHash -#if CC_PolicyDuplicationSelect -case TPM_CC_PolicyDuplicationSelect: { - PolicyDuplicationSelect_In *in = (PolicyDuplicationSelect_In *) - MemoryGetInBuffer(sizeof(PolicyDuplicationSelect_In)); - in->policySession = handles[0]; - result = TPM2B_NAME_Unmarshal(&in->objectName, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyDuplicationSelect_objectName); - result = TPM2B_NAME_Unmarshal(&in->newParentName, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyDuplicationSelect_newParentName); - result = TPMI_YES_NO_Unmarshal(&in->includeObject, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyDuplicationSelect_includeObject); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyDuplicationSelect (in); -break; -} -#endif // CC_PolicyDuplicationSelect -#if CC_PolicyAuthorize -case TPM_CC_PolicyAuthorize: { - PolicyAuthorize_In *in = (PolicyAuthorize_In *) - MemoryGetInBuffer(sizeof(PolicyAuthorize_In)); - in->policySession = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->approvedPolicy, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyAuthorize_approvedPolicy); - result = TPM2B_NONCE_Unmarshal(&in->policyRef, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyAuthorize_policyRef); - result = TPM2B_NAME_Unmarshal(&in->keySign, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyAuthorize_keySign); - result = TPMT_TK_VERIFIED_Unmarshal(&in->checkTicket, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyAuthorize_checkTicket); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyAuthorize (in); -break; -} -#endif // CC_PolicyAuthorize -#if CC_PolicyAuthValue -case TPM_CC_PolicyAuthValue: { - PolicyAuthValue_In *in = (PolicyAuthValue_In *) - MemoryGetInBuffer(sizeof(PolicyAuthValue_In)); - in->policySession = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyAuthValue (in); -break; -} -#endif // CC_PolicyAuthValue -#if CC_PolicyPassword -case TPM_CC_PolicyPassword: { - PolicyPassword_In *in = (PolicyPassword_In *) - MemoryGetInBuffer(sizeof(PolicyPassword_In)); - in->policySession = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyPassword (in); -break; -} -#endif // CC_PolicyPassword -#if CC_PolicyGetDigest -case TPM_CC_PolicyGetDigest: { - PolicyGetDigest_In *in = (PolicyGetDigest_In *) - MemoryGetInBuffer(sizeof(PolicyGetDigest_In)); - PolicyGetDigest_Out *out = (PolicyGetDigest_Out *) - MemoryGetOutBuffer(sizeof(PolicyGetDigest_Out)); - in->policySession = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyGetDigest (in, out); - rSize = sizeof(PolicyGetDigest_Out); - *respParmSize += TPM2B_DIGEST_Marshal(&out->policyDigest, - responseBuffer, &rSize); -break; -} -#endif // CC_PolicyGetDigest -#if CC_PolicyNvWritten -case TPM_CC_PolicyNvWritten: { - PolicyNvWritten_In *in = (PolicyNvWritten_In *) - MemoryGetInBuffer(sizeof(PolicyNvWritten_In)); - in->policySession = handles[0]; - result = TPMI_YES_NO_Unmarshal(&in->writtenSet, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyNvWritten_writtenSet); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyNvWritten (in); -break; -} -#endif // CC_PolicyNvWritten -#if CC_PolicyTemplate -case TPM_CC_PolicyTemplate: { - PolicyTemplate_In *in = (PolicyTemplate_In *) - MemoryGetInBuffer(sizeof(PolicyTemplate_In)); - in->policySession = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->templateHash, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PolicyTemplate_templateHash); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyTemplate (in); -break; -} -#endif // CC_PolicyTemplate -#if CC_PolicyAuthorizeNV -case TPM_CC_PolicyAuthorizeNV: { - PolicyAuthorizeNV_In *in = (PolicyAuthorizeNV_In *) - MemoryGetInBuffer(sizeof(PolicyAuthorizeNV_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - in->policySession = handles[2]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PolicyAuthorizeNV (in); -break; -} -#endif // CC_PolicyAuthorizeNV -#if CC_CreatePrimary -case TPM_CC_CreatePrimary: { - CreatePrimary_In *in = (CreatePrimary_In *) - MemoryGetInBuffer(sizeof(CreatePrimary_In)); - CreatePrimary_Out *out = (CreatePrimary_Out *) - MemoryGetOutBuffer(sizeof(CreatePrimary_Out)); - in->primaryHandle = handles[0]; - result = TPM2B_SENSITIVE_CREATE_Unmarshal(&in->inSensitive, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CreatePrimary_inSensitive); - result = TPM2B_PUBLIC_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_CreatePrimary_inPublic); - result = TPM2B_DATA_Unmarshal(&in->outsideInfo, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CreatePrimary_outsideInfo); - result = TPML_PCR_SELECTION_Unmarshal(&in->creationPCR, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_CreatePrimary_creationPCR); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_CreatePrimary (in, out); - rSize = sizeof(CreatePrimary_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->objectHandle; - *respParmSize += TPM2B_PUBLIC_Marshal(&out->outPublic, - responseBuffer, &rSize); - *respParmSize += TPM2B_CREATION_DATA_Marshal(&out->creationData, - responseBuffer, &rSize); - *respParmSize += TPM2B_DIGEST_Marshal(&out->creationHash, - responseBuffer, &rSize); - *respParmSize += TPMT_TK_CREATION_Marshal(&out->creationTicket, - responseBuffer, &rSize); - *respParmSize += TPM2B_NAME_Marshal(&out->name, - responseBuffer, &rSize); -break; -} -#endif // CC_CreatePrimary -#if CC_HierarchyControl -case TPM_CC_HierarchyControl: { - HierarchyControl_In *in = (HierarchyControl_In *) - MemoryGetInBuffer(sizeof(HierarchyControl_In)); - in->authHandle = handles[0]; - result = TPMI_RH_ENABLES_Unmarshal(&in->enable, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_HierarchyControl_enable); - result = TPMI_YES_NO_Unmarshal(&in->state, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_HierarchyControl_state); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_HierarchyControl (in); -break; -} -#endif // CC_HierarchyControl -#if CC_SetPrimaryPolicy -case TPM_CC_SetPrimaryPolicy: { - SetPrimaryPolicy_In *in = (SetPrimaryPolicy_In *) - MemoryGetInBuffer(sizeof(SetPrimaryPolicy_In)); - in->authHandle = handles[0]; - result = TPM2B_DIGEST_Unmarshal(&in->authPolicy, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_SetPrimaryPolicy_authPolicy); - result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_SetPrimaryPolicy_hashAlg); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_SetPrimaryPolicy (in); -break; -} -#endif // CC_SetPrimaryPolicy -#if CC_ChangePPS -case TPM_CC_ChangePPS: { - ChangePPS_In *in = (ChangePPS_In *) - MemoryGetInBuffer(sizeof(ChangePPS_In)); - in->authHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ChangePPS (in); -break; -} -#endif // CC_ChangePPS -#if CC_ChangeEPS -case TPM_CC_ChangeEPS: { - ChangeEPS_In *in = (ChangeEPS_In *) - MemoryGetInBuffer(sizeof(ChangeEPS_In)); - in->authHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ChangeEPS (in); -break; -} -#endif // CC_ChangeEPS -#if CC_Clear -case TPM_CC_Clear: { - Clear_In *in = (Clear_In *) - MemoryGetInBuffer(sizeof(Clear_In)); - in->authHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Clear (in); -break; -} -#endif // CC_Clear -#if CC_ClearControl -case TPM_CC_ClearControl: { - ClearControl_In *in = (ClearControl_In *) - MemoryGetInBuffer(sizeof(ClearControl_In)); - in->auth = handles[0]; - result = TPMI_YES_NO_Unmarshal(&in->disable, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ClearControl_disable); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ClearControl (in); -break; -} -#endif // CC_ClearControl -#if CC_HierarchyChangeAuth -case TPM_CC_HierarchyChangeAuth: { - HierarchyChangeAuth_In *in = (HierarchyChangeAuth_In *) - MemoryGetInBuffer(sizeof(HierarchyChangeAuth_In)); - in->authHandle = handles[0]; - result = TPM2B_AUTH_Unmarshal(&in->newAuth, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_HierarchyChangeAuth_newAuth); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_HierarchyChangeAuth (in); -break; -} -#endif // CC_HierarchyChangeAuth -#if CC_DictionaryAttackLockReset -case TPM_CC_DictionaryAttackLockReset: { - DictionaryAttackLockReset_In *in = (DictionaryAttackLockReset_In *) - MemoryGetInBuffer(sizeof(DictionaryAttackLockReset_In)); - in->lockHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_DictionaryAttackLockReset (in); -break; -} -#endif // CC_DictionaryAttackLockReset -#if CC_DictionaryAttackParameters -case TPM_CC_DictionaryAttackParameters: { - DictionaryAttackParameters_In *in = (DictionaryAttackParameters_In *) - MemoryGetInBuffer(sizeof(DictionaryAttackParameters_In)); - in->lockHandle = handles[0]; - result = UINT32_Unmarshal(&in->newMaxTries, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_DictionaryAttackParameters_newMaxTries); - result = UINT32_Unmarshal(&in->newRecoveryTime, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_DictionaryAttackParameters_newRecoveryTime); - result = UINT32_Unmarshal(&in->lockoutRecovery, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_DictionaryAttackParameters_lockoutRecovery); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_DictionaryAttackParameters (in); -break; -} -#endif // CC_DictionaryAttackParameters -#if CC_PP_Commands -case TPM_CC_PP_Commands: { - PP_Commands_In *in = (PP_Commands_In *) - MemoryGetInBuffer(sizeof(PP_Commands_In)); - in->auth = handles[0]; - result = TPML_CC_Unmarshal(&in->setList, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PP_Commands_setList); - result = TPML_CC_Unmarshal(&in->clearList, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_PP_Commands_clearList); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_PP_Commands (in); -break; -} -#endif // CC_PP_Commands -#if CC_SetAlgorithmSet -case TPM_CC_SetAlgorithmSet: { - SetAlgorithmSet_In *in = (SetAlgorithmSet_In *) - MemoryGetInBuffer(sizeof(SetAlgorithmSet_In)); - in->authHandle = handles[0]; - result = UINT32_Unmarshal(&in->algorithmSet, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_SetAlgorithmSet_algorithmSet); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_SetAlgorithmSet (in); -break; -} -#endif // CC_SetAlgorithmSet -#if CC_FieldUpgradeStart -case TPM_CC_FieldUpgradeStart: { - FieldUpgradeStart_In *in = (FieldUpgradeStart_In *) - MemoryGetInBuffer(sizeof(FieldUpgradeStart_In)); - in->authorization = handles[0]; - in->keyHandle = handles[1]; - result = TPM2B_DIGEST_Unmarshal(&in->fuDigest, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_FieldUpgradeStart_fuDigest); - result = TPMT_SIGNATURE_Unmarshal(&in->manifestSignature, paramBuffer, paramBufferSize, FALSE); - ERROR_IF_EXIT_PLUS(RC_FieldUpgradeStart_manifestSignature); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_FieldUpgradeStart (in); -break; -} -#endif // CC_FieldUpgradeStart -#if CC_FieldUpgradeData -case TPM_CC_FieldUpgradeData: { - FieldUpgradeData_In *in = (FieldUpgradeData_In *) - MemoryGetInBuffer(sizeof(FieldUpgradeData_In)); - FieldUpgradeData_Out *out = (FieldUpgradeData_Out *) - MemoryGetOutBuffer(sizeof(FieldUpgradeData_Out)); - result = TPM2B_MAX_BUFFER_Unmarshal(&in->fuData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_FieldUpgradeData_fuData); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_FieldUpgradeData (in, out); - rSize = sizeof(FieldUpgradeData_Out); - *respParmSize += TPMT_HA_Marshal(&out->nextDigest, - responseBuffer, &rSize); - *respParmSize += TPMT_HA_Marshal(&out->firstDigest, - responseBuffer, &rSize); -break; -} -#endif // CC_FieldUpgradeData -#if CC_FirmwareRead -case TPM_CC_FirmwareRead: { - FirmwareRead_In *in = (FirmwareRead_In *) - MemoryGetInBuffer(sizeof(FirmwareRead_In)); - FirmwareRead_Out *out = (FirmwareRead_Out *) - MemoryGetOutBuffer(sizeof(FirmwareRead_Out)); - result = UINT32_Unmarshal(&in->sequenceNumber, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_FirmwareRead_sequenceNumber); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_FirmwareRead (in, out); - rSize = sizeof(FirmwareRead_Out); - *respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->fuData, - responseBuffer, &rSize); -break; -} -#endif // CC_FirmwareRead -#if CC_ContextSave -case TPM_CC_ContextSave: { - ContextSave_In *in = (ContextSave_In *) - MemoryGetInBuffer(sizeof(ContextSave_In)); - ContextSave_Out *out = (ContextSave_Out *) - MemoryGetOutBuffer(sizeof(ContextSave_Out)); - in->saveHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ContextSave (in, out); - rSize = sizeof(ContextSave_Out); - *respParmSize += TPMS_CONTEXT_Marshal(&out->context, - responseBuffer, &rSize); -break; -} -#endif // CC_ContextSave -#if CC_ContextLoad -case TPM_CC_ContextLoad: { - ContextLoad_In *in = (ContextLoad_In *) - MemoryGetInBuffer(sizeof(ContextLoad_In)); - ContextLoad_Out *out = (ContextLoad_Out *) - MemoryGetOutBuffer(sizeof(ContextLoad_Out)); - result = TPMS_CONTEXT_Unmarshal(&in->context, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ContextLoad_context); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ContextLoad (in, out); - rSize = sizeof(ContextLoad_Out); - if(TPM_RC_SUCCESS != result) goto Exit; -; command->handles[command->handleNum++] = out->loadedHandle; -break; -} -#endif // CC_ContextLoad -#if CC_FlushContext -case TPM_CC_FlushContext: { - FlushContext_In *in = (FlushContext_In *) - MemoryGetInBuffer(sizeof(FlushContext_In)); - result = TPMI_DH_CONTEXT_Unmarshal(&in->flushHandle, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_FlushContext_flushHandle); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_FlushContext (in); -break; -} -#endif // CC_FlushContext -#if CC_EvictControl -case TPM_CC_EvictControl: { - EvictControl_In *in = (EvictControl_In *) - MemoryGetInBuffer(sizeof(EvictControl_In)); - in->auth = handles[0]; - in->objectHandle = handles[1]; - result = TPMI_DH_PERSISTENT_Unmarshal(&in->persistentHandle, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_EvictControl_persistentHandle); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_EvictControl (in); -break; -} -#endif // CC_EvictControl -#if CC_ReadClock -case TPM_CC_ReadClock: { - ReadClock_Out *out = (ReadClock_Out *) - MemoryGetOutBuffer(sizeof(ReadClock_Out)); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ReadClock (out); - rSize = sizeof(ReadClock_Out); - *respParmSize += TPMS_TIME_INFO_Marshal(&out->currentTime, - responseBuffer, &rSize); -break; -} -#endif // CC_ReadClock -#if CC_ClockSet -case TPM_CC_ClockSet: { - ClockSet_In *in = (ClockSet_In *) - MemoryGetInBuffer(sizeof(ClockSet_In)); - in->auth = handles[0]; - result = UINT64_Unmarshal(&in->newTime, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ClockSet_newTime); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ClockSet (in); -break; -} -#endif // CC_ClockSet -#if CC_ClockRateAdjust -case TPM_CC_ClockRateAdjust: { - ClockRateAdjust_In *in = (ClockRateAdjust_In *) - MemoryGetInBuffer(sizeof(ClockRateAdjust_In)); - in->auth = handles[0]; - result = TPM_CLOCK_ADJUST_Unmarshal(&in->rateAdjust, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_ClockRateAdjust_rateAdjust); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_ClockRateAdjust (in); -break; -} -#endif // CC_ClockRateAdjust -#if CC_GetCapability -case TPM_CC_GetCapability: { - GetCapability_In *in = (GetCapability_In *) - MemoryGetInBuffer(sizeof(GetCapability_In)); - GetCapability_Out *out = (GetCapability_Out *) - MemoryGetOutBuffer(sizeof(GetCapability_Out)); - result = TPM_CAP_Unmarshal(&in->capability, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_GetCapability_capability); - result = UINT32_Unmarshal(&in->property, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_GetCapability_property); - result = UINT32_Unmarshal(&in->propertyCount, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_GetCapability_propertyCount); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_GetCapability (in, out); - rSize = sizeof(GetCapability_Out); - *respParmSize += TPMI_YES_NO_Marshal(&out->moreData, - responseBuffer, &rSize); - *respParmSize += TPMS_CAPABILITY_DATA_Marshal(&out->capabilityData, - responseBuffer, &rSize); -break; -} -#endif // CC_GetCapability -#if CC_TestParms -case TPM_CC_TestParms: { - TestParms_In *in = (TestParms_In *) - MemoryGetInBuffer(sizeof(TestParms_In)); - result = TPMT_PUBLIC_PARMS_Unmarshal(&in->parameters, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_TestParms_parameters); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_TestParms (in); -break; -} -#endif // CC_TestParms -#if CC_NV_DefineSpace -case TPM_CC_NV_DefineSpace: { - NV_DefineSpace_In *in = (NV_DefineSpace_In *) - MemoryGetInBuffer(sizeof(NV_DefineSpace_In)); - in->authHandle = handles[0]; - result = TPM2B_AUTH_Unmarshal(&in->auth, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_DefineSpace_auth); - result = TPM2B_NV_PUBLIC_Unmarshal(&in->publicInfo, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_DefineSpace_publicInfo); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_DefineSpace (in); -break; -} -#endif // CC_NV_DefineSpace -#if CC_NV_UndefineSpace -case TPM_CC_NV_UndefineSpace: { - NV_UndefineSpace_In *in = (NV_UndefineSpace_In *) - MemoryGetInBuffer(sizeof(NV_UndefineSpace_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_UndefineSpace (in); -break; -} -#endif // CC_NV_UndefineSpace -#if CC_NV_UndefineSpaceSpecial -case TPM_CC_NV_UndefineSpaceSpecial: { - NV_UndefineSpaceSpecial_In *in = (NV_UndefineSpaceSpecial_In *) - MemoryGetInBuffer(sizeof(NV_UndefineSpaceSpecial_In)); - in->nvIndex = handles[0]; - in->platform = handles[1]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_UndefineSpaceSpecial (in); -break; -} -#endif // CC_NV_UndefineSpaceSpecial -#if CC_NV_ReadPublic -case TPM_CC_NV_ReadPublic: { - NV_ReadPublic_In *in = (NV_ReadPublic_In *) - MemoryGetInBuffer(sizeof(NV_ReadPublic_In)); - NV_ReadPublic_Out *out = (NV_ReadPublic_Out *) - MemoryGetOutBuffer(sizeof(NV_ReadPublic_Out)); - in->nvIndex = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_ReadPublic (in, out); - rSize = sizeof(NV_ReadPublic_Out); - *respParmSize += TPM2B_NV_PUBLIC_Marshal(&out->nvPublic, - responseBuffer, &rSize); - *respParmSize += TPM2B_NAME_Marshal(&out->nvName, - responseBuffer, &rSize); -break; -} -#endif // CC_NV_ReadPublic -#if CC_NV_Write -case TPM_CC_NV_Write: { - NV_Write_In *in = (NV_Write_In *) - MemoryGetInBuffer(sizeof(NV_Write_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - result = TPM2B_MAX_NV_BUFFER_Unmarshal(&in->data, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_Write_data); - result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_Write_offset); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_Write (in); -break; -} -#endif // CC_NV_Write -#if CC_NV_Increment -case TPM_CC_NV_Increment: { - NV_Increment_In *in = (NV_Increment_In *) - MemoryGetInBuffer(sizeof(NV_Increment_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_Increment (in); -break; -} -#endif // CC_NV_Increment -#if CC_NV_Extend -case TPM_CC_NV_Extend: { - NV_Extend_In *in = (NV_Extend_In *) - MemoryGetInBuffer(sizeof(NV_Extend_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - result = TPM2B_MAX_NV_BUFFER_Unmarshal(&in->data, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_Extend_data); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_Extend (in); -break; -} -#endif // CC_NV_Extend -#if CC_NV_SetBits -case TPM_CC_NV_SetBits: { - NV_SetBits_In *in = (NV_SetBits_In *) - MemoryGetInBuffer(sizeof(NV_SetBits_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - result = UINT64_Unmarshal(&in->bits, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_SetBits_bits); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_SetBits (in); -break; -} -#endif // CC_NV_SetBits -#if CC_NV_WriteLock -case TPM_CC_NV_WriteLock: { - NV_WriteLock_In *in = (NV_WriteLock_In *) - MemoryGetInBuffer(sizeof(NV_WriteLock_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_WriteLock (in); -break; -} -#endif // CC_NV_WriteLock -#if CC_NV_GlobalWriteLock -case TPM_CC_NV_GlobalWriteLock: { - NV_GlobalWriteLock_In *in = (NV_GlobalWriteLock_In *) - MemoryGetInBuffer(sizeof(NV_GlobalWriteLock_In)); - in->authHandle = handles[0]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_GlobalWriteLock (in); -break; -} -#endif // CC_NV_GlobalWriteLock -#if CC_NV_Read -case TPM_CC_NV_Read: { - NV_Read_In *in = (NV_Read_In *) - MemoryGetInBuffer(sizeof(NV_Read_In)); - NV_Read_Out *out = (NV_Read_Out *) - MemoryGetOutBuffer(sizeof(NV_Read_Out)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - result = UINT16_Unmarshal(&in->size, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_Read_size); - result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_Read_offset); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_Read (in, out); - rSize = sizeof(NV_Read_Out); - *respParmSize += TPM2B_MAX_NV_BUFFER_Marshal(&out->data, - responseBuffer, &rSize); -break; -} -#endif // CC_NV_Read -#if CC_NV_ReadLock -case TPM_CC_NV_ReadLock: { - NV_ReadLock_In *in = (NV_ReadLock_In *) - MemoryGetInBuffer(sizeof(NV_ReadLock_In)); - in->authHandle = handles[0]; - in->nvIndex = handles[1]; - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_ReadLock (in); -break; -} -#endif // CC_NV_ReadLock -#if CC_NV_ChangeAuth -case TPM_CC_NV_ChangeAuth: { - NV_ChangeAuth_In *in = (NV_ChangeAuth_In *) - MemoryGetInBuffer(sizeof(NV_ChangeAuth_In)); - in->nvIndex = handles[0]; - result = TPM2B_AUTH_Unmarshal(&in->newAuth, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_ChangeAuth_newAuth); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_ChangeAuth (in); -break; -} -#endif // CC_NV_ChangeAuth -#if CC_NV_Certify -case TPM_CC_NV_Certify: { - NV_Certify_In *in = (NV_Certify_In *) - MemoryGetInBuffer(sizeof(NV_Certify_In)); - NV_Certify_Out *out = (NV_Certify_Out *) - MemoryGetOutBuffer(sizeof(NV_Certify_Out)); - in->signHandle = handles[0]; - in->authHandle = handles[1]; - in->nvIndex = handles[2]; - result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_Certify_qualifyingData); - result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); - ERROR_IF_EXIT_PLUS(RC_NV_Certify_inScheme); - result = UINT16_Unmarshal(&in->size, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_Certify_size); - result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_NV_Certify_offset); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_NV_Certify (in, out); - rSize = sizeof(NV_Certify_Out); - *respParmSize += TPM2B_ATTEST_Marshal(&out->certifyInfo, - responseBuffer, &rSize); - *respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, - responseBuffer, &rSize); -break; -} -#endif // CC_NV_Certify -#if CC_AC_GetCapability -case TPM_CC_AC_GetCapability: { - AC_GetCapability_In *in = (AC_GetCapability_In *) - MemoryGetInBuffer(sizeof(AC_GetCapability_In)); - AC_GetCapability_Out *out = (AC_GetCapability_Out *) - MemoryGetOutBuffer(sizeof(AC_GetCapability_Out)); - in->ac = handles[0]; - result = TPM_AT_Unmarshal(&in->capability, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_AC_GetCapability_capability); - result = UINT32_Unmarshal(&in->count, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_AC_GetCapability_count); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_AC_GetCapability (in, out); - rSize = sizeof(AC_GetCapability_Out); - *respParmSize += TPMI_YES_NO_Marshal(&out->moreData, - responseBuffer, &rSize); - *respParmSize += TPML_AC_CAPABILITIES_Marshal(&out->capabilitiesData, - responseBuffer, &rSize); -break; -} -#endif // CC_AC_GetCapability -#if CC_AC_Send -case TPM_CC_AC_Send: { - AC_Send_In *in = (AC_Send_In *) - MemoryGetInBuffer(sizeof(AC_Send_In)); - AC_Send_Out *out = (AC_Send_Out *) - MemoryGetOutBuffer(sizeof(AC_Send_Out)); - in->sendObject = handles[0]; - in->authHandle = handles[1]; - in->ac = handles[2]; - result = TPM2B_MAX_BUFFER_Unmarshal(&in->acDataIn, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_AC_Send_acDataIn); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_AC_Send (in, out); - rSize = sizeof(AC_Send_Out); - *respParmSize += TPMS_AC_OUTPUT_Marshal(&out->acDataOut, - responseBuffer, &rSize); -break; -} -#endif // CC_AC_Send -#if CC_Policy_AC_SendSelect -case TPM_CC_Policy_AC_SendSelect: { - Policy_AC_SendSelect_In *in = (Policy_AC_SendSelect_In *) - MemoryGetInBuffer(sizeof(Policy_AC_SendSelect_In)); - in->policySession = handles[0]; - result = TPM2B_NAME_Unmarshal(&in->objectName, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Policy_AC_SendSelect_objectName); - result = TPM2B_NAME_Unmarshal(&in->authHandleName, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Policy_AC_SendSelect_authHandleName); - result = TPM2B_NAME_Unmarshal(&in->acName, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Policy_AC_SendSelect_acName); - result = TPMI_YES_NO_Unmarshal(&in->includeObject, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Policy_AC_SendSelect_includeObject); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Policy_AC_SendSelect (in); -break; -} -#endif // CC_Policy_AC_SendSelect -#if CC_Vendor_TCG_Test -case TPM_CC_Vendor_TCG_Test: { - Vendor_TCG_Test_In *in = (Vendor_TCG_Test_In *) - MemoryGetInBuffer(sizeof(Vendor_TCG_Test_In)); - Vendor_TCG_Test_Out *out = (Vendor_TCG_Test_Out *) - MemoryGetOutBuffer(sizeof(Vendor_TCG_Test_Out)); - result = TPM2B_DATA_Unmarshal(&in->inputData, paramBuffer, paramBufferSize); - ERROR_IF_EXIT_PLUS(RC_Vendor_TCG_Test_inputData); - if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } -result = TPM2_Vendor_TCG_Test (in, out); - rSize = sizeof(Vendor_TCG_Test_Out); - *respParmSize += TPM2B_DATA_Marshal(&out->outputData, - responseBuffer, &rSize); -break; -} -#endif // CC_Vendor_TCG_Test diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Commands.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Commands.h deleted file mode 100644 index f72c71e1a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Commands.h +++ /dev/null @@ -1,451 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.1 Dec 8, 2018 - * Date: Jan 28, 2019 Time: 01:24:09AM - */ - -#ifndef _COMMANDS_H_ -#define _COMMANDS_H_ - - -// Start-up -#ifdef TPM_CC_Startup -#include "Startup_fp.h" -#endif -#ifdef TPM_CC_Shutdown -#include "Shutdown_fp.h" -#endif - -// Testing -#ifdef TPM_CC_SelfTest -#include "SelfTest_fp.h" -#endif -#ifdef TPM_CC_IncrementalSelfTest -#include "IncrementalSelfTest_fp.h" -#endif -#ifdef TPM_CC_GetTestResult -#include "GetTestResult_fp.h" -#endif - -// Session Commands -#ifdef TPM_CC_StartAuthSession -#include "StartAuthSession_fp.h" -#endif -#ifdef TPM_CC_PolicyRestart -#include "PolicyRestart_fp.h" -#endif - -// Object Commands -#ifdef TPM_CC_Create -#include "Create_fp.h" -#endif -#ifdef TPM_CC_Load -#include "Load_fp.h" -#endif -#ifdef TPM_CC_LoadExternal -#include "LoadExternal_fp.h" -#endif -#ifdef TPM_CC_ReadPublic -#include "ReadPublic_fp.h" -#endif -#ifdef TPM_CC_ActivateCredential -#include "ActivateCredential_fp.h" -#endif -#ifdef TPM_CC_MakeCredential -#include "MakeCredential_fp.h" -#endif -#ifdef TPM_CC_Unseal -#include "Unseal_fp.h" -#endif -#ifdef TPM_CC_ObjectChangeAuth -#include "ObjectChangeAuth_fp.h" -#endif -#ifdef TPM_CC_CreateLoaded -#include "CreateLoaded_fp.h" -#endif - -// Duplication Commands -#ifdef TPM_CC_Duplicate -#include "Duplicate_fp.h" -#endif -#ifdef TPM_CC_Rewrap -#include "Rewrap_fp.h" -#endif -#ifdef TPM_CC_Import -#include "Import_fp.h" -#endif - -// Asymmetric Primitives -#ifdef TPM_CC_RSA_Encrypt -#include "RSA_Encrypt_fp.h" -#endif -#ifdef TPM_CC_RSA_Decrypt -#include "RSA_Decrypt_fp.h" -#endif -#ifdef TPM_CC_ECDH_KeyGen -#include "ECDH_KeyGen_fp.h" -#endif -#ifdef TPM_CC_ECDH_ZGen -#include "ECDH_ZGen_fp.h" -#endif -#ifdef TPM_CC_ECC_Parameters -#include "ECC_Parameters_fp.h" -#endif -#ifdef TPM_CC_ZGen_2Phase -#include "ZGen_2Phase_fp.h" -#endif - -// Symmetric Primitives -#ifdef TPM_CC_EncryptDecrypt -#include "EncryptDecrypt_fp.h" -#endif -#ifdef TPM_CC_EncryptDecrypt2 -#include "EncryptDecrypt2_fp.h" -#endif -#ifdef TPM_CC_Hash -#include "Hash_fp.h" -#endif -#ifdef TPM_CC_HMAC -#include "HMAC_fp.h" -#endif -#ifdef TPM_CC_MAC -#include "MAC_fp.h" -#endif - -// Random Number Generator -#ifdef TPM_CC_GetRandom -#include "GetRandom_fp.h" -#endif -#ifdef TPM_CC_StirRandom -#include "StirRandom_fp.h" -#endif - -// Hash/HMAC/Event Sequences -#ifdef TPM_CC_HMAC_Start -#include "HMAC_Start_fp.h" -#endif -#ifdef TPM_CC_MAC_Start -#include "MAC_Start_fp.h" -#endif -#ifdef TPM_CC_HashSequenceStart -#include "HashSequenceStart_fp.h" -#endif -#ifdef TPM_CC_SequenceUpdate -#include "SequenceUpdate_fp.h" -#endif -#ifdef TPM_CC_SequenceComplete -#include "SequenceComplete_fp.h" -#endif -#ifdef TPM_CC_EventSequenceComplete -#include "EventSequenceComplete_fp.h" -#endif - -// Attestation Commands -#ifdef TPM_CC_Certify -#include "Certify_fp.h" -#endif -#ifdef TPM_CC_CertifyCreation -#include "CertifyCreation_fp.h" -#endif -#ifdef TPM_CC_Quote -#include "Quote_fp.h" -#endif -#ifdef TPM_CC_GetSessionAuditDigest -#include "GetSessionAuditDigest_fp.h" -#endif -#ifdef TPM_CC_GetCommandAuditDigest -#include "GetCommandAuditDigest_fp.h" -#endif -#ifdef TPM_CC_GetTime -#include "GetTime_fp.h" -#endif -#ifdef TPM_CC_CertifyX509 -#include "CertifyX509_fp.h" -#endif - -// Ephemeral EC Keys -#ifdef TPM_CC_Commit -#include "Commit_fp.h" -#endif -#ifdef TPM_CC_EC_Ephemeral -#include "EC_Ephemeral_fp.h" -#endif - -// Signing and Signature Verification -#ifdef TPM_CC_VerifySignature -#include "VerifySignature_fp.h" -#endif -#ifdef TPM_CC_Sign -#include "Sign_fp.h" -#endif - -// Command Audit -#ifdef TPM_CC_SetCommandCodeAuditStatus -#include "SetCommandCodeAuditStatus_fp.h" -#endif - -// Integrity Collection (PCR) -#ifdef TPM_CC_PCR_Extend -#include "PCR_Extend_fp.h" -#endif -#ifdef TPM_CC_PCR_Event -#include "PCR_Event_fp.h" -#endif -#ifdef TPM_CC_PCR_Read -#include "PCR_Read_fp.h" -#endif -#ifdef TPM_CC_PCR_Allocate -#include "PCR_Allocate_fp.h" -#endif -#ifdef TPM_CC_PCR_SetAuthPolicy -#include "PCR_SetAuthPolicy_fp.h" -#endif -#ifdef TPM_CC_PCR_SetAuthValue -#include "PCR_SetAuthValue_fp.h" -#endif -#ifdef TPM_CC_PCR_Reset -#include "PCR_Reset_fp.h" -#endif - -// Enhanced Authorization (EA) Commands -#ifdef TPM_CC_PolicySigned -#include "PolicySigned_fp.h" -#endif -#ifdef TPM_CC_PolicySecret -#include "PolicySecret_fp.h" -#endif -#ifdef TPM_CC_PolicyTicket -#include "PolicyTicket_fp.h" -#endif -#ifdef TPM_CC_PolicyOR -#include "PolicyOR_fp.h" -#endif -#ifdef TPM_CC_PolicyPCR -#include "PolicyPCR_fp.h" -#endif -#ifdef TPM_CC_PolicyLocality -#include "PolicyLocality_fp.h" -#endif -#ifdef TPM_CC_PolicyNV -#include "PolicyNV_fp.h" -#endif -#ifdef TPM_CC_PolicyCounterTimer -#include "PolicyCounterTimer_fp.h" -#endif -#ifdef TPM_CC_PolicyCommandCode -#include "PolicyCommandCode_fp.h" -#endif -#ifdef TPM_CC_PolicyPhysicalPresence -#include "PolicyPhysicalPresence_fp.h" -#endif -#ifdef TPM_CC_PolicyCpHash -#include "PolicyCpHash_fp.h" -#endif -#ifdef TPM_CC_PolicyNameHash -#include "PolicyNameHash_fp.h" -#endif -#ifdef TPM_CC_PolicyDuplicationSelect -#include "PolicyDuplicationSelect_fp.h" -#endif -#ifdef TPM_CC_PolicyAuthorize -#include "PolicyAuthorize_fp.h" -#endif -#ifdef TPM_CC_PolicyAuthValue -#include "PolicyAuthValue_fp.h" -#endif -#ifdef TPM_CC_PolicyPassword -#include "PolicyPassword_fp.h" -#endif -#ifdef TPM_CC_PolicyGetDigest -#include "PolicyGetDigest_fp.h" -#endif -#ifdef TPM_CC_PolicyNvWritten -#include "PolicyNvWritten_fp.h" -#endif -#ifdef TPM_CC_PolicyTemplate -#include "PolicyTemplate_fp.h" -#endif -#ifdef TPM_CC_PolicyAuthorizeNV -#include "PolicyAuthorizeNV_fp.h" -#endif - -// Hierarchy Commands -#ifdef TPM_CC_CreatePrimary -#include "CreatePrimary_fp.h" -#endif -#ifdef TPM_CC_HierarchyControl -#include "HierarchyControl_fp.h" -#endif -#ifdef TPM_CC_SetPrimaryPolicy -#include "SetPrimaryPolicy_fp.h" -#endif -#ifdef TPM_CC_ChangePPS -#include "ChangePPS_fp.h" -#endif -#ifdef TPM_CC_ChangeEPS -#include "ChangeEPS_fp.h" -#endif -#ifdef TPM_CC_Clear -#include "Clear_fp.h" -#endif -#ifdef TPM_CC_ClearControl -#include "ClearControl_fp.h" -#endif -#ifdef TPM_CC_HierarchyChangeAuth -#include "HierarchyChangeAuth_fp.h" -#endif - -// Dictionary Attack Functions -#ifdef TPM_CC_DictionaryAttackLockReset -#include "DictionaryAttackLockReset_fp.h" -#endif -#ifdef TPM_CC_DictionaryAttackParameters -#include "DictionaryAttackParameters_fp.h" -#endif - -// Miscellaneous Management Functions -#ifdef TPM_CC_PP_Commands -#include "PP_Commands_fp.h" -#endif -#ifdef TPM_CC_SetAlgorithmSet -#include "SetAlgorithmSet_fp.h" -#endif - -// Field Upgrade -#ifdef TPM_CC_FieldUpgradeStart -#include "FieldUpgradeStart_fp.h" -#endif -#ifdef TPM_CC_FieldUpgradeData -#include "FieldUpgradeData_fp.h" -#endif -#ifdef TPM_CC_FirmwareRead -#include "FirmwareRead_fp.h" -#endif - -// Context Management -#ifdef TPM_CC_ContextSave -#include "ContextSave_fp.h" -#endif -#ifdef TPM_CC_ContextLoad -#include "ContextLoad_fp.h" -#endif -#ifdef TPM_CC_FlushContext -#include "FlushContext_fp.h" -#endif -#ifdef TPM_CC_EvictControl -#include "EvictControl_fp.h" -#endif - -// Clocks and Timers -#ifdef TPM_CC_ReadClock -#include "ReadClock_fp.h" -#endif -#ifdef TPM_CC_ClockSet -#include "ClockSet_fp.h" -#endif -#ifdef TPM_CC_ClockRateAdjust -#include "ClockRateAdjust_fp.h" -#endif - -// Capability Commands -#ifdef TPM_CC_GetCapability -#include "GetCapability_fp.h" -#endif -#ifdef TPM_CC_TestParms -#include "TestParms_fp.h" -#endif - -// Non-volatile Storage -#ifdef TPM_CC_NV_DefineSpace -#include "NV_DefineSpace_fp.h" -#endif -#ifdef TPM_CC_NV_UndefineSpace -#include "NV_UndefineSpace_fp.h" -#endif -#ifdef TPM_CC_NV_UndefineSpaceSpecial -#include "NV_UndefineSpaceSpecial_fp.h" -#endif -#ifdef TPM_CC_NV_ReadPublic -#include "NV_ReadPublic_fp.h" -#endif -#ifdef TPM_CC_NV_Write -#include "NV_Write_fp.h" -#endif -#ifdef TPM_CC_NV_Increment -#include "NV_Increment_fp.h" -#endif -#ifdef TPM_CC_NV_Extend -#include "NV_Extend_fp.h" -#endif -#ifdef TPM_CC_NV_SetBits -#include "NV_SetBits_fp.h" -#endif -#ifdef TPM_CC_NV_WriteLock -#include "NV_WriteLock_fp.h" -#endif -#ifdef TPM_CC_NV_GlobalWriteLock -#include "NV_GlobalWriteLock_fp.h" -#endif -#ifdef TPM_CC_NV_Read -#include "NV_Read_fp.h" -#endif -#ifdef TPM_CC_NV_ReadLock -#include "NV_ReadLock_fp.h" -#endif -#ifdef TPM_CC_NV_ChangeAuth -#include "NV_ChangeAuth_fp.h" -#endif -#ifdef TPM_CC_NV_Certify -#include "NV_Certify_fp.h" -#endif - -// Attached Components -#ifdef TPM_CC_AC_GetCapability -#include "AC_GetCapability_fp.h" -#endif -#ifdef TPM_CC_AC_Send -#include "AC_Send_fp.h" -#endif -#ifdef TPM_CC_Policy_AC_SendSelect -#include "Policy_AC_SendSelect_fp.h" -#endif - -// Vendor Specific -#ifdef TPM_CC_Vendor_TCG_Test -#include "Vendor_TCG_Test_fp.h" -#endif - -#endif diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CompilerDependencies.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CompilerDependencies.h deleted file mode 100644 index 2931952f0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CompilerDependencies.h +++ /dev/null @@ -1,132 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// This file contains the build switches. This contains switches for multiple -// versions of the crypto-library so some may not apply to your environment. -// - -#ifndef _COMPILER_DEPENDENCIES_H_ -#define _COMPILER_DEPENDENCIES_H_ - -#ifdef GCC -# undef _MSC_VER -# undef WIN32 -#endif - -#ifdef _MSC_VER -// These definitions are for the Microsoft compiler - -// Endian conversion for aligned structures -# define REVERSE_ENDIAN_16(_Number) _byteswap_ushort(_Number) -# define REVERSE_ENDIAN_32(_Number) _byteswap_ulong(_Number) -# define REVERSE_ENDIAN_64(_Number) _byteswap_uint64(_Number) - -// Avoid compiler warning for in line of stdio (or not) -//#define _NO_CRT_STDIO_INLINE - -// This macro is used to handle LIB_EXPORT of function and variable names in lieu -// of a .def file. Visual Studio requires that functions be explicitly exported and -// imported. -# define LIB_EXPORT __declspec(dllexport) // VS compatible version -# define LIB_IMPORT __declspec(dllimport) - -// This is defined to indicate a function that does not return. Microsoft compilers -// do not support the _Noretrun function parameter. -# define NORETURN __declspec(noreturn) -# if _MSC_VER >= 1400 // SAL processing when needed -# include -# endif - -# ifdef _WIN64 -# define _INTPTR 2 -# else -# define _INTPTR 1 -# endif - - -#define NOT_REFERENCED(x) (x) - -// Lower the compiler error warning for system include -// files. They tend not to be that clean and there is no -// reason to sort through all the spurious errors that they -// generate when the normal error level is set to /Wall -# define _REDUCE_WARNING_LEVEL_(n) \ -__pragma(warning(push, n)) -// Restore the compiler warning level -# define _NORMAL_WARNING_LEVEL_ \ -__pragma(warning(pop)) -# include -#endif - -#ifndef _MSC_VER -#ifndef WINAPI -# define WINAPI -#endif -# define __pragma(x) -# define REVERSE_ENDIAN_16(_Number) __builtin_bswap16(_Number) -# define REVERSE_ENDIAN_32(_Number) __builtin_bswap32(_Number) -# define REVERSE_ENDIAN_64(_Number) __builtin_bswap64(_Number) -#endif - -#if defined(__GNUC__) -# define NORETURN __attribute__((noreturn)) -# include -#endif - -// Things that are not defined should be defined as NULL -#ifndef NORETURN -# define NORETURN -#endif -#ifndef LIB_EXPORT -# define LIB_EXPORT -#endif -#ifndef LIB_IMPORT -# define LIB_IMPORT -#endif -#ifndef _REDUCE_WARNING_LEVEL_ -# define _REDUCE_WARNING_LEVEL_(n) -#endif -#ifndef _NORMAL_WARNING_LEVEL_ -# define _NORMAL_WARNING_LEVEL_ -#endif -#ifndef NOT_REFERENCED -# define NOT_REFERENCED(x) (x = x) -#endif - -#ifdef _POSIX_ -typedef int SOCKET; -#endif - - -#endif // _COMPILER_DEPENDENCIES_H_ \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptEcc.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptEcc.h deleted file mode 100644 index f05e781ad..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptEcc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains structure definitions used for ECC. The -// structures in this file are only used internally. The ECC-related structures -// that cross the TPM interface are defined in TpmTypes.h -// - -#ifndef _CRYPT_ECC_H -#define _CRYPT_ECC_H - -//** Structures - -// This is used to define the macro that may or may not be in the data set for the -// curve (CryptEccData.c). If there is a mismatch, the compiler will warn that there -// is to much/not enough initialization data in the curve. The macro is used because -// not all versions of the CryptEccData.c need the curve name. -#ifdef NAMED_CURVES -#define CURVE_NAME(a) , a -#define CURVE_NAME_DEF const char *name; -#else -# define CURVE_NAME(a) -# define CURVE_NAME_DEF -#endif - -typedef struct ECC_CURVE -{ - const TPM_ECC_CURVE curveId; - const UINT16 keySizeBits; - const TPMT_KDF_SCHEME kdf; - const TPMT_ECC_SCHEME sign; - const ECC_CURVE_DATA *curveData; // the address of the curve data - const BYTE *OID; - CURVE_NAME_DEF -} ECC_CURVE; - -extern const ECC_CURVE eccCurves[ECC_CURVE_COUNT]; - -#endif diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptHash.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptHash.h deleted file mode 100644 index de6eb5148..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptHash.h +++ /dev/null @@ -1,303 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This header contains the hash structure definitions used in the TPM code -// to define the amount of space to be reserved for the hash state. This allows -// the TPM code to not have to import all of the symbols used by the hash -// computations. This lets the build environment of the TPM code not to have -// include the header files associated with the CryptoEngine code. - -#ifndef _CRYPT_HASH_H -#define _CRYPT_HASH_H - -//** Hash-related Structures - -union SMAC_STATES; - -// These definitions add the high-level methods for processing state that may be -// an SMAC -typedef void(* SMAC_DATA_METHOD)( - union SMAC_STATES *state, - UINT32 size, - const BYTE *buffer - ); - -typedef UINT16(* SMAC_END_METHOD)( - union SMAC_STATES *state, - UINT32 size, - BYTE *buffer - ); - -typedef struct sequenceMethods { - SMAC_DATA_METHOD data; - SMAC_END_METHOD end; -} SMAC_METHODS; - -#define SMAC_IMPLEMENTED (CC_MAC || CC_MAC_Start) - -// These definitions are here because the SMAC state is in the union of hash states. -typedef struct tpmCmacState { - TPM_ALG_ID symAlg; - UINT16 keySizeBits; - INT16 bcount; // current count of bytes accumulated in IV - TPM2B_IV iv; // IV buffer - TPM2B_SYM_KEY symKey; -} tpmCmacState_t; - -typedef union SMAC_STATES { -#if ALG_CMAC - tpmCmacState_t cmac; -#endif - UINT64 pad; -} SMAC_STATES; - -typedef struct SMAC_STATE { - SMAC_METHODS smacMethods; - SMAC_STATES state; -} SMAC_STATE; - - -typedef union -{ -#if ALG_SHA1 - tpmHashStateSHA1_t Sha1; -#endif -#if ALG_SHA256 - tpmHashStateSHA256_t Sha256; -#endif -#if ALG_SHA384 - tpmHashStateSHA384_t Sha384; -#endif -#if ALG_SHA512 - tpmHashStateSHA512_t Sha512; -#endif - -// Additions for symmetric block cipher MAC -#if SMAC_IMPLEMENTED - SMAC_STATE smac; -#endif - // to force structure alignment to be no worse than HASH_ALIGNMENT -#if HASH_ALIGNMENT == 4 - uint32_t align; -#else - uint64_t align; -#endif -} ANY_HASH_STATE; - -typedef ANY_HASH_STATE *PANY_HASH_STATE; -typedef const ANY_HASH_STATE *PCANY_HASH_STATE; - -#define ALIGNED_SIZE(x, b) ((((x) + (b) - 1) / (b)) * (b)) -// MAX_HASH_STATE_SIZE will change with each implementation. It is assumed that -// a hash state will not be larger than twice the block size plus some -// overhead (in this case, 16 bytes). The overall size needs to be as -// large as any of the hash contexts. The structure needs to start on an -// alignment boundary and be an even multiple of the alignment -#define MAX_HASH_STATE_SIZE ((2 * MAX_HASH_BLOCK_SIZE) + 16) -#define MAX_HASH_STATE_SIZE_ALIGNED \ - ALIGNED_SIZE(MAX_HASH_STATE_SIZE, HASH_ALIGNMENT) - -// This is an aligned byte array that will hold any of the hash contexts. -typedef ANY_HASH_STATE ALIGNED_HASH_STATE; - -// The header associated with the hash library is expected to define the methods -// which include the calling sequence. When not compiling CryptHash.c, the methods -// are not defined so we need placeholder functions for the structures - -#ifndef HASH_START_METHOD_DEF -# define HASH_START_METHOD_DEF void (HASH_START_METHOD)(void) -#endif -#ifndef HASH_DATA_METHOD_DEF -# define HASH_DATA_METHOD_DEF void (HASH_DATA_METHOD)(void) -#endif -#ifndef HASH_END_METHOD_DEF -# define HASH_END_METHOD_DEF void (HASH_END_METHOD)(void) -#endif -#ifndef HASH_STATE_COPY_METHOD_DEF -# define HASH_STATE_COPY_METHOD_DEF void (HASH_STATE_COPY_METHOD)(void) -#endif -#ifndef HASH_STATE_EXPORT_METHOD_DEF -# define HASH_STATE_EXPORT_METHOD_DEF void (HASH_STATE_EXPORT_METHOD)(void) -#endif -#ifndef HASH_STATE_IMPORT_METHOD_DEF -# define HASH_STATE_IMPORT_METHOD_DEF void (HASH_STATE_IMPORT_METHOD)(void) -#endif - -// Define the prototypical function call for each of the methods. This defines the -// order in which the parameters are passed to the underlying function. -typedef HASH_START_METHOD_DEF; -typedef HASH_DATA_METHOD_DEF; -typedef HASH_END_METHOD_DEF; -typedef HASH_STATE_COPY_METHOD_DEF; -typedef HASH_STATE_EXPORT_METHOD_DEF; -typedef HASH_STATE_IMPORT_METHOD_DEF; - - -typedef struct _HASH_METHODS -{ - HASH_START_METHOD *start; - HASH_DATA_METHOD *data; - HASH_END_METHOD *end; - HASH_STATE_COPY_METHOD *copy; // Copy a hash block - HASH_STATE_EXPORT_METHOD *copyOut; // Copy a hash block from a hash - // context - HASH_STATE_IMPORT_METHOD *copyIn; // Copy a hash block to a proper hash - // context -} HASH_METHODS, *PHASH_METHODS; - -#if ALG_SHA1 - TPM2B_TYPE(SHA1_DIGEST, SHA1_DIGEST_SIZE); -#endif -#if ALG_SHA256 - TPM2B_TYPE(SHA256_DIGEST, SHA256_DIGEST_SIZE); -#endif -#if ALG_SHA384 - TPM2B_TYPE(SHA384_DIGEST, SHA384_DIGEST_SIZE); -#endif -#if ALG_SHA512 - TPM2B_TYPE(SHA512_DIGEST, SHA512_DIGEST_SIZE); -#endif -#if ALG_SM3_256 - TPM2B_TYPE(SM3_256_DIGEST, SM3_256_DIGEST_SIZE); -#endif - -// When the TPM implements RSA, the hash-dependent OID pointers are part of the -// HASH_DEF. These macros conditionally add the OID reference to the HASH_DEF and the -// HASH_DEF_TEMPLATE. -#if ALG_RSA -#define PKCS1_HASH_REF const BYTE *PKCS1; -#define PKCS1_OID(NAME) , OID_PKCS1_##NAME -#else -#define PKCS1_HASH_REF -#define PKCS1_OID(NAME) -#endif - -// When the TPM implements ECC, the hash-dependent OID pointers are part of the -// HASH_DEF. These macros conditionally add the OID reference to the HASH_DEF and the -// HASH_DEF_TEMPLATE. -#if ALG_ECDSA -#define ECDSA_HASH_REF const BYTE *ECDSA; -#define ECDSA_OID(NAME) , OID_ECDSA_##NAME -#else -#define ECDSA_HASH_REF -#define ECDSA_OID(NAME) -#endif - -typedef const struct HASH_DEF -{ - HASH_METHODS method; - uint16_t blockSize; - uint16_t digestSize; - uint16_t contextSize; - uint16_t hashAlg; - const BYTE *OID; - PKCS1_HASH_REF // PKCS1 OID - ECDSA_HASH_REF // ECDSA OID -} HASH_DEF, *PHASH_DEF; - -// Macro to fill in the HASH_DEF for an algorithm. For SHA1, the instance would be: -// HASH_DEF_TEMPLATE(Sha1, SHA1) -// This handles the difference in capitalization for the various pieces. -#define HASH_DEF_TEMPLATE(HASH, Hash) \ - HASH_DEF Hash##_Def= { \ - {(HASH_START_METHOD *)&tpmHashStart_##HASH, \ - (HASH_DATA_METHOD *)&tpmHashData_##HASH, \ - (HASH_END_METHOD *)&tpmHashEnd_##HASH, \ - (HASH_STATE_COPY_METHOD *)&tpmHashStateCopy_##HASH, \ - (HASH_STATE_EXPORT_METHOD *)&tpmHashStateExport_##HASH, \ - (HASH_STATE_IMPORT_METHOD *)&tpmHashStateImport_##HASH, \ - }, \ - HASH##_BLOCK_SIZE, /*block size */ \ - HASH##_DIGEST_SIZE, /*data size */ \ - sizeof(tpmHashState##HASH##_t), \ - TPM_ALG_##HASH, OID_##HASH \ - PKCS1_OID(HASH) ECDSA_OID(HASH)}; - -// These definitions are for the types that can be in a hash state structure. -// These types are used in the cryptographic utilities. This is a define rather than -// an enum so that the size of this field can be explicit. -typedef BYTE HASH_STATE_TYPE; -#define HASH_STATE_EMPTY ((HASH_STATE_TYPE) 0) -#define HASH_STATE_HASH ((HASH_STATE_TYPE) 1) -#define HASH_STATE_HMAC ((HASH_STATE_TYPE) 2) -#if CC_MAC || CC_MAC_Start -#define HASH_STATE_SMAC ((HASH_STATE_TYPE) 3) -#endif - - -// This is the structure that is used for passing a context into the hashing -// functions. It should be the same size as the function context used within -// the hashing functions. This is checked when the hash function is initialized. -// This version uses a new layout for the contexts and a different definition. The -// state buffer is an array of HASH_UNIT values so that a decent compiler will put -// the structure on a HASH_UNIT boundary. If the structure is not properly aligned, -// the code that manipulates the structure will copy to a properly aligned -// structure before it is used and copy the result back. This just makes things -// slower. -// NOTE: This version of the state had the pointer to the update method in the -// state. This is to allow the SMAC functions to use the same structure without -// having to replicate the entire HASH_DEF structure. -typedef struct _HASH_STATE -{ - HASH_STATE_TYPE type; // type of the context - TPM_ALG_ID hashAlg; - PHASH_DEF def; - ANY_HASH_STATE state; -} HASH_STATE, *PHASH_STATE; -typedef const HASH_STATE *PCHASH_STATE; - - -//** HMAC State Structures - -// An HMAC_STATE structure contains an opaque HMAC stack state. A caller would -// use this structure when performing incremental HMAC operations. This structure -// contains a hash state and an HMAC key and allows slightly better stack -// optimization than adding an HMAC key to each hash state. -typedef struct hmacState -{ - HASH_STATE hashState; // the hash state - TPM2B_HASH_BLOCK hmacKey; // the HMAC key -} HMAC_STATE, *PHMAC_STATE; - -// This is for the external hash state. This implementation assumes that the size -// of the exported hash state is no larger than the internal hash state. -typedef struct -{ - BYTE buffer[sizeof(HASH_STATE)]; -} EXPORT_HASH_STATE, *PEXPORT_HASH_STATE; - -typedef const EXPORT_HASH_STATE *PCEXPORT_HASH_STATE; - -#endif // _CRYPT_HASH_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRand.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRand.h deleted file mode 100644 index 60a8a0435..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRand.h +++ /dev/null @@ -1,199 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains constant definition shared by CryptUtil and the parts -// of the Crypto Engine. -// - -#ifndef _CRYPT_RAND_H -#define _CRYPT_RAND_H - - -//** DRBG Structures and Defines - -// Values and structures for the random number generator. These values are defined -// in this header file so that the size of the RNG state can be known to TPM.lib. -// This allows the allocation of some space in NV memory for the state to -// be stored on an orderly shutdown. - -// The DRBG based on a symmetric block cipher is defined by three values, -// 1) the key size -// 2) the block size (the IV size) -// 3) the symmetric algorithm - -#define DRBG_KEY_SIZE_BITS AES_MAX_KEY_SIZE_BITS -#define DRBG_IV_SIZE_BITS (AES_MAX_BLOCK_SIZE * 8) -#define DRBG_ALGORITHM TPM_ALG_AES - - -typedef tpmKeyScheduleAES DRBG_KEY_SCHEDULE; -#define DRBG_ENCRYPT_SETUP(key, keySizeInBits, schedule) \ - TpmCryptSetEncryptKeyAES(key, keySizeInBits, schedule) -#define DRBG_ENCRYPT(keySchedule, in, out) \ - TpmCryptEncryptAES(SWIZZLE(keySchedule, in, out)) - -#if ((DRBG_KEY_SIZE_BITS % RADIX_BITS) != 0) \ - || ((DRBG_IV_SIZE_BITS % RADIX_BITS) != 0) -#error "Key size and IV for DRBG must be even multiples of the radix" -#endif -#if (DRBG_KEY_SIZE_BITS % DRBG_IV_SIZE_BITS) != 0 -#error "Key size for DRBG must be even multiple of the cypher block size" -#endif - -// Derived values -#define DRBG_MAX_REQUESTS_PER_RESEED (1 << 48) -#define DRBG_MAX_REQEST_SIZE (1 << 32) - -#define pDRBG_KEY(seed) ((DRBG_KEY *)&(((BYTE *)(seed))[0])) -#define pDRBG_IV(seed) ((DRBG_IV *)&(((BYTE *)(seed))[DRBG_KEY_SIZE_BYTES])) - -#define DRBG_KEY_SIZE_WORDS (BITS_TO_CRYPT_WORDS(DRBG_KEY_SIZE_BITS)) -#define DRBG_KEY_SIZE_BYTES (DRBG_KEY_SIZE_WORDS * RADIX_BYTES) - -#define DRBG_IV_SIZE_WORDS (BITS_TO_CRYPT_WORDS(DRBG_IV_SIZE_BITS)) -#define DRBG_IV_SIZE_BYTES (DRBG_IV_SIZE_WORDS * RADIX_BYTES) - -#define DRBG_SEED_SIZE_WORDS (DRBG_KEY_SIZE_WORDS + DRBG_IV_SIZE_WORDS) -#define DRBG_SEED_SIZE_BYTES (DRBG_KEY_SIZE_BYTES + DRBG_IV_SIZE_BYTES) - - -typedef union -{ - BYTE bytes[DRBG_KEY_SIZE_BYTES]; - crypt_uword_t words[DRBG_KEY_SIZE_WORDS]; -} DRBG_KEY; - -typedef union -{ - BYTE bytes[DRBG_IV_SIZE_BYTES]; - crypt_uword_t words[DRBG_IV_SIZE_WORDS]; -} DRBG_IV; - -typedef union -{ - BYTE bytes[DRBG_SEED_SIZE_BYTES]; - crypt_uword_t words[DRBG_SEED_SIZE_WORDS]; -} DRBG_SEED; - -#define CTR_DRBG_MAX_REQUESTS_PER_RESEED ((UINT64)1 << 20) -#define CTR_DRBG_MAX_BYTES_PER_REQUEST (1 << 16) - -# define CTR_DRBG_MIN_ENTROPY_INPUT_LENGTH DRBG_SEED_SIZE_BYTES -# define CTR_DRBG_MAX_ENTROPY_INPUT_LENGTH DRBG_SEED_SIZE_BYTES -# define CTR_DRBG_MAX_ADDITIONAL_INPUT_LENGTH DRBG_SEED_SIZE_BYTES - -#define TESTING (1 << 0) -#define ENTROPY (1 << 1) -#define TESTED (1 << 2) - -#define IsTestStateSet(BIT) ((g_cryptoSelfTestState.rng & BIT) != 0) -#define SetTestStateBit(BIT) (g_cryptoSelfTestState.rng |= BIT) -#define ClearTestStateBit(BIT) (g_cryptoSelfTestState.rng &= ~BIT) - -#define IsSelfTest() IsTestStateSet(TESTING) -#define SetSelfTest() SetTestStateBit(TESTING) -#define ClearSelfTest() ClearTestStateBit(TESTING) - -#define IsEntropyBad() IsTestStateSet(ENTROPY) -#define SetEntropyBad() SetTestStateBit(ENTROPY) -#define ClearEntropyBad() ClearTestStateBit(ENTROPY) - -#define IsDrbgTested() IsTestStateSet(TESTED) -#define SetDrbgTested() SetTestStateBit(TESTED) -#define ClearDrbgTested() ClearTestStateBit(TESTED) - -typedef struct -{ - UINT64 reseedCounter; - UINT32 magic; - DRBG_SEED seed; // contains the key and IV for the counter mode DRBG - UINT32 lastValue[4]; // used when the TPM does continuous self-test - // for FIPS compliance of DRBG -} DRBG_STATE, *pDRBG_STATE; -#define DRBG_MAGIC ((UINT32) 0x47425244) // "DRBG" backwards so that it displays - -typedef struct -{ - UINT64 counter; - UINT32 magic; - UINT32 limit; - TPM2B *seed; - const TPM2B *label; - TPM2B *context; - TPM_ALG_ID hash; - TPM_ALG_ID kdf; - UINT16 digestSize; - TPM2B_DIGEST residual; -} KDF_STATE, *pKDR_STATE; -#define KDF_MAGIC ((UINT32) 0x4048444a) // "KDF " backwards - -// Make sure that any other structures added to this union start with a 64-bit -// counter and a 32-bit magic number -typedef union -{ - DRBG_STATE drbg; - KDF_STATE kdf; -} RAND_STATE; - -// This is the state used when the library uses a random number generator. -// A special function is installed for the library to call. That function -// picks up the state from this location and uses it for the generation -// of the random number. -extern RAND_STATE *s_random; - -// When instrumenting RSA key sieve -#if RSA_INSTRUMENT -#define PRIME_INDEX(x) ((x) == 512 ? 0 : (x) == 1024 ? 1 : 2) -# define INSTRUMENT_SET(a, b) ((a) = (b)) -# define INSTRUMENT_ADD(a, b) (a) = (a) + (b) -# define INSTRUMENT_INC(a) (a) = (a) + 1 - -extern UINT32 PrimeIndex; -extern UINT32 failedAtIteration[10]; -extern UINT32 PrimeCounts[3]; -extern UINT32 MillerRabinTrials[3]; -extern UINT32 totalFieldsSieved[3]; -extern UINT32 bitsInFieldAfterSieve[3]; -extern UINT32 emptyFieldsSieved[3]; -extern UINT32 noPrimeFields[3]; -extern UINT32 primesChecked[3]; -extern UINT16 lastSievePrime; -#else -# define INSTRUMENT_SET(a, b) -# define INSTRUMENT_ADD(a, b) -# define INSTRUMENT_INC(a) -#endif - -#endif // _CRYPT_RAND_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRsa.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRsa.h deleted file mode 100644 index 5d0aebdae..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptRsa.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// This file contains the RSA-related structures and defines. - -#ifndef _CRYPT_RSA_H -#define _CRYPT_RSA_H - -// These values are used in the bigNum representation of various RSA values. -BN_TYPE(rsa, MAX_RSA_KEY_BITS); -#define BN_RSA(name) BN_VAR(name, MAX_RSA_KEY_BITS) -#define BN_RSA_INITIALIZED(name, initializer) \ - BN_INITIALIZED(name, MAX_RSA_KEY_BITS, initializer) - -#define BN_PRIME(name) BN_VAR(name, (MAX_RSA_KEY_BITS / 2)) -BN_TYPE(prime, (MAX_RSA_KEY_BITS / 2)); -#define BN_PRIME_INITIALIZED(name, initializer) \ - BN_INITIALIZED(name, MAX_RSA_KEY_BITS / 2, initializer) - -#if !CRT_FORMAT_RSA -# error This verson only works with CRT formatted data -#endif // !CRT_FORMAT_RSA - -typedef struct privateExponent -{ - bigNum P; - bigNum Q; - bigNum dP; - bigNum dQ; - bigNum qInv; - bn_prime_t entries[5]; -} privateExponent; - -#define NEW_PRIVATE_EXPONENT(X) \ - privateExponent _##X; \ - privateExponent *X = RsaInitializeExponent(&(_##X)) - -#endif // _CRYPT_RSA_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptSym.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptSym.h deleted file mode 100644 index efbd24195..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptSym.h +++ /dev/null @@ -1,143 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This file contains the implementation of the symmetric block cipher modes -// allowed for a TPM. These functions only use the single block encryption functions -// of the selected symmetric cryptographic library. - -//** Includes, Defines, and Typedefs -#ifndef CRYPT_SYM_H -#define CRYPT_SYM_H - -typedef union tpmCryptKeySchedule_t { -#if ALG_AES - tpmKeyScheduleAES AES; -#endif -#if ALG_SM4 - tpmKeyScheduleSM4 SM4; -#endif -#if ALG_CAMELLIA - tpmKeyScheduleCAMELLIA CAMELLIA; -#endif - -#if ALG_TDES - tpmKeyScheduleTDES TDES[3]; -#endif -#if SYMMETRIC_ALIGNMENT == 8 - uint64_t alignment; -#else - uint32_t alignment; -#endif -} tpmCryptKeySchedule_t; - - -// Each block cipher within a library is expected to conform to the same calling -// conventions with three parameters ('keySchedule', 'in', and 'out') in the same -// order. That means that all algorithms would use the same order of the same -// parameters. The code is written assuming the ('keySchedule', 'in', and 'out') -// order. However, if the library uses a different order, the order can be changed -// with a SWIZZLE macro that puts the parameters in the correct order. -// Note that all algorithms have to use the same order and number of parameters -// because the code to build the calling list is common for each call to encrypt -// or decrypt with the algorithm chosen by setting a function pointer to select -// the algorithm that is used. - -# define ENCRYPT(keySchedule, in, out) \ - encrypt(SWIZZLE(keySchedule, in, out)) - -# define DECRYPT(keySchedule, in, out) \ - decrypt(SWIZZLE(keySchedule, in, out)) - - -// Note that the macros rely on 'encrypt' as local values in the -// functions that use these macros. Those parameters are set by the macro that -// set the key schedule to be used for the call. - - -#define ENCRYPT_CASE(ALG) \ - case TPM_ALG_##ALG: \ - TpmCryptSetEncryptKey##ALG(key, keySizeInBits, &keySchedule.ALG); \ - encrypt = (TpmCryptSetSymKeyCall_t)TpmCryptEncrypt##ALG; \ - break; -#define DECRYPT_CASE(ALG) \ - case TPM_ALG_##ALG: \ - TpmCryptSetDecryptKey##ALG(key, keySizeInBits, &keySchedule.ALG); \ - decrypt = (TpmCryptSetSymKeyCall_t)TpmCryptDecrypt##ALG; \ - break; - -#if ALG_AES -#define ENCRYPT_CASE_AES ENCRYPT_CASE(AES) -#define DECRYPT_CASE_AES DECRYPT_CASE(AES) -#else -#define ENCRYPT_CASE_AES -#define DECRYPT_CASE_AES -#endif -#if ALG_SM4 -#define ENCRYPT_CASE_SM4 ENCRYPT_CASE(SM4) -#define DECRYPT_CASE_SM4 DECRYPT_CASE(SM4) -#else -#define ENCRYPT_CASE_SM4 -#define DECRYPT_CASE_SM4 -#endif -#if ALG_CAMELLIA -#define ENCRYPT_CASE_CAMELLIA ENCRYPT_CASE(CAMELLIA) -#define DECRYPT_CASE_CAMELLIA DECRYPT_CASE(CAMELLIA) -#else -#define ENCRYPT_CASE_CAMELLIA -#define DECRYPT_CASE_CAMELLIA -#endif -#if ALG_TDES -#define ENCRYPT_CASE_TDES ENCRYPT_CASE(TDES) -#define DECRYPT_CASE_TDES DECRYPT_CASE(TDES) -#else -#define ENCRYPT_CASE_TDES -#define DECRYPT_CASE_TDES -#endif - -// For each algorithm the case will either be defined or null. -#define SELECT(direction) \ - switch(algorithm) \ - { \ - direction##_CASE_AES \ - direction##_CASE_SM4 \ - direction##_CASE_CAMELLIA \ - direction##_CASE_TDES \ - default: \ - FAIL(FATAL_ERROR_INTERNAL); \ - } - - -#endif // CRYPT_SYM_H \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptTest.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptTest.h deleted file mode 100644 index 4b0d16074..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/CryptTest.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// This file contains constant definitions used for self-test. - -#ifndef _CRYPT_TEST_H -#define _CRYPT_TEST_H - -// This is the definition of a bit array with one bit per algorithm. -// NOTE: Since bit numbering starts at zero, when ALG_LAST_VALUE is a multiple of 8, -// ALGORITHM_VECTOR will need to have byte for the single bit in the last byte. So, -// for example, when ALG_LAST_VECTOR is 8, ALGORITHM_VECTOR will need 2 bytes. -#define ALGORITHM_VECTOR_BYTES ((ALG_LAST_VALUE + 8) / 8) -typedef BYTE ALGORITHM_VECTOR[ALGORITHM_VECTOR_BYTES]; - -#ifdef TEST_SELF_TEST -LIB_EXPORT extern ALGORITHM_VECTOR LibToTest; -#endif - -// This structure is used to contain self-test tracking information for the -// cryptographic modules. Each of the major modules is given a 32-bit value in -// which it may maintain its own self test information. The convention for this -// state is that when all of the bits in this structure are 0, all functions need -// to be tested. -typedef struct -{ - UINT32 rng; - UINT32 hash; - UINT32 sym; -#if ALG_RSA - UINT32 rsa; -#endif -#if ALG_ECC - UINT32 ecc; -#endif -} CRYPTO_SELF_TEST_STATE; - - -#endif // _CRYPT_TEST_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/EccTestData.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/EccTestData.h deleted file mode 100644 index f5680a75c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/EccTestData.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// This file contains the parameter data for ECC testing. - -#ifdef SELF_TEST_DATA - -TPM2B_TYPE(EC_TEST, 32); -const TPM_ECC_CURVE c_testCurve = 00003; - -// The "static" key - -const TPM2B_EC_TEST c_ecTestKey_ds = {{32, { - 0xdf,0x8d,0xa4,0xa3,0x88,0xf6,0x76,0x96,0x89,0xfc,0x2f,0x2d,0xa1,0xb4,0x39,0x7a, - 0x78,0xc4,0x7f,0x71,0x8c,0xa6,0x91,0x85,0xc0,0xbf,0xf3,0x54,0x20,0x91,0x2f,0x73}}}; - -const TPM2B_EC_TEST c_ecTestKey_QsX = {{32, { - 0x17,0xad,0x2f,0xcb,0x18,0xd4,0xdb,0x3f,0x2c,0x53,0x13,0x82,0x42,0x97,0xff,0x8d, - 0x99,0x50,0x16,0x02,0x35,0xa7,0x06,0xae,0x1f,0xda,0xe2,0x9c,0x12,0x77,0xc0,0xf9}}}; - -const TPM2B_EC_TEST c_ecTestKey_QsY = {{32, { - 0xa6,0xca,0xf2,0x18,0x45,0x96,0x6e,0x58,0xe6,0x72,0x34,0x12,0x89,0xcd,0xaa,0xad, - 0xcb,0x68,0xb2,0x51,0xdc,0x5e,0xd1,0x6d,0x38,0x20,0x35,0x57,0xb2,0xfd,0xc7,0x52}}}; - -// The "ephemeral" key - -const TPM2B_EC_TEST c_ecTestKey_de = {{32, { - 0xb6,0xb5,0x33,0x5c,0xd1,0xee,0x52,0x07,0x99,0xea,0x2e,0x8f,0x8b,0x19,0x18,0x07, - 0xc1,0xf8,0xdf,0xdd,0xb8,0x77,0x00,0xc7,0xd6,0x53,0x21,0xed,0x02,0x53,0xee,0xac}}}; - -const TPM2B_EC_TEST c_ecTestKey_QeX = {{32, { - 0xa5,0x1e,0x80,0xd1,0x76,0x3e,0x8b,0x96,0xce,0xcc,0x21,0x82,0xc9,0xa2,0xa2,0xed, - 0x47,0x21,0x89,0x53,0x44,0xe9,0xc7,0x92,0xe7,0x31,0x48,0x38,0xe6,0xea,0x93,0x47}}}; - -const TPM2B_EC_TEST c_ecTestKey_QeY = {{32, { - 0x30,0xe6,0x4f,0x97,0x03,0xa1,0xcb,0x3b,0x32,0x2a,0x70,0x39,0x94,0xeb,0x4e,0xea, - 0x55,0x88,0x81,0x3f,0xb5,0x00,0xb8,0x54,0x25,0xab,0xd4,0xda,0xfd,0x53,0x7a,0x18}}}; - -// ECDH test results -const TPM2B_EC_TEST c_ecTestEcdh_X = {{32, { - 0x64,0x02,0x68,0x92,0x78,0xdb,0x33,0x52,0xed,0x3b,0xfa,0x3b,0x74,0xa3,0x3d,0x2c, - 0x2f,0x9c,0x59,0x03,0x07,0xf8,0x22,0x90,0xed,0xe3,0x45,0xf8,0x2a,0x0a,0xd8,0x1d}}}; - -const TPM2B_EC_TEST c_ecTestEcdh_Y = {{32, { - 0x58,0x94,0x05,0x82,0xbe,0x5f,0x33,0x02,0x25,0x90,0x3a,0x33,0x90,0x89,0xe3,0xe5, - 0x10,0x4a,0xbc,0x78,0xa5,0xc5,0x07,0x64,0xaf,0x91,0xbc,0xe6,0xff,0x85,0x11,0x40}}}; - -TPM2B_TYPE(TEST_VALUE, 64); -const TPM2B_TEST_VALUE c_ecTestValue = {{64, { - 0x78,0xd5,0xd4,0x56,0x43,0x61,0xdb,0x97,0xa4,0x32,0xc4,0x0b,0x06,0xa9,0xa8,0xa0, - 0xf4,0x45,0x7f,0x13,0xd8,0x13,0x81,0x0b,0xe5,0x76,0xbe,0xaa,0xb6,0x3f,0x8d,0x4d, - 0x23,0x65,0xcc,0xa7,0xc9,0x19,0x10,0xce,0x69,0xcb,0x0c,0xc7,0x11,0x8d,0xc3,0xff, - 0x62,0x69,0xa2,0xbe,0x46,0x90,0xe7,0x7d,0x81,0x77,0x94,0x65,0x1c,0x3e,0xc1,0x3e}}}; - -#if ALG_SHA1_VALUE == DEFAULT_TEST_HASH - -const TPM2B_EC_TEST c_TestEcDsa_r = {{32, { - 0x57,0xf3,0x36,0xb7,0xec,0xc2,0xdd,0x76,0x0e,0xe2,0x81,0x21,0x49,0xc5,0x66,0x11, - 0x4b,0x8a,0x4f,0x17,0x62,0x82,0xcc,0x06,0xf6,0x64,0x78,0xef,0x6b,0x7c,0xf2,0x6c}}}; -const TPM2B_EC_TEST c_TestEcDsa_s = {{32, { - 0x1b,0xed,0x23,0x72,0x8f,0x17,0x5f,0x47,0x2e,0xa7,0x97,0x2c,0x51,0x57,0x20,0x70, - 0x6f,0x89,0x74,0x8a,0xa8,0xf4,0x26,0xf4,0x96,0xa1,0xb8,0x3e,0xe5,0x35,0xc5,0x94}}}; - -const TPM2B_EC_TEST c_TestEcSchnorr_r = {{32,{ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x08,0x9f,0xde, - 0xef,0x62,0xe3,0xf1,0x14,0xcb,0x54,0x28,0x13,0x76,0xfc,0x6d,0x69,0x22,0xb5,0x3e}}}; -const TPM2B_EC_TEST c_TestEcSchnorr_s = {{32,{ - 0xd9,0xd3,0x20,0xfb,0x4d,0x16,0xf2,0xe6,0xe2,0x45,0x07,0x45,0x1c,0x92,0x92,0x92, - 0xa9,0x6b,0x48,0xf8,0xd1,0x98,0x29,0x4d,0xd3,0x8f,0x56,0xf2,0xbb,0x2e,0x22,0x3b}}}; - -#endif // SHA1 - -#if ALG_SHA256_VALUE == DEFAULT_TEST_HASH - -const TPM2B_EC_TEST c_TestEcDsa_r = {{32, { - 0x04,0x7d,0x54,0xeb,0x04,0x6f,0x56,0xec,0xa2,0x6c,0x38,0x8c,0xeb,0x43,0x0b,0x71, - 0xf8,0xf2,0xf4,0xa5,0xe0,0x1d,0x3c,0xa2,0x39,0x31,0xe4,0xe7,0x36,0x3b,0xb5,0x5f}}}; -const TPM2B_EC_TEST c_TestEcDsa_s = {{32, { - 0x8f,0xd0,0x12,0xd9,0x24,0x75,0xf6,0xc4,0x3b,0xb5,0x46,0x75,0x3a,0x41,0x8d,0x80, - 0x23,0x99,0x38,0xd7,0xe2,0x40,0xca,0x9a,0x19,0x2a,0xfc,0x54,0x75,0xd3,0x4a,0x6e}}}; - -const TPM2B_EC_TEST c_TestEcSchnorr_r = {{32, { - 0xf7,0xb9,0x15,0x4c,0x34,0xf6,0x41,0x19,0xa3,0xd2,0xf1,0xbd,0xf4,0x13,0x6a,0x4f, - 0x63,0xb8,0x4d,0xb5,0xc8,0xcd,0xde,0x85,0x95,0xa5,0x39,0x0a,0x14,0x49,0x3d,0x2f}}}; -const TPM2B_EC_TEST c_TestEcSchnorr_s = {{32,{ - 0xfe,0xbe,0x17,0xaa,0x31,0x22,0x9f,0xd0,0xd2,0xf5,0x25,0x04,0x92,0xb0,0xaa,0x4e, - 0xcc,0x1c,0xb6,0x79,0xd6,0x42,0xb3,0x4e,0x3f,0xbb,0xfe,0x5f,0xd0,0xd0,0x8b,0xc3}}}; - -#endif // SHA256 - -#if ALG_SHA384_VALUE == DEFAULT_TEST_HASH - -const TPM2B_EC_TEST c_TestEcDsa_r = {{32, { - 0xf5,0x74,0x6d,0xd6,0xc6,0x56,0x86,0xbb,0xba,0x1c,0xba,0x75,0x65,0xee,0x64,0x31, - 0xce,0x04,0xe3,0x9f,0x24,0x3f,0xbd,0xfe,0x04,0xcd,0xab,0x7e,0xfe,0xad,0xcb,0x82}}}; -const TPM2B_EC_TEST c_TestEcDsa_s = {{32, { - 0xc2,0x4f,0x32,0xa1,0x06,0xc0,0x85,0x4f,0xc6,0xd8,0x31,0x66,0x91,0x9f,0x79,0xcd, - 0x5b,0xe5,0x7b,0x94,0xa1,0x91,0x38,0xac,0xd4,0x20,0xa2,0x10,0xf0,0xd5,0x9d,0xbf}}}; - -const TPM2B_EC_TEST c_TestEcSchnorr_r = {{32, { - 0x1e,0xb8,0xe1,0xbf,0xa1,0x9e,0x39,0x1e,0x58,0xa2,0xe6,0x59,0xd0,0x1a,0x6a,0x03, - 0x6a,0x1f,0x1c,0x4f,0x36,0x19,0xc1,0xec,0x30,0xa4,0x85,0x1b,0xe9,0x74,0x35,0x66}}}; -const TPM2B_EC_TEST c_TestEcSchnorr_s = {{32,{ - 0xb9,0xe6,0xe3,0x7e,0xcb,0xb9,0xea,0xf1,0xcc,0xf4,0x48,0x44,0x4a,0xda,0xc8,0xd7, - 0x87,0xb4,0xba,0x40,0xfe,0x5b,0x68,0x11,0x14,0xcf,0xa0,0x0e,0x85,0x46,0x99,0x01}}}; - -#endif // SHA384 - -#if ALG_SHA512_VALUE == DEFAULT_TEST_HASH - -const TPM2B_EC_TEST c_TestEcDsa_r = {{32, { - 0xc9,0x71,0xa6,0xb4,0xaf,0x46,0x26,0x8c,0x27,0x00,0x06,0x3b,0x00,0x0f,0xa3,0x17, - 0x72,0x48,0x40,0x49,0x4d,0x51,0x4f,0xa4,0xcb,0x7e,0x86,0xe9,0xe7,0xb4,0x79,0xb2}}}; -const TPM2B_EC_TEST c_TestEcDsa_s = {{32,{ - 0x87,0xbc,0xc0,0xed,0x74,0x60,0x9e,0xfa,0x4e,0xe8,0x16,0xf3,0xf9,0x6b,0x26,0x07, - 0x3c,0x74,0x31,0x7e,0xf0,0x62,0x46,0xdc,0xd6,0x45,0x22,0x47,0x3e,0x0c,0xa0,0x02}}}; - -const TPM2B_EC_TEST c_TestEcSchnorr_r = {{32,{ - 0xcc,0x07,0xad,0x65,0x91,0xdd,0xa0,0x10,0x23,0xae,0x53,0xec,0xdf,0xf1,0x50,0x90, - 0x16,0x96,0xf4,0x45,0x09,0x73,0x9c,0x84,0xb5,0x5c,0x5f,0x08,0x51,0xcb,0x60,0x01}}}; -const TPM2B_EC_TEST c_TestEcSchnorr_s = {{32,{ - 0x55,0x20,0x21,0x54,0xe2,0x49,0x07,0x47,0x71,0xf4,0x99,0x15,0x54,0xf3,0xab,0x14, - 0xdb,0x8e,0xda,0x79,0xb6,0x02,0x0e,0xe3,0x5e,0x6f,0x2c,0xb6,0x05,0xbd,0x14,0x10}}}; - -#endif // SHA512 - -#endif // SELF_TEST_DATA diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Global.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Global.h deleted file mode 100644 index 09bf6fc41..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Global.h +++ /dev/null @@ -1,1439 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Description - -// This file contains internal global type definitions and data declarations that -// are need between subsystems. The instantiation of global data is in Global.c. -// The initialization of global data is in the subsystem that is the primary owner -// of the data. -// -// The first part of this file has the typedefs for structures and other defines -// used in many portions of the code. After the typedef section, is a section that -// defines global values that are only present in RAM. The next three sections -// define the structures for the NV data areas: persistent, orderly, and state -// save. Additional sections define the data that is used in specific modules. That -// data is private to the module but is collected here to simplify the management -// of the instance data. -// All the data is instanced in Global.c. -#if !defined _TPM_H_ -#error "Should only be instanced in TPM.h" -#endif - - -//** Includes - -#ifndef GLOBAL_H -#define GLOBAL_H - -#ifdef GLOBAL_C -#define EXTERN -#define INITIALIZER(_value_) = _value_ -#else -#define EXTERN extern -#define INITIALIZER(_value_) -#endif - -_REDUCE_WARNING_LEVEL_(2) -#include -#include -_NORMAL_WARNING_LEVEL_ - -#if SIMULATION -#undef CONTEXT_SLOT -# define CONTEXT_SLOT UINT8 -#endif -#include "Capabilities.h" -#include "TpmTypes.h" -#include "CommandAttributes.h" -#include "CryptTest.h" -#include "BnValues.h" -#include "CryptHash.h" -#include "CryptSym.h" -#include "CryptRand.h" -#include "CryptEcc.h" -#include "CryptRsa.h" -#include "CryptTest.h" -#include "TpmError.h" -#include "NV.h" - -//** Defines and Types - -//*** Size Types -// These types are used to differentiate the two different size values used. -// -// NUMBYTES is used when a size is a number of bytes (usually a TPM2B) -typedef UINT16 NUMBYTES; - -//*** Other Types -// An AUTH_VALUE is a BYTE array containing a digest (TPMU_HA) -typedef BYTE AUTH_VALUE[sizeof(TPMU_HA)]; - -// A TIME_INFO is a BYTE array that can contain a TPMS_TIME_INFO -typedef BYTE TIME_INFO[sizeof(TPMS_TIME_INFO)]; - -// A NAME is a BYTE array that can contain a TPMU_NAME -typedef BYTE NAME[sizeof(TPMU_NAME)]; - -// Definition for a PROOF value -TPM2B_TYPE(PROOF, PROOF_SIZE); - -// Definition for a Primary Seed value -TPM2B_TYPE(SEED, PRIMARY_SEED_SIZE); - - -// A CLOCK_NONCE is used to tag the time value in the authorization session and -// in the ticket computation so that the ticket expires when there is a time -// discontinuity. When the clock stops during normal operation, the nonce is -// 64-bit value kept in RAM but it is a 32-bit counter when the clock only stops -// during power events. -#if CLOCK_STOPS -typedef UINT64 CLOCK_NONCE; -#else -typedef UINT32 CLOCK_NONCE; -#endif - -//** Loaded Object Structures -//*** Description -// The structures in this section define the object layout as it exists in TPM -// memory. -// -// Two types of objects are defined: an ordinary object such as a key, and a -// sequence object that may be a hash, HMAC, or event. -// -//*** OBJECT_ATTRIBUTES -// An OBJECT_ATTRIBUTES structure contains the variable attributes of an object. -// These properties are not part of the public properties but are used by the -// TPM in managing the object. An OBJECT_ATTRIBUTES is used in the definition of -// the OBJECT data type. - -typedef struct -{ - unsigned publicOnly : 1; //0) SET if only the public portion of - // an object is loaded - unsigned epsHierarchy : 1; //1) SET if the object belongs to EPS - // Hierarchy - unsigned ppsHierarchy : 1; //2) SET if the object belongs to PPS - // Hierarchy - unsigned spsHierarchy : 1; //3) SET f the object belongs to SPS - // Hierarchy - unsigned evict : 1; //4) SET if the object is a platform or - // owner evict object. Platform- - // evict object belongs to PPS - // hierarchy, owner-evict object - // belongs to SPS or EPS hierarchy. - // This bit is also used to mark a - // completed sequence object so it - // will be flush when the - // SequenceComplete command succeeds. - unsigned primary : 1; //5) SET for a primary object - unsigned temporary : 1; //6) SET for a temporary object - unsigned stClear : 1; //7) SET for an stClear object - unsigned hmacSeq : 1; //8) SET for an HMAC or MAC sequence - // object - unsigned hashSeq : 1; //9) SET for a hash sequence object - unsigned eventSeq : 1; //10) SET for an event sequence object - unsigned ticketSafe : 1; //11) SET if a ticket is safe to create - // for hash sequence object - unsigned firstBlock : 1; //12) SET if the first block of hash - // data has been received. It - // works with ticketSafe bit - unsigned isParent : 1; //13) SET if the key has the proper - // attributes to be a parent key -// unsigned privateExp : 1; //14) SET when the private exponent -// // of an RSA key has been validated. - unsigned not_used_14 : 1; - unsigned occupied : 1; //15) SET when the slot is occupied. - unsigned derivation : 1; //16) SET when the key is a derivation - // parent - unsigned external : 1; //17) SET when the object is loaded with - // TPM2_LoadExternal(); -} OBJECT_ATTRIBUTES; - -#if ALG_RSA -// There is an overload of the sensitive.rsa.t.size field of a TPMT_SENSITIVE when an -// RSA key is loaded. When the sensitive->sensitive contains an RSA key with all of -// the CRT values, then the MSB of the size field will be set to indicate that the -// buffer contains all 5 of the CRT private key values. -#define RSA_prime_flag 0x8000 -#endif - - -//*** OBJECT Structure -// An OBJECT structure holds the object public, sensitive, and meta-data -// associated. This structure is implementation dependent. For this -// implementation, the structure is not optimized for space but rather -// for clarity of the reference implementation. Other implementations -// may choose to overlap portions of the structure that are not used -// simultaneously. These changes would necessitate changes to the source -// code but those changes would be compatible with the reference -// implementation. - -typedef struct OBJECT -{ - // The attributes field is required to be first followed by the publicArea. - // This allows the overlay of the object structure and a sequence structure - OBJECT_ATTRIBUTES attributes; // object attributes - TPMT_PUBLIC publicArea; // public area of an object - TPMT_SENSITIVE sensitive; // sensitive area of an object - TPM2B_NAME qualifiedName; // object qualified name - TPMI_DH_OBJECT evictHandle; // if the object is an evict object, - // the original handle is kept here. - // The 'working' handle will be the - // handle of an object slot. - TPM2B_NAME name; // Name of the object name. Kept here - // to avoid repeatedly computing it. -} OBJECT; - -//*** HASH_OBJECT Structure -// This structure holds a hash sequence object or an event sequence object. -// -// The first four components of this structure are manually set to be the same as -// the first four components of the object structure. This prevents the object -// from being inadvertently misused as sequence objects occupy the same memory as -// a regular object. A debug check is present to make sure that the offsets are -// what they are supposed to be. -// NOTE: In a future version, this will probably be renamed as SEQUENCE_OBJECT -typedef struct HASH_OBJECT -{ - OBJECT_ATTRIBUTES attributes; // The attributes of the HASH object - TPMI_ALG_PUBLIC type; // algorithm - TPMI_ALG_HASH nameAlg; // name algorithm - TPMA_OBJECT objectAttributes; // object attributes - - // The data below is unique to a sequence object - TPM2B_AUTH auth; // authorization for use of sequence - union - { - HASH_STATE hashState[HASH_COUNT]; - HMAC_STATE hmacState; - } state; -} HASH_OBJECT; - -typedef BYTE HASH_OBJECT_BUFFER[sizeof(HASH_OBJECT)]; - -//*** ANY_OBJECT -// This is the union for holding either a sequence object or a regular object. -// for ContextSave and ContextLoad -typedef union ANY_OBJECT -{ - OBJECT entity; - HASH_OBJECT hash; -} ANY_OBJECT; - -typedef BYTE ANY_OBJECT_BUFFER[sizeof(ANY_OBJECT)]; - -//**AUTH_DUP Types -// These values are used in the authorization processing. - -typedef UINT32 AUTH_ROLE; -#define AUTH_NONE ((AUTH_ROLE)(0)) -#define AUTH_USER ((AUTH_ROLE)(1)) -#define AUTH_ADMIN ((AUTH_ROLE)(2)) -#define AUTH_DUP ((AUTH_ROLE)(3)) - -//** Active Session Context -//*** Description -// The structures in this section define the internal structure of a session -// context. -// -//*** SESSION_ATTRIBUTES -// The attributes in the SESSION_ATTRIBUTES structure track the various properties -// of the session. It maintains most of the tracking state information for the -// policy session. It is used within the SESSION structure. - -typedef struct SESSION_ATTRIBUTES -{ - unsigned isPolicy : 1; //1) SET if the session may only be used - // for policy - unsigned isAudit : 1; //2) SET if the session is used for audit - unsigned isBound : 1; //3) SET if the session is bound to with an - // entity. This attribute will be CLEAR - // if either isPolicy or isAudit is SET. - unsigned isCpHashDefined : 1; //3) SET if the cpHash has been defined - // This attribute is not SET unless - // 'isPolicy' is SET. - unsigned isAuthValueNeeded : 1; //5) SET if the authValue is required for - // computing the session HMAC. This - // attribute is not SET unless 'isPolicy' - // is SET. - unsigned isPasswordNeeded : 1; //6) SET if a password authValue is required - // for authorization This attribute is not - // SET unless 'isPolicy' is SET. - unsigned isPPRequired : 1; //7) SET if physical presence is required to - // be asserted when the authorization is - // checked. This attribute is not SET - // unless 'isPolicy' is SET. - unsigned isTrialPolicy : 1; //8) SET if the policy session is created - // for trial of the policy's policyHash - // generation. This attribute is not SET - // unless 'isPolicy' is SET. - unsigned isDaBound : 1; //9) SET if the bind entity had noDA CLEAR. - // If this is SET, then an authorization - // failure using this session will count - // against lockout even if the object - // being authorized is exempt from DA. - unsigned isLockoutBound : 1; //10) SET if the session is bound to - // lockoutAuth. - unsigned includeAuth : 1; //11) This attribute is SET when the - // authValue of an object is to be - // included in the computation of the - // HMAC key for the command and response - // computations. (was 'requestWasBound') - unsigned checkNvWritten : 1; //12) SET if the TPMA_NV_WRITTEN attribute - // needs to be checked when the policy is - // used for authorization for NV access. - // If this is SET for any other type, the - // policy will fail. - unsigned nvWrittenState : 1; //13) SET if TPMA_NV_WRITTEN is required to - // be SET. Used when 'checkNvWritten' is - // SET - unsigned isTemplateSet : 1; //14) SET if the templateHash needs to be - // checked for Create, CreatePrimary, or - // CreateLoaded. -} SESSION_ATTRIBUTES; - -//*** SESSION Structure -// The SESSION structure contains all the context of a session except for the -// associated contextID. -// -// Note: The contextID of a session is only relevant when the session context -// is stored off the TPM. - -typedef struct SESSION -{ - SESSION_ATTRIBUTES attributes; // session attributes - UINT32 pcrCounter; // PCR counter value when PCR is - // included (policy session) - // If no PCR is included, this - // value is 0. - UINT64 startTime; // The value in g_time when the session - // was started (policy session) - UINT64 timeout; // The timeout relative to g_time - // There is no timeout if this value - // is 0. - CLOCK_NONCE epoch; // The g_clockEpoch value when the - // session was started. If g_clockEpoch - // does not match this value when the - // timeout is used, then - // then the command will fail. - TPM_CC commandCode; // command code (policy session) - TPM_ALG_ID authHashAlg; // session hash algorithm - TPMA_LOCALITY commandLocality; // command locality (policy session) - TPMT_SYM_DEF symmetric; // session symmetric algorithm (if any) - TPM2B_AUTH sessionKey; // session secret value used for - // this session - TPM2B_NONCE nonceTPM; // last TPM-generated nonce for - // generating HMAC and encryption keys - union - { - TPM2B_NAME boundEntity; // value used to track the entity to - // which the session is bound - - TPM2B_DIGEST cpHash; // the required cpHash value for the - // command being authorized - TPM2B_DIGEST nameHash; // the required nameHash - TPM2B_DIGEST templateHash; // the required template for creation - } u1; - - union - { - TPM2B_DIGEST auditDigest; // audit session digest - TPM2B_DIGEST policyDigest; // policyHash - } u2; // audit log and policyHash may - // share space to save memory -} SESSION; - -#define EXPIRES_ON_RESET INT32_MIN -#define TIMEOUT_ON_RESET UINT64_MAX -#define EXPIRES_ON_RESTART (INT32_MIN + 1) -#define TIMEOUT_ON_RESTART (UINT64_MAX - 1) - -typedef BYTE SESSION_BUF[sizeof(SESSION)]; - -//********************************************************************************* -//** PCR -//********************************************************************************* -//***PCR_SAVE Structure -// The PCR_SAVE structure type contains the PCR data that are saved across power -// cycles. Only the static PCR are required to be saved across power cycles. The -// DRTM and resettable PCR are not saved. The number of static and resettable PCR -// is determined by the platform-specific specification to which the TPM is built. - -typedef struct PCR_SAVE -{ -#if ALG_SHA1 - BYTE sha1[NUM_STATIC_PCR][SHA1_DIGEST_SIZE]; -#endif -#if ALG_SHA256 - BYTE sha256[NUM_STATIC_PCR][SHA256_DIGEST_SIZE]; -#endif -#if ALG_SHA384 - BYTE sha384[NUM_STATIC_PCR][SHA384_DIGEST_SIZE]; -#endif -#if ALG_SHA512 - BYTE sha512[NUM_STATIC_PCR][SHA512_DIGEST_SIZE]; -#endif -#if ALG_SM3_256 - BYTE sm3_256[NUM_STATIC_PCR][SM3_256_DIGEST_SIZE]; -#endif - - // This counter increments whenever the PCR are updated. - // NOTE: A platform-specific specification may designate - // certain PCR changes as not causing this counter - // to increment. - UINT32 pcrCounter; -} PCR_SAVE; - -//***PCR_POLICY -#if defined NUM_POLICY_PCR_GROUP && NUM_POLICY_PCR_GROUP > 0 -// This structure holds the PCR policies, one for each group of PCR controlled -// by policy. -typedef struct PCR_POLICY -{ - TPMI_ALG_HASH hashAlg[NUM_POLICY_PCR_GROUP]; - TPM2B_DIGEST a; - TPM2B_DIGEST policy[NUM_POLICY_PCR_GROUP]; -} PCR_POLICY; -#endif - -//***PCR_AUTHVALUE -// This structure holds the PCR policies, one for each group of PCR controlled -// by policy. -typedef struct PCR_AUTH_VALUE -{ - TPM2B_DIGEST auth[NUM_AUTHVALUE_PCR_GROUP]; -} PCR_AUTHVALUE; - - - -//**STARTUP_TYPE -// This enumeration is the possible startup types. The type is determined -// by the combination of TPM2_ShutDown and TPM2_Startup. -typedef enum -{ - SU_RESET, - SU_RESTART, - SU_RESUME -} STARTUP_TYPE; - -//**NV - -//***NV_INDEX -// The NV_INDEX structure defines the internal format for an NV index. -// The 'indexData' size varies according to the type of the index. -// In this implementation, all of the index is manipulated as a unit. -typedef struct NV_INDEX -{ - TPMS_NV_PUBLIC publicArea; - TPM2B_AUTH authValue; -} NV_INDEX; - -//*** NV_REF -// An NV_REF is an opaque value returned by the NV subsystem. It is used to -// reference and NV Index in a relatively efficient way. Rather than having to -// continually search for an Index, its reference value may be used. In this -// implementation, an NV_REF is a byte pointer that points to the copy of the -// NV memory that is kept in RAM. -typedef UINT32 NV_REF; - -typedef BYTE *NV_RAM_REF; -//***NV_PIN -// This structure deals with the possible endianess differences between the -// canonical form of the TPMS_NV_PIN_COUNTER_PARAMETERS structure and the internal -// value. The structures allow the data in a PIN index to be read as an 8-octet -// value using NvReadUINT64Data(). That function will byte swap all the values on a -// little endian system. This will put the bytes with the 4-octet values in the -// correct order but will swap the pinLimit and pinCount values. When written, the -// PIN index is simply handled as a normal index with the octets in canonical order. -#if BIG_ENDIAN_TPM -typedef struct -{ - UINT32 pinCount; - UINT32 pinLimit; -} PIN_DATA; -#else -typedef struct -{ - UINT32 pinLimit; - UINT32 pinCount; -} PIN_DATA; -#endif - -typedef union -{ - UINT64 intVal; - PIN_DATA pin; -} NV_PIN; - -//**COMMIT_INDEX_MASK -// This is the define for the mask value that is used when manipulating -// the bits in the commit bit array. The commit counter is a 64-bit -// value and the low order bits are used to index the commitArray. -// This mask value is applied to the commit counter to extract the -// bit number in the array. -#if ALG_ECC - -#define COMMIT_INDEX_MASK ((UINT16)((sizeof(gr.commitArray)*8)-1)) - -#endif - -//***************************************************************************** -//***************************************************************************** -//** RAM Global Values -//***************************************************************************** -//***************************************************************************** -//*** Description -// The values in this section are only extant in RAM or ROM as constant values. - -//*** Crypto Self-Test Values -EXTERN ALGORITHM_VECTOR g_implementedAlgorithms; -EXTERN ALGORITHM_VECTOR g_toTest; - -//*** g_rcIndex[] -// This array is used to contain the array of values that are added to a return -// code when it is a parameter-, handle-, or session-related error. -// This is an implementation choice and the same result can be achieved by using -// a macro. -#define g_rcIndexInitializer { TPM_RC_1, TPM_RC_2, TPM_RC_3, TPM_RC_4, \ - TPM_RC_5, TPM_RC_6, TPM_RC_7, TPM_RC_8, \ - TPM_RC_9, TPM_RC_A, TPM_RC_B, TPM_RC_C, \ - TPM_RC_D, TPM_RC_E, TPM_RC_F } -EXTERN const UINT16 g_rcIndex[15] INITIALIZER(g_rcIndexInitializer); - -//*** g_exclusiveAuditSession -// This location holds the session handle for the current exclusive audit -// session. If there is no exclusive audit session, the location is set to -// TPM_RH_UNASSIGNED. -EXTERN TPM_HANDLE g_exclusiveAuditSession; - -//*** g_time -// This is the value in which we keep the current command time. This is initialized -// at the start of each command. The time is the accumulated time since the last -// time that the TPM's timer was last powered up. Clock is the accumulated time -// since the last time that the TPM was cleared. g_time is in mS. -EXTERN UINT64 g_time; - -//*** g_timeEpoch -// This value contains the current clock Epoch. It changes when there is a clock -// discontinuity. It may be necessary to place this in NV should the timer be able -// to run across a power down of the TPM but not in all cases (e.g. dead battery). -// If the nonce is placed in NV, it should go in gp because it should be changing -// slowly. -#if CLOCK_STOPS -EXTERN CLOCK_NONCE g_timeEpoch; -#else -#define g_timeEpoch gp.timeEpoch -#endif - - -//*** g_phEnable -// This is the platform hierarchy control and determines if the platform hierarchy -// is available. This value is SET on each TPM2_Startup(). The default value is -// SET. -EXTERN BOOL g_phEnable; - -//*** g_pcrReConfig -// This value is SET if a TPM2_PCR_Allocate command successfully executed since -// the last TPM2_Startup(). If so, then the next shutdown is required to be -// Shutdown(CLEAR). -EXTERN BOOL g_pcrReConfig; - -//*** g_DRTMHandle -// This location indicates the sequence object handle that holds the DRTM -// sequence data. When not used, it is set to TPM_RH_UNASSIGNED. A sequence -// DRTM sequence is started on either _TPM_Init or _TPM_Hash_Start. -EXTERN TPMI_DH_OBJECT g_DRTMHandle; - -//*** g_DrtmPreStartup -// This value indicates that an H-CRTM occurred after _TPM_Init but before -// TPM2_Startup(). The define for PRE_STARTUP_FLAG is used to add the -// g_DrtmPreStartup value to gp_orderlyState at shutdown. This hack is to avoid -// adding another NV variable. -EXTERN BOOL g_DrtmPreStartup; - -//*** g_StartupLocality3 -// This value indicates that a TPM2_Startup() occurred at locality 3. Otherwise, it -// at locality 0. The define for STARTUP_LOCALITY_3 is to -// indicate that the startup was not at locality 0. This hack is to avoid -// adding another NV variable. -EXTERN BOOL g_StartupLocality3; - -//***TPM_SU_NONE -// Part 2 defines the two shutdown/startup types that may be used in -// TPM2_Shutdown() and TPM2_Starup(). This additional define is -// used by the TPM to indicate that no shutdown was received. -// NOTE: This is a reserved value. -#define SU_NONE_VALUE (0xFFFF) -#define TPM_SU_NONE (TPM_SU)(SU_NONE_VALUE) - -//*** TPM_SU_DA_USED -// As with TPM_SU_NONE, this value is added to allow indication that the shutdown -// was not orderly and that a DA=protected object was reference during the previous -// cycle. -#define SU_DA_USED_VALUE (SU_NONE_VALUE - 1) -#define TPM_SU_DA_USED (TPM_SU)(SU_DA_USED_VALUE) - - - -//*** Startup Flags -// These flags are included in gp.orderlyState. These are hacks and are being -// used to avoid having to change the layout of gp. The PRE_STARTUP_FLAG indicates -// that a _TPM_Hash_Start/_Data/_End sequence was received after _TPM_Init but -// before TPM2_StartUp(). STARTUP_LOCALITY_3 indicates that the last TPM2_Startup() -// was received at locality 3. These flags are only relevant if after a -// TPM2_Shutdown(STATE). -#define PRE_STARTUP_FLAG 0x8000 -#define STARTUP_LOCALITY_3 0x4000 - -#if USE_DA_USED -//*** g_daUsed -// This location indicates if a DA-protected value is accessed during a boot -// cycle. If none has, then there is no need to increment 'failedTries' on the -// next non-orderly startup. This bit is merged with gp.orderlyState when that -// gp.orderly is set to SU_NONE_VALUE -EXTERN BOOL g_daUsed; -#endif - -//*** g_updateNV -// This flag indicates if NV should be updated at the end of a command. -// This flag is set to UT_NONE at the beginning of each command in ExecuteCommand(). -// This flag is checked in ExecuteCommand() after the detailed actions of a command -// complete. If the command execution was successful and this flag is not UT_NONE, -// any pending NV writes will be committed to NV. -// UT_ORDERLY causes any RAM data to be written to the orderly space for staging -// the write to NV. -typedef BYTE UPDATE_TYPE; -#define UT_NONE (UPDATE_TYPE)0 -#define UT_NV (UPDATE_TYPE)1 -#define UT_ORDERLY (UPDATE_TYPE)(UT_NV + 2) -EXTERN UPDATE_TYPE g_updateNV; - -//*** g_powerWasLost -// This flag is used to indicate if the power was lost. It is SET in _TPM__Init. -// This flag is cleared by TPM2_Startup() after all power-lost activities are -// completed. -// Note: When power is applied, this value can come up as anything. However, -// _plat__WasPowerLost() will provide the proper indication in that case. So, when -// power is actually lost, we get the correct answer. When power was not lost, but -// the power-lost processing has not been completed before the next _TPM_Init(), -// then the TPM still does the correct thing. -EXTERN BOOL g_powerWasLost; - -//*** g_clearOrderly -// This flag indicates if the execution of a command should cause the orderly -// state to be cleared. This flag is set to FALSE at the beginning of each -// command in ExecuteCommand() and is checked in ExecuteCommand() after the -// detailed actions of a command complete but before the check of -// 'g_updateNV'. If this flag is TRUE, and the orderly state is not -// SU_NONE_VALUE, then the orderly state in NV memory will be changed to -// SU_NONE_VALUE or SU_DA_USED_VALUE. -EXTERN BOOL g_clearOrderly; - -//*** g_prevOrderlyState -// This location indicates how the TPM was shut down before the most recent -// TPM2_Startup(). This value, along with the startup type, determines if -// the TPM should do a TPM Reset, TPM Restart, or TPM Resume. -EXTERN TPM_SU g_prevOrderlyState; - -//*** g_nvOk -// This value indicates if the NV integrity check was successful or not. If not and -// the failure was severe, then the TPM would have been put into failure mode after -// it had been re-manufactured. If the NV failure was in the area where the state-save -// data is kept, then this variable will have a value of FALSE indicating that -// a TPM2_Startup(CLEAR) is required. -EXTERN BOOL g_nvOk; -// NV availability is sampled as the start of each command and stored here -// so that its value remains consistent during the command execution -EXTERN TPM_RC g_NvStatus; - -#ifdef VENDOR_PERMANENT -//*** g_platformUnique -// This location contains the unique value(s) used to identify the TPM. It is -// loaded on every _TPM2_Startup() -// The first value is used to seed the RNG. The second value is used as a vendor -// authValue. The value used by the RNG would be the value derived from the -// chip unique value (such as fused) with a dependency on the authorities of the -// code in the TPM boot path. The second would be derived from the chip unique value -// with a dependency on the details of the code in the boot path. That is, the -// first value depends on the various signers of the code and the second depends on -// what was signed. The TPM vendor should not be able to know the first value but -// they are expected to know the second. -EXTERN TPM2B_AUTH g_platformUniqueAuthorities; // Reserved for RNG - -EXTERN TPM2B_AUTH g_platformUniqueDetails; // referenced by VENDOR_PERMANENT -#endif - -//********************************************************************************* -//********************************************************************************* -//** Persistent Global Values -//********************************************************************************* -//********************************************************************************* -//*** Description -// The values in this section are global values that are persistent across power -// events. The lifetime of the values determines the structure in which the value -// is placed. - -//********************************************************************************* -//*** PERSISTENT_DATA -//********************************************************************************* -// This structure holds the persistent values that only change as a consequence -// of a specific Protected Capability and are not affected by TPM power events -// (TPM2_Startup() or TPM2_Shutdown(). -typedef struct -{ -//********************************************************************************* -// Hierarchy -//********************************************************************************* -// The values in this section are related to the hierarchies. - - BOOL disableClear; // TRUE if TPM2_Clear() using - // lockoutAuth is disabled - - // Hierarchy authPolicies - TPMI_ALG_HASH ownerAlg; - TPMI_ALG_HASH endorsementAlg; - TPMI_ALG_HASH lockoutAlg; - TPM2B_DIGEST ownerPolicy; - TPM2B_DIGEST endorsementPolicy; - TPM2B_DIGEST lockoutPolicy; - - // Hierarchy authValues - TPM2B_AUTH ownerAuth; - TPM2B_AUTH endorsementAuth; - TPM2B_AUTH lockoutAuth; - - // Primary Seeds - TPM2B_SEED EPSeed; - TPM2B_SEED SPSeed; - TPM2B_SEED PPSeed; - // Note there is a nullSeed in the state_reset memory. - - // Hierarchy proofs - TPM2B_PROOF phProof; - TPM2B_PROOF shProof; - TPM2B_PROOF ehProof; - // Note there is a nullProof in the state_reset memory. - -//********************************************************************************* -// Reset Events -//********************************************************************************* -// A count that increments at each TPM reset and never get reset during the life -// time of TPM. The value of this counter is initialized to 1 during TPM -// manufacture process. It is used to invalidate all saved contexts after a TPM -// Reset. - UINT64 totalResetCount; - -// This counter increments on each TPM Reset. The counter is reset by -// TPM2_Clear(). - UINT32 resetCount; - -//********************************************************************************* -// PCR -//********************************************************************************* -// This structure hold the policies for those PCR that have an update policy. -// This implementation only supports a single group of PCR controlled by -// policy. If more are required, then this structure would be changed to -// an array. -#if defined NUM_POLICY_PCR_GROUP && NUM_POLICY_PCR_GROUP > 0 - PCR_POLICY pcrPolicies; -#endif - -// This structure indicates the allocation of PCR. The structure contains a -// list of PCR allocations for each implemented algorithm. If no PCR are -// allocated for an algorithm, a list entry still exists but the bit map -// will contain no SET bits. - TPML_PCR_SELECTION pcrAllocated; - -//********************************************************************************* -// Physical Presence -//********************************************************************************* -// The PP_LIST type contains a bit map of the commands that require physical -// to be asserted when the authorization is evaluated. Physical presence will be -// checked if the corresponding bit in the array is SET and if the authorization -// handle is TPM_RH_PLATFORM. -// -// These bits may be changed with TPM2_PP_Commands(). - BYTE ppList[(COMMAND_COUNT + 7) / 8]; - -//********************************************************************************* -// Dictionary attack values -//********************************************************************************* -// These values are used for dictionary attack tracking and control. - UINT32 failedTries; // the current count of unexpired - // authorization failures - - UINT32 maxTries; // number of unexpired authorization - // failures before the TPM is in - // lockout - - UINT32 recoveryTime; // time between authorization failures - // before failedTries is decremented - - UINT32 lockoutRecovery; // time that must expire between - // authorization failures associated - // with lockoutAuth - - BOOL lockOutAuthEnabled; // TRUE if use of lockoutAuth is - // allowed - -//***************************************************************************** -// Orderly State -//***************************************************************************** -// The orderly state for current cycle - TPM_SU orderlyState; - -//***************************************************************************** -// Command audit values. -//***************************************************************************** - BYTE auditCommands[((COMMAND_COUNT + 1) + 7) / 8]; - TPMI_ALG_HASH auditHashAlg; - UINT64 auditCounter; - -//***************************************************************************** -// Algorithm selection -//***************************************************************************** -// -// The 'algorithmSet' value indicates the collection of algorithms that are -// currently in used on the TPM. The interpretation of value is vendor dependent. - UINT32 algorithmSet; - -//***************************************************************************** -// Firmware version -//***************************************************************************** -// The firmwareV1 and firmwareV2 values are instanced in TimeStamp.c. This is -// a scheme used in development to allow determination of the linker build time -// of the TPM. An actual implementation would implement these values in a way that -// is consistent with vendor needs. The values are maintained in RAM for simplified -// access with a master version in NV. These values are modified in a -// vendor-specific way. - -// g_firmwareV1 contains the more significant 32-bits of the vendor version number. -// In the reference implementation, if this value is printed as a hex -// value, it will have the format of YYYYMMDD - UINT32 firmwareV1; - -// g_firmwareV1 contains the less significant 32-bits of the vendor version number. -// In the reference implementation, if this value is printed as a hex -// value, it will have the format of 00 HH MM SS - UINT32 firmwareV2; -//***************************************************************************** -// Timer Epoch -//***************************************************************************** -// timeEpoch contains a nonce that has a vendor=specific size (should not be -// less than 8 bytes. This nonce changes when the clock epoch changes. The clock -// epoch changes when there is a discontinuity in the timing of the TPM. -#if !CLOCK_STOPS - CLOCK_NONCE timeEpoch; -#endif - -} PERSISTENT_DATA; - -EXTERN PERSISTENT_DATA gp; - -//********************************************************************************* -//********************************************************************************* -//*** ORDERLY_DATA -//********************************************************************************* -//********************************************************************************* -// The data in this structure is saved to NV on each TPM2_Shutdown(). -typedef struct orderly_data -{ -//***************************************************************************** -// TIME -//***************************************************************************** - -// Clock has two parts. One is the state save part and one is the NV part. The -// state save version is updated on each command. When the clock rolls over, the -// NV version is updated. When the TPM starts up, if the TPM was shutdown in and -// orderly way, then the sClock value is used to initialize the clock. If the -// TPM shutdown was not orderly, then the persistent value is used and the safe -// attribute is clear. - - UINT64 clock; // The orderly version of clock - TPMI_YES_NO clockSafe; // Indicates if the clock value is - // safe. - - // In many implementations, the quality of the entropy available is not that - // high. To compensate, the current value of the drbgState can be saved and - // restored on each power cycle. This prevents the internal state from reverting - // to the initial state on each power cycle and starting with a limited amount - // of entropy. By keeping the old state and adding entropy, the entropy will - // accumulate. - DRBG_STATE drbgState; - -// These values allow the accumulation of self-healing time across orderly shutdown -// of the TPM. -#if ACCUMULATE_SELF_HEAL_TIMER - UINT64 selfHealTimer; // current value of s_selfHealTimer - UINT64 lockoutTimer; // current value of s_lockoutTimer - UINT64 time; // current value of g_time at shutdown -#endif // ACCUMULATE_SELF_HEAL_TIMER - -} ORDERLY_DATA; - -#if ACCUMULATE_SELF_HEAL_TIMER -#define s_selfHealTimer go.selfHealTimer -#define s_lockoutTimer go.lockoutTimer -#endif // ACCUMULATE_SELF_HEAL_TIMER - -# define drbgDefault go.drbgState - -EXTERN ORDERLY_DATA go; - -//********************************************************************************* -//********************************************************************************* -//*** STATE_CLEAR_DATA -//********************************************************************************* -//********************************************************************************* -// This structure contains the data that is saved on Shutdown(STATE) -// and restored on Startup(STATE). The values are set to their default -// settings on any Startup(Clear). In other words, the data is only persistent -// across TPM Resume. -// -// If the comments associated with a parameter indicate a default reset value, the -// value is applied on each Startup(CLEAR). - -typedef struct state_clear_data -{ -//***************************************************************************** -// Hierarchy Control -//***************************************************************************** - BOOL shEnable; // default reset is SET - BOOL ehEnable; // default reset is SET - BOOL phEnableNV; // default reset is SET - TPMI_ALG_HASH platformAlg; // default reset is TPM_ALG_NULL - TPM2B_DIGEST platformPolicy; // default reset is an Empty Buffer - TPM2B_AUTH platformAuth; // default reset is an Empty Buffer - -//***************************************************************************** -// PCR -//***************************************************************************** -// The set of PCR to be saved on Shutdown(STATE) - PCR_SAVE pcrSave; // default reset is 0...0 - -// This structure hold the authorization values for those PCR that have an -// update authorization. -// This implementation only supports a single group of PCR controlled by -// authorization. If more are required, then this structure would be changed to -// an array. - PCR_AUTHVALUE pcrAuthValues; -} STATE_CLEAR_DATA; - -EXTERN STATE_CLEAR_DATA gc; - -//********************************************************************************* -//********************************************************************************* -//*** State Reset Data -//********************************************************************************* -//********************************************************************************* -// This structure contains data is that is saved on Shutdown(STATE) and restored on -// the subsequent Startup(ANY). That is, the data is preserved across TPM Resume -// and TPM Restart. -// -// If a default value is specified in the comments this value is applied on -// TPM Reset. - -typedef struct state_reset_data -{ -//***************************************************************************** -// Hierarchy Control -//***************************************************************************** - TPM2B_PROOF nullProof; // The proof value associated with - // the TPM_RH_NULL hierarchy. The - // default reset value is from the RNG. - - TPM2B_SEED nullSeed; // The seed value for the TPM_RN_NULL - // hierarchy. The default reset value - // is from the RNG. - -//***************************************************************************** -// Context -//***************************************************************************** -// The 'clearCount' counter is incremented each time the TPM successfully executes -// a TPM Resume. The counter is included in each saved context that has 'stClear' -// SET (including descendants of keys that have 'stClear' SET). This prevents these -// objects from being loaded after a TPM Resume. -// If 'clearCount' is at its maximum value when the TPM receives a Shutdown(STATE), -// the TPM will return TPM_RC_RANGE and the TPM will only accept Shutdown(CLEAR). - UINT32 clearCount; // The default reset value is 0. - - UINT64 objectContextID; // This is the context ID for a saved - // object context. The default reset - // value is 0. -#ifndef NDEBUG -#undef CONTEXT_SLOT -#define CONTEXT_SLOT BYTE -#endif - - CONTEXT_SLOT contextArray[MAX_ACTIVE_SESSIONS]; // This array contains - // contains the values used to track - // the version numbers of saved - // contexts (see - // Session.c in for details). The - // default reset value is {0}. - - CONTEXT_COUNTER contextCounter; // This is the value from which the - // 'contextID' is derived. The - // default reset value is {0}. - -//***************************************************************************** -// Command Audit -//***************************************************************************** -// When an audited command completes, ExecuteCommand() checks the return -// value. If it is TPM_RC_SUCCESS, and the command is an audited command, the -// TPM will extend the cpHash and rpHash for the command to this value. If this -// digest was the Zero Digest before the cpHash was extended, the audit counter -// is incremented. - - TPM2B_DIGEST commandAuditDigest; // This value is set to an Empty Digest - // by TPM2_GetCommandAuditDigest() or a - // TPM Reset. - -//***************************************************************************** -// Boot counter -//***************************************************************************** - - UINT32 restartCount; // This counter counts TPM Restarts. - // The default reset value is 0. - -//********************************************************************************* -// PCR -//********************************************************************************* -// This counter increments whenever the PCR are updated. This counter is preserved -// across TPM Resume even though the PCR are not preserved. This is because -// sessions remain active across TPM Restart and the count value in the session -// is compared to this counter so this counter must have values that are unique -// as long as the sessions are active. -// NOTE: A platform-specific specification may designate that certain PCR changes -// do not increment this counter to increment. - UINT32 pcrCounter; // The default reset value is 0. - -#if ALG_ECC - -//***************************************************************************** -// ECDAA -//***************************************************************************** - UINT64 commitCounter; // This counter increments each time - // TPM2_Commit() returns - // TPM_RC_SUCCESS. The default reset - // value is 0. - - TPM2B_NONCE commitNonce; // This random value is used to compute - // the commit values. The default reset - // value is from the RNG. - -// This implementation relies on the number of bits in g_commitArray being a -// power of 2 (8, 16, 32, 64, etc.) and no greater than 64K. - BYTE commitArray[16]; // The default reset value is {0}. - -#endif // ALG_ECC -} STATE_RESET_DATA; - -EXTERN STATE_RESET_DATA gr; - -//** NV Layout -// The NV data organization is -// 1) a PERSISTENT_DATA structure -// 2) a STATE_RESET_DATA structure -// 3) a STATE_CLEAR_DATA structure -// 4) an ORDERLY_DATA structure -// 5) the user defined NV index space -#define NV_PERSISTENT_DATA (0) -#define NV_STATE_RESET_DATA (NV_PERSISTENT_DATA + sizeof(PERSISTENT_DATA)) -#define NV_STATE_CLEAR_DATA (NV_STATE_RESET_DATA + sizeof(STATE_RESET_DATA)) -#define NV_ORDERLY_DATA (NV_STATE_CLEAR_DATA + sizeof(STATE_CLEAR_DATA)) -#define NV_INDEX_RAM_DATA (NV_ORDERLY_DATA + sizeof(ORDERLY_DATA)) -#define NV_USER_DYNAMIC (NV_INDEX_RAM_DATA + sizeof(s_indexOrderlyRam)) -#define NV_USER_DYNAMIC_END NV_MEMORY_SIZE - -//** Global Macro Definitions -// The NV_READ_PERSISTENT and NV_WRITE_PERSISTENT macros are used to access members -// of the PERSISTENT_DATA structure in NV. -#define NV_READ_PERSISTENT(to, from) \ - NvRead(&to, offsetof(PERSISTENT_DATA, from), sizeof(to)) - -#define NV_WRITE_PERSISTENT(to, from) \ - NvWrite(offsetof(PERSISTENT_DATA, to), sizeof(gp.to), &from) - -#define CLEAR_PERSISTENT(item) \ - NvClearPersistent(offsetof(PERSISTENT_DATA, item), sizeof(gp.item)) - -#define NV_SYNC_PERSISTENT(item) NV_WRITE_PERSISTENT(item, gp.item) - -// At the start of command processing, the index of the command is determined. This -// index value is used to access the various data tables that contain per-command -// information. There are multiple options for how the per-command tables can be -// implemented. This is resolved in GetClosestCommandIndex(). -typedef UINT16 COMMAND_INDEX; -#define UNIMPLEMENTED_COMMAND_INDEX ((COMMAND_INDEX)(~0)) - -typedef struct _COMMAND_FLAGS_ -{ - unsigned trialPolicy : 1; //1) If SET, one of the handles references a - // trial policy and authorization may be - // skipped. This is only allowed for a policy - // command. -} COMMAND_FLAGS; - -// This structure is used to avoid having to manage a large number of -// parameters being passed through various levels of the command input processing. -// -typedef struct _COMMAND_ -{ - TPM_ST tag; // the parsed command tag - TPM_CC code; // the parsed command code - COMMAND_INDEX index; // the computed command index - UINT32 handleNum; // the number of entity handles in the - // handle area of the command - TPM_HANDLE handles[MAX_HANDLE_NUM]; // the parsed handle values - UINT32 sessionNum; // the number of sessions found - INT32 parameterSize; // starts out with the parsed command size - // and is reduced and values are - // unmarshaled. Just before calling the - // command actions, this should be zero. - // After the command actions, this number - // should grow as values are marshaled - // in to the response buffer. - INT32 authSize; // this is initialized with the parsed size - // of authorizationSize field and should - // be zero when the authorizations are - // parsed. - BYTE *parameterBuffer; // input to ExecuteCommand - BYTE *responseBuffer; // input to ExecuteCommand -#if ALG_SHA1 - TPM2B_SHA1_DIGEST sha1CpHash; - TPM2B_SHA1_DIGEST sha1RpHash; -#endif -#if ALG_SHA256 - TPM2B_SHA256_DIGEST sha256CpHash; - TPM2B_SHA256_DIGEST sha256RpHash; -#endif -#if ALG_SHA384 - TPM2B_SHA384_DIGEST sha384CpHash; - TPM2B_SHA384_DIGEST sha384RpHash; -#endif -#if ALG_SHA512 - TPM2B_SHA512_DIGEST sha512CpHash; - TPM2B_SHA512_DIGEST sha512RpHash; -#endif -#if ALG_SM3_256 - TPM2B_SM3_256_DIGEST sm3_256CpHash; - TPM2B_SM3_256_DIGEST sm3_256RpHash; -#endif -} COMMAND; - -// Global sting constants for consistency in KDF function calls. -// These string constants are shared across functions to make sure that they -// are all using consistent sting values. - -#define STRING_INITIALIZER(value) {{sizeof(value), {value}}} -#define TPM2B_STRING(name, value) \ -typedef union name##_ { \ - struct { \ - UINT16 size; \ - BYTE buffer[sizeof(value)]; \ - } t; \ - TPM2B b; \ - } TPM2B_##name##_; \ -EXTERN const TPM2B_##name##_ name##_ INITIALIZER(STRING_INITIALIZER(value)); \ -EXTERN const TPM2B *name INITIALIZER(&name##_.b) - -TPM2B_STRING(PRIMARY_OBJECT_CREATION, "Primary Object Creation"); -TPM2B_STRING(CFB_KEY, "CFB"); -TPM2B_STRING(CONTEXT_KEY, "CONTEXT"); -TPM2B_STRING(INTEGRITY_KEY, "INTEGRITY"); -TPM2B_STRING(SECRET_KEY, "SECRET"); -TPM2B_STRING(SESSION_KEY, "ATH"); -TPM2B_STRING(STORAGE_KEY, "STORAGE"); -TPM2B_STRING(XOR_KEY, "XOR"); -TPM2B_STRING(COMMIT_STRING, "ECDAA Commit"); -TPM2B_STRING(DUPLICATE_STRING, "DUPLICATE"); -TPM2B_STRING(IDENTITY_STRING, "IDENTITY"); -TPM2B_STRING(OBFUSCATE_STRING, "OBFUSCATE"); -#if SELF_TEST -TPM2B_STRING(OAEP_TEST_STRING, "OAEP Test Value"); -#endif // SELF_TEST - -//***************************************************************************** -//** From CryptTest.c -//***************************************************************************** -// This structure contains the self-test state values for the cryptographic modules. -EXTERN CRYPTO_SELF_TEST_STATE g_cryptoSelfTestState; - -//***************************************************************************** -//** From Manufacture.c -//***************************************************************************** -EXTERN BOOL g_manufactured INITIALIZER(FALSE); - -// This value indicates if a TPM2_Startup commands has been -// receive since the power on event. This flag is maintained in power -// simulation module because this is the only place that may reliably set this -// flag to FALSE. -EXTERN BOOL g_initialized; - -//** Private data - -//***************************************************************************** -//*** From SessionProcess.c -//***************************************************************************** -#if defined SESSION_PROCESS_C || defined GLOBAL_C || defined MANUFACTURE_C -// The following arrays are used to save command sessions information so that the -// command handle/session buffer does not have to be preserved for the duration of -// the command. These arrays are indexed by the session index in accordance with -// the order of sessions in the session area of the command. -// -// Array of the authorization session handles -EXTERN TPM_HANDLE s_sessionHandles[MAX_SESSION_NUM]; - -// Array of authorization session attributes -EXTERN TPMA_SESSION s_attributes[MAX_SESSION_NUM]; - -// Array of handles authorized by the corresponding authorization sessions; -// and if none, then TPM_RH_UNASSIGNED value is used -EXTERN TPM_HANDLE s_associatedHandles[MAX_SESSION_NUM]; - -// Array of nonces provided by the caller for the corresponding sessions -EXTERN TPM2B_NONCE s_nonceCaller[MAX_SESSION_NUM]; - -// Array of authorization values (HMAC's or passwords) for the corresponding -// sessions -EXTERN TPM2B_AUTH s_inputAuthValues[MAX_SESSION_NUM]; - -// Array of pointers to the SESSION structures for the sessions in a command -EXTERN SESSION *s_usedSessions[MAX_SESSION_NUM]; - -// Special value to indicate an undefined session index -#define UNDEFINED_INDEX (0xFFFF) - -// Index of the session used for encryption of a response parameter -EXTERN UINT32 s_encryptSessionIndex; - -// Index of the session used for decryption of a command parameter -EXTERN UINT32 s_decryptSessionIndex; - -// Index of a session used for audit -EXTERN UINT32 s_auditSessionIndex; - -// The cpHash for command audit -#ifdef TPM_CC_GetCommandAuditDigest -EXTERN TPM2B_DIGEST s_cpHashForCommandAudit; -#endif - -// Flag indicating if NV update is pending for the lockOutAuthEnabled or -// failedTries DA parameter -EXTERN BOOL s_DAPendingOnNV; - -#endif // SESSION_PROCESS_C - -//***************************************************************************** -//*** From DA.c -//***************************************************************************** -#if defined DA_C || defined GLOBAL_C || defined MANUFACTURE_C -// This variable holds the accumulated time since the last time -// that 'failedTries' was decremented. This value is in millisecond. -#if !ACCUMULATE_SELF_HEAL_TIMER -EXTERN UINT64 s_selfHealTimer; - -// This variable holds the accumulated time that the lockoutAuth has been -// blocked. -EXTERN UINT64 s_lockoutTimer; -#endif // ACCUMULATE_SELF_HEAL_TIMER - -#endif // DA_C - -//***************************************************************************** -//*** From NV.c -//***************************************************************************** -#if defined NV_C || defined GLOBAL_C -// This marks the end of the NV area. This is a run-time variable as it might -// not be compile-time constant. -EXTERN NV_REF s_evictNvEnd; - -// This space is used to hold the index data for an orderly Index. It also contains -// the attributes for the index. -EXTERN BYTE s_indexOrderlyRam[RAM_INDEX_SPACE]; // The orderly NV Index data - -// This value contains the current max counter value. It is written to the end of -// allocatable NV space each time an index is deleted or added. This value is -// initialized on Startup. The indices are searched and the maximum of all the -// current counter indices and this value is the initial value for this. -EXTERN UINT64 s_maxCounter; - -// This is space used for the NV Index cache. As with a persistent object, the -// contents of a referenced index are copied into the cache so that the -// NV Index memory scanning and data copying can be reduced. -// Only code that operates on NV Index data should use this cache directly. When -// that action code runs, s_lastNvIndex will contain the index header information. -// It will have been loaded when the handles were verified. -// NOTE: An NV index handle can appear in many commands that do not operate on the -// NV data (e.g. TPM2_StartAuthSession). However, only one NV Index at a time is -// ever directly referenced by any command. If that changes, then the NV Index -// caching needs to be changed to accommodate that. Currently, the code will verify -// that only one NV Index is referenced by the handles of the command. -EXTERN NV_INDEX s_cachedNvIndex; -EXTERN NV_REF s_cachedNvRef; -EXTERN BYTE *s_cachedNvRamRef; - -// Initial NV Index/evict object iterator value -#define NV_REF_INIT (NV_REF)0xFFFFFFFF - -#endif - -//***************************************************************************** -//*** From Object.c -//***************************************************************************** -#if defined OBJECT_C || defined GLOBAL_C -// This type is the container for an object. - -EXTERN OBJECT s_objects[MAX_LOADED_OBJECTS]; - -#endif // OBJECT_C - -//***************************************************************************** -//*** From PCR.c -//***************************************************************************** -#if defined PCR_C || defined GLOBAL_C -typedef struct -{ -#if ALG_SHA1 - // SHA1 PCR - BYTE sha1Pcr[SHA1_DIGEST_SIZE]; -#endif -#if ALG_SHA256 - // SHA256 PCR - BYTE sha256Pcr[SHA256_DIGEST_SIZE]; -#endif -#if ALG_SHA384 - // SHA384 PCR - BYTE sha384Pcr[SHA384_DIGEST_SIZE]; -#endif -#if ALG_SHA512 - // SHA512 PCR - BYTE sha512Pcr[SHA512_DIGEST_SIZE]; -#endif -#if ALG_SM3_256 - // SHA256 PCR - BYTE sm3_256Pcr[SM3_256_DIGEST_SIZE]; -#endif -} PCR; - -typedef struct -{ - unsigned int stateSave : 1; // if the PCR value should be - // saved in state save - unsigned int resetLocality : 5; // The locality that the PCR - // can be reset - unsigned int extendLocality : 5; // The locality that the PCR - // can be extend -} PCR_Attributes; - -EXTERN PCR s_pcrs[IMPLEMENTATION_PCR]; - -#endif // PCR_C - -//***************************************************************************** -//*** From Session.c -//***************************************************************************** -#if defined SESSION_C || defined GLOBAL_C -// Container for HMAC or policy session tracking information -typedef struct -{ - BOOL occupied; - SESSION session; // session structure -} SESSION_SLOT; - -EXTERN SESSION_SLOT s_sessions[MAX_LOADED_SESSIONS]; - -// The index in contextArray that has the value of the oldest saved session -// context. When no context is saved, this will have a value that is greater -// than or equal to MAX_ACTIVE_SESSIONS. -EXTERN UINT32 s_oldestSavedSession; - -// The number of available session slot openings. When this is 1, -// a session can't be created or loaded if the GAP is maxed out. -// The exception is that the oldest saved session context can always -// be loaded (assuming that there is a space in memory to put it) -EXTERN int s_freeSessionSlots; - -#endif // SESSION_C - -//***************************************************************************** -//*** From IoBuffers.c -//***************************************************************************** -#if defined IO_BUFFER_C || defined GLOBAL_C -// Each command function is allowed a structure for the inputs to the function and -// a structure for the outputs. The command dispatch code unmarshals the input butter -// to the command action input structure starting at the first byte of -// s_actionIoBuffer. The value of s_actionIoAllocation is the number of UINT64 values -// allocated. It is used to set the pointer for the response structure. The command -// dispatch code will marshal the response values into the final output buffer. -EXTERN UINT64 s_actionIoBuffer[768]; // action I/O buffer -EXTERN UINT32 s_actionIoAllocation; // number of UIN64 allocated for the - // action input structure -#endif // IO_BUFFER_C - -//***************************************************************************** -//*** From TPMFail.c -//***************************************************************************** -// This value holds the address of the string containing the name of the function -// in which the failure occurred. This address value isn't useful for anything -// other than helping the vendor to know in which file the failure occurred. -EXTERN BOOL g_inFailureMode; // Indicates that the TPM is in failure mode -#if SIMULATION -EXTERN BOOL g_forceFailureMode; // flag to force failure mode during test -#endif - -typedef void(FailFunction)(const char *function, int line, int code); - -#if defined TPM_FAIL_C || defined GLOBAL_C -EXTERN UINT32 s_failFunction; -EXTERN UINT32 s_failLine; // the line in the file at which - // the error was signaled -EXTERN UINT32 s_failCode; // the error code used - -EXTERN FailFunction *LibFailCallback; - -#endif // TPM_FAIL_C - -//***************************************************************************** -//*** From CommandCodeAttributes.c -//***************************************************************************** -// This array is instanced in CommandCodeAttributes.c when it includes -// CommandCodeAttributes.h. Don't change the extern to EXTERN. -extern const TPMA_CC s_ccAttr[]; -extern const COMMAND_ATTRIBUTES s_commandAttributes[]; - -#endif // GLOBAL_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/GpMacros.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/GpMacros.h deleted file mode 100644 index 22f1b5a7e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/GpMacros.h +++ /dev/null @@ -1,332 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file is a collection of miscellaneous macros. - -#ifndef GP_MACROS_H -#define GP_MACROS_H - -#ifndef NULL -#define NULL 0 -#endif - -#include "swap.h" -#include "VendorString.h" - - -//** For Self-test -// These macros are used in CryptUtil to invoke the incremental self test. -#if SELF_TEST -# define TEST(alg) if(TEST_BIT(alg, g_toTest)) CryptTestAlgorithm(alg, NULL) - -// Use of TPM_ALG_NULL is reserved for RSAEP/RSADP testing. If someone is wanting -// to test a hash with that value, don't do it. -# define TEST_HASH(alg) \ - if(TEST_BIT(alg, g_toTest) \ - && (alg != ALG_NULL_VALUE)) \ - CryptTestAlgorithm(alg, NULL) -#else -# define TEST(alg) -# define TEST_HASH(alg) -#endif // SELF_TEST - -//** For Failures -#if defined _POSIX_ -# define FUNCTION_NAME 0 -#else -# define FUNCTION_NAME __FUNCTION__ -#endif - -#if !FAIL_TRACE -# define FAIL(errorCode) (TpmFail(errorCode)) -# define LOG_FAILURE(errorCode) (TpmLogFailure(errorCode)) -#else -# define FAIL(errorCode) TpmFail(FUNCTION_NAME, __LINE__, errorCode) -# define LOG_FAILURE(errorCode) TpmLogFailure(FUNCTION_NAME, __LINE__, errorCode) -#endif - -// If implementation is using longjmp, then the call to TpmFail() does not return -// and the compiler will complain about unreachable code that comes after. To allow -// for not having longjmp, TpmFail() will return and the subsequent code will be -// executed. This macro accounts for the difference. -#ifndef NO_LONGJMP -# define FAIL_RETURN(returnCode) -# define TPM_FAIL_RETURN NORETURN void -#else -# define FAIL_RETURN(returnCode) return (returnCode) -# define TPM_FAIL_RETURN void -#endif - -// This macro tests that a condition is TRUE and puts the TPM into failure mode -// if it is not. If longjmp is being used, then the FAIL(FATAL_ERROR_) macro makes -// a call from which there is no return. Otherwise, it returns and the function -// will exit with the appropriate return code. -#define REQUIRE(condition, errorCode, returnCode) \ - { \ - if(!!(condition)) \ - { \ - FAIL(FATAL_ERROR_errorCode); \ - FAIL_RETURN(returnCode); \ - } \ - } - -#define PARAMETER_CHECK(condition, returnCode) \ - REQUIRE((condition), PARAMETER, returnCode) - -#if (defined EMPTY_ASSERT) && (EMPTY_ASSERT != NO) -# define pAssert(a) ((void)0) -#else -# define pAssert(a) {if(!(a)) FAIL(FATAL_ERROR_PARAMETER);} -#endif - -//** Derived from Vendor-specific values -// Values derived from vendor specific settings in TpmProfile.h -#define PCR_SELECT_MIN ((PLATFORM_PCR+7)/8) -#define PCR_SELECT_MAX ((IMPLEMENTATION_PCR+7)/8) -#define MAX_ORDERLY_COUNT ((1 << ORDERLY_BITS) - 1) - -//** Compile-time Checks -// In some cases, the relationship between two values may be dependent -// on things that change based on various selections like the chosen cryptographic -// libraries. It is possible that these selections will result in incompatible -// settings. These are often detectable by the compiler but it isn't always -// possible to do the check in the preprocessor code. For example, when the -// check requires use of "sizeof" then the preprocessor can't do the comparison. -// For these cases, we include a special macro that, depending on the compiler -// will generate a warning to indicate if the check always passes or always fails -// because it involves fixed constants. To run these checks, define COMPILER_CHECKS -// in TpmBuildSwitches.h -#if COMPILER_CHECKS -# define cAssert pAssert -#else -# define cAssert(value) -#endif - -// This is used commonly in the "Crypt" code as a way to keep listings from -// getting too long. This is not to save paper but to allow one to see more -// useful stuff on the screen at any given time. -#define ERROR_RETURN(returnCode) \ - { \ - retVal = returnCode; \ - goto Exit; \ - } - -#ifndef MAX -# define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif -#ifndef MIN -# define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif -#ifndef IsOdd -# define IsOdd(a) (((a) & 1) != 0) -#endif - -#ifndef BITS_TO_BYTES -# define BITS_TO_BYTES(bits) (((bits) + 7) >> 3) -#endif - -// These are defined for use when the size of the vector being checked is known -// at compile time. -#define TEST_BIT(bit, vector) TestBit((bit), (BYTE *)&(vector), sizeof(vector)) -#define SET_BIT(bit, vector) SetBit((bit), (BYTE *)&(vector), sizeof(vector)) -#define CLEAR_BIT(bit, vector) ClearBit((bit), (BYTE *)&(vector), sizeof(vector)) - - -// The following definitions are used if they have not already been defined. The -// defaults for these settings are compatible with ISO/IEC 9899:2011 (E) -#ifndef LIB_EXPORT -# define LIB_EXPORT -# define LIB_IMPORT -#endif -#ifndef NORETURN -# define NORETURN _Noreturn -#endif -#ifndef NOT_REFERENCED -# define NOT_REFERENCED(x = x) ((void) (x)) -#endif - -#define STD_RESPONSE_HEADER (sizeof(TPM_ST) + sizeof(UINT32) + sizeof(TPM_RC)) - -#define JOIN(x, y) x##y -#define JOIN3(x, y, z) x##y##z -#define CONCAT(x, y) JOIN(x, y) -#define CONCAT3(x, y, z) JOIN3(x,y,z) - -// If CONTEXT_INTEGRITY_HASH_ALG is defined, then the vendor is using the old style -// table. Otherwise, pick the "strongest" implemented hash algorithm as the context -// hash. -#ifndef CONTEXT_HASH_ALGORITHM -# if defined ALG_SHA512 && ALG_SHA512 == YES -# define CONTEXT_HASH_ALGORITHM SHA512 -# elif defined ALG_SHA384 && ALG_SHA384 == YES -# define CONTEXT_HASH_ALGORITHM SHA384 -# elif defined ALG_SHA256 && ALG_SHA256 == YES -# define CONTEXT_HASH_ALGORITHM SHA256 -# elif defined ALG_SM3_256 && ALG_SM3_256 == YES -# define CONTEXT_HASH_ALGORITHM SM3_256 -# elif defined ALG_SHA1 && ALG_SHA1 == YES -# define CONTEXT_HASH_ALGORITHM SHA1 -# endif -# define CONTEXT_INTEGRITY_HASH_ALG CONCAT(TPM_ALG_, CONTEXT_HASH_ALGORITHM) -#endif - -#ifndef CONTEXT_INTEGRITY_HASH_SIZE -#define CONTEXT_INTEGRITY_HASH_SIZE CONCAT(CONTEXT_HASH_ALGORITHM, _DIGEST_SIZE) -#endif -#if ALG_RSA -#define RSA_SECURITY_STRENGTH (MAX_RSA_KEY_BITS >= 15360 ? 256 : \ - (MAX_RSA_KEY_BITS >= 7680 ? 192 : \ - (MAX_RSA_KEY_BITS >= 3072 ? 128 : \ - (MAX_RSA_KEY_BITS >= 2048 ? 112 : \ - (MAX_RSA_KEY_BITS >= 1024 ? 80 : 0))))) -#else -#define RSA_SECURITY_STRENGTH 0 -#endif // ALG_RSA - -#if ALG_ECC -#define ECC_SECURITY_STRENGTH (MAX_ECC_KEY_BITS >= 521 ? 256 : \ - (MAX_ECC_KEY_BITS >= 384 ? 192 : \ - (MAX_ECC_KEY_BITS >= 256 ? 128 : 0))) -#else -#define ECC_SECURITY_STRENGTH 0 -#endif // ALG_ECC - -#define MAX_ASYM_SECURITY_STRENGTH \ - MAX(RSA_SECURITY_STRENGTH, ECC_SECURITY_STRENGTH) - -#define MAX_HASH_SECURITY_STRENGTH ((CONTEXT_INTEGRITY_HASH_SIZE * 8) / 2) - -// Unless some algorithm is broken... -#define MAX_SYM_SECURITY_STRENGTH MAX_SYM_KEY_BITS - -#define MAX_SECURITY_STRENGTH_BITS \ - MAX(MAX_ASYM_SECURITY_STRENGTH, \ - MAX(MAX_SYM_SECURITY_STRENGTH, \ - MAX_HASH_SECURITY_STRENGTH)) - -// This is the size that was used before the 1.38 errata requiring that P1.14.4 be -// followed -#define PROOF_SIZE CONTEXT_INTEGRITY_HASH_SIZE - -// As required by P1.14.4 -#define COMPLIANT_PROOF_SIZE \ - (MAX(CONTEXT_INTEGRITY_HASH_SIZE, (2 * MAX_SYM_KEY_BYTES))) - -// As required by P1.14.3.1 -#define COMPLIANT_PRIMARY_SEED_SIZE \ - BITS_TO_BYTES(MAX_SECURITY_STRENGTH_BITS * 2) - -// This is the pre-errata version -#ifndef PRIMARY_SEED_SIZE -# define PRIMARY_SEED_SIZE PROOF_SIZE -#endif - -#if USE_SPEC_COMPLIANT_PROOFS -# undef PROOF_SIZE -# define PROOF_SIZE COMPLIANT_PROOF_SIZE -# undef PRIMARY_SEED_SIZE -# define PRIMARY_SEED_SIZE COMPLIANT_PRIMARY_SEED_SIZE -#endif // USE_SPEC_COMPLIANT_PROOFS - -#if !SKIP_PROOF_ERRORS -# if PROOF_SIZE < COMPLIANT_PROOF_SIZE -# error "PROOF_SIZE is not compliant with TPM specification" -# endif -# if PRIMARY_SEED_SIZE < COMPLIANT_PRIMARY_SEED_SIZE -# error Non-compliant PRIMARY_SEED_SIZE -# endif -#endif // !SKIP_PROOF_ERRORS - -// If CONTEXT_ENCRYPT_ALG is defined, then the vendor is using the old style table -#if defined CONTEXT_ENCRYPT_ALG -# undef CONTEXT_ENCRYPT_ALGORITHM -# if CONTEXT_ENCRYPT_ALG == ALG_AES_VALUE -# define CONTEXT_ENCRYPT_ALGORITHM AES -# elif CONTEXT_ENCRYPT_ALG == ALG_SM4_VALUE -# define CONTEXT_ENCRYPT_ALGORITHM SM4 -# elif CONTEXT_ENCRYPT_ALG == ALG_CAMELLIA_VALUE -# define CONTEXT_ENCRYPT_ALGORITHM CAMELLIA -# elif CONTEXT_ENCRYPT_ALG == ALG_TDES_VALUE -# error Are you kidding? -# else -# error Unknown value for CONTEXT_ENCRYPT_ALG -# endif // CONTEXT_ENCRYPT_ALG == ALG_AES_VALUE -#else -# define CONTEXT_ENCRYPT_ALG \ - CONCAT3(ALG_, CONTEXT_ENCRYPT_ALGORITHM, _VALUE) -#endif // CONTEXT_ENCRYPT_ALG -#define CONTEXT_ENCRYPT_KEY_BITS \ - CONCAT(CONTEXT_ENCRYPT_ALGORITHM, _MAX_KEY_SIZE_BITS) -#define CONTEXT_ENCRYPT_KEY_BYTES ((CONTEXT_ENCRYPT_KEY_BITS+7)/8) - -// This is updated to follow the requirement of P2 that the label not be larger -// than 32 bytes. -#ifndef LABEL_MAX_BUFFER -#define LABEL_MAX_BUFFER MIN(32, MAX(MAX_ECC_KEY_BYTES, MAX_DIGEST_SIZE)) -#endif - -// This bit is used to indicate that an authorization ticket expires on TPM Reset -// and TPM Restart. It is added to the timeout value returned by TPM2_PoliySigned() -// and TPM2_PolicySecret() and used by TPM2_PolicyTicket(). The timeout value is -// relative to Time (g_time). Time is reset whenever the TPM loses power and cannot -// be moved forward by the user (as can Clock). 'g_time' is a 64-bit value expressing -// time in ms. Stealing the MSb for a flag means that the TPM needs to be reset -// at least once every 292,471,208 years rather than once every 584,942,417 years. -#define EXPIRATION_BIT ((UINT64)1 << 63) - -// Check for consistency of the bit ordering of bit fields -#if BIG_ENDIAN_TPM && MOST_SIGNIFICANT_BIT_0 && USE_BIT_FIELD_STRUCTURES -# error "Settings not consistent" -#endif - -// These macros are used to handle the variation in handling of bit fields. If -#if USE_BIT_FIELD_STRUCTURES // The default, old version, with bit fields -# define IS_ATTRIBUTE(a, type, b) ((a.b) != 0) -# define SET_ATTRIBUTE(a, type, b) (a.b = SET) -# define CLEAR_ATTRIBUTE(a, type, b) (a.b = CLEAR) -# define GET_ATTRIBUTE(a, type, b) (a.b) -# define TPMA_ZERO_INITIALIZER() {0} -#else -# define IS_ATTRIBUTE(a, type, b) ((a & type##_##b) != 0) -# define SET_ATTRIBUTE(a, type, b) (a |= type##_##b) -# define CLEAR_ATTRIBUTE(a, type, b) (a &= ~type##_##b) -# define GET_ATTRIBUTE(a, type, b) \ - (type)((a & type##_##b) >> type##_##b##_SHIFT) -# define TPMA_ZERO_INITIALIZER() (0) -#endif - -#define VERIFY(_X) if(!(_X)) goto Error - -#endif // GP_MACROS_H \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/HandleProcess.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/HandleProcess.h deleted file mode 100644 index 51e740ff4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/HandleProcess.h +++ /dev/null @@ -1,1008 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmDispatch; Version 4.0 July 8,2017 - * Date: Oct 9, 2018 Time: 07:25:19PM - */ -#if CC_Startup -case TPM_CC_Startup: - break; -#endif // CC_Startup -#if CC_Shutdown -case TPM_CC_Shutdown: - break; -#endif // CC_Shutdown -#if CC_SelfTest -case TPM_CC_SelfTest: - break; -#endif // CC_SelfTest -#if CC_IncrementalSelfTest -case TPM_CC_IncrementalSelfTest: - break; -#endif // CC_IncrementalSelfTest -#if CC_GetTestResult -case TPM_CC_GetTestResult: - break; -#endif // CC_GetTestResult -#if CC_StartAuthSession -case TPM_CC_StartAuthSession: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_ENTITY_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_StartAuthSession -#if CC_PolicyRestart -case TPM_CC_PolicyRestart: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyRestart -#if CC_Create -case TPM_CC_Create: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Create -#if CC_Load -case TPM_CC_Load: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Load -#if CC_LoadExternal -case TPM_CC_LoadExternal: - break; -#endif // CC_LoadExternal -#if CC_ReadPublic -case TPM_CC_ReadPublic: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ReadPublic -#if CC_ActivateCredential -case TPM_CC_ActivateCredential: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_ActivateCredential -#if CC_MakeCredential -case TPM_CC_MakeCredential: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_MakeCredential -#if CC_Unseal -case TPM_CC_Unseal: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Unseal -#if CC_ObjectChangeAuth -case TPM_CC_ObjectChangeAuth: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_ObjectChangeAuth -#if CC_CreateLoaded -case TPM_CC_CreateLoaded: - *handleCount = 1; - result = TPMI_DH_PARENT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_CreateLoaded -#if CC_Duplicate -case TPM_CC_Duplicate: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_Duplicate -#if CC_Rewrap -case TPM_CC_Rewrap: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_Rewrap -#if CC_Import -case TPM_CC_Import: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Import -#if CC_RSA_Encrypt -case TPM_CC_RSA_Encrypt: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_RSA_Encrypt -#if CC_RSA_Decrypt -case TPM_CC_RSA_Decrypt: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_RSA_Decrypt -#if CC_ECDH_KeyGen -case TPM_CC_ECDH_KeyGen: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ECDH_KeyGen -#if CC_ECDH_ZGen -case TPM_CC_ECDH_ZGen: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ECDH_ZGen -#if CC_ECC_Parameters -case TPM_CC_ECC_Parameters: - break; -#endif // CC_ECC_Parameters -#if CC_ZGen_2Phase -case TPM_CC_ZGen_2Phase: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ZGen_2Phase -#if CC_EncryptDecrypt -case TPM_CC_EncryptDecrypt: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_EncryptDecrypt -#if CC_EncryptDecrypt2 -case TPM_CC_EncryptDecrypt2: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_EncryptDecrypt2 -#if CC_Hash -case TPM_CC_Hash: - break; -#endif // CC_Hash -#if CC_HMAC -case TPM_CC_HMAC: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_HMAC -#if CC_MAC -case TPM_CC_MAC: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_MAC -#if CC_GetRandom -case TPM_CC_GetRandom: - break; -#endif // CC_GetRandom -#if CC_StirRandom -case TPM_CC_StirRandom: - break; -#endif // CC_StirRandom -#if CC_HMAC_Start -case TPM_CC_HMAC_Start: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_HMAC_Start -#if CC_MAC_Start -case TPM_CC_MAC_Start: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_MAC_Start -#if CC_HashSequenceStart -case TPM_CC_HashSequenceStart: - break; -#endif // CC_HashSequenceStart -#if CC_SequenceUpdate -case TPM_CC_SequenceUpdate: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_SequenceUpdate -#if CC_SequenceComplete -case TPM_CC_SequenceComplete: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_SequenceComplete -#if CC_EventSequenceComplete -case TPM_CC_EventSequenceComplete: - *handleCount = 2; - result = TPMI_DH_PCR_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_EventSequenceComplete -#if CC_Certify -case TPM_CC_Certify: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_Certify -#if CC_CertifyCreation -case TPM_CC_CertifyCreation: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_CertifyCreation -#if CC_Quote -case TPM_CC_Quote: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Quote -#if CC_GetSessionAuditDigest -case TPM_CC_GetSessionAuditDigest: - *handleCount = 3; - result = TPMI_RH_ENDORSEMENT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - result = TPMI_SH_HMAC_Unmarshal(&handles[2], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_3; - break; -#endif // CC_GetSessionAuditDigest -#if CC_GetCommandAuditDigest -case TPM_CC_GetCommandAuditDigest: - *handleCount = 2; - result = TPMI_RH_ENDORSEMENT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_GetCommandAuditDigest -#if CC_GetTime -case TPM_CC_GetTime: - *handleCount = 2; - result = TPMI_RH_ENDORSEMENT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_GetTime -#if CC_CertifyX509 -case TPM_CC_CertifyX509: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_CertifyX509 -#if CC_Commit -case TPM_CC_Commit: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Commit -#if CC_EC_Ephemeral -case TPM_CC_EC_Ephemeral: - break; -#endif // CC_EC_Ephemeral -#if CC_VerifySignature -case TPM_CC_VerifySignature: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_VerifySignature -#if CC_Sign -case TPM_CC_Sign: - *handleCount = 1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Sign -#if CC_SetCommandCodeAuditStatus -case TPM_CC_SetCommandCodeAuditStatus: - *handleCount = 1; - result = TPMI_RH_PROVISION_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_SetCommandCodeAuditStatus -#if CC_PCR_Extend -case TPM_CC_PCR_Extend: - *handleCount = 1; - result = TPMI_DH_PCR_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PCR_Extend -#if CC_PCR_Event -case TPM_CC_PCR_Event: - *handleCount = 1; - result = TPMI_DH_PCR_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PCR_Event -#if CC_PCR_Read -case TPM_CC_PCR_Read: - break; -#endif // CC_PCR_Read -#if CC_PCR_Allocate -case TPM_CC_PCR_Allocate: - *handleCount = 1; - result = TPMI_RH_PLATFORM_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PCR_Allocate -#if CC_PCR_SetAuthPolicy -case TPM_CC_PCR_SetAuthPolicy: - *handleCount = 1; - result = TPMI_RH_PLATFORM_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PCR_SetAuthPolicy -#if CC_PCR_SetAuthValue -case TPM_CC_PCR_SetAuthValue: - *handleCount = 1; - result = TPMI_DH_PCR_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PCR_SetAuthValue -#if CC_PCR_Reset -case TPM_CC_PCR_Reset: - *handleCount = 1; - result = TPMI_DH_PCR_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PCR_Reset -#if CC_PolicySigned -case TPM_CC_PolicySigned: - *handleCount = 2; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_SH_POLICY_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_PolicySigned -#if CC_PolicySecret -case TPM_CC_PolicySecret: - *handleCount = 2; - result = TPMI_DH_ENTITY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_SH_POLICY_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_PolicySecret -#if CC_PolicyTicket -case TPM_CC_PolicyTicket: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyTicket -#if CC_PolicyOR -case TPM_CC_PolicyOR: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyOR -#if CC_PolicyPCR -case TPM_CC_PolicyPCR: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyPCR -#if CC_PolicyLocality -case TPM_CC_PolicyLocality: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyLocality -#if CC_PolicyNV -case TPM_CC_PolicyNV: - *handleCount = 3; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - result = TPMI_SH_POLICY_Unmarshal(&handles[2], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_3; - break; -#endif // CC_PolicyNV -#if CC_PolicyCounterTimer -case TPM_CC_PolicyCounterTimer: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyCounterTimer -#if CC_PolicyCommandCode -case TPM_CC_PolicyCommandCode: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyCommandCode -#if CC_PolicyPhysicalPresence -case TPM_CC_PolicyPhysicalPresence: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyPhysicalPresence -#if CC_PolicyCpHash -case TPM_CC_PolicyCpHash: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyCpHash -#if CC_PolicyNameHash -case TPM_CC_PolicyNameHash: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyNameHash -#if CC_PolicyDuplicationSelect -case TPM_CC_PolicyDuplicationSelect: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyDuplicationSelect -#if CC_PolicyAuthorize -case TPM_CC_PolicyAuthorize: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyAuthorize -#if CC_PolicyAuthValue -case TPM_CC_PolicyAuthValue: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyAuthValue -#if CC_PolicyPassword -case TPM_CC_PolicyPassword: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyPassword -#if CC_PolicyGetDigest -case TPM_CC_PolicyGetDigest: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyGetDigest -#if CC_PolicyNvWritten -case TPM_CC_PolicyNvWritten: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyNvWritten -#if CC_PolicyTemplate -case TPM_CC_PolicyTemplate: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PolicyTemplate -#if CC_PolicyAuthorizeNV -case TPM_CC_PolicyAuthorizeNV: - *handleCount = 3; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - result = TPMI_SH_POLICY_Unmarshal(&handles[2], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_3; - break; -#endif // CC_PolicyAuthorizeNV -#if CC_CreatePrimary -case TPM_CC_CreatePrimary: - *handleCount = 1; - result = TPMI_RH_HIERARCHY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_CreatePrimary -#if CC_HierarchyControl -case TPM_CC_HierarchyControl: - *handleCount = 1; - result = TPMI_RH_HIERARCHY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_HierarchyControl -#if CC_SetPrimaryPolicy -case TPM_CC_SetPrimaryPolicy: - *handleCount = 1; - result = TPMI_RH_HIERARCHY_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_SetPrimaryPolicy -#if CC_ChangePPS -case TPM_CC_ChangePPS: - *handleCount = 1; - result = TPMI_RH_PLATFORM_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ChangePPS -#if CC_ChangeEPS -case TPM_CC_ChangeEPS: - *handleCount = 1; - result = TPMI_RH_PLATFORM_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ChangeEPS -#if CC_Clear -case TPM_CC_Clear: - *handleCount = 1; - result = TPMI_RH_CLEAR_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Clear -#if CC_ClearControl -case TPM_CC_ClearControl: - *handleCount = 1; - result = TPMI_RH_CLEAR_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ClearControl -#if CC_HierarchyChangeAuth -case TPM_CC_HierarchyChangeAuth: - *handleCount = 1; - result = TPMI_RH_HIERARCHY_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_HierarchyChangeAuth -#if CC_DictionaryAttackLockReset -case TPM_CC_DictionaryAttackLockReset: - *handleCount = 1; - result = TPMI_RH_LOCKOUT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_DictionaryAttackLockReset -#if CC_DictionaryAttackParameters -case TPM_CC_DictionaryAttackParameters: - *handleCount = 1; - result = TPMI_RH_LOCKOUT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_DictionaryAttackParameters -#if CC_PP_Commands -case TPM_CC_PP_Commands: - *handleCount = 1; - result = TPMI_RH_PLATFORM_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_PP_Commands -#if CC_SetAlgorithmSet -case TPM_CC_SetAlgorithmSet: - *handleCount = 1; - result = TPMI_RH_PLATFORM_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_SetAlgorithmSet -#if CC_FieldUpgradeStart -case TPM_CC_FieldUpgradeStart: - *handleCount = 2; - result = TPMI_RH_PLATFORM_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_FieldUpgradeStart -#if CC_FieldUpgradeData -case TPM_CC_FieldUpgradeData: - break; -#endif // CC_FieldUpgradeData -#if CC_FirmwareRead -case TPM_CC_FirmwareRead: - break; -#endif // CC_FirmwareRead -#if CC_ContextSave -case TPM_CC_ContextSave: - *handleCount = 1; - result = TPMI_DH_CONTEXT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ContextSave -#if CC_ContextLoad -case TPM_CC_ContextLoad: - break; -#endif // CC_ContextLoad -#if CC_FlushContext -case TPM_CC_FlushContext: - break; -#endif // CC_FlushContext -#if CC_EvictControl -case TPM_CC_EvictControl: - *handleCount = 2; - result = TPMI_RH_PROVISION_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_DH_OBJECT_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_EvictControl -#if CC_ReadClock -case TPM_CC_ReadClock: - break; -#endif // CC_ReadClock -#if CC_ClockSet -case TPM_CC_ClockSet: - *handleCount = 1; - result = TPMI_RH_PROVISION_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ClockSet -#if CC_ClockRateAdjust -case TPM_CC_ClockRateAdjust: - *handleCount = 1; - result = TPMI_RH_PROVISION_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_ClockRateAdjust -#if CC_GetCapability -case TPM_CC_GetCapability: - break; -#endif // CC_GetCapability -#if CC_TestParms -case TPM_CC_TestParms: - break; -#endif // CC_TestParms -#if CC_NV_DefineSpace -case TPM_CC_NV_DefineSpace: - *handleCount = 1; - result = TPMI_RH_PROVISION_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_NV_DefineSpace -#if CC_NV_UndefineSpace -case TPM_CC_NV_UndefineSpace: - *handleCount = 2; - result = TPMI_RH_PROVISION_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_UndefineSpace -#if CC_NV_UndefineSpaceSpecial -case TPM_CC_NV_UndefineSpaceSpecial: - *handleCount = 2; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_PLATFORM_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_UndefineSpaceSpecial -#if CC_NV_ReadPublic -case TPM_CC_NV_ReadPublic: - *handleCount = 1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_NV_ReadPublic -#if CC_NV_Write -case TPM_CC_NV_Write: - *handleCount = 2; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_Write -#if CC_NV_Increment -case TPM_CC_NV_Increment: - *handleCount = 2; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_Increment -#if CC_NV_Extend -case TPM_CC_NV_Extend: - *handleCount = 2; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_Extend -#if CC_NV_SetBits -case TPM_CC_NV_SetBits: - *handleCount = 2; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_SetBits -#if CC_NV_WriteLock -case TPM_CC_NV_WriteLock: - *handleCount = 2; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_WriteLock -#if CC_NV_GlobalWriteLock -case TPM_CC_NV_GlobalWriteLock: - *handleCount = 1; - result = TPMI_RH_PROVISION_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_NV_GlobalWriteLock -#if CC_NV_Read -case TPM_CC_NV_Read: - *handleCount = 2; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_Read -#if CC_NV_ReadLock -case TPM_CC_NV_ReadLock: - *handleCount = 2; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - break; -#endif // CC_NV_ReadLock -#if CC_NV_ChangeAuth -case TPM_CC_NV_ChangeAuth: - *handleCount = 1; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_NV_ChangeAuth -#if CC_NV_Certify -case TPM_CC_NV_Certify: - *handleCount = 3; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, TRUE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - result = TPMI_RH_NV_INDEX_Unmarshal(&handles[2], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_3; - break; -#endif // CC_NV_Certify -#if CC_AC_GetCapability -case TPM_CC_AC_GetCapability: - *handleCount = 1; - result = TPMI_RH_AC_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_AC_GetCapability -#if CC_AC_Send -case TPM_CC_AC_Send: - *handleCount = 3; - result = TPMI_DH_OBJECT_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize, FALSE); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - result = TPMI_RH_NV_AUTH_Unmarshal(&handles[1], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_2; - result = TPMI_RH_AC_Unmarshal(&handles[2], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_3; - break; -#endif // CC_AC_Send -#if CC_Policy_AC_SendSelect -case TPM_CC_Policy_AC_SendSelect: - *handleCount = 1; - result = TPMI_SH_POLICY_Unmarshal(&handles[0], handleBufferStart, - bufferRemainingSize); - if(TPM_RC_SUCCESS != result) return result + TPM_RC_H + TPM_RC_1; - break; -#endif // CC_Policy_AC_SendSelect -#if CC_Vendor_TCG_Test -case TPM_CC_Vendor_TCG_Test: - break; -#endif // CC_Vendor_TCG_Test diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/HashTestData.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/HashTestData.h deleted file mode 100644 index 8bd471a3f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/HashTestData.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// -// Hash Test Vectors -// - -TPM2B_TYPE(HASH_TEST_KEY, 128); // Twice the largest digest size -TPM2B_HASH_TEST_KEY c_hashTestKey = {{128, { - 0xa0,0xed,0x5c,0x9a,0xd2,0x4a,0x21,0x40,0x1a,0xd0,0x81,0x47,0x39,0x63,0xf9,0x50, - 0xdc,0x59,0x47,0x11,0x40,0x13,0x99,0x92,0xc0,0x72,0xa4,0x0f,0xe2,0x33,0xe4,0x63, - 0x9b,0xb6,0x76,0xc3,0x1e,0x6f,0x13,0xee,0xcc,0x99,0x71,0xa5,0xc0,0xcf,0x9a,0x40, - 0xcf,0xdb,0x66,0x70,0x05,0x63,0x54,0x12,0x25,0xf4,0xe0,0x1b,0x23,0x35,0xe3,0x70, - 0x7d,0x19,0x5f,0x00,0xe4,0xf1,0x61,0x73,0x05,0xd8,0x58,0x7f,0x60,0x61,0x84,0x36, - 0xec,0xbe,0x96,0x1b,0x69,0x00,0xf0,0x9a,0x6e,0xe3,0x26,0x73,0x0d,0x17,0x5b,0x33, - 0x41,0x44,0x9d,0x90,0xab,0xd9,0x6b,0x7d,0x48,0x99,0x25,0x93,0x29,0x14,0x2b,0xce, - 0x93,0x8d,0x8c,0xaf,0x31,0x0e,0x9c,0x57,0xd8,0x5b,0x57,0x20,0x1b,0x9f,0x2d,0xa5 - }}}; - -TPM2B_TYPE(HASH_TEST_DATA, 256); // Twice the largest block size -TPM2B_HASH_TEST_DATA c_hashTestData = {{256, { - 0x88,0xac,0xc3,0xe5,0x5f,0x66,0x9d,0x18,0x80,0xc9,0x7a,0x9c,0xa4,0x08,0x90,0x98, - 0x0f,0x3a,0x53,0x92,0x4c,0x67,0x4e,0xb7,0x37,0xec,0x67,0x87,0xb6,0xbe,0x10,0xca, - 0x11,0x5b,0x4a,0x0b,0x45,0xc3,0x32,0x68,0x48,0x69,0xce,0x25,0x1b,0xc8,0xaf,0x44, - 0x79,0x22,0x83,0xc8,0xfb,0xe2,0x63,0x94,0xa2,0x3c,0x59,0x3e,0x3e,0xc6,0x64,0x2c, - 0x1f,0x8c,0x11,0x93,0x24,0xa3,0x17,0xc5,0x2f,0x37,0xcf,0x95,0x97,0x8e,0x63,0x39, - 0x68,0xd5,0xca,0xba,0x18,0x37,0x69,0x6e,0x4f,0x19,0xfd,0x8a,0xc0,0x8d,0x87,0x3a, - 0xbc,0x31,0x42,0x04,0x05,0xef,0xb5,0x02,0xef,0x1e,0x92,0x4b,0xb7,0x73,0x2c,0x8c, - 0xeb,0x23,0x13,0x81,0x34,0xb9,0xb5,0xc1,0x17,0x37,0x39,0xf8,0x3e,0xe4,0x4c,0x06, - 0xa8,0x81,0x52,0x2f,0xef,0xc9,0x9c,0x69,0x89,0xbc,0x85,0x9c,0x30,0x16,0x02,0xca, - 0xe3,0x61,0xd4,0x0f,0xed,0x34,0x1b,0xca,0xc1,0x1b,0xd1,0xfa,0xc1,0xa2,0xe0,0xdf, - 0x52,0x2f,0x0b,0x4b,0x9f,0x0e,0x45,0x54,0xb9,0x17,0xb6,0xaf,0xd6,0xd5,0xca,0x90, - 0x29,0x57,0x7b,0x70,0x50,0x94,0x5c,0x8e,0xf6,0x4e,0x21,0x8b,0xc6,0x8b,0xa6,0xbc, - 0xb9,0x64,0xd4,0x4d,0xf3,0x68,0xd8,0xac,0xde,0xd8,0xd8,0xb5,0x6d,0xcd,0x93,0xeb, - 0x28,0xa4,0xe2,0x5c,0x44,0xef,0xf0,0xe1,0x6f,0x38,0x1a,0x3c,0xe6,0xef,0xa2,0x9d, - 0xb9,0xa8,0x05,0x2a,0x95,0xec,0x5f,0xdb,0xb0,0x25,0x67,0x9c,0x86,0x7a,0x8e,0xea, - 0x51,0xcc,0xc3,0xd3,0xff,0x6e,0xf0,0xed,0xa3,0xae,0xf9,0x5d,0x33,0x70,0xf2,0x11 - }}}; - -#if ALG_SHA1 == YES -TPM2B_TYPE(SHA1, 20); -TPM2B_SHA1 c_SHA1_digest = {{20, { - 0xee,0x2c,0xef,0x93,0x76,0xbd,0xf8,0x91,0xbc,0xe6,0xe5,0x57,0x53,0x77,0x01,0xb5, - 0x70,0x95,0xe5,0x40 - }}}; -#endif - -#if ALG_SHA256 == YES -TPM2B_TYPE(SHA256, 32); -TPM2B_SHA256 c_SHA256_digest = {{32, { - 0x64,0xe8,0xe0,0xc3,0xa9,0xa4,0x51,0x49,0x10,0x55,0x8d,0x31,0x71,0xe5,0x2f,0x69, - 0x3a,0xdc,0xc7,0x11,0x32,0x44,0x61,0xbd,0x34,0x39,0x57,0xb0,0xa8,0x75,0x86,0x1b - }}}; -#endif - -#if ALG_SHA384 == YES -TPM2B_TYPE(SHA384, 48); -TPM2B_SHA384 c_SHA384_digest = {{48, { - 0x37,0x75,0x29,0xb5,0x20,0x15,0x6e,0xa3,0x7e,0xa3,0x0d,0xcd,0x80,0xa8,0xa3,0x3d, - 0xeb,0xe8,0xad,0x4e,0x1c,0x77,0x94,0x5a,0xaf,0x6c,0xd0,0xc1,0xfa,0x43,0x3f,0xc7, - 0xb8,0xf1,0x01,0xc0,0x60,0xbf,0xf2,0x87,0xe8,0x71,0x9e,0x51,0x97,0xa0,0x09,0x8d - }}}; -#endif - -#if ALG_SHA512 == YES -TPM2B_TYPE(SHA512, 64); -TPM2B_SHA512 c_SHA512_digest = {{64, { - 0xe2,0x7b,0x10,0x3d,0x5e,0x48,0x58,0x44,0x67,0xac,0xa3,0x81,0x8c,0x1d,0xc5,0x71, - 0x66,0x92,0x8a,0x89,0xaa,0xd4,0x35,0x51,0x60,0x37,0x31,0xd7,0xba,0xe7,0x93,0x0b, - 0x16,0x4d,0xb3,0xc8,0x34,0x98,0x3c,0xd3,0x53,0xde,0x5e,0xe8,0x0c,0xbc,0xaf,0xc9, - 0x24,0x2c,0xcc,0xed,0xdb,0xde,0xba,0x1f,0x14,0x14,0x5a,0x95,0x80,0xde,0x66,0xbd - }}}; -#endif diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/InternalRoutines.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/InternalRoutines.h deleted file mode 100644 index 11bab88c0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/InternalRoutines.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef INTERNAL_ROUTINES_H -#define INTERNAL_ROUTINES_H - -#if !defined _LIB_SUPPORT_H_ && !defined _TPM_H_ -#error "Should not be called" -#endif - -// DRTM functions -#include "_TPM_Hash_Start_fp.h" -#include "_TPM_Hash_Data_fp.h" -#include "_TPM_Hash_End_fp.h" - -// Internal subsystem functions -#include "Object_fp.h" -#include "Context_spt_fp.h" -#include "Object_spt_fp.h" -#include "Entity_fp.h" -#include "Session_fp.h" -#include "Hierarchy_fp.h" -#include "NvReserved_fp.h" -#include "NvDynamic_fp.h" -#include "NV_spt_fp.h" -#include "PCR_fp.h" -#include "DA_fp.h" -#include "TpmFail_fp.h" -#include "SessionProcess_fp.h" - -// Internal support functions -#include "CommandCodeAttributes_fp.h" -#include "Marshal_fp.h" -#include "Time_fp.h" -#include "Locality_fp.h" -#include "PP_fp.h" -#include "CommandAudit_fp.h" -#include "Manufacture_fp.h" -#include "Handle_fp.h" -#include "Power_fp.h" -#include "Response_fp.h" -#include "CommandDispatcher_fp.h" - -#ifdef CC_AC_Send -# include "AC_spt_fp.h" -#endif // CC_AC_Send - -// Miscellaneous -#include "Bits_fp.h" -#include "AlgorithmCap_fp.h" -#include "PropertyCap_fp.h" -#include "IoBuffers_fp.h" -#include "Memory_fp.h" -#include "ResponseCodeProcessing_fp.h" - -// Internal cryptographic functions -#include "BnConvert_fp.h" -#include "BnMath_fp.h" -#include "BnMemory_fp.h" -#include "Ticket_fp.h" -#include "CryptUtil_fp.h" -#include "CryptHash_fp.h" -#include "CryptSym_fp.h" -#include "CryptDes_fp.h" -#include "CryptPrime_fp.h" -#include "CryptRand_fp.h" -#include "CryptSelfTest_fp.h" -#include "MathOnByteBuffers_fp.h" -#include "CryptSym_fp.h" -#include "AlgorithmTests_fp.h" - -#if ALG_RSA -#include "CryptRsa_fp.h" -#include "CryptPrimeSieve_fp.h" -#endif - -#if ALG_ECC -#include "CryptEccMain_fp.h" -#include "CryptEccSignature_fp.h" -#include "CryptEccKeyExchange_fp.h" -#endif - -#if CC_MAC || CC_MAC_Start -# include "CryptSmac_fp.h" -# if ALG_CMAC -# include "CryptCmac_fp.h" -# endif -#endif - -// Support library -#include "SupportLibraryFunctionPrototypes_fp.h" - -// Linkage to platform functions -#include "Platform_fp.h" - -#endif diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/KdfTestData.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/KdfTestData.h deleted file mode 100644 index bf27cfc84..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/KdfTestData.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// -// Hash Test Vectors -// - -#define TEST_KDF_KEY_SIZE 20 - -TPM2B_TYPE(KDF_TEST_KEY, TEST_KDF_KEY_SIZE); -TPM2B_KDF_TEST_KEY c_kdfTestKeyIn = {{TEST_KDF_KEY_SIZE, { - 0x27, 0x1F, 0xA0, 0x8B, 0xBD, 0xC5, 0x06, 0x0E, 0xC3, 0xDF, - 0xA9, 0x28, 0xFF, 0x9B, 0x73, 0x12, 0x3A, 0x12, 0xDA, 0x0C }}}; - -TPM2B_TYPE(KDF_TEST_LABEL, 17); -TPM2B_KDF_TEST_LABEL c_kdfTestLabel = {{17, { - 0x4B, 0x44, 0x46, 0x53, 0x45, 0x4C, 0x46, 0x54, - 0x45, 0x53, 0x54, 0x4C, 0x41, 0x42, 0x45, 0x4C, 0x00 }}}; - -TPM2B_TYPE(KDF_TEST_CONTEXT, 8); -TPM2B_KDF_TEST_CONTEXT c_kdfTestContextU = {{8, { - 0xCE, 0x24, 0x4F, 0x39, 0x5D, 0xCA, 0x73, 0x91 }}}; - -TPM2B_KDF_TEST_CONTEXT c_kdfTestContextV = {{8, { - 0xDA, 0x50, 0x40, 0x31, 0xDD, 0xF1, 0x2E, 0x83 }}}; - - -#if ALG_SHA512 == ALG_YES - TPM2B_KDF_TEST_KEY c_kdfTestKeyOut = {{20, { - 0x8b, 0xe2, 0xc1, 0xb8, 0x5b, 0x78, 0x56, 0x9b, 0x9f, 0xa7, - 0x59, 0xf5, 0x85, 0x7c, 0x56, 0xd6, 0x84, 0x81, 0x0f, 0xd3 }}}; - #define KDF_TEST_ALG TPM_ALG_SHA512 - -#elif ALG_SHA384 == ALG_YES - TPM2B_KDF_TEST_KEY c_kdfTestKeyOut = {{20, { - 0x1d, 0xce, 0x70, 0xc9, 0x11, 0x3e, 0xb2, 0xdb, 0xa4, 0x7b, - 0xd9, 0xcf, 0xc7, 0x2b, 0xf4, 0x6f, 0x45, 0xb0, 0x93, 0x12 }}}; - #define KDF_TEST_ALG TPM_ALG_SHA384 - -#elif ALG_SHA256 == ALG_YES - TPM2B_KDF_TEST_KEY c_kdfTestKeyOut = {{20, { - 0xbb, 0x02, 0x59, 0xe1, 0xc8, 0xba, 0x60, 0x7e, 0x6a, 0x2c, - 0xd7, 0x04, 0xb6, 0x9a, 0x90, 0x2e, 0x9a, 0xde, 0x84, 0xc4 }}}; - #define KDF_TEST_ALG TPM_ALG_SHA256 - -#elif ALG_SHA1 == ALG_YES - TPM2B_KDF_TEST_KEY c_kdfTestKeyOut = {{20, { - 0x55, 0xb5, 0xa7, 0x18, 0x4a, 0xa0, 0x74, 0x23, 0xc4, 0x7d, - 0xae, 0x76, 0x6c, 0x26, 0xa2, 0x37, 0x7d, 0x7c, 0xf8, 0x51 }}}; - #define KDF_TEST_ALG TPM_ALG_SHA1 -#endif diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/LibSupport.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/LibSupport.h deleted file mode 100644 index 96473928e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/LibSupport.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// This header file is used to select the library code that gets included in the -// TPM build. - -#ifndef _LIB_SUPPORT_H_ -#define _LIB_SUPPORT_H_ - -//********************* -#ifndef RADIX_BITS -# if defined(__x86_64__) || defined(__x86_64) \ - || defined(__amd64__) || defined(__amd64) || defined(_WIN64) || defined(_M_X64) \ - || defined(_M_ARM64) || defined(__aarch64__) -# define RADIX_BITS 64 -# elif defined(__i386__) || defined(__i386) || defined(i386) \ - || defined(_WIN32) || defined(_M_IX86) \ - || defined(_M_ARM) || defined(__arm__) || defined(__thumb__) -# define RADIX_BITS 32 -# else -# error Unable to determine RADIX_BITS from compiler environment -# endif -#endif // RADIX_BITS - -// These macros use the selected libraries to the proper include files. -#define LIB_QUOTE(_STRING_) #_STRING_ -#define LIB_INCLUDE2(_LIB_, _TYPE_) LIB_QUOTE(_LIB_/TpmTo##_LIB_##_TYPE_.h) -#define LIB_INCLUDE(_LIB_, _TYPE_) LIB_INCLUDE2(_LIB_, _TYPE_) - -// Include the options for hashing and symmetric. Defer the load of the math package -// Until the bignum parameters are defined. -#include LIB_INCLUDE(SYM_LIB, Sym) -#include LIB_INCLUDE(HASH_LIB, Hash) - -#undef MIN -#undef MAX - -#endif // _LIB_SUPPORT_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/LtcSettings.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/LtcSettings.h deleted file mode 100644 index 0e31d344d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/LtcSettings.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// This header file contains some defines that are necessary to get LTC to compile -// correctly -// -#ifndef _LTC_SETTINGS_H_ -#define _LTC_SETTINGS_H_ - -#if (defined HASH_LIB_LTC) || (defined SYM_LIB_LTC) || (defined MATH_LIB_LTC) - -#if ALG_AES -# define LTC_RIJNDAEL -#endif -#if ALG_TDES -# define LTC_DES -#endif - -#define _Bool int - -// LibTomCrypt types -typedef unsigned long long ulong64; - -/* default no functions m for LTC */ -#define LTC_MUTEX_GLOBAL(x) -#define LTC_MUTEX_PROTO(x) -#define LTC_MUTEX_TYPE(x) -#define LTC_MUTEX_INIT(x) -#define LTC_MUTEX_LOCK(x) -#define LTC_MUTEX_UNLOCK(x) - -#ifndef XMEM_NEQ -#define XMEM_NEQ -#endif - -#define LTC_SHA512 -#define LTC_SHA384 -#define LTC_SHA256 -#define LTC_SHA1 - -// Define these function calls as needed -#define CryptLibStartup() LtcLibStartup() - -_REDUCE_WARNING_LEVEL_(0) -#include "tomcrypt.h" -_NORMAL_WARNING_LEVEL_ - -#endif - -#endif // diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcHash.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcHash.h deleted file mode 100644 index 6f429852c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcHash.h +++ /dev/null @@ -1,172 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// This header defines the interface between the hashing code and the LIbTomCrypt -// hash functions. - -#ifndef HASH_LIB_DEFINED -#define HASH_LIB_DEFINED - -#define HASH_LIB_LTC - -// Avoid pulling in the MPA math if not doing asymmetric with LTC -#if !(defined MATH_LIB_LTC) -# define LTC_NO_ASYMMETRIC -#endif - -#include "LtcSettings.h" - -//*************************************************************** -//******** Linking to the TomCrypt HASH code ******************** -//*************************************************************** -// These defines need to be known in all parts of the TPM so that the structure -// sizes can be properly computed when needed. -#define tpmHashStateSHA1_t struct sha1_state -#define tpmHashStateSHA256_t struct sha256_state -#define tpmHashStateSHA512_t struct sha512_state -#define tpmHashStateSHA384_t struct sha512_state - -// The following defines are only needed by CryptHash.c -#ifdef _CRYPT_HASH_C_ - -// Define the interface between CryptHash.c to the functions provided by the -// library. For each method, define the calling parameters of the method and then -// define how the method is invoked in CryptHash.c. -// -// All hashes are required to have the same calling sequence. If they don't, create -// a simple adaptation function that converts from the "standard" form of the call -// to the form used by the specific hash (and then send a nasty letter to the -// person who wrote the hash function for the library). -// -// The macro that calls the method also defines how the -// parameters get swizzled between the default form (in CryptHash.c)and the -// library form. -// -// Initialize the hash context -#define HASH_START_METHOD_DEF \ - void (HASH_START_METHOD)(PANY_HASH_STATE state) -#define HASH_START(hashState) \ - ((hashState)->def->method.start)(&(hashState)->state) - -// Add data to the hash -#define HASH_DATA_METHOD_DEF \ - void (HASH_DATA_METHOD)(PANY_HASH_STATE state, \ - const BYTE *buffer, \ - size_t size) -#define HASH_DATA(hashState, dInSize, dIn) \ - ((hashState)->def->method.data)(&(hashState)->state, dIn, dInSize) - -// Finalize the hash and get the digest -#define HASH_END_METHOD_DEF \ - void (HASH_END_METHOD)(PANY_HASH_STATE \ - state, \ - BYTE *buffer) -#define HASH_END(hashState, buffer) \ - ((hashState)->def->method.end)(&(hashState)->state, buffer) - -// Copy the hash context -// Note: For import, export, and copy, memcpy() is used since there is no -// reformatting necessary between the internal and external forms -#define HASH_STATE_COPY_METHOD_DEF \ - void (HASH_STATE_COPY_METHOD)(PANY_HASH_STATE to, \ - PCANY_HASH_STATE from, \ - size_t size) -#define HASH_STATE_COPY(hashStateOut, hashStateIn) \ - ((hashStateIn)->def->method.copy) \ - (&(hashStateOut)->state, \ - &(hashStateIn)->state, \ - (hashStateIn)->def->contextSize) - -// Copy (with reformatting when necessary) an internal hash structure to an -// external blob -#define HASH_STATE_EXPORT_METHOD_DEF \ - void (HASH_STATE_EXPORT_METHOD)(BYTE *to, \ - PANY_HASH_STATE from, \ - size_t size) -#define HASH_STATE_EXPORT(to, hashStateFrom) \ - ((hashStateFrom)->def->method.copyOut) \ - (&(((BYTE *)(to))[offsetof(HASH_STATE, state)]), \ - &(hashStateFrom)->state, \ - (hashStateFrom)->def->contextSize) - -// Copy from an external blob to an internal formate (with reformatting when -// necessary -#define HASH_STATE_IMPORT_METHOD_DEF \ - void (HASH_STATE_IMPORT_METHOD)(PANY_HASH_STATE to, \ - const BYTE *from, \ - size_t size) -#define HASH_STATE_IMPORT(hashStateTo, from) \ - ((hashStateTo)->def->method.copyIn) \ - (&(hashStateTo)->state, \ - &(((const BYTE *)(from))[offsetof(HASH_STATE, state)]),\ - (hashStateTo)->def->contextSize) - -// Internal External -// Designation Designation -#define tpmHashStart_SHA1 sha1_init -#define tpmHashData_SHA1 sha1_process -#define tpmHashEnd_SHA1 sha1_done -#define tpmHashStateCopy_SHA1 memcpy -#define tpmHashStateExport_SHA1 memcpy -#define tpmHashStateImport_SHA1 memcpy -#define tpmHashStart_SHA256 sha256_init -#define tpmHashData_SHA256 sha256_process -#define tpmHashEnd_SHA256 sha256_done -#define tpmHashStateCopy_SHA256 memcpy -#define tpmHashStateExport_SHA256 memcpy -#define tpmHashStateImport_SHA256 memcpy -#define tpmHashStart_SHA384 sha384_init -#define tpmHashData_SHA384 sha384_process -#define tpmHashEnd_SHA384 sha384_done -#define tpmHashStateCopy_SHA384 memcpy -#define tpmHashStateExport_SHA384 memcpy -#define tpmHashStateImport_SHA384 memcpy -#define tpmHashStart_SHA512 sha512_init -#define tpmHashData_SHA512 sha512_process -#define tpmHashEnd_SHA512 sha512_done -#define tpmHashStateCopy_SHA512 memcpy -#define tpmHashStateExport_SHA512 memcpy -#define tpmHashStateImport_SHA512 memcpy - -#endif // _CRYPT_HASH_C_ - -// No special processing to initialize the LTC hash library -#define LibHashInit() - -// No special processing at the end of the simulation (i.e., no statistics to print) -#define HashLibSimulationEnd() - -#endif // HASH_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcMath.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcMath.h deleted file mode 100644 index 93ede548d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcMath.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// This file contains the structure definitions used for linking from the TPM -// code to the MPA and LTC math libraries. - -#ifndef MATH_LIB_DEFINED -#define MATH_LIB_DEFINED - -#define MATH_LIB_LTC - -_REDUCE_WARNING_LEVEL_(2) -#include "LtcSettings.h" -#include "mpalib.h" -#include "mpa.h" -#include "tomcrypt_mpa.h" -_NORMAL_WARNING_LEVEL_ - - -#if RADIX_BITS != 32 -#error "The mpa library used with LibTomCrypt only works for 32-bit words" -#endif - -// These macros handle entering and leaving a scope -// from which an MPA or LibTomCrypt function may be called. -// Many of these functions require a scratch pool from which -// they will allocate scratch variables (rather than using their -// own stack). -extern mpa_scratch_mem external_mem_pool; - -#define MPA_ENTER(vars, bits) \ - mpa_word_t POOL_ [ \ - mpa_scratch_mem_size_in_U32(vars, bits)]; \ - mpa_scratch_mem pool_save = external_mem_pool; \ - mpa_scratch_mem POOL = LtcPoolInit(POOL_, vars, bits) - -#define MPA_LEAVE() init_mpa_tomcrypt(pool_save) - -typedef ECC_CURVE_DATA bnCurve_t; - -typedef bnCurve_t *bigCurve; - -#define AccessCurveData(E) (E) - -// Include the support functions for the routines that are used by LTC thunk. -#include "TpmToLtcSupport_fp.h" - -#define CURVE_INITIALIZED(name, initializer) \ - bnCurve_t *name = (ECC_CURVE_DATA *)GetCurveData(initializer) - -#define CURVE_FREE(E) - -// This definition would change if there were something to report -#define MathLibSimulationEnd() - -#endif // MATH_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcSym.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcSym.h deleted file mode 100644 index 68de231a8..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ltc/TpmToLtcSym.h +++ /dev/null @@ -1,110 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// This header file is used to "splice" the TPM to the LTC symmetric cipher code. - -#ifndef SYM_LIB_DEFINED -#define SYM_LIB_DEFINED - -#define SYM_LIB_LTC - -// Avoid pulling in the MPA math if not doing asymmetric with LTC -#if !(defined MATH_LIB_LTC) -# define LTC_NO_ASYMMETRIC -#endif - -#include "LtcSettings.h" - -//*************************************************************** -//******** Linking to the TomCrypt AES code ********************* -//*************************************************************** - -#if ALG_SM4 -#error "SM4 is not available" -#endif - -#if ALG_CAMELLIA -#error "Camellia is not available" -#endif - -// Define the order of parameters to the functions that do block encryption and -// decryption. -typedef void(*TpmCryptSetSymKeyCall_t)( - const void *in, - void *out, - void *keySchedule - ); - -// Macro to put the parameters in the order required by the library -#define SWIZZLE(keySchedule, in, out) \ - (const void *)(in), (void *)(out), (void *)(keySchedule) - -// Macros to set up the encryption/decryption key schedules -// -// AES: -# define TpmCryptSetEncryptKeyAES(key, keySizeInBits, schedule) \ - aes_setup((key), BITS_TO_BYTES(keySizeInBits), 0, (symmetric_key *)(schedule)) -# define TpmCryptSetDecryptKeyAES(key, keySizeInBits, schedule) \ - aes_setup((key), BITS_TO_BYTES(keySizeInBits), 0, (symmetric_key *)(schedule)) - -// TDES: -# define TpmCryptSetEncryptKeyTDES(key, keySizeInBits, schedule) \ - TDES_setup((key), (keySizeInBits), (symmetric_key *)(schedule)) -# define TpmCryptSetDecryptKeyTDES(key, keySizeInBits, schedule) \ - TDES_setup((key), (keySizeInBits), (symmetric_key *)(schedule)) - - -// Macros to alias encrypt and decrypt function calls to library-specific values -// sparingly. These should be used sparingly. Currently, they are only used by -// CryptRand.c in the AES version of the DRBG. -#define TpmCryptEncryptAES aes_ecb_encrypt -#define TpmCryptDecryptAES aes_ecb_decrypt -#define tpmKeyScheduleAES struct rijndael_key -// -#define TpmCryptEncryptTDES des3_ecb_encrypt -#define TpmCryptDecryptTDES des3_ecb_decrypt -#define tpmKeyScheduleTDES struct des3_key - -typedef union tpmCryptKeySchedule_t tpmCryptKeySchedule_t; - -#include "TpmToLtcDesSupport_fp.h" - -// This is used to trigger printing of simulation statistics - -#define SymLibSimulationEnd() - -#endif // SYM_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/MinMax.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/MinMax.h deleted file mode 100644 index 720065055..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/MinMax.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MIN_MAX_H_ -#define _MIN_MAX_H_ - -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - -#endif // _MIN_MAX_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/NV.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/NV.h deleted file mode 100644 index 88564f73c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/NV.h +++ /dev/null @@ -1,165 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Index Type Definitions - -// These definitions allow the same code to be used pre and post 1.21. The main -// action is to redefine the index type values from the bit values. -// Use TPM_NT_ORDINARY to indicate if the TPM_NT type is defined - -#ifndef _NV_H_ -#define _NV_H_ - - -#ifdef TPM_NT_ORDINARY -// If TPM_NT_ORDINARY is defined, then the TPM_NT field is present in a TPMA_NV -# define GET_TPM_NT(attributes) GET_ATTRIBUTE(attributes, TPMA_NV, TPM_NT) -#else -// If TPM_NT_ORDINARY is not defined, then need to synthesize it from the -// attributes -# define GetNv_TPM_NV(attributes) \ - ( IS_ATTRIBUTE(attributes, TPMA_NV, COUNTER) \ - + (IS_ATTRIBUTE(attributes, TPMA_NV, BITS) << 1) \ - + (IS_ATTRIBUTE(attributes, TPMA_NV, EXTEND) << 2) \ - ) -# define TPM_NT_ORDINARY (0) -# define TPM_NT_COUNTER (1) -# define TPM_NT_BITS (2) -# define TPM_NT_EXTEND (4) -#endif - - -//** Attribute Macros -// These macros are used to isolate the differences in the way that the index type -// changed in version 1.21 of the specification -# define IsNvOrdinaryIndex(attributes) \ - (GET_TPM_NT(attributes) == TPM_NT_ORDINARY) - -# define IsNvCounterIndex(attributes) \ - (GET_TPM_NT(attributes) == TPM_NT_COUNTER) - -# define IsNvBitsIndex(attributes) \ - (GET_TPM_NT(attributes) == TPM_NT_BITS) - -# define IsNvExtendIndex(attributes) \ - (GET_TPM_NT(attributes) == TPM_NT_EXTEND) - -#ifdef TPM_NT_PIN_PASS -# define IsNvPinPassIndex(attributes) \ - (GET_TPM_NT(attributes) == TPM_NT_PIN_PASS) -#endif - -#ifdef TPM_NT_PIN_FAIL -# define IsNvPinFailIndex(attributes) \ - (GET_TPM_NT(attributes) == TPM_NT_PIN_FAIL) -#endif - -typedef struct { - UINT32 size; - TPM_HANDLE handle; -} NV_ENTRY_HEADER; - -#define NV_EVICT_OBJECT_SIZE \ - (sizeof(UINT32) + sizeof(TPM_HANDLE) + sizeof(OBJECT)) - -#define NV_INDEX_COUNTER_SIZE \ - (sizeof(UINT32) + sizeof(NV_INDEX) + sizeof(UINT64)) - -#define NV_RAM_INDEX_COUNTER_SIZE \ - (sizeof(NV_RAM_HEADER) + sizeof(UINT64)) - -typedef struct { - UINT32 size; - TPM_HANDLE handle; - TPMA_NV attributes; -} NV_RAM_HEADER; - -// Defines the end-of-list marker for NV. The list terminator is -// a UINT32 of zero, followed by the current value of s_maxCounter which is a -// 64-bit value. The structure is defined as an array of 3 UINT32 values so that -// there is no padding between the UINT32 list end marker and the UINT64 maxCounter -// value. -typedef UINT32 NV_LIST_TERMINATOR[3]; - -//** Orderly RAM Values -// The following defines are for accessing orderly RAM values. - -// This is the initialize for the RAM reference iterator. -#define NV_RAM_REF_INIT 0 -// This is the starting address of the RAM space used for orderly data -#define RAM_ORDERLY_START \ - (&s_indexOrderlyRam[0]) -// This is the offset within NV that is used to save the orderly data on an -// orderly shutdown. -#define NV_ORDERLY_START \ - (NV_INDEX_RAM_DATA) -// This is the end of the orderly RAM space. It is actually the first byte after the -// last byte of orderly RAM data -#define RAM_ORDERLY_END \ - (RAM_ORDERLY_START + sizeof(s_indexOrderlyRam)) -// This is the end of the orderly space in NV memory. As with RAM_ORDERLY_END, it is -// actually the offset of the first byte after the end of the NV orderly data. -#define NV_ORDERLY_END \ - (NV_ORDERLY_START + sizeof(s_indexOrderlyRam)) - -// Macro to check that an orderly RAM address is with range. -#define ORDERLY_RAM_ADDRESS_OK(start, offset) \ - ((start >= RAM_ORDERLY_START) && ((start + offset - 1) < RAM_ORDERLY_END)) - - -#define RETURN_IF_NV_IS_NOT_AVAILABLE \ -{ \ - if(g_NvStatus != TPM_RC_SUCCESS) \ - return g_NvStatus; \ -} - -// Routinely have to clear the orderly flag and fail if the -// NV is not available so that it can be cleared. -#define RETURN_IF_ORDERLY \ -{ \ - if(NvClearOrderly() != TPM_RC_SUCCESS) \ - return g_NvStatus; \ -} - -#define NV_IS_AVAILABLE (g_NvStatus == TPM_RC_SUCCESS) - -#define IS_ORDERLY(value) (value < SU_DA_USED_VALUE) - -#define NV_IS_ORDERLY (IS_ORDERLY(gp.orderlyState)) - -// Macro to set the NV UPDATE_TYPE. This deals with the fact that the update is -// possibly a combination of UT_NV and UT_ORDERLY. -#define SET_NV_UPDATE(type) g_updateNV |= (type) - -#endif // _NV_H_ \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/OIDs.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/OIDs.h deleted file mode 100644 index 312ae69ff..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/OIDs.h +++ /dev/null @@ -1,275 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _OIDS_H_ -#define _OIDS_H_ - -// All the OIDs in this file are defined as DER-encoded values with a leading tag -// 0x06 (ASN1_OBJECT_IDENTIFIER), followed by a single length byte. This allows the -// OID size to be determined by looking at octet[1] of the OID (total size is -// OID[1] + 2). - -#define MAKE_OID(NAME) \ - EXTERN const BYTE OID##NAME[] INITIALIZER({OID##NAME##_VALUE}) - - -// These macros allow OIDs to be defined (or not) depending on whether the associated -// hash algorithm is implemented. -// NOTE: When one of these macros is used, the NAME needs '_" on each side. The -// exception is when the macro is used for the hash OID when only a single '_' is -// used. -#if ALG_SHA1 -#define SHA1_OID(NAME) MAKE_OID(NAME##SHA1) -#else -#define SHA1_OID(NAME) -#endif -#if ALG_SHA256 -#define SHA256_OID(NAME) MAKE_OID(NAME##SHA256) -#else -#define SHA256_OID(NAME) -#endif -#if ALG_SHA384 -#define SHA384_OID(NAME) MAKE_OID(NAME##SHA384) -#else -#define SHA#84_OID(NAME) -#endif -#if ALG_SHA512 -#define SHA512_OID(NAME) MAKE_OID(NAME##SHA512) -#else -#define SHA512_OID(NAME) -#endif -#if ALG_SM3_256 -#define SM3_256_OID(NAME) MAKE_OID(NAME##SM2_256) -#else -#define SM3_256_OID(NAME) -#endif -#if ALG_SHA3_256 -#define SHA3_256_OID(NAME) MAKE_OID(NAME##SHA3_256) -#else -#define SHA3_256_OID(NAME) -#endif -#if ALG_SHA3_384 -#define SHA3_384_OID(NAME) MAKE_OID(NAME##SHA3_384) -#else -#define SHA3_384_OID(NAME) -#endif -#if ALG_SHA3_512 -#define SSHA3_512_OID(NAME) MAKE_OID(NAME##SHA3_512) -#else -#define SHA3_512_OID(NAME) -#endif - -// These are encoded to take one additional byte of algorithm selector -#define NIST_HASH 0x06, 0x09, 0x60, 0x86, 0x48, 1, 101, 3, 4, 2 -#define NIST_SIG 0x06, 0x09, 0x60, 0x86, 0x48, 1, 101, 3, 4, 3 - -// These hash OIDs used in a lot of places. -#define OID_SHA1_VALUE 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A -SHA1_OID(_); // Expands to - // MAKE_OID(_SHA1) - // which expands to: - // extern BYTE OID_SHA1[] - // or - // const BYTE OID_SHA1[] = {OID_SHA1_VALUE} - // which is: - // const BYTE OID_SHA1[] = {0x06, 0x05, 0x2B, 0x0E, - // 0x03, 0x02, 0x1A} - - -#define OID_SHA256_VALUE NIST_HASH, 1 -SHA256_OID(_); - -#define OID_SHA384_VALUE NIST_HASH, 2 -SHA384_OID(_); - -#define OID_SHA512_VALUE NIST_HASH, 3 -SHA512_OID(_); - -#define OID_SM3_256_VALUE 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, 0x01, \ - 0x83, 0x11 -SM3_256_OID(_); // (1.2.156.10197.1.401) - -#define OID_SHA3_256_VALUE NIST_HASH, 8 -SHA3_256_OID(_); - -#define OID_SHA3_384_VALUE NIST_HASH, 9 -SHA3_384_OID(_); - -#define OID_SHA3_512_VALUE NIST_HASH, 10 -SHA3_512_OID(_); - - -// These are used for RSA-PSS -#if ALG_RSA - -#define OID_MGF1_VALUE 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, \ - 0x01, 0x01, 0x08 -MAKE_OID(_MGF1); - -#define OID_RSAPSS_VALUE 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, \ - 0x01, 0x01, 0x0A -MAKE_OID(_RSAPSS); - -// This is the OID to designate the public part of an RSA key. -#define OID_PKCS1_PUB_VALUE 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, \ - 0x01, 0x01, 0x01 -MAKE_OID(_PKCS1_PUB); - -// These are used for RSA PKCS1 signature Algorithms -#define OID_PKCS1_SHA1_VALUE 0x06,0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, \ - 0x0D, 0x01, 0x01, 0x05 -SHA1_OID(_PKCS1_); // (1.2.840.113549.1.1.5) - -#define OID_PKCS1_SHA256_VALUE 0x06,0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, \ - 0x0D, 0x01, 0x01, 0x0B -SHA256_OID(_PKCS1_); // (1.2.840.113549.1.1.11) - -#define OID_PKCS1_SHA384_VALUE 0x06,0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, \ - 0x0D, 0x01, 0x01, 0x0C -SHA384_OID(_PKCS1_); // (1.2.840.113549.1.1.12) - -#define OID_PKCS1_SHA512_VALUE 0x06,0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, \ - 0x0D, 0x01, 0x01, 0x0D -SHA512_OID(_PKCS1_); //(1.2.840.113549.1.1.13) - -#define OID_PKCS1_SM3_256_VALUE 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, \ - 0x01, 0x83, 0x78 -SM3_256_OID(_PKCS1_); // 1.2.156.10197.1.504 - -#define OID_PKCS1_SHA3_256_VALUE NIST_SIG, 14 -SHA3_256_OID(_PKCS1_); -#define OID_PKCS1_SHA3_384_VALUE NIST_SIG, 15 -SHA3_256_OID(_PKCS1_); -#define OID_PKCS1_SHA3_512_VALUE NIST_SIG, 16 -SHA3_512_OID(_PKCS1_); - - -#endif // ALG_RSA - -#if ALG_ECDSA - -#define OID_ECDSA_SHA1_VALUE 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, \ - 0x01 -SHA1_OID(_ECDSA_); // (1.2.840.10045.4.1) SHA1 digest signed by an ECDSA key. - -#define OID_ECDSA_SHA256_VALUE 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, \ - 0x03, 0x02 -SHA256_OID(_ECDSA_); // (1.2.840.10045.4.3.2) SHA256 digest signed by an ECDSA key. - -#define OID_ECDSA_SHA384_VALUE 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, \ - 0x03, 0x03 -SHA384_OID(_ECDSA_); // (1.2.840.10045.4.3.3) SHA384 digest signed by an ECDSA key. - -#define OID_ECDSA_SHA512_VALUE 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, \ - 0x03, 0x04 -SHA512_OID(_ECDSA_); // (1.2.840.10045.4.3.4) SHA512 digest signed by an ECDSA key. - -#define OID_ECDSA_SM3_256_VALUE 0x00 -SM3_256_OID(_ECDSA_); - -#define OID_ECDSA_SHA3_256_VALUE NIST_SIG, 10 -SHA3_256_OID(_ECDSA_); -#define OID_ECDSA_SHA3_384_VALUE NIST_SIG, 11 -SHA3_384_OID(_ECDSA_); -#define OID_ECDSA_SHA3_512_VALUE NIST_SIG, 12 -SHA3_512_OID(_ECDSA_); - - - -#endif // ALG_ECDSA - -#if ALG_ECC - -#define OID_ECC_PUBLIC_VALUE 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, \ - 0x01 -MAKE_OID(_ECC_PUBLIC); - - -#define OID_ECC_NIST_P192_VALUE 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, \ - 0x01, 0x01 -#if ECC_NIST_P192 -MAKE_OID(_ECC_NIST_P192); // (1.2.840.10045.3.1.1) 'nistP192' -#endif // ECC_NIST_P192 - -#define OID_ECC_NIST_P224_VALUE 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x21 -#if ECC_NIST_P224 -MAKE_OID(_ECC_NIST_P224); // (1.3.132.0.33) 'nistP224' -#endif // ECC_NIST_P224 - -#define OID_ECC_NIST_P256_VALUE 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, \ - 0x01, 0x07 -#if ECC_NIST_P256 -MAKE_OID(_ECC_NIST_P256); // (1.2.840.10045.3.1.7) 'nistP256' -#endif // ECC_NIST_P256 - -#define OID_ECC_NIST_P384_VALUE 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22 -#if ECC_NIST_P384 -MAKE_OID(_ECC_NIST_P384); // (1.3.132.0.34) 'nistP384' -#endif // ECC_NIST_P384 - -#define OID_ECC_NIST_P521_VALUE 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x23 -#if ECC_NIST_P521 -MAKE_OID(_ECC_NIST_P521); // (1.3.132.0.35) 'nistP521' -#endif // ECC_NIST_P521 - -// No OIDs defined for these anonymous curves -#define OID_ECC_BN_P256_VALUE 0x00 -#if ECC_BN_P256 -MAKE_OID(_ECC_BN_P256); -#endif // ECC_BN_P256 - -#define OID_ECC_BN_P638_VALUE 0x00 -#if ECC_BN_P638 -MAKE_OID(_ECC_BN_P638); -#endif // ECC_BN_P638 - -#define OID_ECC_SM2_P256_VALUE 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF, 0x55, 0x01, \ - 0x82, 0x2D -#if ECC_SM2_P256 -MAKE_OID(_ECC_SM2_P256); // Don't know where I found this OID. It needs checking -#endif // ECC_SM2_P256 - -#if ECC_BN_P256 -#define OID_ECC_BN_P256 NULL -#endif // ECC_BN_P256 - -#endif // ALG_ECC - -#undef MAKE_OID - - -#define OID_SIZE(OID) (OID[1] + 2) - -#endif // !_OIDS_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslHash.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslHash.h deleted file mode 100644 index 56f414464..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslHash.h +++ /dev/null @@ -1,180 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This header file is used to 'splice' the OpenSSL hash code into the TPM code. -// -#ifndef HASH_LIB_DEFINED -#define HASH_LIB_DEFINED - -#define HASH_LIB_OSSL - -#include -#include -#include - - -//*************************************************************** -//** Links to the OpenSSL HASH code -//*************************************************************** - -// Redefine the internal name used for each of the hash state structures to the -// name used by the library. -// These defines need to be known in all parts of the TPM so that the structure -// sizes can be properly computed when needed. - -#define tpmHashStateSHA1_t SHA_CTX -#define tpmHashStateSHA256_t SHA256_CTX -#define tpmHashStateSHA384_t SHA512_CTX -#define tpmHashStateSHA512_t SHA512_CTX - -#if ALG_SM3_256 -# error "The version of OpenSSL used by this code does not support SM3" -#endif - -// The defines below are only needed when compiling CryptHash.c or CryptSmac.c. -// This isolation is primarily to avoid name space collision. However, if there -// is a real collision, it will likely show up when the linker tries to put things -// together. - -#ifdef _CRYPT_HASH_C_ - -typedef BYTE *PBYTE; -typedef const BYTE *PCBYTE; - -// Define the interface between CryptHash.c to the functions provided by the -// library. For each method, define the calling parameters of the method and then -// define how the method is invoked in CryptHash.c. -// -// All hashes are required to have the same calling sequence. If they don't, create -// a simple adaptation function that converts from the "standard" form of the call -// to the form used by the specific hash (and then send a nasty letter to the -// person who wrote the hash function for the library). -// -// The macro that calls the method also defines how the -// parameters get swizzled between the default form (in CryptHash.c)and the -// library form. -// -// Initialize the hash context -#define HASH_START_METHOD_DEF void (HASH_START_METHOD)(PANY_HASH_STATE state) -#define HASH_START(hashState) \ - ((hashState)->def->method.start)(&(hashState)->state); - -// Add data to the hash -#define HASH_DATA_METHOD_DEF \ - void (HASH_DATA_METHOD)(PANY_HASH_STATE state, \ - PCBYTE buffer, \ - size_t size) -#define HASH_DATA(hashState, dInSize, dIn) \ - ((hashState)->def->method.data)(&(hashState)->state, dIn, dInSize) - -// Finalize the hash and get the digest -#define HASH_END_METHOD_DEF \ - void (HASH_END_METHOD)(BYTE *buffer, PANY_HASH_STATE state) -#define HASH_END(hashState, buffer) \ - ((hashState)->def->method.end)(buffer, &(hashState)->state) - -// Copy the hash context -// Note: For import, export, and copy, memcpy() is used since there is no -// reformatting necessary between the internal and external forms. -#define HASH_STATE_COPY_METHOD_DEF \ - void (HASH_STATE_COPY_METHOD)(PANY_HASH_STATE to, \ - PCANY_HASH_STATE from, \ - size_t size) -#define HASH_STATE_COPY(hashStateOut, hashStateIn) \ - ((hashStateIn)->def->method.copy)(&(hashStateOut)->state, \ - &(hashStateIn)->state, \ - (hashStateIn)->def->contextSize) - -// Copy (with reformatting when necessary) an internal hash structure to an -// external blob -#define HASH_STATE_EXPORT_METHOD_DEF \ - void (HASH_STATE_EXPORT_METHOD)(BYTE *to, \ - PCANY_HASH_STATE from, \ - size_t size) -#define HASH_STATE_EXPORT(to, hashStateFrom) \ - ((hashStateFrom)->def->method.copyOut) \ - (&(((BYTE *)(to))[offsetof(HASH_STATE, state)]), \ - &(hashStateFrom)->state, \ - (hashStateFrom)->def->contextSize) - -// Copy from an external blob to an internal formate (with reformatting when -// necessary -#define HASH_STATE_IMPORT_METHOD_DEF \ - void (HASH_STATE_IMPORT_METHOD)(PANY_HASH_STATE to, \ - const BYTE *from, \ - size_t size) -#define HASH_STATE_IMPORT(hashStateTo, from) \ - ((hashStateTo)->def->method.copyIn) \ - (&(hashStateTo)->state, \ - &(((const BYTE *)(from))[offsetof(HASH_STATE, state)]),\ - (hashStateTo)->def->contextSize) - - -// Function aliases. The code in CryptHash.c uses the internal designation for the -// functions. These need to be translated to the function names of the library. -#define tpmHashStart_SHA1 SHA1_Init // external name of the - // initialization method -#define tpmHashData_SHA1 SHA1_Update -#define tpmHashEnd_SHA1 SHA1_Final -#define tpmHashStateCopy_SHA1 memcpy -#define tpmHashStateExport_SHA1 memcpy -#define tpmHashStateImport_SHA1 memcpy -#define tpmHashStart_SHA256 SHA256_Init -#define tpmHashData_SHA256 SHA256_Update -#define tpmHashEnd_SHA256 SHA256_Final -#define tpmHashStateCopy_SHA256 memcpy -#define tpmHashStateExport_SHA256 memcpy -#define tpmHashStateImport_SHA256 memcpy -#define tpmHashStart_SHA384 SHA384_Init -#define tpmHashData_SHA384 SHA384_Update -#define tpmHashEnd_SHA384 SHA384_Final -#define tpmHashStateCopy_SHA384 memcpy -#define tpmHashStateExport_SHA384 memcpy -#define tpmHashStateImport_SHA384 memcpy -#define tpmHashStart_SHA512 SHA512_Init -#define tpmHashData_SHA512 SHA512_Update -#define tpmHashEnd_SHA512 SHA512_Final -#define tpmHashStateCopy_SHA512 memcpy -#define tpmHashStateExport_SHA512 memcpy -#define tpmHashStateImport_SHA512 memcpy - -#endif // _CRYPT_HASH_C_ - -#define LibHashInit() -// This definition would change if there were something to report -#define HashLibSimulationEnd() - -#endif // HASH_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h deleted file mode 100644 index 39cb472fd..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslMath.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the structure definitions used for ECC in the LibTomCrypt -// version of the code. These definitions would change, based on the library. -// The ECC-related structures that cross the TPM interface are defined -// in TpmTypes.h -// - -#ifndef MATH_LIB_DEFINED -#define MATH_LIB_DEFINED - -#define MATH_LIB_OSSL - -#include -#include -#if 0 // OPENSSL_VERSION_NUMBER >= 0x10200000L - // Check the bignum_st definition in crypto/bn/bn_lcl.h and either update the - // version check or provide the new definition for this version. -# error Untested OpenSSL version -#elif OPENSSL_VERSION_NUMBER >= 0x10100000L - // from crypto/bn/bn_lcl.h - struct bignum_st { - BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit - * chunks. */ - int top; /* Index of last used d +1. */ - /* The next are internal book keeping for bn_expand. */ - int dmax; /* Size of the d array. */ - int neg; /* one if the number is negative */ - int flags; - }; -#endif // OPENSSL_VERSION_NUMBER -#include - -//** Macros and Defines - -// Make sure that the library is using the correct size for a crypt word -#if defined THIRTY_TWO_BIT && (RADIX_BITS != 32) \ - || ((defined SIXTY_FOUR_BIT_LONG || defined SIXTY_FOUR_BIT) \ - && (RADIX_BITS != 64)) -# error Ossl library is using different radix -#endif - -// Allocate a local BIGNUM value. For the allocation, a bigNum structure is created -// as is a local BIGNUM. The bigNum is initialized and then the BIGNUM is -// set to reference the local value. -#define BIG_VAR(name, bits) \ - BN_VAR(name##Bn, (bits)); \ - BIGNUM _##name; \ - BIGNUM *name = BigInitialized(&_##name, \ - BnInit(name##Bn, \ - BYTES_TO_CRYPT_WORDS(sizeof(_##name##Bn.d)))) - -// Allocate a BIGNUM and initialize with the values in a bigNum initializer -#define BIG_INITIALIZED(name, initializer) \ - BIGNUM _##name; \ - BIGNUM *name = BigInitialized(&_##name, initializer) - - -typedef struct -{ - const ECC_CURVE_DATA *C; // the TPM curve values - EC_GROUP *G; // group parameters - BN_CTX *CTX; // the context for the math (this might not be - // the context in which the curve was created>; -} OSSL_CURVE_DATA; - -typedef OSSL_CURVE_DATA *bigCurve; - -#define AccessCurveData(E) ((E)->C) - - -#include "TpmToOsslSupport_fp.h" - -// Start and end a context within which the OpenSSL memory management works -#define OSSL_ENTER() BN_CTX *CTX = OsslContextEnter() -#define OSSL_LEAVE() OsslContextLeave(CTX) - -// Start and end a context that spans multiple ECC functions. This is used so that -// the group for the curve can persist across multiple frames. -#define CURVE_INITIALIZED(name, initializer) \ - OSSL_CURVE_DATA _##name; \ - bigCurve name = BnCurveInitialize(&_##name, initializer) -#define CURVE_FREE(name) BnCurveFree(name) - -// Start and end a local stack frame within the context of the curve frame -#define ECC_ENTER() BN_CTX *CTX = OsslPushContext(E->CTX) -#define ECC_LEAVE() OsslPopContext(CTX) - -#define BN_NEW() BnNewVariable(CTX) - -// This definition would change if there were something to report -#define MathLibSimulationEnd() - -#endif // MATH_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslSym.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslSym.h deleted file mode 100644 index e65365d7a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Ossl/TpmToOsslSym.h +++ /dev/null @@ -1,120 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This header file is used to 'splice' the OpenSSL library into the TPM code. -// -// The support required of a library are a hash module, a block cipher module and -// portions of a big number library. - -#ifndef SYM_LIB_DEFINED -#define SYM_LIB_DEFINED - -#define SYM_LIB_OSSL - -#include -#include -#include -#include - -//*************************************************************** -//** Links to the OpenSSL AES code -//*************************************************************** - -#if ALG_SM4 -#error "SM4 is not available" -#endif - -#if ALG_CAMELLIA -#error "Camellia is not available" -#endif - -// Define the order of parameters to the library functions that do block encryption -// and decryption. -typedef void(*TpmCryptSetSymKeyCall_t)( - const BYTE *in, - BYTE *out, - void *keySchedule - ); - -// The Crypt functions that call the block encryption function use the parameters -// in the order: -// 1) keySchedule -// 2) in buffer -// 3) out buffer -// Since open SSL uses the order in encryptoCall_t above, need to swizzle the -// values to the order required by the library. -#define SWIZZLE(keySchedule, in, out) \ - (const BYTE *)(in), (BYTE *)(out), (void *)(keySchedule) - -// Macros to set up the encryption/decryption key schedules -// -// AES: -#define TpmCryptSetEncryptKeyAES(key, keySizeInBits, schedule) \ - AES_set_encrypt_key((key), (keySizeInBits), (tpmKeyScheduleAES *)(schedule)) -#define TpmCryptSetDecryptKeyAES(key, keySizeInBits, schedule) \ - AES_set_decrypt_key((key), (keySizeInBits), (tpmKeyScheduleAES *)(schedule)) - -// TDES: -#define TpmCryptSetEncryptKeyTDES(key, keySizeInBits, schedule) \ - TDES_set_encrypt_key((key), (keySizeInBits), (tpmKeyScheduleTDES *)(schedule)) -#define TpmCryptSetDecryptKeyTDES(key, keySizeInBits, schedule) \ - TDES_set_encrypt_key((key), (keySizeInBits), (tpmKeyScheduleTDES *)(schedule)) - -// Macros to alias encryption calls to specific algorithms. This should be used -// sparingly. Currently, only used by CryptRand.c -// -// When using these calls, to call the AES block encryption code, the caller -// should use: -// TpmCryptEncryptAES(SWIZZLE(keySchedule, in, out)); -#define TpmCryptEncryptAES AES_encrypt -#define TpmCryptDecryptAES AES_decrypt -#define tpmKeyScheduleAES AES_KEY - - -#define TpmCryptEncryptTDES TDES_encrypt -#define TpmCryptDecryptTDES TDES_decrypt -#define tpmKeyScheduleTDES DES_key_schedule - -typedef union tpmCryptKeySchedule_t tpmCryptKeySchedule_t; - -#if ALG_TDES -#include "TpmToOsslDesSupport_fp.h" -#endif - -// This definition would change if there were something to report -#define SymLibSimulationEnd() - -#endif // SYM_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/PRNG_TestVectors.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/PRNG_TestVectors.h deleted file mode 100644 index 96c7f5b48..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/PRNG_TestVectors.h +++ /dev/null @@ -1,140 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _MSBN_DRBG_TEST_VECTORS_H -#define _MSBN_DRBG_TEST_VECTORS_H - -//#if DRBG_ALGORITHM == TPM_ALG_AES && DRBG_KEY_BITS == 256 -#if DRBG_KEY_SIZE_BITS == 256 - -/*(NIST test vector) -[AES-256 no df] -[PredictionResistance = False] -[EntropyInputLen = 384] -[NonceLen = 128] -[PersonalizationStringLen = 0] -[AdditionalInputLen = 0] - -COUNT = 0 -EntropyInput = 0d15aa80 b16c3a10 906cfedb 795dae0b 5b81041c 5c5bfacb - 373d4440 d9120f7e 3d6cf909 86cf52d8 5d3e947d 8c061f91 -Nonce = 06caef5f b538e08e 1f3b0452 03f8f4b2 -PersonalizationString = -AdditionalInput = - INTERMEDIATE Key = be5df629 34cc1230 166a6773 345bbd6b - 4c8869cf 8aec1c3b 1aa98bca 37cacf61 - INTERMEDIATE V = 3182dd1e 7638ec70 014e93bd 813e524c - INTERMEDIATE ReturnedBits = 28e0ebb8 21016650 8c8f65f2 207bd0a3 -EntropyInputReseed = 6ee793a3 3955d72a d12fd80a 8a3fcf95 ed3b4dac 5795fe25 - cf869f7c 27573bbc 56f1acae 13a65042 b340093c 464a7a22 -AdditionalInputReseed = -AdditionalInput = -ReturnedBits = 946f5182 d54510b9 461248f5 71ca06c9 -*/ - - -// Entropy is the size of the state. The state is the size of the key -// plus the IV. The IV is a block. If Key = 256 and Block = 128 then State = 384 -# define DRBG_TEST_INITIATE_ENTROPY \ - 0x0d, 0x15, 0xaa, 0x80, 0xb1, 0x6c, 0x3a, 0x10, \ - 0x90, 0x6c, 0xfe, 0xdb, 0x79, 0x5d, 0xae, 0x0b, \ - 0x5b, 0x81, 0x04, 0x1c, 0x5c, 0x5b, 0xfa, 0xcb, \ - 0x37, 0x3d, 0x44, 0x40, 0xd9, 0x12, 0x0f, 0x7e, \ - 0x3d, 0x6c, 0xf9, 0x09, 0x86, 0xcf, 0x52, 0xd8, \ - 0x5d, 0x3e, 0x94, 0x7d, 0x8c, 0x06, 0x1f, 0x91 - -# define DRBG_TEST_RESEED_ENTROPY \ - 0x6e, 0xe7, 0x93, 0xa3, 0x39, 0x55, 0xd7, 0x2a, \ - 0xd1, 0x2f, 0xd8, 0x0a, 0x8a, 0x3f, 0xcf, 0x95, \ - 0xed, 0x3b, 0x4d, 0xac, 0x57, 0x95, 0xfe, 0x25, \ - 0xcf, 0x86, 0x9f, 0x7c, 0x27, 0x57, 0x3b, 0xbc, \ - 0x56, 0xf1, 0xac, 0xae, 0x13, 0xa6, 0x50, 0x42, \ - 0xb3, 0x40, 0x09, 0x3c, 0x46, 0x4a, 0x7a, 0x22 - -# define DRBG_TEST_GENERATED_INTERM \ - 0x28, 0xe0, 0xeb, 0xb8, 0x21, 0x01, 0x66, 0x50, \ - 0x8c, 0x8f, 0x65, 0xf2, 0x20, 0x7b, 0xd0, 0xa3 - - -# define DRBG_TEST_GENERATED \ - 0x94, 0x6f, 0x51, 0x82, 0xd5, 0x45, 0x10, 0xb9, \ - 0x46, 0x12, 0x48, 0xf5, 0x71, 0xca, 0x06, 0xc9 -#elif DRBG_KEY_SIZE_BITS == 128 -/*(NIST test vector) -[AES-128 no df] -[PredictionResistance = False] -[EntropyInputLen = 256] -[NonceLen = 64] -[PersonalizationStringLen = 0] -[AdditionalInputLen = 0] - -COUNT = 0 -EntropyInput = 8fc11bdb5aabb7e093b61428e0907303cb459f3b600dad870955f22da80a44f8 -Nonce = be1f73885ddd15aa -PersonalizationString = -AdditionalInput = - INTERMEDIATE Key = b134ecc836df6dbd624900af118dd7e6 - INTERMEDIATE V = 01bb09e86dabd75c9f26dbf6f9531368 - INTERMEDIATE ReturnedBits = dc3cf6bf5bd341135f2c6811a1071c87 -EntropyInputReseed = - 0cd53cd5eccd5a10d7ea266111259b05574fc6ddd8bed8bd72378cf82f1dba2a -AdditionalInputReseed = -AdditionalInput = -ReturnedBits = b61850decfd7106d44769a8e6e8c1ad4 -*/ - -# define DRBG_TEST_INITIATE_ENTROPY \ - 0x8f, 0xc1, 0x1b, 0xdb, 0x5a, 0xab, 0xb7, 0xe0, \ - 0x93, 0xb6, 0x14, 0x28, 0xe0, 0x90, 0x73, 0x03, \ - 0xcb, 0x45, 0x9f, 0x3b, 0x60, 0x0d, 0xad, 0x87, \ - 0x09, 0x55, 0xf2, 0x2d, 0xa8, 0x0a, 0x44, 0xf8 - -# define DRBG_TEST_RESEED_ENTROPY \ - 0x0c, 0xd5, 0x3c, 0xd5, 0xec, 0xcd, 0x5a, 0x10, \ - 0xd7, 0xea, 0x26, 0x61, 0x11, 0x25, 0x9b, 0x05, \ - 0x57, 0x4f, 0xc6, 0xdd, 0xd8, 0xbe, 0xd8, 0xbd, \ - 0x72, 0x37, 0x8c, 0xf8, 0x2f, 0x1d, 0xba, 0x2a - -#define DRBG_TEST_GENERATED_INTERM \ - 0xdc, 0x3c, 0xf6, 0xbf, 0x5b, 0xd3, 0x41, 0x13, \ - 0x5f, 0x2c, 0x68, 0x11, 0xa1, 0x07, 0x1c, 0x87 - -# define DRBG_TEST_GENERATED \ - 0xb6, 0x18, 0x50, 0xde, 0xcf, 0xd7, 0x10, 0x6d, \ - 0x44, 0x76, 0x9a, 0x8e, 0x6e, 0x8c, 0x1a, 0xd4 - -#endif - - -#endif // _MSBN_DRBG_TEST_VECTORS_H \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/RsaTestData.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/RsaTestData.h deleted file mode 100644 index 9721daa35..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/RsaTestData.h +++ /dev/null @@ -1,423 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// -// RSA Test Vectors - -#define RSA_TEST_KEY_SIZE 256 - -typedef struct -{ - UINT16 size; - BYTE buffer[RSA_TEST_KEY_SIZE]; -} TPM2B_RSA_TEST_KEY; - -typedef TPM2B_RSA_TEST_KEY TPM2B_RSA_TEST_VALUE; - -typedef struct -{ - UINT16 size; - BYTE buffer[RSA_TEST_KEY_SIZE / 2]; -} TPM2B_RSA_TEST_PRIME; - -const TPM2B_RSA_TEST_KEY c_rsaPublicModulus = {256, { - 0x91,0x12,0xf5,0x07,0x9d,0x5f,0x6b,0x1c,0x90,0xf6,0xcc,0x87,0xde,0x3a,0x7a,0x15, - 0xdc,0x54,0x07,0x6c,0x26,0x8f,0x25,0xef,0x7e,0x66,0xc0,0xe3,0x82,0x12,0x2f,0xab, - 0x52,0x82,0x1e,0x85,0xbc,0x53,0xba,0x2b,0x01,0xad,0x01,0xc7,0x8d,0x46,0x4f,0x7d, - 0xdd,0x7e,0xdc,0xb0,0xad,0xf6,0x0c,0xa1,0x62,0x92,0x97,0x8a,0x3e,0x6f,0x7e,0x3e, - 0xf6,0x9a,0xcc,0xf9,0xa9,0x86,0x77,0xb6,0x85,0x43,0x42,0x04,0x13,0x65,0xe2,0xad, - 0x36,0xc9,0xbf,0xc1,0x97,0x84,0x6f,0xee,0x7c,0xda,0x58,0xd2,0xae,0x07,0x00,0xaf, - 0xc5,0x5f,0x4d,0x3a,0x98,0xb0,0xed,0x27,0x7c,0xc2,0xce,0x26,0x5d,0x87,0xe1,0xe3, - 0xa9,0x69,0x88,0x4f,0x8c,0x08,0x31,0x18,0xae,0x93,0x16,0xe3,0x74,0xde,0xd3,0xf6, - 0x16,0xaf,0xa3,0xac,0x37,0x91,0x8d,0x10,0xc6,0x6b,0x64,0x14,0x3a,0xd9,0xfc,0xe4, - 0xa0,0xf2,0xd1,0x01,0x37,0x4f,0x4a,0xeb,0xe5,0xec,0x98,0xc5,0xd9,0x4b,0x30,0xd2, - 0x80,0x2a,0x5a,0x18,0x5a,0x7d,0xd4,0x3d,0xb7,0x62,0x98,0xce,0x6d,0xa2,0x02,0x6e, - 0x45,0xaa,0x95,0x73,0xe0,0xaa,0x75,0x57,0xb1,0x3d,0x1b,0x05,0x75,0x23,0x6b,0x20, - 0x69,0x9e,0x14,0xb0,0x7f,0xac,0xae,0xd2,0xc7,0x48,0x3b,0xe4,0x56,0x11,0x34,0x1e, - 0x05,0x1a,0x30,0x20,0xef,0x68,0x93,0x6b,0x9d,0x7e,0xdd,0xba,0x96,0x50,0xcc,0x1c, - 0x81,0xb4,0x59,0xb9,0x74,0x36,0xd9,0x97,0xdc,0x8f,0x17,0x82,0x72,0xb3,0x59,0xf6, - 0x23,0xfa,0x84,0xf7,0x6d,0xf2,0x05,0xff,0xf1,0xb9,0xcc,0xe9,0xa2,0x82,0x01,0xfb}}; - -const TPM2B_RSA_TEST_PRIME c_rsaPrivatePrime = {RSA_TEST_KEY_SIZE / 2, { - 0xb7,0xa0,0x90,0xc7,0x92,0x09,0xde,0x71,0x03,0x37,0x4a,0xb5,0x2f,0xda,0x61,0xb8, - 0x09,0x1b,0xba,0x99,0x70,0x45,0xc1,0x0b,0x15,0x12,0x71,0x8a,0xb3,0x2a,0x4d,0x5a, - 0x41,0x9b,0x73,0x89,0x80,0x0a,0x8f,0x18,0x4c,0x8b,0xa2,0x5b,0xda,0xbd,0x43,0xbe, - 0xdc,0x76,0x4d,0x71,0x0f,0xb9,0xfc,0x7a,0x09,0xfe,0x4f,0xac,0x63,0xd9,0x2e,0x50, - 0x3a,0xa1,0x37,0xc6,0xf2,0xa1,0x89,0x12,0xe7,0x72,0x64,0x2b,0xba,0xc1,0x1f,0xca, - 0x9d,0xb7,0xaa,0x3a,0xa9,0xd3,0xa6,0x6f,0x73,0x02,0xbb,0x85,0x5d,0x9a,0xb9,0x5c, - 0x08,0x83,0x22,0x20,0x49,0x91,0x5f,0x4b,0x86,0xbc,0x3f,0x76,0x43,0x08,0x97,0xbf, - 0x82,0x55,0x36,0x2d,0x8b,0x6e,0x9e,0xfb,0xc1,0x67,0x6a,0x43,0xa2,0x46,0x81,0x71}}; - -const BYTE c_RsaTestValue[RSA_TEST_KEY_SIZE] = { - 0x2a,0x24,0x3a,0xbb,0x50,0x1d,0xd4,0x2a,0xf9,0x18,0x32,0x34,0xa2,0x0f,0xea,0x5c, - 0x91,0x77,0xe9,0xe1,0x09,0x83,0xdc,0x5f,0x71,0x64,0x5b,0xeb,0x57,0x79,0xa0,0x41, - 0xc9,0xe4,0x5a,0x0b,0xf4,0x9f,0xdb,0x84,0x04,0xa6,0x48,0x24,0xf6,0x3f,0x66,0x1f, - 0xa8,0x04,0x5c,0xf0,0x7a,0x6b,0x4a,0x9c,0x7e,0x21,0xb6,0xda,0x6b,0x65,0x9c,0x3a, - 0x68,0x50,0x13,0x1e,0xa4,0xb7,0xca,0xec,0xd3,0xcc,0xb2,0x9b,0x8c,0x87,0xa4,0x6a, - 0xba,0xc2,0x06,0x3f,0x40,0x48,0x7b,0xa8,0xb8,0x2c,0x03,0x14,0x33,0xf3,0x1d,0xe9, - 0xbd,0x6f,0x54,0x66,0xb4,0x69,0x5e,0xbc,0x80,0x7c,0xe9,0x6a,0x43,0x7f,0xb8,0x6a, - 0xa0,0x5f,0x5d,0x7a,0x20,0xfd,0x7a,0x39,0xe1,0xea,0x0e,0x94,0x91,0x28,0x63,0x7a, - 0xac,0xc9,0xa5,0x3a,0x6d,0x31,0x7b,0x7c,0x54,0x56,0x99,0x56,0xbb,0xb7,0xa1,0x2d, - 0xd2,0x5c,0x91,0x5f,0x1c,0xd3,0x06,0x7f,0x34,0x53,0x2f,0x4c,0xd1,0x8b,0xd2,0x9e, - 0xdc,0xc3,0x94,0x0a,0xe1,0x0f,0xa5,0x15,0x46,0x2a,0x8e,0x10,0xc2,0xfe,0xb7,0x5e, - 0x2d,0x0d,0xd1,0x25,0xfc,0xe4,0xf7,0x02,0x19,0xfe,0xb6,0xe4,0x95,0x9c,0x17,0x4a, - 0x9b,0xdb,0xab,0xc7,0x79,0xe3,0x5e,0x40,0xd0,0x56,0x6d,0x25,0x0a,0x72,0x65,0x80, - 0x92,0x9a,0xa8,0x07,0x70,0x32,0x14,0xfb,0xfe,0x08,0xeb,0x13,0xb4,0x07,0x68,0xb4, - 0x58,0x39,0xbe,0x8e,0x78,0x3a,0x59,0x3f,0x9c,0x4c,0xe9,0xa8,0x64,0x68,0xf7,0xb9, - 0x6e,0x20,0xf5,0xcb,0xca,0x47,0xf2,0x17,0xaa,0x8b,0xbc,0x13,0x14,0x84,0xf6,0xab}; - -const TPM2B_RSA_TEST_VALUE c_RsaepKvt = {RSA_TEST_KEY_SIZE, { - 0x73,0xbd,0x65,0x49,0xda,0x7b,0xb8,0x50,0x9e,0x87,0xf0,0x0a,0x8a,0x9a,0x07,0xb6, - 0x00,0x82,0x10,0x14,0x60,0xd8,0x01,0xfc,0xc5,0x18,0xea,0x49,0x5f,0x13,0xcf,0x65, - 0x66,0x30,0x6c,0x60,0x3f,0x24,0x3c,0xfb,0xe2,0x31,0x16,0x99,0x7e,0x31,0x98,0xab, - 0x93,0xb8,0x07,0x53,0xcc,0xdb,0x7f,0x44,0xd9,0xee,0x5d,0xe8,0x5f,0x97,0x5f,0xe8, - 0x1f,0x88,0x52,0x24,0x7b,0xac,0x62,0x95,0xb7,0x7d,0xf5,0xf8,0x9f,0x5a,0xa8,0x24, - 0x9a,0x76,0x71,0x2a,0x35,0x2a,0xa1,0x08,0xbb,0x95,0xe3,0x64,0xdc,0xdb,0xc2,0x33, - 0xa9,0x5f,0xbe,0x4c,0xc4,0xcc,0x28,0xc9,0x25,0xff,0xee,0x17,0x15,0x9a,0x50,0x90, - 0x0e,0x15,0xb4,0xea,0x6a,0x09,0xe6,0xff,0xa4,0xee,0xc7,0x7e,0xce,0xa9,0x73,0xe4, - 0xa0,0x56,0xbd,0x53,0x2a,0xe4,0xc0,0x2b,0xa8,0x9b,0x09,0x30,0x72,0x62,0x0f,0xf9, - 0xf6,0xa1,0x52,0xd2,0x8a,0x37,0xee,0xa5,0xc8,0x47,0xe1,0x99,0x21,0x47,0xeb,0xdd, - 0x37,0xaa,0xe4,0xbd,0x55,0x46,0x5a,0x5a,0x5d,0xfb,0x7b,0xfc,0xff,0xbf,0x26,0x71, - 0xf6,0x1e,0xad,0xbc,0xbf,0x33,0xca,0xe1,0x92,0x8f,0x2a,0x89,0x6c,0x45,0x24,0xd1, - 0xa6,0x52,0x56,0x24,0x5e,0x90,0x47,0xe5,0xcb,0x12,0xb0,0x32,0xf9,0xa6,0xbb,0xea, - 0x37,0xa9,0xbd,0xef,0x23,0xef,0x63,0x07,0x6c,0xc4,0x4e,0x64,0x3c,0xc6,0x11,0x84, - 0x7d,0x65,0xd6,0x5d,0x7a,0x17,0x58,0xa5,0xf7,0x74,0x3b,0x42,0xe3,0xd2,0xda,0x5f, - 0x6f,0xe0,0x1e,0x4b,0xcf,0x46,0xe2,0xdf,0x3e,0x41,0x8e,0x0e,0xb0,0x3f,0x8b,0x65}}; - -#define OAEP_TEST_LABEL "OAEP Test Value" - -#if ALG_SHA1_VALUE == DEFAULT_TEST_HASH - -const TPM2B_RSA_TEST_VALUE c_OaepKvt = {RSA_TEST_KEY_SIZE, { - 0x32,0x68,0x84,0x0b,0x9c,0xc9,0x25,0x26,0xd9,0xc0,0xd0,0xb1,0xde,0x60,0x55,0xae, - 0x33,0xe5,0xcf,0x6c,0x85,0xbe,0x0d,0x71,0x11,0xe1,0x45,0x60,0xbb,0x42,0x3d,0xf3, - 0xb1,0x18,0x84,0x7b,0xc6,0x5d,0xce,0x1d,0x5f,0x9a,0x97,0xcf,0xb1,0x97,0x9a,0x85, - 0x7c,0xa7,0xa1,0x63,0x23,0xb6,0x74,0x0f,0x1a,0xee,0x29,0x51,0xeb,0x50,0x8f,0x3c, - 0x8e,0x4e,0x31,0x38,0xdc,0x11,0xfc,0x9a,0x4e,0xaf,0x93,0xc9,0x7f,0x6e,0x35,0xf3, - 0xc9,0xe4,0x89,0x14,0x53,0xe2,0xc2,0x1a,0xf7,0x6b,0x9b,0xf0,0x7a,0xa4,0x69,0x52, - 0xe0,0x24,0x8f,0xea,0x31,0xa7,0x5c,0x43,0xb0,0x65,0xc9,0xfe,0xba,0xfe,0x80,0x9e, - 0xa5,0xc0,0xf5,0x8d,0xce,0x41,0xf9,0x83,0x0d,0x8e,0x0f,0xef,0x3d,0x1f,0x6a,0xcc, - 0x8a,0x3d,0x3b,0xdf,0x22,0x38,0xd7,0x34,0x58,0x7b,0x55,0xc9,0xf6,0xbc,0x7c,0x4c, - 0x3f,0xd7,0xde,0x4e,0x30,0xa9,0x69,0xf3,0x5f,0x56,0x8f,0xc2,0xe7,0x75,0x79,0xb8, - 0xa5,0xc8,0x0d,0xc0,0xcd,0xb6,0xc9,0x63,0xad,0x7c,0xe4,0x8f,0x39,0x60,0x4d,0x7d, - 0xdb,0x34,0x49,0x2a,0x47,0xde,0xc0,0x42,0x4a,0x19,0x94,0x2e,0x50,0x21,0x03,0x47, - 0xff,0x73,0xb3,0xb7,0x89,0xcc,0x7b,0x2c,0xeb,0x03,0xa7,0x9a,0x06,0xfd,0xed,0x19, - 0xbb,0x82,0xa0,0x13,0xe9,0xfa,0xac,0x06,0x5f,0xc5,0xa9,0x2b,0xda,0x88,0x23,0xa2, - 0x5d,0xc2,0x7f,0xda,0xc8,0x5a,0x94,0x31,0xc1,0x21,0xd7,0x1e,0x6b,0xd7,0x89,0xb1, - 0x93,0x80,0xab,0xd1,0x37,0xf2,0x6f,0x50,0xcd,0x2a,0xea,0xb1,0xc4,0xcd,0xcb,0xb5}}; - -const TPM2B_RSA_TEST_VALUE c_RsaesKvt = {RSA_TEST_KEY_SIZE, { - 0x29,0xa4,0x2f,0xbb,0x8a,0x14,0x05,0x1e,0x3c,0x72,0x76,0x77,0x38,0xe7,0x73,0xe3, - 0x6e,0x24,0x4b,0x38,0xd2,0x1a,0xcf,0x23,0x58,0x78,0x36,0x82,0x23,0x6e,0x6b,0xef, - 0x2c,0x3d,0xf2,0xe8,0xd6,0xc6,0x87,0x8e,0x78,0x9b,0x27,0x39,0xc0,0xd6,0xef,0x4d, - 0x0b,0xfc,0x51,0x27,0x18,0xf3,0x51,0x5e,0x4d,0x96,0x3a,0xe2,0x15,0xe2,0x7e,0x42, - 0xf4,0x16,0xd5,0xc6,0x52,0x5d,0x17,0x44,0x76,0x09,0x7a,0xcf,0xe3,0x30,0xe3,0x84, - 0xf6,0x6f,0x3a,0x33,0xfb,0x32,0x0d,0x1d,0xe7,0x7c,0x80,0x82,0x4f,0xed,0xda,0x87, - 0x11,0x9c,0xc3,0x7e,0x85,0xbd,0x18,0x58,0x08,0x2b,0x23,0x37,0xe7,0x9d,0xd0,0xd1, - 0x79,0xe2,0x05,0xbd,0xf5,0x4f,0x0e,0x0f,0xdb,0x4a,0x74,0xeb,0x09,0x01,0xb3,0xca, - 0xbd,0xa6,0x7b,0x09,0xb1,0x13,0x77,0x30,0x4d,0x87,0x41,0x06,0x57,0x2e,0x5f,0x36, - 0x6e,0xfc,0x35,0x69,0xfe,0x0a,0x24,0x6c,0x98,0x8c,0xda,0x97,0xf4,0xfb,0xc7,0x83, - 0x2d,0x3e,0x7d,0xc0,0x5c,0x34,0xfd,0x11,0x2a,0x12,0xa7,0xae,0x4a,0xde,0xc8,0x4e, - 0xcf,0xf4,0x85,0x63,0x77,0xc6,0x33,0x34,0xe0,0x27,0xe4,0x9e,0x91,0x0b,0x4b,0x85, - 0xf0,0xb0,0x79,0xaa,0x7c,0xc6,0xff,0x3b,0xbc,0x04,0x73,0xb8,0x95,0xd7,0x31,0x54, - 0x3b,0x56,0xec,0x52,0x15,0xd7,0x3e,0x62,0xf5,0x82,0x99,0x3e,0x2a,0xc0,0x4b,0x2e, - 0x06,0x57,0x6d,0x3f,0x3e,0x77,0x1f,0x2b,0x2d,0xc5,0xb9,0x3b,0x68,0x56,0x73,0x70, - 0x32,0x6b,0x6b,0x65,0x25,0x76,0x45,0x6c,0x45,0xf1,0x6c,0x59,0xfc,0x94,0xa7,0x15}}; - -const TPM2B_RSA_TEST_VALUE c_RsapssKvt = {RSA_TEST_KEY_SIZE, { - 0x01,0xfe,0xd5,0x83,0x0b,0x15,0xba,0x90,0x2c,0xdf,0xf7,0x26,0xb7,0x8f,0xb1,0xd7, - 0x0b,0xfd,0x83,0xf9,0x95,0xd5,0xd7,0xb5,0xc5,0xc5,0x4a,0xde,0xd5,0xe6,0x20,0x78, - 0xca,0x73,0x77,0x3d,0x61,0x36,0x48,0xae,0x3e,0x8f,0xee,0x43,0x29,0x96,0xdf,0x3f, - 0x1c,0x97,0x5a,0xbe,0xe5,0xa2,0x7e,0x5b,0xd0,0xc0,0x29,0x39,0x83,0x81,0x77,0x24, - 0x43,0xdb,0x3c,0x64,0x4d,0xf0,0x23,0xe4,0xae,0x0f,0x78,0x31,0x8c,0xda,0x0c,0xec, - 0xf1,0xdf,0x09,0xf2,0x14,0x6a,0x4d,0xaf,0x36,0x81,0x6e,0xbd,0xbe,0x36,0x79,0x88, - 0x98,0xb6,0x6f,0x5a,0xad,0xcf,0x7c,0xee,0xe0,0xdd,0x00,0xbe,0x59,0x97,0x88,0x00, - 0x34,0xc0,0x8b,0x48,0x42,0x05,0x04,0x5a,0xb7,0x85,0x38,0xa0,0x35,0xd7,0x3b,0x51, - 0xb8,0x7b,0x81,0x83,0xee,0xff,0x76,0x6f,0x50,0x39,0x4d,0xab,0x89,0x63,0x07,0x6d, - 0xf5,0xe5,0x01,0x10,0x56,0xfe,0x93,0x06,0x8f,0xd3,0xc9,0x41,0xab,0xc9,0xdf,0x6e, - 0x59,0xa8,0xc3,0x1d,0xbf,0x96,0x4a,0x59,0x80,0x3c,0x90,0x3a,0x59,0x56,0x4c,0x6d, - 0x44,0x6d,0xeb,0xdc,0x73,0xcd,0xc1,0xec,0xb8,0x41,0xbf,0x89,0x8c,0x03,0x69,0x4c, - 0xaf,0x3f,0xc1,0xc5,0xc7,0xe7,0x7d,0xa7,0x83,0x39,0x70,0xa2,0x6b,0x83,0xbc,0xbe, - 0xf5,0xbf,0x1c,0xee,0x6e,0xa3,0x22,0x1e,0x25,0x2f,0x16,0x68,0x69,0x5a,0x1d,0xfa, - 0x2c,0x3a,0x0f,0x67,0xe1,0x77,0x12,0xe8,0x3d,0xba,0xaa,0xef,0x96,0x9c,0x1f,0x64, - 0x32,0xf4,0xa7,0xb3,0x3f,0x7d,0x61,0xbb,0x9a,0x27,0xad,0xfb,0x2f,0x33,0xc4,0x70}}; - -const TPM2B_RSA_TEST_VALUE c_RsassaKvt = {RSA_TEST_KEY_SIZE, { - 0x67,0x4e,0xdd,0xc2,0xd2,0x6d,0xe0,0x03,0xc4,0xc2,0x41,0xd3,0xd4,0x61,0x30,0xd0, - 0xe1,0x68,0x31,0x4a,0xda,0xd9,0xc2,0x5d,0xaa,0xa2,0x7b,0xfb,0x44,0x02,0xf5,0xd6, - 0xd8,0x2e,0xcd,0x13,0x36,0xc9,0x4b,0xdb,0x1a,0x4b,0x66,0x1b,0x4f,0x9c,0xb7,0x17, - 0xac,0x53,0x37,0x4f,0x21,0xbd,0x0c,0x66,0xac,0x06,0x65,0x52,0x9f,0x04,0xf6,0xa5, - 0x22,0x5b,0xf7,0xe6,0x0d,0x3c,0x9f,0x41,0x19,0x09,0x88,0x7c,0x41,0x4c,0x2f,0x9c, - 0x8b,0x3c,0xdd,0x7c,0x28,0x78,0x24,0xd2,0x09,0xa6,0x5b,0xf7,0x3c,0x88,0x7e,0x73, - 0x5a,0x2d,0x36,0x02,0x4f,0x65,0xb0,0xcb,0xc8,0xdc,0xac,0xa2,0xda,0x8b,0x84,0x91, - 0x71,0xe4,0x30,0x8b,0xb6,0x12,0xf2,0xf0,0xd0,0xa0,0x38,0xcf,0x75,0xb7,0x20,0xcb, - 0x35,0x51,0x52,0x6b,0xc4,0xf4,0x21,0x95,0xc2,0xf7,0x9a,0x13,0xc1,0x1a,0x7b,0x8f, - 0x77,0xda,0x19,0x48,0xbb,0x6d,0x14,0x5d,0xba,0x65,0xb4,0x9e,0x43,0x42,0x58,0x98, - 0x0b,0x91,0x46,0xd8,0x4c,0xf3,0x4c,0xaf,0x2e,0x02,0xa6,0xb2,0x49,0x12,0x62,0x43, - 0x4e,0xa8,0xac,0xbf,0xfd,0xfa,0x37,0x24,0xea,0x69,0x1c,0xf5,0xae,0xfa,0x08,0x82, - 0x30,0xc3,0xc0,0xf8,0x9a,0x89,0x33,0xe1,0x40,0x6d,0x18,0x5c,0x7b,0x90,0x48,0xbf, - 0x37,0xdb,0xea,0xfb,0x0e,0xd4,0x2e,0x11,0xfa,0xa9,0x86,0xff,0x00,0x0b,0x7b,0xca, - 0x09,0x64,0x6a,0x8f,0x0c,0x0e,0x09,0x14,0x36,0x4a,0x74,0x31,0x18,0x5b,0x18,0xeb, - 0xea,0x83,0xc3,0x66,0x68,0xa6,0x7d,0x43,0x06,0x0f,0x99,0x60,0xce,0x65,0x08,0xf6}}; - -#endif // SHA1 - -#if ALG_SHA256_VALUE == DEFAULT_TEST_HASH - -const TPM2B_RSA_TEST_VALUE c_OaepKvt = {RSA_TEST_KEY_SIZE, { - 0x33,0x20,0x6e,0x21,0xc3,0xf6,0xcd,0xf8,0xd7,0x5d,0x9f,0xe9,0x05,0x14,0x8c,0x7c, - 0xbb,0x69,0x24,0x9e,0x52,0x8f,0xaf,0x84,0x73,0x21,0x2c,0x85,0xa5,0x30,0x4d,0xb6, - 0xb8,0xfa,0x15,0x9b,0xc7,0x8f,0xc9,0x7a,0x72,0x4b,0x85,0xa4,0x1c,0xc5,0xd8,0xe4, - 0x92,0xb3,0xec,0xd9,0xa8,0xca,0x5e,0x74,0x73,0x89,0x7f,0xb4,0xac,0x7e,0x68,0x12, - 0xb2,0x53,0x27,0x4b,0xbf,0xd0,0x71,0x69,0x46,0x9f,0xef,0xf4,0x70,0x60,0xf8,0xd7, - 0xae,0xc7,0x5a,0x27,0x38,0x25,0x2d,0x25,0xab,0x96,0x56,0x66,0x3a,0x23,0x40,0xa8, - 0xdb,0xbc,0x86,0xe8,0xf3,0xd2,0x58,0x0b,0x44,0xfc,0x94,0x1e,0xb7,0x5d,0xb4,0x57, - 0xb5,0xf3,0x56,0xee,0x9b,0xcf,0x97,0x91,0x29,0x36,0xe3,0x06,0x13,0xa2,0xea,0xd6, - 0xd6,0x0b,0x86,0x0b,0x1a,0x27,0xe6,0x22,0xc4,0x7b,0xff,0xde,0x0f,0xbf,0x79,0xc8, - 0x1b,0xed,0xf1,0x27,0x62,0xb5,0x8b,0xf9,0xd9,0x76,0x90,0xf6,0xcc,0x83,0x0f,0xce, - 0xce,0x2e,0x63,0x7a,0x9b,0xf4,0x48,0x5b,0xd7,0x81,0x2c,0x3a,0xdb,0x59,0x0d,0x4d, - 0x9e,0x46,0xe9,0x9e,0x92,0x22,0x27,0x1c,0xb0,0x67,0x8a,0xe6,0x8a,0x16,0x8a,0xdf, - 0x95,0x76,0x24,0x82,0xad,0xf1,0xbc,0x97,0xbf,0xd3,0x5e,0x6e,0x14,0x0c,0x5b,0x25, - 0xfe,0x58,0xfa,0x64,0xe5,0x14,0x46,0xb7,0x58,0xc6,0x3f,0x7f,0x42,0xd2,0x8e,0x45, - 0x13,0x41,0x85,0x12,0x2e,0x96,0x19,0xd0,0x5e,0x7d,0x34,0x06,0x32,0x2b,0xc8,0xd9, - 0x0d,0x6c,0x06,0x36,0xa0,0xff,0x47,0x57,0x2c,0x25,0xbc,0x8a,0xa5,0xe2,0xc7,0xe3}}; - -const TPM2B_RSA_TEST_VALUE c_RsaesKvt = {RSA_TEST_KEY_SIZE, { - 0x39,0xfc,0x10,0x5d,0xf4,0x45,0x3d,0x94,0x53,0x06,0x89,0x24,0xe7,0xe8,0xfd,0x03, - 0xac,0xfd,0xbd,0xb2,0x28,0xd3,0x4a,0x52,0xc5,0xd4,0xdb,0x17,0xd4,0x24,0x05,0xc4, - 0xeb,0x6a,0xce,0x1d,0xbb,0x37,0xcb,0x09,0xd8,0x6c,0x83,0x19,0x93,0xd4,0xe2,0x88, - 0x88,0x9b,0xaf,0x92,0x16,0xc4,0x15,0xbd,0x49,0x13,0x22,0xb7,0x84,0xcf,0x23,0xf2, - 0x6f,0x0c,0x3e,0x8f,0xde,0x04,0x09,0x31,0x2d,0x99,0xdf,0xe6,0x74,0x70,0x30,0xde, - 0x8c,0xad,0x32,0x86,0xe2,0x7c,0x12,0x90,0x21,0xf3,0x86,0xb7,0xe2,0x64,0xca,0x98, - 0xcc,0x64,0x4b,0xef,0x57,0x4f,0x5a,0x16,0x6e,0xd7,0x2f,0x5b,0xf6,0x07,0xad,0x33, - 0xb4,0x8f,0x3b,0x3a,0x8b,0xd9,0x06,0x2b,0xed,0x3c,0x3c,0x76,0xf6,0x21,0x31,0xe3, - 0xfb,0x2c,0x45,0x61,0x42,0xba,0xe0,0xc3,0x72,0x63,0xd0,0x6b,0x8f,0x36,0x26,0xfb, - 0x9e,0x89,0x0e,0x44,0x9a,0xc1,0x84,0x5e,0x84,0x8d,0xb6,0xea,0xf1,0x0d,0x66,0xc7, - 0xdb,0x44,0xbd,0x19,0x7c,0x05,0xbe,0xc4,0xab,0x88,0x32,0xbe,0xc7,0x63,0x31,0xe6, - 0x38,0xd4,0xe5,0xb8,0x4b,0xf5,0x0e,0x55,0x9a,0x3a,0xe6,0x0a,0xec,0xee,0xe2,0xa8, - 0x88,0x04,0xf2,0xb8,0xaa,0x5a,0xd8,0x97,0x5d,0xa0,0xa8,0x42,0xfb,0xd9,0xde,0x80, - 0xae,0x4c,0xb3,0xa1,0x90,0x47,0x57,0x03,0x10,0x78,0xa6,0x8f,0x11,0xba,0x4b,0xce, - 0x2d,0x56,0xa4,0xe1,0xbd,0xf8,0xa0,0xa4,0xd5,0x48,0x3c,0x63,0x20,0x00,0x38,0xa0, - 0xd1,0xe6,0x12,0xe9,0x1d,0xd8,0x49,0xe3,0xd5,0x24,0xb5,0xc5,0x3a,0x1f,0xb0,0xd4}}; - -const TPM2B_RSA_TEST_VALUE c_RsapssKvt = {RSA_TEST_KEY_SIZE, { - 0x74,0x89,0x29,0x3e,0x1b,0xac,0xc6,0x85,0xca,0xf0,0x63,0x43,0x30,0x7d,0x1c,0x9b, - 0x2f,0xbd,0x4d,0x69,0x39,0x5e,0x85,0xe2,0xef,0x86,0x0a,0xc6,0x6b,0xa6,0x08,0x19, - 0x6c,0x56,0x38,0x24,0x55,0x92,0x84,0x9b,0x1b,0x8b,0x04,0xcf,0x24,0x14,0x24,0x13, - 0x0e,0x8b,0x82,0x6f,0x96,0xc8,0x9a,0x68,0xfc,0x4c,0x02,0xf0,0xdc,0xcd,0x36,0x25, - 0x31,0xd5,0x82,0xcf,0xc9,0x69,0x72,0xf6,0x1d,0xab,0x68,0x20,0x2e,0x2d,0x19,0x49, - 0xf0,0x2e,0xad,0xd2,0xda,0xaf,0xff,0xb6,0x92,0x83,0x5b,0x8a,0x06,0x2d,0x0c,0x32, - 0x11,0x32,0x3b,0x77,0x17,0xf6,0x50,0xfb,0xf8,0x57,0xc9,0xc7,0x9b,0x9e,0xc6,0xd1, - 0xa9,0x55,0xf0,0x22,0x35,0xda,0xca,0x3c,0x8e,0xc6,0x9a,0xd8,0x25,0xc8,0x5e,0x93, - 0x0d,0xaa,0xa7,0x06,0xaf,0x11,0x29,0x99,0xe7,0x7c,0xee,0x49,0x82,0x30,0xba,0x2c, - 0xe2,0x40,0x8f,0x0a,0xa6,0x7b,0x24,0x75,0xc5,0xcd,0x03,0x12,0xf4,0xb2,0x4b,0x3a, - 0xd1,0x91,0x3c,0x20,0x0e,0x58,0x2b,0x31,0xf8,0x8b,0xee,0xbc,0x1f,0x95,0x35,0x58, - 0x6a,0x73,0xee,0x99,0xb0,0x01,0x42,0x4f,0x66,0xc0,0x66,0xbb,0x35,0x86,0xeb,0xd9, - 0x7b,0x55,0x77,0x2d,0x54,0x78,0x19,0x49,0xe8,0xcc,0xfd,0xb1,0xcb,0x49,0xc9,0xea, - 0x20,0xab,0xed,0xb5,0xed,0xfe,0xb2,0xb5,0xa8,0xcf,0x05,0x06,0xd5,0x7d,0x2b,0xbb, - 0x0b,0x65,0x6b,0x2b,0x6d,0x55,0x95,0x85,0x44,0x8b,0x12,0x05,0xf3,0x4b,0xd4,0x8e, - 0x3d,0x68,0x2d,0x29,0x9c,0x05,0x79,0xd6,0xfc,0x72,0x90,0x6a,0xab,0x46,0x38,0x81}}; - -const TPM2B_RSA_TEST_VALUE c_RsassaKvt = {RSA_TEST_KEY_SIZE, { - 0x8a,0xb1,0x0a,0xb5,0xe4,0x02,0xf7,0xdd,0x45,0x2a,0xcc,0x2b,0x6b,0x8c,0x0e,0x9a, - 0x92,0x4f,0x9b,0xc5,0xe4,0x8b,0x82,0xb9,0xb0,0xd9,0x87,0x8c,0xcb,0xf0,0xb0,0x59, - 0xa5,0x92,0x21,0xa0,0xa7,0x61,0x5c,0xed,0xa8,0x6e,0x22,0x29,0x46,0xc7,0x86,0x37, - 0x4b,0x1b,0x1e,0x94,0x93,0xc8,0x4c,0x17,0x7a,0xae,0x59,0x91,0xf8,0x83,0x84,0xc4, - 0x8c,0x38,0xc2,0x35,0x0e,0x7e,0x50,0x67,0x76,0xe7,0xd3,0xec,0x6f,0x0d,0xa0,0x5c, - 0x2f,0x0a,0x80,0x28,0xd3,0xc5,0x7d,0x2d,0x1a,0x0b,0x96,0xd6,0xe5,0x98,0x05,0x8c, - 0x4d,0xa0,0x1f,0x8c,0xb6,0xfb,0xb1,0xcf,0xe9,0xcb,0x38,0x27,0x60,0x64,0x17,0xca, - 0xf4,0x8b,0x61,0xb7,0x1d,0xb6,0x20,0x9d,0x40,0x2a,0x1c,0xfd,0x55,0x40,0x4b,0x95, - 0x39,0x52,0x18,0x3b,0xab,0x44,0xe8,0x83,0x4b,0x7c,0x47,0xfb,0xed,0x06,0x9c,0xcd, - 0x4f,0xba,0x81,0xd6,0xb7,0x31,0xcf,0x5c,0x23,0xf8,0x25,0xab,0x95,0x77,0x0a,0x8f, - 0x46,0xef,0xfb,0x59,0xb8,0x04,0xd7,0x1e,0xf5,0xaf,0x6a,0x1a,0x26,0x9b,0xae,0xf4, - 0xf5,0x7f,0x84,0x6f,0x3c,0xed,0xf8,0x24,0x0b,0x43,0xd1,0xba,0x74,0x89,0x4e,0x39, - 0xfe,0xab,0xa5,0x16,0xa5,0x28,0xee,0x96,0x84,0x3e,0x16,0x6d,0x5f,0x4e,0x0b,0x7d, - 0x94,0x16,0x1b,0x8c,0xf9,0xaa,0x9b,0xc0,0x49,0x02,0x4c,0x3e,0x62,0xff,0xfe,0xa2, - 0x20,0x33,0x5e,0xa6,0xdd,0xda,0x15,0x2d,0xb7,0xcd,0xda,0xff,0xb1,0x0b,0x45,0x7b, - 0xd3,0xa0,0x42,0x29,0xab,0xa9,0x73,0xe9,0xa4,0xd9,0x8d,0xac,0xa1,0x88,0x2c,0x2d}}; - -#endif // SHA256 - -#if ALG_SHA384_VALUE == DEFAULT_TEST_HASH - -const TPM2B_RSA_TEST_VALUE c_OaepKvt = {RSA_TEST_KEY_SIZE, { - 0x0f,0x3c,0x42,0x4d,0x8c,0x91,0x96,0x05,0x3c,0xfd,0x59,0x3b,0x7f,0x29,0xbc,0x03, - 0x67,0xc1,0xff,0x74,0xe7,0x09,0xf4,0x13,0x45,0xbe,0x13,0x1d,0xc9,0x86,0x94,0xfe, - 0xed,0xa6,0xe8,0x3a,0xcb,0x89,0x4d,0xec,0x86,0x63,0x4c,0xdb,0xf1,0x95,0xee,0xc1, - 0x46,0xc5,0x3b,0xd8,0xf8,0xa2,0x41,0x6a,0x60,0x8b,0x9e,0x5e,0x7f,0x20,0x16,0xe3, - 0x69,0xb6,0x2d,0x92,0xfc,0x60,0xa2,0x74,0x88,0xd5,0xc7,0xa6,0xd1,0xff,0xe3,0x45, - 0x02,0x51,0x39,0xd9,0xf3,0x56,0x0b,0x91,0x80,0xe0,0x6c,0xa8,0xc3,0x78,0xef,0x34, - 0x22,0x8c,0xf5,0xfb,0x47,0x98,0x5d,0x57,0x8e,0x3a,0xb9,0xff,0x92,0x04,0xc7,0xc2, - 0x6e,0xfa,0x14,0xc1,0xb9,0x68,0x15,0x5c,0x12,0xe8,0xa8,0xbe,0xea,0xe8,0x8d,0x9b, - 0x48,0x28,0x35,0xdb,0x4b,0x52,0xc1,0x2d,0x85,0x47,0x83,0xd0,0xe9,0xae,0x90,0x6e, - 0x65,0xd4,0x34,0x7f,0x81,0xce,0x69,0xf0,0x96,0x62,0xf7,0xec,0x41,0xd5,0xc2,0xe3, - 0x4b,0xba,0x9c,0x8a,0x02,0xce,0xf0,0x5d,0x14,0xf7,0x09,0x42,0x8e,0x4a,0x27,0xfe, - 0x3e,0x66,0x42,0x99,0x03,0xe1,0x69,0xbd,0xdb,0x7f,0x9b,0x70,0xeb,0x4e,0x9c,0xac, - 0x45,0x67,0x91,0x9f,0x75,0x10,0xc6,0xfc,0x14,0xe1,0x28,0xc1,0x0e,0xe0,0x7e,0xc0, - 0x5c,0x1d,0xee,0xe8,0xff,0x45,0x79,0x51,0x86,0x08,0xe6,0x39,0xac,0xb5,0xfd,0xb8, - 0xf1,0xdd,0x2e,0xf4,0xb2,0x1a,0x69,0x0d,0xd9,0x98,0x8e,0xdb,0x85,0x61,0x70,0x20, - 0x82,0x91,0x26,0x87,0x80,0xc4,0x6a,0xd8,0x3b,0x91,0x4d,0xd3,0x33,0x84,0xad,0xb7}}; - -const TPM2B_RSA_TEST_VALUE c_RsaesKvt = {RSA_TEST_KEY_SIZE, { - 0x44,0xd5,0x9f,0xbc,0x48,0x03,0x3d,0x9f,0x22,0x91,0x2a,0xab,0x3c,0x31,0x71,0xab, - 0x86,0x3f,0x0f,0x6f,0x59,0x5b,0x93,0x27,0xbc,0xbc,0xcd,0x29,0x38,0x43,0x2a,0x3b, - 0x3b,0xd2,0xb3,0x45,0x40,0xba,0x15,0xb4,0x45,0xe3,0x56,0xab,0xff,0xb3,0x20,0x26, - 0x39,0xcc,0x48,0xc5,0x5d,0x41,0x0d,0x2f,0x57,0x7f,0x9d,0x16,0x2e,0x26,0x57,0xc7, - 0x6b,0xf3,0x36,0x54,0xbd,0xb6,0x1d,0x46,0x4e,0x13,0x50,0xd7,0x61,0x9d,0x8d,0x7b, - 0xeb,0x21,0x9f,0x79,0xf3,0xfd,0xe0,0x1b,0xa8,0xed,0x6d,0x29,0x33,0x0d,0x65,0x94, - 0x24,0x1e,0x62,0x88,0x6b,0x2b,0x4e,0x39,0xf5,0x80,0x39,0xca,0x76,0x95,0xbc,0x7c, - 0x27,0x1d,0xdd,0x3a,0x11,0xf1,0x3e,0x54,0x03,0xb7,0x43,0x91,0x99,0x33,0xfe,0x9d, - 0x14,0x2c,0x87,0x9a,0x95,0x18,0x1f,0x02,0x04,0x6a,0xe2,0xb7,0x81,0x14,0x13,0x45, - 0x16,0xfb,0xe4,0xb7,0x8f,0xab,0x2b,0xd7,0x60,0x34,0x8a,0x55,0xbc,0x01,0x8c,0x49, - 0x02,0x29,0xf1,0x9c,0x94,0x98,0x44,0xd0,0x94,0xcb,0xd4,0x85,0x4c,0x3b,0x77,0x72, - 0x99,0xd5,0x4b,0xc6,0x3b,0xe4,0xd2,0xc8,0xe9,0x6a,0x23,0x18,0x3b,0x3b,0x5e,0x32, - 0xec,0x70,0x84,0x5d,0xbb,0x6a,0x8f,0x0c,0x5f,0x55,0xa5,0x30,0x34,0x48,0xbb,0xc2, - 0xdf,0x12,0xb9,0x81,0xad,0x36,0x3f,0xf0,0x24,0x16,0x48,0x04,0x4a,0x7f,0xfd,0x9f, - 0x4c,0xea,0xfe,0x1d,0x83,0xd0,0x81,0xad,0x25,0x6c,0x5f,0x45,0x36,0x91,0xf0,0xd5, - 0x8b,0x53,0x0a,0xdf,0xec,0x9f,0x04,0x58,0xc4,0x35,0xa0,0x78,0x1f,0x68,0xe0,0x22}}; - -const TPM2B_RSA_TEST_VALUE c_RsapssKvt = {RSA_TEST_KEY_SIZE, { - 0x3f,0x3a,0x82,0x6d,0x42,0xe3,0x8b,0x4f,0x45,0x9c,0xda,0x6c,0xbe,0xbe,0xcd,0x00, - 0x98,0xfb,0xbe,0x59,0x30,0xc6,0x3c,0xaa,0xb3,0x06,0x27,0xb5,0xda,0xfa,0xb2,0xc3, - 0x43,0xb7,0xbd,0xe9,0xd3,0x23,0xed,0x80,0xce,0x74,0xb3,0xb8,0x77,0x8d,0xe6,0x8d, - 0x3c,0xe5,0xf5,0xd7,0x80,0xcf,0x38,0x55,0x76,0xd7,0x87,0xa8,0xd6,0x3a,0xcf,0xfd, - 0xd8,0x91,0x65,0xab,0x43,0x66,0x50,0xb7,0x9a,0x13,0x6b,0x45,0x80,0x76,0x86,0x22, - 0x27,0x72,0xf7,0xbb,0x65,0x22,0x5c,0x55,0x60,0xd8,0x84,0x9f,0xf2,0x61,0x52,0xac, - 0xf2,0x4f,0x5b,0x7b,0x21,0xe1,0xf5,0x4b,0x8f,0x01,0xf2,0x4b,0xcf,0xd3,0xfb,0x74, - 0x5e,0x6e,0x96,0xb4,0xa8,0x0f,0x01,0x9b,0x26,0x54,0x0a,0x70,0x55,0x26,0xb7,0x0b, - 0xe8,0x01,0x68,0x66,0x0d,0x6f,0xb5,0xfc,0x66,0xbd,0x9e,0x44,0xed,0x6a,0x1e,0x3c, - 0x3b,0x61,0x5d,0xe8,0xdb,0x99,0x5b,0x67,0xbf,0x94,0xfb,0xe6,0x8c,0x4b,0x07,0xcb, - 0x43,0x3a,0x0d,0xb1,0x1b,0x10,0x66,0x81,0xe2,0x0d,0xe7,0xd1,0xca,0x85,0xa7,0x50, - 0x82,0x2d,0xbf,0xed,0xcf,0x43,0x6d,0xdb,0x2c,0x7b,0x73,0x20,0xfe,0x73,0x3f,0x19, - 0xc6,0xdb,0x69,0xb8,0xc3,0xd3,0xf4,0xe5,0x64,0xf8,0x36,0x8e,0xd5,0xd8,0x09,0x2a, - 0x5f,0x26,0x70,0xa1,0xd9,0x5b,0x14,0xf8,0x22,0xe9,0x9d,0x22,0x51,0xf4,0x52,0xc1, - 0x6f,0x53,0xf5,0xca,0x0d,0xda,0x39,0x8c,0x29,0x42,0xe8,0x58,0x89,0xbb,0xd1,0x2e, - 0xc5,0xdb,0x86,0x8d,0xaf,0xec,0x58,0x36,0x8d,0x8d,0x57,0x23,0xd5,0xdd,0xb9,0x24}}; - -const TPM2B_RSA_TEST_VALUE c_RsassaKvt = {RSA_TEST_KEY_SIZE, { - 0x39,0x10,0x58,0x7d,0x6d,0xa8,0xd5,0x90,0x07,0xd6,0x2b,0x13,0xe9,0xd8,0x93,0x7e, - 0xf3,0x5d,0x71,0xe0,0xf0,0x33,0x3a,0x4a,0x22,0xf3,0xe6,0x95,0xd3,0x8e,0x8c,0x41, - 0xe7,0xb3,0x13,0xde,0x4a,0x45,0xd3,0xd1,0xfb,0xb1,0x3f,0x9b,0x39,0xa5,0x50,0x58, - 0xef,0xb6,0x3a,0x43,0xdd,0x54,0xab,0xda,0x9d,0x32,0x49,0xe4,0x57,0x96,0xe5,0x1b, - 0x1d,0x8f,0x33,0x8e,0x07,0x67,0x56,0x14,0xc1,0x18,0x78,0xa2,0x52,0xe6,0x2e,0x07, - 0x81,0xbe,0xd8,0xca,0x76,0x63,0x68,0xc5,0x47,0xa2,0x92,0x5e,0x4c,0xfd,0x14,0xc7, - 0x46,0x14,0xbe,0xc7,0x85,0xef,0xe6,0xb8,0x46,0xcb,0x3a,0x67,0x66,0x89,0xc6,0xee, - 0x9d,0x64,0xf5,0x0d,0x09,0x80,0x9a,0x6f,0x0e,0xeb,0xe4,0xb9,0xe9,0xab,0x90,0x4f, - 0xe7,0x5a,0xc8,0xca,0xf6,0x16,0x0a,0x82,0xbd,0xb7,0x76,0x59,0x08,0x2d,0xd9,0x40, - 0x5d,0xaa,0xa5,0xef,0xfb,0xe3,0x81,0x2c,0x2c,0x5c,0xa8,0x16,0xbd,0x63,0x20,0xc2, - 0x4d,0x3b,0x51,0xaa,0x62,0x1f,0x06,0xe5,0xbb,0x78,0x44,0x04,0x0c,0x5c,0xe1,0x1b, - 0x6b,0x9d,0x21,0x10,0xaf,0x48,0x48,0x98,0x97,0x77,0xc2,0x73,0xb4,0x98,0x64,0xcc, - 0x94,0x2c,0x29,0x28,0x45,0x36,0xd1,0xc5,0xd0,0x2f,0x97,0x27,0x92,0x65,0x22,0xbb, - 0x63,0x79,0xea,0xf5,0xff,0x77,0x0f,0x4b,0x56,0x8a,0x9f,0xad,0x1a,0x97,0x67,0x39, - 0x69,0xb8,0x4c,0x6c,0xc2,0x56,0xc5,0x7a,0xa8,0x14,0x5a,0x24,0x7a,0xa4,0x6e,0x55, - 0xb2,0x86,0x1d,0xf4,0x62,0x5a,0x2d,0x87,0x6d,0xde,0x99,0x78,0x2d,0xef,0xd7,0xdc}}; - -#endif // SHA384 - -#if ALG_SHA512_VALUE == DEFAULT_TEST_HASH - -const TPM2B_RSA_TEST_VALUE c_OaepKvt = {RSA_TEST_KEY_SIZE, { - 0x48,0x45,0xa7,0x70,0xb2,0x41,0xb7,0x48,0x5e,0x79,0x8c,0xdf,0x1c,0xc6,0x7e,0xbb, - 0x11,0x80,0x82,0x52,0xbf,0x40,0x3d,0x90,0x03,0x6e,0x20,0x3a,0xb9,0x65,0xc8,0x51, - 0x4c,0xbd,0x9c,0xa9,0x43,0x89,0xd0,0x57,0x0c,0xa3,0x69,0x22,0x7e,0x82,0x2a,0x1c, - 0x1d,0x5a,0x80,0x84,0x81,0xbb,0x5e,0x5e,0xd0,0xc1,0x66,0x9a,0xac,0x00,0xba,0x14, - 0xa2,0xe9,0xd0,0x3a,0x89,0x5a,0x63,0xe2,0xec,0x92,0x05,0xf4,0x47,0x66,0x12,0x7f, - 0xdb,0xa7,0x3c,0x5b,0x67,0xe1,0x55,0xca,0x0a,0x27,0xbf,0x39,0x89,0x11,0x05,0xba, - 0x9b,0x5a,0x9b,0x65,0x44,0xad,0x78,0xcf,0x8f,0x94,0xf6,0x9a,0xb4,0x52,0x39,0x0e, - 0x00,0xba,0xbc,0xe0,0xbd,0x6f,0x81,0x2d,0x76,0x42,0x66,0x70,0x07,0x77,0xbf,0x09, - 0x88,0x2a,0x0c,0xb1,0x56,0x3e,0xee,0xfd,0xdc,0xb6,0x3c,0x0d,0xc5,0xa4,0x0d,0x10, - 0x32,0x80,0x3e,0x1e,0xfe,0x36,0x8f,0xb5,0x42,0xc1,0x21,0x7b,0xdf,0xdf,0x4a,0xd2, - 0x68,0x0c,0x01,0x9f,0x4a,0xfd,0xd4,0xec,0xf7,0x49,0x06,0xab,0xed,0xc6,0xd5,0x1b, - 0x63,0x76,0x38,0xc8,0x6c,0xc7,0x4f,0xcb,0x29,0x8a,0x0e,0x6f,0x33,0xaf,0x69,0x31, - 0x8e,0xa7,0xdd,0x9a,0x36,0xde,0x9b,0xf1,0x0b,0xfb,0x20,0xa0,0x6d,0x33,0x31,0xc9, - 0x9e,0xb4,0x2e,0xc5,0x40,0x0e,0x60,0x71,0x36,0x75,0x05,0xf9,0x37,0xe0,0xca,0x8e, - 0x8f,0x56,0xe0,0xea,0x9b,0xeb,0x17,0xf3,0xca,0x40,0xc3,0x48,0x01,0xba,0xdc,0xc6, - 0x4b,0x2b,0x5b,0x7b,0x5c,0x81,0xa6,0xbb,0xc7,0x43,0xc0,0xbe,0xc0,0x30,0x7b,0x55}}; - -const TPM2B_RSA_TEST_VALUE c_RsaesKvt = {RSA_TEST_KEY_SIZE, { - 0x74,0x83,0xfa,0x52,0x65,0x50,0x68,0xd0,0x82,0x05,0x72,0x70,0x78,0x1c,0xac,0x10, - 0x23,0xc5,0x07,0xf8,0x93,0xd2,0xeb,0x65,0x87,0xbb,0x47,0xc2,0xfb,0x30,0x9e,0x61, - 0x4c,0xac,0x04,0x57,0x5a,0x7c,0xeb,0x29,0x08,0x84,0x86,0x89,0x1e,0x8f,0x07,0x32, - 0xa3,0x8b,0x70,0xe7,0xa2,0x9f,0x9c,0x42,0x71,0x3d,0x23,0x59,0x82,0x5e,0x8a,0xde, - 0xd6,0xfb,0xd8,0xc5,0x8b,0xc0,0xdb,0x10,0x38,0x87,0xd3,0xbf,0x04,0xb0,0x66,0xb9, - 0x85,0x81,0x54,0x4c,0x69,0xdc,0xba,0x78,0xf3,0x4a,0xdb,0x25,0xa2,0xf2,0x34,0x55, - 0xdd,0xaa,0xa5,0xc4,0xed,0x55,0x06,0x0e,0x2a,0x30,0x77,0xab,0x82,0x79,0xf0,0xcd, - 0x9d,0x6f,0x09,0xa0,0xc8,0x82,0xc9,0xe0,0x61,0xda,0x40,0xcd,0x17,0x59,0xc0,0xef, - 0x95,0x6d,0xa3,0x6d,0x1c,0x2b,0xee,0x24,0xef,0xd8,0x4a,0x55,0x6c,0xd6,0x26,0x42, - 0x32,0x17,0xfd,0x6a,0xb3,0x4f,0xde,0x07,0x2f,0x10,0xd4,0xac,0x14,0xea,0x89,0x68, - 0xcc,0xd3,0x07,0xb7,0xcf,0xba,0x39,0x20,0x63,0x20,0x7b,0x44,0x8b,0x48,0x60,0x5d, - 0x3a,0x2a,0x0a,0xe9,0x68,0xab,0x15,0x46,0x27,0x64,0xb5,0x82,0x06,0x29,0xe7,0x25, - 0xca,0x46,0x48,0x6e,0x2a,0x34,0x57,0x4b,0x81,0x75,0xae,0xb6,0xfd,0x6f,0x51,0x5f, - 0x04,0x59,0xc7,0x15,0x1f,0xe0,0x68,0xf7,0x36,0x2d,0xdf,0xc8,0x9d,0x05,0x27,0x2d, - 0x3f,0x2b,0x59,0x5d,0xcb,0xf3,0xc4,0x92,0x6e,0x00,0xa8,0x8d,0xd0,0x69,0xe5,0x59, - 0xda,0xba,0x4f,0x38,0xf5,0xa0,0x8b,0xf1,0x73,0xe9,0x0d,0xee,0x64,0xe5,0xa2,0xd8}}; - -const TPM2B_RSA_TEST_VALUE c_RsapssKvt = {RSA_TEST_KEY_SIZE, { - 0x1b,0xca,0x8b,0x18,0x15,0x3b,0x95,0x5b,0x0a,0x89,0x10,0x03,0x7f,0x7c,0xa0,0xc9, - 0x66,0x57,0x86,0x6a,0xc9,0xeb,0x82,0x71,0xf3,0x8d,0x6f,0xa9,0xa4,0x2d,0xd0,0x22, - 0xdf,0xe9,0xc6,0x71,0x5b,0xf4,0x27,0x38,0x5b,0x2c,0x8a,0x54,0xcc,0x85,0x11,0x69, - 0x6d,0x6f,0x42,0xe7,0x22,0xcb,0xd6,0xad,0x1a,0xc5,0xab,0x6a,0xa5,0xfc,0xa5,0x70, - 0x72,0x4a,0x62,0x25,0xd0,0xa2,0x16,0x61,0xab,0xac,0x31,0xa0,0x46,0x24,0x4f,0xdd, - 0x9a,0x36,0x55,0xb6,0x00,0x9e,0x23,0x50,0x0d,0x53,0x01,0xb3,0x46,0x56,0xb2,0x1d, - 0x33,0x5b,0xca,0x41,0x7f,0x65,0x7e,0x00,0x5c,0x12,0xff,0x0a,0x70,0x5d,0x8c,0x69, - 0x4a,0x02,0xee,0x72,0x30,0xa7,0x5c,0xa4,0xbb,0xbe,0x03,0x0c,0xe4,0x5f,0x33,0xb6, - 0x78,0x91,0x9d,0xd8,0xec,0x34,0x03,0x2e,0x63,0x32,0xc7,0x2a,0x36,0x50,0xd5,0x8b, - 0x0e,0x7f,0x54,0x4e,0xf4,0x29,0x11,0x1b,0xcd,0x0f,0x37,0xa5,0xbc,0x61,0x83,0x50, - 0xfa,0x18,0x75,0xd9,0xfe,0xa7,0xe8,0x9b,0xc1,0x4f,0x96,0x37,0x81,0x71,0xdf,0x71, - 0x8b,0x89,0x81,0xf4,0x95,0xb5,0x29,0x66,0x41,0x0c,0x73,0xd7,0x0b,0x21,0xb4,0xfb, - 0xf9,0x63,0x2f,0xe9,0x7b,0x38,0xaa,0x20,0xc3,0x96,0xcc,0xb7,0xb2,0x24,0xa1,0xe0, - 0x59,0x9c,0x10,0x9e,0x5a,0xf7,0xe3,0x02,0xe6,0x23,0xe2,0x44,0x21,0x3f,0x6e,0x5e, - 0x79,0xb2,0x93,0x7d,0xce,0xed,0xe2,0xe1,0xab,0x98,0x07,0xa7,0xbd,0xbc,0xd8,0xf7, - 0x06,0xeb,0xc5,0xa6,0x37,0x18,0x11,0x88,0xf7,0x63,0x39,0xb9,0x57,0x29,0xdc,0x03}}; - -const TPM2B_RSA_TEST_VALUE c_RsassaKvt = {RSA_TEST_KEY_SIZE, { - 0x05,0x55,0x00,0x62,0x01,0xc6,0x04,0x31,0x55,0x73,0x3f,0x2a,0xf9,0xd4,0x0f,0xc1, - 0x2b,0xeb,0xd8,0xc8,0xdb,0xb2,0xab,0x6c,0x26,0xde,0x2d,0x89,0xc2,0x2d,0x36,0x62, - 0xc8,0x22,0x5d,0x58,0x03,0xb1,0x46,0x14,0xa5,0xd4,0xbc,0x25,0x6b,0x7f,0x8f,0x14, - 0x7e,0x03,0x2f,0x3d,0xb8,0x39,0xa5,0x79,0x13,0x7e,0x22,0x2a,0xb9,0x3e,0x8f,0xaa, - 0x01,0x7c,0x03,0x12,0x21,0x6c,0x2a,0xb4,0x39,0x98,0x6d,0xff,0x08,0x6c,0x59,0x2d, - 0xdc,0xc6,0xf1,0x77,0x62,0x10,0xa6,0xcc,0xe2,0x71,0x8e,0x97,0x00,0x87,0x5b,0x0e, - 0x20,0x00,0x3f,0x18,0x63,0x83,0xf0,0xe4,0x0a,0x64,0x8c,0xe9,0x8c,0x91,0xe7,0x89, - 0x04,0x64,0x2c,0x8b,0x41,0xc8,0xac,0xf6,0x5a,0x75,0xe6,0xa5,0x76,0x43,0xcb,0xa5, - 0x33,0x8b,0x07,0xc9,0x73,0x0f,0x45,0xa4,0xc3,0xac,0xc1,0xc3,0xe6,0xe7,0x21,0x66, - 0x1c,0xba,0xbf,0xea,0x3e,0x39,0xfa,0xb2,0xe2,0x8f,0xfe,0x9c,0xb4,0x85,0x89,0x33, - 0x2a,0x0c,0xc8,0x5d,0x58,0xe1,0x89,0x12,0xe9,0x4d,0x42,0xb3,0x1f,0x99,0x0c,0x3e, - 0xd8,0xb2,0xeb,0xf5,0x88,0xfb,0xe1,0x4b,0x8e,0xdc,0xd3,0xa8,0xda,0xbe,0x04,0x45, - 0xbf,0x56,0xc6,0x54,0x70,0x00,0xb8,0x66,0x46,0x3a,0xa3,0x1e,0xb6,0xeb,0x1a,0xa0, - 0x0b,0xd3,0x9a,0x9a,0x52,0xda,0x60,0x69,0xb7,0xef,0x93,0x47,0x38,0xab,0x1a,0xa0, - 0x22,0x6e,0x76,0x06,0xb6,0x74,0xaf,0x74,0x8f,0x51,0xc0,0x89,0x5a,0x4b,0xbe,0x6a, - 0x91,0x18,0x25,0x7d,0xa6,0x77,0xe6,0xfd,0xc2,0x62,0x36,0x07,0xc6,0xef,0x79,0xc9}}; - -#endif // SHA512 - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SelfTest.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SelfTest.h deleted file mode 100644 index 4b9fc478f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SelfTest.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the structure definitions for the self-test. It also contains -// macros for use when the self-test is implemented. -#ifndef _SELF_TEST_H_ -#define _SELF_TEST_H_ - -//** Defines - -// Was typing this a lot -#define SELF_TEST_FAILURE FAIL(FATAL_ERROR_SELF_TEST) - -// Use the definition of key sizes to set algorithm values for key size. -#define AES_ENTRIES (AES_128 + AES_192 + AES_256) -#define SM4_ENTRIES (SM4_128) -#define CAMELLIA_ENTRIES (CAMELLIA_128 + CAMELLIA_192 + CAMELLIA_256) -#define TDES_ENTRIES (TDES_128 + TDES_192) - -#define NUM_SYMS (AES_ENTRIES + SM4_ENTRIES + CAMELLIA_ENTRIES + TDES_ENTRIES) - -typedef UINT32 SYM_INDEX; - -// These two defines deal with the fact that the TPM_ALG_ID table does not delimit -// the symmetric mode values with a TPM_SYM_MODE_FIRST and TPM_SYM_MODE_LAST -#define TPM_SYM_MODE_FIRST ALG_CTR_VALUE -#define TPM_SYM_MODE_LAST ALG_ECB_VALUE - -#define NUM_SYM_MODES (TPM_SYM_MODE_LAST - TPM_SYM_MODE_FIRST + 1) - -// Define a type to hold a bit vector for the modes. -#if NUM_SYM_MODES <= 0 -#error "No symmetric modes implemented" -#elif NUM_SYM_MODES <= 8 -typedef BYTE SYM_MODES; -#elif NUM_SYM_MODES <= 16 -typedef UINT16 SYM_MODES; -#elif NUM_SYM_MODES <= 32 -typedef UINT32 SYM_MODES; -#else -#error "Too many symmetric modes" -#endif - -typedef struct SYMMETRIC_TEST_VECTOR { - const TPM_ALG_ID alg; // the algorithm - const UINT16 keyBits; // bits in the key - const BYTE *key; // The test key - const UINT32 ivSize; // block size of the algorithm - const UINT32 dataInOutSize; // size to encrypt/decrypt - const BYTE *dataIn; // data to encrypt - const BYTE *dataOut[NUM_SYM_MODES];// data to decrypt -} SYMMETRIC_TEST_VECTOR; - -#if ALG_SHA512 -# define DEFAULT_TEST_HASH ALG_SHA512_VALUE -# define DEFAULT_TEST_DIGEST_SIZE SHA512_DIGEST_SIZE -# define DEFAULT_TEST_HASH_BLOCK_SIZE SHA512_BLOCK_SIZE -#elif ALG_SHA384 -# define DEFAULT_TEST_HASH ALG_SHA384_VALUE -# define DEFAULT_TEST_DIGEST_SIZE SHA384_DIGEST_SIZE -# define DEFAULT_TEST_HASH_BLOCK_SIZE SHA384_BLOCK_SIZE -#elif ALG_SHA256 -# define DEFAULT_TEST_HASH ALG_SHA256_VALUE -# define DEFAULT_TEST_DIGEST_SIZE SHA256_DIGEST_SIZE -# define DEFAULT_TEST_HASH_BLOCK_SIZE SHA256_BLOCK_SIZE -#elif ALG_SHA1 -# define DEFAULT_TEST_HASH ALG_SHA1_VALUE -# define DEFAULT_TEST_DIGEST_SIZE SHA1_DIGEST_SIZE -# define DEFAULT_TEST_HASH_BLOCK_SIZE SHA1_BLOCK_SIZE -#endif - - -#endif // _SELF_TEST_H_ \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SupportLibraryFunctionPrototypes_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SupportLibraryFunctionPrototypes_fp.h deleted file mode 100644 index 3cdd2c816..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SupportLibraryFunctionPrototypes_fp.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the function prototypes for the functions that need to be -// present in the selected math library. For each function listed, there should -// be a small stub function. That stub provides the interface between the TPM -// code and the support library. In most cases, the stub function will only need -// to do a format conversion between the TPM big number and the support library -// big number. The TPM big number format was chosen to make this relatively -// simple and fast. -// -// Arithmetic operations return a BOOL to indicate if the operation completed -// successfully or not. - -#ifndef SUPPORT_LIBRARY_FUNCTION_PROTOTYPES_H -#define SUPPORT_LIBRARY_FUNCTION_PROTOTYPES_H - -//** SupportLibInit() -// This function is called by CryptInit() so that necessary initializations can be -// performed on the cryptographic library. -LIB_EXPORT -int SupportLibInit(void); - -//** MathLibraryCompatibililtyCheck() -// This function is only used during development to make sure that the library -// that is being referenced is using the same size of data structures as the TPM. -void -MathLibraryCompatibilityCheck( - void - ); - -//** BnModMult() -// Does 'op1' * 'op2' and divide by 'modulus' returning the remainder of the divide. -LIB_EXPORT BOOL -BnModMult(bigNum result, bigConst op1, bigConst op2, bigConst modulus); - -//** BnMult() -// Multiplies two numbers and returns the result -LIB_EXPORT BOOL -BnMult(bigNum result, bigConst multiplicand, bigConst multiplier); - -//** BnDiv() -// This function divides two bigNum values. The function returns FALSE if there is -// an error in the operation. -LIB_EXPORT BOOL -BnDiv(bigNum quotient, bigNum remainder, - bigConst dividend, bigConst divisor); -//** BnMod() -#define BnMod(a, b) BnDiv(NULL, (a), (a), (b)) - -//** BnGcd() -// Get the greatest common divisor of two numbers. This function is only needed -// when the TPM implements RSA. -LIB_EXPORT BOOL -BnGcd(bigNum gcd, bigConst number1, bigConst number2); - -//** BnModExp() -// Do modular exponentiation using bigNum values. This function is only needed -// when the TPM implements RSA. -LIB_EXPORT BOOL -BnModExp(bigNum result, bigConst number, - bigConst exponent, bigConst modulus); -//** BnModInverse() -// Modular multiplicative inverse. This function is only needed -// when the TPM implements RSA. -LIB_EXPORT BOOL BnModInverse(bigNum result, bigConst number, - bigConst modulus); - -//** BnEccModMult() -// This function does a point multiply of the form R = [d]S. A return of FALSE -// indicates that the result was the point at infinity. This function is only needed -// if the TPM supports ECC. -LIB_EXPORT BOOL -BnEccModMult(bigPoint R, pointConst S, bigConst d, bigCurve E); - -//** BnEccModMult2() -// This function does a point multiply of the form R = [d]S + [u]Q. A return of -// FALSE indicates that the result was the point at infinity. This function is only -// needed if the TPM supports ECC. -LIB_EXPORT BOOL -BnEccModMult2(bigPoint R, pointConst S, bigConst d, - pointConst Q, bigConst u, bigCurve E); - -//** BnEccAdd() -// This function does a point add R = S + Q. A return of FALSE -// indicates that the result was the point at infinity. This function is only needed -// if the TPM supports ECC. -LIB_EXPORT BOOL -BnEccAdd(bigPoint R, pointConst S, pointConst Q, bigCurve E); - -//** BnCurveInitialize() -// This function is used to initialize the pointers of a bnCurve_t structure. The -// structure is a set of pointers to bigNum values. The curve-dependent values are -// set by a different function. This function is only needed -// if the TPM supports ECC. -LIB_EXPORT bigCurve -BnCurveInitialize(bigCurve E, TPM_ECC_CURVE curveId); - -//*** BnCurveFree() -// This function will free the allocated components of the curve and end the -// frame in which the curve data exists -LIB_EXPORT void -BnCurveFree(bigCurve E); - -#endif \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SymmetricTest.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SymmetricTest.h deleted file mode 100644 index bf052152b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SymmetricTest.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction - -// This file contains the structures and data definitions for the symmetric tests. -// This file references the header file that contains the actual test vectors. This -// organization was chosen so that the program that is used to generate the test -// vector values does not have to also re-generate this data. -#ifndef SELF_TEST_DATA -#error "This file may only be included in AlgorithmTests.c" -#endif - -#ifndef _SYMMETRIC_TEST_H -#define _SYMMETRIC_TEST_H -#include "SymmetricTestData.h" - - -//** Symmetric Test Structures - -const SYMMETRIC_TEST_VECTOR c_symTestValues[NUM_SYMS + 1] = { -#if ALG_AES && AES_128 - {ALG_AES_VALUE, 128, key_AES128, 16, sizeof(dataIn_AES128), dataIn_AES128, - {dataOut_AES128_CTR, dataOut_AES128_OFB, dataOut_AES128_CBC, - dataOut_AES128_CFB, dataOut_AES128_ECB}}, -#endif -#if ALG_AES && AES_192 - {ALG_AES_VALUE, 192, key_AES192, 16, sizeof(dataIn_AES192), dataIn_AES192, - {dataOut_AES192_CTR, dataOut_AES192_OFB, dataOut_AES192_CBC, - dataOut_AES192_CFB, dataOut_AES192_ECB}}, -#endif -#if ALG_AES && AES_256 - {ALG_AES_VALUE, 256, key_AES256, 16, sizeof(dataIn_AES256), dataIn_AES256, - {dataOut_AES256_CTR, dataOut_AES256_OFB, dataOut_AES256_CBC, - dataOut_AES256_CFB, dataOut_AES256_ECB}}, -#endif -#if ALG_SM4 && SM4_128 - {ALG_SM4_VALUE, 128, key_SM4128, 16, sizeof(dataIn_SM4128), dataIn_SM4128, - {dataOut_SM4128_CTR, dataOut_SM4128_OFB, dataOut_SM4128_CBC, - dataOut_SM4128_CFB, dataOut_AES128_ECB}}, -#endif - {0} -}; - -#endif // _SYMMETRIC_TEST_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SymmetricTestData.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SymmetricTestData.h deleted file mode 100644 index e171c07ac..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/SymmetricTestData.h +++ /dev/null @@ -1,178 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// This is a vector for testing either encrypt or decrypt. The premise for decrypt -// is that the IV for decryption is the same as the IV for encryption. However, -// the ivOut value may be different for encryption and decryption. We will encrypt -// at least two blocks. This means that the chaining value will be used for each -// of the schemes (if any) and that implicitly checks that the chaining value -// is handled properly. - - -#if AES_128 - -const BYTE key_AES128 [] = { - 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, - 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; - -const BYTE dataIn_AES128 [] = { - 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51}; - - -const BYTE dataOut_AES128_ECB [] = { - 0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60, - 0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97, - 0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d, - 0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf}; - -const BYTE dataOut_AES128_CBC [] = { - 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, - 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, - 0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee, - 0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2}; - -const BYTE dataOut_AES128_CFB [] = { - 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, - 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a, - 0xc8, 0xa6, 0x45, 0x37, 0xa0, 0xb3, 0xa9, 0x3f, - 0xcd, 0xe3, 0xcd, 0xad, 0x9f, 0x1c, 0xe5, 0x8b}; - -const BYTE dataOut_AES128_OFB [] = { - 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, - 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a, - 0x77, 0x89, 0x50, 0x8d, 0x16, 0x91, 0x8f, 0x03, - 0xf5, 0x3c, 0x52, 0xda, 0xc5, 0x4e, 0xd8, 0x25}; - - -const BYTE dataOut_AES128_CTR [] = { - 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, - 0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce, - 0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff, - 0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff}; -#endif - -#if AES_192 - -const BYTE key_AES192 [] = { - 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, - 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, - 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b}; - -const BYTE dataIn_AES192 [] = { - 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51}; - -const BYTE dataOut_AES192_ECB [] = { - 0xbd, 0x33, 0x4f, 0x1d, 0x6e, 0x45, 0xf2, 0x5f, - 0xf7, 0x12, 0xa2, 0x14, 0x57, 0x1f, 0xa5, 0xcc, - 0x97, 0x41, 0x04, 0x84, 0x6d, 0x0a, 0xd3, 0xad, - 0x77, 0x34, 0xec, 0xb3, 0xec, 0xee, 0x4e, 0xef}; - -const BYTE dataOut_AES192_CBC [] = { - 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d, - 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8, - 0xb4, 0xd9, 0xad, 0xa9, 0xad, 0x7d, 0xed, 0xf4, - 0xe5, 0xe7, 0x38, 0x76, 0x3f, 0x69, 0x14, 0x5a}; - -const BYTE dataOut_AES192_CFB [] = { - 0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab, - 0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74, - 0x67, 0xce, 0x7f, 0x7f, 0x81, 0x17, 0x36, 0x21, - 0x96, 0x1a, 0x2b, 0x70, 0x17, 0x1d, 0x3d, 0x7a}; - -const BYTE dataOut_AES192_OFB [] = { - 0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab, - 0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74, - 0xfc, 0xc2, 0x8b, 0x8d, 0x4c, 0x63, 0x83, 0x7c, - 0x09, 0xe8, 0x17, 0x00, 0xc1, 0x10, 0x04, 0x01}; - -const BYTE dataOut_AES192_CTR [] = { - 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, - 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b, - 0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef, - 0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94}; -#endif - -#if AES_256 - -const BYTE key_AES256 [] = { - 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, - 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, - 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, - 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4}; - -const BYTE dataIn_AES256 [] = { - 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, - 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51}; - -const BYTE dataOut_AES256_ECB [] = { - 0xf3, 0xee, 0xd1, 0xbd, 0xb5, 0xd2, 0xa0, 0x3c, - 0x06, 0x4b, 0x5a, 0x7e, 0x3d, 0xb1, 0x81, 0xf8, - 0x59, 0x1c, 0xcb, 0x10, 0xd4, 0x10, 0xed, 0x26, - 0xdc, 0x5b, 0xa7, 0x4a, 0x31, 0x36, 0x28, 0x70}; - -const BYTE dataOut_AES256_CBC [] = { - 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba, - 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6, - 0x9c, 0xfc, 0x4e, 0x96, 0x7e, 0xdb, 0x80, 0x8d, - 0x67, 0x9f, 0x77, 0x7b, 0xc6, 0x70, 0x2c, 0x7d}; - -const BYTE dataOut_AES256_CFB [] = { - 0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b, - 0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60, - 0x39, 0xff, 0xed, 0x14, 0x3b, 0x28, 0xb1, 0xc8, - 0x32, 0x11, 0x3c, 0x63, 0x31, 0xe5, 0x40, 0x7b}; - -const BYTE dataOut_AES256_OFB [] = { - 0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b, - 0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60, - 0x4f, 0xeb, 0xdc, 0x67, 0x40, 0xd2, 0x0b, 0x3a, - 0xc8, 0x8f, 0x6a, 0xd8, 0x2a, 0x4f, 0xb0, 0x8d}; - -const BYTE dataOut_AES256_CTR [] = { - 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, - 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28, - 0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a, - 0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5}; -#endif - - - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TPMB.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TPMB.h deleted file mode 100644 index d815632ca..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TPMB.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// -// This file contains extra TPM2B structures -// - -#ifndef _TPMB_H -#define _TPMB_H - -// TPM2B Types -typedef struct { - UINT16 size; - BYTE buffer[1]; -} TPM2B, *P2B; -typedef const TPM2B *PC2B; - -// This macro helps avoid having to type in the structure in order to create -// a new TPM2B type that is used in a function. -#define TPM2B_TYPE(name, bytes) \ - typedef union { \ - struct { \ - UINT16 size; \ - BYTE buffer[(bytes)]; \ - } t; \ - TPM2B b; \ - } TPM2B_##name - -// This macro defines a TPM2B with a constant character value. This macro -// sets the size of the string to the size minus the terminating zero byte. -// This lets the user of the label add their terminating 0. This method -// is chosen so that existing code that provides a label will continue -// to work correctly. - -// Macro to instance and initialize a TPM2B value -#define TPM2B_INIT(TYPE, name) \ - TPM2B_##TYPE name = {sizeof(name.t.buffer), {0}} - -#define TPM2B_BYTE_VALUE(bytes) TPM2B_TYPE(bytes##_BYTE_VALUE, bytes) - - -#endif diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h deleted file mode 100644 index e1b45c2cc..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Tpm.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// Root header file for building any TPM.lib code - -#ifndef _TPM_H_ -#define _TPM_H_ - -#include "TpmBuildSwitches.h" -#include "BaseTypes.h" -#include "TPMB.h" -#include "MinMax.h" - -#include "TpmProfile.h" -#include "TpmAlgorithmDefines.h" -#include "LibSupport.h" // Types from the library. These need to come before - // Global.h because some of the structures in - // that file depend on the structures used by the - // cryptographic libraries. -#include "GpMacros.h" // Define additional macros -#include "Global.h" // Define other TPM types -#include "InternalRoutines.h" // Function prototypes - -#endif // _TPM_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmASN1.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmASN1.h deleted file mode 100644 index eafeed4a7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmASN1.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the macro and structure definitions for the X509 commands and -// functions. - -#ifndef _TPMASN1_H_ -#define _TPMASN1_H_ - -//** Includes - -#include "Tpm.h" -#include "OIDs.h" - -//** Defined Constants -//*** ASN.1 Universal Types (Class 00b) -#define ASN1_EOC 0x00 -#define ASN1_BOOLEAN 0x01 -#define ASN1_INTEGER 0x02 -#define ASN1_BITSTRING 0x03 -#define ASN1_OCTET_STRING 0x04 -#define ASN1_NULL 0x05 -#define ASN1_OBJECT_IDENTIFIER 0x06 -#define ASN1_OBJECT_DESCRIPTOR 0x07 -#define ASN1_EXTERNAL 0x08 -#define ASN1_REAL 0x09 -#define ASN1_ENUMERATED 0x0A -#define ASN1_EMBEDDED 0x0B -#define ASN1_UTF8String 0x0C -#define ASN1_RELATIVE_OID 0x0D -#define ASN1_SEQUENCE 0x10 // Primitive + Constructed + 0x10 -#define ASN1_SET 0x11 // Primitive + Constructed + 0x11 -#define ASN1_NumericString 0x12 -#define ASN1_PrintableString 0x13 -#define ASN1_T61String 0x14 -#define ASN1_VideoString 0x15 -#define ASN1_IA5String 0x16 -#define ASN1_UTCTime 0x17 -#define ASN1_GeneralizeTime 0x18 -#define ASN1_VisibleString 0x1A -#define ASN1_GeneralString 0x1B -#define ASN1_UniversalString 0x1C -#define ASN1_CHARACTER STRING 0x1D -#define ASN1_BMPString 0x1E -#define ASN1_CONSTRUCTED 0x20 - -#define ASN1_APPLICAIION_SPECIFIC 0xA0 - -#define ASN1_CONSTRUCTED_SEQUENCE (ASN1_SEQUENCE + ASN1_CONSTRUCTED) - -#define MAX_DEPTH 10 // maximum push depth for marshaling context. - -//** Macros - -//*** Unmarshaling Macros -#ifndef VERIFY -#define VERIFY(_X_) {if(!(_X_)) goto Error; } -#endif -// Checks the validity of the size making sure that there is no wrap around -#define CHECK_SIZE(context, length) \ - VERIFY( (((length) + (context)->offset) >= (context)->offset) \ - && (((length) + (context)->offset) <= (context)->size)) -#define NEXT_OCTET(context) ((context)->buffer[(context)->offset++]) -#define PEEK_NEXT(context) ((context)->buffer[(context)->offset]) - -//*** Marshaling Macros - -// Marshaling works in reverse order. The offset is set to the top of the buffer and, -// as the buffer is filled, 'offset' counts down to zero. When the full thing is -// encoded it can be moved to the top of the buffer. This happens when the last -// context is closed. - -#define CHECK_SPACE(context, length) VERIFY(context->offset > length) - -//** Structures - -typedef struct ASN1UnmarshalContext { - BYTE *buffer; // pointer to the buffer - INT16 size; // size of the buffer (a negative number indicates - // a parsing failure). - INT16 offset; // current offset into the buffer (a negative number - // indicates a parsing failure). Not used - BYTE tag; // The last unmarshaled tag -} ASN1UnmarshalContext; - -typedef struct ASN1MarshalContext { - BYTE *buffer; // pointer to the start of the buffer - INT16 offset; // place on the top where the last entry was added - // items are added from the bottom up. - INT16 end; // the end offset of the current value - INT16 depth; // how many pushed end values. - INT16 ends[MAX_DEPTH]; -} ASN1MarshalContext; - -#endif // _TPMASN1_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmAlgorithmDefines.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmAlgorithmDefines.h deleted file mode 100644 index 5954a8447..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmAlgorithmDefines.h +++ /dev/null @@ -1,423 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Apr 7, 2019 Time: 06:58:55PM - */ - -#ifndef _TPM_ALGORITHM_DEFINES_H_ -#define _TPM_ALGORITHM_DEFINES_H_ - -// Table 2:3 - Definition of Base Types -// Base Types are in BaseTypes.h - -#define ECC_CURVES \ - {TPM_ECC_BN_P256, TPM_ECC_BN_P638, TPM_ECC_NIST_P192, \ - TPM_ECC_NIST_P224, TPM_ECC_NIST_P256, TPM_ECC_NIST_P384, \ - TPM_ECC_NIST_P521, TPM_ECC_SM2_P256} -#define ECC_CURVE_COUNT \ - (ECC_BN_P256 + ECC_BN_P638 + ECC_NIST_P192 + ECC_NIST_P224 + \ - ECC_NIST_P256 + ECC_NIST_P384 + ECC_NIST_P521 + ECC_SM2_P256) -#define MAX_ECC_KEY_BITS \ - MAX(ECC_BN_P256 * 256, MAX(ECC_BN_P638 * 638, \ - MAX(ECC_NIST_P192 * 192, MAX(ECC_NIST_P224 * 224, \ - MAX(ECC_NIST_P256 * 256, MAX(ECC_NIST_P384 * 384, \ - MAX(ECC_NIST_P521 * 521, MAX(ECC_SM2_P256 * 256, \ - 0)))))))) -#define MAX_ECC_KEY_BYTES BITS_TO_BYTES(MAX_ECC_KEY_BITS) - - -// Table 0:6 - Defines for PLATFORM Values -#define PLATFORM_FAMILY TPM_SPEC_FAMILY -#define PLATFORM_LEVEL TPM_SPEC_LEVEL -#define PLATFORM_VERSION TPM_SPEC_VERSION -#define PLATFORM_YEAR TPM_SPEC_YEAR -#define PLATFORM_DAY_OF_YEAR TPM_SPEC_DAY_OF_YEAR - -// Table 1:12 - Defines for SHA1 Hash Values -#define SHA1_DIGEST_SIZE 20 -#define SHA1_BLOCK_SIZE 64 - - -// Table 1:13 - Defines for SHA256 Hash Values -#define SHA256_DIGEST_SIZE 32 -#define SHA256_BLOCK_SIZE 64 - - -// Table 1:14 - Defines for SHA384 Hash Values -#define SHA384_DIGEST_SIZE 48 -#define SHA384_BLOCK_SIZE 128 - - -// Table 1:15 - Defines for SHA512 Hash Values -#define SHA512_DIGEST_SIZE 64 -#define SHA512_BLOCK_SIZE 128 - - -// Table 1:16 - Defines for SM3_256 Hash Values -#define SM3_256_DIGEST_SIZE 32 -#define SM3_256_BLOCK_SIZE 64 - - -// Table 1:16 - Defines for SHA3_256 Hash Values -#define SHA3_256_DIGEST_SIZE 32 -#define SHA3_256_BLOCK_SIZE 136 - - -// Table 1:16 - Defines for SHA3_384 Hash Values -#define SHA3_384_DIGEST_SIZE 48 -#define SHA3_384_BLOCK_SIZE 104 - - -// Table 1:16 - Defines for SHA3_512 Hash Values -#define SHA3_512_DIGEST_SIZE 64 -#define SHA3_512_BLOCK_SIZE 72 - - -// Table 1:00 - Defines for RSA Asymmetric Cipher Algorithm Constants -#define RSA_KEY_SIZES_BITS \ - (1024 * RSA_1024), (2048 * RSA_2048), (3072 * RSA_3072), \ - (4096 * RSA_4096) -#if RSA_4096 -# define RSA_MAX_KEY_SIZE_BITS 4096 -#elif RSA_3072 -# define RSA_MAX_KEY_SIZE_BITS 3072 -#elif RSA_2048 -# define RSA_MAX_KEY_SIZE_BITS 2048 -#elif RSA_1024 -# define RSA_MAX_KEY_SIZE_BITS 1024 -#else -# define RSA_MAX_KEY_SIZE_BITS 0 -#endif -#define MAX_RSA_KEY_BITS RSA_MAX_KEY_SIZE_BITS -#define MAX_RSA_KEY_BYTES ((RSA_MAX_KEY_SIZE_BITS + 7) / 8) - - -// Table 1:17 - Defines for AES Symmetric Cipher Algorithm Constants -#define AES_KEY_SIZES_BITS \ - (128 * AES_128), (192 * AES_192), (256 * AES_256) -#if AES_256 -# define AES_MAX_KEY_SIZE_BITS 256 -#elif AES_192 -# define AES_MAX_KEY_SIZE_BITS 192 -#elif AES_128 -# define AES_MAX_KEY_SIZE_BITS 128 -#else -# define AES_MAX_KEY_SIZE_BITS 0 -#endif -#define MAX_AES_KEY_BITS AES_MAX_KEY_SIZE_BITS -#define MAX_AES_KEY_BYTES ((AES_MAX_KEY_SIZE_BITS + 7) / 8) -#define AES_128_BLOCK_SIZE_BYTES (AES_128 * 16) -#define AES_192_BLOCK_SIZE_BYTES (AES_192 * 16) -#define AES_256_BLOCK_SIZE_BYTES (AES_256 * 16) -#define AES_BLOCK_SIZES \ - AES_128_BLOCK_SIZE_BYTES, AES_192_BLOCK_SIZE_BYTES, \ - AES_256_BLOCK_SIZE_BYTES -#if ALG_AES -# define AES_MAX_BLOCK_SIZE 16 -#else -# define AES_MAX_BLOCK_SIZE 0 -#endif -#define MAX_AES_BLOCK_SIZE_BYTES AES_MAX_BLOCK_SIZE - - -// Table 1:18 - Defines for SM4 Symmetric Cipher Algorithm Constants -#define SM4_KEY_SIZES_BITS (128 * SM4_128) -#if SM4_128 -# define SM4_MAX_KEY_SIZE_BITS 128 -#else -# define SM4_MAX_KEY_SIZE_BITS 0 -#endif -#define MAX_SM4_KEY_BITS SM4_MAX_KEY_SIZE_BITS -#define MAX_SM4_KEY_BYTES ((SM4_MAX_KEY_SIZE_BITS + 7) / 8) -#define SM4_128_BLOCK_SIZE_BYTES (SM4_128 * 16) -#define SM4_BLOCK_SIZES SM4_128_BLOCK_SIZE_BYTES -#if ALG_SM4 -# define SM4_MAX_BLOCK_SIZE 16 -#else -# define SM4_MAX_BLOCK_SIZE 0 -#endif -#define MAX_SM4_BLOCK_SIZE_BYTES SM4_MAX_BLOCK_SIZE - - -// Table 1:19 - Defines for CAMELLIA Symmetric Cipher Algorithm Constants -#define CAMELLIA_KEY_SIZES_BITS \ - (128 * CAMELLIA_128), (192 * CAMELLIA_192), (256 * CAMELLIA_256) -#if CAMELLIA_256 -# define CAMELLIA_MAX_KEY_SIZE_BITS 256 -#elif CAMELLIA_192 -# define CAMELLIA_MAX_KEY_SIZE_BITS 192 -#elif CAMELLIA_128 -# define CAMELLIA_MAX_KEY_SIZE_BITS 128 -#else -# define CAMELLIA_MAX_KEY_SIZE_BITS 0 -#endif -#define MAX_CAMELLIA_KEY_BITS CAMELLIA_MAX_KEY_SIZE_BITS -#define MAX_CAMELLIA_KEY_BYTES ((CAMELLIA_MAX_KEY_SIZE_BITS + 7) / 8) -#define CAMELLIA_128_BLOCK_SIZE_BYTES (CAMELLIA_128 * 16) -#define CAMELLIA_192_BLOCK_SIZE_BYTES (CAMELLIA_192 * 16) -#define CAMELLIA_256_BLOCK_SIZE_BYTES (CAMELLIA_256 * 16) -#define CAMELLIA_BLOCK_SIZES \ - CAMELLIA_128_BLOCK_SIZE_BYTES, CAMELLIA_192_BLOCK_SIZE_BYTES, \ - CAMELLIA_256_BLOCK_SIZE_BYTES -#if ALG_CAMELLIA -# define CAMELLIA_MAX_BLOCK_SIZE 16 -#else -# define CAMELLIA_MAX_BLOCK_SIZE 0 -#endif -#define MAX_CAMELLIA_BLOCK_SIZE_BYTES CAMELLIA_MAX_BLOCK_SIZE - - -// Table 1:17 - Defines for TDES Symmetric Cipher Algorithm Constants -#define TDES_KEY_SIZES_BITS (128 * TDES_128), (192 * TDES_192) -#if TDES_192 -# define TDES_MAX_KEY_SIZE_BITS 192 -#elif TDES_128 -# define TDES_MAX_KEY_SIZE_BITS 128 -#else -# define TDES_MAX_KEY_SIZE_BITS 0 -#endif -#define MAX_TDES_KEY_BITS TDES_MAX_KEY_SIZE_BITS -#define MAX_TDES_KEY_BYTES ((TDES_MAX_KEY_SIZE_BITS + 7) / 8) -#define TDES_128_BLOCK_SIZE_BYTES (TDES_128 * 8) -#define TDES_192_BLOCK_SIZE_BYTES (TDES_192 * 8) -#define TDES_BLOCK_SIZES \ - TDES_128_BLOCK_SIZE_BYTES, TDES_192_BLOCK_SIZE_BYTES -#if ALG_TDES -# define TDES_MAX_BLOCK_SIZE 8 -#else -# define TDES_MAX_BLOCK_SIZE 0 -#endif -#define MAX_TDES_BLOCK_SIZE_BYTES TDES_MAX_BLOCK_SIZE - - -// Additional values for benefit of code -#define TPM_CC_FIRST 0x0000011F -#define TPM_CC_LAST 0x00000197 - - -#if COMPRESSED_LISTS -#define ADD_FILL 0 -#else -#define ADD_FILL 1 -#endif - -// Size the array of library commands based on whether or not -// the array is packed (only defined commands) or dense -// (having entries for unimplemented commands) -#define LIBRARY_COMMAND_ARRAY_SIZE (0 \ - + (ADD_FILL || CC_NV_UndefineSpaceSpecial) /* 0x0000011F */ \ - + (ADD_FILL || CC_EvictControl) /* 0x00000120 */ \ - + (ADD_FILL || CC_HierarchyControl) /* 0x00000121 */ \ - + (ADD_FILL || CC_NV_UndefineSpace) /* 0x00000122 */ \ - + ADD_FILL /* 0x00000123 */ \ - + (ADD_FILL || CC_ChangeEPS) /* 0x00000124 */ \ - + (ADD_FILL || CC_ChangePPS) /* 0x00000125 */ \ - + (ADD_FILL || CC_Clear) /* 0x00000126 */ \ - + (ADD_FILL || CC_ClearControl) /* 0x00000127 */ \ - + (ADD_FILL || CC_ClockSet) /* 0x00000128 */ \ - + (ADD_FILL || CC_HierarchyChangeAuth) /* 0x00000129 */ \ - + (ADD_FILL || CC_NV_DefineSpace) /* 0x0000012A */ \ - + (ADD_FILL || CC_PCR_Allocate) /* 0x0000012B */ \ - + (ADD_FILL || CC_PCR_SetAuthPolicy) /* 0x0000012C */ \ - + (ADD_FILL || CC_PP_Commands) /* 0x0000012D */ \ - + (ADD_FILL || CC_SetPrimaryPolicy) /* 0x0000012E */ \ - + (ADD_FILL || CC_FieldUpgradeStart) /* 0x0000012F */ \ - + (ADD_FILL || CC_ClockRateAdjust) /* 0x00000130 */ \ - + (ADD_FILL || CC_CreatePrimary) /* 0x00000131 */ \ - + (ADD_FILL || CC_NV_GlobalWriteLock) /* 0x00000132 */ \ - + (ADD_FILL || CC_GetCommandAuditDigest) /* 0x00000133 */ \ - + (ADD_FILL || CC_NV_Increment) /* 0x00000134 */ \ - + (ADD_FILL || CC_NV_SetBits) /* 0x00000135 */ \ - + (ADD_FILL || CC_NV_Extend) /* 0x00000136 */ \ - + (ADD_FILL || CC_NV_Write) /* 0x00000137 */ \ - + (ADD_FILL || CC_NV_WriteLock) /* 0x00000138 */ \ - + (ADD_FILL || CC_DictionaryAttackLockReset) /* 0x00000139 */ \ - + (ADD_FILL || CC_DictionaryAttackParameters) /* 0x0000013A */ \ - + (ADD_FILL || CC_NV_ChangeAuth) /* 0x0000013B */ \ - + (ADD_FILL || CC_PCR_Event) /* 0x0000013C */ \ - + (ADD_FILL || CC_PCR_Reset) /* 0x0000013D */ \ - + (ADD_FILL || CC_SequenceComplete) /* 0x0000013E */ \ - + (ADD_FILL || CC_SetAlgorithmSet) /* 0x0000013F */ \ - + (ADD_FILL || CC_SetCommandCodeAuditStatus) /* 0x00000140 */ \ - + (ADD_FILL || CC_FieldUpgradeData) /* 0x00000141 */ \ - + (ADD_FILL || CC_IncrementalSelfTest) /* 0x00000142 */ \ - + (ADD_FILL || CC_SelfTest) /* 0x00000143 */ \ - + (ADD_FILL || CC_Startup) /* 0x00000144 */ \ - + (ADD_FILL || CC_Shutdown) /* 0x00000145 */ \ - + (ADD_FILL || CC_StirRandom) /* 0x00000146 */ \ - + (ADD_FILL || CC_ActivateCredential) /* 0x00000147 */ \ - + (ADD_FILL || CC_Certify) /* 0x00000148 */ \ - + (ADD_FILL || CC_PolicyNV) /* 0x00000149 */ \ - + (ADD_FILL || CC_CertifyCreation) /* 0x0000014A */ \ - + (ADD_FILL || CC_Duplicate) /* 0x0000014B */ \ - + (ADD_FILL || CC_GetTime) /* 0x0000014C */ \ - + (ADD_FILL || CC_GetSessionAuditDigest) /* 0x0000014D */ \ - + (ADD_FILL || CC_NV_Read) /* 0x0000014E */ \ - + (ADD_FILL || CC_NV_ReadLock) /* 0x0000014F */ \ - + (ADD_FILL || CC_ObjectChangeAuth) /* 0x00000150 */ \ - + (ADD_FILL || CC_PolicySecret) /* 0x00000151 */ \ - + (ADD_FILL || CC_Rewrap) /* 0x00000152 */ \ - + (ADD_FILL || CC_Create) /* 0x00000153 */ \ - + (ADD_FILL || CC_ECDH_ZGen) /* 0x00000154 */ \ - + (ADD_FILL || CC_HMAC || CC_MAC) /* 0x00000155 */ \ - + (ADD_FILL || CC_Import) /* 0x00000156 */ \ - + (ADD_FILL || CC_Load) /* 0x00000157 */ \ - + (ADD_FILL || CC_Quote) /* 0x00000158 */ \ - + (ADD_FILL || CC_RSA_Decrypt) /* 0x00000159 */ \ - + ADD_FILL /* 0x0000015A */ \ - + (ADD_FILL || CC_HMAC_Start || CC_MAC_Start) /* 0x0000015B */ \ - + (ADD_FILL || CC_SequenceUpdate) /* 0x0000015C */ \ - + (ADD_FILL || CC_Sign) /* 0x0000015D */ \ - + (ADD_FILL || CC_Unseal) /* 0x0000015E */ \ - + ADD_FILL /* 0x0000015F */ \ - + (ADD_FILL || CC_PolicySigned) /* 0x00000160 */ \ - + (ADD_FILL || CC_ContextLoad) /* 0x00000161 */ \ - + (ADD_FILL || CC_ContextSave) /* 0x00000162 */ \ - + (ADD_FILL || CC_ECDH_KeyGen) /* 0x00000163 */ \ - + (ADD_FILL || CC_EncryptDecrypt) /* 0x00000164 */ \ - + (ADD_FILL || CC_FlushContext) /* 0x00000165 */ \ - + ADD_FILL /* 0x00000166 */ \ - + (ADD_FILL || CC_LoadExternal) /* 0x00000167 */ \ - + (ADD_FILL || CC_MakeCredential) /* 0x00000168 */ \ - + (ADD_FILL || CC_NV_ReadPublic) /* 0x00000169 */ \ - + (ADD_FILL || CC_PolicyAuthorize) /* 0x0000016A */ \ - + (ADD_FILL || CC_PolicyAuthValue) /* 0x0000016B */ \ - + (ADD_FILL || CC_PolicyCommandCode) /* 0x0000016C */ \ - + (ADD_FILL || CC_PolicyCounterTimer) /* 0x0000016D */ \ - + (ADD_FILL || CC_PolicyCpHash) /* 0x0000016E */ \ - + (ADD_FILL || CC_PolicyLocality) /* 0x0000016F */ \ - + (ADD_FILL || CC_PolicyNameHash) /* 0x00000170 */ \ - + (ADD_FILL || CC_PolicyOR) /* 0x00000171 */ \ - + (ADD_FILL || CC_PolicyTicket) /* 0x00000172 */ \ - + (ADD_FILL || CC_ReadPublic) /* 0x00000173 */ \ - + (ADD_FILL || CC_RSA_Encrypt) /* 0x00000174 */ \ - + ADD_FILL /* 0x00000175 */ \ - + (ADD_FILL || CC_StartAuthSession) /* 0x00000176 */ \ - + (ADD_FILL || CC_VerifySignature) /* 0x00000177 */ \ - + (ADD_FILL || CC_ECC_Parameters) /* 0x00000178 */ \ - + (ADD_FILL || CC_FirmwareRead) /* 0x00000179 */ \ - + (ADD_FILL || CC_GetCapability) /* 0x0000017A */ \ - + (ADD_FILL || CC_GetRandom) /* 0x0000017B */ \ - + (ADD_FILL || CC_GetTestResult) /* 0x0000017C */ \ - + (ADD_FILL || CC_Hash) /* 0x0000017D */ \ - + (ADD_FILL || CC_PCR_Read) /* 0x0000017E */ \ - + (ADD_FILL || CC_PolicyPCR) /* 0x0000017F */ \ - + (ADD_FILL || CC_PolicyRestart) /* 0x00000180 */ \ - + (ADD_FILL || CC_ReadClock) /* 0x00000181 */ \ - + (ADD_FILL || CC_PCR_Extend) /* 0x00000182 */ \ - + (ADD_FILL || CC_PCR_SetAuthValue) /* 0x00000183 */ \ - + (ADD_FILL || CC_NV_Certify) /* 0x00000184 */ \ - + (ADD_FILL || CC_EventSequenceComplete) /* 0x00000185 */ \ - + (ADD_FILL || CC_HashSequenceStart) /* 0x00000186 */ \ - + (ADD_FILL || CC_PolicyPhysicalPresence) /* 0x00000187 */ \ - + (ADD_FILL || CC_PolicyDuplicationSelect) /* 0x00000188 */ \ - + (ADD_FILL || CC_PolicyGetDigest) /* 0x00000189 */ \ - + (ADD_FILL || CC_TestParms) /* 0x0000018A */ \ - + (ADD_FILL || CC_Commit) /* 0x0000018B */ \ - + (ADD_FILL || CC_PolicyPassword) /* 0x0000018C */ \ - + (ADD_FILL || CC_ZGen_2Phase) /* 0x0000018D */ \ - + (ADD_FILL || CC_EC_Ephemeral) /* 0x0000018E */ \ - + (ADD_FILL || CC_PolicyNvWritten) /* 0x0000018F */ \ - + (ADD_FILL || CC_PolicyTemplate) /* 0x00000190 */ \ - + (ADD_FILL || CC_CreateLoaded) /* 0x00000191 */ \ - + (ADD_FILL || CC_PolicyAuthorizeNV) /* 0x00000192 */ \ - + (ADD_FILL || CC_EncryptDecrypt2) /* 0x00000193 */ \ - + (ADD_FILL || CC_AC_GetCapability) /* 0x00000194 */ \ - + (ADD_FILL || CC_AC_Send) /* 0x00000195 */ \ - + (ADD_FILL || CC_Policy_AC_SendSelect) /* 0x00000196 */ \ - + (ADD_FILL || CC_CertifyX509) /* 0x00000197 */ \ - ) - -#define VENDOR_COMMAND_ARRAY_SIZE (0 + CC_Vendor_TCG_Test) - -#define COMMAND_COUNT (LIBRARY_COMMAND_ARRAY_SIZE + VENDOR_COMMAND_ARRAY_SIZE) - -#define HASH_COUNT \ - (ALG_SHA1 + ALG_SHA256 + ALG_SHA384 + ALG_SHA3_256 + \ - ALG_SHA3_384 + ALG_SHA3_512 + ALG_SHA512 + ALG_SM3_256) - -#define MAX_HASH_BLOCK_SIZE \ - (MAX(ALG_SHA1 * SHA1_BLOCK_SIZE, \ - MAX(ALG_SHA256 * SHA256_BLOCK_SIZE, \ - MAX(ALG_SHA384 * SHA384_BLOCK_SIZE, \ - MAX(ALG_SHA3_256 * SHA3_256_BLOCK_SIZE, \ - MAX(ALG_SHA3_384 * SHA3_384_BLOCK_SIZE, \ - MAX(ALG_SHA3_512 * SHA3_512_BLOCK_SIZE, \ - MAX(ALG_SHA512 * SHA512_BLOCK_SIZE, \ - MAX(ALG_SM3_256 * SM3_256_BLOCK_SIZE, \ - 0))))))))) - -#define MAX_DIGEST_SIZE \ - (MAX(ALG_SHA1 * SHA1_DIGEST_SIZE, \ - MAX(ALG_SHA256 * SHA256_DIGEST_SIZE, \ - MAX(ALG_SHA384 * SHA384_DIGEST_SIZE, \ - MAX(ALG_SHA3_256 * SHA3_256_DIGEST_SIZE, \ - MAX(ALG_SHA3_384 * SHA3_384_DIGEST_SIZE, \ - MAX(ALG_SHA3_512 * SHA3_512_DIGEST_SIZE, \ - MAX(ALG_SHA512 * SHA512_DIGEST_SIZE, \ - MAX(ALG_SM3_256 * SM3_256_DIGEST_SIZE, \ - 0))))))))) - - -#if MAX_DIGEST_SIZE == 0 || MAX_HASH_BLOCK_SIZE == 0 -#error "Hash data not valid" -#endif - -// Define the 2B structure that would hold any hash block -TPM2B_TYPE(MAX_HASH_BLOCK, MAX_HASH_BLOCK_SIZE); - -// Following typedef is for some old code -typedef TPM2B_MAX_HASH_BLOCK TPM2B_HASH_BLOCK; - -/* Additional symmetric constants */ -#define MAX_SYM_KEY_BITS \ - (MAX(AES_MAX_KEY_SIZE_BITS, MAX(CAMELLIA_MAX_KEY_SIZE_BITS, \ - MAX(SM4_MAX_KEY_SIZE_BITS, MAX(TDES_MAX_KEY_SIZE_BITS, \ - 0))))) - -#define MAX_SYM_KEY_BYTES ((MAX_SYM_KEY_BITS + 7) / 8) - -#define MAX_SYM_BLOCK_SIZE \ - (MAX(AES_MAX_BLOCK_SIZE, MAX(CAMELLIA_MAX_BLOCK_SIZE, \ - MAX(SM4_MAX_BLOCK_SIZE, MAX(TDES_MAX_BLOCK_SIZE, \ - 0))))) - -#if MAX_SYM_KEY_BITS == 0 || MAX_SYM_BLOCK_SIZE == 0 -# error Bad size for MAX_SYM_KEY_BITS or MAX_SYM_BLOCK -#endif - - -#endif // _TPM_ALGORITHM_DEFINES_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmBuildSwitches.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmBuildSwitches.h deleted file mode 100644 index 7ab437684..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmBuildSwitches.h +++ /dev/null @@ -1,341 +0,0 @@ - -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -// This file contains the build switches. This contains switches for multiple -// versions of the crypto-library so some may not apply to your environment. -// -// The switches are guarded so that they can either be set on the command line or -// set here. If the switch is listed on the command line (-DSOME_SWITCH) with NO -// setting, then the switch will be set to YES. If the switch setting is not on the -// command line or if the setting is other than YES or NO, then the switch will be set -// to the default value. The default can either be YES or NO as indicated on each line -// where the default is selected. -// -// A caution. Do not try to test these macros by inserting #defines in this file. For -// some curious reason, a variable set on the command line with no setting will have a -// value of 1. An #if SOME_VARIABLE will work if the variable is not defined or is -// defined on the command line with no initial setting. However, a -// "#define SOME_VARIABLE" is a null string and when used in "#if SOME_VARIABLE" will -// not be a proper expression If you want to test various switches, either use the -// command line or change the default. -// -#ifndef _TPM_BUILD_SWITCHES_H_ -#define _TPM_BUILD_SWITCHES_H_ - -#undef YES -#define YES 1 -#undef NO -#define NO 0 - -// Allow the command line to specify a "profile" file -#ifdef PROFILE -# define PROFILE_QUOTE(a) #a -# define PROFILE_INCLUDE(a) PROFILE_QUOTE(a) -# include PROFILE_INCLUDE(PROFILE) -#endif - -// Need an unambiguous definition for DEBUG. Don't change this -#ifndef DEBUG -# ifdef NDEBUG -# define DEBUG NO -# else -# define DEBUG YES -# endif -#elif (DEBUG != NO) && (DEBUG != YES) -# undef DEBUG -# define DEBUG YES // Default: Either YES or NO -#endif - -#include "CompilerDependencies.h" - -// This definition is required for the re-factored code -#if (!defined USE_BN_ECC_DATA) \ - || ((USE_BN_ECC_DATA != NO) && (USE_BN_ECC_DATA != YES)) -# undef USE_BN_ECC_DATA -# define USE_BN_ECC_DATA YES // Default: Either YES or NO -#endif - -// The SIMULATION switch allows certain other macros to be enabled. The things that -// can be enabled in a simulation include key caching, reproducible "random" -// sequences, instrumentation of the RSA key generation process, and certain other -// debug code. SIMULATION Needs to be defined as either YES or NO. This grouping of -// macros will make sure that it is set correctly. A simulated TPM would include a -// Virtual TPM. The interfaces for a Virtual TPM should be modified from the standard -// ones in the Simulator project. -// -// If SIMULATION is in the compile parameters without modifiers, -// make SIMULATION == YES -#if !(defined SIMULATION) || ((SIMULATION != NO) && (SIMULATION != YES)) -# undef SIMULATION -# define SIMULATION YES // Default: Either YES or NO -#endif - -// Define this to run the function that checks the compatibility between the -// chosen big number math library and the TPM code. Not all ports use this. -#if !(defined LIBRARY_COMPATABILITY_CHECK) \ - || ((LIBRARY_COMPATABILITY_CHECK != NO) \ - && (LIBRARY_COMPATABILITY_CHECK != YES)) -# undef LIBRARY_COMPATABILITY_CHECK -# define LIBRARY_COMPATABILITY_CHECK YES // Default: Either YES or NO -#endif - -#if !(defined FIPS_COMPLIANT) || ((FIPS_COMPLIANT != NO) && (FIPS_COMPLIANT != YES)) -# undef FIPS_COMPLIANT -# define FIPS_COMPLIANT YES // Default: Either YES or NO -#endif - -// Definition to allow alternate behavior for non-orderly startup. If there is a -// chance that the TPM could not update 'failedTries' -#if !(defined USE_DA_USED) || ((USE_DA_USED != NO) && (USE_DA_USED != YES)) -# undef USE_DA_USED -# define USE_DA_USED YES // Default: Either YES or NO -#endif - -// Define TABLE_DRIVEN_DISPATCH to use tables rather than case statements -// for command dispatch and handle unmarshaling -#if !(defined TABLE_DRIVEN_DISPATCH) \ - || ((TABLE_DRIVEN_DISPATCH != NO) && (TABLE_DRIVEN_DISPATCH != YES)) -# undef TABLE_DRIVEN_DISPATCH -# define TABLE_DRIVEN_DISPATCH YES // Default: Either YES or NO -#endif - -// This switch is used to enable the self-test capability in AlgorithmTests.c -#if !(defined SELF_TEST) || ((SELF_TEST != NO) && (SELF_TEST != YES)) -# undef SELF_TEST -# define SELF_TEST YES // Default: Either YES or NO -#endif - -// Enable the generation of RSA primes using a sieve. -#if !(defined RSA_KEY_SIEVE) || ((RSA_KEY_SIEVE != NO) && (RSA_KEY_SIEVE != YES)) -# undef RSA_KEY_SIEVE -# define RSA_KEY_SIEVE YES // Default: Either YES or NO -#endif - -// Enable the instrumentation of the sieve process. This is used to tune the sieve -// variables. -#if RSA_KEY_SIEVE && SIMULATION -# if !(defined RSA_INSTRUMENT) \ - || ((RSA_INSTRUMENT != NO) && (RSA_INSTRUMENT != YES)) -# undef RSA_INSTRUMENT -# define RSA_INSTRUMENT NO // Default: Either YES or NO -# endif -#endif - -// This switch enables the RNG state save and restore -#if !(defined _DRBG_STATE_SAVE) \ - || ((_DRBG_STATE_SAVE != NO) && (_DRBG_STATE_SAVE != YES)) -# undef _DRBG_STATE_SAVE -# define _DRBG_STATE_SAVE YES // Default: Either YES or NO -#endif - -// Switch added to support packed lists that leave out space associated with -// unimplemented commands. Comment this out to use linear lists. -// Note: if vendor specific commands are present, the associated list is always -// in compressed form. -#if !(defined COMPRESSED_LISTS) \ - || ((COMPRESSED_LISTS != NO) && (COMPRESSED_LISTS != YES)) -# undef COMPRESSED_LISTS -# define COMPRESSED_LISTS YES // Default: Either YES or NO -#endif - -// This switch indicates where clock epoch value should be stored. If this value -// defined, then it is assumed that the timer will change at any time so the -// nonce should be a random number kept in RAM. When it is not defined, then the -// timer only stops during power outages. -#if !(defined CLOCK_STOPS) || ((CLOCK_STOPS != NO) && (CLOCK_STOPS != YES)) -# undef CLOCK_STOPS -# define CLOCK_STOPS NO // Default: Either YES or NO -#endif - -// This switch allows use of #defines in place of pass-through marshaling or -// unmarshaling code. A pass-through function just calls another function to do -// the required function and does no parameter checking of its own. The -// table-driven dispatcher calls directly to the lowest level -// marshaling/unmarshaling code and by-passes any pass-through functions. -#if (defined USE_MARSHALING_DEFINES) && (USE_MARSHALING_DEFINES != NO) -# undef USE_MARSHALING_DEFINES -# define USE_MARSHALING_DEFINES YES -#else -# define USE_MARSHALING_DEFINES YES // Default: Either YES or NO -#endif - -//********************************** -// The switches in this group can only be enabled when doing debug during simulation -#if SIMULATION && DEBUG -// Enables use of the key cache. Default is YES -# if !(defined USE_RSA_KEY_CACHE) \ - || ((USE_RSA_KEY_CACHE != NO) && (USE_RSA_KEY_CACHE != YES)) -# undef USE_RSA_KEY_CACHE -# define USE_RSA_KEY_CACHE YES // Default: Either YES or NO -# endif - -// Enables use of a file to store the key cache values so that the TPM will start -// faster during debug. Default for this is YES -# if USE_RSA_KEY_CACHE -# if !(defined USE_KEY_CACHE_FILE) \ - || ((USE_KEY_CACHE_FILE != NO) && (USE_KEY_CACHE_FILE != YES)) -# undef USE_KEY_CACHE_FILE -# define USE_KEY_CACHE_FILE YES // Default: Either YES or NO -# endif -# else -# undef USE_KEY_CACHE_FILE -# define USE_KEY_CACHE_FILE NO -# endif // USE_RSA_KEY_CACHE - -// This provides fixed seeding of the RNG when doing debug on a simulator. This -// should allow consistent results on test runs as long as the input parameters -// to the functions remains the same. There is no default value. -# if !(defined USE_DEBUG_RNG) || ((USE_DEBUG_RNG != NO) && (USE_DEBUG_RNG != YES)) -# undef USE_DEBUG_RNG -# define USE_DEBUG_RNG YES // Default: Either YES or NO -# endif - -// Don't change these. They are the settings needed when not doing a simulation and -// not doing debug. Can't use the key cache except during debug. Otherwise, all of the -// key values end up being the same -#else -# define USE_RSA_KEY_CACHE NO -# define USE_RSA_KEY_CACHE_FILE NO -# define USE_DEBUG_RNG NO -#endif // DEBUG && SIMULATION - -#if DEBUG - -// In some cases, the relationship between two values may be dependent -// on things that change based on various selections like the chosen cryptographic -// libraries. It is possible that these selections will result in incompatible -// settings. These are often detectable by the compiler but it isn't always -// possible to do the check in the preprocessor code. For example, when the -// check requires use of 'sizeof()' then the preprocessor can't do the comparison. -// For these cases, we include a special macro that, depending on the compiler -// will generate a warning to indicate if the check always passes or always fails -// because it involves fixed constants. To run these checks, define COMPILER_CHECKS. -# if !(defined COMPILER_CHECKS) \ - || ((COMPILER_CHECKS != NO) && (COMPILER_CHECKS != YES)) -# undef COMPILER_CHECKS -# define COMPILER_CHECKS NO // Default: Either YES or NO -# endif - -// Some of the values (such as sizes) are the result of different options set in -// TpmProfile.h. The combination might not be consistent. A function is defined -// (TpmSizeChecks()) that is used to verify the sizes at run time. To enable the -// function, define this parameter. -# if !(defined RUNTIME_SIZE_CHECKS) \ - || ((RUNTIME_SIZE_CHECKS != NO) && (RUNTIME_SIZE_CHECKS != YES)) -# undef RUNTIME_SIZE_CHECKS -# define RUNTIME_SIZE_CHECKS NO // Default: Either YES or NO -# endif - -// If doing debug, can set the DRBG to print out the intermediate test values. -// Before enabling this, make sure that the dbgDumpMemBlock() function -// has been added someplace (preferably, somewhere in CryptRand.c) -# if !(defined DRBG_DEBUG_PRINT) \ - || ((DRBG_DEBUG_PRINT != NO) && (DRBG_DEBUG_PRINT != YES)) -# undef DRBG_DEBUG_PRINT -# define DRBG_DEBUG_PRINT NO // Default: Either YES or NO -# endif - -// If an assertion event it not going to produce any trace information (function and -// line number) then make FAIL_TRACE == NO -# if !(defined FAIL_TRACE) || ((FAIL_TRACE != NO) && (FAIL_TRACE != YES)) -# undef FAIL_TRACE -# define FAIL_TRACE YES // Default: Either YES or NO -# endif - -#endif // DEBUG - -// Indicate if the implementation is going to give lockout time credit for time up to -// the last orderly shutdown. -#if !(defined ACCUMULATE_SELF_HEAL_TIMER) \ - || ((ACCUMULATE_SELF_HEAL_TIMER != NO) && (ACCUMULATE_SELF_HEAL_TIMER != YES)) -# undef ACCUMULATE_SELF_HEAL_TIMER -# define ACCUMULATE_SELF_HEAL_TIMER YES // Default: Either YES or NO -#endif - -// Indicates if the implementation is to compute the sizes of the proof and primary -// seed size values based on the implemented algorithms. -#if !(defined USE_SPEC_COMPLIANT_PROOFS) \ - || ((USE_SPEC_COMPLIANT_PROOFS != NO) && (USE_SPEC_COMPLIANT_PROOFS != YES)) -# undef USE_SPEC_COMPLIANT_PROOFS -# define USE_SPEC_COMPLIANT_PROOFS YES // Default: Either YES or NO -#endif - -// Comment this out to allow compile to continue even though the chosen proof values -// do not match the compliant values. This is written so that someone would -// have to proactively ignore errors. -#if !(defined SKIP_PROOF_ERRORS) \ - || ((SKIP_PROOF_ERRORS != NO) && (SKIP_PROOF_ERRORS != YES)) -# undef SKIP_PROOF_ERRORS -# define SKIP_PROOF_ERRORS NO // Default: Either YES or NO -#endif - -// This define is used to eliminate the use of bit-fields. It can be enabled for big- -// or little-endian machines. For big-endian architectures that numbers bits in -// registers from left to right (MSb0) this must be enabled. Little-endian machines -// number from right to left with the least significant bit having assigned a bit -// number of 0. These are LSb0 machines (they are also little-endian so they are also -// least-significant byte 0 (LSB0) machines. Big-endian (MSB0) machines may number in -// either direction (MSb0 or LSb0). For an MSB0+MSb0 machine this value is required to -// be 'NO' -#if !(defined USE_BIT_FIELD_STRUCTURES) \ - || ((USE_BIT_FIELD_STRUCTURES != NO) && (USE_BIT_FIELD_STRUCTURES != YES)) -# undef USE_BIT_FIELD_STRUCTURES -# define USE_BIT_FIELD_STRUCTURES DEBUG // Default: Either YES or NO -#endif - -// This define is used to enable any runtime checks of the interface between the -// cryptographic library (e.g., OpenSSL) and the thunking layer. -#if !(defined LIBRARY_COMPATIBILITY_CHECK) \ - || ((LIBRARY_COMPATIBILITY_CHECK != NO) && (LIBRARY_COMPATIBILITY_CHECK != YES)) -# undef LIBRARY_COMPATIBILITY_CHECK -# define LIBRARY_COMPATIBILITY_CHECK NO // Default: Either YES or NO -#endif - -// This define is used to control the debug for the CertifyX509 command. -#if !(defined CERTIFYX509_DEBUG) \ - || ((CERTIFYX509_DEBUG != NO) && (CERTIFYX509_DEBUG != YES)) -# undef CERTIFYX509_DEBUG -# define CERTIFYX509_DEBUG YES // Default: Either YES or NO -#endif - -// Change these definitions to turn all algorithms or commands ON or OFF. That is, -// to turn all algorithms on, set ALG_NO to YES. This is mostly useful as a debug -// feature. -#define ALG_YES YES -#define ALG_NO NO -#define CC_YES YES -#define CC_NO NO - -#endif // _TPM_BUILD_SWITCHES_H_ \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmError.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmError.h deleted file mode 100644 index e90dbcae4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmError.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _TPM_ERROR_H -#define _TPM_ERROR_H - -#define FATAL_ERROR_ALLOCATION (1) -#define FATAL_ERROR_DIVIDE_ZERO (2) -#define FATAL_ERROR_INTERNAL (3) -#define FATAL_ERROR_PARAMETER (4) -#define FATAL_ERROR_ENTROPY (5) -#define FATAL_ERROR_SELF_TEST (6) -#define FATAL_ERROR_CRYPTO (7) -#define FATAL_ERROR_NV_UNRECOVERABLE (8) -#define FATAL_ERROR_REMANUFACTURED (9) // indicates that the TPM has - // been re-manufactured after an - // unrecoverable NV error -#define FATAL_ERROR_DRBG (10) -#define FATAL_ERROR_MOVE_SIZE (11) -#define FATAL_ERROR_COUNTER_OVERFLOW (12) -#define FATAL_ERROR_SUBTRACT (13) -#define FATAL_ERROR_MATHLIBRARY (14) -#define FATAL_ERROR_FORCED (666) - -#endif // _TPM_ERROR_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmProfile.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmProfile.h deleted file mode 100644 index 7329f79ba..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmProfile.h +++ /dev/null @@ -1,789 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Apr 10, 2019 Time: 03:21:33PM - */ - -#ifndef _TPM_PROFILE_H_ -#define _TPM_PROFILE_H_ - -// Table 2:4 - Defines for Logic Values -#undef TRUE -#define TRUE 1 -#undef FALSE -#define FALSE 0 -#undef YES -#define YES 1 -#undef NO -#define NO 0 -#undef SET -#define SET 1 -#undef CLEAR -#define CLEAR 0 - -// Table 0:1 - Defines for Processor Values -#ifndef BIG_ENDIAN_TPM -#define BIG_ENDIAN_TPM NO -#endif -#ifndef LITTLE_ENDIAN_TPM -#define LITTLE_ENDIAN_TPM !BIG_ENDIAN_TPM -#endif -#ifndef MOST_SIGNIFICANT_BIT_0 -#define MOST_SIGNIFICANT_BIT_0 NO -#endif -#ifndef LEAST_SIGNIFICANT_BIT_0 -#define LEAST_SIGNIFICANT_BIT_0 !MOST_SIGNIFICANT_BIT_0 -#endif -#ifndef AUTO_ALIGN -#define AUTO_ALIGN NO -#endif - -// Table 0:4 - Defines for Implemented Curves -#ifndef ECC_NIST_P192 -#define ECC_NIST_P192 NO -#endif -#ifndef ECC_NIST_P224 -#define ECC_NIST_P224 NO -#endif -#ifndef ECC_NIST_P256 -#define ECC_NIST_P256 YES -#endif -#ifndef ECC_NIST_P384 -#define ECC_NIST_P384 YES -#endif -#ifndef ECC_NIST_P521 -#define ECC_NIST_P521 NO -#endif -#ifndef ECC_BN_P256 -#define ECC_BN_P256 YES -#endif -#ifndef ECC_BN_P638 -#define ECC_BN_P638 NO -#endif -#ifndef ECC_SM2_P256 -#define ECC_SM2_P256 NO -#endif - -// Table 0:7 - Defines for Implementation Values -#ifndef FIELD_UPGRADE_IMPLEMENTED -#define FIELD_UPGRADE_IMPLEMENTED NO -#endif -#ifndef HASH_ALIGNMENT -#define HASH_ALIGNMENT 4 -#endif -#ifndef SYMMETRIC_ALIGNMENT -#define SYMMETRIC_ALIGNMENT 4 -#endif -#ifndef HASH_LIB -#define HASH_LIB Ossl -#endif -#ifndef SYM_LIB -#define SYM_LIB Ossl -#endif -#ifndef MATH_LIB -#define MATH_LIB Ossl -#endif -#ifndef BSIZE -#define BSIZE UINT16 -#endif -#ifndef IMPLEMENTATION_PCR -#define IMPLEMENTATION_PCR 24 -#endif -#ifndef PCR_SELECT_MAX -#define PCR_SELECT_MAX ((IMPLEMENTATION_PCR+7)/8) -#endif -#ifndef PLATFORM_PCR -#define PLATFORM_PCR 24 -#endif -#ifndef PCR_SELECT_MIN -#define PCR_SELECT_MIN ((PLATFORM_PCR+7)/8) -#endif -#ifndef DRTM_PCR -#define DRTM_PCR 17 -#endif -#ifndef HCRTM_PCR -#define HCRTM_PCR 0 -#endif -#ifndef NUM_LOCALITIES -#define NUM_LOCALITIES 5 -#endif -#ifndef MAX_HANDLE_NUM -#define MAX_HANDLE_NUM 3 -#endif -#ifndef MAX_ACTIVE_SESSIONS -#define MAX_ACTIVE_SESSIONS 64 -#endif -#ifndef CONTEXT_SLOT -#define CONTEXT_SLOT UINT16 -#endif -#ifndef CONTEXT_COUNTER -#define CONTEXT_COUNTER UINT64 -#endif -#ifndef MAX_LOADED_SESSIONS -#define MAX_LOADED_SESSIONS 3 -#endif -#ifndef MAX_SESSION_NUM -#define MAX_SESSION_NUM 3 -#endif -#ifndef MAX_LOADED_OBJECTS -#define MAX_LOADED_OBJECTS 3 -#endif -#ifndef MIN_EVICT_OBJECTS -#define MIN_EVICT_OBJECTS 2 -#endif -#ifndef NUM_POLICY_PCR_GROUP -#define NUM_POLICY_PCR_GROUP 1 -#endif -#ifndef NUM_AUTHVALUE_PCR_GROUP -#define NUM_AUTHVALUE_PCR_GROUP 1 -#endif -#ifndef MAX_CONTEXT_SIZE -#define MAX_CONTEXT_SIZE 1264 -#endif -#ifndef MAX_DIGEST_BUFFER -#define MAX_DIGEST_BUFFER 1024 -#endif -#ifndef MAX_NV_INDEX_SIZE -#define MAX_NV_INDEX_SIZE 2048 -#endif -#ifndef MAX_NV_BUFFER_SIZE -#define MAX_NV_BUFFER_SIZE 1024 -#endif -#ifndef MAX_CAP_BUFFER -#define MAX_CAP_BUFFER 1024 -#endif -#ifndef NV_MEMORY_SIZE -#define NV_MEMORY_SIZE 16384 -#endif -#ifndef MIN_COUNTER_INDICES -#define MIN_COUNTER_INDICES 8 -#endif -#ifndef NUM_STATIC_PCR -#define NUM_STATIC_PCR 16 -#endif -#ifndef MAX_ALG_LIST_SIZE -#define MAX_ALG_LIST_SIZE 64 -#endif -#ifndef PRIMARY_SEED_SIZE -#define PRIMARY_SEED_SIZE 32 -#endif -#ifndef CONTEXT_ENCRYPT_ALGORITHM -#define CONTEXT_ENCRYPT_ALGORITHM AES -#endif -#ifndef NV_CLOCK_UPDATE_INTERVAL -#define NV_CLOCK_UPDATE_INTERVAL 12 -#endif -#ifndef NUM_POLICY_PCR -#define NUM_POLICY_PCR 1 -#endif -#ifndef MAX_COMMAND_SIZE -#define MAX_COMMAND_SIZE 4096 -#endif -#ifndef MAX_RESPONSE_SIZE -#define MAX_RESPONSE_SIZE 4096 -#endif -#ifndef ORDERLY_BITS -#define ORDERLY_BITS 8 -#endif -#ifndef MAX_SYM_DATA -#define MAX_SYM_DATA 128 -#endif -#ifndef MAX_RNG_ENTROPY_SIZE -#define MAX_RNG_ENTROPY_SIZE 64 -#endif -#ifndef RAM_INDEX_SPACE -#define RAM_INDEX_SPACE 512 -#endif -#ifndef RSA_DEFAULT_PUBLIC_EXPONENT -#define RSA_DEFAULT_PUBLIC_EXPONENT 0x00010001 -#endif -#ifndef ENABLE_PCR_NO_INCREMENT -#define ENABLE_PCR_NO_INCREMENT YES -#endif -#ifndef CRT_FORMAT_RSA -#define CRT_FORMAT_RSA YES -#endif -#ifndef VENDOR_COMMAND_COUNT -#define VENDOR_COMMAND_COUNT 0 -#endif -#ifndef MAX_VENDOR_BUFFER_SIZE -#define MAX_VENDOR_BUFFER_SIZE 1024 -#endif -#ifndef TPM_MAX_DERIVATION_BITS -#define TPM_MAX_DERIVATION_BITS 8192 -#endif -#ifndef RSA_MAX_PRIME -#define RSA_MAX_PRIME (MAX_RSA_KEY_BYTES/2) -#endif -#ifndef RSA_PRIVATE_SIZE -#define RSA_PRIVATE_SIZE (RSA_MAX_PRIME*5) -#endif -#ifndef SIZE_OF_X509_SERIAL_NUMBER -#define SIZE_OF_X509_SERIAL_NUMBER 20 -#endif -#ifndef PRIVATE_VENDOR_SPECIFIC_BYTES -#define PRIVATE_VENDOR_SPECIFIC_BYTES RSA_PRIVATE_SIZE -#endif - -// Table 0:2 - Defines for Implemented Algorithms -#ifndef ALG_AES -#define ALG_AES ALG_YES -#endif -#ifndef ALG_CAMELLIA -#define ALG_CAMELLIA ALG_NO /* Not specified by vendor */ -#endif -#ifndef ALG_CBC -#define ALG_CBC ALG_YES -#endif -#ifndef ALG_CFB -#define ALG_CFB ALG_YES -#endif -#ifndef ALG_CMAC -#define ALG_CMAC ALG_YES -#endif -#ifndef ALG_CTR -#define ALG_CTR ALG_YES -#endif -#ifndef ALG_ECB -#define ALG_ECB ALG_YES -#endif -#ifndef ALG_ECC -#define ALG_ECC ALG_YES -#endif -#ifndef ALG_ECDAA -#define ALG_ECDAA (ALG_YES && ALG_ECC) -#endif -#ifndef ALG_ECDH -#define ALG_ECDH (ALG_YES && ALG_ECC) -#endif -#ifndef ALG_ECDSA -#define ALG_ECDSA (ALG_YES && ALG_ECC) -#endif -#ifndef ALG_ECMQV -#define ALG_ECMQV (ALG_NO && ALG_ECC) -#endif -#ifndef ALG_ECSCHNORR -#define ALG_ECSCHNORR (ALG_YES && ALG_ECC) -#endif -#ifndef ALG_HMAC -#define ALG_HMAC ALG_YES -#endif -#ifndef ALG_KDF1_SP800_108 -#define ALG_KDF1_SP800_108 ALG_YES -#endif -#ifndef ALG_KDF1_SP800_56A -#define ALG_KDF1_SP800_56A (ALG_YES && ALG_ECC) -#endif -#ifndef ALG_KDF2 -#define ALG_KDF2 ALG_NO -#endif -#ifndef ALG_KEYEDHASH -#define ALG_KEYEDHASH ALG_YES -#endif -#ifndef ALG_MGF1 -#define ALG_MGF1 ALG_YES -#endif -#ifndef ALG_OAEP -#define ALG_OAEP (ALG_YES && ALG_RSA) -#endif -#ifndef ALG_OFB -#define ALG_OFB ALG_YES -#endif -#ifndef ALG_RSA -#define ALG_RSA ALG_YES -#endif -#ifndef ALG_RSAES -#define ALG_RSAES (ALG_YES && ALG_RSA) -#endif -#ifndef ALG_RSAPSS -#define ALG_RSAPSS (ALG_YES && ALG_RSA) -#endif -#ifndef ALG_RSASSA -#define ALG_RSASSA (ALG_YES && ALG_RSA) -#endif -#ifndef ALG_SHA -#define ALG_SHA ALG_NO /* Not specified by vendor */ -#endif -#ifndef ALG_SHA1 -#define ALG_SHA1 ALG_YES -#endif -#ifndef ALG_SHA256 -#define ALG_SHA256 ALG_YES -#endif -#ifndef ALG_SHA384 -#define ALG_SHA384 ALG_YES -#endif -#ifndef ALG_SHA3_256 -#define ALG_SHA3_256 ALG_NO /* Not specified by vendor */ -#endif -#ifndef ALG_SHA3_384 -#define ALG_SHA3_384 ALG_NO /* Not specified by vendor */ -#endif -#ifndef ALG_SHA3_512 -#define ALG_SHA3_512 ALG_NO /* Not specified by vendor */ -#endif -#ifndef ALG_SHA512 -#define ALG_SHA512 ALG_NO -#endif -#ifndef ALG_SM2 -#define ALG_SM2 (ALG_NO && ALG_ECC) -#endif -#ifndef ALG_SM3_256 -#define ALG_SM3_256 ALG_NO -#endif -#ifndef ALG_SM4 -#define ALG_SM4 ALG_NO -#endif -#ifndef ALG_SYMCIPHER -#define ALG_SYMCIPHER ALG_YES -#endif -#ifndef ALG_TDES -#define ALG_TDES ALG_NO -#endif -#ifndef ALG_XOR -#define ALG_XOR ALG_YES -#endif - -// Table 1:00 - Defines for RSA Asymmetric Cipher Algorithm Constants -#ifndef RSA_1024 -#define RSA_1024 (ALG_RSA & YES) -#endif -#ifndef RSA_2048 -#define RSA_2048 (ALG_RSA & YES) -#endif -#ifndef RSA_3072 -#define RSA_3072 (ALG_RSA & NO) -#endif -#ifndef RSA_4096 -#define RSA_4096 (ALG_RSA & NO) -#endif - -// Table 1:17 - Defines for AES Symmetric Cipher Algorithm Constants -#ifndef AES_128 -#define AES_128 (ALG_AES & YES) -#endif -#ifndef AES_192 -#define AES_192 (ALG_AES & NO) -#endif -#ifndef AES_256 -#define AES_256 (ALG_AES & YES) -#endif - -// Table 1:18 - Defines for SM4 Symmetric Cipher Algorithm Constants -#ifndef SM4_128 -#define SM4_128 (ALG_SM4 & YES) -#endif - -// Table 1:19 - Defines for CAMELLIA Symmetric Cipher Algorithm Constants -#ifndef CAMELLIA_128 -#define CAMELLIA_128 (ALG_CAMELLIA & YES) -#endif -#ifndef CAMELLIA_192 -#define CAMELLIA_192 (ALG_CAMELLIA & NO) -#endif -#ifndef CAMELLIA_256 -#define CAMELLIA_256 (ALG_CAMELLIA & NO) -#endif - -// Table 1:17 - Defines for TDES Symmetric Cipher Algorithm Constants -#ifndef TDES_128 -#define TDES_128 (ALG_TDES & YES) -#endif -#ifndef TDES_192 -#define TDES_192 (ALG_TDES & YES) -#endif - -// Table 0:5 - Defines for Implemented Commands -#ifndef CC_AC_GetCapability -#define CC_AC_GetCapability CC_YES -#endif -#ifndef CC_AC_Send -#define CC_AC_Send CC_YES -#endif -#ifndef CC_ActivateCredential -#define CC_ActivateCredential CC_YES -#endif -#ifndef CC_Certify -#define CC_Certify CC_YES -#endif -#ifndef CC_CertifyCreation -#define CC_CertifyCreation CC_YES -#endif -#ifndef CC_CertifyX509 -#define CC_CertifyX509 CC_YES -#endif -#ifndef CC_ChangeEPS -#define CC_ChangeEPS CC_YES -#endif -#ifndef CC_ChangePPS -#define CC_ChangePPS CC_YES -#endif -#ifndef CC_Clear -#define CC_Clear CC_YES -#endif -#ifndef CC_ClearControl -#define CC_ClearControl CC_YES -#endif -#ifndef CC_ClockRateAdjust -#define CC_ClockRateAdjust CC_YES -#endif -#ifndef CC_ClockSet -#define CC_ClockSet CC_YES -#endif -#ifndef CC_Commit -#define CC_Commit (CC_YES && ALG_ECC) -#endif -#ifndef CC_ContextLoad -#define CC_ContextLoad CC_YES -#endif -#ifndef CC_ContextSave -#define CC_ContextSave CC_YES -#endif -#ifndef CC_Create -#define CC_Create CC_YES -#endif -#ifndef CC_CreateLoaded -#define CC_CreateLoaded CC_YES -#endif -#ifndef CC_CreatePrimary -#define CC_CreatePrimary CC_YES -#endif -#ifndef CC_DictionaryAttackLockReset -#define CC_DictionaryAttackLockReset CC_YES -#endif -#ifndef CC_DictionaryAttackParameters -#define CC_DictionaryAttackParameters CC_YES -#endif -#ifndef CC_Duplicate -#define CC_Duplicate CC_YES -#endif -#ifndef CC_ECC_Parameters -#define CC_ECC_Parameters (CC_YES && ALG_ECC) -#endif -#ifndef CC_ECDH_KeyGen -#define CC_ECDH_KeyGen (CC_YES && ALG_ECC) -#endif -#ifndef CC_ECDH_ZGen -#define CC_ECDH_ZGen (CC_YES && ALG_ECC) -#endif -#ifndef CC_EC_Ephemeral -#define CC_EC_Ephemeral (CC_YES && ALG_ECC) -#endif -#ifndef CC_EncryptDecrypt -#define CC_EncryptDecrypt CC_YES -#endif -#ifndef CC_EncryptDecrypt2 -#define CC_EncryptDecrypt2 CC_YES -#endif -#ifndef CC_EventSequenceComplete -#define CC_EventSequenceComplete CC_YES -#endif -#ifndef CC_EvictControl -#define CC_EvictControl CC_YES -#endif -#ifndef CC_FieldUpgradeData -#define CC_FieldUpgradeData CC_NO -#endif -#ifndef CC_FieldUpgradeStart -#define CC_FieldUpgradeStart CC_NO -#endif -#ifndef CC_FirmwareRead -#define CC_FirmwareRead CC_NO -#endif -#ifndef CC_FlushContext -#define CC_FlushContext CC_YES -#endif -#ifndef CC_GetCapability -#define CC_GetCapability CC_YES -#endif -#ifndef CC_GetCommandAuditDigest -#define CC_GetCommandAuditDigest CC_YES -#endif -#ifndef CC_GetRandom -#define CC_GetRandom CC_YES -#endif -#ifndef CC_GetSessionAuditDigest -#define CC_GetSessionAuditDigest CC_YES -#endif -#ifndef CC_GetTestResult -#define CC_GetTestResult CC_YES -#endif -#ifndef CC_GetTime -#define CC_GetTime CC_YES -#endif -#ifndef CC_HMAC -#define CC_HMAC (CC_YES && !ALG_CMAC) -#endif -#ifndef CC_HMAC_Start -#define CC_HMAC_Start (CC_YES && !ALG_CMAC) -#endif -#ifndef CC_Hash -#define CC_Hash CC_YES -#endif -#ifndef CC_HashSequenceStart -#define CC_HashSequenceStart CC_YES -#endif -#ifndef CC_HierarchyChangeAuth -#define CC_HierarchyChangeAuth CC_YES -#endif -#ifndef CC_HierarchyControl -#define CC_HierarchyControl CC_YES -#endif -#ifndef CC_Import -#define CC_Import CC_YES -#endif -#ifndef CC_IncrementalSelfTest -#define CC_IncrementalSelfTest CC_YES -#endif -#ifndef CC_Load -#define CC_Load CC_YES -#endif -#ifndef CC_LoadExternal -#define CC_LoadExternal CC_YES -#endif -#ifndef CC_MAC -#define CC_MAC (CC_YES && ALG_CMAC) -#endif -#ifndef CC_MAC_Start -#define CC_MAC_Start (CC_YES && ALG_CMAC) -#endif -#ifndef CC_MakeCredential -#define CC_MakeCredential CC_YES -#endif -#ifndef CC_NV_Certify -#define CC_NV_Certify CC_YES -#endif -#ifndef CC_NV_ChangeAuth -#define CC_NV_ChangeAuth CC_YES -#endif -#ifndef CC_NV_DefineSpace -#define CC_NV_DefineSpace CC_YES -#endif -#ifndef CC_NV_Extend -#define CC_NV_Extend CC_YES -#endif -#ifndef CC_NV_GlobalWriteLock -#define CC_NV_GlobalWriteLock CC_YES -#endif -#ifndef CC_NV_Increment -#define CC_NV_Increment CC_YES -#endif -#ifndef CC_NV_Read -#define CC_NV_Read CC_YES -#endif -#ifndef CC_NV_ReadLock -#define CC_NV_ReadLock CC_YES -#endif -#ifndef CC_NV_ReadPublic -#define CC_NV_ReadPublic CC_YES -#endif -#ifndef CC_NV_SetBits -#define CC_NV_SetBits CC_YES -#endif -#ifndef CC_NV_UndefineSpace -#define CC_NV_UndefineSpace CC_YES -#endif -#ifndef CC_NV_UndefineSpaceSpecial -#define CC_NV_UndefineSpaceSpecial CC_YES -#endif -#ifndef CC_NV_Write -#define CC_NV_Write CC_YES -#endif -#ifndef CC_NV_WriteLock -#define CC_NV_WriteLock CC_YES -#endif -#ifndef CC_ObjectChangeAuth -#define CC_ObjectChangeAuth CC_YES -#endif -#ifndef CC_PCR_Allocate -#define CC_PCR_Allocate CC_YES -#endif -#ifndef CC_PCR_Event -#define CC_PCR_Event CC_YES -#endif -#ifndef CC_PCR_Extend -#define CC_PCR_Extend CC_YES -#endif -#ifndef CC_PCR_Read -#define CC_PCR_Read CC_YES -#endif -#ifndef CC_PCR_Reset -#define CC_PCR_Reset CC_YES -#endif -#ifndef CC_PCR_SetAuthPolicy -#define CC_PCR_SetAuthPolicy CC_YES -#endif -#ifndef CC_PCR_SetAuthValue -#define CC_PCR_SetAuthValue CC_YES -#endif -#ifndef CC_PP_Commands -#define CC_PP_Commands CC_YES -#endif -#ifndef CC_PolicyAuthValue -#define CC_PolicyAuthValue CC_YES -#endif -#ifndef CC_PolicyAuthorize -#define CC_PolicyAuthorize CC_YES -#endif -#ifndef CC_PolicyAuthorizeNV -#define CC_PolicyAuthorizeNV CC_YES -#endif -#ifndef CC_PolicyCommandCode -#define CC_PolicyCommandCode CC_YES -#endif -#ifndef CC_PolicyCounterTimer -#define CC_PolicyCounterTimer CC_YES -#endif -#ifndef CC_PolicyCpHash -#define CC_PolicyCpHash CC_YES -#endif -#ifndef CC_PolicyDuplicationSelect -#define CC_PolicyDuplicationSelect CC_YES -#endif -#ifndef CC_PolicyGetDigest -#define CC_PolicyGetDigest CC_YES -#endif -#ifndef CC_PolicyLocality -#define CC_PolicyLocality CC_YES -#endif -#ifndef CC_PolicyNV -#define CC_PolicyNV CC_YES -#endif -#ifndef CC_PolicyNameHash -#define CC_PolicyNameHash CC_YES -#endif -#ifndef CC_PolicyNvWritten -#define CC_PolicyNvWritten CC_YES -#endif -#ifndef CC_PolicyOR -#define CC_PolicyOR CC_YES -#endif -#ifndef CC_PolicyPCR -#define CC_PolicyPCR CC_YES -#endif -#ifndef CC_PolicyPassword -#define CC_PolicyPassword CC_YES -#endif -#ifndef CC_PolicyPhysicalPresence -#define CC_PolicyPhysicalPresence CC_YES -#endif -#ifndef CC_PolicyRestart -#define CC_PolicyRestart CC_YES -#endif -#ifndef CC_PolicySecret -#define CC_PolicySecret CC_YES -#endif -#ifndef CC_PolicySigned -#define CC_PolicySigned CC_YES -#endif -#ifndef CC_PolicyTemplate -#define CC_PolicyTemplate CC_YES -#endif -#ifndef CC_PolicyTicket -#define CC_PolicyTicket CC_YES -#endif -#ifndef CC_Policy_AC_SendSelect -#define CC_Policy_AC_SendSelect CC_YES -#endif -#ifndef CC_Quote -#define CC_Quote CC_YES -#endif -#ifndef CC_RSA_Decrypt -#define CC_RSA_Decrypt (CC_YES && ALG_RSA) -#endif -#ifndef CC_RSA_Encrypt -#define CC_RSA_Encrypt (CC_YES && ALG_RSA) -#endif -#ifndef CC_ReadClock -#define CC_ReadClock CC_YES -#endif -#ifndef CC_ReadPublic -#define CC_ReadPublic CC_YES -#endif -#ifndef CC_Rewrap -#define CC_Rewrap CC_YES -#endif -#ifndef CC_SelfTest -#define CC_SelfTest CC_YES -#endif -#ifndef CC_SequenceComplete -#define CC_SequenceComplete CC_YES -#endif -#ifndef CC_SequenceUpdate -#define CC_SequenceUpdate CC_YES -#endif -#ifndef CC_SetAlgorithmSet -#define CC_SetAlgorithmSet CC_YES -#endif -#ifndef CC_SetCommandCodeAuditStatus -#define CC_SetCommandCodeAuditStatus CC_YES -#endif -#ifndef CC_SetPrimaryPolicy -#define CC_SetPrimaryPolicy CC_YES -#endif -#ifndef CC_Shutdown -#define CC_Shutdown CC_YES -#endif -#ifndef CC_Sign -#define CC_Sign CC_YES -#endif -#ifndef CC_StartAuthSession -#define CC_StartAuthSession CC_YES -#endif -#ifndef CC_Startup -#define CC_Startup CC_YES -#endif -#ifndef CC_StirRandom -#define CC_StirRandom CC_YES -#endif -#ifndef CC_TestParms -#define CC_TestParms CC_YES -#endif -#ifndef CC_Unseal -#define CC_Unseal CC_YES -#endif -#ifndef CC_Vendor_TCG_Test -#define CC_Vendor_TCG_Test CC_YES -#endif -#ifndef CC_VerifySignature -#define CC_VerifySignature CC_YES -#endif -#ifndef CC_ZGen_2Phase -#define CC_ZGen_2Phase (CC_YES && ALG_ECC) -#endif - - -#endif // _TPM_PROFILE_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmTypes.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmTypes.h deleted file mode 100644 index aefcdf280..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/TpmTypes.h +++ /dev/null @@ -1,2374 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Apr 10, 2019 Time: 03:21:33PM - */ - -#ifndef _TPM_TYPES_H_ -#define _TPM_TYPES_H_ - -// Table 1:2 - Definition of TPM_ALG_ID Constants -typedef UINT16 TPM_ALG_ID; -#define TYPE_OF_TPM_ALG_ID UINT16 -#define ALG_ERROR_VALUE 0x0000 -#define TPM_ALG_ERROR (TPM_ALG_ID)(ALG_ERROR_VALUE) -#define ALG_RSA_VALUE 0x0001 -#define TPM_ALG_RSA (TPM_ALG_ID)(ALG_RSA_VALUE) -#define ALG_TDES_VALUE 0x0003 -#define TPM_ALG_TDES (TPM_ALG_ID)(ALG_TDES_VALUE) -#define ALG_SHA_VALUE 0x0004 -#define TPM_ALG_SHA (TPM_ALG_ID)(ALG_SHA_VALUE) -#define ALG_SHA1_VALUE 0x0004 -#define TPM_ALG_SHA1 (TPM_ALG_ID)(ALG_SHA1_VALUE) -#define ALG_HMAC_VALUE 0x0005 -#define TPM_ALG_HMAC (TPM_ALG_ID)(ALG_HMAC_VALUE) -#define ALG_AES_VALUE 0x0006 -#define TPM_ALG_AES (TPM_ALG_ID)(ALG_AES_VALUE) -#define ALG_MGF1_VALUE 0x0007 -#define TPM_ALG_MGF1 (TPM_ALG_ID)(ALG_MGF1_VALUE) -#define ALG_KEYEDHASH_VALUE 0x0008 -#define TPM_ALG_KEYEDHASH (TPM_ALG_ID)(ALG_KEYEDHASH_VALUE) -#define ALG_XOR_VALUE 0x000A -#define TPM_ALG_XOR (TPM_ALG_ID)(ALG_XOR_VALUE) -#define ALG_SHA256_VALUE 0x000B -#define TPM_ALG_SHA256 (TPM_ALG_ID)(ALG_SHA256_VALUE) -#define ALG_SHA384_VALUE 0x000C -#define TPM_ALG_SHA384 (TPM_ALG_ID)(ALG_SHA384_VALUE) -#define ALG_SHA512_VALUE 0x000D -#define TPM_ALG_SHA512 (TPM_ALG_ID)(ALG_SHA512_VALUE) -#define ALG_NULL_VALUE 0x0010 -#define TPM_ALG_NULL (TPM_ALG_ID)(ALG_NULL_VALUE) -#define ALG_SM3_256_VALUE 0x0012 -#define TPM_ALG_SM3_256 (TPM_ALG_ID)(ALG_SM3_256_VALUE) -#define ALG_SM4_VALUE 0x0013 -#define TPM_ALG_SM4 (TPM_ALG_ID)(ALG_SM4_VALUE) -#define ALG_RSASSA_VALUE 0x0014 -#define TPM_ALG_RSASSA (TPM_ALG_ID)(ALG_RSASSA_VALUE) -#define ALG_RSAES_VALUE 0x0015 -#define TPM_ALG_RSAES (TPM_ALG_ID)(ALG_RSAES_VALUE) -#define ALG_RSAPSS_VALUE 0x0016 -#define TPM_ALG_RSAPSS (TPM_ALG_ID)(ALG_RSAPSS_VALUE) -#define ALG_OAEP_VALUE 0x0017 -#define TPM_ALG_OAEP (TPM_ALG_ID)(ALG_OAEP_VALUE) -#define ALG_ECDSA_VALUE 0x0018 -#define TPM_ALG_ECDSA (TPM_ALG_ID)(ALG_ECDSA_VALUE) -#define ALG_ECDH_VALUE 0x0019 -#define TPM_ALG_ECDH (TPM_ALG_ID)(ALG_ECDH_VALUE) -#define ALG_ECDAA_VALUE 0x001A -#define TPM_ALG_ECDAA (TPM_ALG_ID)(ALG_ECDAA_VALUE) -#define ALG_SM2_VALUE 0x001B -#define TPM_ALG_SM2 (TPM_ALG_ID)(ALG_SM2_VALUE) -#define ALG_ECSCHNORR_VALUE 0x001C -#define TPM_ALG_ECSCHNORR (TPM_ALG_ID)(ALG_ECSCHNORR_VALUE) -#define ALG_ECMQV_VALUE 0x001D -#define TPM_ALG_ECMQV (TPM_ALG_ID)(ALG_ECMQV_VALUE) -#define ALG_KDF1_SP800_56A_VALUE 0x0020 -#define TPM_ALG_KDF1_SP800_56A (TPM_ALG_ID)(ALG_KDF1_SP800_56A_VALUE) -#define ALG_KDF2_VALUE 0x0021 -#define TPM_ALG_KDF2 (TPM_ALG_ID)(ALG_KDF2_VALUE) -#define ALG_KDF1_SP800_108_VALUE 0x0022 -#define TPM_ALG_KDF1_SP800_108 (TPM_ALG_ID)(ALG_KDF1_SP800_108_VALUE) -#define ALG_ECC_VALUE 0x0023 -#define TPM_ALG_ECC (TPM_ALG_ID)(ALG_ECC_VALUE) -#define ALG_SYMCIPHER_VALUE 0x0025 -#define TPM_ALG_SYMCIPHER (TPM_ALG_ID)(ALG_SYMCIPHER_VALUE) -#define ALG_CAMELLIA_VALUE 0x0026 -#define TPM_ALG_CAMELLIA (TPM_ALG_ID)(ALG_CAMELLIA_VALUE) -#define ALG_SHA3_256_VALUE 0x0027 -#define TPM_ALG_SHA3_256 (TPM_ALG_ID)(ALG_SHA3_256_VALUE) -#define ALG_SHA3_384_VALUE 0x0028 -#define TPM_ALG_SHA3_384 (TPM_ALG_ID)(ALG_SHA3_384_VALUE) -#define ALG_SHA3_512_VALUE 0x0029 -#define TPM_ALG_SHA3_512 (TPM_ALG_ID)(ALG_SHA3_512_VALUE) -#define ALG_CMAC_VALUE 0x003F -#define TPM_ALG_CMAC (TPM_ALG_ID)(ALG_CMAC_VALUE) -#define ALG_CTR_VALUE 0x0040 -#define TPM_ALG_CTR (TPM_ALG_ID)(ALG_CTR_VALUE) -#define ALG_OFB_VALUE 0x0041 -#define TPM_ALG_OFB (TPM_ALG_ID)(ALG_OFB_VALUE) -#define ALG_CBC_VALUE 0x0042 -#define TPM_ALG_CBC (TPM_ALG_ID)(ALG_CBC_VALUE) -#define ALG_CFB_VALUE 0x0043 -#define TPM_ALG_CFB (TPM_ALG_ID)(ALG_CFB_VALUE) -#define ALG_ECB_VALUE 0x0044 -#define TPM_ALG_ECB (TPM_ALG_ID)(ALG_ECB_VALUE) -// Values derived from Table 1:2 -#define ALG_FIRST_VALUE 0x0001 -#define TPM_ALG_FIRST (TPM_ALG_ID)(ALG_FIRST_VALUE) -#define ALG_LAST_VALUE 0x0044 -#define TPM_ALG_LAST (TPM_ALG_ID)(ALG_LAST_VALUE) - -// Table 1:3 - Definition of TPM_ECC_CURVE Constants -typedef UINT16 TPM_ECC_CURVE; -#define TYPE_OF_TPM_ECC_CURVE UINT16 -#define TPM_ECC_NONE (TPM_ECC_CURVE)(0x0000) -#define TPM_ECC_NIST_P192 (TPM_ECC_CURVE)(0x0001) -#define TPM_ECC_NIST_P224 (TPM_ECC_CURVE)(0x0002) -#define TPM_ECC_NIST_P256 (TPM_ECC_CURVE)(0x0003) -#define TPM_ECC_NIST_P384 (TPM_ECC_CURVE)(0x0004) -#define TPM_ECC_NIST_P521 (TPM_ECC_CURVE)(0x0005) -#define TPM_ECC_BN_P256 (TPM_ECC_CURVE)(0x0010) -#define TPM_ECC_BN_P638 (TPM_ECC_CURVE)(0x0011) -#define TPM_ECC_SM2_P256 (TPM_ECC_CURVE)(0x0020) - -// Table 2:12 - Definition of TPM_CC Constants -typedef UINT32 TPM_CC; -#define TYPE_OF_TPM_CC UINT32 -#define TPM_CC_NV_UndefineSpaceSpecial (TPM_CC)(0x0000011F) -#define TPM_CC_EvictControl (TPM_CC)(0x00000120) -#define TPM_CC_HierarchyControl (TPM_CC)(0x00000121) -#define TPM_CC_NV_UndefineSpace (TPM_CC)(0x00000122) -#define TPM_CC_ChangeEPS (TPM_CC)(0x00000124) -#define TPM_CC_ChangePPS (TPM_CC)(0x00000125) -#define TPM_CC_Clear (TPM_CC)(0x00000126) -#define TPM_CC_ClearControl (TPM_CC)(0x00000127) -#define TPM_CC_ClockSet (TPM_CC)(0x00000128) -#define TPM_CC_HierarchyChangeAuth (TPM_CC)(0x00000129) -#define TPM_CC_NV_DefineSpace (TPM_CC)(0x0000012A) -#define TPM_CC_PCR_Allocate (TPM_CC)(0x0000012B) -#define TPM_CC_PCR_SetAuthPolicy (TPM_CC)(0x0000012C) -#define TPM_CC_PP_Commands (TPM_CC)(0x0000012D) -#define TPM_CC_SetPrimaryPolicy (TPM_CC)(0x0000012E) -#define TPM_CC_FieldUpgradeStart (TPM_CC)(0x0000012F) -#define TPM_CC_ClockRateAdjust (TPM_CC)(0x00000130) -#define TPM_CC_CreatePrimary (TPM_CC)(0x00000131) -#define TPM_CC_NV_GlobalWriteLock (TPM_CC)(0x00000132) -#define TPM_CC_GetCommandAuditDigest (TPM_CC)(0x00000133) -#define TPM_CC_NV_Increment (TPM_CC)(0x00000134) -#define TPM_CC_NV_SetBits (TPM_CC)(0x00000135) -#define TPM_CC_NV_Extend (TPM_CC)(0x00000136) -#define TPM_CC_NV_Write (TPM_CC)(0x00000137) -#define TPM_CC_NV_WriteLock (TPM_CC)(0x00000138) -#define TPM_CC_DictionaryAttackLockReset (TPM_CC)(0x00000139) -#define TPM_CC_DictionaryAttackParameters (TPM_CC)(0x0000013A) -#define TPM_CC_NV_ChangeAuth (TPM_CC)(0x0000013B) -#define TPM_CC_PCR_Event (TPM_CC)(0x0000013C) -#define TPM_CC_PCR_Reset (TPM_CC)(0x0000013D) -#define TPM_CC_SequenceComplete (TPM_CC)(0x0000013E) -#define TPM_CC_SetAlgorithmSet (TPM_CC)(0x0000013F) -#define TPM_CC_SetCommandCodeAuditStatus (TPM_CC)(0x00000140) -#define TPM_CC_FieldUpgradeData (TPM_CC)(0x00000141) -#define TPM_CC_IncrementalSelfTest (TPM_CC)(0x00000142) -#define TPM_CC_SelfTest (TPM_CC)(0x00000143) -#define TPM_CC_Startup (TPM_CC)(0x00000144) -#define TPM_CC_Shutdown (TPM_CC)(0x00000145) -#define TPM_CC_StirRandom (TPM_CC)(0x00000146) -#define TPM_CC_ActivateCredential (TPM_CC)(0x00000147) -#define TPM_CC_Certify (TPM_CC)(0x00000148) -#define TPM_CC_PolicyNV (TPM_CC)(0x00000149) -#define TPM_CC_CertifyCreation (TPM_CC)(0x0000014A) -#define TPM_CC_Duplicate (TPM_CC)(0x0000014B) -#define TPM_CC_GetTime (TPM_CC)(0x0000014C) -#define TPM_CC_GetSessionAuditDigest (TPM_CC)(0x0000014D) -#define TPM_CC_NV_Read (TPM_CC)(0x0000014E) -#define TPM_CC_NV_ReadLock (TPM_CC)(0x0000014F) -#define TPM_CC_ObjectChangeAuth (TPM_CC)(0x00000150) -#define TPM_CC_PolicySecret (TPM_CC)(0x00000151) -#define TPM_CC_Rewrap (TPM_CC)(0x00000152) -#define TPM_CC_Create (TPM_CC)(0x00000153) -#define TPM_CC_ECDH_ZGen (TPM_CC)(0x00000154) -#define TPM_CC_HMAC (TPM_CC)(0x00000155) -#define TPM_CC_MAC (TPM_CC)(0x00000155) -#define TPM_CC_Import (TPM_CC)(0x00000156) -#define TPM_CC_Load (TPM_CC)(0x00000157) -#define TPM_CC_Quote (TPM_CC)(0x00000158) -#define TPM_CC_RSA_Decrypt (TPM_CC)(0x00000159) -#define TPM_CC_HMAC_Start (TPM_CC)(0x0000015B) -#define TPM_CC_MAC_Start (TPM_CC)(0x0000015B) -#define TPM_CC_SequenceUpdate (TPM_CC)(0x0000015C) -#define TPM_CC_Sign (TPM_CC)(0x0000015D) -#define TPM_CC_Unseal (TPM_CC)(0x0000015E) -#define TPM_CC_PolicySigned (TPM_CC)(0x00000160) -#define TPM_CC_ContextLoad (TPM_CC)(0x00000161) -#define TPM_CC_ContextSave (TPM_CC)(0x00000162) -#define TPM_CC_ECDH_KeyGen (TPM_CC)(0x00000163) -#define TPM_CC_EncryptDecrypt (TPM_CC)(0x00000164) -#define TPM_CC_FlushContext (TPM_CC)(0x00000165) -#define TPM_CC_LoadExternal (TPM_CC)(0x00000167) -#define TPM_CC_MakeCredential (TPM_CC)(0x00000168) -#define TPM_CC_NV_ReadPublic (TPM_CC)(0x00000169) -#define TPM_CC_PolicyAuthorize (TPM_CC)(0x0000016A) -#define TPM_CC_PolicyAuthValue (TPM_CC)(0x0000016B) -#define TPM_CC_PolicyCommandCode (TPM_CC)(0x0000016C) -#define TPM_CC_PolicyCounterTimer (TPM_CC)(0x0000016D) -#define TPM_CC_PolicyCpHash (TPM_CC)(0x0000016E) -#define TPM_CC_PolicyLocality (TPM_CC)(0x0000016F) -#define TPM_CC_PolicyNameHash (TPM_CC)(0x00000170) -#define TPM_CC_PolicyOR (TPM_CC)(0x00000171) -#define TPM_CC_PolicyTicket (TPM_CC)(0x00000172) -#define TPM_CC_ReadPublic (TPM_CC)(0x00000173) -#define TPM_CC_RSA_Encrypt (TPM_CC)(0x00000174) -#define TPM_CC_StartAuthSession (TPM_CC)(0x00000176) -#define TPM_CC_VerifySignature (TPM_CC)(0x00000177) -#define TPM_CC_ECC_Parameters (TPM_CC)(0x00000178) -#define TPM_CC_FirmwareRead (TPM_CC)(0x00000179) -#define TPM_CC_GetCapability (TPM_CC)(0x0000017A) -#define TPM_CC_GetRandom (TPM_CC)(0x0000017B) -#define TPM_CC_GetTestResult (TPM_CC)(0x0000017C) -#define TPM_CC_Hash (TPM_CC)(0x0000017D) -#define TPM_CC_PCR_Read (TPM_CC)(0x0000017E) -#define TPM_CC_PolicyPCR (TPM_CC)(0x0000017F) -#define TPM_CC_PolicyRestart (TPM_CC)(0x00000180) -#define TPM_CC_ReadClock (TPM_CC)(0x00000181) -#define TPM_CC_PCR_Extend (TPM_CC)(0x00000182) -#define TPM_CC_PCR_SetAuthValue (TPM_CC)(0x00000183) -#define TPM_CC_NV_Certify (TPM_CC)(0x00000184) -#define TPM_CC_EventSequenceComplete (TPM_CC)(0x00000185) -#define TPM_CC_HashSequenceStart (TPM_CC)(0x00000186) -#define TPM_CC_PolicyPhysicalPresence (TPM_CC)(0x00000187) -#define TPM_CC_PolicyDuplicationSelect (TPM_CC)(0x00000188) -#define TPM_CC_PolicyGetDigest (TPM_CC)(0x00000189) -#define TPM_CC_TestParms (TPM_CC)(0x0000018A) -#define TPM_CC_Commit (TPM_CC)(0x0000018B) -#define TPM_CC_PolicyPassword (TPM_CC)(0x0000018C) -#define TPM_CC_ZGen_2Phase (TPM_CC)(0x0000018D) -#define TPM_CC_EC_Ephemeral (TPM_CC)(0x0000018E) -#define TPM_CC_PolicyNvWritten (TPM_CC)(0x0000018F) -#define TPM_CC_PolicyTemplate (TPM_CC)(0x00000190) -#define TPM_CC_CreateLoaded (TPM_CC)(0x00000191) -#define TPM_CC_PolicyAuthorizeNV (TPM_CC)(0x00000192) -#define TPM_CC_EncryptDecrypt2 (TPM_CC)(0x00000193) -#define TPM_CC_AC_GetCapability (TPM_CC)(0x00000194) -#define TPM_CC_AC_Send (TPM_CC)(0x00000195) -#define TPM_CC_Policy_AC_SendSelect (TPM_CC)(0x00000196) -#define TPM_CC_CertifyX509 (TPM_CC)(0x00000197) -#define CC_VEND 0x20000000 -#define TPM_CC_Vendor_TCG_Test (TPM_CC)(0x20000000) - -// Table 2:5 - Definition of Types for Documentation Clarity -typedef UINT32 TPM_ALGORITHM_ID; -#define TYPE_OF_TPM_ALGORITHM_ID UINT32 -typedef UINT32 TPM_MODIFIER_INDICATOR; -#define TYPE_OF_TPM_MODIFIER_INDICATOR UINT32 -typedef UINT32 TPM_AUTHORIZATION_SIZE; -#define TYPE_OF_TPM_AUTHORIZATION_SIZE UINT32 -typedef UINT32 TPM_PARAMETER_SIZE; -#define TYPE_OF_TPM_PARAMETER_SIZE UINT32 -typedef UINT16 TPM_KEY_SIZE; -#define TYPE_OF_TPM_KEY_SIZE UINT16 -typedef UINT16 TPM_KEY_BITS; -#define TYPE_OF_TPM_KEY_BITS UINT16 - -// Table 2:6 - Definition of TPM_SPEC Constants -typedef UINT32 TPM_SPEC; -#define TYPE_OF_TPM_SPEC UINT32 -#define SPEC_FAMILY 0x322E3000 -#define TPM_SPEC_FAMILY (TPM_SPEC)(SPEC_FAMILY) -#define SPEC_LEVEL 00 -#define TPM_SPEC_LEVEL (TPM_SPEC)(SPEC_LEVEL) -#define SPEC_VERSION 154 -#define TPM_SPEC_VERSION (TPM_SPEC)(SPEC_VERSION) -#define SPEC_YEAR 2019 -#define TPM_SPEC_YEAR (TPM_SPEC)(SPEC_YEAR) -#define SPEC_DAY_OF_YEAR 81 -#define TPM_SPEC_DAY_OF_YEAR (TPM_SPEC)(SPEC_DAY_OF_YEAR) - -// Table 2:7 - Definition of TPM_GENERATED Constants -typedef UINT32 TPM_GENERATED; -#define TYPE_OF_TPM_GENERATED UINT32 -#define TPM_GENERATED_VALUE (TPM_GENERATED)(0xFF544347) - -// Table 2:16 - Definition of TPM_RC Constants -typedef UINT32 TPM_RC; -#define TYPE_OF_TPM_RC UINT32 -#define TPM_RC_SUCCESS (TPM_RC)(0x000) -#define TPM_RC_BAD_TAG (TPM_RC)(0x01E) -#define RC_VER1 (TPM_RC)(0x100) -#define TPM_RC_INITIALIZE (TPM_RC)(RC_VER1+0x000) -#define TPM_RC_FAILURE (TPM_RC)(RC_VER1+0x001) -#define TPM_RC_SEQUENCE (TPM_RC)(RC_VER1+0x003) -#define TPM_RC_PRIVATE (TPM_RC)(RC_VER1+0x00B) -#define TPM_RC_HMAC (TPM_RC)(RC_VER1+0x019) -#define TPM_RC_DISABLED (TPM_RC)(RC_VER1+0x020) -#define TPM_RC_EXCLUSIVE (TPM_RC)(RC_VER1+0x021) -#define TPM_RC_AUTH_TYPE (TPM_RC)(RC_VER1+0x024) -#define TPM_RC_AUTH_MISSING (TPM_RC)(RC_VER1+0x025) -#define TPM_RC_POLICY (TPM_RC)(RC_VER1+0x026) -#define TPM_RC_PCR (TPM_RC)(RC_VER1+0x027) -#define TPM_RC_PCR_CHANGED (TPM_RC)(RC_VER1+0x028) -#define TPM_RC_UPGRADE (TPM_RC)(RC_VER1+0x02D) -#define TPM_RC_TOO_MANY_CONTEXTS (TPM_RC)(RC_VER1+0x02E) -#define TPM_RC_AUTH_UNAVAILABLE (TPM_RC)(RC_VER1+0x02F) -#define TPM_RC_REBOOT (TPM_RC)(RC_VER1+0x030) -#define TPM_RC_UNBALANCED (TPM_RC)(RC_VER1+0x031) -#define TPM_RC_COMMAND_SIZE (TPM_RC)(RC_VER1+0x042) -#define TPM_RC_COMMAND_CODE (TPM_RC)(RC_VER1+0x043) -#define TPM_RC_AUTHSIZE (TPM_RC)(RC_VER1+0x044) -#define TPM_RC_AUTH_CONTEXT (TPM_RC)(RC_VER1+0x045) -#define TPM_RC_NV_RANGE (TPM_RC)(RC_VER1+0x046) -#define TPM_RC_NV_SIZE (TPM_RC)(RC_VER1+0x047) -#define TPM_RC_NV_LOCKED (TPM_RC)(RC_VER1+0x048) -#define TPM_RC_NV_AUTHORIZATION (TPM_RC)(RC_VER1+0x049) -#define TPM_RC_NV_UNINITIALIZED (TPM_RC)(RC_VER1+0x04A) -#define TPM_RC_NV_SPACE (TPM_RC)(RC_VER1+0x04B) -#define TPM_RC_NV_DEFINED (TPM_RC)(RC_VER1+0x04C) -#define TPM_RC_BAD_CONTEXT (TPM_RC)(RC_VER1+0x050) -#define TPM_RC_CPHASH (TPM_RC)(RC_VER1+0x051) -#define TPM_RC_PARENT (TPM_RC)(RC_VER1+0x052) -#define TPM_RC_NEEDS_TEST (TPM_RC)(RC_VER1+0x053) -#define TPM_RC_NO_RESULT (TPM_RC)(RC_VER1+0x054) -#define TPM_RC_SENSITIVE (TPM_RC)(RC_VER1+0x055) -#define RC_MAX_FM0 (TPM_RC)(RC_VER1+0x07F) -#define RC_FMT1 (TPM_RC)(0x080) -#define TPM_RC_ASYMMETRIC (TPM_RC)(RC_FMT1+0x001) -#define TPM_RCS_ASYMMETRIC (TPM_RC)(RC_FMT1+0x001) -#define TPM_RC_ATTRIBUTES (TPM_RC)(RC_FMT1+0x002) -#define TPM_RCS_ATTRIBUTES (TPM_RC)(RC_FMT1+0x002) -#define TPM_RC_HASH (TPM_RC)(RC_FMT1+0x003) -#define TPM_RCS_HASH (TPM_RC)(RC_FMT1+0x003) -#define TPM_RC_VALUE (TPM_RC)(RC_FMT1+0x004) -#define TPM_RCS_VALUE (TPM_RC)(RC_FMT1+0x004) -#define TPM_RC_HIERARCHY (TPM_RC)(RC_FMT1+0x005) -#define TPM_RCS_HIERARCHY (TPM_RC)(RC_FMT1+0x005) -#define TPM_RC_KEY_SIZE (TPM_RC)(RC_FMT1+0x007) -#define TPM_RCS_KEY_SIZE (TPM_RC)(RC_FMT1+0x007) -#define TPM_RC_MGF (TPM_RC)(RC_FMT1+0x008) -#define TPM_RCS_MGF (TPM_RC)(RC_FMT1+0x008) -#define TPM_RC_MODE (TPM_RC)(RC_FMT1+0x009) -#define TPM_RCS_MODE (TPM_RC)(RC_FMT1+0x009) -#define TPM_RC_TYPE (TPM_RC)(RC_FMT1+0x00A) -#define TPM_RCS_TYPE (TPM_RC)(RC_FMT1+0x00A) -#define TPM_RC_HANDLE (TPM_RC)(RC_FMT1+0x00B) -#define TPM_RCS_HANDLE (TPM_RC)(RC_FMT1+0x00B) -#define TPM_RC_KDF (TPM_RC)(RC_FMT1+0x00C) -#define TPM_RCS_KDF (TPM_RC)(RC_FMT1+0x00C) -#define TPM_RC_RANGE (TPM_RC)(RC_FMT1+0x00D) -#define TPM_RCS_RANGE (TPM_RC)(RC_FMT1+0x00D) -#define TPM_RC_AUTH_FAIL (TPM_RC)(RC_FMT1+0x00E) -#define TPM_RCS_AUTH_FAIL (TPM_RC)(RC_FMT1+0x00E) -#define TPM_RC_NONCE (TPM_RC)(RC_FMT1+0x00F) -#define TPM_RCS_NONCE (TPM_RC)(RC_FMT1+0x00F) -#define TPM_RC_PP (TPM_RC)(RC_FMT1+0x010) -#define TPM_RCS_PP (TPM_RC)(RC_FMT1+0x010) -#define TPM_RC_SCHEME (TPM_RC)(RC_FMT1+0x012) -#define TPM_RCS_SCHEME (TPM_RC)(RC_FMT1+0x012) -#define TPM_RC_SIZE (TPM_RC)(RC_FMT1+0x015) -#define TPM_RCS_SIZE (TPM_RC)(RC_FMT1+0x015) -#define TPM_RC_SYMMETRIC (TPM_RC)(RC_FMT1+0x016) -#define TPM_RCS_SYMMETRIC (TPM_RC)(RC_FMT1+0x016) -#define TPM_RC_TAG (TPM_RC)(RC_FMT1+0x017) -#define TPM_RCS_TAG (TPM_RC)(RC_FMT1+0x017) -#define TPM_RC_SELECTOR (TPM_RC)(RC_FMT1+0x018) -#define TPM_RCS_SELECTOR (TPM_RC)(RC_FMT1+0x018) -#define TPM_RC_INSUFFICIENT (TPM_RC)(RC_FMT1+0x01A) -#define TPM_RCS_INSUFFICIENT (TPM_RC)(RC_FMT1+0x01A) -#define TPM_RC_SIGNATURE (TPM_RC)(RC_FMT1+0x01B) -#define TPM_RCS_SIGNATURE (TPM_RC)(RC_FMT1+0x01B) -#define TPM_RC_KEY (TPM_RC)(RC_FMT1+0x01C) -#define TPM_RCS_KEY (TPM_RC)(RC_FMT1+0x01C) -#define TPM_RC_POLICY_FAIL (TPM_RC)(RC_FMT1+0x01D) -#define TPM_RCS_POLICY_FAIL (TPM_RC)(RC_FMT1+0x01D) -#define TPM_RC_INTEGRITY (TPM_RC)(RC_FMT1+0x01F) -#define TPM_RCS_INTEGRITY (TPM_RC)(RC_FMT1+0x01F) -#define TPM_RC_TICKET (TPM_RC)(RC_FMT1+0x020) -#define TPM_RCS_TICKET (TPM_RC)(RC_FMT1+0x020) -#define TPM_RC_RESERVED_BITS (TPM_RC)(RC_FMT1+0x021) -#define TPM_RCS_RESERVED_BITS (TPM_RC)(RC_FMT1+0x021) -#define TPM_RC_BAD_AUTH (TPM_RC)(RC_FMT1+0x022) -#define TPM_RCS_BAD_AUTH (TPM_RC)(RC_FMT1+0x022) -#define TPM_RC_EXPIRED (TPM_RC)(RC_FMT1+0x023) -#define TPM_RCS_EXPIRED (TPM_RC)(RC_FMT1+0x023) -#define TPM_RC_POLICY_CC (TPM_RC)(RC_FMT1+0x024) -#define TPM_RCS_POLICY_CC (TPM_RC)(RC_FMT1+0x024) -#define TPM_RC_BINDING (TPM_RC)(RC_FMT1+0x025) -#define TPM_RCS_BINDING (TPM_RC)(RC_FMT1+0x025) -#define TPM_RC_CURVE (TPM_RC)(RC_FMT1+0x026) -#define TPM_RCS_CURVE (TPM_RC)(RC_FMT1+0x026) -#define TPM_RC_ECC_POINT (TPM_RC)(RC_FMT1+0x027) -#define TPM_RCS_ECC_POINT (TPM_RC)(RC_FMT1+0x027) -#define RC_WARN (TPM_RC)(0x900) -#define TPM_RC_CONTEXT_GAP (TPM_RC)(RC_WARN+0x001) -#define TPM_RC_OBJECT_MEMORY (TPM_RC)(RC_WARN+0x002) -#define TPM_RC_SESSION_MEMORY (TPM_RC)(RC_WARN+0x003) -#define TPM_RC_MEMORY (TPM_RC)(RC_WARN+0x004) -#define TPM_RC_SESSION_HANDLES (TPM_RC)(RC_WARN+0x005) -#define TPM_RC_OBJECT_HANDLES (TPM_RC)(RC_WARN+0x006) -#define TPM_RC_LOCALITY (TPM_RC)(RC_WARN+0x007) -#define TPM_RC_YIELDED (TPM_RC)(RC_WARN+0x008) -#define TPM_RC_CANCELED (TPM_RC)(RC_WARN+0x009) -#define TPM_RC_TESTING (TPM_RC)(RC_WARN+0x00A) -#define TPM_RC_REFERENCE_H0 (TPM_RC)(RC_WARN+0x010) -#define TPM_RC_REFERENCE_H1 (TPM_RC)(RC_WARN+0x011) -#define TPM_RC_REFERENCE_H2 (TPM_RC)(RC_WARN+0x012) -#define TPM_RC_REFERENCE_H3 (TPM_RC)(RC_WARN+0x013) -#define TPM_RC_REFERENCE_H4 (TPM_RC)(RC_WARN+0x014) -#define TPM_RC_REFERENCE_H5 (TPM_RC)(RC_WARN+0x015) -#define TPM_RC_REFERENCE_H6 (TPM_RC)(RC_WARN+0x016) -#define TPM_RC_REFERENCE_S0 (TPM_RC)(RC_WARN+0x018) -#define TPM_RC_REFERENCE_S1 (TPM_RC)(RC_WARN+0x019) -#define TPM_RC_REFERENCE_S2 (TPM_RC)(RC_WARN+0x01A) -#define TPM_RC_REFERENCE_S3 (TPM_RC)(RC_WARN+0x01B) -#define TPM_RC_REFERENCE_S4 (TPM_RC)(RC_WARN+0x01C) -#define TPM_RC_REFERENCE_S5 (TPM_RC)(RC_WARN+0x01D) -#define TPM_RC_REFERENCE_S6 (TPM_RC)(RC_WARN+0x01E) -#define TPM_RC_NV_RATE (TPM_RC)(RC_WARN+0x020) -#define TPM_RC_LOCKOUT (TPM_RC)(RC_WARN+0x021) -#define TPM_RC_RETRY (TPM_RC)(RC_WARN+0x022) -#define TPM_RC_NV_UNAVAILABLE (TPM_RC)(RC_WARN+0x023) -#define TPM_RC_NOT_USED (TPM_RC)(RC_WARN+0x7F) -#define TPM_RC_H (TPM_RC)(0x000) -#define TPM_RC_P (TPM_RC)(0x040) -#define TPM_RC_S (TPM_RC)(0x800) -#define TPM_RC_1 (TPM_RC)(0x100) -#define TPM_RC_2 (TPM_RC)(0x200) -#define TPM_RC_3 (TPM_RC)(0x300) -#define TPM_RC_4 (TPM_RC)(0x400) -#define TPM_RC_5 (TPM_RC)(0x500) -#define TPM_RC_6 (TPM_RC)(0x600) -#define TPM_RC_7 (TPM_RC)(0x700) -#define TPM_RC_8 (TPM_RC)(0x800) -#define TPM_RC_9 (TPM_RC)(0x900) -#define TPM_RC_A (TPM_RC)(0xA00) -#define TPM_RC_B (TPM_RC)(0xB00) -#define TPM_RC_C (TPM_RC)(0xC00) -#define TPM_RC_D (TPM_RC)(0xD00) -#define TPM_RC_E (TPM_RC)(0xE00) -#define TPM_RC_F (TPM_RC)(0xF00) -#define TPM_RC_N_MASK (TPM_RC)(0xF00) - -// Table 2:17 - Definition of TPM_CLOCK_ADJUST Constants -typedef INT8 TPM_CLOCK_ADJUST; -#define TYPE_OF_TPM_CLOCK_ADJUST UINT8 -#define TPM_CLOCK_COARSE_SLOWER (TPM_CLOCK_ADJUST)(-3) -#define TPM_CLOCK_MEDIUM_SLOWER (TPM_CLOCK_ADJUST)(-2) -#define TPM_CLOCK_FINE_SLOWER (TPM_CLOCK_ADJUST)(-1) -#define TPM_CLOCK_NO_CHANGE (TPM_CLOCK_ADJUST)(0) -#define TPM_CLOCK_FINE_FASTER (TPM_CLOCK_ADJUST)(1) -#define TPM_CLOCK_MEDIUM_FASTER (TPM_CLOCK_ADJUST)(2) -#define TPM_CLOCK_COARSE_FASTER (TPM_CLOCK_ADJUST)(3) - -// Table 2:18 - Definition of TPM_EO Constants -typedef UINT16 TPM_EO; -#define TYPE_OF_TPM_EO UINT16 -#define TPM_EO_EQ (TPM_EO)(0x0000) -#define TPM_EO_NEQ (TPM_EO)(0x0001) -#define TPM_EO_SIGNED_GT (TPM_EO)(0x0002) -#define TPM_EO_UNSIGNED_GT (TPM_EO)(0x0003) -#define TPM_EO_SIGNED_LT (TPM_EO)(0x0004) -#define TPM_EO_UNSIGNED_LT (TPM_EO)(0x0005) -#define TPM_EO_SIGNED_GE (TPM_EO)(0x0006) -#define TPM_EO_UNSIGNED_GE (TPM_EO)(0x0007) -#define TPM_EO_SIGNED_LE (TPM_EO)(0x0008) -#define TPM_EO_UNSIGNED_LE (TPM_EO)(0x0009) -#define TPM_EO_BITSET (TPM_EO)(0x000A) -#define TPM_EO_BITCLEAR (TPM_EO)(0x000B) - -// Table 2:19 - Definition of TPM_ST Constants -typedef UINT16 TPM_ST; -#define TYPE_OF_TPM_ST UINT16 -#define TPM_ST_RSP_COMMAND (TPM_ST)(0x00C4) -#define TPM_ST_NULL (TPM_ST)(0x8000) -#define TPM_ST_NO_SESSIONS (TPM_ST)(0x8001) -#define TPM_ST_SESSIONS (TPM_ST)(0x8002) -#define TPM_ST_ATTEST_NV (TPM_ST)(0x8014) -#define TPM_ST_ATTEST_COMMAND_AUDIT (TPM_ST)(0x8015) -#define TPM_ST_ATTEST_SESSION_AUDIT (TPM_ST)(0x8016) -#define TPM_ST_ATTEST_CERTIFY (TPM_ST)(0x8017) -#define TPM_ST_ATTEST_QUOTE (TPM_ST)(0x8018) -#define TPM_ST_ATTEST_TIME (TPM_ST)(0x8019) -#define TPM_ST_ATTEST_CREATION (TPM_ST)(0x801A) -#define TPM_ST_ATTEST_NV_DIGEST (TPM_ST)(0x801C) -#define TPM_ST_CREATION (TPM_ST)(0x8021) -#define TPM_ST_VERIFIED (TPM_ST)(0x8022) -#define TPM_ST_AUTH_SECRET (TPM_ST)(0x8023) -#define TPM_ST_HASHCHECK (TPM_ST)(0x8024) -#define TPM_ST_AUTH_SIGNED (TPM_ST)(0x8025) -#define TPM_ST_FU_MANIFEST (TPM_ST)(0x8029) - -// Table 2:20 - Definition of TPM_SU Constants -typedef UINT16 TPM_SU; -#define TYPE_OF_TPM_SU UINT16 -#define TPM_SU_CLEAR (TPM_SU)(0x0000) -#define TPM_SU_STATE (TPM_SU)(0x0001) - -// Table 2:21 - Definition of TPM_SE Constants -typedef UINT8 TPM_SE; -#define TYPE_OF_TPM_SE UINT8 -#define TPM_SE_HMAC (TPM_SE)(0x00) -#define TPM_SE_POLICY (TPM_SE)(0x01) -#define TPM_SE_TRIAL (TPM_SE)(0x03) - -// Table 2:22 - Definition of TPM_CAP Constants -typedef UINT32 TPM_CAP; -#define TYPE_OF_TPM_CAP UINT32 -#define TPM_CAP_FIRST (TPM_CAP)(0x00000000) -#define TPM_CAP_ALGS (TPM_CAP)(0x00000000) -#define TPM_CAP_HANDLES (TPM_CAP)(0x00000001) -#define TPM_CAP_COMMANDS (TPM_CAP)(0x00000002) -#define TPM_CAP_PP_COMMANDS (TPM_CAP)(0x00000003) -#define TPM_CAP_AUDIT_COMMANDS (TPM_CAP)(0x00000004) -#define TPM_CAP_PCRS (TPM_CAP)(0x00000005) -#define TPM_CAP_TPM_PROPERTIES (TPM_CAP)(0x00000006) -#define TPM_CAP_PCR_PROPERTIES (TPM_CAP)(0x00000007) -#define TPM_CAP_ECC_CURVES (TPM_CAP)(0x00000008) -#define TPM_CAP_AUTH_POLICIES (TPM_CAP)(0x00000009) -#define TPM_CAP_LAST (TPM_CAP)(0x00000009) -#define TPM_CAP_VENDOR_PROPERTY (TPM_CAP)(0x00000100) - -// Table 2:23 - Definition of TPM_PT Constants -typedef UINT32 TPM_PT; -#define TYPE_OF_TPM_PT UINT32 -#define TPM_PT_NONE (TPM_PT)(0x00000000) -#define PT_GROUP (TPM_PT)(0x00000100) -#define PT_FIXED (TPM_PT)(PT_GROUP*1) -#define TPM_PT_FAMILY_INDICATOR (TPM_PT)(PT_FIXED+0) -#define TPM_PT_LEVEL (TPM_PT)(PT_FIXED+1) -#define TPM_PT_REVISION (TPM_PT)(PT_FIXED+2) -#define TPM_PT_DAY_OF_YEAR (TPM_PT)(PT_FIXED+3) -#define TPM_PT_YEAR (TPM_PT)(PT_FIXED+4) -#define TPM_PT_MANUFACTURER (TPM_PT)(PT_FIXED+5) -#define TPM_PT_VENDOR_STRING_1 (TPM_PT)(PT_FIXED+6) -#define TPM_PT_VENDOR_STRING_2 (TPM_PT)(PT_FIXED+7) -#define TPM_PT_VENDOR_STRING_3 (TPM_PT)(PT_FIXED+8) -#define TPM_PT_VENDOR_STRING_4 (TPM_PT)(PT_FIXED+9) -#define TPM_PT_VENDOR_TPM_TYPE (TPM_PT)(PT_FIXED+10) -#define TPM_PT_FIRMWARE_VERSION_1 (TPM_PT)(PT_FIXED+11) -#define TPM_PT_FIRMWARE_VERSION_2 (TPM_PT)(PT_FIXED+12) -#define TPM_PT_INPUT_BUFFER (TPM_PT)(PT_FIXED+13) -#define TPM_PT_HR_TRANSIENT_MIN (TPM_PT)(PT_FIXED+14) -#define TPM_PT_HR_PERSISTENT_MIN (TPM_PT)(PT_FIXED+15) -#define TPM_PT_HR_LOADED_MIN (TPM_PT)(PT_FIXED+16) -#define TPM_PT_ACTIVE_SESSIONS_MAX (TPM_PT)(PT_FIXED+17) -#define TPM_PT_PCR_COUNT (TPM_PT)(PT_FIXED+18) -#define TPM_PT_PCR_SELECT_MIN (TPM_PT)(PT_FIXED+19) -#define TPM_PT_CONTEXT_GAP_MAX (TPM_PT)(PT_FIXED+20) -#define TPM_PT_NV_COUNTERS_MAX (TPM_PT)(PT_FIXED+22) -#define TPM_PT_NV_INDEX_MAX (TPM_PT)(PT_FIXED+23) -#define TPM_PT_MEMORY (TPM_PT)(PT_FIXED+24) -#define TPM_PT_CLOCK_UPDATE (TPM_PT)(PT_FIXED+25) -#define TPM_PT_CONTEXT_HASH (TPM_PT)(PT_FIXED+26) -#define TPM_PT_CONTEXT_SYM (TPM_PT)(PT_FIXED+27) -#define TPM_PT_CONTEXT_SYM_SIZE (TPM_PT)(PT_FIXED+28) -#define TPM_PT_ORDERLY_COUNT (TPM_PT)(PT_FIXED+29) -#define TPM_PT_MAX_COMMAND_SIZE (TPM_PT)(PT_FIXED+30) -#define TPM_PT_MAX_RESPONSE_SIZE (TPM_PT)(PT_FIXED+31) -#define TPM_PT_MAX_DIGEST (TPM_PT)(PT_FIXED+32) -#define TPM_PT_MAX_OBJECT_CONTEXT (TPM_PT)(PT_FIXED+33) -#define TPM_PT_MAX_SESSION_CONTEXT (TPM_PT)(PT_FIXED+34) -#define TPM_PT_PS_FAMILY_INDICATOR (TPM_PT)(PT_FIXED+35) -#define TPM_PT_PS_LEVEL (TPM_PT)(PT_FIXED+36) -#define TPM_PT_PS_REVISION (TPM_PT)(PT_FIXED+37) -#define TPM_PT_PS_DAY_OF_YEAR (TPM_PT)(PT_FIXED+38) -#define TPM_PT_PS_YEAR (TPM_PT)(PT_FIXED+39) -#define TPM_PT_SPLIT_MAX (TPM_PT)(PT_FIXED+40) -#define TPM_PT_TOTAL_COMMANDS (TPM_PT)(PT_FIXED+41) -#define TPM_PT_LIBRARY_COMMANDS (TPM_PT)(PT_FIXED+42) -#define TPM_PT_VENDOR_COMMANDS (TPM_PT)(PT_FIXED+43) -#define TPM_PT_NV_BUFFER_MAX (TPM_PT)(PT_FIXED+44) -#define TPM_PT_MODES (TPM_PT)(PT_FIXED+45) -#define TPM_PT_MAX_CAP_BUFFER (TPM_PT)(PT_FIXED+46) -#define PT_VAR (TPM_PT)(PT_GROUP*2) -#define TPM_PT_PERMANENT (TPM_PT)(PT_VAR+0) -#define TPM_PT_STARTUP_CLEAR (TPM_PT)(PT_VAR+1) -#define TPM_PT_HR_NV_INDEX (TPM_PT)(PT_VAR+2) -#define TPM_PT_HR_LOADED (TPM_PT)(PT_VAR+3) -#define TPM_PT_HR_LOADED_AVAIL (TPM_PT)(PT_VAR+4) -#define TPM_PT_HR_ACTIVE (TPM_PT)(PT_VAR+5) -#define TPM_PT_HR_ACTIVE_AVAIL (TPM_PT)(PT_VAR+6) -#define TPM_PT_HR_TRANSIENT_AVAIL (TPM_PT)(PT_VAR+7) -#define TPM_PT_HR_PERSISTENT (TPM_PT)(PT_VAR+8) -#define TPM_PT_HR_PERSISTENT_AVAIL (TPM_PT)(PT_VAR+9) -#define TPM_PT_NV_COUNTERS (TPM_PT)(PT_VAR+10) -#define TPM_PT_NV_COUNTERS_AVAIL (TPM_PT)(PT_VAR+11) -#define TPM_PT_ALGORITHM_SET (TPM_PT)(PT_VAR+12) -#define TPM_PT_LOADED_CURVES (TPM_PT)(PT_VAR+13) -#define TPM_PT_LOCKOUT_COUNTER (TPM_PT)(PT_VAR+14) -#define TPM_PT_MAX_AUTH_FAIL (TPM_PT)(PT_VAR+15) -#define TPM_PT_LOCKOUT_INTERVAL (TPM_PT)(PT_VAR+16) -#define TPM_PT_LOCKOUT_RECOVERY (TPM_PT)(PT_VAR+17) -#define TPM_PT_NV_WRITE_RECOVERY (TPM_PT)(PT_VAR+18) -#define TPM_PT_AUDIT_COUNTER_0 (TPM_PT)(PT_VAR+19) -#define TPM_PT_AUDIT_COUNTER_1 (TPM_PT)(PT_VAR+20) - -// Table 2:24 - Definition of TPM_PT_PCR Constants -typedef UINT32 TPM_PT_PCR; -#define TYPE_OF_TPM_PT_PCR UINT32 -#define TPM_PT_PCR_FIRST (TPM_PT_PCR)(0x00000000) -#define TPM_PT_PCR_SAVE (TPM_PT_PCR)(0x00000000) -#define TPM_PT_PCR_EXTEND_L0 (TPM_PT_PCR)(0x00000001) -#define TPM_PT_PCR_RESET_L0 (TPM_PT_PCR)(0x00000002) -#define TPM_PT_PCR_EXTEND_L1 (TPM_PT_PCR)(0x00000003) -#define TPM_PT_PCR_RESET_L1 (TPM_PT_PCR)(0x00000004) -#define TPM_PT_PCR_EXTEND_L2 (TPM_PT_PCR)(0x00000005) -#define TPM_PT_PCR_RESET_L2 (TPM_PT_PCR)(0x00000006) -#define TPM_PT_PCR_EXTEND_L3 (TPM_PT_PCR)(0x00000007) -#define TPM_PT_PCR_RESET_L3 (TPM_PT_PCR)(0x00000008) -#define TPM_PT_PCR_EXTEND_L4 (TPM_PT_PCR)(0x00000009) -#define TPM_PT_PCR_RESET_L4 (TPM_PT_PCR)(0x0000000A) -#define TPM_PT_PCR_NO_INCREMENT (TPM_PT_PCR)(0x00000011) -#define TPM_PT_PCR_DRTM_RESET (TPM_PT_PCR)(0x00000012) -#define TPM_PT_PCR_POLICY (TPM_PT_PCR)(0x00000013) -#define TPM_PT_PCR_AUTH (TPM_PT_PCR)(0x00000014) -#define TPM_PT_PCR_LAST (TPM_PT_PCR)(0x00000014) - -// Table 2:25 - Definition of TPM_PS Constants -typedef UINT32 TPM_PS; -#define TYPE_OF_TPM_PS UINT32 -#define TPM_PS_MAIN (TPM_PS)(0x00000000) -#define TPM_PS_PC (TPM_PS)(0x00000001) -#define TPM_PS_PDA (TPM_PS)(0x00000002) -#define TPM_PS_CELL_PHONE (TPM_PS)(0x00000003) -#define TPM_PS_SERVER (TPM_PS)(0x00000004) -#define TPM_PS_PERIPHERAL (TPM_PS)(0x00000005) -#define TPM_PS_TSS (TPM_PS)(0x00000006) -#define TPM_PS_STORAGE (TPM_PS)(0x00000007) -#define TPM_PS_AUTHENTICATION (TPM_PS)(0x00000008) -#define TPM_PS_EMBEDDED (TPM_PS)(0x00000009) -#define TPM_PS_HARDCOPY (TPM_PS)(0x0000000A) -#define TPM_PS_INFRASTRUCTURE (TPM_PS)(0x0000000B) -#define TPM_PS_VIRTUALIZATION (TPM_PS)(0x0000000C) -#define TPM_PS_TNC (TPM_PS)(0x0000000D) -#define TPM_PS_MULTI_TENANT (TPM_PS)(0x0000000E) -#define TPM_PS_TC (TPM_PS)(0x0000000F) - -// Table 2:26 - Definition of Types for Handles -typedef UINT32 TPM_HANDLE; -#define TYPE_OF_TPM_HANDLE UINT32 - -// Table 2:27 - Definition of TPM_HT Constants -typedef UINT8 TPM_HT; -#define TYPE_OF_TPM_HT UINT8 -#define TPM_HT_PCR (TPM_HT)(0x00) -#define TPM_HT_NV_INDEX (TPM_HT)(0x01) -#define TPM_HT_HMAC_SESSION (TPM_HT)(0x02) -#define TPM_HT_LOADED_SESSION (TPM_HT)(0x02) -#define TPM_HT_POLICY_SESSION (TPM_HT)(0x03) -#define TPM_HT_SAVED_SESSION (TPM_HT)(0x03) -#define TPM_HT_PERMANENT (TPM_HT)(0x40) -#define TPM_HT_TRANSIENT (TPM_HT)(0x80) -#define TPM_HT_PERSISTENT (TPM_HT)(0x81) -#define TPM_HT_AC (TPM_HT)(0x90) - -// Table 2:28 - Definition of TPM_RH Constants -typedef TPM_HANDLE TPM_RH; -#define TPM_RH_FIRST (TPM_RH)(0x40000000) -#define TPM_RH_SRK (TPM_RH)(0x40000000) -#define TPM_RH_OWNER (TPM_RH)(0x40000001) -#define TPM_RH_REVOKE (TPM_RH)(0x40000002) -#define TPM_RH_TRANSPORT (TPM_RH)(0x40000003) -#define TPM_RH_OPERATOR (TPM_RH)(0x40000004) -#define TPM_RH_ADMIN (TPM_RH)(0x40000005) -#define TPM_RH_EK (TPM_RH)(0x40000006) -#define TPM_RH_NULL (TPM_RH)(0x40000007) -#define TPM_RH_UNASSIGNED (TPM_RH)(0x40000008) -#define TPM_RS_PW (TPM_RH)(0x40000009) -#define TPM_RH_LOCKOUT (TPM_RH)(0x4000000A) -#define TPM_RH_ENDORSEMENT (TPM_RH)(0x4000000B) -#define TPM_RH_PLATFORM (TPM_RH)(0x4000000C) -#define TPM_RH_PLATFORM_NV (TPM_RH)(0x4000000D) -#define TPM_RH_AUTH_00 (TPM_RH)(0x40000010) -#define TPM_RH_AUTH_FF (TPM_RH)(0x4000010F) -#define TPM_RH_LAST (TPM_RH)(0x4000010F) - -// Table 2:29 - Definition of TPM_HC Constants -typedef TPM_HANDLE TPM_HC; -#define HR_HANDLE_MASK (TPM_HC)(0x00FFFFFF) -#define HR_RANGE_MASK (TPM_HC)(0xFF000000) -#define HR_SHIFT (TPM_HC)(24) -#define HR_PCR (TPM_HC)((TPM_HT_PCR< -#include -#include - - -//*************************************************************** -//** Links to the wolfcrypt HASH code -//*************************************************************** - -// Redefine the internal name used for each of the hash state structures to the -// name used by the library. -// These defines need to be known in all parts of the TPM so that the structure -// sizes can be properly computed when needed. - -#define tpmHashStateSHA1_t wc_Sha -#define tpmHashStateSHA256_t wc_Sha256 -#define tpmHashStateSHA384_t wc_Sha512 -#define tpmHashStateSHA512_t wc_Sha512 - -#if ALG_SM3 -# error "The version of WolfCrypt used by this code does not support SM3" -#endif - -// The defines below are only needed when compiling CryptHash.c or CryptSmac.c. -// This isolation is primarily to avoid name space collision. However, if there -// is a real collision, it will likely show up when the linker tries to put things -// together. - -#ifdef _CRYPT_HASH_C_ - -typedef BYTE *PBYTE; -typedef const BYTE *PCBYTE; - -// Define the interface between CryptHash.c to the functions provided by the -// library. For each method, define the calling parameters of the method and then -// define how the method is invoked in CryptHash.c. -// -// All hashes are required to have the same calling sequence. If they don't, create -// a simple adaptation function that converts from the "standard" form of the call -// to the form used by the specific hash (and then send a nasty letter to the -// person who wrote the hash function for the library). -// -// The macro that calls the method also defines how the -// parameters get swizzled between the default form (in CryptHash.c)and the -// library form. -// -// Initialize the hash context -#define HASH_START_METHOD_DEF void (HASH_START_METHOD)(PANY_HASH_STATE state) -#define HASH_START(hashState) \ - ((hashState)->def->method.start)(&(hashState)->state); - -// Add data to the hash -#define HASH_DATA_METHOD_DEF \ - void (HASH_DATA_METHOD)(PANY_HASH_STATE state, \ - PCBYTE buffer, \ - size_t size) -#define HASH_DATA(hashState, dInSize, dIn) \ - ((hashState)->def->method.data)(&(hashState)->state, dIn, dInSize) - -// Finalize the hash and get the digest -#define HASH_END_METHOD_DEF \ - void (HASH_END_METHOD)(PANY_HASH_STATE state, BYTE *buffer) -#define HASH_END(hashState, buffer) \ - ((hashState)->def->method.end)(&(hashState)->state, buffer) - -// Copy the hash context -// Note: For import, export, and copy, memcpy() is used since there is no -// reformatting necessary between the internal and external forms. -#define HASH_STATE_COPY_METHOD_DEF \ - void (HASH_STATE_COPY_METHOD)(PANY_HASH_STATE to, \ - PCANY_HASH_STATE from, \ - size_t size) -#define HASH_STATE_COPY(hashStateOut, hashStateIn) \ - ((hashStateIn)->def->method.copy)(&(hashStateOut)->state, \ - &(hashStateIn)->state, \ - (hashStateIn)->def->contextSize) - -// Copy (with reformatting when necessary) an internal hash structure to an -// external blob -#define HASH_STATE_EXPORT_METHOD_DEF \ - void (HASH_STATE_EXPORT_METHOD)(BYTE *to, \ - PCANY_HASH_STATE from, \ - size_t size) -#define HASH_STATE_EXPORT(to, hashStateFrom) \ - ((hashStateFrom)->def->method.copyOut) \ - (&(((BYTE *)(to))[offsetof(HASH_STATE, state)]), \ - &(hashStateFrom)->state, \ - (hashStateFrom)->def->contextSize) - -// Copy from an external blob to an internal formate (with reformatting when -// necessary -#define HASH_STATE_IMPORT_METHOD_DEF \ - void (HASH_STATE_IMPORT_METHOD)(PANY_HASH_STATE to, \ - const BYTE *from, \ - size_t size) -#define HASH_STATE_IMPORT(hashStateTo, from) \ - ((hashStateTo)->def->method.copyIn) \ - (&(hashStateTo)->state, \ - &(((const BYTE *)(from))[offsetof(HASH_STATE, state)]),\ - (hashStateTo)->def->contextSize) - - -// Function aliases. The code in CryptHash.c uses the internal designation for the -// functions. These need to be translated to the function names of the library. -// Internal External -// Designation Designation -#define tpmHashStart_SHA1 wc_InitSha // external name of the - // initialization method -#define tpmHashData_SHA1 wc_ShaUpdate -#define tpmHashEnd_SHA1 wc_ShaFinal -#define tpmHashStateCopy_SHA1 memcpy -#define tpmHashStateExport_SHA1 memcpy -#define tpmHashStateImport_SHA1 memcpy -#define tpmHashStart_SHA256 wc_InitSha256 -#define tpmHashData_SHA256 wc_Sha256Update -#define tpmHashEnd_SHA256 wc_Sha256Final -#define tpmHashStateCopy_SHA256 memcpy -#define tpmHashStateExport_SHA256 memcpy -#define tpmHashStateImport_SHA256 memcpy -#define tpmHashStart_SHA384 wc_InitSha384 -#define tpmHashData_SHA384 wc_Sha384Update -#define tpmHashEnd_SHA384 wc_Sha384Final -#define tpmHashStateCopy_SHA384 memcpy -#define tpmHashStateExport_SHA384 memcpy -#define tpmHashStateImport_SHA384 memcpy -#define tpmHashStart_SHA512 wc_InitSha512 -#define tpmHashData_SHA512 wc_Sha512Update -#define tpmHashEnd_SHA512 wc_Sha512Final -#define tpmHashStateCopy_SHA512 memcpy -#define tpmHashStateExport_SHA512 memcpy -#define tpmHashStateImport_SHA512 memcpy - -#endif // _CRYPT_HASH_C_ - -#define LibHashInit() -// This definition would change if there were something to report -#define HashLibSimulationEnd() - -#endif // HASH_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfMath.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfMath.h deleted file mode 100644 index 18b48b931..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfMath.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// This file contains the structure definitions used for ECC in the LibTomCrypt -// version of the code. These definitions would change, based on the library. -// The ECC-related structures that cross the TPM interface are defined -// in TpmTypes.h -// - -#ifndef MATH_LIB_DEFINED -#define MATH_LIB_DEFINED - -#define MATH_LIB_WOLF - -#if ALG_ECC -#define HAVE_ECC -#endif - -#include -#include - -#define MP_VAR(name) \ - mp_int _##name; \ - mp_int *name = MpInitialize(&_##name); - -// Allocate a mp_int and initialize with the values in a mp_int* initializer -#define MP_INITIALIZED(name, initializer) \ - MP_VAR(name); \ - BnToWolf(name, initializer); - -#define POINT_CREATE(name, initializer) \ - ecc_point *name = EcPointInitialized(initializer); - -#define POINT_DELETE(name) \ - wc_ecc_del_point(name); \ - name = NULL; - -typedef ECC_CURVE_DATA bnCurve_t; - -typedef bnCurve_t *bigCurve; - -#define AccessCurveData(E) (E) - -#define CURVE_INITIALIZED(name, initializer) \ - bnCurve_t *name = (ECC_CURVE_DATA *)GetCurveData(initializer) - -#define CURVE_FREE(E) - -#include "TpmToWolfSupport_fp.h" - -#define WOLF_ENTER() - -#define WOLF_LEAVE() - -// This definition would change if there were something to report -#define MathLibSimulationEnd() - -#endif // MATH_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfSym.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfSym.h deleted file mode 100644 index 54e01e3ed..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/TpmToWolfSym.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// This header file is used to 'splice' the wolfcrypt library into the TPM code. - -#ifndef SYM_LIB_DEFINED -#define SYM_LIB_DEFINED - -#define SYM_LIB_WOLF - -#include -#include - -//*************************************************************** -//** Links to the wolfCrypt AES code -//*************************************************************** - -#if ALG_SM4 -#error "SM4 is not available" -#endif - -#if ALG_CAMELLIA -#error "Camellia is not available" -#endif - -// Define the order of parameters to the library functions that do block encryption -// and decryption. -typedef void(*TpmCryptSetSymKeyCall_t)( - void *keySchedule, - BYTE *out, - const BYTE *in - ); - -// The Crypt functions that call the block encryption function use the parameters -// in the order: -// 1) keySchedule -// 2) in buffer -// 3) out buffer -// Since wolfcrypt uses the order in encryptoCall_t above, need to swizzle the -// values to the order required by the library. -#define SWIZZLE(keySchedule, in, out) \ - (void *)(keySchedule), (BYTE *)(out), (const BYTE *)(in) - -// Macros to set up the encryption/decryption key schedules -// -// AES: -#define TpmCryptSetEncryptKeyAES(key, keySizeInBits, schedule) \ - wc_AesSetKeyDirect((tpmKeyScheduleAES *)(schedule), key, BITS_TO_BYTES(keySizeInBits), 0, AES_ENCRYPTION) -#define TpmCryptSetDecryptKeyAES(key, keySizeInBits, schedule) \ - wc_AesSetKeyDirect((tpmKeyScheduleAES *)(schedule), key, BITS_TO_BYTES(keySizeInBits), 0, AES_DECRYPTION) - -// TDES: -#define TpmCryptSetEncryptKeyTDES(key, keySizeInBits, schedule) \ - TDES_setup_encrypt_key((key), (keySizeInBits), (tpmKeyScheduleTDES *)(schedule)) -#define TpmCryptSetDecryptKeyTDES(key, keySizeInBits, schedule) \ - TDES_setup_decrypt_key((key), (keySizeInBits), (tpmKeyScheduleTDES *)(schedule)) - -// Macros to alias encryption calls to specific algorithms. This should be used -// sparingly. Currently, only used by CryptRand.c -// -// When using these calls, to call the AES block encryption code, the caller -// should use: -// TpmCryptEncryptAES(SWIZZLE(keySchedule, in, out)); -#define TpmCryptEncryptAES wc_AesEncryptDirect -#define TpmCryptDecryptAES wc_AesDecryptDirect -#define tpmKeyScheduleAES Aes - -#define TpmCryptEncryptTDES TDES_encrypt -#define TpmCryptDecryptTDES TDES_decrypt -#define tpmKeyScheduleTDES Des3 - -typedef union tpmCryptKeySchedule_t tpmCryptKeySchedule_t; - -#if ALG_TDES -#include "TpmToWolfDesSupport_fp.h" -#endif - -// This definition would change if there were something to report -#define SymLibSimulationEnd() - -#endif // SYM_LIB_DEFINED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/user_settings.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/user_settings.h deleted file mode 100644 index 168fcb38c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/Wolf/user_settings.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/* TPM specific preprocessor flags for wolfcrypt */ - - -#ifndef WOLF_CRYPT_USER_SETTINGS_H -#define WOLF_CRYPT_USER_SETTINGS_H - -/* Remove the automatic setting of the default I/O functions EmbedSend() - and EmbedReceive(). */ -#define WOLFSSL_USER_IO - -/* Avoid naming conflicts */ -#define NO_OLD_WC_NAMES - -/* Use stack based fast math for all big integer math */ -#define USE_FAST_MATH -#define TFM_TIMING_RESISTANT - -/* Expose direct encryption functions */ -#define WOLFSSL_AES_DIRECT - -/* Enable/Disable algorithm support based on TPM implementation header */ -#if ALG_SHA256 - #define WOLFSSL_SHA256 -#endif -#if ALG_SHA384 || ALG_SHA512 - #define WOLFSSL_SHA384 - #define WOLFSSL_SHA512 -#endif -#if ALG_TDES - #define WOLFSSL_DES_ECB -#endif -#if ALG_RSA - /* Turn on RSA key generation functionality */ - #define WOLFSSL_KEY_GEN -#endif -#if ALG_ECC || defined(WOLFSSL_LIB) - #define HAVE_ECC - - /* Expose additional ECC primitives */ - #define WOLFSSL_PUBLIC_ECC_ADD_DBL - #define ECC_TIMING_RESISTANT - - /* Enables Shamir calc method */ - #define ECC_SHAMIR - - /* The TPM only needs low level ECC crypto */ - #define NO_ECC_SIGN - #define NO_ECC_VERIFY - #define NO_ECC_SECP - - #undef ECC_BN_P256 - #undef ECC_SM2_P256 - #undef ECC_BN_P638 - #define ECC_BN_P256 NO - #define ECC_SM2_P256 NO - #define ECC_BN_P638 NO - -#endif - -/* Disable explicit RSA. The TPM support for RSA is dependent only on TFM */ -#define NO_RSA -#define NO_RC4 -#define NO_ASN - -/* Enable debug wolf library check */ -//#define LIBRARY_COMPATIBILITY_CHECK - -#define WOLFSSL_ - -#endif // WOLF_CRYPT_USER_SETTINGS_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/X509.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/X509.h deleted file mode 100644 index ef3332c2d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/X509.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the macro and structure definitions for the X509 commands and -// functions. - -#ifndef _X509_H_ -#define _X509_H_ - -//** Includes - -#include "Tpm.h" -#include "TpmASN1.h" - -//** Defined Constants - -//*** X509 Application-specific types -#define X509_SELECTION 0xA0 -#define X509_ISSUER_UNIQUE_ID 0xA1 -#define X509_SUBJECT_UNIQUE_ID 0xA2 -#define X509_EXTENSIONS 0xA3 - -// These defines give the order in which values appear in the TBScertificate -// of an x.509 certificate. These values are used to index into an array of -// -#define ENCODED_SIZE_REF 0 -#define VERSION_REF (ENCODED_SIZE_REF + 1) -#define SERIAL_NUMBER_REF (VERSION_REF + 1) -#define SIGNATURE_REF (SERIAL_NUMBER_REF + 1) -#define ISSUER_REF (SIGNATURE_REF + 1) -#define VALIDITY_REF (ISSUER_REF + 1) -#define SUBJECT_KEY_REF (VALIDITY_REF + 1) -#define SUBJECT_PUBLIC_KEY_REF (SUBJECT_KEY_REF + 1) -#define EXTENSIONS_REF (SUBJECT_PUBLIC_KEY_REF + 1) -#define REF_COUNT (EXTENSIONS_REF + 1) - -#undef MAKE_OID -#ifdef _X509_SPT_ -# define MAKE_OID(NAME) \ - const BYTE OID##NAME[] = {OID##NAME##_VALUE} -#else -# define MAKE_OID(NAME) \ - extern const BYTE OID##NAME[] -#endif - - -//** Structures - - -// Used to access the fields of a TBSsignature some of which are in the in_CertifyX509 -// structure and some of which are in the out_CertifyX509 structure. -typedef struct stringRef -{ - BYTE *buf; - INT16 len; -} stringRef; - - -typedef union x509KeyUsageUnion { - TPMA_X509_KEY_USAGE x509; - UINT32 integer; -} x509KeyUsageUnion; - - -//** Global X509 Constants -// These values are instanced by X509_spt.c and referenced by other X509-related -// files. - - -// This is the DER-encoded value for the Key Usage OID (2.5.29.15). This is the -// full OID, not just the numeric value -#define OID_KEY_USAGE_EXTENSTION_VALUE 0x06, 0x03, 0x55, 0x1D, 0x0F -MAKE_OID(_KEY_USAGE_EXTENSTION); - -// This is the DER-encoded value for the TCG-defined TPMA_OBJECT OID -// (2.23.133.10.1.1.1) -#define OID_TCG_TPMA_OBJECT_VALUE 0x06, 0x07, 0x67, 0x81, 0x05, 0x0a, 0x01, \ - 0x01, 0x01 -MAKE_OID(_TCG_TPMA_OBJECT); - -#ifdef _X509_SPT_ -const x509KeyUsageUnion keyUsageSign = { TPMA_X509_KEY_USAGE_INITIALIZER( - /* digitalsignature */ 1, /* nonrepudiation */ 0, - /* keyencipherment */ 0, /* dataencipherment */ 0, - /* keyagreement */ 0, /* keycertsign */ 1, - /* crlsign */ 1, /* encipheronly */ 0, - /* decipheronly */ 0, /* bits_at_9 */ 0) }; - -const x509KeyUsageUnion keyUsageDecrypt = { TPMA_X509_KEY_USAGE_INITIALIZER( - /* digitalsignature */ 0, /* nonrepudiation */ 0, - /* keyencipherment */ 1, /* dataencipherment */ 1, - /* keyagreement */ 1, /* keycertsign */ 0, - /* crlsign */ 0, /* encipheronly */ 1, - /* decipheronly */ 1, /* bits_at_9 */ 0) }; -#else -extern x509KeyUsageUnion keyUsageSign; -extern x509KeyUsageUnion keyUsageDecrypt; -#endif - -#undef MAKE_OID - -#endif // _X509_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_GetCapability_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_GetCapability_fp.h deleted file mode 100644 index c5998a7df..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_GetCapability_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_AC_GetCapability // Command must be enabled - -#ifndef _AC_Get_Capability_FP_H_ -#define _AC_Get_Capability_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_AC ac; - TPM_AT capability; - UINT32 count; -} AC_GetCapability_In; - -// Output structure definition -typedef struct { - TPMI_YES_NO moreData; - TPML_AC_CAPABILITIES capabilitiesData; -} AC_GetCapability_Out; - -// Response code modifiers -#define RC_AC_GetCapability_ac (TPM_RC_H + TPM_RC_1) -#define RC_AC_GetCapability_capability (TPM_RC_P + TPM_RC_1) -#define RC_AC_GetCapability_count (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_AC_GetCapability( - AC_GetCapability_In *in, - AC_GetCapability_Out *out -); - -#endif // _AC_Get_Capability_FP_H_ -#endif // CC_AC_GetCapability diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_Send_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_Send_fp.h deleted file mode 100644 index 9b7d71caf..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_Send_fp.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_AC_Send // Command must be enabled - -#ifndef _AC_Send_FP_H_ -#define _AC_Send_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT sendObject; - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_AC ac; - TPM2B_MAX_BUFFER acDataIn; -} AC_Send_In; - -// Output structure definition -typedef struct { - TPMS_AC_OUTPUT acDataOut; -} AC_Send_Out; - -// Response code modifiers -#define RC_AC_Send_sendObject (TPM_RC_H + TPM_RC_1) -#define RC_AC_Send_authHandle (TPM_RC_H + TPM_RC_2) -#define RC_AC_Send_ac (TPM_RC_H + TPM_RC_3) -#define RC_AC_Send_acDataIn (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_AC_Send( - AC_Send_In *in, - AC_Send_Out *out -); - -#endif // _AC_Send_FP_H_ -#endif // CC_AC_Send diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_spt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_spt_fp.h deleted file mode 100644 index 280eb8edd..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AC_spt_fp.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _AC_SPT_FP_H_ -#define _AC_SPT_FP_H_ - -//*** AcToCapabilities() -// This function returns a pointer to a list of AC capabilities. -TPML_AC_CAPABILITIES * -AcToCapabilities( - TPMI_RH_AC component // IN: component -); - -//*** AcIsAccessible() -// Function to determine if an AC handle references an actual AC -// Return Type: BOOL -BOOL -AcIsAccessible( - TPM_HANDLE acHandle -); - -//*** AcCapabilitiesGet() -// This function returns a list of capabilities associated with an AC -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -AcCapabilitiesGet( - TPMI_RH_AC component, // IN: the component - TPM_AT type, // IN: start capability type - TPML_AC_CAPABILITIES *capabilityList // OUT: list of handle -); - -//*** AcSendObject() -// Stub to handle sending of an AC object -// Return Type: TPM_RC -TPM_RC -AcSendObject( - TPM_HANDLE acHandle, // IN: Handle of AC receiving object - OBJECT *object, // IN: object structure to send - TPMS_AC_OUTPUT *acDataOut // OUT: results of operation -); - -#endif // _AC_SPT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ActivateCredential_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ActivateCredential_fp.h deleted file mode 100644 index 0779c7205..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ActivateCredential_fp.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ActivateCredential // Command must be enabled - -#ifndef _Activate_Credential_FP_H_ -#define _Activate_Credential_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT activateHandle; - TPMI_DH_OBJECT keyHandle; - TPM2B_ID_OBJECT credentialBlob; - TPM2B_ENCRYPTED_SECRET secret; -} ActivateCredential_In; - -// Output structure definition -typedef struct { - TPM2B_DIGEST certInfo; -} ActivateCredential_Out; - -// Response code modifiers -#define RC_ActivateCredential_activateHandle (TPM_RC_H + TPM_RC_1) -#define RC_ActivateCredential_keyHandle (TPM_RC_H + TPM_RC_2) -#define RC_ActivateCredential_credentialBlob (TPM_RC_P + TPM_RC_1) -#define RC_ActivateCredential_secret (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_ActivateCredential( - ActivateCredential_In *in, - ActivateCredential_Out *out -); - -#endif // _Activate_Credential_FP_H_ -#endif // CC_ActivateCredential diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AlgorithmCap_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AlgorithmCap_fp.h deleted file mode 100644 index 32c99a1c6..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AlgorithmCap_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _ALGORITHM_CAP_FP_H_ -#define _ALGORITHM_CAP_FP_H_ - -//** AlgorithmCapGetImplemented() -// This function is used by TPM2_GetCapability() to return a list of the -// implemented algorithms. -// Return Type: TPMI_YES_NO -// YES more algorithms to report -// NO no more algorithms to report -TPMI_YES_NO -AlgorithmCapGetImplemented( - TPM_ALG_ID algID, // IN: the starting algorithm ID - UINT32 count, // IN: count of returned algorithms - TPML_ALG_PROPERTY *algList // OUT: algorithm list -); - -//** AlgorithmGetImplementedVector() -// This function returns the bit vector of the implemented algorithms. -LIB_EXPORT -void -AlgorithmGetImplementedVector( - ALGORITHM_VECTOR *implemented // OUT: the implemented bits are SET -); - -#endif // _ALGORITHM_CAP_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AlgorithmTests_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AlgorithmTests_fp.h deleted file mode 100644 index fbe539d6f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/AlgorithmTests_fp.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _ALGORITHM_TESTS_FP_H_ -#define _ALGORITHM_TESTS_FP_H_ - -#if SELF_TEST - -//*** TestAlgorithm() -// Dispatches to the correct test function for the algorithm or gets a list of -// testable algorithms. -// -// If 'toTest' is not NULL, then the test decisions are based on the algorithm -// selections in 'toTest'. Otherwise, 'g_toTest' is used. When bits are clear in -// 'g_toTest' they will also be cleared 'toTest'. -// -// If there doesn't happen to be a test for the algorithm, its associated bit is -// quietly cleared. -// -// If 'alg' is zero (TPM_ALG_ERROR), then the toTest vector is cleared of any bits -// for which there is no test (i.e. no tests are actually run but the vector is -// cleared). -// -// Note: 'toTest' will only ever have bits set for implemented algorithms but 'alg' -// can be anything. -// Return Type: TPM_RC -// TPM_RC_CANCELED test was canceled -LIB_EXPORT -TPM_RC -TestAlgorithm( - TPM_ALG_ID alg, - ALGORITHM_VECTOR *toTest -); -#endif // SELF_TESTS - -#endif // _ALGORITHM_TESTS_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Attest_spt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Attest_spt_fp.h deleted file mode 100644 index dbf634480..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Attest_spt_fp.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _ATTEST_SPT_FP_H_ -#define _ATTEST_SPT_FP_H_ - -//***FillInAttestInfo() -// Fill in common fields of TPMS_ATTEST structure. -void -FillInAttestInfo( - TPMI_DH_OBJECT signHandle, // IN: handle of signing object - TPMT_SIG_SCHEME *scheme, // IN/OUT: scheme to be used for signing - TPM2B_DATA *data, // IN: qualifying data - TPMS_ATTEST *attest // OUT: attest structure -); - -//***SignAttestInfo() -// Sign a TPMS_ATTEST structure. If signHandle is TPM_RH_NULL, a null signature -// is returned. -// -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'signHandle' references not a signing key -// TPM_RC_SCHEME 'scheme' is not compatible with 'signHandle' type -// TPM_RC_VALUE digest generated for the given 'scheme' is greater than -// the modulus of 'signHandle' (for an RSA key); -// invalid commit status or failed to generate "r" value -// (for an ECC key) -TPM_RC -SignAttestInfo( - OBJECT *signKey, // IN: sign object - TPMT_SIG_SCHEME *scheme, // IN: sign scheme - TPMS_ATTEST *certifyInfo, // IN: the data to be signed - TPM2B_DATA *qualifyingData, // IN: extra data for the signing - // process - TPM2B_ATTEST *attest, // OUT: marshaled attest blob to be - // signed - TPMT_SIGNATURE *signature // OUT: signature -); - -//*** IsSigningObject() -// Checks to see if the object is OK for signing. This is here rather than in -// Object_spt.c because all the attestation commands use this file but not -// Object_spt.c. -// Return Type: BOOL -// TRUE(1) object may sign -// FALSE(0) object may not sign -BOOL -IsSigningObject( - OBJECT *object // IN: -); - -#endif // _ATTEST_SPT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Bits_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Bits_fp.h deleted file mode 100644 index 5baaa5d9e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Bits_fp.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _BITS_FP_H_ -#define _BITS_FP_H_ - -//*** TestBit() -// This function is used to check the setting of a bit in an array of bits. -// Return Type: BOOL -// TRUE(1) bit is set -// FALSE(0) bit is not set -BOOL -TestBit( - unsigned int bitNum, // IN: number of the bit in 'bArray' - BYTE *bArray, // IN: array containing the bits - unsigned int bytesInArray // IN: size in bytes of 'bArray' -); - -//*** SetBit() -// This function will set the indicated bit in 'bArray'. -void -SetBit( - unsigned int bitNum, // IN: number of the bit in 'bArray' - BYTE *bArray, // IN: array containing the bits - unsigned int bytesInArray // IN: size in bytes of 'bArray' -); - -//*** ClearBit() -// This function will clear the indicated bit in 'bArray'. -void -ClearBit( - unsigned int bitNum, // IN: number of the bit in 'bArray'. - BYTE *bArray, // IN: array containing the bits - unsigned int bytesInArray // IN: size in bytes of 'bArray' -); - -#endif // _BITS_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnConvert_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnConvert_fp.h deleted file mode 100644 index 35733f48d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnConvert_fp.h +++ /dev/null @@ -1,130 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _BN_CONVERT_FP_H_ -#define _BN_CONVERT_FP_H_ - -//*** BnFromBytes() -// This function will convert a big-endian byte array to the internal number -// format. If bn is NULL, then the output is NULL. If bytes is null or the -// required size is 0, then the output is set to zero -LIB_EXPORT bigNum -BnFromBytes( - bigNum bn, - const BYTE *bytes, - NUMBYTES nBytes -); - -//*** BnFrom2B() -// Convert an TPM2B to a BIG_NUM. -// If the input value does not exist, or the output does not exist, or the input -// will not fit into the output the function returns NULL -LIB_EXPORT bigNum -BnFrom2B( - bigNum bn, // OUT: - const TPM2B *a2B // IN: number to convert -); - -//*** BnFromHex() -// Convert a hex string into a bigNum. This is primarily used in debugging. -LIB_EXPORT bigNum -BnFromHex( - bigNum bn, // OUT: - const char *hex // IN: -); - -//*** BnToBytes() -// This function converts a BIG_NUM to a byte array. It converts the bigNum to a -// big-endian byte string and sets 'size' to the normalized value. If 'size' is an -// input 0, then the receiving buffer is guaranteed to be large enough for the result -// and the size will be set to the size required for bigNum (leading zeros -// suppressed). -// -// The conversion for a little-endian machine simply requires that all significant -// bytes of the bigNum be reversed. For a big-endian machine, rather than -// unpack each word individually, the bigNum is converted to little-endian words, -// copied, and then converted back to big-endian. -LIB_EXPORT BOOL -BnToBytes( - bigConst bn, - BYTE *buffer, - NUMBYTES *size // This the number of bytes that are - // available in the buffer. The result - // should be this big. -); - -//*** BnTo2B() -// Function to convert a BIG_NUM to TPM2B. -// The TPM2B size is set to the requested 'size' which may require padding. -// If 'size' is non-zero and less than required by the value in 'bn' then an error -// is returned. If 'size' is zero, then the TPM2B is assumed to be large enough -// for the data and a2b->size will be adjusted accordingly. -LIB_EXPORT BOOL -BnTo2B( - bigConst bn, // IN: - TPM2B *a2B, // OUT: - NUMBYTES size // IN: the desired size -); -#if ALG_ECC - -//*** BnPointFrom2B() -// Function to create a BIG_POINT structure from a 2B point. -// A point is going to be two ECC values in the same buffer. The values are going -// to be the size of the modulus. They are in modular form. -LIB_EXPORT bn_point_t * -BnPointFrom2B( - bigPoint ecP, // OUT: the preallocated point structure - TPMS_ECC_POINT *p // IN: the number to convert -); - -//*** BnPointTo2B() -// This function converts a BIG_POINT into a TPMS_ECC_POINT. A TPMS_ECC_POINT -// contains two TPM2B_ECC_PARAMETER values. The maximum size of the parameters -// is dependent on the maximum EC key size used in an implementation. -// The presumption is that the TPMS_ECC_POINT is large enough to hold 2 TPM2B -// values, each as large as a MAX_ECC_PARAMETER_BYTES -LIB_EXPORT BOOL -BnPointTo2B( - TPMS_ECC_POINT *p, // OUT: the converted 2B structure - bigPoint ecP, // IN: the values to be converted - bigCurve E // IN: curve descriptor for the point -); -#endif // ALG_ECC - -#endif // _BN_CONVERT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnMath_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnMath_fp.h deleted file mode 100644 index 0b9107caa..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnMath_fp.h +++ /dev/null @@ -1,238 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _BN_MATH_FP_H_ -#define _BN_MATH_FP_H_ - -//*** BnAdd() -// This function adds two bigNum values. This function always returns TRUE. -LIB_EXPORT BOOL -BnAdd( - bigNum result, - bigConst op1, - bigConst op2 -); - -//*** BnAddWord() -// This function adds a word value to a bigNum. This function always returns TRUE. -LIB_EXPORT BOOL -BnAddWord( - bigNum result, - bigConst op, - crypt_uword_t word -); - -//*** BnSub() -// This function does subtraction of two bigNum values and returns result = op1 - op2 -// when op1 is greater than op2. If op2 is greater than op1, then a fault is -// generated. This function always returns TRUE. -LIB_EXPORT BOOL -BnSub( - bigNum result, - bigConst op1, - bigConst op2 -); - -//*** BnSubWord() -// This function subtracts a word value from a bigNum. This function always -// returns TRUE. -LIB_EXPORT BOOL -BnSubWord( - bigNum result, - bigConst op, - crypt_uword_t word -); - -//*** BnUnsignedCmp() -// This function performs a comparison of op1 to op2. The compare is approximately -// constant time if the size of the values used in the compare is consistent -// across calls (from the same line in the calling code). -// Return Type: int -// < 0 op1 is less than op2 -// 0 op1 is equal to op2 -// > 0 op1 is greater than op2 -LIB_EXPORT int -BnUnsignedCmp( - bigConst op1, - bigConst op2 -); - -//*** BnUnsignedCmpWord() -// Compare a bigNum to a crypt_uword_t. -// Return Type: int -// -1 op1 is less that word -// 0 op1 is equal to word -// 1 op1 is greater than word -LIB_EXPORT int -BnUnsignedCmpWord( - bigConst op1, - crypt_uword_t word -); - -//*** BnModWord() -// This function does modular division of a big number when the modulus is a -// word value. -LIB_EXPORT crypt_word_t -BnModWord( - bigConst numerator, - crypt_word_t modulus -); - -//*** Msb() -// This function returns the bit number of the most significant bit of a -// crypt_uword_t. The number for the least significant bit of any bigNum value is 0. -// The maximum return value is RADIX_BITS - 1, -// Return Type: int -// -1 the word was zero -// n the bit number of the most significant bit in the word -LIB_EXPORT int -Msb( - crypt_uword_t word -); - -//*** BnMsb() -// This function returns the number of the MSb of a bigNum value. -// Return Type: int -// -1 the word was zero or 'bn' was NULL -// n the bit number of the most significant bit in the word -LIB_EXPORT int -BnMsb( - bigConst bn -); - -//*** BnSizeInBits() -// This function returns the number of bits required to hold a number. It is one -// greater than the Msb. -// -LIB_EXPORT unsigned -BnSizeInBits( - bigConst n -); - -//*** BnSetWord() -// Change the value of a bignum_t to a word value. -LIB_EXPORT bigNum -BnSetWord( - bigNum n, - crypt_uword_t w -); - -//*** BnSetBit() -// This function will SET a bit in a bigNum. Bit 0 is the least-significant bit in -// the 0th digit_t. The function always return TRUE -LIB_EXPORT BOOL -BnSetBit( - bigNum bn, // IN/OUT: big number to modify - unsigned int bitNum // IN: Bit number to SET -); - -//*** BnTestBit() -// This function is used to check to see if a bit is SET in a bignum_t. The 0th bit -// is the LSb of d[0]. -// Return Type: BOOL -// TRUE(1) the bit is set -// FALSE(0) the bit is not set or the number is out of range -LIB_EXPORT BOOL -BnTestBit( - bigNum bn, // IN: number to check - unsigned int bitNum // IN: bit to test -); - -//***BnMaskBits() -// This function is used to mask off high order bits of a big number. -// The returned value will have no more than 'maskBit' bits -// set. -// Note: There is a requirement that unused words of a bignum_t are set to zero. -// Return Type: BOOL -// TRUE(1) result masked -// FALSE(0) the input was not as large as the mask -LIB_EXPORT BOOL -BnMaskBits( - bigNum bn, // IN/OUT: number to mask - crypt_uword_t maskBit // IN: the bit number for the mask. -); - -//*** BnShiftRight() -// This function will shift a bigNum to the right by the shiftAmount. -// This function always returns TRUE. -LIB_EXPORT BOOL -BnShiftRight( - bigNum result, - bigConst toShift, - uint32_t shiftAmount -); - -//*** BnGetRandomBits() -// This function gets random bits for use in various places. To make sure that the -// number is generated in a portable format, it is created as a TPM2B and then -// converted to the internal format. -// -// One consequence of the generation scheme is that, if the number of bits requested -// is not a multiple of 8, then the high-order bits are set to zero. This would come -// into play when generating a 521-bit ECC key. A 66-byte (528-bit) value is -// generated an the high order 7 bits are masked off (CLEAR). -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -LIB_EXPORT BOOL -BnGetRandomBits( - bigNum n, - size_t bits, - RAND_STATE *rand -); - -//*** BnGenerateRandomInRange() -// This function is used to generate a random number r in the range 1 <= r < limit. -// The function gets a random number of bits that is the size of limit. There is some -// some probability that the returned number is going to be greater than or equal -// to the limit. If it is, try again. There is no more than 50% chance that the -// next number is also greater, so try again. We keep trying until we get a -// value that meets the criteria. Since limit is very often a number with a LOT of -// high order ones, this rarely would need a second try. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure ('limit' is too small) -LIB_EXPORT BOOL -BnGenerateRandomInRange( - bigNum dest, - bigConst limit, - RAND_STATE *rand -); - -#endif // _BN_MATH_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnMemory_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnMemory_fp.h deleted file mode 100644 index 68abe86c3..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/BnMemory_fp.h +++ /dev/null @@ -1,110 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _BN_MEMORY_FP_H_ -#define _BN_MEMORY_FP_H_ - -//*** BnSetTop() -// This function is used when the size of a bignum_t is changed. It -// makes sure that the unused words are set to zero and that any significant -// words of zeros are eliminated from the used size indicator. -LIB_EXPORT bigNum -BnSetTop( - bigNum bn, // IN/OUT: number to clean - crypt_uword_t top // IN: the new top -); - -//*** BnClearTop() -// This function will make sure that all unused words are zero. -LIB_EXPORT bigNum -BnClearTop( - bigNum bn -); - -//*** BnInitializeWord() -// This function is used to initialize an allocated bigNum with a word value. The -// bigNum does not have to be allocated with a single word. -LIB_EXPORT bigNum -BnInitializeWord( - bigNum bn, // IN: - crypt_uword_t allocated, // IN: - crypt_uword_t word // IN: -); - -//*** BnInit() -// This function initializes a stack allocated bignum_t. It initializes -// 'allocated' and 'size' and zeros the words of 'd'. -LIB_EXPORT bigNum -BnInit( - bigNum bn, - crypt_uword_t allocated -); - -//*** BnCopy() -// Function to copy a bignum_t. If the output is NULL, then -// nothing happens. If the input is NULL, the output is set -// to zero. -LIB_EXPORT BOOL -BnCopy( - bigNum out, - bigConst in -); -#if ALG_ECC - -//*** BnPointCopy() -// Function to copy a bn point. -LIB_EXPORT BOOL -BnPointCopy( - bigPoint pOut, - pointConst pIn -); - -//*** BnInitializePoint() -// This function is used to initialize a point structure with the addresses -// of the coordinates. -LIB_EXPORT bn_point_t * -BnInitializePoint( - bigPoint p, // OUT: structure to receive pointers - bigNum x, // IN: x coordinate - bigNum y, // IN: y coordinate - bigNum z // IN: x coordinate -); -#endif // ALG_ECC - -#endif // _BN_MEMORY_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CertifyCreation_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CertifyCreation_fp.h deleted file mode 100644 index d40105c94..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CertifyCreation_fp.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_CertifyCreation // Command must be enabled - -#ifndef _Certify_Creation_FP_H_ -#define _Certify_Creation_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT signHandle; - TPMI_DH_OBJECT objectHandle; - TPM2B_DATA qualifyingData; - TPM2B_DIGEST creationHash; - TPMT_SIG_SCHEME inScheme; - TPMT_TK_CREATION creationTicket; -} CertifyCreation_In; - -// Output structure definition -typedef struct { - TPM2B_ATTEST certifyInfo; - TPMT_SIGNATURE signature; -} CertifyCreation_Out; - -// Response code modifiers -#define RC_CertifyCreation_signHandle (TPM_RC_H + TPM_RC_1) -#define RC_CertifyCreation_objectHandle (TPM_RC_H + TPM_RC_2) -#define RC_CertifyCreation_qualifyingData (TPM_RC_P + TPM_RC_1) -#define RC_CertifyCreation_creationHash (TPM_RC_P + TPM_RC_2) -#define RC_CertifyCreation_inScheme (TPM_RC_P + TPM_RC_3) -#define RC_CertifyCreation_creationTicket (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_CertifyCreation( - CertifyCreation_In *in, - CertifyCreation_Out *out -); - -#endif // _Certify_Creation_FP_H_ -#endif // CC_CertifyCreation diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CertifyX509_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CertifyX509_fp.h deleted file mode 100644 index 53aed310e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CertifyX509_fp.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Apr 2, 2019 Time: 11:00:48AM - */ - -#if CC_CertifyX509 // Command must be enabled - -#ifndef _Certify_X509_FP_H_ -#define _Certify_X509_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT objectHandle; - TPMI_DH_OBJECT signHandle; - TPM2B_DATA qualifyingData; - TPMT_SIG_SCHEME inScheme; - TPM2B_MAX_BUFFER partialCertificate; -} CertifyX509_In; - -// Output structure definition -typedef struct { - TPM2B_MAX_BUFFER addedToCertificate; - TPM2B_DIGEST tbsDigest; - TPMT_SIGNATURE signature; -} CertifyX509_Out; - -// Response code modifiers -#define RC_CertifyX509_objectHandle (TPM_RC_H + TPM_RC_1) -#define RC_CertifyX509_signHandle (TPM_RC_H + TPM_RC_2) -#define RC_CertifyX509_qualifyingData (TPM_RC_P + TPM_RC_1) -#define RC_CertifyX509_inScheme (TPM_RC_P + TPM_RC_2) -#define RC_CertifyX509_partialCertificate (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_CertifyX509( - CertifyX509_In *in, - CertifyX509_Out *out -); - -#endif // _Certify_X509_FP_H_ -#endif // CC_CertifyX509 diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Certify_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Certify_fp.h deleted file mode 100644 index 64cdba21b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Certify_fp.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Certify // Command must be enabled - -#ifndef _Certify_FP_H_ -#define _Certify_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT objectHandle; - TPMI_DH_OBJECT signHandle; - TPM2B_DATA qualifyingData; - TPMT_SIG_SCHEME inScheme; -} Certify_In; - -// Output structure definition -typedef struct { - TPM2B_ATTEST certifyInfo; - TPMT_SIGNATURE signature; -} Certify_Out; - -// Response code modifiers -#define RC_Certify_objectHandle (TPM_RC_H + TPM_RC_1) -#define RC_Certify_signHandle (TPM_RC_H + TPM_RC_2) -#define RC_Certify_qualifyingData (TPM_RC_P + TPM_RC_1) -#define RC_Certify_inScheme (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_Certify( - Certify_In *in, - Certify_Out *out -); - -#endif // _Certify_FP_H_ -#endif // CC_Certify diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ChangeEPS_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ChangeEPS_fp.h deleted file mode 100644 index 60dfc174c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ChangeEPS_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ChangeEPS // Command must be enabled - -#ifndef _Change_EPS_FP_H_ -#define _Change_EPS_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PLATFORM authHandle; -} ChangeEPS_In; - -// Response code modifiers -#define RC_ChangeEPS_authHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ChangeEPS( - ChangeEPS_In *in -); - -#endif // _Change_EPS_FP_H_ -#endif // CC_ChangeEPS diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ChangePPS_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ChangePPS_fp.h deleted file mode 100644 index e4e70180e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ChangePPS_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ChangePPS // Command must be enabled - -#ifndef _Change_PPS_FP_H_ -#define _Change_PPS_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PLATFORM authHandle; -} ChangePPS_In; - -// Response code modifiers -#define RC_ChangePPS_authHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ChangePPS( - ChangePPS_In *in -); - -#endif // _Change_PPS_FP_H_ -#endif // CC_ChangePPS diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClearControl_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClearControl_fp.h deleted file mode 100644 index 5a10c680b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClearControl_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ClearControl // Command must be enabled - -#ifndef _Clear_Control_FP_H_ -#define _Clear_Control_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_CLEAR auth; - TPMI_YES_NO disable; -} ClearControl_In; - -// Response code modifiers -#define RC_ClearControl_auth (TPM_RC_H + TPM_RC_1) -#define RC_ClearControl_disable (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ClearControl( - ClearControl_In *in -); - -#endif // _Clear_Control_FP_H_ -#endif // CC_ClearControl diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Clear_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Clear_fp.h deleted file mode 100644 index cc9692126..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Clear_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Clear // Command must be enabled - -#ifndef _Clear_FP_H_ -#define _Clear_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_CLEAR authHandle; -} Clear_In; - -// Response code modifiers -#define RC_Clear_authHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_Clear( - Clear_In *in -); - -#endif // _Clear_FP_H_ -#endif // CC_Clear diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClockRateAdjust_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClockRateAdjust_fp.h deleted file mode 100644 index f8a6376e1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClockRateAdjust_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ClockRateAdjust // Command must be enabled - -#ifndef _Clock_Rate_Adjust_FP_H_ -#define _Clock_Rate_Adjust_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PROVISION auth; - TPM_CLOCK_ADJUST rateAdjust; -} ClockRateAdjust_In; - -// Response code modifiers -#define RC_ClockRateAdjust_auth (TPM_RC_H + TPM_RC_1) -#define RC_ClockRateAdjust_rateAdjust (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ClockRateAdjust( - ClockRateAdjust_In *in -); - -#endif // _Clock_Rate_Adjust_FP_H_ -#endif // CC_ClockRateAdjust diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClockSet_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClockSet_fp.h deleted file mode 100644 index f2915a96d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ClockSet_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ClockSet // Command must be enabled - -#ifndef _Clock_Set_FP_H_ -#define _Clock_Set_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PROVISION auth; - UINT64 newTime; -} ClockSet_In; - -// Response code modifiers -#define RC_ClockSet_auth (TPM_RC_H + TPM_RC_1) -#define RC_ClockSet_newTime (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ClockSet( - ClockSet_In *in -); - -#endif // _Clock_Set_FP_H_ -#endif // CC_ClockSet diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandAudit_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandAudit_fp.h deleted file mode 100644 index a9bfa78a8..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandAudit_fp.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:23:27PM - */ - -#ifndef _COMMAND_AUDIT_FP_H_ -#define _COMMAND_AUDIT_FP_H_ - -//*** CommandAuditPreInstall_Init() -// This function initializes the command audit list. This function simulates -// the behavior of manufacturing. A function is used instead of a structure -// definition because this is easier than figuring out the initialization value -// for a bit array. -// -// This function would not be implemented outside of a manufacturing or -// simulation environment. -void -CommandAuditPreInstall_Init( - void -); - -//*** CommandAuditStartup() -// This function clears the command audit digest on a TPM Reset. -BOOL -CommandAuditStartup( - STARTUP_TYPE type // IN: start up type -); - -//*** CommandAuditSet() -// This function will SET the audit flag for a command. This function -// will not SET the audit flag for a command that is not implemented. This -// ensures that the audit status is not SET when TPM2_GetCapability() is -// used to read the list of audited commands. -// -// This function is only used by TPM2_SetCommandCodeAuditStatus(). -// -// The actions in TPM2_SetCommandCodeAuditStatus() are expected to cause the -// changes to be saved to NV after it is setting and clearing bits. -// Return Type: BOOL -// TRUE(1) command code audit status was changed -// FALSE(0) command code audit status was not changed -BOOL -CommandAuditSet( - TPM_CC commandCode // IN: command code -); - -//*** CommandAuditClear() -// This function will CLEAR the audit flag for a command. It will not CLEAR the -// audit flag for TPM_CC_SetCommandCodeAuditStatus(). -// -// This function is only used by TPM2_SetCommandCodeAuditStatus(). -// -// The actions in TPM2_SetCommandCodeAuditStatus() are expected to cause the -// changes to be saved to NV after it is setting and clearing bits. -// Return Type: BOOL -// TRUE(1) command code audit status was changed -// FALSE(0) command code audit status was not changed -BOOL -CommandAuditClear( - TPM_CC commandCode // IN: command code -); - -//*** CommandAuditIsRequired() -// This function indicates if the audit flag is SET for a command. -// Return Type: BOOL -// TRUE(1) command is audited -// FALSE(0) command is not audited -BOOL -CommandAuditIsRequired( - COMMAND_INDEX commandIndex // IN: command index -); - -//*** CommandAuditCapGetCCList() -// This function returns a list of commands that have their audit bit SET. -// -// The list starts at the input commandCode. -// Return Type: TPMI_YES_NO -// YES if there are more command code available -// NO all the available command code has been returned -TPMI_YES_NO -CommandAuditCapGetCCList( - TPM_CC commandCode, // IN: start command code - UINT32 count, // IN: count of returned TPM_CC - TPML_CC *commandList // OUT: list of TPM_CC -); - -//*** CommandAuditGetDigest -// This command is used to create a digest of the commands being audited. The -// commands are processed in ascending numeric order with a list of TPM_CC being -// added to a hash. This operates as if all the audited command codes were -// concatenated and then hashed. -void -CommandAuditGetDigest( - TPM2B_DIGEST *digest // OUT: command digest -); - -#endif // _COMMAND_AUDIT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandCodeAttributes_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandCodeAttributes_fp.h deleted file mode 100644 index 0e40485a2..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandCodeAttributes_fp.h +++ /dev/null @@ -1,182 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _COMMAND_CODE_ATTRIBUTES_FP_H_ -#define _COMMAND_CODE_ATTRIBUTES_FP_H_ - -//*** GetClosestCommandIndex() -// This function returns the command index for the command with a value that is -// equal to or greater than the input value -// Return Type: COMMAND_INDEX -// UNIMPLEMENTED_COMMAND_INDEX command is not implemented -// other index of a command -COMMAND_INDEX -GetClosestCommandIndex( - TPM_CC commandCode // IN: the command code to start at -); - -//*** CommandCodeToComandIndex() -// This function returns the index in the various attributes arrays of the -// command. -// Return Type: COMMAND_INDEX -// UNIMPLEMENTED_COMMAND_INDEX command is not implemented -// other index of the command -COMMAND_INDEX -CommandCodeToCommandIndex( - TPM_CC commandCode // IN: the command code to look up -); - -//*** GetNextCommandIndex() -// This function returns the index of the next implemented command. -// Return Type: COMMAND_INDEX -// UNIMPLEMENTED_COMMAND_INDEX no more implemented commands -// other the index of the next implemented command -COMMAND_INDEX -GetNextCommandIndex( - COMMAND_INDEX commandIndex // IN: the starting index -); - -//*** GetCommandCode() -// This function returns the commandCode associated with the command index -TPM_CC -GetCommandCode( - COMMAND_INDEX commandIndex // IN: the command index -); - -//*** CommandAuthRole() -// -// This function returns the authorization role required of a handle. -// -// Return Type: AUTH_ROLE -// AUTH_NONE no authorization is required -// AUTH_USER user role authorization is required -// AUTH_ADMIN admin role authorization is required -// AUTH_DUP duplication role authorization is required -AUTH_ROLE -CommandAuthRole( - COMMAND_INDEX commandIndex, // IN: command index - UINT32 handleIndex // IN: handle index (zero based) -); - -//*** EncryptSize() -// This function returns the size of the decrypt size field. This function returns -// 0 if encryption is not allowed -// Return Type: int -// 0 encryption not allowed -// 2 size field is two bytes -// 4 size field is four bytes -int -EncryptSize( - COMMAND_INDEX commandIndex // IN: command index -); - -//*** DecryptSize() -// This function returns the size of the decrypt size field. This function returns -// 0 if decryption is not allowed -// Return Type: int -// 0 encryption not allowed -// 2 size field is two bytes -// 4 size field is four bytes -int -DecryptSize( - COMMAND_INDEX commandIndex // IN: command index -); - -//*** IsSessionAllowed() -// -// This function indicates if the command is allowed to have sessions. -// -// This function must not be called if the command is not known to be implemented. -// -// Return Type: BOOL -// TRUE(1) session is allowed with this command -// FALSE(0) session is not allowed with this command -BOOL -IsSessionAllowed( - COMMAND_INDEX commandIndex // IN: the command to be checked -); - -//*** IsHandleInResponse() -// This function determines if a command has a handle in the response -BOOL -IsHandleInResponse( - COMMAND_INDEX commandIndex -); - -//*** IsWriteOperation() -// Checks to see if an operation will write to an NV Index and is subject to being -// blocked by read-lock -BOOL -IsWriteOperation( - COMMAND_INDEX commandIndex // IN: Command to check -); - -//*** IsReadOperation() -// Checks to see if an operation will write to an NV Index and is -// subject to being blocked by write-lock. -BOOL -IsReadOperation( - COMMAND_INDEX commandIndex // IN: Command to check -); - -//*** CommandCapGetCCList() -// This function returns a list of implemented commands and command attributes -// starting from the command in 'commandCode'. -// Return Type: TPMI_YES_NO -// YES more command attributes are available -// NO no more command attributes are available -TPMI_YES_NO -CommandCapGetCCList( - TPM_CC commandCode, // IN: start command code - UINT32 count, // IN: maximum count for number of entries in - // 'commandList' - TPML_CCA *commandList // OUT: list of TPMA_CC -); - -//*** IsVendorCommand() -// Function indicates if a command index references a vendor command. -// Return Type: BOOL -// TRUE(1) command is a vendor command -// FALSE(0) command is not a vendor command -BOOL -IsVendorCommand( - COMMAND_INDEX commandIndex // IN: command index to check -); - -#endif // _COMMAND_CODE_ATTRIBUTES_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandDispatcher_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandDispatcher_fp.h deleted file mode 100644 index 3c0e70f8e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CommandDispatcher_fp.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _COMMAND_DISPATCHER_FP_H_ -#define _COMMAND_DISPATCHER_FP_H_ - -//*** ParseHandleBuffer() -// This is the table-driven version of the handle buffer unmarshaling code -TPM_RC -ParseHandleBuffer( - COMMAND *command -); - -//*** CommandDispatcher() -// Function to unmarshal the command parameters, call the selected action code, and -// marshal the response parameters. -TPM_RC -CommandDispatcher( - COMMAND *command -); - -#endif // _COMMAND_DISPATCHER_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Commit_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Commit_fp.h deleted file mode 100644 index 6bf6e9a3b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Commit_fp.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Commit // Command must be enabled - -#ifndef _Commit_FP_H_ -#define _Commit_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT signHandle; - TPM2B_ECC_POINT P1; - TPM2B_SENSITIVE_DATA s2; - TPM2B_ECC_PARAMETER y2; -} Commit_In; - -// Output structure definition -typedef struct { - TPM2B_ECC_POINT K; - TPM2B_ECC_POINT L; - TPM2B_ECC_POINT E; - UINT16 counter; -} Commit_Out; - -// Response code modifiers -#define RC_Commit_signHandle (TPM_RC_H + TPM_RC_1) -#define RC_Commit_P1 (TPM_RC_P + TPM_RC_1) -#define RC_Commit_s2 (TPM_RC_P + TPM_RC_2) -#define RC_Commit_y2 (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_Commit( - Commit_In *in, - Commit_Out *out -); - -#endif // _Commit_FP_H_ -#endif // CC_Commit diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ContextLoad_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ContextLoad_fp.h deleted file mode 100644 index a2c4ab437..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ContextLoad_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ContextLoad // Command must be enabled - -#ifndef _Context_Load_FP_H_ -#define _Context_Load_FP_H_ - -// Input structure definition -typedef struct { - TPMS_CONTEXT context; -} ContextLoad_In; - -// Output structure definition -typedef struct { - TPMI_DH_CONTEXT loadedHandle; -} ContextLoad_Out; - -// Response code modifiers -#define RC_ContextLoad_context (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ContextLoad( - ContextLoad_In *in, - ContextLoad_Out *out -); - -#endif // _Context_Load_FP_H_ -#endif // CC_ContextLoad diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ContextSave_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ContextSave_fp.h deleted file mode 100644 index 816c36b94..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ContextSave_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ContextSave // Command must be enabled - -#ifndef _Context_Save_FP_H_ -#define _Context_Save_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_CONTEXT saveHandle; -} ContextSave_In; - -// Output structure definition -typedef struct { - TPMS_CONTEXT context; -} ContextSave_Out; - -// Response code modifiers -#define RC_ContextSave_saveHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ContextSave( - ContextSave_In *in, - ContextSave_Out *out -); - -#endif // _Context_Save_FP_H_ -#endif // CC_ContextSave diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Context_spt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Context_spt_fp.h deleted file mode 100644 index 3b52073c3..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Context_spt_fp.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _CONTEXT_SPT_FP_H_ -#define _CONTEXT_SPT_FP_H_ - -//*** ComputeContextProtectionKey() -// This function retrieves the symmetric protection key for context encryption -// It is used by TPM2_ConextSave and TPM2_ContextLoad to create the symmetric -// encryption key and iv -// Return Type: void -void -ComputeContextProtectionKey( - TPMS_CONTEXT *contextBlob, // IN: context blob - TPM2B_SYM_KEY *symKey, // OUT: the symmetric key - TPM2B_IV *iv // OUT: the IV. -); - -//*** ComputeContextIntegrity() -// Generate the integrity hash for a context -// It is used by TPM2_ContextSave to create an integrity hash -// and by TPM2_ContextLoad to compare an integrity hash -// Return Type: void -void -ComputeContextIntegrity( - TPMS_CONTEXT *contextBlob, // IN: context blob - TPM2B_DIGEST *integrity // OUT: integrity -); - -//*** SequenceDataExport(); -// This function is used scan through the sequence object and -// either modify the hash state data for export (contextSave) or to -// import it into the internal format (contextLoad). -// This function should only be called after the sequence object has been copied -// to the context buffer (contextSave) or from the context buffer into the sequence -// object. The presumption is that the context buffer version of the data is the -// same size as the internal representation so nothing outsize of the hash context -// area gets modified. -void -SequenceDataExport( - HASH_OBJECT *object, // IN: an internal hash object - HASH_OBJECT_BUFFER *exportObject // OUT: a sequence context in a buffer -); - -//*** SequenceDataImport(); -// This function is used scan through the sequence object and -// either modify the hash state data for export (contextSave) or to -// import it into the internal format (contextLoad). -// This function should only be called after the sequence object has been copied -// to the context buffer (contextSave) or from the context buffer into the sequence -// object. The presumption is that the context buffer version of the data is the -// same size as the internal representation so nothing outsize of the hash context -// area gets modified. -void -SequenceDataImport( - HASH_OBJECT *object, // IN/OUT: an internal hash object - HASH_OBJECT_BUFFER *exportObject // IN/OUT: a sequence context in a buffer -); - -#endif // _CONTEXT_SPT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CreateLoaded_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CreateLoaded_fp.h deleted file mode 100644 index 7569df429..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CreateLoaded_fp.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_CreateLoaded // Command must be enabled - -#ifndef _Create_Loaded_FP_H_ -#define _Create_Loaded_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_PARENT parentHandle; - TPM2B_SENSITIVE_CREATE inSensitive; - TPM2B_TEMPLATE inPublic; -} CreateLoaded_In; - -// Output structure definition -typedef struct { - TPM_HANDLE objectHandle; - TPM2B_PRIVATE outPrivate; - TPM2B_PUBLIC outPublic; - TPM2B_NAME name; -} CreateLoaded_Out; - -// Response code modifiers -#define RC_CreateLoaded_parentHandle (TPM_RC_H + TPM_RC_1) -#define RC_CreateLoaded_inSensitive (TPM_RC_P + TPM_RC_1) -#define RC_CreateLoaded_inPublic (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_CreateLoaded( - CreateLoaded_In *in, - CreateLoaded_Out *out -); - -#endif // _Create_Loaded_FP_H_ -#endif // CC_CreateLoaded diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CreatePrimary_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CreatePrimary_fp.h deleted file mode 100644 index e42cfc754..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CreatePrimary_fp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_CreatePrimary // Command must be enabled - -#ifndef _Create_Primary_FP_H_ -#define _Create_Primary_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_HIERARCHY primaryHandle; - TPM2B_SENSITIVE_CREATE inSensitive; - TPM2B_PUBLIC inPublic; - TPM2B_DATA outsideInfo; - TPML_PCR_SELECTION creationPCR; -} CreatePrimary_In; - -// Output structure definition -typedef struct { - TPM_HANDLE objectHandle; - TPM2B_PUBLIC outPublic; - TPM2B_CREATION_DATA creationData; - TPM2B_DIGEST creationHash; - TPMT_TK_CREATION creationTicket; - TPM2B_NAME name; -} CreatePrimary_Out; - -// Response code modifiers -#define RC_CreatePrimary_primaryHandle (TPM_RC_H + TPM_RC_1) -#define RC_CreatePrimary_inSensitive (TPM_RC_P + TPM_RC_1) -#define RC_CreatePrimary_inPublic (TPM_RC_P + TPM_RC_2) -#define RC_CreatePrimary_outsideInfo (TPM_RC_P + TPM_RC_3) -#define RC_CreatePrimary_creationPCR (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_CreatePrimary( - CreatePrimary_In *in, - CreatePrimary_Out *out -); - -#endif // _Create_Primary_FP_H_ -#endif // CC_CreatePrimary diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Create_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Create_fp.h deleted file mode 100644 index 3b1e2a773..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Create_fp.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Create // Command must be enabled - -#ifndef _Create_FP_H_ -#define _Create_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT parentHandle; - TPM2B_SENSITIVE_CREATE inSensitive; - TPM2B_PUBLIC inPublic; - TPM2B_DATA outsideInfo; - TPML_PCR_SELECTION creationPCR; -} Create_In; - -// Output structure definition -typedef struct { - TPM2B_PRIVATE outPrivate; - TPM2B_PUBLIC outPublic; - TPM2B_CREATION_DATA creationData; - TPM2B_DIGEST creationHash; - TPMT_TK_CREATION creationTicket; -} Create_Out; - -// Response code modifiers -#define RC_Create_parentHandle (TPM_RC_H + TPM_RC_1) -#define RC_Create_inSensitive (TPM_RC_P + TPM_RC_1) -#define RC_Create_inPublic (TPM_RC_P + TPM_RC_2) -#define RC_Create_outsideInfo (TPM_RC_P + TPM_RC_3) -#define RC_Create_creationPCR (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_Create( - Create_In *in, - Create_Out *out -); - -#endif // _Create_FP_H_ -#endif // CC_Create diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptCmac_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptCmac_fp.h deleted file mode 100644 index be781014a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptCmac_fp.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _CRYPT_CMAC_FP_H_ -#define _CRYPT_CMAC_FP_H_ - -#if ALG_CMAC - -//*** CryptCmacStart() -// This is the function to start the CMAC sequence operation. It initializes the -// dispatch functions for the data and end operations for CMAC and initializes the -// parameters that are used for the processing of data, including the key, key size -// and block cipher algorithm. -UINT16 -CryptCmacStart( - SMAC_STATE *state, - TPMU_PUBLIC_PARMS *keyParms, - TPM_ALG_ID macAlg, - TPM2B *key -); - -//*** CryptCmacData() -// This function is used to add data to the CMAC sequence computation. The function -// will XOR new data into the IV. If the buffer is full, and there is additional -// input data, the data is encrypted into the IV buffer, the new data is then -// XOR into the IV. When the data runs out, the function returns without encrypting -// even if the buffer is full. The last data block of a sequence will not be -// encrypted until the call to CryptCmacEnd(). This is to allow the proper subkey -// to be computed and applied before the last block is encrypted. -void -CryptCmacData( - SMAC_STATES *state, - UINT32 size, - const BYTE *buffer -); - -//*** CryptCmacEnd() -// This is the completion function for the CMAC. It does padding, if needed, and -// selects the subkey to be applied before the last block is encrypted. -UINT16 -CryptCmacEnd( - SMAC_STATES *state, - UINT32 outSize, - BYTE *outBuffer -); -#endif - -#endif // _CRYPT_CMAC_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptDes_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptDes_fp.h deleted file mode 100644 index 4f4513483..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptDes_fp.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _CRYPT_DES_FP_H_ -#define _CRYPT_DES_FP_H_ - -#if ALG_TDES - -//*** CryptSetOddByteParity() -// This function sets the per byte parity of a 64-bit value. The least-significant -// bit is of each byte is replaced with the odd parity of the other 7 bits in the -// byte. With odd parity, no byte will ever be 0x00. -UINT64 -CryptSetOddByteParity( - UINT64 k -); - -//*** CryptDesValidateKey() -// Function to check to see if the input key is a valid DES key where the definition -// of valid is that none of the elements are on the list of weak, semi-weak, or -// possibly weak keys; and that for two keys, K1!=K2, and for three keys that -// K1!=K2 and K2!=K3. -BOOL -CryptDesValidateKey( - TPM2B_SYM_KEY *desKey // IN: key to validate -); - -//*** CryptGenerateKeyDes() -// This function is used to create a DES key of the appropriate size. The key will -// have odd parity in the bytes. -TPM_RC -CryptGenerateKeyDes( - TPMT_PUBLIC *publicArea, // IN/OUT: The public area template - // for the new key. - TPMT_SENSITIVE *sensitive, // OUT: sensitive area - RAND_STATE *rand // IN: the "entropy" source for -); -#endif - -#endif // _CRYPT_DES_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccKeyExchange_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccKeyExchange_fp.h deleted file mode 100644 index f566dacff..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccKeyExchange_fp.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _CRYPT_ECC_KEY_EXCHANGE_FP_H_ -#define _CRYPT_ECC_KEY_EXCHANGE_FP_H_ - -#if CC_ZGen_2Phase == YES - -//*** CryptEcc2PhaseKeyExchange() -// This function is the dispatch routine for the EC key exchange functions that use -// two ephemeral and two static keys. -// Return Type: TPM_RC -// TPM_RC_SCHEME scheme is not defined -LIB_EXPORT TPM_RC -CryptEcc2PhaseKeyExchange( - TPMS_ECC_POINT *outZ1, // OUT: a computed point - TPMS_ECC_POINT *outZ2, // OUT: and optional second point - TPM_ECC_CURVE curveId, // IN: the curve for the computations - TPM_ALG_ID scheme, // IN: the key exchange scheme - TPM2B_ECC_PARAMETER *dsA, // IN: static private TPM key - TPM2B_ECC_PARAMETER *deA, // IN: ephemeral private TPM key - TPMS_ECC_POINT *QsB, // IN: static public party B key - TPMS_ECC_POINT *QeB // IN: ephemeral public party B key -); -#if ALG_SM2 - -//*** SM2KeyExchange() -// This function performs the key exchange defined in SM2. -// The first step is to compute -// 'tA' = ('dsA' + 'deA' avf(Xe,A)) mod 'n' -// Then, compute the 'Z' value from -// 'outZ' = ('h' 'tA' mod 'n') ('QsA' + [avf('QeB.x')]('QeB')). -// The function will compute the ephemeral public key from the ephemeral -// private key. -// All points are required to be on the curve of 'inQsA'. The function will fail -// catastrophically if this is not the case -// Return Type: TPM_RC -// TPM_RC_NO_RESULT the value for dsA does not give a valid point on the -// curve -LIB_EXPORT TPM_RC -SM2KeyExchange( - TPMS_ECC_POINT *outZ, // OUT: the computed point - TPM_ECC_CURVE curveId, // IN: the curve for the computations - TPM2B_ECC_PARAMETER *dsAIn, // IN: static private TPM key - TPM2B_ECC_PARAMETER *deAIn, // IN: ephemeral private TPM key - TPMS_ECC_POINT *QsBIn, // IN: static public party B key - TPMS_ECC_POINT *QeBIn // IN: ephemeral public party B key -); -#endif -#endif // CC_ZGen_2Phase - -#endif // _CRYPT_ECC_KEY_EXCHANGE_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccMain_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccMain_fp.h deleted file mode 100644 index 96864b4b0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccMain_fp.h +++ /dev/null @@ -1,374 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _CRYPT_ECC_MAIN_FP_H_ -#define _CRYPT_ECC_MAIN_FP_H_ - -#if ALG_ECC - -//** Functions -#if SIMULATION -void -EccSimulationEnd( - void -); -#endif // SIMULATION - -//*** CryptEccInit() -// This function is called at _TPM_Init -BOOL -CryptEccInit( - void -); - -//*** CryptEccStartup() -// This function is called at TPM2_Startup(). -BOOL -CryptEccStartup( - void -); - -//*** ClearPoint2B(generic) -// Initialize the size values of a TPMS_ECC_POINT structure. -void -ClearPoint2B( - TPMS_ECC_POINT *p // IN: the point -); - -//*** CryptEccGetParametersByCurveId() -// This function returns a pointer to the curve data that is associated with -// the indicated curveId. -// If there is no curve with the indicated ID, the function returns NULL. This -// function is in this module so that it can be called by GetCurve data. -// Return Type: const ECC_CURVE_DATA -// NULL curve with the indicated TPM_ECC_CURVE is not implemented -// != NULL pointer to the curve data -LIB_EXPORT const ECC_CURVE * -CryptEccGetParametersByCurveId( - TPM_ECC_CURVE curveId // IN: the curveID -); - -//*** CryptEccGetKeySizeForCurve() -// This function returns the key size in bits of the indicated curve. -LIB_EXPORT UINT16 -CryptEccGetKeySizeForCurve( - TPM_ECC_CURVE curveId // IN: the curve -); - -//*** GetCurveData() -// This function returns the a pointer for the parameter data -// associated with a curve. -const ECC_CURVE_DATA * -GetCurveData( - TPM_ECC_CURVE curveId // IN: the curveID -); - -//***CryptEccGetOID() -const BYTE * -CryptEccGetOID( - TPM_ECC_CURVE curveId -); - -//*** CryptEccGetCurveByIndex() -// This function returns the number of the 'i'-th implemented curve. The normal -// use would be to call this function with 'i' starting at 0. When the 'i' is greater -// than or equal to the number of implemented curves, TPM_ECC_NONE is returned. -LIB_EXPORT TPM_ECC_CURVE -CryptEccGetCurveByIndex( - UINT16 i -); - -//*** CryptEccGetParameter() -// This function returns an ECC curve parameter. The parameter is -// selected by a single character designator from the set of ""PNABXYH"". -// Return Type: BOOL -// TRUE(1) curve exists and parameter returned -// FALSE(0) curve does not exist or parameter selector -LIB_EXPORT BOOL -CryptEccGetParameter( - TPM2B_ECC_PARAMETER *out, // OUT: place to put parameter - char p, // IN: the parameter selector - TPM_ECC_CURVE curveId // IN: the curve id -); - -//*** CryptCapGetECCCurve() -// This function returns the list of implemented ECC curves. -// Return Type: TPMI_YES_NO -// YES if no more ECC curve is available -// NO if there are more ECC curves not reported -TPMI_YES_NO -CryptCapGetECCCurve( - TPM_ECC_CURVE curveID, // IN: the starting ECC curve - UINT32 maxCount, // IN: count of returned curves - TPML_ECC_CURVE *curveList // OUT: ECC curve list -); - -//*** CryptGetCurveSignScheme() -// This function will return a pointer to the scheme of the curve. -const TPMT_ECC_SCHEME * -CryptGetCurveSignScheme( - TPM_ECC_CURVE curveId // IN: The curve selector -); - -//*** CryptGenerateR() -// This function computes the commit random value for a split signing scheme. -// -// If 'c' is NULL, it indicates that 'r' is being generated -// for TPM2_Commit. -// If 'c' is not NULL, the TPM will validate that the 'gr.commitArray' -// bit associated with the input value of 'c' is SET. If not, the TPM -// returns FALSE and no 'r' value is generated. -// Return Type: BOOL -// TRUE(1) r value computed -// FALSE(0) no r value computed -BOOL -CryptGenerateR( - TPM2B_ECC_PARAMETER *r, // OUT: the generated random value - UINT16 *c, // IN/OUT: count value. - TPMI_ECC_CURVE curveID, // IN: the curve for the value - TPM2B_NAME *name // IN: optional name of a key to - // associate with 'r' -); - -//*** CryptCommit() -// This function is called when the count value is committed. The 'gr.commitArray' -// value associated with the current count value is SET and g_commitCounter is -// incremented. The low-order 16 bits of old value of the counter is returned. -UINT16 -CryptCommit( - void -); - -//*** CryptEndCommit() -// This function is called when the signing operation using the committed value -// is completed. It clears the gr.commitArray bit associated with the count -// value so that it can't be used again. -void -CryptEndCommit( - UINT16 c // IN: the counter value of the commitment -); - -//*** CryptEccGetParameters() -// This function returns the ECC parameter details of the given curve. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) unsupported ECC curve ID -BOOL -CryptEccGetParameters( - TPM_ECC_CURVE curveId, // IN: ECC curve ID - TPMS_ALGORITHM_DETAIL_ECC *parameters // OUT: ECC parameters -); - -//*** BnGetCurvePrime() -// This function is used to get just the prime modulus associated with a curve. -const bignum_t * -BnGetCurvePrime( - TPM_ECC_CURVE curveId -); - -//*** BnGetCurveOrder() -// This function is used to get just the curve order -const bignum_t * -BnGetCurveOrder( - TPM_ECC_CURVE curveId -); - -//*** BnIsOnCurve() -// This function checks if a point is on the curve. -BOOL -BnIsOnCurve( - pointConst Q, - const ECC_CURVE_DATA *C -); - -//*** BnIsValidPrivateEcc() -// Checks that 0 < 'x' < 'q' -BOOL -BnIsValidPrivateEcc( - bigConst x, // IN: private key to check - bigCurve E // IN: the curve to check -); - -LIB_EXPORT BOOL -CryptEccIsValidPrivateKey( - TPM2B_ECC_PARAMETER *d, - TPM_ECC_CURVE curveId -); - -//*** BnPointMul() -// This function does a point multiply of the form 'R' = ['d']'S' + ['u']'Q' where the -// parameters are bigNum values. If 'S' is NULL and d is not NULL, then it computes -// 'R' = ['d']'G' + ['u']'Q' or just 'R' = ['d']'G' if 'u' and 'Q' are NULL. -// If 'skipChecks' is TRUE, then the function will not verify that the inputs are -// correct for the domain. This would be the case when the values were created by the -// CryptoEngine code. -// It will return TPM_RC_NO_RESULT if the resulting point is the point at infinity. -// Return Type: TPM_RC -// TPM_RC_NO_RESULT result of multiplication is a point at infinity -// TPM_RC_ECC_POINT 'S' or 'Q' is not on the curve -// TPM_RC_VALUE 'd' or 'u' is not < n -TPM_RC -BnPointMult( - bigPoint R, // OUT: computed point - pointConst S, // IN: optional point to multiply by 'd' - bigConst d, // IN: scalar for [d]S or [d]G - pointConst Q, // IN: optional second point - bigConst u, // IN: optional second scalar - bigCurve E // IN: curve parameters -); - -//***BnEccGetPrivate() -// This function gets random values that are the size of the key plus 64 bits. The -// value is reduced (mod ('q' - 1)) and incremented by 1 ('q' is the order of the -// curve. This produces a value ('d') such that 1 <= 'd' < 'q'. This is the method -// of FIPS 186-4 Section B.4.1 ""Key Pair Generation Using Extra Random Bits"". -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure generating private key -BOOL -BnEccGetPrivate( - bigNum dOut, // OUT: the qualified random value - const ECC_CURVE_DATA *C, // IN: curve for which the private key - // needs to be appropriate - RAND_STATE *rand // IN: state for DRBG -); - -//*** BnEccGenerateKeyPair() -// This function gets a private scalar from the source of random bits and does -// the point multiply to get the public key. -BOOL -BnEccGenerateKeyPair( - bigNum bnD, // OUT: private scalar - bn_point_t *ecQ, // OUT: public point - bigCurve E, // IN: curve for the point - RAND_STATE *rand // IN: DRBG state to use -); - -//***CryptEccNewKeyPair(***) -// This function creates an ephemeral ECC. It is ephemeral in that -// is expected that the private part of the key will be discarded -LIB_EXPORT TPM_RC -CryptEccNewKeyPair( - TPMS_ECC_POINT *Qout, // OUT: the public point - TPM2B_ECC_PARAMETER *dOut, // OUT: the private scalar - TPM_ECC_CURVE curveId // IN: the curve for the key -); - -//*** CryptEccPointMultiply() -// This function computes 'R' := ['dIn']'G' + ['uIn']'QIn'. Where 'dIn' and -// 'uIn' are scalars, 'G' and 'QIn' are points on the specified curve and 'G' is the -// default generator of the curve. -// -// The 'xOut' and 'yOut' parameters are optional and may be set to NULL if not -// used. -// -// It is not necessary to provide 'uIn' if 'QIn' is specified but one of 'uIn' and -// 'dIn' must be provided. If 'dIn' and 'QIn' are specified but 'uIn' is not -// provided, then 'R' = ['dIn']'QIn'. -// -// If the multiply produces the point at infinity, the TPM_RC_NO_RESULT is returned. -// -// The sizes of 'xOut' and yOut' will be set to be the size of the degree of -// the curve -// -// It is a fatal error if 'dIn' and 'uIn' are both unspecified (NULL) or if 'Qin' -// or 'Rout' is unspecified. -// -// Return Type: TPM_RC -// TPM_RC_ECC_POINT the point 'Pin' or 'Qin' is not on the curve -// TPM_RC_NO_RESULT the product point is at infinity -// TPM_RC_CURVE bad curve -// TPM_RC_VALUE 'dIn' or 'uIn' out of range -// -LIB_EXPORT TPM_RC -CryptEccPointMultiply( - TPMS_ECC_POINT *Rout, // OUT: the product point R - TPM_ECC_CURVE curveId, // IN: the curve to use - TPMS_ECC_POINT *Pin, // IN: first point (can be null) - TPM2B_ECC_PARAMETER *dIn, // IN: scalar value for [dIn]Qin - // the Pin - TPMS_ECC_POINT *Qin, // IN: point Q - TPM2B_ECC_PARAMETER *uIn // IN: scalar value for the multiplier - // of Q -); - -//*** CryptEccIsPointOnCurve() -// This function is used to test if a point is on a defined curve. It does this -// by checking that 'y'^2 mod 'p' = 'x'^3 + 'a'*'x' + 'b' mod 'p'. -// -// It is a fatal error if 'Q' is not specified (is NULL). -// Return Type: BOOL -// TRUE(1) point is on curve -// FALSE(0) point is not on curve or curve is not supported -LIB_EXPORT BOOL -CryptEccIsPointOnCurve( - TPM_ECC_CURVE curveId, // IN: the curve selector - TPMS_ECC_POINT *Qin // IN: the point. -); - -//*** CryptEccGenerateKey() -// This function generates an ECC key pair based on the input parameters. -// This routine uses KDFa to produce candidate numbers. The method is according -// to FIPS 186-3, section B.1.2 "Key Pair Generation by Testing Candidates." -// According to the method in FIPS 186-3, the resulting private value 'd' should be -// 1 <= 'd' < 'n' where 'n' is the order of the base point. -// -// It is a fatal error if 'Qout', 'dOut', is not provided (is NULL). -// -// If the curve is not supported -// If 'seed' is not provided, then a random number will be used for the key -// Return Type: TPM_RC -// TPM_RC_CURVE curve is not supported -// TPM_RC_NO_RESULT could not verify key with signature (FIPS only) -LIB_EXPORT TPM_RC -CryptEccGenerateKey( - TPMT_PUBLIC *publicArea, // IN/OUT: The public area template for - // the new key. The public key - // area will be replaced computed - // ECC public key - TPMT_SENSITIVE *sensitive, // OUT: the sensitive area will be - // updated to contain the private - // ECC key and the symmetric - // encryption key - RAND_STATE *rand // IN: if not NULL, the deterministic - // RNG state -); -#endif // ALG_ECC - -#endif // _CRYPT_ECC_MAIN_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccSignature_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccSignature_fp.h deleted file mode 100644 index ede9e4f83..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptEccSignature_fp.h +++ /dev/null @@ -1,139 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _CRYPT_ECC_SIGNATURE_FP_H_ -#define _CRYPT_ECC_SIGNATURE_FP_H_ - -#if ALG_ECC - -//*** BnSignEcdsa() -// This function implements the ECDSA signing algorithm. The method is described -// in the comments below. -TPM_RC -BnSignEcdsa( - bigNum bnR, // OUT: 'r' component of the signature - bigNum bnS, // OUT: 's' component of the signature - bigCurve E, // IN: the curve used in the signature - // process - bigNum bnD, // IN: private signing key - const TPM2B_DIGEST *digest, // IN: the digest to sign - RAND_STATE *rand // IN: used in debug of signing -); - -//*** CryptEccSign() -// This function is the dispatch function for the various ECC-based -// signing schemes. -// There is a bit of ugliness to the parameter passing. In order to test this, -// we sometime would like to use a deterministic RNG so that we can get the same -// signatures during testing. The easiest way to do this for most schemes is to -// pass in a deterministic RNG and let it return canned values during testing. -// There is a competing need for a canned parameter to use in ECDAA. To accommodate -// both needs with minimal fuss, a special type of RAND_STATE is defined to carry -// the address of the commit value. The setup and handling of this is not very -// different for the caller than what was in previous versions of the code. -// Return Type: TPM_RC -// TPM_RC_SCHEME 'scheme' is not supported -LIB_EXPORT TPM_RC -CryptEccSign( - TPMT_SIGNATURE *signature, // OUT: signature - OBJECT *signKey, // IN: ECC key to sign the hash - const TPM2B_DIGEST *digest, // IN: digest to sign - TPMT_ECC_SCHEME *scheme, // IN: signing scheme - RAND_STATE *rand -); -#if ALG_ECDSA - -//*** BnValidateSignatureEcdsa() -// This function validates an ECDSA signature. rIn and sIn should have been checked -// to make sure that they are in the range 0 < 'v' < 'n' -// Return Type: TPM_RC -// TPM_RC_SIGNATURE signature not valid -TPM_RC -BnValidateSignatureEcdsa( - bigNum bnR, // IN: 'r' component of the signature - bigNum bnS, // IN: 's' component of the signature - bigCurve E, // IN: the curve used in the signature - // process - bn_point_t *ecQ, // IN: the public point of the key - const TPM2B_DIGEST *digest // IN: the digest that was signed -); -#endif // ALG_ECDSA - -//*** CryptEccValidateSignature() -// This function validates an EcDsa or EcSchnorr signature. -// The point 'Qin' needs to have been validated to be on the curve of 'curveId'. -// Return Type: TPM_RC -// TPM_RC_SIGNATURE not a valid signature -LIB_EXPORT TPM_RC -CryptEccValidateSignature( - TPMT_SIGNATURE *signature, // IN: signature to be verified - OBJECT *signKey, // IN: ECC key signed the hash - const TPM2B_DIGEST *digest // IN: digest that was signed -); - -//***CryptEccCommitCompute() -// This function performs the point multiply operations required by TPM2_Commit. -// -// If 'B' or 'M' is provided, they must be on the curve defined by 'curveId'. This -// routine does not check that they are on the curve and results are unpredictable -// if they are not. -// -// It is a fatal error if 'r' is NULL. If 'B' is not NULL, then it is a -// fatal error if 'd' is NULL or if 'K' and 'L' are both NULL. -// If 'M' is not NULL, then it is a fatal error if 'E' is NULL. -// -// Return Type: TPM_RC -// TPM_RC_NO_RESULT if 'K', 'L' or 'E' was computed to be the point -// at infinity -// TPM_RC_CANCELED a cancel indication was asserted during this -// function -LIB_EXPORT TPM_RC -CryptEccCommitCompute( - TPMS_ECC_POINT *K, // OUT: [d]B or [r]Q - TPMS_ECC_POINT *L, // OUT: [r]B - TPMS_ECC_POINT *E, // OUT: [r]M - TPM_ECC_CURVE curveId, // IN: the curve for the computations - TPMS_ECC_POINT *M, // IN: M (optional) - TPMS_ECC_POINT *B, // IN: B (optional) - TPM2B_ECC_PARAMETER *d, // IN: d (optional) - TPM2B_ECC_PARAMETER *r // IN: the computed r value (required) -); -#endif // ALG_ECC - -#endif // _CRYPT_ECC_SIGNATURE_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptHash_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptHash_fp.h deleted file mode 100644 index 218d9ca72..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptHash_fp.h +++ /dev/null @@ -1,408 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _CRYPT_HASH_FP_H_ -#define _CRYPT_HASH_FP_H_ - -//*** CryptHashInit() -// This function is called by _TPM_Init do perform the initialization operations for -// the library. -BOOL -CryptHashInit( - void -); - -//*** CryptHashStartup() -// This function is called by TPM2_Startup() in case there is work to do at startup. -// Currently, this is a placeholder. -BOOL -CryptHashStartup( - void -); - -//*** CryptGetHashDef() -// This function accesses the hash descriptor associated with a hash a -// algorithm. The function returns a pointer to a 'null' descriptor if hashAlg is -// TPM_ALG_NULL or not a defined algorithm. -PHASH_DEF -CryptGetHashDef( - TPM_ALG_ID hashAlg -); - -//*** CryptHashIsValidAlg() -// This function tests to see if an algorithm ID is a valid hash algorithm. If -// flag is true, then TPM_ALG_NULL is a valid hash. -// Return Type: BOOL -// TRUE(1) hashAlg is a valid, implemented hash on this TPM -// FALSE(0) hashAlg is not valid for this TPM -BOOL -CryptHashIsValidAlg( - TPM_ALG_ID hashAlg, // IN: the algorithm to check - BOOL flag // IN: TRUE if TPM_ALG_NULL is to be treated - // as a valid hash -); - -//*** CryptHashGetAlgByIndex() -// This function is used to iterate through the hashes. TPM_ALG_NULL -// is returned for all indexes that are not valid hashes. -// If the TPM implements 3 hashes, then an 'index' value of 0 will -// return the first implemented hash and an 'index' of 2 will return the -// last. All other index values will return TPM_ALG_NULL. -// -// Return Type: TPM_ALG_ID -// TPM_ALG_xxx a hash algorithm -// TPM_ALG_NULL this can be used as a stop value -LIB_EXPORT TPM_ALG_ID -CryptHashGetAlgByIndex( - UINT32 index // IN: the index -); - -//*** CryptHashGetDigestSize() -// Returns the size of the digest produced by the hash. If 'hashAlg' is not a hash -// algorithm, the TPM will FAIL. -// Return Type: UINT16 -// 0 TPM_ALG_NULL -// > 0 the digest size -// -LIB_EXPORT UINT16 -CryptHashGetDigestSize( - TPM_ALG_ID hashAlg // IN: hash algorithm to look up -); - -//*** CryptHashGetBlockSize() -// Returns the size of the block used by the hash. If 'hashAlg' is not a hash -// algorithm, the TPM will FAIL. -// Return Type: UINT16 -// 0 TPM_ALG_NULL -// > 0 the digest size -// -LIB_EXPORT UINT16 -CryptHashGetBlockSize( - TPM_ALG_ID hashAlg // IN: hash algorithm to look up -); - -//*** CryptHashGetOid() -// This function returns a pointer to DER=encoded OID for a hash algorithm. All OIDs -// are full OID values including the Tag (0x06) and length byte. -LIB_EXPORT const BYTE * -CryptHashGetOid( - TPM_ALG_ID hashAlg -); - -//*** CryptHashGetContextAlg() -// This function returns the hash algorithm associated with a hash context. -TPM_ALG_ID -CryptHashGetContextAlg( - PHASH_STATE state // IN: the context to check -); - -//*** CryptHashCopyState -// This function is used to clone a HASH_STATE. -LIB_EXPORT void -CryptHashCopyState( - HASH_STATE *out, // OUT: destination of the state - const HASH_STATE *in // IN: source of the state -); - -//*** CryptHashExportState() -// This function is used to export a hash or HMAC hash state. This function -// would be called when preparing to context save a sequence object. -void -CryptHashExportState( - PCHASH_STATE internalFmt, // IN: the hash state formatted for use by - // library - PEXPORT_HASH_STATE externalFmt // OUT: the exported hash state -); - -//*** CryptHashImportState() -// This function is used to import the hash state. This function -// would be called to import a hash state when the context of a sequence object -// was being loaded. -void -CryptHashImportState( - PHASH_STATE internalFmt, // OUT: the hash state formatted for use by - // the library - PCEXPORT_HASH_STATE externalFmt // IN: the exported hash state -); - -//*** CryptHashStart() -// Functions starts a hash stack -// Start a hash stack and returns the digest size. As a side effect, the -// value of 'stateSize' in hashState is updated to indicate the number of bytes -// of state that were saved. This function calls GetHashServer() and that function -// will put the TPM into failure mode if the hash algorithm is not supported. -// -// This function does not use the sequence parameter. If it is necessary to import -// or export context, this will start the sequence in a local state -// and export the state to the input buffer. Will need to add a flag to the state -// structure to indicate that it needs to be imported before it can be used. -// (BLEH). -// Return Type: UINT16 -// 0 hash is TPM_ALG_NULL -// >0 digest size -LIB_EXPORT UINT16 -CryptHashStart( - PHASH_STATE hashState, // OUT: the running hash state - TPM_ALG_ID hashAlg // IN: hash algorithm -); - -//*** CryptDigestUpdate() -// Add data to a hash or HMAC, SMAC stack. -// -void -CryptDigestUpdate( - PHASH_STATE hashState, // IN: the hash context information - UINT32 dataSize, // IN: the size of data to be added - const BYTE *data // IN: data to be hashed -); - -//*** CryptHashEnd() -// Complete a hash or HMAC computation. This function will place the smaller of -// 'digestSize' or the size of the digest in 'dOut'. The number of bytes in the -// placed in the buffer is returned. If there is a failure, the returned value -// is <= 0. -// Return Type: UINT16 -// 0 no data returned -// > 0 the number of bytes in the digest or dOutSize, whichever is smaller -LIB_EXPORT UINT16 -CryptHashEnd( - PHASH_STATE hashState, // IN: the state of hash stack - UINT32 dOutSize, // IN: size of digest buffer - BYTE *dOut // OUT: hash digest -); - -//*** CryptHashBlock() -// Start a hash, hash a single block, update 'digest' and return the size of -// the results. -// -// The 'digestSize' parameter can be smaller than the digest. If so, only the more -// significant bytes are returned. -// Return Type: UINT16 -// >= 0 number of bytes placed in 'dOut' -LIB_EXPORT UINT16 -CryptHashBlock( - TPM_ALG_ID hashAlg, // IN: The hash algorithm - UINT32 dataSize, // IN: size of buffer to hash - const BYTE *data, // IN: the buffer to hash - UINT32 dOutSize, // IN: size of the digest buffer - BYTE *dOut // OUT: digest buffer -); - -//*** CryptDigestUpdate2B() -// This function updates a digest (hash or HMAC) with a TPM2B. -// -// This function can be used for both HMAC and hash functions so the -// 'digestState' is void so that either state type can be passed. -LIB_EXPORT void -CryptDigestUpdate2B( - PHASH_STATE state, // IN: the digest state - const TPM2B *bIn // IN: 2B containing the data -); - -//*** CryptHashEnd2B() -// This function is the same as CryptCompleteHash() but the digest is -// placed in a TPM2B. This is the most common use and this is provided -// for specification clarity. 'digest.size' should be set to indicate the number of -// bytes to place in the buffer -// Return Type: UINT16 -// >=0 the number of bytes placed in 'digest.buffer' -LIB_EXPORT UINT16 -CryptHashEnd2B( - PHASH_STATE state, // IN: the hash state - P2B digest // IN: the size of the buffer Out: requested - // number of bytes -); - -//*** CryptDigestUpdateInt() -// This function is used to include an integer value to a hash stack. The function -// marshals the integer into its canonical form before calling CryptDigestUpdate(). -LIB_EXPORT void -CryptDigestUpdateInt( - void *state, // IN: the state of hash stack - UINT32 intSize, // IN: the size of 'intValue' in bytes - UINT64 intValue // IN: integer value to be hashed -); - -//*** CryptHmacStart() -// This function is used to start an HMAC using a temp -// hash context. The function does the initialization -// of the hash with the HMAC key XOR iPad and updates the -// HMAC key XOR oPad. -// -// The function returns the number of bytes in a digest produced by 'hashAlg'. -// Return Type: UINT16 -// >= 0 number of bytes in digest produced by 'hashAlg' (may be zero) -// -LIB_EXPORT UINT16 -CryptHmacStart( - PHMAC_STATE state, // IN/OUT: the state buffer - TPM_ALG_ID hashAlg, // IN: the algorithm to use - UINT16 keySize, // IN: the size of the HMAC key - const BYTE *key // IN: the HMAC key -); - -//*** CryptHmacEnd() -// This function is called to complete an HMAC. It will finish the current -// digest, and start a new digest. It will then add the oPadKey and the -// completed digest and return the results in dOut. It will not return more -// than dOutSize bytes. -// Return Type: UINT16 -// >= 0 number of bytes in 'dOut' (may be zero) -LIB_EXPORT UINT16 -CryptHmacEnd( - PHMAC_STATE state, // IN: the hash state buffer - UINT32 dOutSize, // IN: size of digest buffer - BYTE *dOut // OUT: hash digest -); - -//*** CryptHmacStart2B() -// This function starts an HMAC and returns the size of the digest -// that will be produced. -// -// This function is provided to support the most common use of starting an HMAC -// with a TPM2B key. -// -// The caller must provide a block of memory in which the hash sequence state -// is kept. The caller should not alter the contents of this buffer until the -// hash sequence is completed or abandoned. -// -// Return Type: UINT16 -// > 0 the digest size of the algorithm -// = 0 the hashAlg was TPM_ALG_NULL -LIB_EXPORT UINT16 -CryptHmacStart2B( - PHMAC_STATE hmacState, // OUT: the state of HMAC stack. It will be used - // in HMAC update and completion - TPMI_ALG_HASH hashAlg, // IN: hash algorithm - P2B key // IN: HMAC key -); - -//*** CryptHmacEnd2B() -// This function is the same as CryptHmacEnd() but the HMAC result -// is returned in a TPM2B which is the most common use. -// Return Type: UINT16 -// >=0 the number of bytes placed in 'digest' -LIB_EXPORT UINT16 -CryptHmacEnd2B( - PHMAC_STATE hmacState, // IN: the state of HMAC stack - P2B digest // OUT: HMAC -); - -//** Mask and Key Generation Functions -//*** CryptMGF1() -// This function performs MGF1 using the selected hash. MGF1 is -// T(n) = T(n-1) || H(seed || counter). -// This function returns the length of the mask produced which -// could be zero if the digest algorithm is not supported -// Return Type: UINT16 -// 0 hash algorithm was TPM_ALG_NULL -// > 0 should be the same as 'mSize' -LIB_EXPORT UINT16 -CryptMGF1( - UINT32 mSize, // IN: length of the mask to be produced - BYTE *mask, // OUT: buffer to receive the mask - TPM_ALG_ID hashAlg, // IN: hash to use - UINT32 seedSize, // IN: size of the seed - BYTE *seed // IN: seed size -); - -//*** CryptKDFa() -// This function performs the key generation according to Part 1 of the -// TPM specification. -// -// This function returns the number of bytes generated which may be zero. -// -// The 'key' and 'keyStream' pointers are not allowed to be NULL. The other -// pointer values may be NULL. The value of 'sizeInBits' must be no larger -// than (2^18)-1 = 256K bits (32385 bytes). -// -// The 'once' parameter is set to allow incremental generation of a large -// value. If this flag is TRUE, 'sizeInBits' will be used in the HMAC computation -// but only one iteration of the KDF is performed. This would be used for -// XOR obfuscation so that the mask value can be generated in digest-sized -// chunks rather than having to be generated all at once in an arbitrarily -// large buffer and then XORed into the result. If 'once' is TRUE, then -// 'sizeInBits' must be a multiple of 8. -// -// Any error in the processing of this command is considered fatal. -// Return Type: UINT16 -// 0 hash algorithm is not supported or is TPM_ALG_NULL -// > 0 the number of bytes in the 'keyStream' buffer -LIB_EXPORT UINT16 -CryptKDFa( - TPM_ALG_ID hashAlg, // IN: hash algorithm used in HMAC - const TPM2B *key, // IN: HMAC key - const TPM2B *label, // IN: a label for the KDF - const TPM2B *contextU, // IN: context U - const TPM2B *contextV, // IN: context V - UINT32 sizeInBits, // IN: size of generated key in bits - BYTE *keyStream, // OUT: key buffer - UINT32 *counterInOut, // IN/OUT: caller may provide the iteration - // counter for incremental operations to - // avoid large intermediate buffers. - UINT16 blocks // IN: If non-zero, this is the maximum number - // of blocks to be returned, regardless - // of sizeInBits -); - -//*** CryptKDFe() -// This function implements KDFe() as defined in TPM specification part 1. -// -// This function returns the number of bytes generated which may be zero. -// -// The 'Z' and 'keyStream' pointers are not allowed to be NULL. The other -// pointer values may be NULL. The value of 'sizeInBits' must be no larger -// than (2^18)-1 = 256K bits (32385 bytes). -// Any error in the processing of this command is considered fatal. -// Return Type: UINT16 -// 0 hash algorithm is not supported or is TPM_ALG_NULL -// > 0 the number of bytes in the 'keyStream' buffer -// -LIB_EXPORT UINT16 -CryptKDFe( - TPM_ALG_ID hashAlg, // IN: hash algorithm used in HMAC - TPM2B *Z, // IN: Z - const TPM2B *label, // IN: a label value for the KDF - TPM2B *partyUInfo, // IN: PartyUInfo - TPM2B *partyVInfo, // IN: PartyVInfo - UINT32 sizeInBits, // IN: size of generated key in bits - BYTE *keyStream // OUT: key buffer -); - -#endif // _CRYPT_HASH_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptPrimeSieve_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptPrimeSieve_fp.h deleted file mode 100644 index 55a0712d7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptPrimeSieve_fp.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:06:42PM - */ - -#ifndef _CRYPT_PRIME_SIEVE_FP_H_ -#define _CRYPT_PRIME_SIEVE_FP_H_ - -#if RSA_KEY_SIEVE - -//*** RsaAdjustPrimeLimit() -// This used during the sieve process. The iterator for getting the -// next prime (RsaNextPrime()) will return primes until it hits the -// limit (primeLimit) set up by this function. This causes the sieve -// process to stop when an appropriate number of primes have been -// sieved. -LIB_EXPORT void -RsaAdjustPrimeLimit( - uint32_t requestedPrimes -); - -//*** RsaNextPrime() -// This the iterator used during the sieve process. The input is the -// last prime returned (or any starting point) and the output is the -// next higher prime. The function returns 0 when the primeLimit is -// reached. -LIB_EXPORT uint32_t -RsaNextPrime( - uint32_t lastPrime -); - -//*** FindNthSetBit() -// This function finds the nth SET bit in a bit array. The 'n' parameter is -// between 1 and the number of bits in the array (always a multiple of 8). -// If called when the array does not have n bits set, it will return -1 -// Return Type: unsigned int -// <0 no bit is set or no bit with the requested number is set -// >=0 the number of the bit in the array that is the nth set -LIB_EXPORT int -FindNthSetBit( - const UINT16 aSize, // IN: the size of the array to check - const BYTE *a, // IN: the array to check - const UINT32 n // IN, the number of the SET bit -); - -//*** PrimeSieve() -// This function does a prime sieve over the input 'field' which has as its -// starting address the value in bnN. Since this initializes the Sieve -// using a precomputed field with the bits associated with 3, 5 and 7 already -// turned off, the value of pnN may need to be adjusted by a few counts to allow -// the precomputed field to be used without modification. -// -// To get better performance, one could address the issue of developing the -// composite numbers. When the size of the prime gets large, the time for doing -// the divisions goes up, noticeably. It could be better to develop larger composite -// numbers even if they need to be bigNum's themselves. The object would be to -// reduce the number of times that the large prime is divided into a few large -// divides and then use smaller divides to get to the final 16 bit (or smaller) -// remainders. -LIB_EXPORT UINT32 -PrimeSieve( - bigNum bnN, // IN/OUT: number to sieve - UINT32 fieldSize, // IN: size of the field area in bytes - BYTE *field // IN: field -); -#ifdef SIEVE_DEBUG - -//***SetFieldSize() -// Function to set the field size used for prime generation. Used for tuning. -LIB_EXPORT uint32_t -SetFieldSize( - uint32_t newFieldSize -); -#endif // SIEVE_DEBUG - -//*** PrimeSelectWithSieve() -// This function will sieve the field around the input prime candidate. If the -// sieve field is not empty, one of the one bits in the field is chosen for testing -// with Miller-Rabin. If the value is prime, 'pnP' is updated with this value -// and the function returns success. If this value is not prime, another -// pseudo-random candidate is chosen and tested. This process repeats until -// all values in the field have been checked. If all bits in the field have -// been checked and none is prime, the function returns FALSE and a new random -// value needs to be chosen. -// Return Type: TPM_RC -// TPM_RC_FAILURE TPM in failure mode, probably due to entropy source -// TPM_RC_SUCCESS candidate is probably prime -// TPM_RC_NO_RESULT candidate is not prime and couldn't find and alternative -// in the field -LIB_EXPORT TPM_RC -PrimeSelectWithSieve( - bigNum candidate, // IN/OUT: The candidate to filter - UINT32 e, // IN: the exponent - RAND_STATE *rand // IN: the random number generator state -); -#if RSA_INSTRUMENT - -char * -PrintTuple( - UINT32 *i -); - -void -RsaSimulationEnd( - void -); - -LIB_EXPORT void -GetSieveStats( - uint32_t *trials, - uint32_t *emptyFields, - uint32_t *averageBits -); - -#endif -#endif // RSA_KEY_SIEVE -#if !RSA_INSTRUMENT -void -RsaSimulationEnd( - void -); -#endif - -#endif // _CRYPT_PRIME_SIEVE_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptPrime_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptPrime_fp.h deleted file mode 100644 index 019bdbc17..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptPrime_fp.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _CRYPT_PRIME_FP_H_ -#define _CRYPT_PRIME_FP_H_ - -//*** IsPrimeInt() -// This will do a test of a word of up to 32-bits in size. -BOOL -IsPrimeInt( - uint32_t n -); - -//*** BnIsProbablyPrime() -// This function is used when the key sieve is not implemented. This function -// Will try to eliminate some of the obvious things before going on -// to perform MillerRabin as a final verification of primeness. -BOOL -BnIsProbablyPrime( - bigNum prime, // IN: - RAND_STATE *rand // IN: the random state just - // in case Miller-Rabin is required -); - -//*** MillerRabinRounds() -// Function returns the number of Miller-Rabin rounds necessary to give an -// error probability equal to the security strength of the prime. These values -// are from FIPS 186-3. -UINT32 -MillerRabinRounds( - UINT32 bits // IN: Number of bits in the RSA prime -); - -//*** MillerRabin() -// This function performs a Miller-Rabin test from FIPS 186-3. It does -// 'iterations' trials on the number. In all likelihood, if the number -// is not prime, the first test fails. -// Return Type: BOOL -// TRUE(1) probably prime -// FALSE(0) composite -BOOL -MillerRabin( - bigNum bnW, - RAND_STATE *rand -); -#if ALG_RSA - -//*** RsaCheckPrime() -// This will check to see if a number is prime and appropriate for an -// RSA prime. -// -// This has different functionality based on whether we are using key -// sieving or not. If not, the number checked to see if it is divisible by -// the public exponent, then the number is adjusted either up or down -// in order to make it a better candidate. It is then checked for being -// probably prime. -// -// If sieving is used, the number is used to root a sieving process. -// -TPM_RC -RsaCheckPrime( - bigNum prime, - UINT32 exponent, - RAND_STATE *rand -); - -//*** AdjustPrimeCandiate() -// This function adjusts the candidate prime so that it is odd and > root(2)/2. -// This allows the product of these two numbers to be .5, which, in fixed point -// notation means that the most significant bit is 1. -// For this routine, the root(2)/2 (0.7071067811865475) approximated with 0xB505 -// which is, in fixed point, 0.7071075439453125 or an error of 0.000108%. Just setting -// the upper two bits would give a value > 0.75 which is an error of > 6%. Given the -// amount of time all the other computations take, reducing the error is not much of -// a cost, but it isn't totally required either. -// -// The code maps the most significant crypt_uword_t in 'prime' so that a 32-/64-bit -// value of 0 to 0xB5050...0 and a value of 0xff...f to 0xff...f. It also sets the LSb -// of 'prime' to make sure that the number is odd. -// -// This code has been fixed so that it will work with a RADIX_SIZE == 64. -// -// The function also puts the number on a field boundary. -LIB_EXPORT void -RsaAdjustPrimeCandidate( - bigNum prime -); - -//***BnGeneratePrimeForRSA() -// Function to generate a prime of the desired size with the proper attributes -// for an RSA prime. -TPM_RC -BnGeneratePrimeForRSA( - bigNum prime, - UINT32 bits, - UINT32 exponent, - RAND_STATE *rand -); -#endif // ALG_RSA - -#endif // _CRYPT_PRIME_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptRand_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptRand_fp.h deleted file mode 100644 index 34e9cc6ec..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptRand_fp.h +++ /dev/null @@ -1,204 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _CRYPT_RAND_FP_H_ -#define _CRYPT_RAND_FP_H_ - -//*** DRBG_GetEntropy() -// Even though this implementation never fails, it may get blocked -// indefinitely long in the call to get entropy from the platform -// (DRBG_GetEntropy32()). -// This function is only used during instantiation of the DRBG for -// manufacturing and on each start-up after an non-orderly shutdown. -// Return Type: BOOL -// TRUE(1) requested entropy returned -// FALSE(0) entropy Failure -BOOL -DRBG_GetEntropy( - UINT32 requiredEntropy, // IN: requested number of bytes of full - // entropy - BYTE *entropy // OUT: buffer to return collected entropy -); - -//*** IncrementIv() -// This function increments the IV value by 1. It is used by EncryptDRBG(). -void -IncrementIv( - DRBG_IV *iv -); - -//*** DRBG_Reseed() -// This function is used when reseeding of the DRBG is required. If -// entropy is provided, it is used in lieu of using hardware entropy. -// Note: the provided entropy must be the required size. -// Return Type: BOOL -// TRUE(1) reseed succeeded -// FALSE(0) reseed failed, probably due to the entropy generation -BOOL -DRBG_Reseed( - DRBG_STATE *drbgState, // IN: the state to update - DRBG_SEED *providedEntropy, // IN: entropy - DRBG_SEED *additionalData // IN: -); - -//*** DRBG_SelfTest() -// This is run when the DRBG is instantiated and at startup -// Return Type: BOOL -// TRUE(1) test OK -// FALSE(0) test failed -BOOL -DRBG_SelfTest( - void -); - -//*** CryptRandomStir() -// This function is used to cause a reseed. A DRBG_SEED amount of entropy is -// collected from the hardware and then additional data is added. -// Return Type: TPM_RC -// TPM_RC_NO_RESULT failure of the entropy generator -LIB_EXPORT TPM_RC -CryptRandomStir( - UINT16 additionalDataSize, - BYTE *additionalData -); - -//*** CryptRandomGenerate() -// Generate a 'randomSize' number or random bytes. -LIB_EXPORT UINT16 -CryptRandomGenerate( - UINT16 randomSize, - BYTE *buffer -); - -//**** DRBG_InstantiateSeededKdf() -// This function is used to instantiate a KDF-based RNG. This is used for derivations. -// This function always returns TRUE. -LIB_EXPORT BOOL -DRBG_InstantiateSeededKdf( - KDF_STATE *state, // OUT: buffer to hold the state - TPM_ALG_ID hashAlg, // IN: hash algorithm - TPM_ALG_ID kdf, // IN: the KDF to use - TPM2B *seed, // IN: the seed to use - const TPM2B *label, // IN: a label for the generation process. - TPM2B *context, // IN: the context value - UINT32 limit // IN: Maximum number of bits from the KDF -); - -//**** DRBG_AdditionalData() -// Function to reseed the DRBG with additional entropy. This is normally called -// before computing the protection value of a primary key in the Endorsement -// hierarchy. -LIB_EXPORT void -DRBG_AdditionalData( - DRBG_STATE *drbgState, // IN:OUT state to update - TPM2B *additionalData // IN: value to incorporate -); - -//**** DRBG_InstantiateSeeded() -// This function is used to instantiate a random number generator from seed values. -// The nominal use of this generator is to create sequences of pseudo-random -// numbers from a seed value. This function always returns TRUE. -LIB_EXPORT TPM_RC -DRBG_InstantiateSeeded( - DRBG_STATE *drbgState, // IN/OUT: buffer to hold the state - const TPM2B *seed, // IN: the seed to use - const TPM2B *purpose, // IN: a label for the generation process. - const TPM2B *name, // IN: name of the object - const TPM2B *additional // IN: additional data -); - -//**** CryptRandStartup() -// This function is called when TPM_Startup is executed. This function always returns -// TRUE. -LIB_EXPORT BOOL -CryptRandStartup( - void -); - -//**** CryptRandInit() -// This function is called when _TPM_Init is being processed. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -LIB_EXPORT BOOL -CryptRandInit( - void -); - -//*** DRBG_Generate() -// This function generates a random sequence according SP800-90A. -// If 'random' is not NULL, then 'randomSize' bytes of random values are generated. -// If 'random' is NULL or 'randomSize' is zero, then the function returns -// TRUE without generating any bits or updating the reseed counter. -// This function returns 0 if a reseed is required. Otherwise, it returns the -// number of bytes produced which could be less than the number requested if the -// request is too large. -LIB_EXPORT UINT16 -DRBG_Generate( - RAND_STATE *state, - BYTE *random, // OUT: buffer to receive the random values - UINT16 randomSize // IN: the number of bytes to generate -); - -//*** DRBG_Instantiate() -// This is CTR_DRBG_Instantiate_algorithm() from [SP 800-90A 10.2.1.3.1]. -// This is called when a the TPM DRBG is to be instantiated. This is -// called to instantiate a DRBG used by the TPM for normal -// operations. -// Return Type: BOOL -// TRUE(1) instantiation succeeded -// FALSE(0) instantiation failed -LIB_EXPORT BOOL -DRBG_Instantiate( - DRBG_STATE *drbgState, // OUT: the instantiated value - UINT16 pSize, // IN: Size of personalization string - BYTE *personalization // IN: The personalization string -); - -//*** DRBG_Uninstantiate() -// This is Uninstantiate_function() from [SP 800-90A 9.4]. -// -// Return Type: TPM_RC -// TPM_RC_VALUE not a valid state -LIB_EXPORT TPM_RC -DRBG_Uninstantiate( - DRBG_STATE *drbgState // IN/OUT: working state to erase -); - -#endif // _CRYPT_RAND_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptRsa_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptRsa_fp.h deleted file mode 100644 index 8af477f6c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptRsa_fp.h +++ /dev/null @@ -1,210 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _CRYPT_RSA_FP_H_ -#define _CRYPT_RSA_FP_H_ - -#if ALG_RSA - -//*** CryptRsaInit() -// Function called at _TPM_Init(). -BOOL -CryptRsaInit( - void -); - -//*** CryptRsaStartup() -// Function called at TPM2_Startup() -BOOL -CryptRsaStartup( - void -); - -//*** CryptRsaPssSaltSize() -// This function computes the salt size used in PSS. It is broken out so that -// the X509 code can get the same value that is used by the encoding function in this -// module. -INT16 -CryptRsaPssSaltSize( - INT16 hashSize, - INT16 outSize -); - -//*** MakeDerTag() -// Construct the DER value that is used in RSASSA -// Return Type: INT16 -// > 0 size of value -// <= 0 no hash exists -INT16 -MakeDerTag( - TPM_ALG_ID hashAlg, - INT16 sizeOfBuffer, - BYTE *buffer -); - -//*** CryptRsaSelectScheme() -// This function is used by TPM2_RSA_Decrypt and TPM2_RSA_Encrypt. It sets up -// the rules to select a scheme between input and object default. -// This function assume the RSA object is loaded. -// If a default scheme is defined in object, the default scheme should be chosen, -// otherwise, the input scheme should be chosen. -// In the case that both the object and 'scheme' are not TPM_ALG_NULL, then -// if the schemes are the same, the input scheme will be chosen. -// if the scheme are not compatible, a NULL pointer will be returned. -// -// The return pointer may point to a TPM_ALG_NULL scheme. -TPMT_RSA_DECRYPT* -CryptRsaSelectScheme( - TPMI_DH_OBJECT rsaHandle, // IN: handle of an RSA key - TPMT_RSA_DECRYPT *scheme // IN: a sign or decrypt scheme -); - -//*** CryptRsaLoadPrivateExponent() -// This function is called to generate the private exponent of an RSA key. -// Return Type: TPM_RC -// TPM_RC_BINDING public and private parts of 'rsaKey' are not matched -TPM_RC -CryptRsaLoadPrivateExponent( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive -); - -//*** CryptRsaEncrypt() -// This is the entry point for encryption using RSA. Encryption is -// use of the public exponent. The padding parameter determines what -// padding will be used. -// -// The 'cOutSize' parameter must be at least as large as the size of the key. -// -// If the padding is RSA_PAD_NONE, 'dIn' is treated as a number. It must be -// lower in value than the key modulus. -// NOTE: If dIn has fewer bytes than cOut, then we don't add low-order zeros to -// dIn to make it the size of the RSA key for the call to RSAEP. This is -// because the high order bytes of dIn might have a numeric value that is -// greater than the value of the key modulus. If this had low-order zeros -// added, it would have a numeric value larger than the modulus even though -// it started out with a lower numeric value. -// -// Return Type: TPM_RC -// TPM_RC_VALUE 'cOutSize' is too small (must be the size -// of the modulus) -// TPM_RC_SCHEME 'padType' is not a supported scheme -// -LIB_EXPORT TPM_RC -CryptRsaEncrypt( - TPM2B_PUBLIC_KEY_RSA *cOut, // OUT: the encrypted data - TPM2B *dIn, // IN: the data to encrypt - OBJECT *key, // IN: the key used for encryption - TPMT_RSA_DECRYPT *scheme, // IN: the type of padding and hash - // if needed - const TPM2B *label, // IN: in case it is needed - RAND_STATE *rand // IN: random number generator - // state (mostly for testing) -); - -//*** CryptRsaDecrypt() -// This is the entry point for decryption using RSA. Decryption is -// use of the private exponent. The 'padType' parameter determines what -// padding was used. -// -// Return Type: TPM_RC -// TPM_RC_SIZE 'cInSize' is not the same as the size of the public -// modulus of 'key'; or numeric value of the encrypted -// data is greater than the modulus -// TPM_RC_VALUE 'dOutSize' is not large enough for the result -// TPM_RC_SCHEME 'padType' is not supported -// -LIB_EXPORT TPM_RC -CryptRsaDecrypt( - TPM2B *dOut, // OUT: the decrypted data - TPM2B *cIn, // IN: the data to decrypt - OBJECT *key, // IN: the key to use for decryption - TPMT_RSA_DECRYPT *scheme, // IN: the padding scheme - const TPM2B *label // IN: in case it is needed for the scheme -); - -//*** CryptRsaSign() -// This function is used to generate an RSA signature of the type indicated in -// 'scheme'. -// -// Return Type: TPM_RC -// TPM_RC_SCHEME 'scheme' or 'hashAlg' are not supported -// TPM_RC_VALUE 'hInSize' does not match 'hashAlg' (for RSASSA) -// -LIB_EXPORT TPM_RC -CryptRsaSign( - TPMT_SIGNATURE *sigOut, - OBJECT *key, // IN: key to use - TPM2B_DIGEST *hIn, // IN: the digest to sign - RAND_STATE *rand // IN: the random number generator - // to use (mostly for testing) -); - -//*** CryptRsaValidateSignature() -// This function is used to validate an RSA signature. If the signature is valid -// TPM_RC_SUCCESS is returned. If the signature is not valid, TPM_RC_SIGNATURE is -// returned. Other return codes indicate either parameter problems or fatal errors. -// -// Return Type: TPM_RC -// TPM_RC_SIGNATURE the signature does not check -// TPM_RC_SCHEME unsupported scheme or hash algorithm -// -LIB_EXPORT TPM_RC -CryptRsaValidateSignature( - TPMT_SIGNATURE *sig, // IN: signature - OBJECT *key, // IN: public modulus - TPM2B_DIGEST *digest // IN: The digest being validated -); - -//*** CryptRsaGenerateKey() -// Generate an RSA key from a provided seed -// Return Type: TPM_RC -// TPM_RC_CANCELED operation was canceled -// TPM_RC_RANGE public exponent is not supported -// TPM_RC_VALUE could not find a prime using the provided parameters -LIB_EXPORT TPM_RC -CryptRsaGenerateKey( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive, - RAND_STATE *rand // IN: if not NULL, the deterministic - // RNG state -); -#endif // ALG_RSA - -#endif // _CRYPT_RSA_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSelfTest_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSelfTest_fp.h deleted file mode 100644 index 49c537537..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSelfTest_fp.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _CRYPT_SELF_TEST_FP_H_ -#define _CRYPT_SELF_TEST_FP_H_ - -//*** CryptSelfTest() -// This function is called to start/complete a full self-test. -// If 'fullTest' is NO, then only the untested algorithms will be run. If -// 'fullTest' is YES, then 'g_untestedDecryptionAlgorithms' is reinitialized and then -// all tests are run. -// This implementation of the reference design does not support processing outside -// the framework of a TPM command. As a consequence, this command does not -// complete until all tests are done. Since this can take a long time, the TPM -// will check after each test to see if the command is canceled. If so, then the -// TPM will returned TPM_RC_CANCELLED. To continue with the self-tests, call -// TPM2_SelfTest(fullTest == No) and the TPM will complete the testing. -// Return Type: TPM_RC -// TPM_RC_CANCELED if the command is canceled -LIB_EXPORT -TPM_RC -CryptSelfTest( - TPMI_YES_NO fullTest // IN: if full test is required -); - -//*** CryptIncrementalSelfTest() -// This function is used to perform an incremental self-test. This implementation -// will perform the toTest values before returning. That is, it assumes that the -// TPM cannot perform background tasks between commands. -// -// This command may be canceled. If it is, then there is no return result. -// However, this command can be run again and the incremental progress will not -// be lost. -// Return Type: TPM_RC -// TPM_RC_CANCELED processing of this command was canceled -// TPM_RC_TESTING if toTest list is not empty -// TPM_RC_VALUE an algorithm in the toTest list is not implemented -TPM_RC -CryptIncrementalSelfTest( - TPML_ALG *toTest, // IN: list of algorithms to be tested - TPML_ALG *toDoList // OUT: list of algorithms needing test -); - -//*** CryptInitializeToTest() -// This function will initialize the data structures for testing all the -// algorithms. This should not be called unless CryptAlgsSetImplemented() has -// been called -void -CryptInitializeToTest( - void -); - -//*** CryptTestAlgorithm() -// Only point of contact with the actual self tests. If a self-test fails, there -// is no return and the TPM goes into failure mode. -// The call to TestAlgorithm uses an algorithm selector and a bit vector. When the -// test is run, the corresponding bit in 'toTest' and in 'g_toTest' is CLEAR. If -// 'toTest' is NULL, then only the bit in 'g_toTest' is CLEAR. -// There is a special case for the call to TestAlgorithm(). When 'alg' is -// ALG_ERROR, TestAlgorithm() will CLEAR any bit in 'toTest' for which it has -// no test. This allows the knowledge about which algorithms have test to be -// accessed through the interface that provides the test. -// Return Type: TPM_RC -// TPM_RC_CANCELED test was canceled -LIB_EXPORT -TPM_RC -CryptTestAlgorithm( - TPM_ALG_ID alg, - ALGORITHM_VECTOR *toTest -); - -#endif // _CRYPT_SELF_TEST_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSmac_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSmac_fp.h deleted file mode 100644 index 1c1f6aff5..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSmac_fp.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _CRYPT_SMAC_FP_H_ -#define _CRYPT_SMAC_FP_H_ - -#if SMAC_IMPLEMENTED - -//*** CryptSmacStart() -// Function to start an SMAC. -UINT16 -CryptSmacStart( - HASH_STATE *state, - TPMU_PUBLIC_PARMS *keyParameters, - TPM_ALG_ID macAlg, // IN: the type of MAC - TPM2B *key -); - -//*** CryptMacStart() -// Function to start either an HMAC or an SMAC. Cannot reuse the CryptHmacStart -// function because of the difference in number of parameters. -UINT16 -CryptMacStart( - HMAC_STATE *state, - TPMU_PUBLIC_PARMS *keyParameters, - TPM_ALG_ID macAlg, // IN: the type of MAC - TPM2B *key -); - -//*** CryptMacEnd() -// Dispatch to the MAC end function using a size and buffer pointer. -UINT16 -CryptMacEnd( - HMAC_STATE *state, - UINT32 size, - BYTE *buffer -); - -//*** CryptMacEnd2B() -// Dispatch to the MAC end function using a 2B. -UINT16 -CryptMacEnd2B ( - HMAC_STATE *state, - TPM2B *data -); -#endif // SMAC_IMPLEMENTED - -#endif // _CRYPT_SMAC_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSym_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSym_fp.h deleted file mode 100644 index d02634e65..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptSym_fp.h +++ /dev/null @@ -1,126 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _CRYPT_SYM_FP_H_ -#define _CRYPT_SYM_FP_H_ - -//** Initialization and Data Access Functions -// -//*** CryptSymInit() -// This function is called to do _TPM_Init processing -BOOL -CryptSymInit( - void -); - -//*** CryptSymStartup() -// This function is called to do TPM2_Startup() processing -BOOL -CryptSymStartup( - void -); - -//*** CryptGetSymmetricBlockSize() -// This function returns the block size of the algorithm. The table of bit sizes has -// an entry for each allowed key size. The entry for a key size is 0 if the TPM does -// not implement that key size. The key size table is delimited with a negative number -// (-1). After the delimiter is a list of block sizes with each entry corresponding -// to the key bit size. For most symmetric algorithms, the block size is the same -// regardless of the key size but this arrangement allows them to be different. -// Return Type: INT16 -// <= 0 cipher not supported -// > 0 the cipher block size in bytes -LIB_EXPORT INT16 -CryptGetSymmetricBlockSize( - TPM_ALG_ID symmetricAlg, // IN: the symmetric algorithm - UINT16 keySizeInBits // IN: the key size -); - -//** Symmetric Encryption -// This function performs symmetric encryption based on the mode. -// Return Type: TPM_RC -// TPM_RC_SIZE 'dSize' is not a multiple of the block size for an -// algorithm that requires it -// TPM_RC_FAILURE Fatal error -LIB_EXPORT TPM_RC -CryptSymmetricEncrypt( - BYTE *dOut, // OUT: - TPM_ALG_ID algorithm, // IN: the symmetric algorithm - UINT16 keySizeInBits, // IN: key size in bits - const BYTE *key, // IN: key buffer. The size of this buffer - // in bytes is (keySizeInBits + 7) / 8 - TPM2B_IV *ivInOut, // IN/OUT: IV for decryption. - TPM_ALG_ID mode, // IN: Mode to use - INT32 dSize, // IN: data size (may need to be a - // multiple of the blockSize) - const BYTE *dIn // IN: data buffer -); - -//*** CryptSymmetricDecrypt() -// This function performs symmetric decryption based on the mode. -// Return Type: TPM_RC -// TPM_RC_FAILURE A fatal error -// TPM_RCS_SIZE 'dSize' is not a multiple of the block size for an -// algorithm that requires it -LIB_EXPORT TPM_RC -CryptSymmetricDecrypt( - BYTE *dOut, // OUT: decrypted data - TPM_ALG_ID algorithm, // IN: the symmetric algorithm - UINT16 keySizeInBits, // IN: key size in bits - const BYTE *key, // IN: key buffer. The size of this buffer - // in bytes is (keySizeInBits + 7) / 8 - TPM2B_IV *ivInOut, // IN/OUT: IV for decryption. - TPM_ALG_ID mode, // IN: Mode to use - INT32 dSize, // IN: data size (may need to be a - // multiple of the blockSize) - const BYTE *dIn // IN: data buffer -); - -//*** CryptSymKeyValidate() -// Validate that a provided symmetric key meets the requirements of the TPM -// Return Type: TPM_RC -// TPM_RC_KEY_SIZE Key size specifiers do not match -// TPM_RC_KEY Key is not allowed -TPM_RC -CryptSymKeyValidate( - TPMT_SYM_DEF_OBJECT *symDef, - TPM2B_SYM_KEY *key -); - -#endif // _CRYPT_SYM_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptUtil_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptUtil_fp.h deleted file mode 100644 index c7367a26d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/CryptUtil_fp.h +++ /dev/null @@ -1,488 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _CRYPT_UTIL_FP_H_ -#define _CRYPT_UTIL_FP_H_ - -//*** CryptIsSchemeAnonymous() -// This function is used to test a scheme to see if it is an anonymous scheme -// The only anonymous scheme is ECDAA. ECDAA can be used to do things -// like U-Prove. -BOOL -CryptIsSchemeAnonymous( - TPM_ALG_ID scheme // IN: the scheme algorithm to test -); - -//*** ParmDecryptSym() -// This function performs parameter decryption using symmetric block cipher. -void -ParmDecryptSym( - TPM_ALG_ID symAlg, // IN: the symmetric algorithm - TPM_ALG_ID hash, // IN: hash algorithm for KDFa - UINT16 keySizeInBits, // IN: the key size in bits - TPM2B *key, // IN: KDF HMAC key - TPM2B *nonceCaller, // IN: nonce caller - TPM2B *nonceTpm, // IN: nonce TPM - UINT32 dataSize, // IN: size of parameter buffer - BYTE *data // OUT: buffer to be decrypted -); - -//*** ParmEncryptSym() -// This function performs parameter encryption using symmetric block cipher. -void -ParmEncryptSym( - TPM_ALG_ID symAlg, // IN: symmetric algorithm - TPM_ALG_ID hash, // IN: hash algorithm for KDFa - UINT16 keySizeInBits, // IN: symmetric key size in bits - TPM2B *key, // IN: KDF HMAC key - TPM2B *nonceCaller, // IN: nonce caller - TPM2B *nonceTpm, // IN: nonce TPM - UINT32 dataSize, // IN: size of parameter buffer - BYTE *data // OUT: buffer to be encrypted -); - -//*** CryptXORObfuscation() -// This function implements XOR obfuscation. It should not be called if the -// hash algorithm is not implemented. The only return value from this function -// is TPM_RC_SUCCESS. -void -CryptXORObfuscation( - TPM_ALG_ID hash, // IN: hash algorithm for KDF - TPM2B *key, // IN: KDF key - TPM2B *contextU, // IN: contextU - TPM2B *contextV, // IN: contextV - UINT32 dataSize, // IN: size of data buffer - BYTE *data // IN/OUT: data to be XORed in place -); - -//*** CryptInit() -// This function is called when the TPM receives a _TPM_Init indication. -// -// NOTE: The hash algorithms do not have to be tested, they just need to be -// available. They have to be tested before the TPM can accept HMAC authorization -// or return any result that relies on a hash algorithm. -// Return Type: BOOL -// TRUE(1) initializations succeeded -// FALSE(0) initialization failed and caller should place the TPM into -// Failure Mode -BOOL -CryptInit( - void -); - -//*** CryptStartup() -// This function is called by TPM2_Startup() to initialize the functions in -// this cryptographic library and in the provided CryptoLibrary. This function -// and CryptUtilInit() are both provided so that the implementation may move the -// initialization around to get the best interaction. -// Return Type: BOOL -// TRUE(1) startup succeeded -// FALSE(0) startup failed and caller should place the TPM into -// Failure Mode -BOOL -CryptStartup( - STARTUP_TYPE type // IN: the startup type -); - -//**************************************************************************** -//** Algorithm-Independent Functions -//**************************************************************************** -//*** Introduction -// These functions are used generically when a function of a general type -// (e.g., symmetric encryption) is required. The functions will modify the -// parameters as required to interface to the indicated algorithms. -// -//*** CryptIsAsymAlgorithm() -// This function indicates if an algorithm is an asymmetric algorithm. -// Return Type: BOOL -// TRUE(1) if it is an asymmetric algorithm -// FALSE(0) if it is not an asymmetric algorithm -BOOL -CryptIsAsymAlgorithm( - TPM_ALG_ID algID // IN: algorithm ID -); - -//*** CryptSecretEncrypt() -// This function creates a secret value and its associated secret structure using -// an asymmetric algorithm. -// -// This function is used by TPM2_Rewrap() TPM2_MakeCredential(), -// and TPM2_Duplicate(). -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'keyHandle' does not reference a valid decryption key -// TPM_RC_KEY invalid ECC key (public point is not on the curve) -// TPM_RC_SCHEME RSA key with an unsupported padding scheme -// TPM_RC_VALUE numeric value of the data to be decrypted is greater -// than the RSA key modulus -TPM_RC -CryptSecretEncrypt( - OBJECT *encryptKey, // IN: encryption key object - const TPM2B *label, // IN: a null-terminated string as L - TPM2B_DATA *data, // OUT: secret value - TPM2B_ENCRYPTED_SECRET *secret // OUT: secret structure -); - -//*** CryptSecretDecrypt() -// Decrypt a secret value by asymmetric (or symmetric) algorithm -// This function is used for ActivateCredential and Import for asymmetric -// decryption, and StartAuthSession for both asymmetric and symmetric -// decryption process -// -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES RSA key is not a decryption key -// TPM_RC_BINDING Invalid RSA key (public and private parts are not -// cryptographically bound. -// TPM_RC_ECC_POINT ECC point in the secret is not on the curve -// TPM_RC_INSUFFICIENT failed to retrieve ECC point from the secret -// TPM_RC_NO_RESULT multiplication resulted in ECC point at infinity -// TPM_RC_SIZE data to decrypt is not of the same size as RSA key -// TPM_RC_VALUE For RSA key, numeric value of the encrypted data is -// greater than the modulus, or the recovered data is -// larger than the output buffer. -// For keyedHash or symmetric key, the secret is -// larger than the size of the digest produced by -// the name algorithm. -// TPM_RC_FAILURE internal error -TPM_RC -CryptSecretDecrypt( - OBJECT *decryptKey, // IN: decrypt key - TPM2B_NONCE *nonceCaller, // IN: nonceCaller. It is needed for - // symmetric decryption. For - // asymmetric decryption, this - // parameter is NULL - const TPM2B *label, // IN: a value for L - TPM2B_ENCRYPTED_SECRET *secret, // IN: input secret - TPM2B_DATA *data // OUT: decrypted secret value -); - -//*** CryptParameterEncryption() -// This function does in-place encryption of a response parameter. -void -CryptParameterEncryption( - TPM_HANDLE handle, // IN: encrypt session handle - TPM2B *nonceCaller, // IN: nonce caller - UINT16 leadingSizeInByte, // IN: the size of the leading size field in - // bytes - TPM2B_AUTH *extraKey, // IN: additional key material other than - // sessionAuth - BYTE *buffer // IN/OUT: parameter buffer to be encrypted -); - -//*** CryptParameterDecryption() -// This function does in-place decryption of a command parameter. -// Return Type: TPM_RC -// TPM_RC_SIZE The number of bytes in the input buffer is less than -// the number of bytes to be decrypted. -TPM_RC -CryptParameterDecryption( - TPM_HANDLE handle, // IN: encrypted session handle - TPM2B *nonceCaller, // IN: nonce caller - UINT32 bufferSize, // IN: size of parameter buffer - UINT16 leadingSizeInByte, // IN: the size of the leading size field in - // byte - TPM2B_AUTH *extraKey, // IN: the authValue - BYTE *buffer // IN/OUT: parameter buffer to be decrypted -); - -//*** CryptComputeSymmetricUnique() -// This function computes the unique field in public area for symmetric objects. -void -CryptComputeSymmetricUnique( - TPMT_PUBLIC *publicArea, // IN: the object's public area - TPMT_SENSITIVE *sensitive, // IN: the associated sensitive area - TPM2B_DIGEST *unique // OUT: unique buffer -); - -//*** CryptCreateObject() -// This function creates an object. -// For an asymmetric key, it will create a key pair and, for a parent key, a seed -// value for child protections. -// -// For an symmetric object, (TPM_ALG_SYMCIPHER or TPM_ALG_KEYEDHASH), it will -// create a secret key if the caller did not provide one. It will create a random -// secret seed value that is hashed with the secret value to create the public -// unique value. -// -// 'publicArea', 'sensitive', and 'sensitiveCreate' are the only required parameters -// and are the only ones that are used by TPM2_Create(). The other parameters -// are optional and are used when the generated Object needs to be deterministic. -// This is the case for both Primary Objects and Derived Objects. -// -// When a seed value is provided, a RAND_STATE will be populated and used for -// all operations in the object generation that require a random number. In the -// simplest case, TPM2_CreatePrimary() will use 'seed', 'label' and 'context' with -// context being the hash of the template. If the Primary Object is in -// the Endorsement hierarchy, it will also populate 'proof' with ehProof. -// -// For derived keys, 'seed' will be the secret value from the parent, 'label' and -// 'context' will be set according to the parameters of TPM2_CreateLoaded() and -// 'hashAlg' will be set which causes the RAND_STATE to be a KDF generator. -// -// Return Type: TPM_RC -// TPM_RC_KEY a provided key is not an allowed value -// TPM_RC_KEY_SIZE key size in the public area does not match the size -// in the sensitive creation area for a symmetric key -// TPM_RC_NO_RESULT unable to get random values (only in derivation) -// TPM_RC_RANGE for an RSA key, the exponent is not supported -// TPM_RC_SIZE sensitive data size is larger than allowed for the -// scheme for a keyed hash object -// TPM_RC_VALUE exponent is not prime or could not find a prime using -// the provided parameters for an RSA key; -// unsupported name algorithm for an ECC key -TPM_RC -CryptCreateObject( - OBJECT *object, // IN: new object structure pointer - TPMS_SENSITIVE_CREATE *sensitiveCreate, // IN: sensitive creation - RAND_STATE *rand // IN: the random number generator - // to use -); - -//*** CryptGetSignHashAlg() -// Get the hash algorithm of signature from a TPMT_SIGNATURE structure. -// It assumes the signature is not NULL -// This is a function for easy access -TPMI_ALG_HASH -CryptGetSignHashAlg( - TPMT_SIGNATURE *auth // IN: signature -); - -//*** CryptIsSplitSign() -// This function us used to determine if the signing operation is a split -// signing operation that required a TPM2_Commit(). -// -BOOL -CryptIsSplitSign( - TPM_ALG_ID scheme // IN: the algorithm selector -); - -//*** CryptIsAsymSignScheme() -// This function indicates if a scheme algorithm is a sign algorithm. -BOOL -CryptIsAsymSignScheme( - TPMI_ALG_PUBLIC publicType, // IN: Type of the object - TPMI_ALG_ASYM_SCHEME scheme // IN: the scheme -); - -//*** CryptIsAsymDecryptScheme() -// This function indicate if a scheme algorithm is a decrypt algorithm. -BOOL -CryptIsAsymDecryptScheme( - TPMI_ALG_PUBLIC publicType, // IN: Type of the object - TPMI_ALG_ASYM_SCHEME scheme // IN: the scheme -); - -//*** CryptSelectSignScheme() -// This function is used by the attestation and signing commands. It implements -// the rules for selecting the signature scheme to use in signing. This function -// requires that the signing key either be TPM_RH_NULL or be loaded. -// -// If a default scheme is defined in object, the default scheme should be chosen, -// otherwise, the input scheme should be chosen. -// In the case that both object and input scheme has a non-NULL scheme -// algorithm, if the schemes are compatible, the input scheme will be chosen. -// -// This function should not be called if 'signObject->publicArea.type' == -// ALG_SYMCIPHER. -// -// Return Type: BOOL -// TRUE(1) scheme selected -// FALSE(0) both 'scheme' and key's default scheme are empty; or -// 'scheme' is empty while key's default scheme requires -// explicit input scheme (split signing); or -// non-empty default key scheme differs from 'scheme' -BOOL -CryptSelectSignScheme( - OBJECT *signObject, // IN: signing key - TPMT_SIG_SCHEME *scheme // IN/OUT: signing scheme -); - -//*** CryptSign() -// Sign a digest with asymmetric key or HMAC. -// This function is called by attestation commands and the generic TPM2_Sign -// command. -// This function checks the key scheme and digest size. It does not -// check if the sign operation is allowed for restricted key. It should be -// checked before the function is called. -// The function will assert if the key is not a signing key. -// -// Return Type: TPM_RC -// TPM_RC_SCHEME 'signScheme' is not compatible with the signing key type -// TPM_RC_VALUE 'digest' value is greater than the modulus of -// 'signHandle' or size of 'hashData' does not match hash -// algorithm in'signScheme' (for an RSA key); -// invalid commit status or failed to generate "r" value -// (for an ECC key) -TPM_RC -CryptSign( - OBJECT *signKey, // IN: signing key - TPMT_SIG_SCHEME *signScheme, // IN: sign scheme. - TPM2B_DIGEST *digest, // IN: The digest being signed - TPMT_SIGNATURE *signature // OUT: signature -); - -//*** CryptValidateSignature() -// This function is used to verify a signature. It is called by -// TPM2_VerifySignature() and TPM2_PolicySigned. -// -// Since this operation only requires use of a public key, no consistency -// checks are necessary for the key to signature type because a caller can load -// any public key that they like with any scheme that they like. This routine -// simply makes sure that the signature is correct, whatever the type. -// -// Return Type: TPM_RC -// TPM_RC_SIGNATURE the signature is not genuine -// TPM_RC_SCHEME the scheme is not supported -// TPM_RC_HANDLE an HMAC key was selected but the -// private part of the key is not loaded -TPM_RC -CryptValidateSignature( - TPMI_DH_OBJECT keyHandle, // IN: The handle of sign key - TPM2B_DIGEST *digest, // IN: The digest being validated - TPMT_SIGNATURE *signature // IN: signature -); - -//*** CryptGetTestResult -// This function returns the results of a self-test function. -// Note: the behavior in this function is NOT the correct behavior for a real -// TPM implementation. An artificial behavior is placed here due to the -// limitation of a software simulation environment. For the correct behavior, -// consult the part 3 specification for TPM2_GetTestResult(). -TPM_RC -CryptGetTestResult( - TPM2B_MAX_BUFFER *outData // OUT: test result data -); - -//*** CryptIsUniqueSizeValid() -// This function validates that the unique values are consistent. -// NOTE: This is not a comprehensive test of the public key. -// Return Type: BOOL -// TRUE(1) sizes are consistent -// FALSE(0) sizes are not consistent -BOOL -CryptIsUniqueSizeValid( - TPMT_PUBLIC *publicArea // IN: the public area to check -); - -//*** CryptIsSensitiveSizeValid() -// This function is used by TPM2_LoadExternal() to validate that the sensitive area -// contains a 'sensitive' value that is consistent with the values in the public -// area. -BOOL -CryptIsSensitiveSizeValid( - TPMT_PUBLIC *publicArea, // IN: the object's public part - TPMT_SENSITIVE *sensitiveArea // IN: the object's sensitive part -); - -//*** CryptValidateKeys() -// This function is used to verify that the key material of and object is valid. -// For a 'publicOnly' object, the key is verified for size and, if it is an ECC -// key, it is verified to be on the specified curve. For a key with a sensitive -// area, the binding between the public and private parts of the key are verified. -// If the nameAlg of the key is TPM_ALG_NULL, then the size of the sensitive area -// is verified but the public portion is not verified, unless the key is an RSA key. -// For an RSA key, the reason for loading the sensitive area is to use it. The -// only way to use a private RSA key is to compute the private exponent. To compute -// the private exponent, the public modulus is used. -// Return Type: TPM_RC -// TPM_RC_BINDING the public and private parts are not cryptographically -// bound -// TPM_RC_HASH cannot have a publicOnly key with nameAlg of TPM_ALG_NULL -// TPM_RC_KEY the public unique is not valid -// TPM_RC_KEY_SIZE the private area key is not valid -// TPM_RC_TYPE the types of the sensitive and private parts do not match -TPM_RC -CryptValidateKeys( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive, - TPM_RC blamePublic, - TPM_RC blameSensitive -); - -//*** CryptAlgSetImplemented() -// This function initializes the bit vector with one bit for each implemented -// algorithm. This function is called from _TPM_Init(). The vector of implemented -// algorithms should be generated by the part 2 parser so that the -// 'g_implementedAlgorithms' vector can be a constant. That's not how it is now -void -CryptAlgsSetImplemented( - void -); - -//*** CryptSelectMac() -// This function is used to set the MAC scheme based on the key parameters and -// the input scheme. -// Return Type: TPM_RC -// TPM_RC_SCHEME the scheme is not a valid mac scheme -// TPM_RC_TYPE the input key is not a type that supports a mac -// TPM_RC_VALUE the input scheme and the key scheme are not compatible -TPM_RC -CryptSelectMac( - TPMT_PUBLIC *publicArea, - TPMI_ALG_MAC_SCHEME *inMac -); - -//*** CryptMacIsValidForKey() -// Check to see if the key type is compatible with the mac type -BOOL -CryptMacIsValidForKey( - TPM_ALG_ID keyType, - TPM_ALG_ID macAlg, - BOOL flag -); - -//*** CryptSmacIsValidAlg() -// This function is used to test if an algorithm is a supported SMAC algorithm. It -// needs to be updated as new algorithms are added. -BOOL -CryptSmacIsValidAlg( - TPM_ALG_ID alg, - BOOL FLAG // IN: Indicates if TPM_ALG_NULL is valid -); - -//*** CryptSymModeIsValid() -// Function checks to see if an algorithm ID is a valid, symmetric block cipher -// mode for the TPM. If 'flag' is SET, them TPM_ALG_NULL is a valid mode. -// not include the modes used for SMAC -BOOL -CryptSymModeIsValid( - TPM_ALG_ID mode, - BOOL flag -); - -#endif // _CRYPT_UTIL_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DA_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DA_fp.h deleted file mode 100644 index 88b50282e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DA_fp.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:23:27PM - */ - -#ifndef _DA_FP_H_ -#define _DA_FP_H_ - -//*** DAPreInstall_Init() -// This function initializes the DA parameters to their manufacturer-default -// values. The default values are determined by a platform-specific specification. -// -// This function should not be called outside of a manufacturing or simulation -// environment. -// -// The DA parameters will be restored to these initial values by TPM2_Clear(). -void -DAPreInstall_Init( - void -); - -//*** DAStartup() -// This function is called by TPM2_Startup() to initialize the DA parameters. -// In the case of Startup(CLEAR), use of lockoutAuth will be enabled if the -// lockout recovery time is 0. Otherwise, lockoutAuth will not be enabled until -// the TPM has been continuously powered for the lockoutRecovery time. -// -// This function requires that NV be available and not rate limiting. -BOOL -DAStartup( - STARTUP_TYPE type // IN: startup type -); - -//*** DARegisterFailure() -// This function is called when a authorization failure occurs on an entity -// that is subject to dictionary-attack protection. When a DA failure is -// triggered, register the failure by resetting the relevant self-healing -// timer to the current time. -void -DARegisterFailure( - TPM_HANDLE handle // IN: handle for failure -); - -//*** DASelfHeal() -// This function is called to check if sufficient time has passed to allow -// decrement of failedTries or to re-enable use of lockoutAuth. -// -// This function should be called when the time interval is updated. -void -DASelfHeal( - void -); - -#endif // _DA_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DictionaryAttackLockReset_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DictionaryAttackLockReset_fp.h deleted file mode 100644 index e8be2fc9c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DictionaryAttackLockReset_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_DictionaryAttackLockReset // Command must be enabled - -#ifndef _Dictionary_Attack_Lock_Reset_FP_H_ -#define _Dictionary_Attack_Lock_Reset_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_LOCKOUT lockHandle; -} DictionaryAttackLockReset_In; - -// Response code modifiers -#define RC_DictionaryAttackLockReset_lockHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_DictionaryAttackLockReset( - DictionaryAttackLockReset_In *in -); - -#endif // _Dictionary_Attack_Lock_Reset_FP_H_ -#endif // CC_DictionaryAttackLockReset diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DictionaryAttackParameters_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DictionaryAttackParameters_fp.h deleted file mode 100644 index 787a9e22f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/DictionaryAttackParameters_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_DictionaryAttackParameters // Command must be enabled - -#ifndef _Dictionary_Attack_Parameters_FP_H_ -#define _Dictionary_Attack_Parameters_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_LOCKOUT lockHandle; - UINT32 newMaxTries; - UINT32 newRecoveryTime; - UINT32 lockoutRecovery; -} DictionaryAttackParameters_In; - -// Response code modifiers -#define RC_DictionaryAttackParameters_lockHandle (TPM_RC_H + TPM_RC_1) -#define RC_DictionaryAttackParameters_newMaxTries (TPM_RC_P + TPM_RC_1) -#define RC_DictionaryAttackParameters_newRecoveryTime (TPM_RC_P + TPM_RC_2) -#define RC_DictionaryAttackParameters_lockoutRecovery (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_DictionaryAttackParameters( - DictionaryAttackParameters_In *in -); - -#endif // _Dictionary_Attack_Parameters_FP_H_ -#endif // CC_DictionaryAttackParameters diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Duplicate_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Duplicate_fp.h deleted file mode 100644 index 74f064c6e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Duplicate_fp.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Duplicate // Command must be enabled - -#ifndef _Duplicate_FP_H_ -#define _Duplicate_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT objectHandle; - TPMI_DH_OBJECT newParentHandle; - TPM2B_DATA encryptionKeyIn; - TPMT_SYM_DEF_OBJECT symmetricAlg; -} Duplicate_In; - -// Output structure definition -typedef struct { - TPM2B_DATA encryptionKeyOut; - TPM2B_PRIVATE duplicate; - TPM2B_ENCRYPTED_SECRET outSymSeed; -} Duplicate_Out; - -// Response code modifiers -#define RC_Duplicate_objectHandle (TPM_RC_H + TPM_RC_1) -#define RC_Duplicate_newParentHandle (TPM_RC_H + TPM_RC_2) -#define RC_Duplicate_encryptionKeyIn (TPM_RC_P + TPM_RC_1) -#define RC_Duplicate_symmetricAlg (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_Duplicate( - Duplicate_In *in, - Duplicate_Out *out -); - -#endif // _Duplicate_FP_H_ -#endif // CC_Duplicate diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECC_Parameters_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECC_Parameters_fp.h deleted file mode 100644 index c38b14cb3..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECC_Parameters_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ECC_Parameters // Command must be enabled - -#ifndef _ECC_Parameters_FP_H_ -#define _ECC_Parameters_FP_H_ - -// Input structure definition -typedef struct { - TPMI_ECC_CURVE curveID; -} ECC_Parameters_In; - -// Output structure definition -typedef struct { - TPMS_ALGORITHM_DETAIL_ECC parameters; -} ECC_Parameters_Out; - -// Response code modifiers -#define RC_ECC_Parameters_curveID (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ECC_Parameters( - ECC_Parameters_In *in, - ECC_Parameters_Out *out -); - -#endif // _ECC_Parameters_FP_H_ -#endif // CC_ECC_Parameters diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECDH_KeyGen_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECDH_KeyGen_fp.h deleted file mode 100644 index f86e16f93..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECDH_KeyGen_fp.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ECDH_KeyGen // Command must be enabled - -#ifndef _ECDH_Key_Gen_FP_H_ -#define _ECDH_Key_Gen_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyHandle; -} ECDH_KeyGen_In; - -// Output structure definition -typedef struct { - TPM2B_ECC_POINT zPoint; - TPM2B_ECC_POINT pubPoint; -} ECDH_KeyGen_Out; - -// Response code modifiers -#define RC_ECDH_KeyGen_keyHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ECDH_KeyGen( - ECDH_KeyGen_In *in, - ECDH_KeyGen_Out *out -); - -#endif // _ECDH_Key_Gen_FP_H_ -#endif // CC_ECDH_KeyGen diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECDH_ZGen_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECDH_ZGen_fp.h deleted file mode 100644 index ba77f5f31..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ECDH_ZGen_fp.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ECDH_ZGen // Command must be enabled - -#ifndef _ECDH_ZGen_FP_H_ -#define _ECDH_ZGen_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyHandle; - TPM2B_ECC_POINT inPoint; -} ECDH_ZGen_In; - -// Output structure definition -typedef struct { - TPM2B_ECC_POINT outPoint; -} ECDH_ZGen_Out; - -// Response code modifiers -#define RC_ECDH_ZGen_keyHandle (TPM_RC_H + TPM_RC_1) -#define RC_ECDH_ZGen_inPoint (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ECDH_ZGen( - ECDH_ZGen_In *in, - ECDH_ZGen_Out *out -); - -#endif // _ECDH_ZGen_FP_H_ -#endif // CC_ECDH_ZGen diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EC_Ephemeral_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EC_Ephemeral_fp.h deleted file mode 100644 index 7b0ba0fec..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EC_Ephemeral_fp.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_EC_Ephemeral // Command must be enabled - -#ifndef _EC_Ephemeral_FP_H_ -#define _EC_Ephemeral_FP_H_ - -// Input structure definition -typedef struct { - TPMI_ECC_CURVE curveID; -} EC_Ephemeral_In; - -// Output structure definition -typedef struct { - TPM2B_ECC_POINT Q; - UINT16 counter; -} EC_Ephemeral_Out; - -// Response code modifiers -#define RC_EC_Ephemeral_curveID (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_EC_Ephemeral( - EC_Ephemeral_In *in, - EC_Ephemeral_Out *out -); - -#endif // _EC_Ephemeral_FP_H_ -#endif // CC_EC_Ephemeral diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt2_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt2_fp.h deleted file mode 100644 index 20e717ede..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt2_fp.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_EncryptDecrypt2 // Command must be enabled - -#ifndef _Encrypt_Decrypt2_FP_H_ -#define _Encrypt_Decrypt2_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyHandle; - TPM2B_MAX_BUFFER inData; - TPMI_YES_NO decrypt; - TPMI_ALG_CIPHER_MODE mode; - TPM2B_IV ivIn; -} EncryptDecrypt2_In; - -// Output structure definition -typedef struct { - TPM2B_MAX_BUFFER outData; - TPM2B_IV ivOut; -} EncryptDecrypt2_Out; - -// Response code modifiers -#define RC_EncryptDecrypt2_keyHandle (TPM_RC_H + TPM_RC_1) -#define RC_EncryptDecrypt2_inData (TPM_RC_P + TPM_RC_1) -#define RC_EncryptDecrypt2_decrypt (TPM_RC_P + TPM_RC_2) -#define RC_EncryptDecrypt2_mode (TPM_RC_P + TPM_RC_3) -#define RC_EncryptDecrypt2_ivIn (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_EncryptDecrypt2( - EncryptDecrypt2_In *in, - EncryptDecrypt2_Out *out -); - -#endif // _Encrypt_Decrypt2_FP_H_ -#endif // CC_EncryptDecrypt2 diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt_fp.h deleted file mode 100644 index 689d2688e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt_fp.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_EncryptDecrypt // Command must be enabled - -#ifndef _Encrypt_Decrypt_FP_H_ -#define _Encrypt_Decrypt_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyHandle; - TPMI_YES_NO decrypt; - TPMI_ALG_CIPHER_MODE mode; - TPM2B_IV ivIn; - TPM2B_MAX_BUFFER inData; -} EncryptDecrypt_In; - -// Output structure definition -typedef struct { - TPM2B_MAX_BUFFER outData; - TPM2B_IV ivOut; -} EncryptDecrypt_Out; - -// Response code modifiers -#define RC_EncryptDecrypt_keyHandle (TPM_RC_H + TPM_RC_1) -#define RC_EncryptDecrypt_decrypt (TPM_RC_P + TPM_RC_1) -#define RC_EncryptDecrypt_mode (TPM_RC_P + TPM_RC_2) -#define RC_EncryptDecrypt_ivIn (TPM_RC_P + TPM_RC_3) -#define RC_EncryptDecrypt_inData (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_EncryptDecrypt( - EncryptDecrypt_In *in, - EncryptDecrypt_Out *out -); - -#endif // _Encrypt_Decrypt_FP_H_ -#endif // CC_EncryptDecrypt diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt_spt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt_spt_fp.h deleted file mode 100644 index b1e7c39ef..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EncryptDecrypt_spt_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _ENCRYPT_DECRYPT_SPT_FP_H_ -#define _ENCRYPT_DECRYPT_SPT_FP_H_ - -#if CC_EncryptDecrypt2 - -// Return Type: TPM_RC -// TPM_RC_KEY is not a symmetric decryption key with both -// public and private portions loaded -// TPM_RC_SIZE 'IvIn' size is incompatible with the block cipher mode; -// or 'inData' size is not an even multiple of the block -// size for CBC or ECB mode -// TPM_RC_VALUE 'keyHandle' is restricted and the argument 'mode' does -// not match the key's mode -TPM_RC -EncryptDecryptShared( - TPMI_DH_OBJECT keyHandleIn, - TPMI_YES_NO decryptIn, - TPMI_ALG_SYM_MODE modeIn, - TPM2B_IV *ivIn, - TPM2B_MAX_BUFFER *inData, - EncryptDecrypt_Out *out -); -#endif // CC_EncryptDecrypt - -#endif // _ENCRYPT_DECRYPT_SPT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Entity_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Entity_fp.h deleted file mode 100644 index 4bb2a1b55..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Entity_fp.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _ENTITY_FP_H_ -#define _ENTITY_FP_H_ - -//** Functions -//*** EntityGetLoadStatus() -// This function will check that all the handles access loaded entities. -// Return Type: TPM_RC -// TPM_RC_HANDLE handle type does not match -// TPM_RC_REFERENCE_Hx entity is not present -// TPM_RC_HIERARCHY entity belongs to a disabled hierarchy -// TPM_RC_OBJECT_MEMORY handle is an evict object but there is no -// space to load it to RAM -TPM_RC -EntityGetLoadStatus( - COMMAND *command // IN/OUT: command parsing structure -); - -//*** EntityGetAuthValue() -// This function is used to access the 'authValue' associated with a handle. -// This function assumes that the handle references an entity that is accessible -// and the handle is not for a persistent objects. That is EntityGetLoadStatus() -// should have been called. Also, the accessibility of the authValue should have -// been verified by IsAuthValueAvailable(). -// -// This function copies the authorization value of the entity to 'auth'. -// Return Type: UINT16 -// count number of bytes in the authValue with 0's stripped -UINT16 -EntityGetAuthValue( - TPMI_DH_ENTITY handle, // IN: handle of entity - TPM2B_AUTH *auth // OUT: authValue of the entity -); - -//*** EntityGetAuthPolicy() -// This function is used to access the 'authPolicy' associated with a handle. -// This function assumes that the handle references an entity that is accessible -// and the handle is not for a persistent objects. That is EntityGetLoadStatus() -// should have been called. Also, the accessibility of the authPolicy should have -// been verified by IsAuthPolicyAvailable(). -// -// This function copies the authorization policy of the entity to 'authPolicy'. -// -// The return value is the hash algorithm for the policy. -TPMI_ALG_HASH -EntityGetAuthPolicy( - TPMI_DH_ENTITY handle, // IN: handle of entity - TPM2B_DIGEST *authPolicy // OUT: authPolicy of the entity -); - -//*** EntityGetName() -// This function returns the Name associated with a handle. -TPM2B_NAME * -EntityGetName( - TPMI_DH_ENTITY handle, // IN: handle of entity - TPM2B_NAME *name // OUT: name of entity -); - -//*** EntityGetHierarchy() -// This function returns the hierarchy handle associated with an entity. -// 1. A handle that is a hierarchy handle is associated with itself. -// 2. An NV index belongs to TPM_RH_PLATFORM if TPMA_NV_PLATFORMCREATE, -// is SET, otherwise it belongs to TPM_RH_OWNER -// 3. An object handle belongs to its hierarchy. -TPMI_RH_HIERARCHY -EntityGetHierarchy( - TPMI_DH_ENTITY handle // IN :handle of entity -); - -#endif // _ENTITY_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EventSequenceComplete_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EventSequenceComplete_fp.h deleted file mode 100644 index ec346f370..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EventSequenceComplete_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_EventSequenceComplete // Command must be enabled - -#ifndef _Event_Sequence_Complete_FP_H_ -#define _Event_Sequence_Complete_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_PCR pcrHandle; - TPMI_DH_OBJECT sequenceHandle; - TPM2B_MAX_BUFFER buffer; -} EventSequenceComplete_In; - -// Output structure definition -typedef struct { - TPML_DIGEST_VALUES results; -} EventSequenceComplete_Out; - -// Response code modifiers -#define RC_EventSequenceComplete_pcrHandle (TPM_RC_H + TPM_RC_1) -#define RC_EventSequenceComplete_sequenceHandle (TPM_RC_H + TPM_RC_2) -#define RC_EventSequenceComplete_buffer (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_EventSequenceComplete( - EventSequenceComplete_In *in, - EventSequenceComplete_Out *out -); - -#endif // _Event_Sequence_Complete_FP_H_ -#endif // CC_EventSequenceComplete diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EvictControl_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EvictControl_fp.h deleted file mode 100644 index 340eb8c97..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/EvictControl_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_EvictControl // Command must be enabled - -#ifndef _Evict_Control_FP_H_ -#define _Evict_Control_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PROVISION auth; - TPMI_DH_OBJECT objectHandle; - TPMI_DH_PERSISTENT persistentHandle; -} EvictControl_In; - -// Response code modifiers -#define RC_EvictControl_auth (TPM_RC_H + TPM_RC_1) -#define RC_EvictControl_objectHandle (TPM_RC_H + TPM_RC_2) -#define RC_EvictControl_persistentHandle (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_EvictControl( - EvictControl_In *in -); - -#endif // _Evict_Control_FP_H_ -#endif // CC_EvictControl diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ExecCommand_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ExecCommand_fp.h deleted file mode 100644 index 7d2e5fdaf..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ExecCommand_fp.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _EXEC_COMMAND_FP_H_ -#define _EXEC_COMMAND_FP_H_ - -//** ExecuteCommand() -// -// The function performs the following steps. -// -// a) Parses the command header from input buffer. -// b) Calls ParseHandleBuffer() to parse the handle area of the command. -// c) Validates that each of the handles references a loaded entity. -// d) Calls ParseSessionBuffer () to: -// 1) unmarshal and parse the session area; -// 2) check the authorizations; and -// 3) when necessary, decrypt a parameter. -// e) Calls CommandDispatcher() to: -// 1) unmarshal the command parameters from the command buffer; -// 2) call the routine that performs the command actions; and -// 3) marshal the responses into the response buffer. -// f) If any error occurs in any of the steps above create the error response -// and return. -// g) Calls BuildResponseSessions() to: -// 1) when necessary, encrypt a parameter -// 2) build the response authorization sessions -// 3) update the audit sessions and nonces -// h) Calls BuildResponseHeader() to complete the construction of the response. -// -// 'responseSize' is set by the caller to the maximum number of bytes available in -// the output buffer. ExecuteCommand will adjust the value and return the number -// of bytes placed in the buffer. -// -// 'response' is also set by the caller to indicate the buffer into which -// ExecuteCommand is to place the response. -// -// 'request' and 'response' may point to the same buffer -// -// Note: As of February, 2016, the failure processing has been moved to the -// platform-specific code. When the TPM code encounters an unrecoverable failure, it -// will SET g_inFailureMode and call _plat__Fail(). That function should not return -// but may call ExecuteCommand(). -// -LIB_EXPORT void -ExecuteCommand( - uint32_t requestSize, // IN: command buffer size - unsigned char *request, // IN: command buffer - uint32_t *responseSize, // IN/OUT: response buffer size - unsigned char **response // IN/OUT: response buffer -); - -#endif // _EXEC_COMMAND_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FieldUpgradeData_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FieldUpgradeData_fp.h deleted file mode 100644 index dba27ce31..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FieldUpgradeData_fp.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_FieldUpgradeData // Command must be enabled - -#ifndef _Field_Upgrade_Data_FP_H_ -#define _Field_Upgrade_Data_FP_H_ - -// Input structure definition -typedef struct { - TPM2B_MAX_BUFFER fuData; -} FieldUpgradeData_In; - -// Output structure definition -typedef struct { - TPMT_HA nextDigest; - TPMT_HA firstDigest; -} FieldUpgradeData_Out; - -// Response code modifiers -#define RC_FieldUpgradeData_fuData (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_FieldUpgradeData( - FieldUpgradeData_In *in, - FieldUpgradeData_Out *out -); - -#endif // _Field_Upgrade_Data_FP_H_ -#endif // CC_FieldUpgradeData diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FieldUpgradeStart_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FieldUpgradeStart_fp.h deleted file mode 100644 index 0047e3558..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FieldUpgradeStart_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_FieldUpgradeStart // Command must be enabled - -#ifndef _Field_Upgrade_Start_FP_H_ -#define _Field_Upgrade_Start_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PLATFORM authorization; - TPMI_DH_OBJECT keyHandle; - TPM2B_DIGEST fuDigest; - TPMT_SIGNATURE manifestSignature; -} FieldUpgradeStart_In; - -// Response code modifiers -#define RC_FieldUpgradeStart_authorization (TPM_RC_H + TPM_RC_1) -#define RC_FieldUpgradeStart_keyHandle (TPM_RC_H + TPM_RC_2) -#define RC_FieldUpgradeStart_fuDigest (TPM_RC_P + TPM_RC_1) -#define RC_FieldUpgradeStart_manifestSignature (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_FieldUpgradeStart( - FieldUpgradeStart_In *in -); - -#endif // _Field_Upgrade_Start_FP_H_ -#endif // CC_FieldUpgradeStart diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FirmwareRead_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FirmwareRead_fp.h deleted file mode 100644 index bc991ffa5..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FirmwareRead_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_FirmwareRead // Command must be enabled - -#ifndef _Firmware_Read_FP_H_ -#define _Firmware_Read_FP_H_ - -// Input structure definition -typedef struct { - UINT32 sequenceNumber; -} FirmwareRead_In; - -// Output structure definition -typedef struct { - TPM2B_MAX_BUFFER fuData; -} FirmwareRead_Out; - -// Response code modifiers -#define RC_FirmwareRead_sequenceNumber (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_FirmwareRead( - FirmwareRead_In *in, - FirmwareRead_Out *out -); - -#endif // _Firmware_Read_FP_H_ -#endif // CC_FirmwareRead diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FlushContext_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FlushContext_fp.h deleted file mode 100644 index 8b0c7ffe8..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/FlushContext_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_FlushContext // Command must be enabled - -#ifndef _Flush_Context_FP_H_ -#define _Flush_Context_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_CONTEXT flushHandle; -} FlushContext_In; - -// Response code modifiers -#define RC_FlushContext_flushHandle (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_FlushContext( - FlushContext_In *in -); - -#endif // _Flush_Context_FP_H_ -#endif // CC_FlushContext diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetCapability_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetCapability_fp.h deleted file mode 100644 index 83ad53cfa..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetCapability_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_GetCapability // Command must be enabled - -#ifndef _Get_Capability_FP_H_ -#define _Get_Capability_FP_H_ - -// Input structure definition -typedef struct { - TPM_CAP capability; - UINT32 property; - UINT32 propertyCount; -} GetCapability_In; - -// Output structure definition -typedef struct { - TPMI_YES_NO moreData; - TPMS_CAPABILITY_DATA capabilityData; -} GetCapability_Out; - -// Response code modifiers -#define RC_GetCapability_capability (TPM_RC_P + TPM_RC_1) -#define RC_GetCapability_property (TPM_RC_P + TPM_RC_2) -#define RC_GetCapability_propertyCount (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_GetCapability( - GetCapability_In *in, - GetCapability_Out *out -); - -#endif // _Get_Capability_FP_H_ -#endif // CC_GetCapability diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetCommandAuditDigest_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetCommandAuditDigest_fp.h deleted file mode 100644 index 193250e9a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetCommandAuditDigest_fp.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_GetCommandAuditDigest // Command must be enabled - -#ifndef _Get_Command_Audit_Digest_FP_H_ -#define _Get_Command_Audit_Digest_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_ENDORSEMENT privacyHandle; - TPMI_DH_OBJECT signHandle; - TPM2B_DATA qualifyingData; - TPMT_SIG_SCHEME inScheme; -} GetCommandAuditDigest_In; - -// Output structure definition -typedef struct { - TPM2B_ATTEST auditInfo; - TPMT_SIGNATURE signature; -} GetCommandAuditDigest_Out; - -// Response code modifiers -#define RC_GetCommandAuditDigest_privacyHandle (TPM_RC_H + TPM_RC_1) -#define RC_GetCommandAuditDigest_signHandle (TPM_RC_H + TPM_RC_2) -#define RC_GetCommandAuditDigest_qualifyingData (TPM_RC_P + TPM_RC_1) -#define RC_GetCommandAuditDigest_inScheme (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_GetCommandAuditDigest( - GetCommandAuditDigest_In *in, - GetCommandAuditDigest_Out *out -); - -#endif // _Get_Command_Audit_Digest_FP_H_ -#endif // CC_GetCommandAuditDigest diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetRandom_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetRandom_fp.h deleted file mode 100644 index 1d82cef61..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetRandom_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_GetRandom // Command must be enabled - -#ifndef _Get_Random_FP_H_ -#define _Get_Random_FP_H_ - -// Input structure definition -typedef struct { - UINT16 bytesRequested; -} GetRandom_In; - -// Output structure definition -typedef struct { - TPM2B_DIGEST randomBytes; -} GetRandom_Out; - -// Response code modifiers -#define RC_GetRandom_bytesRequested (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_GetRandom( - GetRandom_In *in, - GetRandom_Out *out -); - -#endif // _Get_Random_FP_H_ -#endif // CC_GetRandom diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetSessionAuditDigest_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetSessionAuditDigest_fp.h deleted file mode 100644 index e3ef9f651..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetSessionAuditDigest_fp.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_GetSessionAuditDigest // Command must be enabled - -#ifndef _Get_Session_Audit_Digest_FP_H_ -#define _Get_Session_Audit_Digest_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_ENDORSEMENT privacyAdminHandle; - TPMI_DH_OBJECT signHandle; - TPMI_SH_HMAC sessionHandle; - TPM2B_DATA qualifyingData; - TPMT_SIG_SCHEME inScheme; -} GetSessionAuditDigest_In; - -// Output structure definition -typedef struct { - TPM2B_ATTEST auditInfo; - TPMT_SIGNATURE signature; -} GetSessionAuditDigest_Out; - -// Response code modifiers -#define RC_GetSessionAuditDigest_privacyAdminHandle (TPM_RC_H + TPM_RC_1) -#define RC_GetSessionAuditDigest_signHandle (TPM_RC_H + TPM_RC_2) -#define RC_GetSessionAuditDigest_sessionHandle (TPM_RC_H + TPM_RC_3) -#define RC_GetSessionAuditDigest_qualifyingData (TPM_RC_P + TPM_RC_1) -#define RC_GetSessionAuditDigest_inScheme (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_GetSessionAuditDigest( - GetSessionAuditDigest_In *in, - GetSessionAuditDigest_Out *out -); - -#endif // _Get_Session_Audit_Digest_FP_H_ -#endif // CC_GetSessionAuditDigest diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetTestResult_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetTestResult_fp.h deleted file mode 100644 index 22fdc00db..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetTestResult_fp.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_GetTestResult // Command must be enabled - -#ifndef _Get_Test_Result_FP_H_ -#define _Get_Test_Result_FP_H_ - -// Output structure definition -typedef struct { - TPM2B_MAX_BUFFER outData; - TPM_RC testResult; -} GetTestResult_Out; - - -// Function prototype -TPM_RC -TPM2_GetTestResult( - GetTestResult_Out *out -); - -#endif // _Get_Test_Result_FP_H_ -#endif // CC_GetTestResult diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetTime_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetTime_fp.h deleted file mode 100644 index 2ef55ac5f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/GetTime_fp.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_GetTime // Command must be enabled - -#ifndef _Get_Time_FP_H_ -#define _Get_Time_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_ENDORSEMENT privacyAdminHandle; - TPMI_DH_OBJECT signHandle; - TPM2B_DATA qualifyingData; - TPMT_SIG_SCHEME inScheme; -} GetTime_In; - -// Output structure definition -typedef struct { - TPM2B_ATTEST timeInfo; - TPMT_SIGNATURE signature; -} GetTime_Out; - -// Response code modifiers -#define RC_GetTime_privacyAdminHandle (TPM_RC_H + TPM_RC_1) -#define RC_GetTime_signHandle (TPM_RC_H + TPM_RC_2) -#define RC_GetTime_qualifyingData (TPM_RC_P + TPM_RC_1) -#define RC_GetTime_inScheme (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_GetTime( - GetTime_In *in, - GetTime_Out *out -); - -#endif // _Get_Time_FP_H_ -#endif // CC_GetTime diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HMAC_Start_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HMAC_Start_fp.h deleted file mode 100644 index 79f4a96cb..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HMAC_Start_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_HMAC_Start // Command must be enabled - -#ifndef _HMAC_Start_FP_H_ -#define _HMAC_Start_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT handle; - TPM2B_AUTH auth; - TPMI_ALG_HASH hashAlg; -} HMAC_Start_In; - -// Output structure definition -typedef struct { - TPMI_DH_OBJECT sequenceHandle; -} HMAC_Start_Out; - -// Response code modifiers -#define RC_HMAC_Start_handle (TPM_RC_H + TPM_RC_1) -#define RC_HMAC_Start_auth (TPM_RC_P + TPM_RC_1) -#define RC_HMAC_Start_hashAlg (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_HMAC_Start( - HMAC_Start_In *in, - HMAC_Start_Out *out -); - -#endif // _HMAC_Start_FP_H_ -#endif // CC_HMAC_Start diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HMAC_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HMAC_fp.h deleted file mode 100644 index 63a6d0fbd..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HMAC_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_HMAC // Command must be enabled - -#ifndef _HMAC_FP_H_ -#define _HMAC_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT handle; - TPM2B_MAX_BUFFER buffer; - TPMI_ALG_HASH hashAlg; -} HMAC_In; - -// Output structure definition -typedef struct { - TPM2B_DIGEST outHMAC; -} HMAC_Out; - -// Response code modifiers -#define RC_HMAC_handle (TPM_RC_H + TPM_RC_1) -#define RC_HMAC_buffer (TPM_RC_P + TPM_RC_1) -#define RC_HMAC_hashAlg (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_HMAC( - HMAC_In *in, - HMAC_Out *out -); - -#endif // _HMAC_FP_H_ -#endif // CC_HMAC diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Handle_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Handle_fp.h deleted file mode 100644 index 8ada3d356..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Handle_fp.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _HANDLE_FP_H_ -#define _HANDLE_FP_H_ - -//*** HandleGetType() -// This function returns the type of a handle which is the MSO of the handle. -TPM_HT -HandleGetType( - TPM_HANDLE handle // IN: a handle to be checked -); - -//*** NextPermanentHandle() -// This function returns the permanent handle that is equal to the input value or -// is the next higher value. If there is no handle with the input value and there -// is no next higher value, it returns 0: -TPM_HANDLE -NextPermanentHandle( - TPM_HANDLE inHandle // IN: the handle to check -); - -//*** PermanentCapGetHandles() -// This function returns a list of the permanent handles of PCR, started from -// 'handle'. If 'handle' is larger than the largest permanent handle, an empty list -// will be returned with 'more' set to NO. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -PermanentCapGetHandles( - TPM_HANDLE handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle -); - -//*** PermanentHandleGetPolicy() -// This function returns a list of the permanent handles of PCR, started from -// 'handle'. If 'handle' is larger than the largest permanent handle, an empty list -// will be returned with 'more' set to NO. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -PermanentHandleGetPolicy( - TPM_HANDLE handle, // IN: start handle - UINT32 count, // IN: max count of returned handles - TPML_TAGGED_POLICY *policyList // OUT: list of handle -); - -#endif // _HANDLE_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HashSequenceStart_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HashSequenceStart_fp.h deleted file mode 100644 index a3abb2219..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HashSequenceStart_fp.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_HashSequenceStart // Command must be enabled - -#ifndef _Hash_Sequence_Start_FP_H_ -#define _Hash_Sequence_Start_FP_H_ - -// Input structure definition -typedef struct { - TPM2B_AUTH auth; - TPMI_ALG_HASH hashAlg; -} HashSequenceStart_In; - -// Output structure definition -typedef struct { - TPMI_DH_OBJECT sequenceHandle; -} HashSequenceStart_Out; - -// Response code modifiers -#define RC_HashSequenceStart_auth (TPM_RC_P + TPM_RC_1) -#define RC_HashSequenceStart_hashAlg (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_HashSequenceStart( - HashSequenceStart_In *in, - HashSequenceStart_Out *out -); - -#endif // _Hash_Sequence_Start_FP_H_ -#endif // CC_HashSequenceStart diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Hash_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Hash_fp.h deleted file mode 100644 index c59a4ab6f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Hash_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Hash // Command must be enabled - -#ifndef _Hash_FP_H_ -#define _Hash_FP_H_ - -// Input structure definition -typedef struct { - TPM2B_MAX_BUFFER data; - TPMI_ALG_HASH hashAlg; - TPMI_RH_HIERARCHY hierarchy; -} Hash_In; - -// Output structure definition -typedef struct { - TPM2B_DIGEST outHash; - TPMT_TK_HASHCHECK validation; -} Hash_Out; - -// Response code modifiers -#define RC_Hash_data (TPM_RC_P + TPM_RC_1) -#define RC_Hash_hashAlg (TPM_RC_P + TPM_RC_2) -#define RC_Hash_hierarchy (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_Hash( - Hash_In *in, - Hash_Out *out -); - -#endif // _Hash_FP_H_ -#endif // CC_Hash diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HierarchyChangeAuth_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HierarchyChangeAuth_fp.h deleted file mode 100644 index 2538a7053..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HierarchyChangeAuth_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_HierarchyChangeAuth // Command must be enabled - -#ifndef _Hierarchy_Change_Auth_FP_H_ -#define _Hierarchy_Change_Auth_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_HIERARCHY_AUTH authHandle; - TPM2B_AUTH newAuth; -} HierarchyChangeAuth_In; - -// Response code modifiers -#define RC_HierarchyChangeAuth_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_HierarchyChangeAuth_newAuth (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_HierarchyChangeAuth( - HierarchyChangeAuth_In *in -); - -#endif // _Hierarchy_Change_Auth_FP_H_ -#endif // CC_HierarchyChangeAuth diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HierarchyControl_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HierarchyControl_fp.h deleted file mode 100644 index 8431ff51d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/HierarchyControl_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_HierarchyControl // Command must be enabled - -#ifndef _Hierarchy_Control_FP_H_ -#define _Hierarchy_Control_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_HIERARCHY authHandle; - TPMI_RH_ENABLES enable; - TPMI_YES_NO state; -} HierarchyControl_In; - -// Response code modifiers -#define RC_HierarchyControl_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_HierarchyControl_enable (TPM_RC_P + TPM_RC_1) -#define RC_HierarchyControl_state (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_HierarchyControl( - HierarchyControl_In *in -); - -#endif // _Hierarchy_Control_FP_H_ -#endif // CC_HierarchyControl diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Hierarchy_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Hierarchy_fp.h deleted file mode 100644 index dc55a9439..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Hierarchy_fp.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:23:27PM - */ - -#ifndef _HIERARCHY_FP_H_ -#define _HIERARCHY_FP_H_ - -//*** HierarchyPreInstall() -// This function performs the initialization functions for the hierarchy -// when the TPM is simulated. This function should not be called if the -// TPM is not in a manufacturing mode at the manufacturer, or in a simulated -// environment. -void -HierarchyPreInstall_Init( - void -); - -//*** HierarchyStartup() -// This function is called at TPM2_Startup() to initialize the hierarchy -// related values. -BOOL -HierarchyStartup( - STARTUP_TYPE type // IN: start up type -); - -//*** HierarchyGetProof() -// This function finds the proof value associated with a hierarchy.It returns a -// pointer to the proof value. -TPM2B_PROOF * -HierarchyGetProof( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy constant -); - -//*** HierarchyGetPrimarySeed() -// This function returns the primary seed of a hierarchy. -TPM2B_SEED * -HierarchyGetPrimarySeed( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy -); - -//*** HierarchyIsEnabled() -// This function checks to see if a hierarchy is enabled. -// NOTE: The TPM_RH_NULL hierarchy is always enabled. -// Return Type: BOOL -// TRUE(1) hierarchy is enabled -// FALSE(0) hierarchy is disabled -BOOL -HierarchyIsEnabled( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy -); - -#endif // _HIERARCHY_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Import_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Import_fp.h deleted file mode 100644 index d997754f9..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Import_fp.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Import // Command must be enabled - -#ifndef _Import_FP_H_ -#define _Import_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT parentHandle; - TPM2B_DATA encryptionKey; - TPM2B_PUBLIC objectPublic; - TPM2B_PRIVATE duplicate; - TPM2B_ENCRYPTED_SECRET inSymSeed; - TPMT_SYM_DEF_OBJECT symmetricAlg; -} Import_In; - -// Output structure definition -typedef struct { - TPM2B_PRIVATE outPrivate; -} Import_Out; - -// Response code modifiers -#define RC_Import_parentHandle (TPM_RC_H + TPM_RC_1) -#define RC_Import_encryptionKey (TPM_RC_P + TPM_RC_1) -#define RC_Import_objectPublic (TPM_RC_P + TPM_RC_2) -#define RC_Import_duplicate (TPM_RC_P + TPM_RC_3) -#define RC_Import_inSymSeed (TPM_RC_P + TPM_RC_4) -#define RC_Import_symmetricAlg (TPM_RC_P + TPM_RC_5) - -// Function prototype -TPM_RC -TPM2_Import( - Import_In *in, - Import_Out *out -); - -#endif // _Import_FP_H_ -#endif // CC_Import diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/IncrementalSelfTest_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/IncrementalSelfTest_fp.h deleted file mode 100644 index cd384cb50..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/IncrementalSelfTest_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_IncrementalSelfTest // Command must be enabled - -#ifndef _Incremental_Self_Test_FP_H_ -#define _Incremental_Self_Test_FP_H_ - -// Input structure definition -typedef struct { - TPML_ALG toTest; -} IncrementalSelfTest_In; - -// Output structure definition -typedef struct { - TPML_ALG toDoList; -} IncrementalSelfTest_Out; - -// Response code modifiers -#define RC_IncrementalSelfTest_toTest (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_IncrementalSelfTest( - IncrementalSelfTest_In *in, - IncrementalSelfTest_Out *out -); - -#endif // _Incremental_Self_Test_FP_H_ -#endif // CC_IncrementalSelfTest diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/IoBuffers_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/IoBuffers_fp.h deleted file mode 100644 index dd74dad60..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/IoBuffers_fp.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _IO_BUFFERS_FP_H_ -#define _IO_BUFFERS_FP_H_ - -//*** MemoryIoBufferAllocationReset() -// This function is used to reset the allocation of buffers. -void -MemoryIoBufferAllocationReset( - void -); - -//*** MemoryIoBufferZero() -// Function zeros the action I/O buffer at the end of a command. Calling this is -// not mandatory for proper functionality. -void -MemoryIoBufferZero( - void -); - -//*** MemoryGetInBuffer() -// This function returns the address of the buffer into which the -// command parameters will be unmarshaled in preparation for calling -// the command actions. -BYTE * -MemoryGetInBuffer( - UINT32 size // Size, in bytes, required for the input - // unmarshaling -); - -//*** MemoryGetOutBuffer() -// This function returns the address of the buffer into which the command -// action code places its output values. -BYTE * -MemoryGetOutBuffer( - UINT32 size // required size of the buffer -); - -//*** IsLabelProperlyFormatted() -// This function checks that a label is a null-terminated string. -// NOTE: this function is here because there was no better place for it. -// Return Type: BOOL -// TRUE(1) string is null terminated -// FALSE(0) string is not null terminated -BOOL -IsLabelProperlyFormatted( - TPM2B *x -); - -#endif // _IO_BUFFERS_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/LoadExternal_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/LoadExternal_fp.h deleted file mode 100644 index d1691bac4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/LoadExternal_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_LoadExternal // Command must be enabled - -#ifndef _Load_External_FP_H_ -#define _Load_External_FP_H_ - -// Input structure definition -typedef struct { - TPM2B_SENSITIVE inPrivate; - TPM2B_PUBLIC inPublic; - TPMI_RH_HIERARCHY hierarchy; -} LoadExternal_In; - -// Output structure definition -typedef struct { - TPM_HANDLE objectHandle; - TPM2B_NAME name; -} LoadExternal_Out; - -// Response code modifiers -#define RC_LoadExternal_inPrivate (TPM_RC_P + TPM_RC_1) -#define RC_LoadExternal_inPublic (TPM_RC_P + TPM_RC_2) -#define RC_LoadExternal_hierarchy (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_LoadExternal( - LoadExternal_In *in, - LoadExternal_Out *out -); - -#endif // _Load_External_FP_H_ -#endif // CC_LoadExternal diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Load_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Load_fp.h deleted file mode 100644 index 3a61c5394..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Load_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Load // Command must be enabled - -#ifndef _Load_FP_H_ -#define _Load_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT parentHandle; - TPM2B_PRIVATE inPrivate; - TPM2B_PUBLIC inPublic; -} Load_In; - -// Output structure definition -typedef struct { - TPM_HANDLE objectHandle; - TPM2B_NAME name; -} Load_Out; - -// Response code modifiers -#define RC_Load_parentHandle (TPM_RC_H + TPM_RC_1) -#define RC_Load_inPrivate (TPM_RC_P + TPM_RC_1) -#define RC_Load_inPublic (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_Load( - Load_In *in, - Load_Out *out -); - -#endif // _Load_FP_H_ -#endif // CC_Load diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Locality_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Locality_fp.h deleted file mode 100644 index c3298b1db..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Locality_fp.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _LOCALITY_FP_H_ -#define _LOCALITY_FP_H_ - -//** LocalityGetAttributes() -// This function will convert a locality expressed as an integer into -// TPMA_LOCALITY form. -// -// The function returns the locality attribute. -TPMA_LOCALITY -LocalityGetAttributes( - UINT8 locality // IN: locality value -); - -#endif // _LOCALITY_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MAC_Start_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MAC_Start_fp.h deleted file mode 100644 index aeec79cc0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MAC_Start_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_MAC_Start // Command must be enabled - -#ifndef _MAC_Start_FP_H_ -#define _MAC_Start_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT handle; - TPM2B_AUTH auth; - TPMI_ALG_MAC_SCHEME inScheme; -} MAC_Start_In; - -// Output structure definition -typedef struct { - TPMI_DH_OBJECT sequenceHandle; -} MAC_Start_Out; - -// Response code modifiers -#define RC_MAC_Start_handle (TPM_RC_H + TPM_RC_1) -#define RC_MAC_Start_auth (TPM_RC_P + TPM_RC_1) -#define RC_MAC_Start_inScheme (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_MAC_Start( - MAC_Start_In *in, - MAC_Start_Out *out -); - -#endif // _MAC_Start_FP_H_ -#endif // CC_MAC_Start diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MAC_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MAC_fp.h deleted file mode 100644 index fe9bf102e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MAC_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_MAC // Command must be enabled - -#ifndef _MAC_FP_H_ -#define _MAC_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT handle; - TPM2B_MAX_BUFFER buffer; - TPMI_ALG_MAC_SCHEME inScheme; -} MAC_In; - -// Output structure definition -typedef struct { - TPM2B_DIGEST outMAC; -} MAC_Out; - -// Response code modifiers -#define RC_MAC_handle (TPM_RC_H + TPM_RC_1) -#define RC_MAC_buffer (TPM_RC_P + TPM_RC_1) -#define RC_MAC_inScheme (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_MAC( - MAC_In *in, - MAC_Out *out -); - -#endif // _MAC_FP_H_ -#endif // CC_MAC diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MakeCredential_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MakeCredential_fp.h deleted file mode 100644 index f34b5b2ac..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MakeCredential_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_MakeCredential // Command must be enabled - -#ifndef _Make_Credential_FP_H_ -#define _Make_Credential_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT handle; - TPM2B_DIGEST credential; - TPM2B_NAME objectName; -} MakeCredential_In; - -// Output structure definition -typedef struct { - TPM2B_ID_OBJECT credentialBlob; - TPM2B_ENCRYPTED_SECRET secret; -} MakeCredential_Out; - -// Response code modifiers -#define RC_MakeCredential_handle (TPM_RC_H + TPM_RC_1) -#define RC_MakeCredential_credential (TPM_RC_P + TPM_RC_1) -#define RC_MakeCredential_objectName (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_MakeCredential( - MakeCredential_In *in, - MakeCredential_Out *out -); - -#endif // _Make_Credential_FP_H_ -#endif // CC_MakeCredential diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Manufacture_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Manufacture_fp.h deleted file mode 100644 index d3fd77ffc..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Manufacture_fp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _MANUFACTURE_FP_H_ -#define _MANUFACTURE_FP_H_ - -//*** TPM_Manufacture() -// This function initializes the TPM values in preparation for the TPM's first -// use. This function will fail if previously called. The TPM can be re-manufactured -// by calling TPM_Teardown() first and then calling this function again. -// Return Type: int -// 0 success -// 1 manufacturing process previously performed -LIB_EXPORT int -TPM_Manufacture( - int firstTime // IN: indicates if this is the first call from - // main() -); - -//*** TPM_TearDown() -// This function prepares the TPM for re-manufacture. It should not be implemented -// in anything other than a simulated TPM. -// -// In this implementation, all that is needs is to stop the cryptographic units -// and set a flag to indicate that the TPM can be re-manufactured. This should -// be all that is necessary to start the manufacturing process again. -// Return Type: int -// 0 success -// 1 TPM not previously manufactured -LIB_EXPORT int -TPM_TearDown( - void -); - -//*** TpmEndSimulation() -// This function is called at the end of the simulation run. It is used to provoke -// printing of any statistics that might be needed. -LIB_EXPORT void -TpmEndSimulation( - void -); - -#endif // _MANUFACTURE_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Marshal_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Marshal_fp.h deleted file mode 100644 index c0328a92a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Marshal_fp.h +++ /dev/null @@ -1,2408 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmMarshal; Version 4.1 Dec 10, 2018 - * Date: Apr 2, 2019 Time: 11:00:48AM - */ - -#ifndef _MARSHAL_FP_H_ -#define _MARSHAL_FP_H_ - -// Table 2:3 - Definition of Base Types -// UINT8 definition from table 2:3 -TPM_RC -UINT8_Unmarshal(UINT8 *target, BYTE **buffer, INT32 *size); -UINT16 -UINT8_Marshal(UINT8 *source, BYTE **buffer, INT32 *size); - -// BYTE definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -BYTE_Unmarshal(BYTE *target, BYTE **buffer, INT32 *size); -#else -#define BYTE_Unmarshal(target, buffer, size) \ - UINT8_Unmarshal((UINT8 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -BYTE_Marshal(BYTE *source, BYTE **buffer, INT32 *size); -#else -#define BYTE_Marshal(source, buffer, size) \ - UINT8_Marshal((UINT8 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// INT8 definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -INT8_Unmarshal(INT8 *target, BYTE **buffer, INT32 *size); -#else -#define INT8_Unmarshal(target, buffer, size) \ - UINT8_Unmarshal((UINT8 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -INT8_Marshal(INT8 *source, BYTE **buffer, INT32 *size); -#else -#define INT8_Marshal(source, buffer, size) \ - UINT8_Marshal((UINT8 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// UINT16 definition from table 2:3 -TPM_RC -UINT16_Unmarshal(UINT16 *target, BYTE **buffer, INT32 *size); -UINT16 -UINT16_Marshal(UINT16 *source, BYTE **buffer, INT32 *size); - -// INT16 definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -INT16_Unmarshal(INT16 *target, BYTE **buffer, INT32 *size); -#else -#define INT16_Unmarshal(target, buffer, size) \ - UINT16_Unmarshal((UINT16 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -INT16_Marshal(INT16 *source, BYTE **buffer, INT32 *size); -#else -#define INT16_Marshal(source, buffer, size) \ - UINT16_Marshal((UINT16 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// UINT32 definition from table 2:3 -TPM_RC -UINT32_Unmarshal(UINT32 *target, BYTE **buffer, INT32 *size); -UINT16 -UINT32_Marshal(UINT32 *source, BYTE **buffer, INT32 *size); - -// INT32 definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -INT32_Unmarshal(INT32 *target, BYTE **buffer, INT32 *size); -#else -#define INT32_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -INT32_Marshal(INT32 *source, BYTE **buffer, INT32 *size); -#else -#define INT32_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// UINT64 definition from table 2:3 -TPM_RC -UINT64_Unmarshal(UINT64 *target, BYTE **buffer, INT32 *size); -UINT16 -UINT64_Marshal(UINT64 *source, BYTE **buffer, INT32 *size); - -// INT64 definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -INT64_Unmarshal(INT64 *target, BYTE **buffer, INT32 *size); -#else -#define INT64_Unmarshal(target, buffer, size) \ - UINT64_Unmarshal((UINT64 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -INT64_Marshal(INT64 *source, BYTE **buffer, INT32 *size); -#else -#define INT64_Marshal(source, buffer, size) \ - UINT64_Marshal((UINT64 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:4 - Defines for Logic Values -// Table 2:5 - Definition of Types for Documentation Clarity -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_ALGORITHM_ID_Unmarshal(TPM_ALGORITHM_ID *target, BYTE **buffer, INT32 *size); -#else -#define TPM_ALGORITHM_ID_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_ALGORITHM_ID_Marshal(TPM_ALGORITHM_ID *source, BYTE **buffer, INT32 *size); -#else -#define TPM_ALGORITHM_ID_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_MODIFIER_INDICATOR_Unmarshal(TPM_MODIFIER_INDICATOR *target, - BYTE **buffer, INT32 *size); -#else -#define TPM_MODIFIER_INDICATOR_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_MODIFIER_INDICATOR_Marshal(TPM_MODIFIER_INDICATOR *source, - BYTE **buffer, INT32 *size); -#else -#define TPM_MODIFIER_INDICATOR_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_AUTHORIZATION_SIZE_Unmarshal(TPM_AUTHORIZATION_SIZE *target, - BYTE **buffer, INT32 *size); -#else -#define TPM_AUTHORIZATION_SIZE_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_AUTHORIZATION_SIZE_Marshal(TPM_AUTHORIZATION_SIZE *source, - BYTE **buffer, INT32 *size); -#else -#define TPM_AUTHORIZATION_SIZE_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_PARAMETER_SIZE_Unmarshal(TPM_PARAMETER_SIZE *target, - BYTE **buffer, INT32 *size); -#else -#define TPM_PARAMETER_SIZE_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_PARAMETER_SIZE_Marshal(TPM_PARAMETER_SIZE *source, BYTE **buffer, INT32 *size); -#else -#define TPM_PARAMETER_SIZE_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_KEY_SIZE_Unmarshal(TPM_KEY_SIZE *target, BYTE **buffer, INT32 *size); -#else -#define TPM_KEY_SIZE_Unmarshal(target, buffer, size) \ - UINT16_Unmarshal((UINT16 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_KEY_SIZE_Marshal(TPM_KEY_SIZE *source, BYTE **buffer, INT32 *size); -#else -#define TPM_KEY_SIZE_Marshal(source, buffer, size) \ - UINT16_Marshal((UINT16 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_KEY_BITS_Unmarshal(TPM_KEY_BITS *target, BYTE **buffer, INT32 *size); -#else -#define TPM_KEY_BITS_Unmarshal(target, buffer, size) \ - UINT16_Unmarshal((UINT16 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_KEY_BITS_Marshal(TPM_KEY_BITS *source, BYTE **buffer, INT32 *size); -#else -#define TPM_KEY_BITS_Marshal(source, buffer, size) \ - UINT16_Marshal((UINT16 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:6 - Definition of TPM_SPEC Constants -// Table 2:7 - Definition of TPM_GENERATED Constants -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_GENERATED_Marshal(TPM_GENERATED *source, BYTE **buffer, INT32 *size); -#else -#define TPM_GENERATED_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:9 - Definition of TPM_ALG_ID Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_ALG_ID_Unmarshal(TPM_ALG_ID *target, BYTE **buffer, INT32 *size); -#else -#define TPM_ALG_ID_Unmarshal(target, buffer, size) \ - UINT16_Unmarshal((UINT16 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_ALG_ID_Marshal(TPM_ALG_ID *source, BYTE **buffer, INT32 *size); -#else -#define TPM_ALG_ID_Marshal(source, buffer, size) \ - UINT16_Marshal((UINT16 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:10 - Definition of TPM_ECC_CURVE Constants -#if ALG_ECC -TPM_RC -TPM_ECC_CURVE_Unmarshal(TPM_ECC_CURVE *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_ECC_CURVE_Marshal(TPM_ECC_CURVE *source, BYTE **buffer, INT32 *size); -#else -#define TPM_ECC_CURVE_Marshal(source, buffer, size) \ - UINT16_Marshal((UINT16 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:12 - Definition of TPM_CC Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_CC_Unmarshal(TPM_CC *target, BYTE **buffer, INT32 *size); -#else -#define TPM_CC_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_CC_Marshal(TPM_CC *source, BYTE **buffer, INT32 *size); -#else -#define TPM_CC_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:16 - Definition of TPM_RC Constants -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_RC_Marshal(TPM_RC *source, BYTE **buffer, INT32 *size); -#else -#define TPM_RC_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:17 - Definition of TPM_CLOCK_ADJUST Constants -TPM_RC -TPM_CLOCK_ADJUST_Unmarshal(TPM_CLOCK_ADJUST *target, BYTE **buffer, INT32 *size); - -// Table 2:18 - Definition of TPM_EO Constants -TPM_RC -TPM_EO_Unmarshal(TPM_EO *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_EO_Marshal(TPM_EO *source, BYTE **buffer, INT32 *size); -#else -#define TPM_EO_Marshal(source, buffer, size) \ - UINT16_Marshal((UINT16 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:19 - Definition of TPM_ST Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_ST_Unmarshal(TPM_ST *target, BYTE **buffer, INT32 *size); -#else -#define TPM_ST_Unmarshal(target, buffer, size) \ - UINT16_Unmarshal((UINT16 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_ST_Marshal(TPM_ST *source, BYTE **buffer, INT32 *size); -#else -#define TPM_ST_Marshal(source, buffer, size) \ - UINT16_Marshal((UINT16 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:20 - Definition of TPM_SU Constants -TPM_RC -TPM_SU_Unmarshal(TPM_SU *target, BYTE **buffer, INT32 *size); - -// Table 2:21 - Definition of TPM_SE Constants -TPM_RC -TPM_SE_Unmarshal(TPM_SE *target, BYTE **buffer, INT32 *size); - -// Table 2:22 - Definition of TPM_CAP Constants -TPM_RC -TPM_CAP_Unmarshal(TPM_CAP *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_CAP_Marshal(TPM_CAP *source, BYTE **buffer, INT32 *size); -#else -#define TPM_CAP_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:23 - Definition of TPM_PT Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_PT_Unmarshal(TPM_PT *target, BYTE **buffer, INT32 *size); -#else -#define TPM_PT_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_PT_Marshal(TPM_PT *source, BYTE **buffer, INT32 *size); -#else -#define TPM_PT_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:24 - Definition of TPM_PT_PCR Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_PT_PCR_Unmarshal(TPM_PT_PCR *target, BYTE **buffer, INT32 *size); -#else -#define TPM_PT_PCR_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_PT_PCR_Marshal(TPM_PT_PCR *source, BYTE **buffer, INT32 *size); -#else -#define TPM_PT_PCR_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:25 - Definition of TPM_PS Constants -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_PS_Marshal(TPM_PS *source, BYTE **buffer, INT32 *size); -#else -#define TPM_PS_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:26 - Definition of Types for Handles -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_HANDLE_Unmarshal(TPM_HANDLE *target, BYTE **buffer, INT32 *size); -#else -#define TPM_HANDLE_Unmarshal(target, buffer, size) \ - UINT32_Unmarshal((UINT32 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_HANDLE_Marshal(TPM_HANDLE *source, BYTE **buffer, INT32 *size); -#else -#define TPM_HANDLE_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:27 - Definition of TPM_HT Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_HT_Unmarshal(TPM_HT *target, BYTE **buffer, INT32 *size); -#else -#define TPM_HT_Unmarshal(target, buffer, size) \ - UINT8_Unmarshal((UINT8 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_HT_Marshal(TPM_HT *source, BYTE **buffer, INT32 *size); -#else -#define TPM_HT_Marshal(source, buffer, size) \ - UINT8_Marshal((UINT8 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:28 - Definition of TPM_RH Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_RH_Unmarshal(TPM_RH *target, BYTE **buffer, INT32 *size); -#else -#define TPM_RH_Unmarshal(target, buffer, size) \ - TPM_HANDLE_Unmarshal((TPM_HANDLE *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_RH_Marshal(TPM_RH *source, BYTE **buffer, INT32 *size); -#else -#define TPM_RH_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:29 - Definition of TPM_HC Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_HC_Unmarshal(TPM_HC *target, BYTE **buffer, INT32 *size); -#else -#define TPM_HC_Unmarshal(target, buffer, size) \ - TPM_HANDLE_Unmarshal((TPM_HANDLE *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_HC_Marshal(TPM_HC *source, BYTE **buffer, INT32 *size); -#else -#define TPM_HC_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:30 - Definition of TPMA_ALGORITHM Bits -TPM_RC -TPMA_ALGORITHM_Unmarshal(TPMA_ALGORITHM *target, BYTE **buffer, INT32 *size); - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_ALGORITHM_Marshal(TPMA_ALGORITHM *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_ALGORITHM_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:31 - Definition of TPMA_OBJECT Bits -TPM_RC -TPMA_OBJECT_Unmarshal(TPMA_OBJECT *target, BYTE **buffer, INT32 *size); - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_OBJECT_Marshal(TPMA_OBJECT *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_OBJECT_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:32 - Definition of TPMA_SESSION Bits -TPM_RC -TPMA_SESSION_Unmarshal(TPMA_SESSION *target, BYTE **buffer, INT32 *size); - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_SESSION_Marshal(TPMA_SESSION *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_SESSION_Marshal(source, buffer, size) \ - UINT8_Marshal((UINT8 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:33 - Definition of TPMA_LOCALITY Bits -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMA_LOCALITY_Unmarshal(TPMA_LOCALITY *target, BYTE **buffer, INT32 *size); -#else -#define TPMA_LOCALITY_Unmarshal(target, buffer, size) \ - UINT8_Unmarshal((UINT8 *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_LOCALITY_Marshal(TPMA_LOCALITY *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_LOCALITY_Marshal(source, buffer, size) \ - UINT8_Marshal((UINT8 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:34 - Definition of TPMA_PERMANENT Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_PERMANENT_Marshal(TPMA_PERMANENT *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_PERMANENT_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:35 - Definition of TPMA_STARTUP_CLEAR Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_STARTUP_CLEAR_Marshal(TPMA_STARTUP_CLEAR *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_STARTUP_CLEAR_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:36 - Definition of TPMA_MEMORY Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_MEMORY_Marshal(TPMA_MEMORY *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_MEMORY_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:37 - Definition of TPMA_CC Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_CC_Marshal(TPMA_CC *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_CC_Marshal(source, buffer, size) \ - TPM_CC_Marshal((TPM_CC *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:38 - Definition of TPMA_MODES Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_MODES_Marshal(TPMA_MODES *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_MODES_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:39 - Definition of TPMA_X509_KEY_USAGE Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_X509_KEY_USAGE_Marshal(TPMA_X509_KEY_USAGE *source, - BYTE **buffer, INT32 *size); -#else -#define TPMA_X509_KEY_USAGE_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:40 - Definition of TPMI_YES_NO Type -TPM_RC -TPMI_YES_NO_Unmarshal(TPMI_YES_NO *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_YES_NO_Marshal(TPMI_YES_NO *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_YES_NO_Marshal(source, buffer, size) \ - BYTE_Marshal((BYTE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:41 - Definition of TPMI_DH_OBJECT Type -TPM_RC -TPMI_DH_OBJECT_Unmarshal(TPMI_DH_OBJECT *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_OBJECT_Marshal(TPMI_DH_OBJECT *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_DH_OBJECT_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:42 - Definition of TPMI_DH_PARENT Type -TPM_RC -TPMI_DH_PARENT_Unmarshal(TPMI_DH_PARENT *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_PARENT_Marshal(TPMI_DH_PARENT *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_DH_PARENT_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:43 - Definition of TPMI_DH_PERSISTENT Type -TPM_RC -TPMI_DH_PERSISTENT_Unmarshal(TPMI_DH_PERSISTENT *target, - BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_PERSISTENT_Marshal(TPMI_DH_PERSISTENT *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_DH_PERSISTENT_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:44 - Definition of TPMI_DH_ENTITY Type -TPM_RC -TPMI_DH_ENTITY_Unmarshal(TPMI_DH_ENTITY *target, - BYTE **buffer, INT32 *size, BOOL flag); - -// Table 2:45 - Definition of TPMI_DH_PCR Type -TPM_RC -TPMI_DH_PCR_Unmarshal(TPMI_DH_PCR *target, BYTE **buffer, INT32 *size, BOOL flag); - -// Table 2:46 - Definition of TPMI_SH_AUTH_SESSION Type -TPM_RC -TPMI_SH_AUTH_SESSION_Unmarshal(TPMI_SH_AUTH_SESSION *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_SH_AUTH_SESSION_Marshal(TPMI_SH_AUTH_SESSION *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_SH_AUTH_SESSION_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:47 - Definition of TPMI_SH_HMAC Type -TPM_RC -TPMI_SH_HMAC_Unmarshal(TPMI_SH_HMAC *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_SH_HMAC_Marshal(TPMI_SH_HMAC *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_SH_HMAC_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:48 - Definition of TPMI_SH_POLICY Type -TPM_RC -TPMI_SH_POLICY_Unmarshal(TPMI_SH_POLICY *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_SH_POLICY_Marshal(TPMI_SH_POLICY *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_SH_POLICY_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:49 - Definition of TPMI_DH_CONTEXT Type -TPM_RC -TPMI_DH_CONTEXT_Unmarshal(TPMI_DH_CONTEXT *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_CONTEXT_Marshal(TPMI_DH_CONTEXT *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_DH_CONTEXT_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:50 - Definition of TPMI_DH_SAVED Type -TPM_RC -TPMI_DH_SAVED_Unmarshal(TPMI_DH_SAVED *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_SAVED_Marshal(TPMI_DH_SAVED *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_DH_SAVED_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:51 - Definition of TPMI_RH_HIERARCHY Type -TPM_RC -TPMI_RH_HIERARCHY_Unmarshal(TPMI_RH_HIERARCHY *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_RH_HIERARCHY_Marshal(TPMI_RH_HIERARCHY *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_RH_HIERARCHY_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:52 - Definition of TPMI_RH_ENABLES Type -TPM_RC -TPMI_RH_ENABLES_Unmarshal(TPMI_RH_ENABLES *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_RH_ENABLES_Marshal(TPMI_RH_ENABLES *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_RH_ENABLES_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:53 - Definition of TPMI_RH_HIERARCHY_AUTH Type -TPM_RC -TPMI_RH_HIERARCHY_AUTH_Unmarshal(TPMI_RH_HIERARCHY_AUTH *target, - BYTE **buffer, INT32 *size); - -// Table 2:54 - Definition of TPMI_RH_PLATFORM Type -TPM_RC -TPMI_RH_PLATFORM_Unmarshal(TPMI_RH_PLATFORM *target, BYTE **buffer, INT32 *size); - -// Table 2:55 - Definition of TPMI_RH_OWNER Type -TPM_RC -TPMI_RH_OWNER_Unmarshal(TPMI_RH_OWNER *target, - BYTE **buffer, INT32 *size, BOOL flag); - -// Table 2:56 - Definition of TPMI_RH_ENDORSEMENT Type -TPM_RC -TPMI_RH_ENDORSEMENT_Unmarshal(TPMI_RH_ENDORSEMENT *target, - BYTE **buffer, INT32 *size, BOOL flag); - -// Table 2:57 - Definition of TPMI_RH_PROVISION Type -TPM_RC -TPMI_RH_PROVISION_Unmarshal(TPMI_RH_PROVISION *target, BYTE **buffer, INT32 *size); - -// Table 2:58 - Definition of TPMI_RH_CLEAR Type -TPM_RC -TPMI_RH_CLEAR_Unmarshal(TPMI_RH_CLEAR *target, BYTE **buffer, INT32 *size); - -// Table 2:59 - Definition of TPMI_RH_NV_AUTH Type -TPM_RC -TPMI_RH_NV_AUTH_Unmarshal(TPMI_RH_NV_AUTH *target, BYTE **buffer, INT32 *size); - -// Table 2:60 - Definition of TPMI_RH_LOCKOUT Type -TPM_RC -TPMI_RH_LOCKOUT_Unmarshal(TPMI_RH_LOCKOUT *target, BYTE **buffer, INT32 *size); - -// Table 2:61 - Definition of TPMI_RH_NV_INDEX Type -TPM_RC -TPMI_RH_NV_INDEX_Unmarshal(TPMI_RH_NV_INDEX *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_RH_NV_INDEX_Marshal(TPMI_RH_NV_INDEX *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_RH_NV_INDEX_Marshal(source, buffer, size) \ - TPM_HANDLE_Marshal((TPM_HANDLE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:62 - Definition of TPMI_RH_AC Type -TPM_RC -TPMI_RH_AC_Unmarshal(TPMI_RH_AC *target, BYTE **buffer, INT32 *size); - -// Table 2:63 - Definition of TPMI_ALG_HASH Type -TPM_RC -TPMI_ALG_HASH_Unmarshal(TPMI_ALG_HASH *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_HASH_Marshal(TPMI_ALG_HASH *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_HASH_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:64 - Definition of TPMI_ALG_ASYM Type -TPM_RC -TPMI_ALG_ASYM_Unmarshal(TPMI_ALG_ASYM *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_ASYM_Marshal(TPMI_ALG_ASYM *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_ASYM_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:65 - Definition of TPMI_ALG_SYM Type -TPM_RC -TPMI_ALG_SYM_Unmarshal(TPMI_ALG_SYM *target, BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_SYM_Marshal(TPMI_ALG_SYM *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_SYM_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:66 - Definition of TPMI_ALG_SYM_OBJECT Type -TPM_RC -TPMI_ALG_SYM_OBJECT_Unmarshal(TPMI_ALG_SYM_OBJECT *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_SYM_OBJECT_Marshal(TPMI_ALG_SYM_OBJECT *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_SYM_OBJECT_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:67 - Definition of TPMI_ALG_SYM_MODE Type -TPM_RC -TPMI_ALG_SYM_MODE_Unmarshal(TPMI_ALG_SYM_MODE *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_SYM_MODE_Marshal(TPMI_ALG_SYM_MODE *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_SYM_MODE_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:68 - Definition of TPMI_ALG_KDF Type -TPM_RC -TPMI_ALG_KDF_Unmarshal(TPMI_ALG_KDF *target, BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_KDF_Marshal(TPMI_ALG_KDF *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_KDF_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:69 - Definition of TPMI_ALG_SIG_SCHEME Type -TPM_RC -TPMI_ALG_SIG_SCHEME_Unmarshal(TPMI_ALG_SIG_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_SIG_SCHEME_Marshal(TPMI_ALG_SIG_SCHEME *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_SIG_SCHEME_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:70 - Definition of TPMI_ECC_KEY_EXCHANGE Type -#if ALG_ECC -TPM_RC -TPMI_ECC_KEY_EXCHANGE_Unmarshal(TPMI_ECC_KEY_EXCHANGE *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ECC_KEY_EXCHANGE_Marshal(TPMI_ECC_KEY_EXCHANGE *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ECC_KEY_EXCHANGE_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:71 - Definition of TPMI_ST_COMMAND_TAG Type -TPM_RC -TPMI_ST_COMMAND_TAG_Unmarshal(TPMI_ST_COMMAND_TAG *target, - BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ST_COMMAND_TAG_Marshal(TPMI_ST_COMMAND_TAG *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ST_COMMAND_TAG_Marshal(source, buffer, size) \ - TPM_ST_Marshal((TPM_ST *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:72 - Definition of TPMI_ALG_MAC_SCHEME Type -TPM_RC -TPMI_ALG_MAC_SCHEME_Unmarshal(TPMI_ALG_MAC_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_MAC_SCHEME_Marshal(TPMI_ALG_MAC_SCHEME *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_MAC_SCHEME_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:73 - Definition of TPMI_ALG_CIPHER_MODE Type -TPM_RC -TPMI_ALG_CIPHER_MODE_Unmarshal(TPMI_ALG_CIPHER_MODE *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_CIPHER_MODE_Marshal(TPMI_ALG_CIPHER_MODE *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_CIPHER_MODE_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:74 - Definition of TPMS_EMPTY Structure -TPM_RC -TPMS_EMPTY_Unmarshal(TPMS_EMPTY *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_EMPTY_Marshal(TPMS_EMPTY *source, BYTE **buffer, INT32 *size); - -// Table 2:75 - Definition of TPMS_ALGORITHM_DESCRIPTION Structure -UINT16 -TPMS_ALGORITHM_DESCRIPTION_Marshal(TPMS_ALGORITHM_DESCRIPTION *source, - BYTE **buffer, INT32 *size); - -// Table 2:76 - Definition of TPMU_HA Union -TPM_RC -TPMU_HA_Unmarshal(TPMU_HA *target, BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_HA_Marshal(TPMU_HA *source, BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:77 - Definition of TPMT_HA Structure -TPM_RC -TPMT_HA_Unmarshal(TPMT_HA *target, BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_HA_Marshal(TPMT_HA *source, BYTE **buffer, INT32 *size); - -// Table 2:78 - Definition of TPM2B_DIGEST Structure -TPM_RC -TPM2B_DIGEST_Unmarshal(TPM2B_DIGEST *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_DIGEST_Marshal(TPM2B_DIGEST *source, BYTE **buffer, INT32 *size); - -// Table 2:79 - Definition of TPM2B_DATA Structure -TPM_RC -TPM2B_DATA_Unmarshal(TPM2B_DATA *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_DATA_Marshal(TPM2B_DATA *source, BYTE **buffer, INT32 *size); - -// Table 2:80 - Definition of Types for TPM2B_NONCE -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM2B_NONCE_Unmarshal(TPM2B_NONCE *target, BYTE **buffer, INT32 *size); -#else -#define TPM2B_NONCE_Unmarshal(target, buffer, size) \ - TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM2B_NONCE_Marshal(TPM2B_NONCE *source, BYTE **buffer, INT32 *size); -#else -#define TPM2B_NONCE_Marshal(source, buffer, size) \ - TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:81 - Definition of Types for TPM2B_AUTH -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM2B_AUTH_Unmarshal(TPM2B_AUTH *target, BYTE **buffer, INT32 *size); -#else -#define TPM2B_AUTH_Unmarshal(target, buffer, size) \ - TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM2B_AUTH_Marshal(TPM2B_AUTH *source, BYTE **buffer, INT32 *size); -#else -#define TPM2B_AUTH_Marshal(source, buffer, size) \ - TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:82 - Definition of Types for TPM2B_OPERAND -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM2B_OPERAND_Unmarshal(TPM2B_OPERAND *target, BYTE **buffer, INT32 *size); -#else -#define TPM2B_OPERAND_Unmarshal(target, buffer, size) \ - TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPM2B_OPERAND_Marshal(TPM2B_OPERAND *source, BYTE **buffer, INT32 *size); -#else -#define TPM2B_OPERAND_Marshal(source, buffer, size) \ - TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:83 - Definition of TPM2B_EVENT Structure -TPM_RC -TPM2B_EVENT_Unmarshal(TPM2B_EVENT *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_EVENT_Marshal(TPM2B_EVENT *source, BYTE **buffer, INT32 *size); - -// Table 2:84 - Definition of TPM2B_MAX_BUFFER Structure -TPM_RC -TPM2B_MAX_BUFFER_Unmarshal(TPM2B_MAX_BUFFER *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_MAX_BUFFER_Marshal(TPM2B_MAX_BUFFER *source, BYTE **buffer, INT32 *size); - -// Table 2:85 - Definition of TPM2B_MAX_NV_BUFFER Structure -TPM_RC -TPM2B_MAX_NV_BUFFER_Unmarshal(TPM2B_MAX_NV_BUFFER *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_MAX_NV_BUFFER_Marshal(TPM2B_MAX_NV_BUFFER *source, - BYTE **buffer, INT32 *size); - -// Table 2:86 - Definition of TPM2B_TIMEOUT Structure -TPM_RC -TPM2B_TIMEOUT_Unmarshal(TPM2B_TIMEOUT *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_TIMEOUT_Marshal(TPM2B_TIMEOUT *source, BYTE **buffer, INT32 *size); - -// Table 2:87 - Definition of TPM2B_IV Structure -TPM_RC -TPM2B_IV_Unmarshal(TPM2B_IV *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_IV_Marshal(TPM2B_IV *source, BYTE **buffer, INT32 *size); - -// Table 2:88 - Definition of TPMU_NAME Union -// Table 2:89 - Definition of TPM2B_NAME Structure -TPM_RC -TPM2B_NAME_Unmarshal(TPM2B_NAME *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_NAME_Marshal(TPM2B_NAME *source, BYTE **buffer, INT32 *size); - -// Table 2:90 - Definition of TPMS_PCR_SELECT Structure -TPM_RC -TPMS_PCR_SELECT_Unmarshal(TPMS_PCR_SELECT *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_PCR_SELECT_Marshal(TPMS_PCR_SELECT *source, BYTE **buffer, INT32 *size); - -// Table 2:91 - Definition of TPMS_PCR_SELECTION Structure -TPM_RC -TPMS_PCR_SELECTION_Unmarshal(TPMS_PCR_SELECTION *target, - BYTE **buffer, INT32 *size); -UINT16 -TPMS_PCR_SELECTION_Marshal(TPMS_PCR_SELECTION *source, BYTE **buffer, INT32 *size); - -// Table 2:94 - Definition of TPMT_TK_CREATION Structure -TPM_RC -TPMT_TK_CREATION_Unmarshal(TPMT_TK_CREATION *target, BYTE **buffer, INT32 *size); -UINT16 -TPMT_TK_CREATION_Marshal(TPMT_TK_CREATION *source, BYTE **buffer, INT32 *size); - -// Table 2:95 - Definition of TPMT_TK_VERIFIED Structure -TPM_RC -TPMT_TK_VERIFIED_Unmarshal(TPMT_TK_VERIFIED *target, BYTE **buffer, INT32 *size); -UINT16 -TPMT_TK_VERIFIED_Marshal(TPMT_TK_VERIFIED *source, BYTE **buffer, INT32 *size); - -// Table 2:96 - Definition of TPMT_TK_AUTH Structure -TPM_RC -TPMT_TK_AUTH_Unmarshal(TPMT_TK_AUTH *target, BYTE **buffer, INT32 *size); -UINT16 -TPMT_TK_AUTH_Marshal(TPMT_TK_AUTH *source, BYTE **buffer, INT32 *size); - -// Table 2:97 - Definition of TPMT_TK_HASHCHECK Structure -TPM_RC -TPMT_TK_HASHCHECK_Unmarshal(TPMT_TK_HASHCHECK *target, BYTE **buffer, INT32 *size); -UINT16 -TPMT_TK_HASHCHECK_Marshal(TPMT_TK_HASHCHECK *source, BYTE **buffer, INT32 *size); - -// Table 2:98 - Definition of TPMS_ALG_PROPERTY Structure -UINT16 -TPMS_ALG_PROPERTY_Marshal(TPMS_ALG_PROPERTY *source, BYTE **buffer, INT32 *size); - -// Table 2:99 - Definition of TPMS_TAGGED_PROPERTY Structure -UINT16 -TPMS_TAGGED_PROPERTY_Marshal(TPMS_TAGGED_PROPERTY *source, - BYTE **buffer, INT32 *size); - -// Table 2:100 - Definition of TPMS_TAGGED_PCR_SELECT Structure -UINT16 -TPMS_TAGGED_PCR_SELECT_Marshal(TPMS_TAGGED_PCR_SELECT *source, - BYTE **buffer, INT32 *size); - -// Table 2:101 - Definition of TPMS_TAGGED_POLICY Structure -UINT16 -TPMS_TAGGED_POLICY_Marshal(TPMS_TAGGED_POLICY *source, BYTE **buffer, INT32 *size); - -// Table 2:102 - Definition of TPML_CC Structure -TPM_RC -TPML_CC_Unmarshal(TPML_CC *target, BYTE **buffer, INT32 *size); -UINT16 -TPML_CC_Marshal(TPML_CC *source, BYTE **buffer, INT32 *size); - -// Table 2:103 - Definition of TPML_CCA Structure -UINT16 -TPML_CCA_Marshal(TPML_CCA *source, BYTE **buffer, INT32 *size); - -// Table 2:104 - Definition of TPML_ALG Structure -TPM_RC -TPML_ALG_Unmarshal(TPML_ALG *target, BYTE **buffer, INT32 *size); -UINT16 -TPML_ALG_Marshal(TPML_ALG *source, BYTE **buffer, INT32 *size); - -// Table 2:105 - Definition of TPML_HANDLE Structure -UINT16 -TPML_HANDLE_Marshal(TPML_HANDLE *source, BYTE **buffer, INT32 *size); - -// Table 2:106 - Definition of TPML_DIGEST Structure -TPM_RC -TPML_DIGEST_Unmarshal(TPML_DIGEST *target, BYTE **buffer, INT32 *size); -UINT16 -TPML_DIGEST_Marshal(TPML_DIGEST *source, BYTE **buffer, INT32 *size); - -// Table 2:107 - Definition of TPML_DIGEST_VALUES Structure -TPM_RC -TPML_DIGEST_VALUES_Unmarshal(TPML_DIGEST_VALUES *target, - BYTE **buffer, INT32 *size); -UINT16 -TPML_DIGEST_VALUES_Marshal(TPML_DIGEST_VALUES *source, BYTE **buffer, INT32 *size); - -// Table 2:108 - Definition of TPML_PCR_SELECTION Structure -TPM_RC -TPML_PCR_SELECTION_Unmarshal(TPML_PCR_SELECTION *target, - BYTE **buffer, INT32 *size); -UINT16 -TPML_PCR_SELECTION_Marshal(TPML_PCR_SELECTION *source, BYTE **buffer, INT32 *size); - -// Table 2:109 - Definition of TPML_ALG_PROPERTY Structure -UINT16 -TPML_ALG_PROPERTY_Marshal(TPML_ALG_PROPERTY *source, BYTE **buffer, INT32 *size); - -// Table 2:110 - Definition of TPML_TAGGED_TPM_PROPERTY Structure -UINT16 -TPML_TAGGED_TPM_PROPERTY_Marshal(TPML_TAGGED_TPM_PROPERTY *source, - BYTE **buffer, INT32 *size); - -// Table 2:111 - Definition of TPML_TAGGED_PCR_PROPERTY Structure -UINT16 -TPML_TAGGED_PCR_PROPERTY_Marshal(TPML_TAGGED_PCR_PROPERTY *source, - BYTE **buffer, INT32 *size); - -// Table 2:112 - Definition of TPML_ECC_CURVE Structure -#if ALG_ECC -UINT16 -TPML_ECC_CURVE_Marshal(TPML_ECC_CURVE *source, BYTE **buffer, INT32 *size); -#endif // ALG_ECC - -// Table 2:113 - Definition of TPML_TAGGED_POLICY Structure -UINT16 -TPML_TAGGED_POLICY_Marshal(TPML_TAGGED_POLICY *source, BYTE **buffer, INT32 *size); - -// Table 2:114 - Definition of TPMU_CAPABILITIES Union -UINT16 -TPMU_CAPABILITIES_Marshal(TPMU_CAPABILITIES *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:115 - Definition of TPMS_CAPABILITY_DATA Structure -UINT16 -TPMS_CAPABILITY_DATA_Marshal(TPMS_CAPABILITY_DATA *source, - BYTE **buffer, INT32 *size); - -// Table 2:116 - Definition of TPMS_CLOCK_INFO Structure -TPM_RC -TPMS_CLOCK_INFO_Unmarshal(TPMS_CLOCK_INFO *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_CLOCK_INFO_Marshal(TPMS_CLOCK_INFO *source, BYTE **buffer, INT32 *size); - -// Table 2:117 - Definition of TPMS_TIME_INFO Structure -TPM_RC -TPMS_TIME_INFO_Unmarshal(TPMS_TIME_INFO *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_TIME_INFO_Marshal(TPMS_TIME_INFO *source, BYTE **buffer, INT32 *size); - -// Table 2:118 - Definition of TPMS_TIME_ATTEST_INFO Structure -UINT16 -TPMS_TIME_ATTEST_INFO_Marshal(TPMS_TIME_ATTEST_INFO *source, - BYTE **buffer, INT32 *size); - -// Table 2:119 - Definition of TPMS_CERTIFY_INFO Structure -UINT16 -TPMS_CERTIFY_INFO_Marshal(TPMS_CERTIFY_INFO *source, BYTE **buffer, INT32 *size); - -// Table 2:120 - Definition of TPMS_QUOTE_INFO Structure -UINT16 -TPMS_QUOTE_INFO_Marshal(TPMS_QUOTE_INFO *source, BYTE **buffer, INT32 *size); - -// Table 2:121 - Definition of TPMS_COMMAND_AUDIT_INFO Structure -UINT16 -TPMS_COMMAND_AUDIT_INFO_Marshal(TPMS_COMMAND_AUDIT_INFO *source, - BYTE **buffer, INT32 *size); - -// Table 2:122 - Definition of TPMS_SESSION_AUDIT_INFO Structure -UINT16 -TPMS_SESSION_AUDIT_INFO_Marshal(TPMS_SESSION_AUDIT_INFO *source, - BYTE **buffer, INT32 *size); - -// Table 2:123 - Definition of TPMS_CREATION_INFO Structure -UINT16 -TPMS_CREATION_INFO_Marshal(TPMS_CREATION_INFO *source, BYTE **buffer, INT32 *size); - -// Table 2:124 - Definition of TPMS_NV_CERTIFY_INFO Structure -UINT16 -TPMS_NV_CERTIFY_INFO_Marshal(TPMS_NV_CERTIFY_INFO *source, - BYTE **buffer, INT32 *size); - -// Table 2:125 - Definition of TPMS_NV_DIGEST_CERTIFY_INFO Structure -UINT16 -TPMS_NV_DIGEST_CERTIFY_INFO_Marshal(TPMS_NV_DIGEST_CERTIFY_INFO *source, - BYTE **buffer, INT32 *size); - -// Table 2:126 - Definition of TPMI_ST_ATTEST Type -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ST_ATTEST_Marshal(TPMI_ST_ATTEST *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_ST_ATTEST_Marshal(source, buffer, size) \ - TPM_ST_Marshal((TPM_ST *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:127 - Definition of TPMU_ATTEST Union -UINT16 -TPMU_ATTEST_Marshal(TPMU_ATTEST *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:128 - Definition of TPMS_ATTEST Structure -UINT16 -TPMS_ATTEST_Marshal(TPMS_ATTEST *source, BYTE **buffer, INT32 *size); - -// Table 2:129 - Definition of TPM2B_ATTEST Structure -UINT16 -TPM2B_ATTEST_Marshal(TPM2B_ATTEST *source, BYTE **buffer, INT32 *size); - -// Table 2:130 - Definition of TPMS_AUTH_COMMAND Structure -TPM_RC -TPMS_AUTH_COMMAND_Unmarshal(TPMS_AUTH_COMMAND *target, BYTE **buffer, INT32 *size); - -// Table 2:131 - Definition of TPMS_AUTH_RESPONSE Structure -UINT16 -TPMS_AUTH_RESPONSE_Marshal(TPMS_AUTH_RESPONSE *source, BYTE **buffer, INT32 *size); - -// Table 2:132 - Definition of TPMI_TDES_KEY_BITS Type -#if ALG_TDES -TPM_RC -TPMI_TDES_KEY_BITS_Unmarshal(TPMI_TDES_KEY_BITS *target, - BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_TDES_KEY_BITS_Marshal(TPMI_TDES_KEY_BITS *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_TDES_KEY_BITS_Marshal(source, buffer, size) \ - TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_TDES - -// Table 2:132 - Definition of TPMI_AES_KEY_BITS Type -#if ALG_AES -TPM_RC -TPMI_AES_KEY_BITS_Unmarshal(TPMI_AES_KEY_BITS *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_AES_KEY_BITS_Marshal(TPMI_AES_KEY_BITS *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_AES_KEY_BITS_Marshal(source, buffer, size) \ - TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_AES - -// Table 2:132 - Definition of TPMI_SM4_KEY_BITS Type -#if ALG_SM4 -TPM_RC -TPMI_SM4_KEY_BITS_Unmarshal(TPMI_SM4_KEY_BITS *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_SM4_KEY_BITS_Marshal(TPMI_SM4_KEY_BITS *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_SM4_KEY_BITS_Marshal(source, buffer, size) \ - TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_SM4 - -// Table 2:132 - Definition of TPMI_CAMELLIA_KEY_BITS Type -#if ALG_CAMELLIA -TPM_RC -TPMI_CAMELLIA_KEY_BITS_Unmarshal(TPMI_CAMELLIA_KEY_BITS *target, - BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_CAMELLIA_KEY_BITS_Marshal(TPMI_CAMELLIA_KEY_BITS *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_CAMELLIA_KEY_BITS_Marshal(source, buffer, size) \ - TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_CAMELLIA - -// Table 2:133 - Definition of TPMU_SYM_KEY_BITS Union -TPM_RC -TPMU_SYM_KEY_BITS_Unmarshal(TPMU_SYM_KEY_BITS *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_SYM_KEY_BITS_Marshal(TPMU_SYM_KEY_BITS *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:134 - Definition of TPMU_SYM_MODE Union -TPM_RC -TPMU_SYM_MODE_Unmarshal(TPMU_SYM_MODE *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_SYM_MODE_Marshal(TPMU_SYM_MODE *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:136 - Definition of TPMT_SYM_DEF Structure -TPM_RC -TPMT_SYM_DEF_Unmarshal(TPMT_SYM_DEF *target, BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_SYM_DEF_Marshal(TPMT_SYM_DEF *source, BYTE **buffer, INT32 *size); - -// Table 2:137 - Definition of TPMT_SYM_DEF_OBJECT Structure -TPM_RC -TPMT_SYM_DEF_OBJECT_Unmarshal(TPMT_SYM_DEF_OBJECT *target, - BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_SYM_DEF_OBJECT_Marshal(TPMT_SYM_DEF_OBJECT *source, - BYTE **buffer, INT32 *size); - -// Table 2:138 - Definition of TPM2B_SYM_KEY Structure -TPM_RC -TPM2B_SYM_KEY_Unmarshal(TPM2B_SYM_KEY *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_SYM_KEY_Marshal(TPM2B_SYM_KEY *source, BYTE **buffer, INT32 *size); - -// Table 2:139 - Definition of TPMS_SYMCIPHER_PARMS Structure -TPM_RC -TPMS_SYMCIPHER_PARMS_Unmarshal(TPMS_SYMCIPHER_PARMS *target, - BYTE **buffer, INT32 *size); -UINT16 -TPMS_SYMCIPHER_PARMS_Marshal(TPMS_SYMCIPHER_PARMS *source, - BYTE **buffer, INT32 *size); - -// Table 2:140 - Definition of TPM2B_LABEL Structure -TPM_RC -TPM2B_LABEL_Unmarshal(TPM2B_LABEL *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_LABEL_Marshal(TPM2B_LABEL *source, BYTE **buffer, INT32 *size); - -// Table 2:141 - Definition of TPMS_DERIVE Structure -TPM_RC -TPMS_DERIVE_Unmarshal(TPMS_DERIVE *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_DERIVE_Marshal(TPMS_DERIVE *source, BYTE **buffer, INT32 *size); - -// Table 2:142 - Definition of TPM2B_DERIVE Structure -TPM_RC -TPM2B_DERIVE_Unmarshal(TPM2B_DERIVE *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_DERIVE_Marshal(TPM2B_DERIVE *source, BYTE **buffer, INT32 *size); - -// Table 2:143 - Definition of TPMU_SENSITIVE_CREATE Union -// Table 2:144 - Definition of TPM2B_SENSITIVE_DATA Structure -TPM_RC -TPM2B_SENSITIVE_DATA_Unmarshal(TPM2B_SENSITIVE_DATA *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_SENSITIVE_DATA_Marshal(TPM2B_SENSITIVE_DATA *source, - BYTE **buffer, INT32 *size); - -// Table 2:145 - Definition of TPMS_SENSITIVE_CREATE Structure -TPM_RC -TPMS_SENSITIVE_CREATE_Unmarshal(TPMS_SENSITIVE_CREATE *target, - BYTE **buffer, INT32 *size); - -// Table 2:146 - Definition of TPM2B_SENSITIVE_CREATE Structure -TPM_RC -TPM2B_SENSITIVE_CREATE_Unmarshal(TPM2B_SENSITIVE_CREATE *target, - BYTE **buffer, INT32 *size); - -// Table 2:147 - Definition of TPMS_SCHEME_HASH Structure -TPM_RC -TPMS_SCHEME_HASH_Unmarshal(TPMS_SCHEME_HASH *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_SCHEME_HASH_Marshal(TPMS_SCHEME_HASH *source, BYTE **buffer, INT32 *size); - -// Table 2:148 - Definition of TPMS_SCHEME_ECDAA Structure -#if ALG_ECC -TPM_RC -TPMS_SCHEME_ECDAA_Unmarshal(TPMS_SCHEME_ECDAA *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_SCHEME_ECDAA_Marshal(TPMS_SCHEME_ECDAA *source, BYTE **buffer, INT32 *size); -#endif // ALG_ECC - -// Table 2:149 - Definition of TPMI_ALG_KEYEDHASH_SCHEME Type -TPM_RC -TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_KEYEDHASH_SCHEME_Marshal(TPMI_ALG_KEYEDHASH_SCHEME *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_KEYEDHASH_SCHEME_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:150 - Definition of Types for HMAC_SIG_SCHEME -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SCHEME_HMAC_Unmarshal(TPMS_SCHEME_HMAC *target, BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_HMAC_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SCHEME_HMAC_Marshal(TPMS_SCHEME_HMAC *source, BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_HMAC_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:151 - Definition of TPMS_SCHEME_XOR Structure -TPM_RC -TPMS_SCHEME_XOR_Unmarshal(TPMS_SCHEME_XOR *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_SCHEME_XOR_Marshal(TPMS_SCHEME_XOR *source, BYTE **buffer, INT32 *size); - -// Table 2:152 - Definition of TPMU_SCHEME_KEYEDHASH Union -TPM_RC -TPMU_SCHEME_KEYEDHASH_Unmarshal(TPMU_SCHEME_KEYEDHASH *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_SCHEME_KEYEDHASH_Marshal(TPMU_SCHEME_KEYEDHASH *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:153 - Definition of TPMT_KEYEDHASH_SCHEME Structure -TPM_RC -TPMT_KEYEDHASH_SCHEME_Unmarshal(TPMT_KEYEDHASH_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_KEYEDHASH_SCHEME_Marshal(TPMT_KEYEDHASH_SCHEME *source, - BYTE **buffer, INT32 *size); - -// Table 2:154 - Definition of Types for RSA Signature Schemes -#if ALG_RSA -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIG_SCHEME_RSASSA_Unmarshal(TPMS_SIG_SCHEME_RSASSA *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_RSASSA_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIG_SCHEME_RSASSA_Marshal(TPMS_SIG_SCHEME_RSASSA *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_RSASSA_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIG_SCHEME_RSAPSS_Unmarshal(TPMS_SIG_SCHEME_RSAPSS *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_RSAPSS_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIG_SCHEME_RSAPSS_Marshal(TPMS_SIG_SCHEME_RSAPSS *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_RSAPSS_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:155 - Definition of Types for ECC Signature Schemes -#if ALG_ECC -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIG_SCHEME_ECDSA_Unmarshal(TPMS_SIG_SCHEME_ECDSA *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_ECDSA_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIG_SCHEME_ECDSA_Marshal(TPMS_SIG_SCHEME_ECDSA *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_ECDSA_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIG_SCHEME_SM2_Unmarshal(TPMS_SIG_SCHEME_SM2 *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_SM2_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIG_SCHEME_SM2_Marshal(TPMS_SIG_SCHEME_SM2 *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_SM2_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal(TPMS_SIG_SCHEME_ECSCHNORR *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIG_SCHEME_ECSCHNORR_Marshal(TPMS_SIG_SCHEME_ECSCHNORR *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_ECSCHNORR_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIG_SCHEME_ECDAA_Unmarshal(TPMS_SIG_SCHEME_ECDAA *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_ECDAA_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_ECDAA_Unmarshal((TPMS_SCHEME_ECDAA *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIG_SCHEME_ECDAA_Marshal(TPMS_SIG_SCHEME_ECDAA *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIG_SCHEME_ECDAA_Marshal(source, buffer, size) \ - TPMS_SCHEME_ECDAA_Marshal((TPMS_SCHEME_ECDAA *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:156 - Definition of TPMU_SIG_SCHEME Union -TPM_RC -TPMU_SIG_SCHEME_Unmarshal(TPMU_SIG_SCHEME *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_SIG_SCHEME_Marshal(TPMU_SIG_SCHEME *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:157 - Definition of TPMT_SIG_SCHEME Structure -TPM_RC -TPMT_SIG_SCHEME_Unmarshal(TPMT_SIG_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_SIG_SCHEME_Marshal(TPMT_SIG_SCHEME *source, BYTE **buffer, INT32 *size); - -// Table 2:158 - Definition of Types for Encryption Schemes -#if ALG_RSA -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_ENC_SCHEME_OAEP_Unmarshal(TPMS_ENC_SCHEME_OAEP *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_ENC_SCHEME_OAEP_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_ENC_SCHEME_OAEP_Marshal(TPMS_ENC_SCHEME_OAEP *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_ENC_SCHEME_OAEP_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_ENC_SCHEME_RSAES_Unmarshal(TPMS_ENC_SCHEME_RSAES *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_ENC_SCHEME_RSAES_Unmarshal(target, buffer, size) \ - TPMS_EMPTY_Unmarshal((TPMS_EMPTY *)(target), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_ENC_SCHEME_RSAES_Marshal(TPMS_ENC_SCHEME_RSAES *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_ENC_SCHEME_RSAES_Marshal(source, buffer, size) \ - TPMS_EMPTY_Marshal((TPMS_EMPTY *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:159 - Definition of Types for ECC Key Exchange -#if ALG_ECC -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_KEY_SCHEME_ECDH_Unmarshal(TPMS_KEY_SCHEME_ECDH *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_KEY_SCHEME_ECDH_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_KEY_SCHEME_ECDH_Marshal(TPMS_KEY_SCHEME_ECDH *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_KEY_SCHEME_ECDH_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_KEY_SCHEME_ECMQV_Unmarshal(TPMS_KEY_SCHEME_ECMQV *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_KEY_SCHEME_ECMQV_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_KEY_SCHEME_ECMQV_Marshal(TPMS_KEY_SCHEME_ECMQV *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_KEY_SCHEME_ECMQV_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:160 - Definition of Types for KDF Schemes -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SCHEME_MGF1_Unmarshal(TPMS_SCHEME_MGF1 *target, BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_MGF1_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SCHEME_MGF1_Marshal(TPMS_SCHEME_MGF1 *source, BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_MGF1_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SCHEME_KDF1_SP800_56A_Unmarshal(TPMS_SCHEME_KDF1_SP800_56A *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_KDF1_SP800_56A_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SCHEME_KDF1_SP800_56A_Marshal(TPMS_SCHEME_KDF1_SP800_56A *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_KDF1_SP800_56A_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SCHEME_KDF2_Unmarshal(TPMS_SCHEME_KDF2 *target, BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_KDF2_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SCHEME_KDF2_Marshal(TPMS_SCHEME_KDF2 *source, BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_KDF2_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SCHEME_KDF1_SP800_108_Unmarshal(TPMS_SCHEME_KDF1_SP800_108 *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_KDF1_SP800_108_Unmarshal(target, buffer, size) \ - TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SCHEME_KDF1_SP800_108_Marshal(TPMS_SCHEME_KDF1_SP800_108 *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SCHEME_KDF1_SP800_108_Marshal(source, buffer, size) \ - TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:161 - Definition of TPMU_KDF_SCHEME Union -TPM_RC -TPMU_KDF_SCHEME_Unmarshal(TPMU_KDF_SCHEME *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_KDF_SCHEME_Marshal(TPMU_KDF_SCHEME *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:162 - Definition of TPMT_KDF_SCHEME Structure -TPM_RC -TPMT_KDF_SCHEME_Unmarshal(TPMT_KDF_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_KDF_SCHEME_Marshal(TPMT_KDF_SCHEME *source, BYTE **buffer, INT32 *size); - -// Table 2:163 - Definition of TPMI_ALG_ASYM_SCHEME Type -TPM_RC -TPMI_ALG_ASYM_SCHEME_Unmarshal(TPMI_ALG_ASYM_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_ASYM_SCHEME_Marshal(TPMI_ALG_ASYM_SCHEME *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_ASYM_SCHEME_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:164 - Definition of TPMU_ASYM_SCHEME Union -TPM_RC -TPMU_ASYM_SCHEME_Unmarshal(TPMU_ASYM_SCHEME *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_ASYM_SCHEME_Marshal(TPMU_ASYM_SCHEME *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:165 - Definition of TPMT_ASYM_SCHEME Structure -// Table 2:166 - Definition of TPMI_ALG_RSA_SCHEME Type -#if ALG_RSA -TPM_RC -TPMI_ALG_RSA_SCHEME_Unmarshal(TPMI_ALG_RSA_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_RSA_SCHEME_Marshal(TPMI_ALG_RSA_SCHEME *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_RSA_SCHEME_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:167 - Definition of TPMT_RSA_SCHEME Structure -#if ALG_RSA -TPM_RC -TPMT_RSA_SCHEME_Unmarshal(TPMT_RSA_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_RSA_SCHEME_Marshal(TPMT_RSA_SCHEME *source, BYTE **buffer, INT32 *size); -#endif // ALG_RSA - -// Table 2:168 - Definition of TPMI_ALG_RSA_DECRYPT Type -#if ALG_RSA -TPM_RC -TPMI_ALG_RSA_DECRYPT_Unmarshal(TPMI_ALG_RSA_DECRYPT *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_RSA_DECRYPT_Marshal(TPMI_ALG_RSA_DECRYPT *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_RSA_DECRYPT_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:169 - Definition of TPMT_RSA_DECRYPT Structure -#if ALG_RSA -TPM_RC -TPMT_RSA_DECRYPT_Unmarshal(TPMT_RSA_DECRYPT *target, - BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_RSA_DECRYPT_Marshal(TPMT_RSA_DECRYPT *source, BYTE **buffer, INT32 *size); -#endif // ALG_RSA - -// Table 2:170 - Definition of TPM2B_PUBLIC_KEY_RSA Structure -#if ALG_RSA -TPM_RC -TPM2B_PUBLIC_KEY_RSA_Unmarshal(TPM2B_PUBLIC_KEY_RSA *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_PUBLIC_KEY_RSA_Marshal(TPM2B_PUBLIC_KEY_RSA *source, - BYTE **buffer, INT32 *size); -#endif // ALG_RSA - -// Table 2:171 - Definition of TPMI_RSA_KEY_BITS Type -#if ALG_RSA -TPM_RC -TPMI_RSA_KEY_BITS_Unmarshal(TPMI_RSA_KEY_BITS *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_RSA_KEY_BITS_Marshal(TPMI_RSA_KEY_BITS *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_RSA_KEY_BITS_Marshal(source, buffer, size) \ - TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:172 - Definition of TPM2B_PRIVATE_KEY_RSA Structure -#if ALG_RSA -TPM_RC -TPM2B_PRIVATE_KEY_RSA_Unmarshal(TPM2B_PRIVATE_KEY_RSA *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_PRIVATE_KEY_RSA_Marshal(TPM2B_PRIVATE_KEY_RSA *source, - BYTE **buffer, INT32 *size); -#endif // ALG_RSA - -// Table 2:173 - Definition of TPM2B_ECC_PARAMETER Structure -TPM_RC -TPM2B_ECC_PARAMETER_Unmarshal(TPM2B_ECC_PARAMETER *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_ECC_PARAMETER_Marshal(TPM2B_ECC_PARAMETER *source, - BYTE **buffer, INT32 *size); - -// Table 2:174 - Definition of TPMS_ECC_POINT Structure -#if ALG_ECC -TPM_RC -TPMS_ECC_POINT_Unmarshal(TPMS_ECC_POINT *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_ECC_POINT_Marshal(TPMS_ECC_POINT *source, BYTE **buffer, INT32 *size); -#endif // ALG_ECC - -// Table 2:175 - Definition of TPM2B_ECC_POINT Structure -#if ALG_ECC -TPM_RC -TPM2B_ECC_POINT_Unmarshal(TPM2B_ECC_POINT *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_ECC_POINT_Marshal(TPM2B_ECC_POINT *source, BYTE **buffer, INT32 *size); -#endif // ALG_ECC - -// Table 2:176 - Definition of TPMI_ALG_ECC_SCHEME Type -#if ALG_ECC -TPM_RC -TPMI_ALG_ECC_SCHEME_Unmarshal(TPMI_ALG_ECC_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_ECC_SCHEME_Marshal(TPMI_ALG_ECC_SCHEME *source, - BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_ECC_SCHEME_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:177 - Definition of TPMI_ECC_CURVE Type -#if ALG_ECC -TPM_RC -TPMI_ECC_CURVE_Unmarshal(TPMI_ECC_CURVE *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ECC_CURVE_Marshal(TPMI_ECC_CURVE *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_ECC_CURVE_Marshal(source, buffer, size) \ - TPM_ECC_CURVE_Marshal((TPM_ECC_CURVE *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:178 - Definition of TPMT_ECC_SCHEME Structure -#if ALG_ECC -TPM_RC -TPMT_ECC_SCHEME_Unmarshal(TPMT_ECC_SCHEME *target, - BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_ECC_SCHEME_Marshal(TPMT_ECC_SCHEME *source, BYTE **buffer, INT32 *size); -#endif // ALG_ECC - -// Table 2:179 - Definition of TPMS_ALGORITHM_DETAIL_ECC Structure -#if ALG_ECC -UINT16 -TPMS_ALGORITHM_DETAIL_ECC_Marshal(TPMS_ALGORITHM_DETAIL_ECC *source, - BYTE **buffer, INT32 *size); -#endif // ALG_ECC - -// Table 2:180 - Definition of TPMS_SIGNATURE_RSA Structure -#if ALG_RSA -TPM_RC -TPMS_SIGNATURE_RSA_Unmarshal(TPMS_SIGNATURE_RSA *target, - BYTE **buffer, INT32 *size); -UINT16 -TPMS_SIGNATURE_RSA_Marshal(TPMS_SIGNATURE_RSA *source, BYTE **buffer, INT32 *size); -#endif // ALG_RSA - -// Table 2:181 - Definition of Types for Signature -#if ALG_RSA -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIGNATURE_RSASSA_Unmarshal(TPMS_SIGNATURE_RSASSA *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_RSASSA_Unmarshal(target, buffer, size) \ - TPMS_SIGNATURE_RSA_Unmarshal((TPMS_SIGNATURE_RSA *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIGNATURE_RSASSA_Marshal(TPMS_SIGNATURE_RSASSA *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_RSASSA_Marshal(source, buffer, size) \ - TPMS_SIGNATURE_RSA_Marshal((TPMS_SIGNATURE_RSA *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIGNATURE_RSAPSS_Unmarshal(TPMS_SIGNATURE_RSAPSS *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_RSAPSS_Unmarshal(target, buffer, size) \ - TPMS_SIGNATURE_RSA_Unmarshal((TPMS_SIGNATURE_RSA *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIGNATURE_RSAPSS_Marshal(TPMS_SIGNATURE_RSAPSS *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_RSAPSS_Marshal(source, buffer, size) \ - TPMS_SIGNATURE_RSA_Marshal((TPMS_SIGNATURE_RSA *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:182 - Definition of TPMS_SIGNATURE_ECC Structure -#if ALG_ECC -TPM_RC -TPMS_SIGNATURE_ECC_Unmarshal(TPMS_SIGNATURE_ECC *target, - BYTE **buffer, INT32 *size); -UINT16 -TPMS_SIGNATURE_ECC_Marshal(TPMS_SIGNATURE_ECC *source, BYTE **buffer, INT32 *size); -#endif // ALG_ECC - -// Table 2:183 - Definition of Types for TPMS_SIGNATURE_ECC -#if ALG_ECC -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIGNATURE_ECDAA_Unmarshal(TPMS_SIGNATURE_ECDAA *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_ECDAA_Unmarshal(target, buffer, size) \ - TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIGNATURE_ECDAA_Marshal(TPMS_SIGNATURE_ECDAA *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_ECDAA_Marshal(source, buffer, size) \ - TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIGNATURE_ECDSA_Unmarshal(TPMS_SIGNATURE_ECDSA *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_ECDSA_Unmarshal(target, buffer, size) \ - TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIGNATURE_ECDSA_Marshal(TPMS_SIGNATURE_ECDSA *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_ECDSA_Marshal(source, buffer, size) \ - TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIGNATURE_SM2_Unmarshal(TPMS_SIGNATURE_SM2 *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_SM2_Unmarshal(target, buffer, size) \ - TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIGNATURE_SM2_Marshal(TPMS_SIGNATURE_SM2 *source, BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_SM2_Marshal(source, buffer, size) \ - TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIGNATURE_ECSCHNORR_Unmarshal(TPMS_SIGNATURE_ECSCHNORR *target, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_ECSCHNORR_Unmarshal(target, buffer, size) \ - TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)(target), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#if !USE_MARSHALING_DEFINES -UINT16 -TPMS_SIGNATURE_ECSCHNORR_Marshal(TPMS_SIGNATURE_ECSCHNORR *source, - BYTE **buffer, INT32 *size); -#else -#define TPMS_SIGNATURE_ECSCHNORR_Marshal(source, buffer, size) \ - TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)(source), \ - (buffer), \ - (size)) -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:184 - Definition of TPMU_SIGNATURE Union -TPM_RC -TPMU_SIGNATURE_Unmarshal(TPMU_SIGNATURE *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_SIGNATURE_Marshal(TPMU_SIGNATURE *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:185 - Definition of TPMT_SIGNATURE Structure -TPM_RC -TPMT_SIGNATURE_Unmarshal(TPMT_SIGNATURE *target, - BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_SIGNATURE_Marshal(TPMT_SIGNATURE *source, BYTE **buffer, INT32 *size); - -// Table 2:186 - Definition of TPMU_ENCRYPTED_SECRET Union -TPM_RC -TPMU_ENCRYPTED_SECRET_Unmarshal(TPMU_ENCRYPTED_SECRET *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_ENCRYPTED_SECRET_Marshal(TPMU_ENCRYPTED_SECRET *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:187 - Definition of TPM2B_ENCRYPTED_SECRET Structure -TPM_RC -TPM2B_ENCRYPTED_SECRET_Unmarshal(TPM2B_ENCRYPTED_SECRET *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_ENCRYPTED_SECRET_Marshal(TPM2B_ENCRYPTED_SECRET *source, - BYTE **buffer, INT32 *size); - -// Table 2:188 - Definition of TPMI_ALG_PUBLIC Type -TPM_RC -TPMI_ALG_PUBLIC_Unmarshal(TPMI_ALG_PUBLIC *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_PUBLIC_Marshal(TPMI_ALG_PUBLIC *source, BYTE **buffer, INT32 *size); -#else -#define TPMI_ALG_PUBLIC_Marshal(source, buffer, size) \ - TPM_ALG_ID_Marshal((TPM_ALG_ID *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:189 - Definition of TPMU_PUBLIC_ID Union -TPM_RC -TPMU_PUBLIC_ID_Unmarshal(TPMU_PUBLIC_ID *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_PUBLIC_ID_Marshal(TPMU_PUBLIC_ID *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:190 - Definition of TPMS_KEYEDHASH_PARMS Structure -TPM_RC -TPMS_KEYEDHASH_PARMS_Unmarshal(TPMS_KEYEDHASH_PARMS *target, - BYTE **buffer, INT32 *size); -UINT16 -TPMS_KEYEDHASH_PARMS_Marshal(TPMS_KEYEDHASH_PARMS *source, - BYTE **buffer, INT32 *size); - -// Table 2:191 - Definition of TPMS_ASYM_PARMS Structure -// Table 2:192 - Definition of TPMS_RSA_PARMS Structure -#if ALG_RSA -TPM_RC -TPMS_RSA_PARMS_Unmarshal(TPMS_RSA_PARMS *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_RSA_PARMS_Marshal(TPMS_RSA_PARMS *source, BYTE **buffer, INT32 *size); -#endif // ALG_RSA - -// Table 2:193 - Definition of TPMS_ECC_PARMS Structure -#if ALG_ECC -TPM_RC -TPMS_ECC_PARMS_Unmarshal(TPMS_ECC_PARMS *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_ECC_PARMS_Marshal(TPMS_ECC_PARMS *source, BYTE **buffer, INT32 *size); -#endif // ALG_ECC - -// Table 2:194 - Definition of TPMU_PUBLIC_PARMS Union -TPM_RC -TPMU_PUBLIC_PARMS_Unmarshal(TPMU_PUBLIC_PARMS *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_PUBLIC_PARMS_Marshal(TPMU_PUBLIC_PARMS *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:195 - Definition of TPMT_PUBLIC_PARMS Structure -TPM_RC -TPMT_PUBLIC_PARMS_Unmarshal(TPMT_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size); -UINT16 -TPMT_PUBLIC_PARMS_Marshal(TPMT_PUBLIC_PARMS *source, BYTE **buffer, INT32 *size); - -// Table 2:196 - Definition of TPMT_PUBLIC Structure -TPM_RC -TPMT_PUBLIC_Unmarshal(TPMT_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPMT_PUBLIC_Marshal(TPMT_PUBLIC *source, BYTE **buffer, INT32 *size); - -// Table 2:197 - Definition of TPM2B_PUBLIC Structure -TPM_RC -TPM2B_PUBLIC_Unmarshal(TPM2B_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL flag); -UINT16 -TPM2B_PUBLIC_Marshal(TPM2B_PUBLIC *source, BYTE **buffer, INT32 *size); - -// Table 2:198 - Definition of TPM2B_TEMPLATE Structure -TPM_RC -TPM2B_TEMPLATE_Unmarshal(TPM2B_TEMPLATE *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_TEMPLATE_Marshal(TPM2B_TEMPLATE *source, BYTE **buffer, INT32 *size); - -// Table 2:199 - Definition of TPM2B_PRIVATE_VENDOR_SPECIFIC Structure -TPM_RC -TPM2B_PRIVATE_VENDOR_SPECIFIC_Unmarshal(TPM2B_PRIVATE_VENDOR_SPECIFIC *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_PRIVATE_VENDOR_SPECIFIC_Marshal(TPM2B_PRIVATE_VENDOR_SPECIFIC *source, - BYTE **buffer, INT32 *size); - -// Table 2:200 - Definition of TPMU_SENSITIVE_COMPOSITE Union -TPM_RC -TPMU_SENSITIVE_COMPOSITE_Unmarshal(TPMU_SENSITIVE_COMPOSITE *target, - BYTE **buffer, INT32 *size, UINT32 selector); -UINT16 -TPMU_SENSITIVE_COMPOSITE_Marshal(TPMU_SENSITIVE_COMPOSITE *source, - BYTE **buffer, INT32 *size, UINT32 selector); - -// Table 2:201 - Definition of TPMT_SENSITIVE Structure -TPM_RC -TPMT_SENSITIVE_Unmarshal(TPMT_SENSITIVE *target, BYTE **buffer, INT32 *size); -UINT16 -TPMT_SENSITIVE_Marshal(TPMT_SENSITIVE *source, BYTE **buffer, INT32 *size); - -// Table 2:202 - Definition of TPM2B_SENSITIVE Structure -TPM_RC -TPM2B_SENSITIVE_Unmarshal(TPM2B_SENSITIVE *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_SENSITIVE_Marshal(TPM2B_SENSITIVE *source, BYTE **buffer, INT32 *size); - -// Table 2:203 - Definition of _PRIVATE Structure -// Table 2:204 - Definition of TPM2B_PRIVATE Structure -TPM_RC -TPM2B_PRIVATE_Unmarshal(TPM2B_PRIVATE *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_PRIVATE_Marshal(TPM2B_PRIVATE *source, BYTE **buffer, INT32 *size); - -// Table 2:205 - Definition of TPMS_ID_OBJECT Structure -// Table 2:206 - Definition of TPM2B_ID_OBJECT Structure -TPM_RC -TPM2B_ID_OBJECT_Unmarshal(TPM2B_ID_OBJECT *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_ID_OBJECT_Marshal(TPM2B_ID_OBJECT *source, BYTE **buffer, INT32 *size); - -// Table 2:207 - Definition of TPM_NV_INDEX Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_NV_INDEX_Marshal(TPM_NV_INDEX *source, BYTE **buffer, INT32 *size); -#else -#define TPM_NV_INDEX_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:208 - Definition of TPM_NT Constants -// Table 2:209 - Definition of TPMS_NV_PIN_COUNTER_PARAMETERS Structure -TPM_RC -TPMS_NV_PIN_COUNTER_PARAMETERS_Unmarshal(TPMS_NV_PIN_COUNTER_PARAMETERS *target, - BYTE **buffer, INT32 *size); -UINT16 -TPMS_NV_PIN_COUNTER_PARAMETERS_Marshal(TPMS_NV_PIN_COUNTER_PARAMETERS *source, - BYTE **buffer, INT32 *size); - -// Table 2:210 - Definition of TPMA_NV Bits -TPM_RC -TPMA_NV_Unmarshal(TPMA_NV *target, BYTE **buffer, INT32 *size); - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_NV_Marshal(TPMA_NV *source, BYTE **buffer, INT32 *size); -#else -#define TPMA_NV_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:211 - Definition of TPMS_NV_PUBLIC Structure -TPM_RC -TPMS_NV_PUBLIC_Unmarshal(TPMS_NV_PUBLIC *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_NV_PUBLIC_Marshal(TPMS_NV_PUBLIC *source, BYTE **buffer, INT32 *size); - -// Table 2:212 - Definition of TPM2B_NV_PUBLIC Structure -TPM_RC -TPM2B_NV_PUBLIC_Unmarshal(TPM2B_NV_PUBLIC *target, BYTE **buffer, INT32 *size); -UINT16 -TPM2B_NV_PUBLIC_Marshal(TPM2B_NV_PUBLIC *source, BYTE **buffer, INT32 *size); - -// Table 2:213 - Definition of TPM2B_CONTEXT_SENSITIVE Structure -TPM_RC -TPM2B_CONTEXT_SENSITIVE_Unmarshal(TPM2B_CONTEXT_SENSITIVE *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_CONTEXT_SENSITIVE_Marshal(TPM2B_CONTEXT_SENSITIVE *source, - BYTE **buffer, INT32 *size); - -// Table 2:214 - Definition of TPMS_CONTEXT_DATA Structure -TPM_RC -TPMS_CONTEXT_DATA_Unmarshal(TPMS_CONTEXT_DATA *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_CONTEXT_DATA_Marshal(TPMS_CONTEXT_DATA *source, BYTE **buffer, INT32 *size); - -// Table 2:215 - Definition of TPM2B_CONTEXT_DATA Structure -TPM_RC -TPM2B_CONTEXT_DATA_Unmarshal(TPM2B_CONTEXT_DATA *target, - BYTE **buffer, INT32 *size); -UINT16 -TPM2B_CONTEXT_DATA_Marshal(TPM2B_CONTEXT_DATA *source, BYTE **buffer, INT32 *size); - -// Table 2:216 - Definition of TPMS_CONTEXT Structure -TPM_RC -TPMS_CONTEXT_Unmarshal(TPMS_CONTEXT *target, BYTE **buffer, INT32 *size); -UINT16 -TPMS_CONTEXT_Marshal(TPMS_CONTEXT *source, BYTE **buffer, INT32 *size); - -// Table 2:218 - Definition of TPMS_CREATION_DATA Structure -UINT16 -TPMS_CREATION_DATA_Marshal(TPMS_CREATION_DATA *source, BYTE **buffer, INT32 *size); - -// Table 2:219 - Definition of TPM2B_CREATION_DATA Structure -UINT16 -TPM2B_CREATION_DATA_Marshal(TPM2B_CREATION_DATA *source, - BYTE **buffer, INT32 *size); - -// Table 2:220 - Definition of TPM_AT Constants -TPM_RC -TPM_AT_Unmarshal(TPM_AT *target, BYTE **buffer, INT32 *size); -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_AT_Marshal(TPM_AT *source, BYTE **buffer, INT32 *size); -#else -#define TPM_AT_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:221 - Definition of TPM_AE Constants -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_AE_Marshal(TPM_AE *source, BYTE **buffer, INT32 *size); -#else -#define TPM_AE_Marshal(source, buffer, size) \ - UINT32_Marshal((UINT32 *)(source), (buffer), (size)) -#endif // !USE_MARSHALING_DEFINES - -// Table 2:222 - Definition of TPMS_AC_OUTPUT Structure -UINT16 -TPMS_AC_OUTPUT_Marshal(TPMS_AC_OUTPUT *source, BYTE **buffer, INT32 *size); - -// Table 2:223 - Definition of TPML_AC_CAPABILITIES Structure -UINT16 -TPML_AC_CAPABILITIES_Marshal(TPML_AC_CAPABILITIES *source, - BYTE **buffer, INT32 *size); - -// Array Marshal/Unmarshal for BYTE -TPM_RC -BYTE_Array_Unmarshal(BYTE *target, BYTE **buffer, INT32 *size, INT32 count); -UINT16 -BYTE_Array_Marshal(BYTE *source, BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal/Unmarshal for TPM2B_DIGEST -TPM_RC -TPM2B_DIGEST_Array_Unmarshal(TPM2B_DIGEST *target, - BYTE **buffer, INT32 *size, INT32 count); -UINT16 -TPM2B_DIGEST_Array_Marshal(TPM2B_DIGEST *source, - BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal for TPMA_CC -UINT16 -TPMA_CC_Array_Marshal(TPMA_CC *source, BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal for TPMS_AC_OUTPUT -UINT16 -TPMS_AC_OUTPUT_Array_Marshal(TPMS_AC_OUTPUT *source, - BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal for TPMS_ALG_PROPERTY -UINT16 -TPMS_ALG_PROPERTY_Array_Marshal(TPMS_ALG_PROPERTY *source, - BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal/Unmarshal for TPMS_PCR_SELECTION -TPM_RC -TPMS_PCR_SELECTION_Array_Unmarshal(TPMS_PCR_SELECTION *target, - BYTE **buffer, INT32 *size, INT32 count); -UINT16 -TPMS_PCR_SELECTION_Array_Marshal(TPMS_PCR_SELECTION *source, - BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal for TPMS_TAGGED_PCR_SELECT -UINT16 -TPMS_TAGGED_PCR_SELECT_Array_Marshal(TPMS_TAGGED_PCR_SELECT *source, - BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal for TPMS_TAGGED_POLICY -UINT16 -TPMS_TAGGED_POLICY_Array_Marshal(TPMS_TAGGED_POLICY *source, - BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal for TPMS_TAGGED_PROPERTY -UINT16 -TPMS_TAGGED_PROPERTY_Array_Marshal(TPMS_TAGGED_PROPERTY *source, - BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal/Unmarshal for TPMT_HA -TPM_RC -TPMT_HA_Array_Unmarshal(TPMT_HA *target, - BYTE **buffer, INT32 *size, BOOL flag, INT32 count); -UINT16 -TPMT_HA_Array_Marshal(TPMT_HA *source, BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal/Unmarshal for TPM_ALG_ID -TPM_RC -TPM_ALG_ID_Array_Unmarshal(TPM_ALG_ID *target, - BYTE **buffer, INT32 *size, INT32 count); -UINT16 -TPM_ALG_ID_Array_Marshal(TPM_ALG_ID *source, - BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal/Unmarshal for TPM_CC -TPM_RC -TPM_CC_Array_Unmarshal(TPM_CC *target, BYTE **buffer, INT32 *size, INT32 count); -UINT16 -TPM_CC_Array_Marshal(TPM_CC *source, BYTE **buffer, INT32 *size, INT32 count); - -// Array Marshal/Unmarshal for TPM_ECC_CURVE -#if ALG_ECC -TPM_RC -TPM_ECC_CURVE_Array_Unmarshal(TPM_ECC_CURVE *target, - BYTE **buffer, INT32 *size, INT32 count); -UINT16 -TPM_ECC_CURVE_Array_Marshal(TPM_ECC_CURVE *source, - BYTE **buffer, INT32 *size, INT32 count); -#endif // ALG_ECC - -// Array Marshal/Unmarshal for TPM_HANDLE -TPM_RC -TPM_HANDLE_Array_Unmarshal(TPM_HANDLE *target, - BYTE **buffer, INT32 *size, INT32 count); -UINT16 -TPM_HANDLE_Array_Marshal(TPM_HANDLE *source, - BYTE **buffer, INT32 *size, INT32 count); -#endif // _MARSHAL_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MathOnByteBuffers_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MathOnByteBuffers_fp.h deleted file mode 100644 index 57e58b3e0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/MathOnByteBuffers_fp.h +++ /dev/null @@ -1,147 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _MATH_ON_BYTE_BUFFERS_FP_H_ -#define _MATH_ON_BYTE_BUFFERS_FP_H_ - -//*** UnsignedCmpB -// This function compare two unsigned values. The values are byte-aligned, -// big-endian numbers (e.g, a hash). -// Return Type: int -// 1 if (a > b) -// 0 if (a = b) -// -1 if (a < b) -LIB_EXPORT int -UnsignedCompareB( - UINT32 aSize, // IN: size of a - const BYTE *a, // IN: a - UINT32 bSize, // IN: size of b - const BYTE *b // IN: b -); - -//***SignedCompareB() -// Compare two signed integers: -// Return Type: int -// 1 if a > b -// 0 if a = b -// -1 if a < b -int -SignedCompareB( - const UINT32 aSize, // IN: size of a - const BYTE *a, // IN: a buffer - const UINT32 bSize, // IN: size of b - const BYTE *b // IN: b buffer -); - -//*** ModExpB -// This function is used to do modular exponentiation in support of RSA. -// The most typical uses are: 'c' = 'm'^'e' mod 'n' (RSA encrypt) and -// 'm' = 'c'^'d' mod 'n' (RSA decrypt). When doing decryption, the 'e' parameter -// of the function will contain the private exponent 'd' instead of the public -// exponent 'e'. -// -// If the results will not fit in the provided buffer, -// an error is returned (CRYPT_ERROR_UNDERFLOW). If the results is smaller -// than the buffer, the results is de-normalized. -// -// This version is intended for use with RSA and requires that 'm' be -// less than 'n'. -// -// Return Type: TPM_RC -// TPM_RC_SIZE number to exponentiate is larger than the modulus -// TPM_RC_NO_RESULT result will not fit into the provided buffer -// -TPM_RC -ModExpB( - UINT32 cSize, // IN: the size of the output buffer. It will - // need to be the same size as the modulus - BYTE *c, // OUT: the buffer to receive the results - // (c->size must be set to the maximum size - // for the returned value) - const UINT32 mSize, - const BYTE *m, // IN: number to exponentiate - const UINT32 eSize, - const BYTE *e, // IN: power - const UINT32 nSize, - const BYTE *n // IN: modulus -); - -//*** DivideB() -// Divide an integer ('n') by an integer ('d') producing a quotient ('q') and -// a remainder ('r'). If 'q' or 'r' is not needed, then the pointer to them -// may be set to NULL. -// -// Return Type: TPM_RC -// TPM_RC_NO_RESULT 'q' or 'r' is too small to receive the result -// -LIB_EXPORT TPM_RC -DivideB( - const TPM2B *n, // IN: numerator - const TPM2B *d, // IN: denominator - TPM2B *q, // OUT: quotient - TPM2B *r // OUT: remainder -); - -//*** AdjustNumberB() -// Remove/add leading zeros from a number in a TPM2B. Will try to make the number -// by adding or removing leading zeros. If the number is larger than the requested -// size, it will make the number as small as possible. Setting 'requestedSize' to -// zero is equivalent to requesting that the number be normalized. -UINT16 -AdjustNumberB( - TPM2B *num, - UINT16 requestedSize -); - -//*** ShiftLeft() -// This function shifts a byte buffer (a TPM2B) one byte to the left. That is, -// the most significant bit of the most significant byte is lost. -TPM2B * -ShiftLeft( - TPM2B *value // IN/OUT: value to shift and shifted value out -); - -//*** IsNumeric() -// Verifies that all the characters are simple numeric (0-9) -BOOL -IsNumeric( - TPM2B *value -); - -#endif // _MATH_ON_BYTE_BUFFERS_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Memory_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Memory_fp.h deleted file mode 100644 index 42f4c5845..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Memory_fp.h +++ /dev/null @@ -1,179 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 7, 2019 Time: 06:58:58PM - */ - -#ifndef _MEMORY_FP_H_ -#define _MEMORY_FP_H_ - -//*** MemoryCopy() -// This is an alias for memmove. This is used in place of memcpy because -// some of the moves may overlap and rather than try to make sure that -// memmove is used when necessary, it is always used. -void -MemoryCopy( - void *dest, - const void *src, - int sSize -); - -//*** MemoryEqual() -// This function indicates if two buffers have the same values in the indicated -// number of bytes. -// Return Type: BOOL -// TRUE(1) all octets are the same -// FALSE(0) all octets are not the same -BOOL -MemoryEqual( - const void *buffer1, // IN: compare buffer1 - const void *buffer2, // IN: compare buffer2 - unsigned int size // IN: size of bytes being compared -); - -//*** MemoryCopy2B() -// This function copies a TPM2B. This can be used when the TPM2B types are -// the same or different. -// -// This function returns the number of octets in the data buffer of the TPM2B. -LIB_EXPORT INT16 -MemoryCopy2B( - TPM2B *dest, // OUT: receiving TPM2B - const TPM2B *source, // IN: source TPM2B - unsigned int dSize // IN: size of the receiving buffer -); - -//*** MemoryConcat2B() -// This function will concatenate the buffer contents of a TPM2B to an -// the buffer contents of another TPM2B and adjust the size accordingly -// ('a' := ('a' | 'b')). -void -MemoryConcat2B( - TPM2B *aInOut, // IN/OUT: destination 2B - TPM2B *bIn, // IN: second 2B - unsigned int aMaxSize // IN: The size of aInOut.buffer (max values for - // aInOut.size) -); - -//*** MemoryEqual2B() -// This function will compare two TPM2B structures. To be equal, they -// need to be the same size and the buffer contexts need to be the same -// in all octets. -// Return Type: BOOL -// TRUE(1) size and buffer contents are the same -// FALSE(0) size or buffer contents are not the same -BOOL -MemoryEqual2B( - const TPM2B *aIn, // IN: compare value - const TPM2B *bIn // IN: compare value -); - -//*** MemorySet() -// This function will set all the octets in the specified memory range to -// the specified octet value. -// Note: A previous version had an additional parameter (dSize) that was -// intended to make sure that the destination would not be overrun. The -// problem is that, in use, all that was happening was that the value of -// size was used for dSize so there was no benefit in the extra parameter. -void -MemorySet( - void *dest, - int value, - size_t size -); - -//*** MemoryPad2B() -// Function to pad a TPM2B with zeros and adjust the size. -void -MemoryPad2B( - TPM2B *b, - UINT16 newSize -); - -//*** Uint16ToByteArray() -// Function to write an integer to a byte array -void -Uint16ToByteArray( - UINT16 i, - BYTE *a -); - -//*** Uint32ToByteArray() -// Function to write an integer to a byte array -void -Uint32ToByteArray( - UINT32 i, - BYTE *a -); - -//*** Uint64ToByteArray() -// Function to write an integer to a byte array -void -Uint64ToByteArray( - UINT64 i, - BYTE *a -); - -//*** ByteArrayToUint8() -// Function to write a UINT8 to a byte array. This is included for completeness -// and to allow certain macro expansions -UINT8 -ByteArrayToUint8( - BYTE *a -); - -//*** ByteArrayToUint16() -// Function to write an integer to a byte array -UINT16 -ByteArrayToUint16( - BYTE *a -); - -//*** ByteArrayToUint32() -// Function to write an integer to a byte array -UINT32 -ByteArrayToUint32( - BYTE *a -); - -//*** ByteArrayToUint64() -// Function to write an integer to a byte array -UINT64 -ByteArrayToUint64( - BYTE *a -); - -#endif // _MEMORY_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Certify_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Certify_fp.h deleted file mode 100644 index 764e15e1a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Certify_fp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_Certify // Command must be enabled - -#ifndef _NV_Certify_FP_H_ -#define _NV_Certify_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT signHandle; - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; - TPM2B_DATA qualifyingData; - TPMT_SIG_SCHEME inScheme; - UINT16 size; - UINT16 offset; -} NV_Certify_In; - -// Output structure definition -typedef struct { - TPM2B_ATTEST certifyInfo; - TPMT_SIGNATURE signature; -} NV_Certify_Out; - -// Response code modifiers -#define RC_NV_Certify_signHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_Certify_authHandle (TPM_RC_H + TPM_RC_2) -#define RC_NV_Certify_nvIndex (TPM_RC_H + TPM_RC_3) -#define RC_NV_Certify_qualifyingData (TPM_RC_P + TPM_RC_1) -#define RC_NV_Certify_inScheme (TPM_RC_P + TPM_RC_2) -#define RC_NV_Certify_size (TPM_RC_P + TPM_RC_3) -#define RC_NV_Certify_offset (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_NV_Certify( - NV_Certify_In *in, - NV_Certify_Out *out -); - -#endif // _NV_Certify_FP_H_ -#endif // CC_NV_Certify diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ChangeAuth_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ChangeAuth_fp.h deleted file mode 100644 index d0620d416..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ChangeAuth_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_ChangeAuth // Command must be enabled - -#ifndef _NV_Change_Auth_FP_H_ -#define _NV_Change_Auth_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_INDEX nvIndex; - TPM2B_AUTH newAuth; -} NV_ChangeAuth_In; - -// Response code modifiers -#define RC_NV_ChangeAuth_nvIndex (TPM_RC_H + TPM_RC_1) -#define RC_NV_ChangeAuth_newAuth (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_NV_ChangeAuth( - NV_ChangeAuth_In *in -); - -#endif // _NV_Change_Auth_FP_H_ -#endif // CC_NV_ChangeAuth diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_DefineSpace_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_DefineSpace_fp.h deleted file mode 100644 index 742702fdd..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_DefineSpace_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_DefineSpace // Command must be enabled - -#ifndef _NV_Define_Space_FP_H_ -#define _NV_Define_Space_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PROVISION authHandle; - TPM2B_AUTH auth; - TPM2B_NV_PUBLIC publicInfo; -} NV_DefineSpace_In; - -// Response code modifiers -#define RC_NV_DefineSpace_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_DefineSpace_auth (TPM_RC_P + TPM_RC_1) -#define RC_NV_DefineSpace_publicInfo (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_NV_DefineSpace( - NV_DefineSpace_In *in -); - -#endif // _NV_Define_Space_FP_H_ -#endif // CC_NV_DefineSpace diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Extend_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Extend_fp.h deleted file mode 100644 index 6913fcd99..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Extend_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_Extend // Command must be enabled - -#ifndef _NV_Extend_FP_H_ -#define _NV_Extend_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; - TPM2B_MAX_NV_BUFFER data; -} NV_Extend_In; - -// Response code modifiers -#define RC_NV_Extend_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_Extend_nvIndex (TPM_RC_H + TPM_RC_2) -#define RC_NV_Extend_data (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_NV_Extend( - NV_Extend_In *in -); - -#endif // _NV_Extend_FP_H_ -#endif // CC_NV_Extend diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_GlobalWriteLock_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_GlobalWriteLock_fp.h deleted file mode 100644 index cd11e9320..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_GlobalWriteLock_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_GlobalWriteLock // Command must be enabled - -#ifndef _NV_Global_Write_Lock_FP_H_ -#define _NV_Global_Write_Lock_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PROVISION authHandle; -} NV_GlobalWriteLock_In; - -// Response code modifiers -#define RC_NV_GlobalWriteLock_authHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_NV_GlobalWriteLock( - NV_GlobalWriteLock_In *in -); - -#endif // _NV_Global_Write_Lock_FP_H_ -#endif // CC_NV_GlobalWriteLock diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Increment_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Increment_fp.h deleted file mode 100644 index 51441befc..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Increment_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_Increment // Command must be enabled - -#ifndef _NV_Increment_FP_H_ -#define _NV_Increment_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; -} NV_Increment_In; - -// Response code modifiers -#define RC_NV_Increment_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_Increment_nvIndex (TPM_RC_H + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_NV_Increment( - NV_Increment_In *in -); - -#endif // _NV_Increment_FP_H_ -#endif // CC_NV_Increment diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ReadLock_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ReadLock_fp.h deleted file mode 100644 index 8687f6ac4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ReadLock_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_ReadLock // Command must be enabled - -#ifndef _NV_Read_Lock_FP_H_ -#define _NV_Read_Lock_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; -} NV_ReadLock_In; - -// Response code modifiers -#define RC_NV_ReadLock_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_ReadLock_nvIndex (TPM_RC_H + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_NV_ReadLock( - NV_ReadLock_In *in -); - -#endif // _NV_Read_Lock_FP_H_ -#endif // CC_NV_ReadLock diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ReadPublic_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ReadPublic_fp.h deleted file mode 100644 index 90e439677..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_ReadPublic_fp.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_ReadPublic // Command must be enabled - -#ifndef _NV_Read_Public_FP_H_ -#define _NV_Read_Public_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_INDEX nvIndex; -} NV_ReadPublic_In; - -// Output structure definition -typedef struct { - TPM2B_NV_PUBLIC nvPublic; - TPM2B_NAME nvName; -} NV_ReadPublic_Out; - -// Response code modifiers -#define RC_NV_ReadPublic_nvIndex (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_NV_ReadPublic( - NV_ReadPublic_In *in, - NV_ReadPublic_Out *out -); - -#endif // _NV_Read_Public_FP_H_ -#endif // CC_NV_ReadPublic diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Read_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Read_fp.h deleted file mode 100644 index 384eecff0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Read_fp.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_Read // Command must be enabled - -#ifndef _NV_Read_FP_H_ -#define _NV_Read_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; - UINT16 size; - UINT16 offset; -} NV_Read_In; - -// Output structure definition -typedef struct { - TPM2B_MAX_NV_BUFFER data; -} NV_Read_Out; - -// Response code modifiers -#define RC_NV_Read_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_Read_nvIndex (TPM_RC_H + TPM_RC_2) -#define RC_NV_Read_size (TPM_RC_P + TPM_RC_1) -#define RC_NV_Read_offset (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_NV_Read( - NV_Read_In *in, - NV_Read_Out *out -); - -#endif // _NV_Read_FP_H_ -#endif // CC_NV_Read diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_SetBits_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_SetBits_fp.h deleted file mode 100644 index fee30fbea..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_SetBits_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_SetBits // Command must be enabled - -#ifndef _NV_Set_Bits_FP_H_ -#define _NV_Set_Bits_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; - UINT64 bits; -} NV_SetBits_In; - -// Response code modifiers -#define RC_NV_SetBits_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_SetBits_nvIndex (TPM_RC_H + TPM_RC_2) -#define RC_NV_SetBits_bits (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_NV_SetBits( - NV_SetBits_In *in -); - -#endif // _NV_Set_Bits_FP_H_ -#endif // CC_NV_SetBits diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_UndefineSpaceSpecial_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_UndefineSpaceSpecial_fp.h deleted file mode 100644 index d99b64033..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_UndefineSpaceSpecial_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_UndefineSpaceSpecial // Command must be enabled - -#ifndef _NV_Undefine_Space_Special_FP_H_ -#define _NV_Undefine_Space_Special_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_INDEX nvIndex; - TPMI_RH_PLATFORM platform; -} NV_UndefineSpaceSpecial_In; - -// Response code modifiers -#define RC_NV_UndefineSpaceSpecial_nvIndex (TPM_RC_H + TPM_RC_1) -#define RC_NV_UndefineSpaceSpecial_platform (TPM_RC_H + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_NV_UndefineSpaceSpecial( - NV_UndefineSpaceSpecial_In *in -); - -#endif // _NV_Undefine_Space_Special_FP_H_ -#endif // CC_NV_UndefineSpaceSpecial diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_UndefineSpace_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_UndefineSpace_fp.h deleted file mode 100644 index 217d17c84..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_UndefineSpace_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_UndefineSpace // Command must be enabled - -#ifndef _NV_Undefine_Space_FP_H_ -#define _NV_Undefine_Space_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PROVISION authHandle; - TPMI_RH_NV_INDEX nvIndex; -} NV_UndefineSpace_In; - -// Response code modifiers -#define RC_NV_UndefineSpace_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_UndefineSpace_nvIndex (TPM_RC_H + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_NV_UndefineSpace( - NV_UndefineSpace_In *in -); - -#endif // _NV_Undefine_Space_FP_H_ -#endif // CC_NV_UndefineSpace diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_WriteLock_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_WriteLock_fp.h deleted file mode 100644 index af640c838..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_WriteLock_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_WriteLock // Command must be enabled - -#ifndef _NV_Write_Lock_FP_H_ -#define _NV_Write_Lock_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; -} NV_WriteLock_In; - -// Response code modifiers -#define RC_NV_WriteLock_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_WriteLock_nvIndex (TPM_RC_H + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_NV_WriteLock( - NV_WriteLock_In *in -); - -#endif // _NV_Write_Lock_FP_H_ -#endif // CC_NV_WriteLock diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Write_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Write_fp.h deleted file mode 100644 index c4bfb28d8..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_Write_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_NV_Write // Command must be enabled - -#ifndef _NV_Write_FP_H_ -#define _NV_Write_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; - TPM2B_MAX_NV_BUFFER data; - UINT16 offset; -} NV_Write_In; - -// Response code modifiers -#define RC_NV_Write_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_NV_Write_nvIndex (TPM_RC_H + TPM_RC_2) -#define RC_NV_Write_data (TPM_RC_P + TPM_RC_1) -#define RC_NV_Write_offset (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_NV_Write( - NV_Write_In *in -); - -#endif // _NV_Write_FP_H_ -#endif // CC_NV_Write diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_spt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_spt_fp.h deleted file mode 100644 index 0844f2dad..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NV_spt_fp.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _NV_SPT_FP_H_ -#define _NV_SPT_FP_H_ - -//*** NvReadAccessChecks() -// Common routine for validating a read -// Used by TPM2_NV_Read, TPM2_NV_ReadLock and TPM2_PolicyNV -// Return Type: TPM_RC -// TPM_RC_NV_AUTHORIZATION autHandle is not allowed to authorize read -// of the index -// TPM_RC_NV_LOCKED Read locked -// TPM_RC_NV_UNINITIALIZED Try to read an uninitialized index -// -TPM_RC -NvReadAccessChecks( - TPM_HANDLE authHandle, // IN: the handle that provided the - // authorization - TPM_HANDLE nvHandle, // IN: the handle of the NV index to be read - TPMA_NV attributes // IN: the attributes of 'nvHandle' -); - -//*** NvWriteAccessChecks() -// Common routine for validating a write -// Used by TPM2_NV_Write, TPM2_NV_Increment, TPM2_SetBits, and TPM2_NV_WriteLock -// Return Type: TPM_RC -// TPM_RC_NV_AUTHORIZATION Authorization fails -// TPM_RC_NV_LOCKED Write locked -// -TPM_RC -NvWriteAccessChecks( - TPM_HANDLE authHandle, // IN: the handle that provided the - // authorization - TPM_HANDLE nvHandle, // IN: the handle of the NV index to be written - TPMA_NV attributes // IN: the attributes of 'nvHandle' -); - -//*** NvClearOrderly() -// This function is used to cause gp.orderlyState to be cleared to the -// non-orderly state. -TPM_RC -NvClearOrderly( - void -); - -//*** NvIsPinPassIndex() -// Function to check to see if an NV index is a PIN Pass Index -// Return Type: BOOL -// TRUE(1) is pin pass -// FALSE(0) is not pin pass -BOOL -NvIsPinPassIndex( - TPM_HANDLE index // IN: Handle to check -); - -#endif // _NV_SPT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NvDynamic_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NvDynamic_fp.h deleted file mode 100644 index 8c9b34e9b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NvDynamic_fp.h +++ /dev/null @@ -1,474 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 7, 2019 Time: 06:58:58PM - */ - -#ifndef _NV_DYNAMIC_FP_H_ -#define _NV_DYNAMIC_FP_H_ - -//*** NvWriteNvListEnd() -// Function to write the list terminator. -NV_REF -NvWriteNvListEnd( - NV_REF end -); - -//*** NvUpdateIndexOrderlyData() -// This function is used to cause an update of the orderly data to the NV backing -// store. -void -NvUpdateIndexOrderlyData( - void -); - -//*** NvReadIndex() -// This function is used to read the NV Index NV_INDEX. This is used so that the -// index information can be compressed and only this function would be needed -// to decompress it. Mostly, compression would only be able to save the space -// needed by the policy. -void -NvReadNvIndexInfo( - NV_REF ref, // IN: points to NV where index is located - NV_INDEX *nvIndex // OUT: place to receive index data -); - -//*** NvReadObject() -// This function is used to read a persistent object. This is used so that the -// object information can be compressed and only this function would be needed -// to uncompress it. -void -NvReadObject( - NV_REF ref, // IN: points to NV where index is located - OBJECT *object // OUT: place to receive the object data -); - -//*** NvIndexIsDefined() -// See if an index is already defined -BOOL -NvIndexIsDefined( - TPM_HANDLE nvHandle // IN: Index to look for -); - -//*** NvIsPlatformPersistentHandle() -// This function indicates if a handle references a persistent object in the -// range belonging to the platform. -// Return Type: BOOL -// TRUE(1) handle references a platform persistent object -// and may reference an owner persistent object either -// FALSE(0) handle does not reference platform persistent object -BOOL -NvIsPlatformPersistentHandle( - TPM_HANDLE handle // IN: handle -); - -//*** NvIsOwnerPersistentHandle() -// This function indicates if a handle references a persistent object in the -// range belonging to the owner. -// Return Type: BOOL -// TRUE(1) handle is owner persistent handle -// FALSE(0) handle is not owner persistent handle and may not be -// a persistent handle at all -BOOL -NvIsOwnerPersistentHandle( - TPM_HANDLE handle // IN: handle -); - -//*** NvIndexIsAccessible() -// -// This function validates that a handle references a defined NV Index and -// that the Index is currently accessible. -// Return Type: TPM_RC -// TPM_RC_HANDLE the handle points to an undefined NV Index -// If shEnable is CLEAR, this would include an index -// created using ownerAuth. If phEnableNV is CLEAR, -// this would include and index created using -// platformAuth -// TPM_RC_NV_READLOCKED Index is present but locked for reading and command -// does not write to the index -// TPM_RC_NV_WRITELOCKED Index is present but locked for writing and command -// writes to the index -TPM_RC -NvIndexIsAccessible( - TPMI_RH_NV_INDEX handle // IN: handle -); - -//*** NvGetEvictObject() -// This function is used to dereference an evict object handle and get a pointer -// to the object. -// Return Type: TPM_RC -// TPM_RC_HANDLE the handle does not point to an existing -// persistent object -TPM_RC -NvGetEvictObject( - TPM_HANDLE handle, // IN: handle - OBJECT *object // OUT: object data -); - -//*** NvIndexCacheInit() -// Function to initialize the Index cache -void -NvIndexCacheInit( - void -); - -//*** NvGetIndexData() -// This function is used to access the data in an NV Index. The data is returned -// as a byte sequence. -// -// This function requires that the NV Index be defined, and that the -// required data is within the data range. It also requires that TPMA_NV_WRITTEN -// of the Index is SET. -void -NvGetIndexData( - NV_INDEX *nvIndex, // IN: the in RAM index descriptor - NV_REF locator, // IN: where the data is located - UINT32 offset, // IN: offset of NV data - UINT16 size, // IN: number of octets of NV data to read - void *data // OUT: data buffer -); - -//*** NvHashIndexData() -// This function adds Index data to a hash. It does this in parts to avoid large stack -// buffers. -void -NvHashIndexData( - HASH_STATE *hashState, // IN: Initialized hash state - NV_INDEX *nvIndex, // IN: Index - NV_REF locator, // IN: where the data is located - UINT32 offset, // IN: starting offset - UINT16 size // IN: amount to hash -); - -//*** NvGetUINT64Data() -// Get data in integer format of a bit or counter NV Index. -// -// This function requires that the NV Index is defined and that the NV Index -// previously has been written. -UINT64 -NvGetUINT64Data( - NV_INDEX *nvIndex, // IN: the in RAM index descriptor - NV_REF locator // IN: where index exists in NV -); - -//*** NvWriteIndexAttributes() -// This function is used to write just the attributes of an index. -// Return type: TPM_RC -// TPM_RC_NV_RATE NV is rate limiting so retry -// TPM_RC_NV_UNAVAILABLE NV is not available -TPM_RC -NvWriteIndexAttributes( - TPM_HANDLE handle, - NV_REF locator, // IN: location of the index - TPMA_NV attributes // IN: attributes to write -); - -//*** NvWriteIndexAuth() -// This function is used to write the authValue of an index. It is used by -// TPM2_NV_ChangeAuth() -// Return type: TPM_RC -// TPM_RC_NV_RATE NV is rate limiting so retry -// TPM_RC_NV_UNAVAILABLE NV is not available -TPM_RC -NvWriteIndexAuth( - NV_REF locator, // IN: location of the index - TPM2B_AUTH *authValue // IN: the authValue to write -); - -//*** NvGetIndexInfo() -// This function loads the nvIndex Info into the NV cache and returns a pointer -// to the NV_INDEX. If the returned value is zero, the index was not found. -// The 'locator' parameter, if not NULL, will be set to the offset in NV of the -// Index (the location of the handle of the Index). -// -// This function will set the index cache. If the index is orderly, the attributes -// from RAM are substituted for the attributes in the cached index -NV_INDEX * -NvGetIndexInfo( - TPM_HANDLE nvHandle, // IN: the index handle - NV_REF *locator // OUT: location of the index -); - -//*** NvWriteIndexData() -// This function is used to write NV index data. It is intended to be used to -// update the data associated with the default index. -// -// This function requires that the NV Index is defined, and the data is -// within the defined data range for the index. -// -// Index data is only written due to a command that modifies the data in a single -// index. There is no case where changes are made to multiple indexes data at the -// same time. Multiple attributes may be change but not multiple index data. This -// is important because we will normally be handling the index for which we have -// the cached pointer values. -// Return type: TPM_RC -// TPM_RC_NV_RATE NV is rate limiting so retry -// TPM_RC_NV_UNAVAILABLE NV is not available -TPM_RC -NvWriteIndexData( - NV_INDEX *nvIndex, // IN: the description of the index - UINT32 offset, // IN: offset of NV data - UINT32 size, // IN: size of NV data - void *data // IN: data buffer -); - -//*** NvWriteUINT64Data() -// This function to write back a UINT64 value. The various UINT64 values (bits, -// counters, and PINs) are kept in canonical format but manipulate in native -// format. This takes a native format value converts it and saves it back as -// in canonical format. -// -// This function will return the value from NV or RAM depending on the type of the -// index (orderly or not) -// -TPM_RC -NvWriteUINT64Data( - NV_INDEX *nvIndex, // IN: the description of the index - UINT64 intValue // IN: the value to write -); - -//*** NvGetIndexName() -// This function computes the Name of an index -// The 'name' buffer receives the bytes of the Name and the return value -// is the number of octets in the Name. -// -// This function requires that the NV Index is defined. -TPM2B_NAME * -NvGetIndexName( - NV_INDEX *nvIndex, // IN: the index over which the name is to be - // computed - TPM2B_NAME *name // OUT: name of the index -); - -//*** NvGetNameByIndexHandle() -// This function is used to compute the Name of an NV Index referenced by handle. -// -// The 'name' buffer receives the bytes of the Name and the return value -// is the number of octets in the Name. -// -// This function requires that the NV Index is defined. -TPM2B_NAME * -NvGetNameByIndexHandle( - TPMI_RH_NV_INDEX handle, // IN: handle of the index - TPM2B_NAME *name // OUT: name of the index -); - -//*** NvDefineIndex() -// This function is used to assign NV memory to an NV Index. -// -// Return Type: TPM_RC -// TPM_RC_NV_SPACE insufficient NV space -TPM_RC -NvDefineIndex( - TPMS_NV_PUBLIC *publicArea, // IN: A template for an area to create. - TPM2B_AUTH *authValue // IN: The initial authorization value -); - -//*** NvAddEvictObject() -// This function is used to assign NV memory to a persistent object. -// Return Type: TPM_RC -// TPM_RC_NV_HANDLE the requested handle is already in use -// TPM_RC_NV_SPACE insufficient NV space -TPM_RC -NvAddEvictObject( - TPMI_DH_OBJECT evictHandle, // IN: new evict handle - OBJECT *object // IN: object to be added -); - -//*** NvDeleteIndex() -// This function is used to delete an NV Index. -// Return Type: TPM_RC -// TPM_RC_NV_UNAVAILABLE NV is not accessible -// TPM_RC_NV_RATE NV is rate limiting -TPM_RC -NvDeleteIndex( - NV_INDEX *nvIndex, // IN: an in RAM index descriptor - NV_REF entityAddr // IN: location in NV -); - -TPM_RC -NvDeleteEvict( - TPM_HANDLE handle // IN: handle of entity to be deleted -); - -//*** NvFlushHierarchy() -// This function will delete persistent objects belonging to the indicated hierarchy. -// If the storage hierarchy is selected, the function will also delete any -// NV Index defined using ownerAuth. -// Return Type: TPM_RC -// TPM_RC_NV_RATE NV is unavailable because of rate limit -// TPM_RC_NV_UNAVAILABLE NV is inaccessible -TPM_RC -NvFlushHierarchy( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy to be flushed. -); - -//*** NvSetGlobalLock() -// This function is used to SET the TPMA_NV_WRITELOCKED attribute for all -// NV indexes that have TPMA_NV_GLOBALLOCK SET. This function is use by -// TPM2_NV_GlobalWriteLock(). -// Return Type: TPM_RC -// TPM_RC_NV_RATE NV is unavailable because of rate limit -// TPM_RC_NV_UNAVAILABLE NV is inaccessible -TPM_RC -NvSetGlobalLock( - void -); - -//*** NvCapGetPersistent() -// This function is used to get a list of handles of the persistent objects, -// starting at 'handle'. -// -// 'Handle' must be in valid persistent object handle range, but does not -// have to reference an existing persistent object. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -NvCapGetPersistent( - TPMI_DH_OBJECT handle, // IN: start handle - UINT32 count, // IN: maximum number of returned handles - TPML_HANDLE *handleList // OUT: list of handle -); - -//*** NvCapGetIndex() -// This function returns a list of handles of NV indexes, starting from 'handle'. -// 'Handle' must be in the range of NV indexes, but does not have to reference -// an existing NV Index. -// Return Type: TPMI_YES_NO -// YES if there are more handles to report -// NO all the available handles has been reported -TPMI_YES_NO -NvCapGetIndex( - TPMI_DH_OBJECT handle, // IN: start handle - UINT32 count, // IN: max number of returned handles - TPML_HANDLE *handleList // OUT: list of handle -); - -//*** NvCapGetIndexNumber() -// This function returns the count of NV Indexes currently defined. -UINT32 -NvCapGetIndexNumber( - void -); - -//*** NvCapGetPersistentNumber() -// Function returns the count of persistent objects currently in NV memory. -UINT32 -NvCapGetPersistentNumber( - void -); - -//*** NvCapGetPersistentAvail() -// This function returns an estimate of the number of additional persistent -// objects that could be loaded into NV memory. -UINT32 -NvCapGetPersistentAvail( - void -); - -//*** NvCapGetCounterNumber() -// Get the number of defined NV Indexes that are counter indexes. -UINT32 -NvCapGetCounterNumber( - void -); - -//*** NvEntityStartup() -// This function is called at TPM_Startup(). If the startup completes -// a TPM Resume cycle, no action is taken. If the startup is a TPM Reset -// or a TPM Restart, then this function will: -// 1. clear read/write lock; -// 2. reset NV Index data that has TPMA_NV_CLEAR_STCLEAR SET; and -// 3. set the lower bits in orderly counters to 1 for a non-orderly startup -// -// It is a prerequisite that NV be available for writing before this -// function is called. -BOOL -NvEntityStartup( - STARTUP_TYPE type // IN: start up type -); - -//*** NvCapGetCounterAvail() -// This function returns an estimate of the number of additional counter type -// NV indexes that can be defined. -UINT32 -NvCapGetCounterAvail( - void -); - -//*** NvFindHandle() -// this function returns the offset in NV memory of the entity associated -// with the input handle. A value of zero indicates that handle does not -// exist reference an existing persistent object or defined NV Index. -NV_REF -NvFindHandle( - TPM_HANDLE handle -); - -//*** NvReadMaxCount() -// This function returns the max NV counter value. -// -UINT64 -NvReadMaxCount( - void -); - -//*** NvUpdateMaxCount() -// This function updates the max counter value to NV memory. This is just staging -// for the actual write that will occur when the NV index memory is modified. -// -void -NvUpdateMaxCount( - UINT64 count -); - -//*** NvSetMaxCount() -// This function is used at NV initialization time to set the initial value of -// the maximum counter. -void -NvSetMaxCount( - UINT64 value -); - -//*** NvGetMaxCount() -// Function to get the NV max counter value from the end-of-list marker -UINT64 -NvGetMaxCount( - void -); - -#endif // _NV_DYNAMIC_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NvReserved_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NvReserved_fp.h deleted file mode 100644 index 5d912abea..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/NvReserved_fp.h +++ /dev/null @@ -1,130 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:23:27PM - */ - -#ifndef _NV_RESERVED_FP_H_ -#define _NV_RESERVED_FP_H_ - -//*** NvCheckState() -// Function to check the NV state by accessing the platform-specific function -// to get the NV state. The result state is registered in s_NvIsAvailable -// that will be reported by NvIsAvailable. -// -// This function is called at the beginning of ExecuteCommand before any potential -// check of g_NvStatus. -void -NvCheckState( - void -); - -//*** NvCommit -// This is a wrapper for the platform function to commit pending NV writes. -BOOL -NvCommit( - void -); - -//*** NvPowerOn() -// This function is called at _TPM_Init to initialize the NV environment. -// Return Type: BOOL -// TRUE(1) all NV was initialized -// FALSE(0) the NV containing saved state had an error and -// TPM2_Startup(CLEAR) is required -BOOL -NvPowerOn( - void -); - -//*** NvManufacture() -// This function initializes the NV system at pre-install time. -// -// This function should only be called in a manufacturing environment or in a -// simulation. -// -// The layout of NV memory space is an implementation choice. -void -NvManufacture( - void -); - -//*** NvRead() -// This function is used to move reserved data from NV memory to RAM. -void -NvRead( - void *outBuffer, // OUT: buffer to receive data - UINT32 nvOffset, // IN: offset in NV of value - UINT32 size // IN: size of the value to read -); - -//*** NvWrite() -// This function is used to post reserved data for writing to NV memory. Before -// the TPM completes the operation, the value will be written. -BOOL -NvWrite( - UINT32 nvOffset, // IN: location in NV to receive data - UINT32 size, // IN: size of the data to move - void *inBuffer // IN: location containing data to write -); - -//*** NvUpdatePersistent() -// This function is used to update a value in the PERSISTENT_DATA structure and -// commits the value to NV. -void -NvUpdatePersistent( - UINT32 offset, // IN: location in PERMANENT_DATA to be updated - UINT32 size, // IN: size of the value - void *buffer // IN: the new data -); - -//*** NvClearPersistent() -// This function is used to clear a persistent data entry and commit it to NV -void -NvClearPersistent( - UINT32 offset, // IN: the offset in the PERMANENT_DATA - // structure to be cleared (zeroed) - UINT32 size // IN: number of bytes to clear -); - -//*** NvReadPersistent() -// This function reads persistent data to the RAM copy of the 'gp' structure. -void -NvReadPersistent( - void -); - -#endif // _NV_RESERVED_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ObjectChangeAuth_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ObjectChangeAuth_fp.h deleted file mode 100644 index 6e8b6f8ca..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ObjectChangeAuth_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ObjectChangeAuth // Command must be enabled - -#ifndef _Object_Change_Auth_FP_H_ -#define _Object_Change_Auth_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT objectHandle; - TPMI_DH_OBJECT parentHandle; - TPM2B_AUTH newAuth; -} ObjectChangeAuth_In; - -// Output structure definition -typedef struct { - TPM2B_PRIVATE outPrivate; -} ObjectChangeAuth_Out; - -// Response code modifiers -#define RC_ObjectChangeAuth_objectHandle (TPM_RC_H + TPM_RC_1) -#define RC_ObjectChangeAuth_parentHandle (TPM_RC_H + TPM_RC_2) -#define RC_ObjectChangeAuth_newAuth (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ObjectChangeAuth( - ObjectChangeAuth_In *in, - ObjectChangeAuth_Out *out -); - -#endif // _Object_Change_Auth_FP_H_ -#endif // CC_ObjectChangeAuth diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Object_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Object_fp.h deleted file mode 100644 index 9574ab6c7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Object_fp.h +++ /dev/null @@ -1,355 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:23:27PM - */ - -#ifndef _OBJECT_FP_H_ -#define _OBJECT_FP_H_ - -//*** ObjectFlush() -// This function marks an object slot as available. -// Since there is no checking of the input parameters, it should be used -// judiciously. -// Note: This could be converted to a macro. -void -ObjectFlush( - OBJECT *object -); - -//*** ObjectSetInUse() -// This access function sets the occupied attribute of an object slot. -void -ObjectSetInUse( - OBJECT *object -); - -//*** ObjectStartup() -// This function is called at TPM2_Startup() to initialize the object subsystem. -BOOL -ObjectStartup( - void -); - -//*** ObjectCleanupEvict() -// -// In this implementation, a persistent object is moved from NV into an object slot -// for processing. It is flushed after command execution. This function is called -// from ExecuteCommand(). -void -ObjectCleanupEvict( - void -); - -//*** IsObjectPresent() -// This function checks to see if a transient handle references a loaded -// object. This routine should not be called if the handle is not a -// transient handle. The function validates that the handle is in the -// implementation-dependent allowed in range for loaded transient objects. -// Return Type: BOOL -// TRUE(1) handle references a loaded object -// FALSE(0) handle is not an object handle, or it does not -// reference to a loaded object -BOOL -IsObjectPresent( - TPMI_DH_OBJECT handle // IN: handle to be checked -); - -//*** ObjectIsSequence() -// This function is used to check if the object is a sequence object. This function -// should not be called if the handle does not reference a loaded object. -// Return Type: BOOL -// TRUE(1) object is an HMAC, hash, or event sequence object -// FALSE(0) object is not an HMAC, hash, or event sequence object -BOOL -ObjectIsSequence( - OBJECT *object // IN: handle to be checked -); - -//*** HandleToObject() -// This function is used to find the object structure associated with a handle. -// -// This function requires that 'handle' references a loaded object or a permanent -// handle. -OBJECT* -HandleToObject( - TPMI_DH_OBJECT handle // IN: handle of the object -); - -//*** GetQualifiedName() -// This function returns the Qualified Name of the object. In this implementation, -// the Qualified Name is computed when the object is loaded and is saved in the -// internal representation of the object. The alternative would be to retain the -// Name of the parent and compute the QN when needed. This would take the same -// amount of space so it is not recommended that the alternate be used. -// -// This function requires that 'handle' references a loaded object. -void -GetQualifiedName( - TPMI_DH_OBJECT handle, // IN: handle of the object - TPM2B_NAME *qualifiedName // OUT: qualified name of the object -); - -//*** ObjectGetHierarchy() -// This function returns the handle for the hierarchy of an object. -TPMI_RH_HIERARCHY -ObjectGetHierarchy( - OBJECT *object // IN :object -); - -//*** GetHeriarchy() -// This function returns the handle of the hierarchy to which a handle belongs. -// This function is similar to ObjectGetHierarchy() but this routine takes -// a handle but ObjectGetHierarchy() takes an pointer to an object. -// -// This function requires that 'handle' references a loaded object. -TPMI_RH_HIERARCHY -GetHeriarchy( - TPMI_DH_OBJECT handle // IN :object handle -); - -//*** FindEmptyObjectSlot() -// This function finds an open object slot, if any. It will clear the attributes -// but will not set the occupied attribute. This is so that a slot may be used -// and discarded if everything does not go as planned. -// Return Type: OBJECT * -// NULL no open slot found -// != NULL pointer to available slot -OBJECT * -FindEmptyObjectSlot( - TPMI_DH_OBJECT *handle // OUT: (optional) -); - -//*** ObjectAllocateSlot() -// This function is used to allocate a slot in internal object array. -OBJECT * -ObjectAllocateSlot( - TPMI_DH_OBJECT *handle // OUT: handle of allocated object -); - -//*** ObjectSetLoadedAttributes() -// This function sets the internal attributes for a loaded object. It is called to -// finalize the OBJECT attributes (not the TPMA_OBJECT attributes) for a loaded -// object. -void -ObjectSetLoadedAttributes( - OBJECT *object, // IN: object attributes to finalize - TPM_HANDLE parentHandle // IN: the parent handle -); - -//*** ObjectLoad() -// Common function to load an object. A loaded object has its public area validated -// (unless its 'nameAlg' is TPM_ALG_NULL). If a sensitive part is loaded, it is -// verified to be correct and if both public and sensitive parts are loaded, then -// the cryptographic binding between the objects is validated. This function does -// not cause the allocated slot to be marked as in use. -TPM_RC -ObjectLoad( - OBJECT *object, // IN: pointer to object slot - // object - OBJECT *parent, // IN: (optional) the parent object - TPMT_PUBLIC *publicArea, // IN: public area to be installed in the object - TPMT_SENSITIVE *sensitive, // IN: (optional) sensitive area to be - // installed in the object - TPM_RC blamePublic, // IN: parameter number to associate with the - // publicArea errors - TPM_RC blameSensitive,// IN: parameter number to associate with the - // sensitive area errors - TPM2B_NAME *name // IN: (optional) -); - -#if CC_HMAC_Start || CC_MAC_Start -//*** ObjectCreateHMACSequence() -// This function creates an internal HMAC sequence object. -// Return Type: TPM_RC -// TPM_RC_OBJECT_MEMORY if there is no free slot for an object -TPM_RC -ObjectCreateHMACSequence( - TPMI_ALG_HASH hashAlg, // IN: hash algorithm - OBJECT *keyObject, // IN: the object containing the HMAC key - TPM2B_AUTH *auth, // IN: authValue - TPMI_DH_OBJECT *newHandle // OUT: HMAC sequence object handle -); -#endif - -//*** ObjectCreateHashSequence() -// This function creates a hash sequence object. -// Return Type: TPM_RC -// TPM_RC_OBJECT_MEMORY if there is no free slot for an object -TPM_RC -ObjectCreateHashSequence( - TPMI_ALG_HASH hashAlg, // IN: hash algorithm - TPM2B_AUTH *auth, // IN: authValue - TPMI_DH_OBJECT *newHandle // OUT: sequence object handle -); - -//*** ObjectCreateEventSequence() -// This function creates an event sequence object. -// Return Type: TPM_RC -// TPM_RC_OBJECT_MEMORY if there is no free slot for an object -TPM_RC -ObjectCreateEventSequence( - TPM2B_AUTH *auth, // IN: authValue - TPMI_DH_OBJECT *newHandle // OUT: sequence object handle -); - -//*** ObjectTerminateEvent() -// This function is called to close out the event sequence and clean up the hash -// context states. -void -ObjectTerminateEvent( - void -); - -//*** ObjectContextLoad() -// This function loads an object from a saved object context. -// Return Type: OBJECT * -// NULL if there is no free slot for an object -// != NULL points to the loaded object -OBJECT * -ObjectContextLoad( - ANY_OBJECT_BUFFER *object, // IN: pointer to object structure in saved - // context - TPMI_DH_OBJECT *handle // OUT: object handle -); - -//*** FlushObject() -// This function frees an object slot. -// -// This function requires that the object is loaded. -void -FlushObject( - TPMI_DH_OBJECT handle // IN: handle to be freed -); - -//*** ObjectFlushHierarchy() -// This function is called to flush all the loaded transient objects associated -// with a hierarchy when the hierarchy is disabled. -void -ObjectFlushHierarchy( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy to be flush -); - -//*** ObjectLoadEvict() -// This function loads a persistent object into a transient object slot. -// -// This function requires that 'handle' is associated with a persistent object. -// Return Type: TPM_RC -// TPM_RC_HANDLE the persistent object does not exist -// or the associated hierarchy is disabled. -// TPM_RC_OBJECT_MEMORY no object slot -TPM_RC -ObjectLoadEvict( - TPM_HANDLE *handle, // IN:OUT: evict object handle. If success, it - // will be replace by the loaded object handle - COMMAND_INDEX commandIndex // IN: the command being processed -); - -//*** ObjectComputeName() -// This does the name computation from a public area (can be marshaled or not). -TPM2B_NAME * -ObjectComputeName( - UINT32 size, // IN: the size of the area to digest - BYTE *publicArea, // IN: the public area to digest - TPM_ALG_ID nameAlg, // IN: the hash algorithm to use - TPM2B_NAME *name // OUT: Computed name -); - -//*** PublicMarshalAndComputeName() -// This function computes the Name of an object from its public area. -TPM2B_NAME * -PublicMarshalAndComputeName( - TPMT_PUBLIC *publicArea, // IN: public area of an object - TPM2B_NAME *name // OUT: name of the object -); - -//*** ComputeQualifiedName() -// This function computes the qualified name of an object. -void -ComputeQualifiedName( - TPM_HANDLE parentHandle, // IN: parent's handle - TPM_ALG_ID nameAlg, // IN: name hash - TPM2B_NAME *name, // IN: name of the object - TPM2B_NAME *qualifiedName // OUT: qualified name of the object -); - -//*** ObjectIsStorage() -// This function determines if an object has the attributes associated -// with a parent. A parent is an asymmetric or symmetric block cipher key -// that has its 'restricted' and 'decrypt' attributes SET, and 'sign' CLEAR. -// Return Type: BOOL -// TRUE(1) object is a storage key -// FALSE(0) object is not a storage key -BOOL -ObjectIsStorage( - TPMI_DH_OBJECT handle // IN: object handle -); - -//*** ObjectCapGetLoaded() -// This function returns a a list of handles of loaded object, starting from -// 'handle'. 'Handle' must be in the range of valid transient object handles, -// but does not have to be the handle of a loaded transient object. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -ObjectCapGetLoaded( - TPMI_DH_OBJECT handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle -); - -//*** ObjectCapGetTransientAvail() -// This function returns an estimate of the number of additional transient -// objects that could be loaded into the TPM. -UINT32 -ObjectCapGetTransientAvail( - void -); - -//*** ObjectGetPublicAttributes() -// Returns the attributes associated with an object handles. -TPMA_OBJECT -ObjectGetPublicAttributes( - TPM_HANDLE handle -); - -OBJECT_ATTRIBUTES -ObjectGetProperties( - TPM_HANDLE handle -); - -#endif // _OBJECT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Object_spt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Object_spt_fp.h deleted file mode 100644 index 3dbd2e3ec..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Object_spt_fp.h +++ /dev/null @@ -1,393 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _OBJECT_SPT_FP_H_ -#define _OBJECT_SPT_FP_H_ - -//*** AdjustAuthSize() -// This function will validate that the input authValue is no larger than the -// digestSize for the nameAlg. It will then pad with zeros to the size of the -// digest. -BOOL -AdjustAuthSize( - TPM2B_AUTH *auth, // IN/OUT: value to adjust - TPMI_ALG_HASH nameAlg // IN: -); - -//*** AreAttributesForParent() -// This function is called by create, load, and import functions. -// Note: The 'isParent' attribute is SET when an object is loaded and it has -// attributes that are suitable for a parent object. -// Return Type: BOOL -// TRUE(1) properties are those of a parent -// FALSE(0) properties are not those of a parent -BOOL -ObjectIsParent( - OBJECT *parentObject // IN: parent handle -); - -//*** CreateChecks() -// Attribute checks that are unique to creation. -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES sensitiveDataOrigin is not consistent with the -// object type -// other returns from PublicAttributesValidation() -TPM_RC -CreateChecks( - OBJECT *parentObject, - TPMT_PUBLIC *publicArea, - UINT16 sensitiveDataSize -); - -//*** SchemeChecks -// This function is called by TPM2_LoadExternal() and PublicAttributesValidation(). -// This function validates the schemes in the public area of an object. -// Return Type: TPM_RC -// TPM_RC_HASH non-duplicable storage key and its parent have different -// name algorithm -// TPM_RC_KDF incorrect KDF specified for decrypting keyed hash object -// TPM_RC_KEY invalid key size values in an asymmetric key public area -// TPM_RCS_SCHEME inconsistent attributes 'decrypt', 'sign', 'restricted' -// and key's scheme ID; or hash algorithm is inconsistent -// with the scheme ID for keyed hash object -// TPM_RC_SYMMETRIC a storage key with no symmetric algorithm specified; or -// non-storage key with symmetric algorithm different from -// ALG_NULL -TPM_RC -SchemeChecks( - OBJECT *parentObject, // IN: parent (null if primary seed) - TPMT_PUBLIC *publicArea // IN: public area of the object -); - -//*** PublicAttributesValidation() -// This function validates the values in the public area of an object. -// This function is used in the processing of TPM2_Create, TPM2_CreatePrimary, -// TPM2_CreateLoaded(), TPM2_Load(), TPM2_Import(), and TPM2_LoadExternal(). -// For TPM2_Import() this is only used if the new parent has fixedTPM SET. For -// TPM2_LoadExternal(), this is not used for a public-only key -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'fixedTPM', 'fixedParent', or 'encryptedDuplication' -// attributes are inconsistent between themselves or with -// those of the parent object; -// inconsistent 'restricted', 'decrypt' and 'sign' -// attributes; -// attempt to inject sensitive data for an asymmetric key; -// attempt to create a symmetric cipher key that is not -// a decryption key -// TPM_RC_HASH nameAlg is TPM_ALG_NULL -// TPM_RC_SIZE 'authPolicy' size does not match digest size of the name -// algorithm in 'publicArea' -// other returns from SchemeChecks() -TPM_RC -PublicAttributesValidation( - OBJECT *parentObject, // IN: input parent object - TPMT_PUBLIC *publicArea // IN: public area of the object -); - -//*** FillInCreationData() -// Fill in creation data for an object. -// Return Type: void -void -FillInCreationData( - TPMI_DH_OBJECT parentHandle, // IN: handle of parent - TPMI_ALG_HASH nameHashAlg, // IN: name hash algorithm - TPML_PCR_SELECTION *creationPCR, // IN: PCR selection - TPM2B_DATA *outsideData, // IN: outside data - TPM2B_CREATION_DATA *outCreation, // OUT: creation data for output - TPM2B_DIGEST *creationDigest // OUT: creation digest -); - -//*** GetSeedForKDF() -// Get a seed for KDF. The KDF for encryption and HMAC key use the same seed. -const TPM2B * -GetSeedForKDF( - OBJECT *protector // IN: the protector handle -); - -//*** ProduceOuterWrap() -// This function produce outer wrap for a buffer containing the sensitive data. -// It requires the sensitive data being marshaled to the outerBuffer, with the -// leading bytes reserved for integrity hash. If iv is used, iv space should -// be reserved at the beginning of the buffer. It assumes the sensitive data -// starts at address (outerBuffer + integrity size @). -// This function performs: -// 1. Add IV before sensitive area if required -// 2. encrypt sensitive data, if iv is required, encrypt by iv. otherwise, -// encrypted by a NULL iv -// 3. add HMAC integrity at the beginning of the buffer -// It returns the total size of blob with outer wrap -UINT16 -ProduceOuterWrap( - OBJECT *protector, // IN: The handle of the object that provides - // protection. For object, it is parent - // handle. For credential, it is the handle - // of encrypt object. - TPM2B *name, // IN: the name of the object - TPM_ALG_ID hashAlg, // IN: hash algorithm for outer wrap - TPM2B *seed, // IN: an external seed may be provided for - // duplication blob. For non duplication - // blob, this parameter should be NULL - BOOL useIV, // IN: indicate if an IV is used - UINT16 dataSize, // IN: the size of sensitive data, excluding the - // leading integrity buffer size or the - // optional iv size - BYTE *outerBuffer // IN/OUT: outer buffer with sensitive data in - // it -); - -//*** UnwrapOuter() -// This function remove the outer wrap of a blob containing sensitive data -// This function performs: -// 1. check integrity of outer blob -// 2. decrypt outer blob -// -// Return Type: TPM_RC -// TPM_RCS_INSUFFICIENT error during sensitive data unmarshaling -// TPM_RCS_INTEGRITY sensitive data integrity is broken -// TPM_RCS_SIZE error during sensitive data unmarshaling -// TPM_RCS_VALUE IV size for CFB does not match the encryption -// algorithm block size -TPM_RC -UnwrapOuter( - OBJECT *protector, // IN: The object that provides - // protection. For object, it is parent - // handle. For credential, it is the - // encrypt object. - TPM2B *name, // IN: the name of the object - TPM_ALG_ID hashAlg, // IN: hash algorithm for outer wrap - TPM2B *seed, // IN: an external seed may be provided for - // duplication blob. For non duplication - // blob, this parameter should be NULL. - BOOL useIV, // IN: indicates if an IV is used - UINT16 dataSize, // IN: size of sensitive data in outerBuffer, - // including the leading integrity buffer - // size, and an optional iv area - BYTE *outerBuffer // IN/OUT: sensitive data -); - -//*** SensitiveToPrivate() -// This function prepare the private blob for off the chip storage -// The operations in this function: -// 1. marshal TPM2B_SENSITIVE structure into the buffer of TPM2B_PRIVATE -// 2. apply encryption to the sensitive area. -// 3. apply outer integrity computation. -void -SensitiveToPrivate( - TPMT_SENSITIVE *sensitive, // IN: sensitive structure - TPM2B_NAME *name, // IN: the name of the object - OBJECT *parent, // IN: The parent object - TPM_ALG_ID nameAlg, // IN: hash algorithm in public area. This - // parameter is used when parentHandle is - // NULL, in which case the object is - // temporary. - TPM2B_PRIVATE *outPrivate // OUT: output private structure -); - -//*** PrivateToSensitive() -// Unwrap a input private area. Check the integrity, decrypt and retrieve data -// to a sensitive structure. -// The operations in this function: -// 1. check the integrity HMAC of the input private area -// 2. decrypt the private buffer -// 3. unmarshal TPMT_SENSITIVE structure into the buffer of TPMT_SENSITIVE -// Return Type: TPM_RC -// TPM_RCS_INTEGRITY if the private area integrity is bad -// TPM_RC_SENSITIVE unmarshal errors while unmarshaling TPMS_ENCRYPT -// from input private -// TPM_RCS_SIZE error during sensitive data unmarshaling -// TPM_RCS_VALUE outer wrapper does not have an iV of the correct -// size -TPM_RC -PrivateToSensitive( - TPM2B *inPrivate, // IN: input private structure - TPM2B *name, // IN: the name of the object - OBJECT *parent, // IN: parent object - TPM_ALG_ID nameAlg, // IN: hash algorithm in public area. It is - // passed separately because we only pass - // name, rather than the whole public area - // of the object. This parameter is used in - // the following two cases: 1. primary - // objects. 2. duplication blob with inner - // wrap. In other cases, this parameter - // will be ignored - TPMT_SENSITIVE *sensitive // OUT: sensitive structure -); - -//*** SensitiveToDuplicate() -// This function prepare the duplication blob from the sensitive area. -// The operations in this function: -// 1. marshal TPMT_SENSITIVE structure into the buffer of TPM2B_PRIVATE -// 2. apply inner wrap to the sensitive area if required -// 3. apply outer wrap if required -void -SensitiveToDuplicate( - TPMT_SENSITIVE *sensitive, // IN: sensitive structure - TPM2B *name, // IN: the name of the object - OBJECT *parent, // IN: The new parent object - TPM_ALG_ID nameAlg, // IN: hash algorithm in public area. It - // is passed separately because we - // only pass name, rather than the - // whole public area of the object. - TPM2B *seed, // IN: the external seed. If external - // seed is provided with size of 0, - // no outer wrap should be applied - // to duplication blob. - TPMT_SYM_DEF_OBJECT *symDef, // IN: Symmetric key definition. If the - // symmetric key algorithm is NULL, - // no inner wrap should be applied. - TPM2B_DATA *innerSymKey, // IN/OUT: a symmetric key may be - // provided to encrypt the inner - // wrap of a duplication blob. May - // be generated here if needed. - TPM2B_PRIVATE *outPrivate // OUT: output private structure -); - -//*** DuplicateToSensitive() -// Unwrap a duplication blob. Check the integrity, decrypt and retrieve data -// to a sensitive structure. -// The operations in this function: -// 1. check the integrity HMAC of the input private area -// 2. decrypt the private buffer -// 3. unmarshal TPMT_SENSITIVE structure into the buffer of TPMT_SENSITIVE -// -// Return Type: TPM_RC -// TPM_RC_INSUFFICIENT unmarshaling sensitive data from 'inPrivate' failed -// TPM_RC_INTEGRITY 'inPrivate' data integrity is broken -// TPM_RC_SIZE unmarshaling sensitive data from 'inPrivate' failed -TPM_RC -DuplicateToSensitive( - TPM2B *inPrivate, // IN: input private structure - TPM2B *name, // IN: the name of the object - OBJECT *parent, // IN: the parent - TPM_ALG_ID nameAlg, // IN: hash algorithm in public area. - TPM2B *seed, // IN: an external seed may be provided. - // If external seed is provided with - // size of 0, no outer wrap is - // applied - TPMT_SYM_DEF_OBJECT *symDef, // IN: Symmetric key definition. If the - // symmetric key algorithm is NULL, - // no inner wrap is applied - TPM2B *innerSymKey, // IN: a symmetric key may be provided - // to decrypt the inner wrap of a - // duplication blob. - TPMT_SENSITIVE *sensitive // OUT: sensitive structure -); - -//*** SecretToCredential() -// This function prepare the credential blob from a secret (a TPM2B_DIGEST) -// The operations in this function: -// 1. marshal TPM2B_DIGEST structure into the buffer of TPM2B_ID_OBJECT -// 2. encrypt the private buffer, excluding the leading integrity HMAC area -// 3. compute integrity HMAC and append to the beginning of the buffer. -// 4. Set the total size of TPM2B_ID_OBJECT buffer -void -SecretToCredential( - TPM2B_DIGEST *secret, // IN: secret information - TPM2B *name, // IN: the name of the object - TPM2B *seed, // IN: an external seed. - OBJECT *protector, // IN: the protector - TPM2B_ID_OBJECT *outIDObject // OUT: output credential -); - -//*** CredentialToSecret() -// Unwrap a credential. Check the integrity, decrypt and retrieve data -// to a TPM2B_DIGEST structure. -// The operations in this function: -// 1. check the integrity HMAC of the input credential area -// 2. decrypt the credential buffer -// 3. unmarshal TPM2B_DIGEST structure into the buffer of TPM2B_DIGEST -// -// Return Type: TPM_RC -// TPM_RC_INSUFFICIENT error during credential unmarshaling -// TPM_RC_INTEGRITY credential integrity is broken -// TPM_RC_SIZE error during credential unmarshaling -// TPM_RC_VALUE IV size does not match the encryption algorithm -// block size -TPM_RC -CredentialToSecret( - TPM2B *inIDObject, // IN: input credential blob - TPM2B *name, // IN: the name of the object - TPM2B *seed, // IN: an external seed. - OBJECT *protector, // IN: the protector - TPM2B_DIGEST *secret // OUT: secret information -); - -//*** MemoryRemoveTrailingZeros() -// This function is used to adjust the length of an authorization value. -// It adjusts the size of the TPM2B so that it does not include octets -// at the end of the buffer that contain zero. -// The function returns the number of non-zero octets in the buffer. -UINT16 -MemoryRemoveTrailingZeros( - TPM2B_AUTH *auth // IN/OUT: value to adjust -); - -//*** SetLabelAndContext() -// This function sets the label and context for a derived key. It is possible -// that 'label' or 'context' can end up being an Empty Buffer. -TPM_RC -SetLabelAndContext( - TPMS_DERIVE *labelContext, // IN/OUT: the recovered label and - // context - TPM2B_SENSITIVE_DATA *sensitive // IN: the sensitive data -); - -//*** UnmarshalToPublic() -// Support function to unmarshal the template. This is used because the -// Input may be a TPMT_TEMPLATE and that structure does not have the same -// size as a TPMT_PUBLIC because of the difference between the 'unique' and -// 'seed' fields. -// If 'derive' is not NULL, then the 'seed' field is assumed to contain -// a 'label' and 'context' that are unmarshaled into 'derive'. -TPM_RC -UnmarshalToPublic( - TPMT_PUBLIC *tOut, // OUT: output - TPM2B_TEMPLATE *tIn, // IN: - BOOL derivation, // IN: indicates if this is for a derivation - TPMS_DERIVE *labelContext// OUT: label and context if derivation -); - -//*** ObjectSetExternal() -// Set the external attributes for an object. -void -ObjectSetExternal( - OBJECT *object -); - -#endif // _OBJECT_SPT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Allocate_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Allocate_fp.h deleted file mode 100644 index 0af3dae51..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Allocate_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PCR_Allocate // Command must be enabled - -#ifndef _PCR_Allocate_FP_H_ -#define _PCR_Allocate_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PLATFORM authHandle; - TPML_PCR_SELECTION pcrAllocation; -} PCR_Allocate_In; - -// Output structure definition -typedef struct { - TPMI_YES_NO allocationSuccess; - UINT32 maxPCR; - UINT32 sizeNeeded; - UINT32 sizeAvailable; -} PCR_Allocate_Out; - -// Response code modifiers -#define RC_PCR_Allocate_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_PCR_Allocate_pcrAllocation (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PCR_Allocate( - PCR_Allocate_In *in, - PCR_Allocate_Out *out -); - -#endif // _PCR_Allocate_FP_H_ -#endif // CC_PCR_Allocate diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Event_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Event_fp.h deleted file mode 100644 index 33e3fc341..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Event_fp.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PCR_Event // Command must be enabled - -#ifndef _PCR_Event_FP_H_ -#define _PCR_Event_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_PCR pcrHandle; - TPM2B_EVENT eventData; -} PCR_Event_In; - -// Output structure definition -typedef struct { - TPML_DIGEST_VALUES digests; -} PCR_Event_Out; - -// Response code modifiers -#define RC_PCR_Event_pcrHandle (TPM_RC_H + TPM_RC_1) -#define RC_PCR_Event_eventData (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PCR_Event( - PCR_Event_In *in, - PCR_Event_Out *out -); - -#endif // _PCR_Event_FP_H_ -#endif // CC_PCR_Event diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Extend_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Extend_fp.h deleted file mode 100644 index cc9e6a924..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Extend_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PCR_Extend // Command must be enabled - -#ifndef _PCR_Extend_FP_H_ -#define _PCR_Extend_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_PCR pcrHandle; - TPML_DIGEST_VALUES digests; -} PCR_Extend_In; - -// Response code modifiers -#define RC_PCR_Extend_pcrHandle (TPM_RC_H + TPM_RC_1) -#define RC_PCR_Extend_digests (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PCR_Extend( - PCR_Extend_In *in -); - -#endif // _PCR_Extend_FP_H_ -#endif // CC_PCR_Extend diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Read_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Read_fp.h deleted file mode 100644 index 5a72fab5f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Read_fp.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PCR_Read // Command must be enabled - -#ifndef _PCR_Read_FP_H_ -#define _PCR_Read_FP_H_ - -// Input structure definition -typedef struct { - TPML_PCR_SELECTION pcrSelectionIn; -} PCR_Read_In; - -// Output structure definition -typedef struct { - UINT32 pcrUpdateCounter; - TPML_PCR_SELECTION pcrSelectionOut; - TPML_DIGEST pcrValues; -} PCR_Read_Out; - -// Response code modifiers -#define RC_PCR_Read_pcrSelectionIn (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PCR_Read( - PCR_Read_In *in, - PCR_Read_Out *out -); - -#endif // _PCR_Read_FP_H_ -#endif // CC_PCR_Read diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Reset_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Reset_fp.h deleted file mode 100644 index e47433f57..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_Reset_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PCR_Reset // Command must be enabled - -#ifndef _PCR_Reset_FP_H_ -#define _PCR_Reset_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_PCR pcrHandle; -} PCR_Reset_In; - -// Response code modifiers -#define RC_PCR_Reset_pcrHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PCR_Reset( - PCR_Reset_In *in -); - -#endif // _PCR_Reset_FP_H_ -#endif // CC_PCR_Reset diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_SetAuthPolicy_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_SetAuthPolicy_fp.h deleted file mode 100644 index 8cf671c45..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_SetAuthPolicy_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PCR_SetAuthPolicy // Command must be enabled - -#ifndef _PCR_Set_Auth_Policy_FP_H_ -#define _PCR_Set_Auth_Policy_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PLATFORM authHandle; - TPM2B_DIGEST authPolicy; - TPMI_ALG_HASH hashAlg; - TPMI_DH_PCR pcrNum; -} PCR_SetAuthPolicy_In; - -// Response code modifiers -#define RC_PCR_SetAuthPolicy_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_PCR_SetAuthPolicy_authPolicy (TPM_RC_P + TPM_RC_1) -#define RC_PCR_SetAuthPolicy_hashAlg (TPM_RC_P + TPM_RC_2) -#define RC_PCR_SetAuthPolicy_pcrNum (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_PCR_SetAuthPolicy( - PCR_SetAuthPolicy_In *in -); - -#endif // _PCR_Set_Auth_Policy_FP_H_ -#endif // CC_PCR_SetAuthPolicy diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_SetAuthValue_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_SetAuthValue_fp.h deleted file mode 100644 index 30d3db5d4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_SetAuthValue_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PCR_SetAuthValue // Command must be enabled - -#ifndef _PCR_Set_Auth_Value_FP_H_ -#define _PCR_Set_Auth_Value_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_PCR pcrHandle; - TPM2B_DIGEST auth; -} PCR_SetAuthValue_In; - -// Response code modifiers -#define RC_PCR_SetAuthValue_pcrHandle (TPM_RC_H + TPM_RC_1) -#define RC_PCR_SetAuthValue_auth (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PCR_SetAuthValue( - PCR_SetAuthValue_In *in -); - -#endif // _PCR_Set_Auth_Value_FP_H_ -#endif // CC_PCR_SetAuthValue diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_fp.h deleted file mode 100644 index 002607bf1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PCR_fp.h +++ /dev/null @@ -1,318 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:23:27PM - */ - -#ifndef _PCR_FP_H_ -#define _PCR_FP_H_ - -//*** PCRBelongsAuthGroup() -// This function indicates if a PCR belongs to a group that requires an authValue -// in order to modify the PCR. If it does, 'groupIndex' is set to value of -// the group index. This feature of PCR is decided by the platform specification. -// Return Type: BOOL -// TRUE(1) PCR belongs an authorization group -// FALSE(0) PCR does not belong an authorization group -BOOL -PCRBelongsAuthGroup( - TPMI_DH_PCR handle, // IN: handle of PCR - UINT32 *groupIndex // OUT: group index if PCR belongs a - // group that allows authValue. If PCR - // does not belong to an authorization - // group, the value in this parameter is - // invalid -); - -//*** PCRBelongsPolicyGroup() -// This function indicates if a PCR belongs to a group that requires a policy -// authorization in order to modify the PCR. If it does, 'groupIndex' is set -// to value of the group index. This feature of PCR is decided by the platform -// specification. -// Return Type: BOOL -// TRUE(1) PCR belongs a policy group -// FALSE(0) PCR does not belong a policy group -BOOL -PCRBelongsPolicyGroup( - TPMI_DH_PCR handle, // IN: handle of PCR - UINT32 *groupIndex // OUT: group index if PCR belongs a group that - // allows policy. If PCR does not belong to - // a policy group, the value in this - // parameter is invalid -); - -//*** PCRPolicyIsAvailable() -// This function indicates if a policy is available for a PCR. -// Return Type: BOOL -// TRUE(1) the PCR should be authorized by policy -// FALSE(0) the PCR does not allow policy -BOOL -PCRPolicyIsAvailable( - TPMI_DH_PCR handle // IN: PCR handle -); - -//*** PCRGetAuthValue() -// This function is used to access the authValue of a PCR. If PCR does not -// belong to an authValue group, an EmptyAuth will be returned. -TPM2B_AUTH * -PCRGetAuthValue( - TPMI_DH_PCR handle // IN: PCR handle -); - -//*** PCRGetAuthPolicy() -// This function is used to access the authorization policy of a PCR. It sets -// 'policy' to the authorization policy and returns the hash algorithm for policy -// If the PCR does not allow a policy, TPM_ALG_NULL is returned. -TPMI_ALG_HASH -PCRGetAuthPolicy( - TPMI_DH_PCR handle, // IN: PCR handle - TPM2B_DIGEST *policy // OUT: policy of PCR -); - -//*** PCRSimStart() -// This function is used to initialize the policies when a TPM is manufactured. -// This function would only be called in a manufacturing environment or in -// a TPM simulator. -void -PCRSimStart( - void -); - -//*** PcrIsAllocated() -// This function indicates if a PCR number for the particular hash algorithm -// is allocated. -// Return Type: BOOL -// TRUE(1) PCR is allocated -// FALSE(0) PCR is not allocated -BOOL -PcrIsAllocated( - UINT32 pcr, // IN: The number of the PCR - TPMI_ALG_HASH hashAlg // IN: The PCR algorithm -); - -//*** PcrDrtm() -// This function does the DRTM and H-CRTM processing it is called from -// _TPM_Hash_End. -void -PcrDrtm( - const TPMI_DH_PCR pcrHandle, // IN: the index of the PCR to be - // modified - const TPMI_ALG_HASH hash, // IN: the bank identifier - const TPM2B_DIGEST *digest // IN: the digest to modify the PCR -); - -//*** PCR_ClearAuth() -// This function is used to reset the PCR authorization values. It is called -// on TPM2_Startup(CLEAR) and TPM2_Clear(). -void -PCR_ClearAuth( - void -); - -//*** PCRStartup() -// This function initializes the PCR subsystem at TPM2_Startup(). -BOOL -PCRStartup( - STARTUP_TYPE type, // IN: startup type - BYTE locality // IN: startup locality -); - -//*** PCRStateSave() -// This function is used to save the PCR values that will be restored on TPM Resume. -void -PCRStateSave( - TPM_SU type // IN: startup type -); - -//*** PCRIsStateSaved() -// This function indicates if the selected PCR is a PCR that is state saved -// on TPM2_Shutdown(STATE). The return value is based on PCR attributes. -// Return Type: BOOL -// TRUE(1) PCR is state saved -// FALSE(0) PCR is not state saved -BOOL -PCRIsStateSaved( - TPMI_DH_PCR handle // IN: PCR handle to be extended -); - -//*** PCRIsResetAllowed() -// This function indicates if a PCR may be reset by the current command locality. -// The return value is based on PCR attributes, and not the PCR allocation. -// Return Type: BOOL -// TRUE(1) TPM2_PCR_Reset is allowed -// FALSE(0) TPM2_PCR_Reset is not allowed -BOOL -PCRIsResetAllowed( - TPMI_DH_PCR handle // IN: PCR handle to be extended -); - -//*** PCRChanged() -// This function checks a PCR handle to see if the attributes for the PCR are set -// so that any change to the PCR causes an increment of the pcrCounter. If it does, -// then the function increments the counter. Will also bump the counter if the -// handle is zero which means that PCR 0 can not be in the TCB group. Bump on zero -// is used by TPM2_Clear(). -void -PCRChanged( - TPM_HANDLE pcrHandle // IN: the handle of the PCR that changed. -); - -//*** PCRIsExtendAllowed() -// This function indicates a PCR may be extended at the current command locality. -// The return value is based on PCR attributes, and not the PCR allocation. -// Return Type: BOOL -// TRUE(1) extend is allowed -// FALSE(0) extend is not allowed -BOOL -PCRIsExtendAllowed( - TPMI_DH_PCR handle // IN: PCR handle to be extended -); - -//*** PCRExtend() -// This function is used to extend a PCR in a specific bank. -void -PCRExtend( - TPMI_DH_PCR handle, // IN: PCR handle to be extended - TPMI_ALG_HASH hash, // IN: hash algorithm of PCR - UINT32 size, // IN: size of data to be extended - BYTE *data // IN: data to be extended -); - -//*** PCRComputeCurrentDigest() -// This function computes the digest of the selected PCR. -// -// As a side-effect, 'selection' is modified so that only the implemented PCR -// will have their bits still set. -void -PCRComputeCurrentDigest( - TPMI_ALG_HASH hashAlg, // IN: hash algorithm to compute digest - TPML_PCR_SELECTION *selection, // IN/OUT: PCR selection (filtered on - // output) - TPM2B_DIGEST *digest // OUT: digest -); - -//*** PCRRead() -// This function is used to read a list of selected PCR. If the requested PCR -// number exceeds the maximum number that can be output, the 'selection' is -// adjusted to reflect the actual output PCR. -void -PCRRead( - TPML_PCR_SELECTION *selection, // IN/OUT: PCR selection (filtered on - // output) - TPML_DIGEST *digest, // OUT: digest - UINT32 *pcrCounter // OUT: the current value of PCR generation - // number -); - -//*** PcrWrite() -// This function is used by _TPM_Hash_End to set a PCR to the computed hash -// of the H-CRTM event. -void -PcrWrite( - TPMI_DH_PCR handle, // IN: PCR handle to be extended - TPMI_ALG_HASH hash, // IN: hash algorithm of PCR - TPM2B_DIGEST *digest // IN: the new value -); - -//*** PCRAllocate() -// This function is used to change the PCR allocation. -// Return Type: TPM_RC -// TPM_RC_NO_RESULT allocate failed -// TPM_RC_PCR improper allocation -TPM_RC -PCRAllocate( - TPML_PCR_SELECTION *allocate, // IN: required allocation - UINT32 *maxPCR, // OUT: Maximum number of PCR - UINT32 *sizeNeeded, // OUT: required space - UINT32 *sizeAvailable // OUT: available space -); - -//*** PCRSetValue() -// This function is used to set the designated PCR in all banks to an initial value. -// The initial value is signed and will be sign extended into the entire PCR. -// -void -PCRSetValue( - TPM_HANDLE handle, // IN: the handle of the PCR to set - INT8 initialValue // IN: the value to set -); - -//*** PCRResetDynamics -// This function is used to reset a dynamic PCR to 0. This function is used in -// DRTM sequence. -void -PCRResetDynamics( - void -); - -//*** PCRCapGetAllocation() -// This function is used to get the current allocation of PCR banks. -// Return Type: TPMI_YES_NO -// YES if the return count is 0 -// NO if the return count is not 0 -TPMI_YES_NO -PCRCapGetAllocation( - UINT32 count, // IN: count of return - TPML_PCR_SELECTION *pcrSelection // OUT: PCR allocation list -); - -//*** PCRCapGetProperties() -// This function returns a list of PCR properties starting at 'property'. -// Return Type: TPMI_YES_NO -// YES if no more property is available -// NO if there are more properties not reported -TPMI_YES_NO -PCRCapGetProperties( - TPM_PT_PCR property, // IN: the starting PCR property - UINT32 count, // IN: count of returned properties - TPML_TAGGED_PCR_PROPERTY *select // OUT: PCR select -); - -//*** PCRCapGetHandles() -// This function is used to get a list of handles of PCR, started from 'handle'. -// If 'handle' exceeds the maximum PCR handle range, an empty list will be -// returned and the return value will be NO. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -PCRCapGetHandles( - TPMI_DH_PCR handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle -); - -#endif // _PCR_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PP_Commands_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PP_Commands_fp.h deleted file mode 100644 index 3b67af02c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PP_Commands_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PP_Commands // Command must be enabled - -#ifndef _PP_Commands_FP_H_ -#define _PP_Commands_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PLATFORM auth; - TPML_CC setList; - TPML_CC clearList; -} PP_Commands_In; - -// Response code modifiers -#define RC_PP_Commands_auth (TPM_RC_H + TPM_RC_1) -#define RC_PP_Commands_setList (TPM_RC_P + TPM_RC_1) -#define RC_PP_Commands_clearList (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_PP_Commands( - PP_Commands_In *in -); - -#endif // _PP_Commands_FP_H_ -#endif // CC_PP_Commands diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PP_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PP_fp.h deleted file mode 100644 index 9cf046c35..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PP_fp.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _PP_FP_H_ -#define _PP_FP_H_ - -//*** PhysicalPresencePreInstall_Init() -// This function is used to initialize the array of commands that always require -// confirmation with physical presence. The array is an array of bits that -// has a correspondence with the command code. -// -// This command should only ever be executable in a manufacturing setting or in -// a simulation. -// -// When set, these cannot be cleared. -// -void -PhysicalPresencePreInstall_Init( - void -); - -//*** PhysicalPresenceCommandSet() -// This function is used to set the indicator that a command requires -// PP confirmation. -void -PhysicalPresenceCommandSet( - TPM_CC commandCode // IN: command code -); - -//*** PhysicalPresenceCommandClear() -// This function is used to clear the indicator that a command requires PP -// confirmation. -void -PhysicalPresenceCommandClear( - TPM_CC commandCode // IN: command code -); - -//*** PhysicalPresenceIsRequired() -// This function indicates if PP confirmation is required for a command. -// Return Type: BOOL -// TRUE(1) physical presence is required -// FALSE(0) physical presence is not required -BOOL -PhysicalPresenceIsRequired( - COMMAND_INDEX commandIndex // IN: command index -); - -//*** PhysicalPresenceCapGetCCList() -// This function returns a list of commands that require PP confirmation. The -// list starts from the first implemented command that has a command code that -// the same or greater than 'commandCode'. -// Return Type: TPMI_YES_NO -// YES if there are more command codes available -// NO all the available command codes have been returned -TPMI_YES_NO -PhysicalPresenceCapGetCCList( - TPM_CC commandCode, // IN: start command code - UINT32 count, // IN: count of returned TPM_CC - TPML_CC *commandList // OUT: list of TPM_CC -); - -#endif // _PP_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthValue_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthValue_fp.h deleted file mode 100644 index c78db8f2e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthValue_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyAuthValue // Command must be enabled - -#ifndef _Policy_Auth_Value_FP_H_ -#define _Policy_Auth_Value_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; -} PolicyAuthValue_In; - -// Response code modifiers -#define RC_PolicyAuthValue_policySession (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyAuthValue( - PolicyAuthValue_In *in -); - -#endif // _Policy_Auth_Value_FP_H_ -#endif // CC_PolicyAuthValue diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthorizeNV_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthorizeNV_fp.h deleted file mode 100644 index 77b2fa4c7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthorizeNV_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyAuthorizeNV // Command must be enabled - -#ifndef _Policy_Authorize_NV_FP_H_ -#define _Policy_Authorize_NV_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; - TPMI_SH_POLICY policySession; -} PolicyAuthorizeNV_In; - -// Response code modifiers -#define RC_PolicyAuthorizeNV_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_PolicyAuthorizeNV_nvIndex (TPM_RC_H + TPM_RC_2) -#define RC_PolicyAuthorizeNV_policySession (TPM_RC_H + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_PolicyAuthorizeNV( - PolicyAuthorizeNV_In *in -); - -#endif // _Policy_Authorize_NV_FP_H_ -#endif // CC_PolicyAuthorizeNV diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthorize_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthorize_fp.h deleted file mode 100644 index 3f3a9ffd3..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyAuthorize_fp.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyAuthorize // Command must be enabled - -#ifndef _Policy_Authorize_FP_H_ -#define _Policy_Authorize_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_DIGEST approvedPolicy; - TPM2B_NONCE policyRef; - TPM2B_NAME keySign; - TPMT_TK_VERIFIED checkTicket; -} PolicyAuthorize_In; - -// Response code modifiers -#define RC_PolicyAuthorize_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyAuthorize_approvedPolicy (TPM_RC_P + TPM_RC_1) -#define RC_PolicyAuthorize_policyRef (TPM_RC_P + TPM_RC_2) -#define RC_PolicyAuthorize_keySign (TPM_RC_P + TPM_RC_3) -#define RC_PolicyAuthorize_checkTicket (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_PolicyAuthorize( - PolicyAuthorize_In *in -); - -#endif // _Policy_Authorize_FP_H_ -#endif // CC_PolicyAuthorize diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCommandCode_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCommandCode_fp.h deleted file mode 100644 index 565fb6455..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCommandCode_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyCommandCode // Command must be enabled - -#ifndef _Policy_Command_Code_FP_H_ -#define _Policy_Command_Code_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM_CC code; -} PolicyCommandCode_In; - -// Response code modifiers -#define RC_PolicyCommandCode_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyCommandCode_code (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyCommandCode( - PolicyCommandCode_In *in -); - -#endif // _Policy_Command_Code_FP_H_ -#endif // CC_PolicyCommandCode diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCounterTimer_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCounterTimer_fp.h deleted file mode 100644 index 060a07105..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCounterTimer_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyCounterTimer // Command must be enabled - -#ifndef _Policy_Counter_Timer_FP_H_ -#define _Policy_Counter_Timer_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_OPERAND operandB; - UINT16 offset; - TPM_EO operation; -} PolicyCounterTimer_In; - -// Response code modifiers -#define RC_PolicyCounterTimer_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyCounterTimer_operandB (TPM_RC_P + TPM_RC_1) -#define RC_PolicyCounterTimer_offset (TPM_RC_P + TPM_RC_2) -#define RC_PolicyCounterTimer_operation (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_PolicyCounterTimer( - PolicyCounterTimer_In *in -); - -#endif // _Policy_Counter_Timer_FP_H_ -#endif // CC_PolicyCounterTimer diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCpHash_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCpHash_fp.h deleted file mode 100644 index 788fb429e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyCpHash_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyCpHash // Command must be enabled - -#ifndef _Policy_Cp_Hash_FP_H_ -#define _Policy_Cp_Hash_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_DIGEST cpHashA; -} PolicyCpHash_In; - -// Response code modifiers -#define RC_PolicyCpHash_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyCpHash_cpHashA (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyCpHash( - PolicyCpHash_In *in -); - -#endif // _Policy_Cp_Hash_FP_H_ -#endif // CC_PolicyCpHash diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyDuplicationSelect_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyDuplicationSelect_fp.h deleted file mode 100644 index 17e161c29..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyDuplicationSelect_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyDuplicationSelect // Command must be enabled - -#ifndef _Policy_Duplication_Select_FP_H_ -#define _Policy_Duplication_Select_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_NAME objectName; - TPM2B_NAME newParentName; - TPMI_YES_NO includeObject; -} PolicyDuplicationSelect_In; - -// Response code modifiers -#define RC_PolicyDuplicationSelect_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyDuplicationSelect_objectName (TPM_RC_P + TPM_RC_1) -#define RC_PolicyDuplicationSelect_newParentName (TPM_RC_P + TPM_RC_2) -#define RC_PolicyDuplicationSelect_includeObject (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_PolicyDuplicationSelect( - PolicyDuplicationSelect_In *in -); - -#endif // _Policy_Duplication_Select_FP_H_ -#endif // CC_PolicyDuplicationSelect diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyGetDigest_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyGetDigest_fp.h deleted file mode 100644 index 848bd2fe7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyGetDigest_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyGetDigest // Command must be enabled - -#ifndef _Policy_Get_Digest_FP_H_ -#define _Policy_Get_Digest_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; -} PolicyGetDigest_In; - -// Output structure definition -typedef struct { - TPM2B_DIGEST policyDigest; -} PolicyGetDigest_Out; - -// Response code modifiers -#define RC_PolicyGetDigest_policySession (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyGetDigest( - PolicyGetDigest_In *in, - PolicyGetDigest_Out *out -); - -#endif // _Policy_Get_Digest_FP_H_ -#endif // CC_PolicyGetDigest diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyLocality_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyLocality_fp.h deleted file mode 100644 index ef45ed684..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyLocality_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyLocality // Command must be enabled - -#ifndef _Policy_Locality_FP_H_ -#define _Policy_Locality_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPMA_LOCALITY locality; -} PolicyLocality_In; - -// Response code modifiers -#define RC_PolicyLocality_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyLocality_locality (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyLocality( - PolicyLocality_In *in -); - -#endif // _Policy_Locality_FP_H_ -#endif // CC_PolicyLocality diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNV_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNV_fp.h deleted file mode 100644 index b16beda8f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNV_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyNV // Command must be enabled - -#ifndef _Policy_NV_FP_H_ -#define _Policy_NV_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_NV_AUTH authHandle; - TPMI_RH_NV_INDEX nvIndex; - TPMI_SH_POLICY policySession; - TPM2B_OPERAND operandB; - UINT16 offset; - TPM_EO operation; -} PolicyNV_In; - -// Response code modifiers -#define RC_PolicyNV_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_PolicyNV_nvIndex (TPM_RC_H + TPM_RC_2) -#define RC_PolicyNV_policySession (TPM_RC_H + TPM_RC_3) -#define RC_PolicyNV_operandB (TPM_RC_P + TPM_RC_1) -#define RC_PolicyNV_offset (TPM_RC_P + TPM_RC_2) -#define RC_PolicyNV_operation (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_PolicyNV( - PolicyNV_In *in -); - -#endif // _Policy_NV_FP_H_ -#endif // CC_PolicyNV diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNameHash_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNameHash_fp.h deleted file mode 100644 index 3e3ae8d8c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNameHash_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyNameHash // Command must be enabled - -#ifndef _Policy_Name_Hash_FP_H_ -#define _Policy_Name_Hash_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_DIGEST nameHash; -} PolicyNameHash_In; - -// Response code modifiers -#define RC_PolicyNameHash_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyNameHash_nameHash (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyNameHash( - PolicyNameHash_In *in -); - -#endif // _Policy_Name_Hash_FP_H_ -#endif // CC_PolicyNameHash diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNvWritten_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNvWritten_fp.h deleted file mode 100644 index 2f5ba18f4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyNvWritten_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyNvWritten // Command must be enabled - -#ifndef _Policy_Nv_Written_FP_H_ -#define _Policy_Nv_Written_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPMI_YES_NO writtenSet; -} PolicyNvWritten_In; - -// Response code modifiers -#define RC_PolicyNvWritten_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyNvWritten_writtenSet (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyNvWritten( - PolicyNvWritten_In *in -); - -#endif // _Policy_Nv_Written_FP_H_ -#endif // CC_PolicyNvWritten diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyOR_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyOR_fp.h deleted file mode 100644 index 9db3808c2..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyOR_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyOR // Command must be enabled - -#ifndef _Policy_OR_FP_H_ -#define _Policy_OR_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPML_DIGEST pHashList; -} PolicyOR_In; - -// Response code modifiers -#define RC_PolicyOR_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyOR_pHashList (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyOR( - PolicyOR_In *in -); - -#endif // _Policy_OR_FP_H_ -#endif // CC_PolicyOR diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPCR_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPCR_fp.h deleted file mode 100644 index c5f2940f7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPCR_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyPCR // Command must be enabled - -#ifndef _Policy_PCR_FP_H_ -#define _Policy_PCR_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_DIGEST pcrDigest; - TPML_PCR_SELECTION pcrs; -} PolicyPCR_In; - -// Response code modifiers -#define RC_PolicyPCR_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyPCR_pcrDigest (TPM_RC_P + TPM_RC_1) -#define RC_PolicyPCR_pcrs (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_PolicyPCR( - PolicyPCR_In *in -); - -#endif // _Policy_PCR_FP_H_ -#endif // CC_PolicyPCR diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPassword_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPassword_fp.h deleted file mode 100644 index 712d051e3..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPassword_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyPassword // Command must be enabled - -#ifndef _Policy_Password_FP_H_ -#define _Policy_Password_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; -} PolicyPassword_In; - -// Response code modifiers -#define RC_PolicyPassword_policySession (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyPassword( - PolicyPassword_In *in -); - -#endif // _Policy_Password_FP_H_ -#endif // CC_PolicyPassword diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPhysicalPresence_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPhysicalPresence_fp.h deleted file mode 100644 index 54d5b4004..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyPhysicalPresence_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyPhysicalPresence // Command must be enabled - -#ifndef _Policy_Physical_Presence_FP_H_ -#define _Policy_Physical_Presence_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; -} PolicyPhysicalPresence_In; - -// Response code modifiers -#define RC_PolicyPhysicalPresence_policySession (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyPhysicalPresence( - PolicyPhysicalPresence_In *in -); - -#endif // _Policy_Physical_Presence_FP_H_ -#endif // CC_PolicyPhysicalPresence diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyRestart_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyRestart_fp.h deleted file mode 100644 index 5716be52a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyRestart_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyRestart // Command must be enabled - -#ifndef _Policy_Restart_FP_H_ -#define _Policy_Restart_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY sessionHandle; -} PolicyRestart_In; - -// Response code modifiers -#define RC_PolicyRestart_sessionHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyRestart( - PolicyRestart_In *in -); - -#endif // _Policy_Restart_FP_H_ -#endif // CC_PolicyRestart diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicySecret_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicySecret_fp.h deleted file mode 100644 index fb944da09..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicySecret_fp.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicySecret // Command must be enabled - -#ifndef _Policy_Secret_FP_H_ -#define _Policy_Secret_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_ENTITY authHandle; - TPMI_SH_POLICY policySession; - TPM2B_NONCE nonceTPM; - TPM2B_DIGEST cpHashA; - TPM2B_NONCE policyRef; - INT32 expiration; -} PolicySecret_In; - -// Output structure definition -typedef struct { - TPM2B_TIMEOUT timeout; - TPMT_TK_AUTH policyTicket; -} PolicySecret_Out; - -// Response code modifiers -#define RC_PolicySecret_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_PolicySecret_policySession (TPM_RC_H + TPM_RC_2) -#define RC_PolicySecret_nonceTPM (TPM_RC_P + TPM_RC_1) -#define RC_PolicySecret_cpHashA (TPM_RC_P + TPM_RC_2) -#define RC_PolicySecret_policyRef (TPM_RC_P + TPM_RC_3) -#define RC_PolicySecret_expiration (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_PolicySecret( - PolicySecret_In *in, - PolicySecret_Out *out -); - -#endif // _Policy_Secret_FP_H_ -#endif // CC_PolicySecret diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicySigned_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicySigned_fp.h deleted file mode 100644 index f25ca6ee9..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicySigned_fp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicySigned // Command must be enabled - -#ifndef _Policy_Signed_FP_H_ -#define _Policy_Signed_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT authObject; - TPMI_SH_POLICY policySession; - TPM2B_NONCE nonceTPM; - TPM2B_DIGEST cpHashA; - TPM2B_NONCE policyRef; - INT32 expiration; - TPMT_SIGNATURE auth; -} PolicySigned_In; - -// Output structure definition -typedef struct { - TPM2B_TIMEOUT timeout; - TPMT_TK_AUTH policyTicket; -} PolicySigned_Out; - -// Response code modifiers -#define RC_PolicySigned_authObject (TPM_RC_H + TPM_RC_1) -#define RC_PolicySigned_policySession (TPM_RC_H + TPM_RC_2) -#define RC_PolicySigned_nonceTPM (TPM_RC_P + TPM_RC_1) -#define RC_PolicySigned_cpHashA (TPM_RC_P + TPM_RC_2) -#define RC_PolicySigned_policyRef (TPM_RC_P + TPM_RC_3) -#define RC_PolicySigned_expiration (TPM_RC_P + TPM_RC_4) -#define RC_PolicySigned_auth (TPM_RC_P + TPM_RC_5) - -// Function prototype -TPM_RC -TPM2_PolicySigned( - PolicySigned_In *in, - PolicySigned_Out *out -); - -#endif // _Policy_Signed_FP_H_ -#endif // CC_PolicySigned diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyTemplate_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyTemplate_fp.h deleted file mode 100644 index 2e724d78c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyTemplate_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyTemplate // Command must be enabled - -#ifndef _Policy_Template_FP_H_ -#define _Policy_Template_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_DIGEST templateHash; -} PolicyTemplate_In; - -// Response code modifiers -#define RC_PolicyTemplate_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyTemplate_templateHash (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_PolicyTemplate( - PolicyTemplate_In *in -); - -#endif // _Policy_Template_FP_H_ -#endif // CC_PolicyTemplate diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyTicket_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyTicket_fp.h deleted file mode 100644 index 74dfccb5a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PolicyTicket_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_PolicyTicket // Command must be enabled - -#ifndef _Policy_Ticket_FP_H_ -#define _Policy_Ticket_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_TIMEOUT timeout; - TPM2B_DIGEST cpHashA; - TPM2B_NONCE policyRef; - TPM2B_NAME authName; - TPMT_TK_AUTH ticket; -} PolicyTicket_In; - -// Response code modifiers -#define RC_PolicyTicket_policySession (TPM_RC_H + TPM_RC_1) -#define RC_PolicyTicket_timeout (TPM_RC_P + TPM_RC_1) -#define RC_PolicyTicket_cpHashA (TPM_RC_P + TPM_RC_2) -#define RC_PolicyTicket_policyRef (TPM_RC_P + TPM_RC_3) -#define RC_PolicyTicket_authName (TPM_RC_P + TPM_RC_4) -#define RC_PolicyTicket_ticket (TPM_RC_P + TPM_RC_5) - -// Function prototype -TPM_RC -TPM2_PolicyTicket( - PolicyTicket_In *in -); - -#endif // _Policy_Ticket_FP_H_ -#endif // CC_PolicyTicket diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Policy_AC_SendSelect_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Policy_AC_SendSelect_fp.h deleted file mode 100644 index 316ee7a3b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Policy_AC_SendSelect_fp.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Policy_AC_SendSelect // Command must be enabled - -#ifndef _Policy_AC_Send_Select_FP_H_ -#define _Policy_AC_Send_Select_FP_H_ - -// Input structure definition -typedef struct { - TPMI_SH_POLICY policySession; - TPM2B_NAME objectName; - TPM2B_NAME authHandleName; - TPM2B_NAME acName; - TPMI_YES_NO includeObject; -} Policy_AC_SendSelect_In; - -// Response code modifiers -#define RC_Policy_AC_SendSelect_policySession (TPM_RC_H + TPM_RC_1) -#define RC_Policy_AC_SendSelect_objectName (TPM_RC_P + TPM_RC_1) -#define RC_Policy_AC_SendSelect_authHandleName (TPM_RC_P + TPM_RC_2) -#define RC_Policy_AC_SendSelect_acName (TPM_RC_P + TPM_RC_3) -#define RC_Policy_AC_SendSelect_includeObject (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_Policy_AC_SendSelect( - Policy_AC_SendSelect_In *in -); - -#endif // _Policy_AC_Send_Select_FP_H_ -#endif // CC_Policy_AC_SendSelect diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Policy_spt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Policy_spt_fp.h deleted file mode 100644 index 21717a68d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Policy_spt_fp.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:18PM - */ - -#ifndef _POLICY_SPT_FP_H_ -#define _POLICY_SPT_FP_H_ - -//** Functions -//*** PolicyParameterChecks() -// This function validates the common parameters of TPM2_PolicySiged() -// and TPM2_PolicySecret(). The common parameters are 'nonceTPM', -// 'expiration', and 'cpHashA'. -TPM_RC -PolicyParameterChecks( - SESSION *session, - UINT64 authTimeout, - TPM2B_DIGEST *cpHashA, - TPM2B_NONCE *nonce, - TPM_RC blameNonce, - TPM_RC blameCpHash, - TPM_RC blameExpiration -); - -//*** PolicyContextUpdate() -// Update policy hash -// Update the policyDigest in policy session by extending policyRef and -// objectName to it. This will also update the cpHash if it is present. -// Return Type: void -void -PolicyContextUpdate( - TPM_CC commandCode, // IN: command code - TPM2B_NAME *name, // IN: name of entity - TPM2B_NONCE *ref, // IN: the reference data - TPM2B_DIGEST *cpHash, // IN: the cpHash (optional) - UINT64 policyTimeout, // IN: the timeout value for the policy - SESSION *session // IN/OUT: policy session to be updated -); - -//*** ComputeAuthTimeout() -// This function is used to determine what the authorization timeout value for -// the session should be. -UINT64 -ComputeAuthTimeout( - SESSION *session, // IN: the session containing the time - // values - INT32 expiration, // IN: either the number of seconds from - // the start of the session or the - // time in g_timer; - TPM2B_NONCE *nonce // IN: indicator of the time base -); - -//*** PolicyDigestClear() -// Function to reset the policyDigest of a session -void -PolicyDigestClear( - SESSION *session -); - -BOOL -PolicySptCheckCondition( - TPM_EO operation, - BYTE *opA, - BYTE *opB, - UINT16 size -); - -#endif // _POLICY_SPT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Power_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Power_fp.h deleted file mode 100644 index e6941a062..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Power_fp.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 11:00:49AM - */ - -#ifndef _POWER_FP_H_ -#define _POWER_FP_H_ - -//*** TPMInit() -// This function is used to process a power on event. -void -TPMInit( - void -); - -//*** TPMRegisterStartup() -// This function registers the fact that the TPM has been initialized -// (a TPM2_Startup() has completed successfully). -BOOL -TPMRegisterStartup( - void -); - -//*** TPMIsStarted() -// Indicates if the TPM has been initialized (a TPM2_Startup() has completed -// successfully after a _TPM_Init). -// Return Type: BOOL -// TRUE(1) TPM has been initialized -// FALSE(0) TPM has not been initialized -BOOL -TPMIsStarted( - void -); - -#endif // _POWER_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PropertyCap_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PropertyCap_fp.h deleted file mode 100644 index 20e6ff8f5..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/PropertyCap_fp.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _PROPERTY_CAP_FP_H_ -#define _PROPERTY_CAP_FP_H_ - -//*** TPMCapGetProperties() -// This function is used to get the TPM_PT values. The search of properties will -// start at 'property' and continue until 'propertyList' has as many values as -// will fit, or the last property has been reported, or the list has as many -// values as requested in 'count'. -// Return Type: TPMI_YES_NO -// YES more properties are available -// NO no more properties to be reported -TPMI_YES_NO -TPMCapGetProperties( - TPM_PT property, // IN: the starting TPM property - UINT32 count, // IN: maximum number of returned - // properties - TPML_TAGGED_TPM_PROPERTY *propertyList // OUT: property list -); - -#endif // _PROPERTY_CAP_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Quote_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Quote_fp.h deleted file mode 100644 index 3d9e49c2e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Quote_fp.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Quote // Command must be enabled - -#ifndef _Quote_FP_H_ -#define _Quote_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT signHandle; - TPM2B_DATA qualifyingData; - TPMT_SIG_SCHEME inScheme; - TPML_PCR_SELECTION PCRselect; -} Quote_In; - -// Output structure definition -typedef struct { - TPM2B_ATTEST quoted; - TPMT_SIGNATURE signature; -} Quote_Out; - -// Response code modifiers -#define RC_Quote_signHandle (TPM_RC_H + TPM_RC_1) -#define RC_Quote_qualifyingData (TPM_RC_P + TPM_RC_1) -#define RC_Quote_inScheme (TPM_RC_P + TPM_RC_2) -#define RC_Quote_PCRselect (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_Quote( - Quote_In *in, - Quote_Out *out -); - -#endif // _Quote_FP_H_ -#endif // CC_Quote diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RSA_Decrypt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RSA_Decrypt_fp.h deleted file mode 100644 index edcc718f9..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RSA_Decrypt_fp.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_RSA_Decrypt // Command must be enabled - -#ifndef _RSA_Decrypt_FP_H_ -#define _RSA_Decrypt_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyHandle; - TPM2B_PUBLIC_KEY_RSA cipherText; - TPMT_RSA_DECRYPT inScheme; - TPM2B_DATA label; -} RSA_Decrypt_In; - -// Output structure definition -typedef struct { - TPM2B_PUBLIC_KEY_RSA message; -} RSA_Decrypt_Out; - -// Response code modifiers -#define RC_RSA_Decrypt_keyHandle (TPM_RC_H + TPM_RC_1) -#define RC_RSA_Decrypt_cipherText (TPM_RC_P + TPM_RC_1) -#define RC_RSA_Decrypt_inScheme (TPM_RC_P + TPM_RC_2) -#define RC_RSA_Decrypt_label (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_RSA_Decrypt( - RSA_Decrypt_In *in, - RSA_Decrypt_Out *out -); - -#endif // _RSA_Decrypt_FP_H_ -#endif // CC_RSA_Decrypt diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RSA_Encrypt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RSA_Encrypt_fp.h deleted file mode 100644 index 807cc8a9a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RSA_Encrypt_fp.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_RSA_Encrypt // Command must be enabled - -#ifndef _RSA_Encrypt_FP_H_ -#define _RSA_Encrypt_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyHandle; - TPM2B_PUBLIC_KEY_RSA message; - TPMT_RSA_DECRYPT inScheme; - TPM2B_DATA label; -} RSA_Encrypt_In; - -// Output structure definition -typedef struct { - TPM2B_PUBLIC_KEY_RSA outData; -} RSA_Encrypt_Out; - -// Response code modifiers -#define RC_RSA_Encrypt_keyHandle (TPM_RC_H + TPM_RC_1) -#define RC_RSA_Encrypt_message (TPM_RC_P + TPM_RC_1) -#define RC_RSA_Encrypt_inScheme (TPM_RC_P + TPM_RC_2) -#define RC_RSA_Encrypt_label (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_RSA_Encrypt( - RSA_Encrypt_In *in, - RSA_Encrypt_Out *out -); - -#endif // _RSA_Encrypt_FP_H_ -#endif // CC_RSA_Encrypt diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ReadClock_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ReadClock_fp.h deleted file mode 100644 index 101f7c187..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ReadClock_fp.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ReadClock // Command must be enabled - -#ifndef _Read_Clock_FP_H_ -#define _Read_Clock_FP_H_ - -// Output structure definition -typedef struct { - TPMS_TIME_INFO currentTime; -} ReadClock_Out; - - -// Function prototype -TPM_RC -TPM2_ReadClock( - ReadClock_Out *out -); - -#endif // _Read_Clock_FP_H_ -#endif // CC_ReadClock diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ReadPublic_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ReadPublic_fp.h deleted file mode 100644 index 8d3a9930b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ReadPublic_fp.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ReadPublic // Command must be enabled - -#ifndef _Read_Public_FP_H_ -#define _Read_Public_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT objectHandle; -} ReadPublic_In; - -// Output structure definition -typedef struct { - TPM2B_PUBLIC outPublic; - TPM2B_NAME name; - TPM2B_NAME qualifiedName; -} ReadPublic_Out; - -// Response code modifiers -#define RC_ReadPublic_objectHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_ReadPublic( - ReadPublic_In *in, - ReadPublic_Out *out -); - -#endif // _Read_Public_FP_H_ -#endif // CC_ReadPublic diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ResponseCodeProcessing_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ResponseCodeProcessing_fp.h deleted file mode 100644 index 1beb94983..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ResponseCodeProcessing_fp.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _RESPONSE_CODE_PROCESSING_FP_H_ -#define _RESPONSE_CODE_PROCESSING_FP_H_ - -//** RcSafeAddToResult() -// Adds a modifier to a response code as long as the response code allows a modifier -// and no modifier has already been added. -TPM_RC -RcSafeAddToResult( - TPM_RC responseCode, - TPM_RC modifier -); - -#endif // _RESPONSE_CODE_PROCESSING_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Response_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Response_fp.h deleted file mode 100644 index 551c2e13b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Response_fp.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _RESPONSE_FP_H_ -#define _RESPONSE_FP_H_ - -//** BuildResponseHeader() -// Adds the response header to the response. It will update command->parameterSize -// to indicate the total size of the response. -void -BuildResponseHeader( - COMMAND *command, // IN: main control structure - BYTE *buffer, // OUT: the output buffer - TPM_RC result // IN: the response code -); - -#endif // _RESPONSE_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Rewrap_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Rewrap_fp.h deleted file mode 100644 index 03942d3b6..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Rewrap_fp.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Rewrap // Command must be enabled - -#ifndef _Rewrap_FP_H_ -#define _Rewrap_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT oldParent; - TPMI_DH_OBJECT newParent; - TPM2B_PRIVATE inDuplicate; - TPM2B_NAME name; - TPM2B_ENCRYPTED_SECRET inSymSeed; -} Rewrap_In; - -// Output structure definition -typedef struct { - TPM2B_PRIVATE outDuplicate; - TPM2B_ENCRYPTED_SECRET outSymSeed; -} Rewrap_Out; - -// Response code modifiers -#define RC_Rewrap_oldParent (TPM_RC_H + TPM_RC_1) -#define RC_Rewrap_newParent (TPM_RC_H + TPM_RC_2) -#define RC_Rewrap_inDuplicate (TPM_RC_P + TPM_RC_1) -#define RC_Rewrap_name (TPM_RC_P + TPM_RC_2) -#define RC_Rewrap_inSymSeed (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_Rewrap( - Rewrap_In *in, - Rewrap_Out *out -); - -#endif // _Rewrap_FP_H_ -#endif // CC_Rewrap diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RsaKeyCache_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RsaKeyCache_fp.h deleted file mode 100644 index 9d21ac99e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/RsaKeyCache_fp.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _RSA_KEY_CACHE_FP_H_ -#define _RSA_KEY_CACHE_FP_H_ - -#if USE_RSA_KEY_CACHE - -//*** RsaKeyCacheControl() -// Used to enable and disable the RSA key cache. -LIB_EXPORT void -RsaKeyCacheControl( - int state -); - -//*** GetCachedRsaKey() -// Return Type: BOOL -// TRUE(1) key loaded -// FALSE(0) key not loaded -BOOL -GetCachedRsaKey( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive, - RAND_STATE *rand // IN: if not NULL, the deterministic - // RNG state -); -#endif // defined SIMULATION && defined USE_RSA_KEY_CACHE - -#endif // _RSA_KEY_CACHE_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SelfTest_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SelfTest_fp.h deleted file mode 100644 index 9557e1bf5..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SelfTest_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_SelfTest // Command must be enabled - -#ifndef _Self_Test_FP_H_ -#define _Self_Test_FP_H_ - -// Input structure definition -typedef struct { - TPMI_YES_NO fullTest; -} SelfTest_In; - -// Response code modifiers -#define RC_SelfTest_fullTest (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_SelfTest( - SelfTest_In *in -); - -#endif // _Self_Test_FP_H_ -#endif // CC_SelfTest diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SequenceComplete_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SequenceComplete_fp.h deleted file mode 100644 index 48d73e72a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SequenceComplete_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_SequenceComplete // Command must be enabled - -#ifndef _Sequence_Complete_FP_H_ -#define _Sequence_Complete_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT sequenceHandle; - TPM2B_MAX_BUFFER buffer; - TPMI_RH_HIERARCHY hierarchy; -} SequenceComplete_In; - -// Output structure definition -typedef struct { - TPM2B_DIGEST result; - TPMT_TK_HASHCHECK validation; -} SequenceComplete_Out; - -// Response code modifiers -#define RC_SequenceComplete_sequenceHandle (TPM_RC_H + TPM_RC_1) -#define RC_SequenceComplete_buffer (TPM_RC_P + TPM_RC_1) -#define RC_SequenceComplete_hierarchy (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_SequenceComplete( - SequenceComplete_In *in, - SequenceComplete_Out *out -); - -#endif // _Sequence_Complete_FP_H_ -#endif // CC_SequenceComplete diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SequenceUpdate_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SequenceUpdate_fp.h deleted file mode 100644 index 6a31cc6e7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SequenceUpdate_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_SequenceUpdate // Command must be enabled - -#ifndef _Sequence_Update_FP_H_ -#define _Sequence_Update_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT sequenceHandle; - TPM2B_MAX_BUFFER buffer; -} SequenceUpdate_In; - -// Response code modifiers -#define RC_SequenceUpdate_sequenceHandle (TPM_RC_H + TPM_RC_1) -#define RC_SequenceUpdate_buffer (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_SequenceUpdate( - SequenceUpdate_In *in -); - -#endif // _Sequence_Update_FP_H_ -#endif // CC_SequenceUpdate diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SessionProcess_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SessionProcess_fp.h deleted file mode 100644 index afaa64dab..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SessionProcess_fp.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _SESSION_PROCESS_FP_H_ -#define _SESSION_PROCESS_FP_H_ - -//*** IsDAExempted() -// This function indicates if a handle is exempted from DA logic. -// A handle is exempted if it is -// 1. a primary seed handle, -// 2. an object with noDA bit SET, -// 3. an NV Index with TPMA_NV_NO_DA bit SET, or -// 4. a PCR handle. -// -// Return Type: BOOL -// TRUE(1) handle is exempted from DA logic -// FALSE(0) handle is not exempted from DA logic -BOOL -IsDAExempted( - TPM_HANDLE handle // IN: entity handle -); - -//*** ClearCpRpHashes() -void -ClearCpRpHashes( - COMMAND *command -); - -//*** CompareNameHash() -// This function computes the name hash and compares it to the nameHash in the -// session data. -BOOL -CompareNameHash( - COMMAND *command, // IN: main parsing structure - SESSION *session // IN: session structure with nameHash -); - -//*** ParseSessionBuffer() -// This function is the entry function for command session processing. -// It iterates sessions in session area and reports if the required authorization -// has been properly provided. It also processes audit session and passes the -// information of encryption sessions to parameter encryption module. -// -// Return Type: TPM_RC -// various parsing failure or authorization failure -// -TPM_RC -ParseSessionBuffer( - COMMAND *command // IN: the structure that contains -); - -//*** CheckAuthNoSession() -// Function to process a command with no session associated. -// The function makes sure all the handles in the command require no authorization. -// -// Return Type: TPM_RC -// TPM_RC_AUTH_MISSING failure - one or more handles require -// authorization -TPM_RC -CheckAuthNoSession( - COMMAND *command // IN: command parsing structure -); - -//*** BuildResponseSession() -// Function to build Session buffer in a response. The authorization data is added -// to the end of command->responseBuffer. The size of the authorization area is -// accumulated in command->authSize. -// When this is called, command->responseBuffer is pointing at the next location -// in the response buffer to be filled. This is where the authorization sessions -// will go, if any. command->parameterSize is the number of bytes that have been -// marshaled as parameters in the output buffer. -void -BuildResponseSession( - COMMAND *command // IN: structure that has relevant command - // information -); - -//*** SessionRemoveAssociationToHandle() -// This function deals with the case where an entity associated with an authorization -// is deleted during command processing. The primary use of this is to support -// UndefineSpaceSpecial(). -void -SessionRemoveAssociationToHandle( - TPM_HANDLE handle -); - -#endif // _SESSION_PROCESS_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Session_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Session_fp.h deleted file mode 100644 index 3c8227a2c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Session_fp.h +++ /dev/null @@ -1,287 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:06:42PM - */ - -#ifndef _SESSION_FP_H_ -#define _SESSION_FP_H_ - -//** Startup Function -- SessionStartup() -// This function initializes the session subsystem on TPM2_Startup(). -BOOL -SessionStartup( - STARTUP_TYPE type -); - -//*** SessionIsLoaded() -// This function test a session handle references a loaded session. The handle -// must have previously been checked to make sure that it is a valid handle for -// an authorization session. -// NOTE: A PWAP authorization does not have a session. -// -// Return Type: BOOL -// TRUE(1) session is loaded -// FALSE(0) session is not loaded -// -BOOL -SessionIsLoaded( - TPM_HANDLE handle // IN: session handle -); - -//*** SessionIsSaved() -// This function test a session handle references a saved session. The handle -// must have previously been checked to make sure that it is a valid handle for -// an authorization session. -// NOTE: An password authorization does not have a session. -// -// This function requires that the handle be a valid session handle. -// -// Return Type: BOOL -// TRUE(1) session is saved -// FALSE(0) session is not saved -// -BOOL -SessionIsSaved( - TPM_HANDLE handle // IN: session handle -); - -//*** SequenceNumberForSavedContextIsValid() -// This function validates that the sequence number and handle value within a -// saved context are valid. -BOOL -SequenceNumberForSavedContextIsValid( - TPMS_CONTEXT *context // IN: pointer to a context structure to be - // validated -); - -//*** SessionPCRValueIsCurrent() -// -// This function is used to check if PCR values have been updated since the -// last time they were checked in a policy session. -// -// This function requires the session is loaded. -// Return Type: BOOL -// TRUE(1) PCR value is current -// FALSE(0) PCR value is not current -BOOL -SessionPCRValueIsCurrent( - SESSION *session // IN: session structure -); - -//*** SessionGet() -// This function returns a pointer to the session object associated with a -// session handle. -// -// The function requires that the session is loaded. -SESSION * -SessionGet( - TPM_HANDLE handle // IN: session handle -); - -//*** SessionCreate() -// -// This function does the detailed work for starting an authorization session. -// This is done in a support routine rather than in the action code because -// the session management may differ in implementations. This implementation -// uses a fixed memory allocation to hold sessions and a fixed allocation -// to hold the contextID for the saved contexts. -// -// Return Type: TPM_RC -// TPM_RC_CONTEXT_GAP need to recycle sessions -// TPM_RC_SESSION_HANDLE active session space is full -// TPM_RC_SESSION_MEMORY loaded session space is full -TPM_RC -SessionCreate( - TPM_SE sessionType, // IN: the session type - TPMI_ALG_HASH authHash, // IN: the hash algorithm - TPM2B_NONCE *nonceCaller, // IN: initial nonceCaller - TPMT_SYM_DEF *symmetric, // IN: the symmetric algorithm - TPMI_DH_ENTITY bind, // IN: the bind object - TPM2B_DATA *seed, // IN: seed data - TPM_HANDLE *sessionHandle, // OUT: the session handle - TPM2B_NONCE *nonceTpm // OUT: the session nonce -); - -//*** SessionContextSave() -// This function is called when a session context is to be saved. The -// contextID of the saved session is returned. If no contextID can be -// assigned, then the routine returns TPM_RC_CONTEXT_GAP. -// If the function completes normally, the session slot will be freed. -// -// This function requires that 'handle' references a loaded session. -// Otherwise, it should not be called at the first place. -// -// Return Type: TPM_RC -// TPM_RC_CONTEXT_GAP a contextID could not be assigned. -// TPM_RC_TOO_MANY_CONTEXTSthe counter maxed out -// -TPM_RC -SessionContextSave( - TPM_HANDLE handle, // IN: session handle - CONTEXT_COUNTER *contextID // OUT: assigned contextID -); - -//*** SessionContextLoad() -// This function is used to load a session from saved context. The session -// handle must be for a saved context. -// -// If the gap is at a maximum, then the only session that can be loaded is -// the oldest session, otherwise TPM_RC_CONTEXT_GAP is returned. -/// -// This function requires that 'handle' references a valid saved session. -// -// Return Type: TPM_RC -// TPM_RC_SESSION_MEMORY no free session slots -// TPM_RC_CONTEXT_GAP the gap count is maximum and this -// is not the oldest saved context -// -TPM_RC -SessionContextLoad( - SESSION_BUF *session, // IN: session structure from saved context - TPM_HANDLE *handle // IN/OUT: session handle -); - -//*** SessionFlush() -// This function is used to flush a session referenced by its handle. If the -// session associated with 'handle' is loaded, the session array entry is -// marked as available. -// -// This function requires that 'handle' be a valid active session. -// -void -SessionFlush( - TPM_HANDLE handle // IN: loaded or saved session handle -); - -//*** SessionComputeBoundEntity() -// This function computes the binding value for a session. The binding value -// for a reserved handle is the handle itself. For all the other entities, -// the authValue at the time of binding is included to prevent squatting. -// For those values, the Name and the authValue are concatenated -// into the bind buffer. If they will not both fit, the will be overlapped -// by XORing bytes. If XOR is required, the bind value will be full. -void -SessionComputeBoundEntity( - TPMI_DH_ENTITY entityHandle, // IN: handle of entity - TPM2B_NAME *bind // OUT: binding value -); - -//*** SessionSetStartTime() -// This function is used to initialize the session timing -void -SessionSetStartTime( - SESSION *session // IN: the session to update -); - -//*** SessionResetPolicyData() -// This function is used to reset the policy data without changing the nonce -// or the start time of the session. -void -SessionResetPolicyData( - SESSION *session // IN: the session to reset -); - -//*** SessionCapGetLoaded() -// This function returns a list of handles of loaded session, started -// from input 'handle' -// -// 'Handle' must be in valid loaded session handle range, but does not -// have to point to a loaded session. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -SessionCapGetLoaded( - TPMI_SH_POLICY handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle -); - -//*** SessionCapGetSaved() -// This function returns a list of handles for saved session, starting at -// 'handle'. -// -// 'Handle' must be in a valid handle range, but does not have to point to a -// saved session -// -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -SessionCapGetSaved( - TPMI_SH_HMAC handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle -); - -//*** SessionCapGetLoadedNumber() -// This function return the number of authorization sessions currently -// loaded into TPM RAM. -UINT32 -SessionCapGetLoadedNumber( - void -); - -//*** SessionCapGetLoadedAvail() -// This function returns the number of additional authorization sessions, of -// any type, that could be loaded into TPM RAM. -// NOTE: In other implementations, this number may just be an estimate. The only -// requirement for the estimate is, if it is one or more, then at least one -// session must be loadable. -UINT32 -SessionCapGetLoadedAvail( - void -); - -//*** SessionCapGetActiveNumber() -// This function returns the number of active authorization sessions currently -// being tracked by the TPM. -UINT32 -SessionCapGetActiveNumber( - void -); - -//*** SessionCapGetActiveAvail() -// This function returns the number of additional authorization sessions, of any -// type, that could be created. This not the number of slots for sessions, but -// the number of additional sessions that the TPM is capable of tracking. -UINT32 -SessionCapGetActiveAvail( - void -); - -#endif // _SESSION_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetAlgorithmSet_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetAlgorithmSet_fp.h deleted file mode 100644 index ac1e3bdc1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetAlgorithmSet_fp.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_SetAlgorithmSet // Command must be enabled - -#ifndef _Set_Algorithm_Set_FP_H_ -#define _Set_Algorithm_Set_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PLATFORM authHandle; - UINT32 algorithmSet; -} SetAlgorithmSet_In; - -// Response code modifiers -#define RC_SetAlgorithmSet_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_SetAlgorithmSet_algorithmSet (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_SetAlgorithmSet( - SetAlgorithmSet_In *in -); - -#endif // _Set_Algorithm_Set_FP_H_ -#endif // CC_SetAlgorithmSet diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetCommandCodeAuditStatus_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetCommandCodeAuditStatus_fp.h deleted file mode 100644 index 916aec6b4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetCommandCodeAuditStatus_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_SetCommandCodeAuditStatus // Command must be enabled - -#ifndef _Set_Command_Code_Audit_Status_FP_H_ -#define _Set_Command_Code_Audit_Status_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_PROVISION auth; - TPMI_ALG_HASH auditAlg; - TPML_CC setList; - TPML_CC clearList; -} SetCommandCodeAuditStatus_In; - -// Response code modifiers -#define RC_SetCommandCodeAuditStatus_auth (TPM_RC_H + TPM_RC_1) -#define RC_SetCommandCodeAuditStatus_auditAlg (TPM_RC_P + TPM_RC_1) -#define RC_SetCommandCodeAuditStatus_setList (TPM_RC_P + TPM_RC_2) -#define RC_SetCommandCodeAuditStatus_clearList (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_SetCommandCodeAuditStatus( - SetCommandCodeAuditStatus_In *in -); - -#endif // _Set_Command_Code_Audit_Status_FP_H_ -#endif // CC_SetCommandCodeAuditStatus diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetPrimaryPolicy_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetPrimaryPolicy_fp.h deleted file mode 100644 index c0d23e0a4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SetPrimaryPolicy_fp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_SetPrimaryPolicy // Command must be enabled - -#ifndef _Set_Primary_Policy_FP_H_ -#define _Set_Primary_Policy_FP_H_ - -// Input structure definition -typedef struct { - TPMI_RH_HIERARCHY_AUTH authHandle; - TPM2B_DIGEST authPolicy; - TPMI_ALG_HASH hashAlg; -} SetPrimaryPolicy_In; - -// Response code modifiers -#define RC_SetPrimaryPolicy_authHandle (TPM_RC_H + TPM_RC_1) -#define RC_SetPrimaryPolicy_authPolicy (TPM_RC_P + TPM_RC_1) -#define RC_SetPrimaryPolicy_hashAlg (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_SetPrimaryPolicy( - SetPrimaryPolicy_In *in -); - -#endif // _Set_Primary_Policy_FP_H_ -#endif // CC_SetPrimaryPolicy diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Shutdown_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Shutdown_fp.h deleted file mode 100644 index 4bb93d716..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Shutdown_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Shutdown // Command must be enabled - -#ifndef _Shutdown_FP_H_ -#define _Shutdown_FP_H_ - -// Input structure definition -typedef struct { - TPM_SU shutdownType; -} Shutdown_In; - -// Response code modifiers -#define RC_Shutdown_shutdownType (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_Shutdown( - Shutdown_In *in -); - -#endif // _Shutdown_FP_H_ -#endif // CC_Shutdown diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Sign_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Sign_fp.h deleted file mode 100644 index 0acab7ddd..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Sign_fp.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Sign // Command must be enabled - -#ifndef _Sign_FP_H_ -#define _Sign_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyHandle; - TPM2B_DIGEST digest; - TPMT_SIG_SCHEME inScheme; - TPMT_TK_HASHCHECK validation; -} Sign_In; - -// Output structure definition -typedef struct { - TPMT_SIGNATURE signature; -} Sign_Out; - -// Response code modifiers -#define RC_Sign_keyHandle (TPM_RC_H + TPM_RC_1) -#define RC_Sign_digest (TPM_RC_P + TPM_RC_1) -#define RC_Sign_inScheme (TPM_RC_P + TPM_RC_2) -#define RC_Sign_validation (TPM_RC_P + TPM_RC_3) - -// Function prototype -TPM_RC -TPM2_Sign( - Sign_In *in, - Sign_Out *out -); - -#endif // _Sign_FP_H_ -#endif // CC_Sign diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/StartAuthSession_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/StartAuthSession_fp.h deleted file mode 100644 index b1c9c778f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/StartAuthSession_fp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_StartAuthSession // Command must be enabled - -#ifndef _Start_Auth_Session_FP_H_ -#define _Start_Auth_Session_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT tpmKey; - TPMI_DH_ENTITY bind; - TPM2B_NONCE nonceCaller; - TPM2B_ENCRYPTED_SECRET encryptedSalt; - TPM_SE sessionType; - TPMT_SYM_DEF symmetric; - TPMI_ALG_HASH authHash; -} StartAuthSession_In; - -// Output structure definition -typedef struct { - TPMI_SH_AUTH_SESSION sessionHandle; - TPM2B_NONCE nonceTPM; -} StartAuthSession_Out; - -// Response code modifiers -#define RC_StartAuthSession_tpmKey (TPM_RC_H + TPM_RC_1) -#define RC_StartAuthSession_bind (TPM_RC_H + TPM_RC_2) -#define RC_StartAuthSession_nonceCaller (TPM_RC_P + TPM_RC_1) -#define RC_StartAuthSession_encryptedSalt (TPM_RC_P + TPM_RC_2) -#define RC_StartAuthSession_sessionType (TPM_RC_P + TPM_RC_3) -#define RC_StartAuthSession_symmetric (TPM_RC_P + TPM_RC_4) -#define RC_StartAuthSession_authHash (TPM_RC_P + TPM_RC_5) - -// Function prototype -TPM_RC -TPM2_StartAuthSession( - StartAuthSession_In *in, - StartAuthSession_Out *out -); - -#endif // _Start_Auth_Session_FP_H_ -#endif // CC_StartAuthSession diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Startup_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Startup_fp.h deleted file mode 100644 index 96f03e584..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Startup_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Startup // Command must be enabled - -#ifndef _Startup_FP_H_ -#define _Startup_FP_H_ - -// Input structure definition -typedef struct { - TPM_SU startupType; -} Startup_In; - -// Response code modifiers -#define RC_Startup_startupType (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_Startup( - Startup_In *in -); - -#endif // _Startup_FP_H_ -#endif // CC_Startup diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/StirRandom_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/StirRandom_fp.h deleted file mode 100644 index 33b610a38..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/StirRandom_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_StirRandom // Command must be enabled - -#ifndef _Stir_Random_FP_H_ -#define _Stir_Random_FP_H_ - -// Input structure definition -typedef struct { - TPM2B_SENSITIVE_DATA inData; -} StirRandom_In; - -// Response code modifiers -#define RC_StirRandom_inData (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_StirRandom( - StirRandom_In *in -); - -#endif // _Stir_Random_FP_H_ -#endif // CC_StirRandom diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TestParms_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TestParms_fp.h deleted file mode 100644 index 78a66b82d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TestParms_fp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_TestParms // Command must be enabled - -#ifndef _Test_Parms_FP_H_ -#define _Test_Parms_FP_H_ - -// Input structure definition -typedef struct { - TPMT_PUBLIC_PARMS parameters; -} TestParms_In; - -// Response code modifiers -#define RC_TestParms_parameters (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_TestParms( - TestParms_In *in -); - -#endif // _Test_Parms_FP_H_ -#endif // CC_TestParms diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Ticket_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Ticket_fp.h deleted file mode 100644 index c18de287d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Ticket_fp.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _TICKET_FP_H_ -#define _TICKET_FP_H_ - -//*** TicketIsSafe() -// This function indicates if producing a ticket is safe. -// It checks if the leading bytes of an input buffer is TPM_GENERATED_VALUE -// or its substring of canonical form. If so, it is not safe to produce ticket -// for an input buffer claiming to be TPM generated buffer -// Return Type: BOOL -// TRUE(1) safe to produce ticket -// FALSE(0) not safe to produce ticket -BOOL -TicketIsSafe( - TPM2B *buffer -); - -//*** TicketComputeVerified() -// This function creates a TPMT_TK_VERIFIED ticket. -void -TicketComputeVerified( - TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy constant for ticket - TPM2B_DIGEST *digest, // IN: digest - TPM2B_NAME *keyName, // IN: name of key that signed the values - TPMT_TK_VERIFIED *ticket // OUT: verified ticket -); - -//*** TicketComputeAuth() -// This function creates a TPMT_TK_AUTH ticket. -void -TicketComputeAuth( - TPM_ST type, // IN: the type of ticket. - TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy constant for ticket - UINT64 timeout, // IN: timeout - BOOL expiresOnReset,// IN: flag to indicate if ticket expires on - // TPM Reset - TPM2B_DIGEST *cpHashA, // IN: input cpHashA - TPM2B_NONCE *policyRef, // IN: input policyRef - TPM2B_NAME *entityName, // IN: name of entity - TPMT_TK_AUTH *ticket // OUT: Created ticket -); - -//*** TicketComputeHashCheck() -// This function creates a TPMT_TK_HASHCHECK ticket. -void -TicketComputeHashCheck( - TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy constant for ticket - TPM_ALG_ID hashAlg, // IN: the hash algorithm for 'digest' - TPM2B_DIGEST *digest, // IN: input digest - TPMT_TK_HASHCHECK *ticket // OUT: Created ticket -); - -//*** TicketComputeCreation() -// This function creates a TPMT_TK_CREATION ticket. -void -TicketComputeCreation( - TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy for ticket - TPM2B_NAME *name, // IN: object name - TPM2B_DIGEST *creation, // IN: creation hash - TPMT_TK_CREATION *ticket // OUT: created ticket -); - -#endif // _TICKET_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Time_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Time_fp.h deleted file mode 100644 index 81c2ea953..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Time_fp.h +++ /dev/null @@ -1,139 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 04:23:27PM - */ - -#ifndef _TIME_FP_H_ -#define _TIME_FP_H_ - -//*** TimePowerOn() -// This function initialize time info at _TPM_Init(). -// -// This function is called at _TPM_Init() so that the TPM time can start counting -// as soon as the TPM comes out of reset and doesn't have to wait until -// TPM2_Startup() in order to begin the new time epoch. This could be significant -// for systems that could get powered up but not run any TPM commands for some -// period of time. -// -void -TimePowerOn( - void -); - -//*** TimeStartup() -// This function updates the resetCount and restartCount components of -// TPMS_CLOCK_INFO structure at TPM2_Startup(). -// -// This function will deal with the deferred creation of a new epoch. -// TimeUpdateToCurrent() will not start a new epoch even if one is due when -// TPM_Startup() has not been run. This is because the state of NV is not known -// until startup completes. When Startup is done, then it will create the epoch -// nonce to complete the initializations by calling this function. -BOOL -TimeStartup( - STARTUP_TYPE type // IN: start up type -); - -//*** TimeClockUpdate() -// This function updates go.clock. If 'newTime' requires an update of NV, then -// NV is checked for availability. If it is not available or is rate limiting, then -// go.clock is not updated and the function returns an error. If 'newTime' would -// not cause an NV write, then go.clock is updated. If an NV write occurs, then -// go.safe is SET. -void -TimeClockUpdate( - UINT64 newTime // IN: New time value in mS. -); - -//*** TimeUpdate() -// This function is used to update the time and clock values. If the TPM -// has run TPM2_Startup(), this function is called at the start of each command. -// If the TPM has not run TPM2_Startup(), this is called from TPM2_Startup() to -// get the clock values initialized. It is not called on command entry because, in -// this implementation, the go structure is not read from NV until TPM2_Startup(). -// The reason for this is that the initialization code (_TPM_Init()) may run before -// NV is accessible. -void -TimeUpdate( - void -); - -//*** TimeUpdateToCurrent() -// This function updates the 'Time' and 'Clock' in the global -// TPMS_TIME_INFO structure. -// -// In this implementation, 'Time' and 'Clock' are updated at the beginning -// of each command and the values are unchanged for the duration of the -// command. -// -// Because 'Clock' updates may require a write to NV memory, 'Time' and 'Clock' -// are not allowed to advance if NV is not available. When clock is not advancing, -// any function that uses 'Clock' will fail and return TPM_RC_NV_UNAVAILABLE or -// TPM_RC_NV_RATE. -// -// This implementation does not do rate limiting. If the implementation does do -// rate limiting, then the 'Clock' update should not be inhibited even when doing -// rate limiting. -void -TimeUpdateToCurrent( - void -); - -//*** TimeSetAdjustRate() -// This function is used to perform rate adjustment on 'Time' and 'Clock'. -void -TimeSetAdjustRate( - TPM_CLOCK_ADJUST adjust // IN: adjust constant -); - -//*** TimeGetMarshaled() -// This function is used to access TPMS_TIME_INFO in canonical form. -// The function collects the time information and marshals it into 'dataBuffer' -// and returns the marshaled size -UINT16 -TimeGetMarshaled( - TIME_INFO *dataBuffer // OUT: result buffer -); - -//*** TimeFillInfo -// This function gathers information to fill in a TPMS_CLOCK_INFO structure. -void -TimeFillInfo( - TPMS_CLOCK_INFO *clockInfo -); - -#endif // _TIME_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmASN1_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmASN1_fp.h deleted file mode 100644 index 9f78d7bb0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmASN1_fp.h +++ /dev/null @@ -1,234 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 11:00:49AM - */ - -#ifndef _TPM_ASN1_FP_H_ -#define _TPM_ASN1_FP_H_ - -//*** ASN1UnmarshalContextInitialize() -// Function does standard initialization of a context. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -BOOL -ASN1UnmarshalContextInitialize( - ASN1UnmarshalContext *ctx, - INT16 size, - BYTE *buffer -); - -//***ASN1DecodeLength() -// This function extracts the length of an element from 'buffer' starting at 'offset'. -// Return Type: UINT16 -// >=0 the extracted length -// <0 an error -INT16 -ASN1DecodeLength( - ASN1UnmarshalContext *ctx -); - -//***ASN1NextTag() -// This function extracts the next type from 'buffer' starting at 'offset'. -// It advances 'offset' as it parses the type and the length of the type. It returns -// the length of the type. On return, the 'length' octets starting at 'offset' are the -// octets of the type. -// Return Type: UINT -// >=0 the number of octets in 'type' -// <0 an error -INT16 -ASN1NextTag( - ASN1UnmarshalContext *ctx -); - -//*** ASN1GetBitStringValue() -// Try to parse a bit string of up to 32 bits from a value that is expected to be -// a bit string. -// If there is a general parsing error, the context->size is set to -1. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -BOOL -ASN1GetBitStringValue( - ASN1UnmarshalContext *ctx, - UINT32 *val -); - -//*** ASN1InitialializeMarshalContext() -// This creates a structure for handling marshaling of an ASN.1 formatted data -// structure. -void -ASN1InitialializeMarshalContext( - ASN1MarshalContext *ctx, - INT16 length, - BYTE *buffer -); - -//*** ASN1StartMarshalContext() -// This starts a new constructed element. It is constructed on 'top' of the value -// that was previously placed in the structure. -void -ASN1StartMarshalContext( - ASN1MarshalContext *ctx -); - -//*** ASN1EndMarshalContext() -// This function restores the end pointer for an encapsulating structure. -// Return Type: INT16 -// > 0 the size of the encapsulated structure that was just ended -// <= 0 an error -INT16 -ASN1EndMarshalContext( - ASN1MarshalContext *ctx -); - -//***ASN1EndEncapsulation() -// This function puts a tag and length in the buffer. In this function, an embedded -// BIT_STRING is assumed to be a collection of octets. To indicate that all bits -// are used, a byte of zero is prepended. If a raw bit-string is needed, a new -// function like ASN1PushInteger() would be needed. -// Return Type: INT16 -// > 0 number of octets in the encapsulation -// == 0 failure -UINT16 -ASN1EndEncapsulation( - ASN1MarshalContext *ctx, - BYTE tag -); - -//*** ASN1PushByte() -BOOL -ASN1PushByte( - ASN1MarshalContext *ctx, - BYTE b -); - -//*** ASN1PushBytes() -// Push some raw bytes onto the buffer. 'count' cannot be zero. -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushBytes( - ASN1MarshalContext *ctx, - INT16 count, - const BYTE *buffer -); - -//*** ASN1PushNull() -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushNull( - ASN1MarshalContext *ctx -); - -//*** ASN1PushLength() -// Push a length value. This will only handle length values that fit in an INT16. -// Return Type: UINT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushLength( - ASN1MarshalContext *ctx, - INT16 len -); - -//*** ASN1PushTagAndLength() -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushTagAndLength( - ASN1MarshalContext *ctx, - BYTE tag, - INT16 length -); - -//*** ASN1PushTaggedOctetString() -// This function will push a random octet string. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushTaggedOctetString( - ASN1MarshalContext *ctx, - INT16 size, - const BYTE *string, - BYTE tag -); - -//*** ASN1PushUINT() -// This function pushes an native-endian integer value. This just changes a -// native-endian integer into a big-endian byte string and calls ASN1PushInteger(). -// That function will remove leading zeros and make sure that the number is positive. -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushUINT( - ASN1MarshalContext *ctx, - UINT32 integer -); - -//*** ASN1PushInteger -// Push a big-endian integer on the end of the buffer -// Return Type: UINT16 -// > 0 the number of bytes marshaled for the integer -// == 0 failure -INT16 -ASN1PushInteger( - ASN1MarshalContext *ctx, // IN/OUT: buffer context - INT16 iLen, // IN: octets of the integer - BYTE *integer // IN: big-endian integer -); - -//*** ASN1PushOID() -// This function is used to add an OID. An OID is 0x06 followed by a byte of size -// followed by size bytes. This is used to avoid having to do anything special in the -// definition of an OID. -// Return Type: UINT16 -// > 0 the number of bytes marshaled for the integer -// == 0 failure -INT16 -ASN1PushOID( - ASN1MarshalContext *ctx, - const BYTE *OID -); - -#endif // _TPM_ASN1_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmFail_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmFail_fp.h deleted file mode 100644 index 998d16b12..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmFail_fp.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _TPM_FAIL_FP_H_ -#define _TPM_FAIL_FP_H_ - -//*** SetForceFailureMode() -// This function is called by the simulator to enable failure mode testing. -#if SIMULATION -LIB_EXPORT void -SetForceFailureMode( - void -); -#endif - -//*** TpmLogFailure() -// This function saves the failure values when the code will continue to operate. It -// if similar to TpmFail() but returns to the caller. The assumption is that the -// caller will propagate a failure back up the stack. -void -TpmLogFailure( -#if FAIL_TRACE - const char *function, - int line, -#endif - int code -); - -//*** TpmFail() -// This function is called by TPM.lib when a failure occurs. It will set up the -// failure values to be returned on TPM2_GetTestResult(). -NORETURN void -TpmFail( -#if FAIL_TRACE - const char *function, - int line, -#endif - int code -); - -//*** TpmFailureMode( -// This function is called by the interface code when the platform is in failure -// mode. -void -TpmFailureMode( - unsigned int inRequestSize, // IN: command buffer size - unsigned char *inRequest, // IN: command buffer - unsigned int *outResponseSize, // OUT: response buffer size - unsigned char **outResponse // OUT: response buffer -); - -//*** UnmarshalFail() -// This is a stub that is used to catch an attempt to unmarshal an entry -// that is not defined. Don't ever expect this to be called but... -void -UnmarshalFail( - void *type, - BYTE **buffer, - INT32 *size -); - -#endif // _TPM_FAIL_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmSizeChecks_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmSizeChecks_fp.h deleted file mode 100644 index 236f9d0d0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmSizeChecks_fp.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _TPM_SIZE_CHECKS_FP_H_ -#define _TPM_SIZE_CHECKS_FP_H_ - -#if RUNTIME_SIZE_CHECKS - -//** TpmSizeChecks() -// This function is used during the development process to make sure that the -// vendor-specific values result in a consistent implementation. When possible, -// the code contains #if to do compile-time checks. However, in some cases, the -// values require the use of "sizeof()" and that can't be used in an #if. -void -TpmSizeChecks( - void -); -#endif // RUNTIME_SIZE_CHECKS - -#endif // _TPM_SIZE_CHECKS_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcDesSupport_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcDesSupport_fp.h deleted file mode 100644 index 53aef9517..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcDesSupport_fp.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/*(Auto) - Automatically Generated by TpmPrototypes version 2.2 February 10, 2016 - Date: Sep 9, 2016 Time: 01:03:57 PM -*/ - -#ifndef _TPMTOLTCDESSUPPORT_FP_H_ -#define _TPMTOLTCDESSUPPORT_FP_H_ - -#if SYM_LIB == LTC && defined TPM_ALG_TDES -//** TDES_setup -// This function calls the LTC function to generate a TDES key schedule. If the -// key is one DES key (8 bytes), then it is replicated two more times to create a -// 24-byte TDES key. If the key is two key (16 bytes), then the first DES key is -// replicated to the third key position. -void TDES_setup( - const BYTE *key, - UINT32 keyBits, - symmetric_key *skey - ); -#endif - - -#endif // _TPMTOLTCDESSUPPORT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcMath_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcMath_fp.h deleted file mode 100644 index 2e6577cd4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcMath_fp.h +++ /dev/null @@ -1,150 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/*(Auto) - Automatically Generated by TpmPrototypes version 2.2 February 10, 2016 - Date: Mar 23, 2017 Time: 03:31:51 PM -*/ - -#ifndef _TPMTOLTCMATH_FP_H_ -#define _TPMTOLTCMATH_FP_H_ - -#if MATH_LIB == LTC -//*** BnModMult() -// Does multiply and divide returning the remainder of the divide. -LIB_EXPORT BOOL -BnModMult( - bigNum result, - bigConst op1, - bigConst op2, - bigConst modulus - ); - -//*** BnMult() -// Multiplies two numbers -LIB_EXPORT BOOL -BnMult( - bigNum result, - bigConst multiplicand, - bigConst multiplier - ); - -//*** BnDiv() -// This function divides two BIGNUM values. The function always returns TRUE. -LIB_EXPORT BOOL -BnDiv( - bigNum quotient, - bigNum remainder, - bigConst dividend, - bigConst divisor - ); - -#ifdef TPM_ALG_RSA -//*** BnGcd() -// Get the greatest common divisor of two numbers -LIB_EXPORT BOOL -BnGcd( - bigNum gcd, // OUT: the common divisor - bigConst number1, // IN: - bigConst number2 // IN: - ); - -//***BnModExp() -// Do modular exponentiation using BIGNUM values. The conversion from a bignum_t -// to a BIGNUM is trivial as they are based on the same structure -LIB_EXPORT BOOL -BnModExp( - bigNum result, // OUT: the result - bigConst number, // IN: number to exponentiate - bigConst exponent, // IN: - bigConst modulus // IN: - ); - -//*** BnModInverse() -// Modular multiplicative inverse -LIB_EXPORT BOOL -BnModInverse( - bigNum result, - bigConst number, - bigConst modulus - ); -#endif // TPM_ALG_RSA - -#ifdef TPM_ALG_ECC -//*** BnEccModMult() -// This function does a point multiply of the form R = [d]S -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' - bigConst d, // IN: scalar for [d]S - bigCurve E - ); - -//*** BnEccModMult2() -// This function does a point multiply of the form R = [d]S + [u]Q -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult2( - bigPoint R, // OUT: computed point - pointConst S, // IN: first point (optional) - bigConst d, // IN: scalar for [d]S or [d]G - pointConst Q, // IN: second point - bigConst u, // IN: second scalar - bigCurve E // IN: curve - ); - -//*** BnEccAdd() -// This function does addition of two points. Since this is not implemented -// in LibTomCrypt() will try to trick it by doing multiply with scalar of 1. -// I have no idea if this will work and it's not needed unless MQV or the SM2 -// variant is enabled. -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccAdd( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' - pointConst Q, // IN: second point - bigCurve E // IN: curve - ); -#endif // TPM_ALG_ECC -#endif // MATH_LIB == LTC - - -#endif // _TPMTOLTCMATH_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcSupport_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcSupport_fp.h deleted file mode 100644 index f0d482c70..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToLtcSupport_fp.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/*(Auto) - Automatically Generated by TpmPrototypes version 2.2 February 10, 2016 - Date: Sep 9, 2016 Time: 01:03:57 PM -*/ - -#ifndef _TPMTOLTCSUPPORT_FP_H_ -#define _TPMTOLTCSUPPORT_FP_H_ - -#if MATH_LIB == LTC -//*** LtcRand() -// This is a stub function that is called from the LibTomCrypt or libmpa code -// to get a random number. In turn, this will call the random RandGenerate -// function that was passed in LibraryInit(). This function will pass the pointer -// to the current rand state along with the random byte request. -uint32_t LtcRand( - void *buf, - size_t blen - ); - -//*** SupportLibInit() -// This does any initialization required by the support library. -LIB_EXPORT int -SupportLibInit( - void - ); - -//*** LtcPoolInit() -// Function to initialize a pool. **** -LIB_EXPORT mpa_scratch_mem -LtcPoolInit( - mpa_word_t *poolAddress, - int vars, - int bits - ); -#endif // MATH_LIB == LTC - - -#endif // _TPMTOLTCSUPPORT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslDesSupport_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslDesSupport_fp.h deleted file mode 100644 index e8d45f23b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslDesSupport_fp.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _TPM_TO_OSSL_DES_SUPPORT_FP_H_ -#define _TPM_TO_OSSL_DES_SUPPORT_FP_H_ - -#if (defined SYM_LIB_OSSL) && ALG_TDES - -//**Functions -//*** TDES_set_encyrpt_key() -// This function makes creation of a TDES key look like the creation of a key for -// any of the other OpenSSL block ciphers. It will create three key schedules, -// one for each of the DES keys. If there are only two keys, then the third schedule -// is a copy of the first. -void -TDES_set_encrypt_key( - const BYTE *key, - UINT16 keySizeInBits, - tpmKeyScheduleTDES *keySchedule -); - -//*** TDES_encyrpt() -// The TPM code uses one key schedule. For TDES, the schedule contains three -// schedules. OpenSSL wants the schedules referenced separately. This function -// does that. -void TDES_encrypt( - const BYTE *in, - BYTE *out, - tpmKeyScheduleTDES *ks -); - -//*** TDES_decrypt() -// As with TDES_encypt() this function bridges between the TPM single schedule -// model and the OpenSSL three schedule model. -void TDES_decrypt( - const BYTE *in, - BYTE *out, - tpmKeyScheduleTDES *ks -); -#endif // SYM_LIB_OSSL - -#endif // _TPM_TO_OSSL_DES_SUPPORT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslMath_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslMath_fp.h deleted file mode 100644 index 81cbc972f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslMath_fp.h +++ /dev/null @@ -1,223 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 03:18:00PM - */ - -#ifndef _TPM_TO_OSSL_MATH_FP_H_ -#define _TPM_TO_OSSL_MATH_FP_H_ - -#ifdef MATH_LIB_OSSL - -//*** OsslToTpmBn() -// This function converts an OpenSSL BIGNUM to a TPM bignum. In this implementation -// it is assumed that OpenSSL uses a different control structure but the same data -// layout -- an array of native-endian words in little-endian order. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure because value will not fit or OpenSSL variable doesn't -// exist -BOOL -OsslToTpmBn( - bigNum bn, - BIGNUM *osslBn -); - -//*** BigInitialized() -// This function initializes an OSSL BIGNUM from a TPM bigConst. Do not use this for -// values that are passed to OpenSLL when they are not declared as const in the -// function prototype. Instead, use BnNewVariable(). -BIGNUM * -BigInitialized( - BIGNUM *toInit, - bigConst initializer -); -#if LIBRARY_COMPATIBILITY_CHECK - -//*** MathLibraryCompatibilityCheck() -void -MathLibraryCompatibilityCheck( - void -); -#endif - -//*** BnModMult() -// This function does a modular multiply. It first does a multiply and then a divide -// and returns the remainder of the divide. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnModMult( - bigNum result, - bigConst op1, - bigConst op2, - bigConst modulus -); - -//*** BnMult() -// Multiplies two numbers -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnMult( - bigNum result, - bigConst multiplicand, - bigConst multiplier -); - -//*** BnDiv() -// This function divides two bigNum values. The function returns FALSE if -// there is an error in the operation. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnDiv( - bigNum quotient, - bigNum remainder, - bigConst dividend, - bigConst divisor -); - -#if ALG_RSA -//*** BnGcd() -// Get the greatest common divisor of two numbers -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnGcd( - bigNum gcd, // OUT: the common divisor - bigConst number1, // IN: - bigConst number2 // IN: -); - -//***BnModExp() -// Do modular exponentiation using bigNum values. The conversion from a bignum_t to -// a bigNum is trivial as they are based on the same structure -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnModExp( - bigNum result, // OUT: the result - bigConst number, // IN: number to exponentiate - bigConst exponent, // IN: - bigConst modulus // IN: -); - -//*** BnModInverse() -// Modular multiplicative inverse -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnModInverse( - bigNum result, - bigConst number, - bigConst modulus -); -#endif // ALG_RSA -#if ALG_ECC - -//*** BnCurveInitialize() -// This function initializes the OpenSSL curve information structure. This -// structure points to the TPM-defined values for the curve, to the context for the -// number values in the frame, and to the OpenSSL-defined group values. -// Return Type: bigCurve * -// NULL the TPM_ECC_CURVE is not valid or there was a problem in -// in initializing the curve data -// non-NULL points to 'E' -LIB_EXPORT bigCurve -BnCurveInitialize( - bigCurve E, // IN: curve structure to initialize - TPM_ECC_CURVE curveId // IN: curve identifier -); - -//*** BnCurveFree() -// This function will free the allocated components of the curve and end the -// frame in which the curve data exists -LIB_EXPORT void -BnCurveFree( - bigCurve E -); - -//*** BnEccModMult() -// This function does a point multiply of the form R = [d]S -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' (optional) - bigConst d, // IN: scalar for [d]S - bigCurve E -); - -//*** BnEccModMult2() -// This function does a point multiply of the form R = [d]G + [u]Q -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult2( - bigPoint R, // OUT: computed point - pointConst S, // IN: optional point - bigConst d, // IN: scalar for [d]S or [d]G - pointConst Q, // IN: second point - bigConst u, // IN: second scalar - bigCurve E // IN: curve -); - -//** BnEccAdd() -// This function does addition of two points. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccAdd( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' - pointConst Q, // IN: second point - bigCurve E // IN: curve -); -#endif // ALG_ECC -#endif // MATHLIB OSSL - -#endif // _TPM_TO_OSSL_MATH_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslSupport_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslSupport_fp.h deleted file mode 100644 index b787cce0c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToOsslSupport_fp.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef _TPM_TO_OSSL_SUPPORT_FP_H_ -#define _TPM_TO_OSSL_SUPPORT_FP_H_ - -#ifdef MATH_LIB_OSSL - -//*** SupportLibInit() -// This does any initialization required by the support library. -LIB_EXPORT int -SupportLibInit( - void -); - -//*** OsslContextEnter() -// This function is used to initialize an OpenSSL context at the start of a function -// that will call to an OpenSSL math function. -BN_CTX * -OsslContextEnter( - void -); - -//*** OsslContextLeave() -// This is the companion function to OsslContextEnter(). -void -OsslContextLeave( - BN_CTX *CTX -); - -//*** OsslPushContext() -// This function is used to create a frame in a context. All values allocated within -// this context after the frame is started will be automatically freed when the -// context (OsslPopContext() -BN_CTX * -OsslPushContext( - BN_CTX *CTX -); - -//*** OsslPopContext() -// This is the companion function to OsslPushContext(). -void -OsslPopContext( - BN_CTX *CTX -); -#endif // MATH_LIB_OSSL - -#endif // _TPM_TO_OSSL_SUPPORT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfDesSupport_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfDesSupport_fp.h deleted file mode 100644 index e7b8ff794..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfDesSupport_fp.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/*(Auto) - Automatically Generated by TpmPrototypes version 2.2 February 10, 2016 - Date: Sep 9, 2016 Time: 01:03:57 PM -*/ - -#ifndef _TPMTOWOLFDESSUPPORT_FP_H_ -#define _TPMTOWOLFDESSUPPORT_FP_H_ - -#if SYM_LIB == WOLF && defined TPM_ALG_TDES -//**Functions - -//** TDES_setup -// This function calls the wolfcrypt function to generate a TDES key schedule. If the -// If the key is two key (16 bytes), then the first DES key is replicated to the third -// key position. -int TDES_setup( - const BYTE *key, - UINT32 keyBits, - tpmKeyScheduleTDES *skey, - int dir - ); - -//** TDES_setup_encrypt_key -// This function calls into TDES_setup(), specifically for an encryption key. -int TDES_setup_encrypt_key( - const BYTE *key, - UINT32 keyBits, - tpmKeyScheduleTDES *skey - ); - -//** TDES_setup_decrypt_key -// This function calls into TDES_setup(), specifically for an decryption key. -int TDES_setup_decrypt_key( - const BYTE *key, - UINT32 keyBits, - tpmKeyScheduleTDES *skey - ); - -//*** TDES_encyrpt() -void TDES_encrypt( - const BYTE *in, - BYTE *out, - tpmKeyScheduleTDES *ks - ); - -//*** TDES_decrypt() -void TDES_decrypt( - const BYTE *in, - BYTE *out, - tpmKeyScheduleTDES *ks - ); -#endif // SYM_LIB == WOLF - - -#endif // _TPMTOWOLFDESSUPPORT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfMath_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfMath_fp.h deleted file mode 100644 index 2ee6c0445..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfMath_fp.h +++ /dev/null @@ -1,209 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/*(Auto) - Automatically Generated by TpmPrototypes version 2.2 February 10, 2016 - Date: Sep 9, 2016 Time: 01:03:57 PM -*/ - -#ifndef _TPMTOWOLFMATH_FP_H_ -#define _TPMTOWOLFMATH_FP_H_ - -#if MATH_LIB == WOLF -//**Functions - -//*** BnFromWolf() -// This function converts a wolfcrypt mp_int to a TPM bignum. In this implementation -// it is assumed that wolfcrypt used the same format for a big number as does the -// TPM -- an array of native-endian words in little-endian order. -void -BnFromWolf( - bigNum bn, - mp_int *wolfBn - ); - -//*** BnToWolf() -// This function converts a TPM bignum to a wolfcrypt mp_init, and has the same -// assumptions as made by BnFromWolf() -void -BnToWolf( - mp_int *toInit, - bigConst initializer - ); - -//*** MpInitialize() -// This function initializes an wolfcrypt mp_int. -mp_int * -MpInitialize( - mp_int *toInit - ); - -//** MathLibraryCompatibililtyCheck() -// This function is only used during development to make sure that the library -// that is being referenced is using the same size of data structures as the TPM. -void -MathLibraryCompatibilityCheck( - void - ); - -//*** BnModMult() -// Does multiply and divide returning the remainder of the divide. -LIB_EXPORT BOOL -BnModMult( - bigNum result, - bigConst op1, - bigConst op2, - bigConst modulus - ); - -//*** BnMult() -// Multiplies two numbers -LIB_EXPORT BOOL -BnMult( - bigNum result, - bigConst multiplicand, - bigConst multiplier - ); - -//*** BnDiv() -// This function divides two bigNum values. The function returns FALSE if -// there is an error in the operation. -LIB_EXPORT BOOL -BnDiv( - bigNum quotient, - bigNum remainder, - bigConst dividend, - bigConst divisor - ); - -#ifdef TPM_ALG_RSA -//*** BnGcd() -// Get the greatest common divisor of two numbers -LIB_EXPORT BOOL -BnGcd( - bigNum gcd, // OUT: the common divisor - bigConst number1, // IN: - bigConst number2 // IN: - ); - -//***BnModExp() -// Do modular exponentiation using bigNum values. The conversion from a mp_int to -// a bigNum is trivial as they are based on the same structure -LIB_EXPORT BOOL -BnModExp( - bigNum result, // OUT: the result - bigConst number, // IN: number to exponentiate - bigConst exponent, // IN: - bigConst modulus // IN: - ); - -//*** BnModInverse() -// Modular multiplicative inverse -LIB_EXPORT BOOL -BnModInverse( - bigNum result, - bigConst number, - bigConst modulus - ); -#endif // TPM_ALG_RSA - -#ifdef TPM_ALG_ECC - -//*** PointFromWolf() -// Function to copy the point result from a wolf ecc_point to a bigNum -void -PointFromWolf( - bigPoint pOut, // OUT: resulting point - ecc_point *pIn // IN: the point to return - ); - -//*** PointToWolf() -// Function to copy the point result from a bigNum to a wolf ecc_point -void -PointToWolf( - ecc_point *pOut, // OUT: resulting point - pointConst pIn // IN: the point to return - ); - -//*** EcPointInitialized() -// Allocate and initialize a point. -static ecc_point * -EcPointInitialized( - pointConst initializer - ); - -//*** BnEccModMult() -// This function does a point multiply of the form R = [d]S -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' (optional) - bigConst d, // IN: scalar for [d]S - bigCurve E - ); - -//*** BnEccModMult2() -// This function does a point multiply of the form R = [d]G + [u]Q -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult2( - bigPoint R, // OUT: computed point - pointConst S, // IN: optional point - bigConst d, // IN: scalar for [d]S or [d]G - pointConst Q, // IN: second point - bigConst u, // IN: second scalar - bigCurve E // IN: curve - ); - -//** BnEccAdd() -// This function does addition of two points. -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccAdd( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' - pointConst Q, // IN: second point - bigCurve E // IN: curve - ); -#endif // TPM_ALG_ECC - -#endif // MATH_LIB == WOLF - - -#endif // _TPMTOWOLFMATH_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfSupport_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfSupport_fp.h deleted file mode 100644 index ee0887a33..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/TpmToWolfSupport_fp.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/*(Auto) - Automatically Generated by TpmPrototypes version 2.2 February 10, 2016 - Date: Sep 9, 2016 Time: 01:03:57 PM -*/ - -#ifndef _TPMTOWOLFSUPPORT_FP_H_ -#define _TPMTOWOLFSUPPORT_FP_H_ - -#ifdef MATH_LIB_WOLF -//**Functions - -//*** SupportLibInit() -// This does any initialization required by the support library. -LIB_EXPORT int -SupportLibInit( - void - ); -#endif // MATH_LIB == WOLF - - -#endif // _TPMTOWOLFSUPPORT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Unseal_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Unseal_fp.h deleted file mode 100644 index c32ff2278..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Unseal_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Unseal // Command must be enabled - -#ifndef _Unseal_FP_H_ -#define _Unseal_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT itemHandle; -} Unseal_In; - -// Output structure definition -typedef struct { - TPM2B_SENSITIVE_DATA outData; -} Unseal_Out; - -// Response code modifiers -#define RC_Unseal_itemHandle (TPM_RC_H + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_Unseal( - Unseal_In *in, - Unseal_Out *out -); - -#endif // _Unseal_FP_H_ -#endif // CC_Unseal diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Vendor_TCG_Test_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Vendor_TCG_Test_fp.h deleted file mode 100644 index 105d71766..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Vendor_TCG_Test_fp.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_Vendor_TCG_Test // Command must be enabled - -#ifndef _Vendor_TCG_Test_FP_H_ -#define _Vendor_TCG_Test_FP_H_ - -// Input structure definition -typedef struct { - TPM2B_DATA inputData; -} Vendor_TCG_Test_In; - -// Output structure definition -typedef struct { - TPM2B_DATA outputData; -} Vendor_TCG_Test_Out; - -// Response code modifiers -#define RC_Vendor_TCG_Test_inputData (TPM_RC_P + TPM_RC_1) - -// Function prototype -TPM_RC -TPM2_Vendor_TCG_Test( - Vendor_TCG_Test_In *in, - Vendor_TCG_Test_Out *out -); - -#endif // _Vendor_TCG_Test_FP_H_ -#endif // CC_Vendor_TCG_Test diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/VerifySignature_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/VerifySignature_fp.h deleted file mode 100644 index 44961907a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/VerifySignature_fp.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_VerifySignature // Command must be enabled - -#ifndef _Verify_Signature_FP_H_ -#define _Verify_Signature_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyHandle; - TPM2B_DIGEST digest; - TPMT_SIGNATURE signature; -} VerifySignature_In; - -// Output structure definition -typedef struct { - TPMT_TK_VERIFIED validation; -} VerifySignature_Out; - -// Response code modifiers -#define RC_VerifySignature_keyHandle (TPM_RC_H + TPM_RC_1) -#define RC_VerifySignature_digest (TPM_RC_P + TPM_RC_1) -#define RC_VerifySignature_signature (TPM_RC_P + TPM_RC_2) - -// Function prototype -TPM_RC -TPM2_VerifySignature( - VerifySignature_In *in, - VerifySignature_Out *out -); - -#endif // _Verify_Signature_FP_H_ -#endif // CC_VerifySignature diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_ECC_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_ECC_fp.h deleted file mode 100644 index b994b1208..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_ECC_fp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 11:00:49AM - */ - -#ifndef _X509_ECC_FP_H_ -#define _X509_ECC_FP_H_ - -//*** X509PushPoint() -// This seems like it might be used more than once so... -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509PushPoint( - ASN1MarshalContext *ctx, - TPMS_ECC_POINT *p -); - -//*** X509AddSigningAlgorithmECC() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddSigningAlgorithmECC( - OBJECT *signKey, - TPMT_SIG_SCHEME *scheme, - ASN1MarshalContext *ctx -); - -//*** X509AddPublicECC() -// This function will add the publicKey description to the DER data. If ctx is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddPublicECC( - OBJECT *object, - ASN1MarshalContext *ctx -); - -#endif // _X509_ECC_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_RSA_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_RSA_fp.h deleted file mode 100644 index 8fb05e672..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_RSA_fp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 11:00:49AM - */ - -#ifndef _X509_RSA_FP_H_ -#define _X509_RSA_FP_H_ - -#if ALG_RSA - -//*** X509AddSigningAlgorithmRSA() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddSigningAlgorithmRSA( - OBJECT *signKey, - TPMT_SIG_SCHEME *scheme, - ASN1MarshalContext *ctx -); - -//*** X509AddPublicRSA() -// This function will add the publicKey description to the DER data. If fillPtr is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddPublicRSA( - OBJECT *object, - ASN1MarshalContext *ctx -); -#endif // ALG_RSA - -#endif // _X509_RSA_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_spt_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_spt_fp.h deleted file mode 100644 index 1670e78b4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/X509_spt_fp.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Apr 2, 2019 Time: 11:00:49AM - */ - -#ifndef _X509_SPT_FP_H_ -#define _X509_SPT_FP_H_ - -//*** X509FindExtensionOID() -// This will search a list of X508 extensions to find an extension with the -// requested OID. If the extension is found, the output context ('ctx') is set up -// to point to the OID in the extension. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure (could be catastrophic) -BOOL -X509FindExtensionByOID( - ASN1UnmarshalContext *ctxIn, // IN: the context to search - ASN1UnmarshalContext *ctx, // OUT: the extension context - const BYTE *OID // IN: oid to search for -); - -//*** X509GetExtensionBits() -// This function will extract a bit field from an extension. If the extension doesn't -// contain a bit string, it will fail. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -UINT32 -X509GetExtensionBits( - ASN1UnmarshalContext *ctx, - UINT32 *value -); - -//***X509ProcessExtensions() -// This function is used to process the TPMA_OBJECT and KeyUsage extensions. It is not -// in the CertifyX509.c code because it makes the code harder to follow. -// Return Type: TPM_RC -// TPM_RCS_ATTRIBUTES the attributes of object are not consistent with -// the extension setting -// TPM_RC_VALUE problem parsing the extensions -TPM_RC -X509ProcessExtensions( - OBJECT *object, // IN: The object with the attributes to - // check - stringRef *extension // IN: The start and length of the extensions -); - -//*** X509AddSigningAlgorithm() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of octets added -// <= 0 failure -INT16 -X509AddSigningAlgorithm( - ASN1MarshalContext *ctx, - OBJECT *signKey, - TPMT_SIG_SCHEME *scheme -); - -//*** X509AddPublicKey() -// This function will add the publicKey description to the DER data. If fillPtr is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of octets added -// == 0 failure -INT16 -X509AddPublicKey( - ASN1MarshalContext *ctx, - OBJECT *object -); - -//*** X509PushAlgorithmIdentifierSequence() -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509PushAlgorithmIdentifierSequence( - ASN1MarshalContext *ctx, - const BYTE *OID -); - -#endif // _X509_SPT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ZGen_2Phase_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ZGen_2Phase_fp.h deleted file mode 100644 index 1fc708632..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/ZGen_2Phase_fp.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.4 Mar 26, 2019 - * Date: Mar 28, 2019 Time: 08:25:17PM - */ - -#if CC_ZGen_2Phase // Command must be enabled - -#ifndef _ZGen_2Phase_FP_H_ -#define _ZGen_2Phase_FP_H_ - -// Input structure definition -typedef struct { - TPMI_DH_OBJECT keyA; - TPM2B_ECC_POINT inQsB; - TPM2B_ECC_POINT inQeB; - TPMI_ECC_KEY_EXCHANGE inScheme; - UINT16 counter; -} ZGen_2Phase_In; - -// Output structure definition -typedef struct { - TPM2B_ECC_POINT outZ1; - TPM2B_ECC_POINT outZ2; -} ZGen_2Phase_Out; - -// Response code modifiers -#define RC_ZGen_2Phase_keyA (TPM_RC_H + TPM_RC_1) -#define RC_ZGen_2Phase_inQsB (TPM_RC_P + TPM_RC_1) -#define RC_ZGen_2Phase_inQeB (TPM_RC_P + TPM_RC_2) -#define RC_ZGen_2Phase_inScheme (TPM_RC_P + TPM_RC_3) -#define RC_ZGen_2Phase_counter (TPM_RC_P + TPM_RC_4) - -// Function prototype -TPM_RC -TPM2_ZGen_2Phase( - ZGen_2Phase_In *in, - ZGen_2Phase_Out *out -); - -#endif // _ZGen_2Phase_FP_H_ -#endif // CC_ZGen_2Phase diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_Data_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_Data_fp.h deleted file mode 100644 index 8ac5c2074..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_Data_fp.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef __TPM_HASH_DATA_FP_H_ -#define __TPM_HASH_DATA_FP_H_ - -// This function is called to process a _TPM_Hash_Data indication. -LIB_EXPORT void -_TPM_Hash_Data( - uint32_t dataSize, // IN: size of data to be extend - unsigned char *data // IN: data buffer -); - -#endif // __TPM_HASH_DATA_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_End_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_End_fp.h deleted file mode 100644 index 45ee7dff0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_End_fp.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef __TPM_HASH_END_FP_H_ -#define __TPM_HASH_END_FP_H_ - -// This function is called to process a _TPM_Hash_End indication. -LIB_EXPORT void -_TPM_Hash_End( - void -); - -#endif // __TPM_HASH_END_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_Start_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_Start_fp.h deleted file mode 100644 index 5ae53fb4f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Hash_Start_fp.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef __TPM_HASH_START_FP_H_ -#define __TPM_HASH_START_FP_H_ - -// This function is called to process a _TPM_Hash_Start indication. -LIB_EXPORT void -_TPM_Hash_Start( - void -); - -#endif // __TPM_HASH_START_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Init_fp.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Init_fp.h deleted file mode 100644 index aabb43a2e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/_TPM_Init_fp.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmPrototypes; Version 3.0 July 18, 2017 - * Date: Mar 28, 2019 Time: 08:25:19PM - */ - -#ifndef __TPM_INIT_FP_H_ -#define __TPM_INIT_FP_H_ - -// This function is used to process a _TPM_Init indication. -LIB_EXPORT void -_TPM_Init( - void -); - -#endif // __TPM_INIT_FP_H_ diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/swap.h b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/swap.h deleted file mode 100644 index 01216f740..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/include/swap.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _SWAP_H -#define _SWAP_H - -#if LITTLE_ENDIAN_TPM -#define TO_BIG_ENDIAN_UINT16(i) REVERSE_ENDIAN_16(i) -#define FROM_BIG_ENDIAN_UINT16(i) REVERSE_ENDIAN_16(i) -#define TO_BIG_ENDIAN_UINT32(i) REVERSE_ENDIAN_32(i) -#define FROM_BIG_ENDIAN_UINT32(i) REVERSE_ENDIAN_32(i) -#define TO_BIG_ENDIAN_UINT64(i) REVERSE_ENDIAN_64(i) -#define FROM_BIG_ENDIAN_UINT64(i) REVERSE_ENDIAN_64(i) -#else -#define TO_BIG_ENDIAN_UINT16(i) (i) -#define FROM_BIG_ENDIAN_UINT16(i) (i) -#define TO_BIG_ENDIAN_UINT32(i) (i) -#define FROM_BIG_ENDIAN_UINT32(i) (i) -#define TO_BIG_ENDIAN_UINT64(i) (i) -#define FROM_BIG_ENDIAN_UINT64(i) (i) -#endif - -#if AUTO_ALIGN == NO - -// The aggregation macros for machines that do not allow unaligned access or for -// little-endian machines. - -// Aggregate bytes into an UINT - -#define BYTE_ARRAY_TO_UINT8(b) (uint8_t)((b)[0]) -#define BYTE_ARRAY_TO_UINT16(b) ByteArrayToUint16((BYTE *)(b)) -#define BYTE_ARRAY_TO_UINT32(b) ByteArrayToUint32((BYTE *)(b)) -#define BYTE_ARRAY_TO_UINT64(b) ByteArrayToUint64((BYTE *)(b)) -#define UINT8_TO_BYTE_ARRAY(i, b) ((b)[0] = (uint8_t)(i)) -#define UINT16_TO_BYTE_ARRAY(i, b) Uint16ToByteArray((i), (BYTE *)(b)) -#define UINT32_TO_BYTE_ARRAY(i, b) Uint32ToByteArray((i), (BYTE *)(b)) -#define UINT64_TO_BYTE_ARRAY(i, b) Uint64ToByteArray((i), (BYTE *)(b)) - - -#else // AUTO_ALIGN - -#if BIG_ENDIAN_TPM -// the big-endian macros for machines that allow unaligned memory access -// Aggregate a byte array into a UINT -#define BYTE_ARRAY_TO_UINT8(b) *((uint8_t *)(b)) -#define BYTE_ARRAY_TO_UINT16(b) *((uint16_t *)(b)) -#define BYTE_ARRAY_TO_UINT32(b) *((uint32_t *)(b)) -#define BYTE_ARRAY_TO_UINT64(b) *((uint64_t *)(b)) - -// Disaggregate a UINT into a byte array - -#define UINT8_TO_BYTE_ARRAY(i, b) {*((uint8_t *)(b)) = (i);} -#define UINT16_TO_BYTE_ARRAY(i, b) {*((uint16_t *)(b)) = (i);} -#define UINT32_TO_BYTE_ARRAY(i, b) {*((uint32_t *)(b)) = (i);} -#define UINT64_TO_BYTE_ARRAY(i, b) {*((uint64_t *)(b)) = (i);} -#else -// the little endian macros for machines that allow unaligned memory access -// the big-endian macros for machines that allow unaligned memory access -// Aggregate a byte array into a UINT -#define BYTE_ARRAY_TO_UINT8(b) *((uint8_t *)(b)) -#define BYTE_ARRAY_TO_UINT16(b) REVERSE_ENDIAN_16(*((uint16_t *)(b))) -#define BYTE_ARRAY_TO_UINT32(b) REVERSE_ENDIAN_32(*((uint32_t *)(b))) -#define BYTE_ARRAY_TO_UINT64(b) REVERSE_ENDIAN_64(*((uint64_t *)(b))) - -// Disaggregate a UINT into a byte array - -#define UINT8_TO_BYTE_ARRAY(i, b) {*((uint8_t *)(b)) = (i);} -#define UINT16_TO_BYTE_ARRAY(i, b) {*((uint16_t *)(b)) = REVERSE_ENDIAN_16(i);} -#define UINT32_TO_BYTE_ARRAY(i, b) {*((uint32_t *)(b)) = REVERSE_ENDIAN_32(i);} -#define UINT64_TO_BYTE_ARRAY(i, b) {*((uint64_t *)(b)) = REVERSE_ENDIAN_64(i);} -#endif // BIG_ENDIAN_TPM - -#endif // AUTO_ALIGN == NO - -#endif // _SWAP_H diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/TpmASN1.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/TpmASN1.c deleted file mode 100644 index f275c5801..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/TpmASN1.c +++ /dev/null @@ -1,514 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" - -#define _OIDS_ -#include "OIDs.h" - -#include "TpmASN1.h" -#include "TpmASN1_fp.h" - -//** Unmarshaling Functions - -//*** ASN1UnmarshalContextInitialize() -// Function does standard initialization of a context. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -BOOL -ASN1UnmarshalContextInitialize( - ASN1UnmarshalContext *ctx, - INT16 size, - BYTE *buffer -) -{ - VERIFY(buffer != NULL); - VERIFY(size > 0); - ctx->buffer = buffer; - ctx->size = size; - ctx->offset = 0; - ctx->tag = 0xFF; - return TRUE; -Error: - return FALSE; -} - -//***ASN1DecodeLength() -// This function extracts the length of an element from 'buffer' starting at 'offset'. -// Return Type: UINT16 -// >=0 the extracted length -// <0 an error -INT16 -ASN1DecodeLength( - ASN1UnmarshalContext *ctx -) -{ - BYTE first; // Next octet in buffer - INT16 value; -// - VERIFY(ctx->offset < ctx->size); - first = NEXT_OCTET(ctx); - // If the number of octets of the entity is larger than 127, then the first octet - // is the number of octets in the length specifier. - if(first >= 0x80) - { - // Make sure that this length field is contained with the structure being - // parsed - CHECK_SIZE(ctx, (first & 0x7F)); - if(first == 0x82) - { - // Two octets of size - // get the next value - value = (INT16)NEXT_OCTET(ctx); - // Make sure that the result will fit in an INT16 - VERIFY(value < 0x0080); - // Shift up and add next octet - value = (value << 8) + NEXT_OCTET(ctx); - } - else if(first == 0x81) - value = NEXT_OCTET(ctx); - // Sizes larger than will fit in a INT16 are an error - else - goto Error; - } - else - value = first; - // Make sure that the size defined something within the current context - CHECK_SIZE(ctx, value); - return value; -Error: - ctx->size = -1; // Makes everything fail from now on. - return -1; -} - -//***ASN1NextTag() -// This function extracts the next type from 'buffer' starting at 'offset'. -// It advances 'offset' as it parses the type and the length of the type. It returns -// the length of the type. On return, the 'length' octets starting at 'offset' are the -// octets of the type. -// Return Type: UINT -// >=0 the number of octets in 'type' -// <0 an error -INT16 -ASN1NextTag( - ASN1UnmarshalContext *ctx -) -{ - // A tag to get? - VERIFY(ctx->offset < ctx->size); - // Get it - ctx->tag = NEXT_OCTET(ctx); - // Make sure that it is not an extended tag - VERIFY((ctx->tag & 0x1F) != 0x1F); - // Get the length field and return that - return ASN1DecodeLength(ctx); - -Error: - // Attempt to read beyond the end of the context or an illegal tag - ctx->size = -1; // Persistent failure - ctx->tag = 0xFF; - return -1; -} - - -//*** ASN1GetBitStringValue() -// Try to parse a bit string of up to 32 bits from a value that is expected to be -// a bit string. -// If there is a general parsing error, the context->size is set to -1. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -BOOL -ASN1GetBitStringValue( - ASN1UnmarshalContext *ctx, - UINT32 *val -) -{ - int shift; - INT16 length; - UINT32 value = 0; -// - - VERIFY((length = ASN1NextTag(ctx)) >= 1); - VERIFY(ctx->tag == ASN1_BITSTRING); - // Get the shift value for the bit field (how many bits to loop off of the end) - shift = NEXT_OCTET(ctx); - length--; - // the shift count has to make sense - VERIFY((shift < 8) && ((length > 0) || (shift == 0))); - // if there are any bytes left - for(; length > 0; length--) - { - if(length > 1) - { - // for all but the last octet, just shift and add the new octet - VERIFY((value & 0xFF000000) == 0); // can't loose significant bits - value = (value << 8) + NEXT_OCTET(ctx); - } - else - { - // for the last octet, just shift the accumulated value enough to - // accept the significant bits in the last octet and shift the last - // octet down - VERIFY(((value & (0xFF000000 << (8 - shift)))) == 0); - value = (value << (8 - shift)) + (NEXT_OCTET(ctx) >> shift); - } - } - *val = value; - return TRUE; -Error: - ctx->size = -1; - return FALSE; -} - -//******************************************************************* -//** Marshaling Functions -//******************************************************************* - -//*** Introduction -// Marshaling of an ASN.1 structure is accomplished from the bottom up. That is, -// the things that will be at the end of the structure are added last. To manage the -// collecting of the relative sizes, start a context for the outermost container, if -// there is one, and then placing items in from the bottom up. If the bottom-most -// item is also within a structure, create a nested context by calling -// ASN1StartMarshalingContext(). -// -// The context control structure contains a 'buffer' pointer, an 'offset', an 'end' -// and a stack. 'offset' is the offset from the start of the buffer of the last added -// byte. When 'offset' reaches 0, the buffer is full. 'offset' is a signed value so -// that, when it becomes negative, there is an overflow. Only two functions are -// allowed to move bytes into the buffer: ASN1PushByte() and ASN1PushBytes(). These -// functions make sure that no data is written beyond the end of the buffer. -// -// When a new context is started, the current value of 'end' is pushed -// on the stack and 'end' is set to 'offset. As bytes are added, offset gets smaller. -// At any time, the count of bytes in the current context is simply 'end' - 'offset'. -// -// Since starting a new context involves setting 'end' = 'offset', the number of bytes -// in the context starts at 0. The nominal way of ending a context is to use -// 'end' - 'offset' to set the length value, and then a tag is added to the buffer. -// Then the previous 'end' value is popped meaning that the context just ended -// becomes a member of the now current context. -// -// The nominal strategy for building a completed ASN.1 structure is to push everything -// into the buffer and then move everything to the start of the buffer. The move is -// simple as the size of the move is the initial 'end' value minus the final 'offset' -// value. The destination is 'buffer' and the source is 'buffer' + 'offset'. As Skippy -// would say "Easy peasy, Joe." -// -// It is not necessary to provide a buffer into which the data is placed. If no buffer -// is provided, then the marshaling process will return values needed for marshaling. -// On strategy for filling the buffer would be to execute the process for building -// the structure without using a buffer. This would return the overall size of the -// structure. Then that amount of data could be allocated for the buffer and the fill -// process executed again with the data going into the buffer. At the end, the data -// would be in its final resting place. - -//*** ASN1InitialializeMarshalContext() -// This creates a structure for handling marshaling of an ASN.1 formatted data -// structure. -void -ASN1InitialializeMarshalContext( - ASN1MarshalContext *ctx, - INT16 length, - BYTE *buffer -) -{ - ctx->buffer = buffer; - if(buffer) - ctx->offset = length; - else - ctx->offset = INT16_MAX; - ctx->end = ctx->offset; - ctx->depth = -1; -} - -//*** ASN1StartMarshalContext() -// This starts a new constructed element. It is constructed on 'top' of the value -// that was previously placed in the structure. -void -ASN1StartMarshalContext( - ASN1MarshalContext *ctx -) -{ - pAssert((ctx->depth + 1) < MAX_DEPTH); - ctx->depth++; - ctx->ends[ctx->depth] = ctx->end; - ctx->end = ctx->offset; -} - -//*** ASN1EndMarshalContext() -// This function restores the end pointer for an encapsulating structure. -// Return Type: INT16 -// > 0 the size of the encapsulated structure that was just ended -// <= 0 an error -INT16 -ASN1EndMarshalContext( - ASN1MarshalContext *ctx -) -{ - INT16 length; - pAssert(ctx->depth >= 0); - length = ctx->end - ctx->offset; - ctx->end = ctx->ends[ctx->depth--]; - if((ctx->depth == -1) && (ctx->buffer)) - { - MemoryCopy(ctx->buffer, ctx->buffer + ctx->offset, ctx->end - ctx->offset); - } - return length; -} - - -//***ASN1EndEncapsulation() -// This function puts a tag and length in the buffer. In this function, an embedded -// BIT_STRING is assumed to be a collection of octets. To indicate that all bits -// are used, a byte of zero is prepended. If a raw bit-string is needed, a new -// function like ASN1PushInteger() would be needed. -// Return Type: INT16 -// > 0 number of octets in the encapsulation -// == 0 failure -UINT16 -ASN1EndEncapsulation( - ASN1MarshalContext *ctx, - BYTE tag -) -{ - // only add a leading zero for an encapsulated BIT STRING - if (tag == ASN1_BITSTRING) - ASN1PushByte(ctx, 0); - ASN1PushTagAndLength(ctx, tag, ctx->end - ctx->offset); - return ASN1EndMarshalContext(ctx); -} - -//*** ASN1PushByte() -BOOL -ASN1PushByte( - ASN1MarshalContext *ctx, - BYTE b -) -{ - if(ctx->offset > 0) - { - ctx->offset -= 1; - if(ctx->buffer) - ctx->buffer[ctx->offset] = b; - return TRUE; - } - ctx->offset = -1; - return FALSE; -} - -//*** ASN1PushBytes() -// Push some raw bytes onto the buffer. 'count' cannot be zero. -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushBytes( - ASN1MarshalContext *ctx, - INT16 count, - const BYTE *buffer -) -{ - // make sure that count is not negative which would mess up the math; and that - // if there is a count, there is a buffer - VERIFY((count >= 0) && ((buffer != NULL) || (count == 0))); - // back up the offset to determine where the new octets will get pushed - ctx->offset -= count; - // can't go negative - VERIFY(ctx->offset >= 0); - // if there are buffers, move the data, otherwise, assume that this is just a - // test. - if(count && buffer && ctx->buffer) - MemoryCopy(&ctx->buffer[ctx->offset], buffer, count); - return count; -Error: - ctx->offset = -1; - return 0; -} - -//*** ASN1PushNull() -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushNull( - ASN1MarshalContext *ctx -) -{ - ASN1PushByte(ctx, 0); - ASN1PushByte(ctx, ASN1_NULL); - return (ctx->offset >= 0) ? 2 : 0; -} - -//*** ASN1PushLength() -// Push a length value. This will only handle length values that fit in an INT16. -// Return Type: UINT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushLength( - ASN1MarshalContext *ctx, - INT16 len -) -{ - UINT16 start = ctx->offset; - VERIFY(len >= 0); - if(len <= 127) - ASN1PushByte(ctx, (BYTE)len); - else - { - ASN1PushByte(ctx, (BYTE)(len & 0xFF)); - len >>= 8; - if(len == 0) - ASN1PushByte(ctx, 0x81); - else - { - ASN1PushByte(ctx, (BYTE)(len)); - ASN1PushByte(ctx, 0x82); - } - } - goto Exit; -Error: - ctx->offset = -1; -Exit: - return (ctx->offset > 0) ? start - ctx->offset : 0; -} - -//*** ASN1PushTagAndLength() -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushTagAndLength( - ASN1MarshalContext *ctx, - BYTE tag, - INT16 length -) -{ - INT16 bytes; - bytes = ASN1PushLength(ctx, length); - bytes += (INT16)ASN1PushByte(ctx, tag); - return (ctx->offset < 0) ? 0 : bytes; -} - - -//*** ASN1PushTaggedOctetString() -// This function will push a random octet string. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -ASN1PushTaggedOctetString( - ASN1MarshalContext *ctx, - INT16 size, - const BYTE *string, - BYTE tag -) -{ - ASN1PushBytes(ctx, size, string); - // PushTagAndLenght just tells how many octets it added so the total size of this - // element is the sum of those octets and input size. - size += ASN1PushTagAndLength(ctx, tag, size); - return size; -} - -//*** ASN1PushUINT() -// This function pushes an native-endian integer value. This just changes a -// native-endian integer into a big-endian byte string and calls ASN1PushInteger(). -// That function will remove leading zeros and make sure that the number is positive. -// Return Type: IN16 -// > 0 count bytes -// == 0 failure unless count was zero -INT16 -ASN1PushUINT( - ASN1MarshalContext *ctx, - UINT32 integer -) -{ - BYTE marshaled[4]; - UINT32_TO_BYTE_ARRAY(integer, marshaled); - return ASN1PushInteger(ctx, 4, marshaled); -} - -//*** ASN1PushInteger -// Push a big-endian integer on the end of the buffer -// Return Type: UINT16 -// > 0 the number of bytes marshaled for the integer -// == 0 failure -INT16 -ASN1PushInteger( - ASN1MarshalContext *ctx, // IN/OUT: buffer context - INT16 iLen, // IN: octets of the integer - BYTE *integer // IN: big-endian integer -) -{ - // no leading 0's - while((*integer == 0) && (--iLen > 0)) - integer++; - // Move the bytes to the buffer - ASN1PushBytes(ctx, iLen, integer); - // if needed, add a leading byte of 0 to make the number positive - if(*integer & 0x80) - iLen += (INT16)ASN1PushByte(ctx, 0); - // PushTagAndLenght just tells how many octets it added so the total size of this - // element is the sum of those octets and the adjusted input size. - iLen += ASN1PushTagAndLength(ctx, ASN1_INTEGER, iLen); - return iLen; -} - -//*** ASN1PushOID() -// This function is used to add an OID. An OID is 0x06 followed by a byte of size -// followed by size bytes. This is used to avoid having to do anything special in the -// definition of an OID. -// Return Type: UINT16 -// > 0 the number of bytes marshaled for the integer -// == 0 failure -INT16 -ASN1PushOID( - ASN1MarshalContext *ctx, - const BYTE *OID -) -{ - if((*OID == ASN1_OBJECT_IDENTIFIER) && ((OID[1] & 0x80) == 0)) - { - return ASN1PushBytes(ctx, OID[1] + 2, OID); - } - ctx->offset = -1; - return 0; -} - - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_ECC.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_ECC.c deleted file mode 100644 index 29a8d5940..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_ECC.c +++ /dev/null @@ -1,146 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" -#include "X509.h" -#include "OIDs.h" -#include "TpmASN1_fp.h" -#include "X509_spt_fp.h" -#include "CryptHash_fp.h" - -//** Functions - -//*** X509PushPoint() -// This seems like it might be used more than once so... -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509PushPoint( - ASN1MarshalContext *ctx, - TPMS_ECC_POINT *p -) -{ - // Push a bit string containing the public key. For now, push the x, and y - // coordinates of the public point, bottom up - ASN1StartMarshalContext(ctx); // BIT STRING - { - ASN1PushBytes(ctx, p->y.t.size, p->y.t.buffer); - ASN1PushBytes(ctx, p->x.t.size, p->x.t.buffer); - ASN1PushByte(ctx, 0x04); - } - return ASN1EndEncapsulation(ctx, ASN1_BITSTRING); // Ends BIT STRING -} - -//*** X509AddSigningAlgorithmECC() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddSigningAlgorithmECC( - OBJECT *signKey, - TPMT_SIG_SCHEME *scheme, - ASN1MarshalContext *ctx -) -{ - PHASH_DEF hashDef = CryptGetHashDef(scheme->details.any.hashAlg); -// - NOT_REFERENCED(signKey); - // If the desired hashAlg definition wasn't found... - if(hashDef->hashAlg != scheme->details.any.hashAlg) - return 0; - - switch(scheme->scheme) - { - case ALG_ECDSA_VALUE: - // Make sure that we have an OID for this hash and ECC - if((hashDef->ECDSA)[0] != ASN1_OBJECT_IDENTIFIER) - break; - // if this is just an implementation check, indicate that this - // combination is supported - if(!ctx) - return 1; - ASN1StartMarshalContext(ctx); - ASN1PushOID(ctx, hashDef->ECDSA); - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); - default: - break; - } - return 0; -} - - -//*** X509AddPublicECC() -// This function will add the publicKey description to the DER data. If ctx is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddPublicECC( - OBJECT *object, - ASN1MarshalContext *ctx -) -{ - const BYTE *curveOid = - CryptEccGetOID(object->publicArea.parameters.eccDetail.curveID); - if((curveOid == NULL) || (*curveOid != ASN1_OBJECT_IDENTIFIER)) - return 0; -// -// -// SEQUENCE (2 elem) 1st -// SEQUENCE (2 elem) 2nd -// OBJECT IDENTIFIER 1.2.840.10045.2.1 ecPublicKey (ANSI X9.62 public key type) -// OBJECT IDENTIFIER 1.2.840.10045.3.1.7 prime256v1 (ANSI X9.62 named curve) -// BIT STRING (520 bit) 000001001010000111010101010111001001101101000100000010... -// - // If this is a check to see if the key can be encoded, it can. - // Need to mark the end sequence - if(ctx == NULL) - return 1; - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elem) 1st - { - X509PushPoint(ctx, &object->publicArea.unique.ecc); // BIT STRING - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elem) 2nd - { - ASN1PushOID(ctx, curveOid); // curve dependent - ASN1PushOID(ctx, OID_ECC_PUBLIC); // (1.2.840.10045.2.1) - } - ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); // Ends SEQUENCE 2nd - } - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); // Ends SEQUENCE 1st -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_RSA.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_RSA.c deleted file mode 100644 index 77b827bdf..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_RSA.c +++ /dev/null @@ -1,234 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" -#include "X509.h" -#include "TpmASN1_fp.h" -#include "X509_spt_fp.h" -#include "CryptHash_fp.h" -#include "CryptRsa_fp.h" - -//** Functions - -#if ALG_RSA - -//*** X509AddSigningAlgorithmRSA() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddSigningAlgorithmRSA( - OBJECT *signKey, - TPMT_SIG_SCHEME *scheme, - ASN1MarshalContext *ctx -) -{ - TPM_ALG_ID hashAlg = scheme->details.any.hashAlg; - PHASH_DEF hashDef = CryptGetHashDef(hashAlg); -// - NOT_REFERENCED(signKey); - // return failure if hash isn't implemented - if(hashDef->hashAlg != hashAlg) - return 0; - switch(scheme->scheme) - { - case ALG_RSASSA_VALUE: - { - // if the hash is implemented but there is no PKCS1 OID defined - // then this is not a valid signing combination. - if(hashDef->PKCS1[0] != ASN1_OBJECT_IDENTIFIER) - break; - if(ctx == NULL) - return 1; - ASN1StartMarshalContext(ctx); - ASN1PushOID(ctx, hashDef->PKCS1); - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); - } - case ALG_RSAPSS_VALUE: - // leave if this is just an implementation check - if(ctx == NULL) - return 1; - // In the case of SHA1, everything is default and RFC4055 says that - // implementations that do signature generation MUST omit the parameter - // when defaults are used. )-: - if(hashDef->hashAlg == ALG_SHA1_VALUE) - { - return X509PushAlgorithmIdentifierSequence(ctx, OID_RSAPSS); - } - else - { - // Going to build something that looks like: - // SEQUENCE (2 elem) - // OBJECT IDENTIFIER 1.2.840.113549.1.1.10 rsaPSS (PKCS #1) - // SEQUENCE (3 elem) - // [0] (1 elem) - // SEQUENCE (2 elem) - // OBJECT IDENTIFIER 2.16.840.1.101.3.4.2.1 sha-256 - // NULL - // [1] (1 elem) - // SEQUENCE (2 elem) - // OBJECT IDENTIFIER 1.2.840.113549.1.1.8 pkcs1-MGF - // SEQUENCE (2 elem) - // OBJECT IDENTIFIER 2.16.840.1.101.3.4.2.1 sha-256 - // NULL - // [2] (1 elem) salt length - // INTEGER 32 - - // The indentation is just to keep track of where we are in the - // structure - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elements) - { - ASN1StartMarshalContext(ctx); // SEQUENCE (3 elements) - { - // [2] (1 elem) salt length - // INTEGER 32 - ASN1StartMarshalContext(ctx); - { - INT16 saltSize = - CryptRsaPssSaltSize((INT16)hashDef->digestSize, - (INT16)signKey->publicArea.unique.rsa.t.size); - ASN1PushUINT(ctx, saltSize); - } - ASN1EndEncapsulation(ctx, ASN1_APPLICAIION_SPECIFIC + 2); - - // Add the mask generation algorithm - // [1] (1 elem) - // SEQUENCE (2 elem) 1st - // OBJECT IDENTIFIER 1.2.840.113549.1.1.8 pkcs1-MGF - // SEQUENCE (2 elem) 2nd - // OBJECT IDENTIFIER 2.16.840.1.101.3.4.2.1 sha-256 - // NULL - ASN1StartMarshalContext(ctx); // mask context [1] (1 elem) - { - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elem) 1st - // Handle the 2nd Sequence (sequence (object, null)) - { - X509PushAlgorithmIdentifierSequence(ctx, - hashDef->OID); - // add the pkcs1-MGF OID - ASN1PushOID(ctx, OID_MGF1); - } - // End outer sequence - ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); - } - // End the [1] - ASN1EndEncapsulation(ctx, ASN1_APPLICAIION_SPECIFIC + 1); - - // Add the hash algorithm - // [0] (1 elem) - // SEQUENCE (2 elem) (done by - // X509PushAlgorithmIdentifierSequence) - // OBJECT IDENTIFIER 2.16.840.1.101.3.4.2.1 sha-256 (NIST) - // NULL - ASN1StartMarshalContext(ctx); // [0] (1 elem) - { - X509PushAlgorithmIdentifierSequence(ctx, hashDef->OID); - } - ASN1EndEncapsulation(ctx, (ASN1_APPLICAIION_SPECIFIC + 0)); - } - // SEQUENCE (3 elements) end - ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); - - // RSA PSS OID - // OBJECT IDENTIFIER 1.2.840.113549.1.1.10 rsaPSS (PKCS #1) - ASN1PushOID(ctx, OID_RSAPSS); - } - // End Sequence (2 elements) - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); - } - default: - break; - } - return 0; -} - -//*** X509AddPublicRSA() -// This function will add the publicKey description to the DER data. If fillPtr is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509AddPublicRSA( - OBJECT *object, - ASN1MarshalContext *ctx -) -{ - UINT32 exp = object->publicArea.parameters.rsaDetail.exponent; -// -/* - SEQUENCE (2 elem) 1st - SEQUENCE (2 elem) 2nd - OBJECT IDENTIFIER 1.2.840.113549.1.1.1 rsaEncryption (PKCS #1) - NULL - BIT STRING (1 elem) - SEQUENCE (2 elem) 3rd - INTEGER (2048 bit) 2197304513741227955725834199357401 - INTEGER 65537 -*/ - // If this is a check to see if the key can be encoded, it can. - // Need to mark the end sequence - if(ctx == NULL) - return 1; - ASN1StartMarshalContext(ctx); // SEQUENCE (2 elem) 1st - ASN1StartMarshalContext(ctx); // BIT STRING - ASN1StartMarshalContext(ctx); // SEQUENCE *(2 elem) 3rd - - // Get public exponent in big-endian byte order. - if(exp == 0) - exp = RSA_DEFAULT_PUBLIC_EXPONENT; - - // Push a 4 byte integer. This might get reduced if there are leading zeros or - // extended if the high order byte is negative. - ASN1PushUINT(ctx, exp); - // Push the public key as an integer - ASN1PushInteger(ctx, object->publicArea.unique.rsa.t.size, - object->publicArea.unique.rsa.t.buffer); - // Embed this in a SEQUENCE tag and length in for the key, exponent sequence - ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); // SEQUENCE (3rd) - - // Embed this in a BIT STRING - ASN1EndEncapsulation(ctx, ASN1_BITSTRING); - - // Now add the formatted SEQUENCE for the RSA public key OID. This is a - // fully constructed value so it doesn't need to have a context started - X509PushAlgorithmIdentifierSequence(ctx, OID_PKCS1_PUB); - - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); -} - -#endif // ALG_RSA \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_spt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_spt.c deleted file mode 100644 index 77fd96ba9..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/X509/X509_spt.c +++ /dev/null @@ -1,295 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" -#include "TpmASN1.h" -#include "TpmASN1_fp.h" -#define _X509_SPT_ -#include "X509.h" -#include "X509_spt_fp.h" -#if ALG_RSA -# include "X509_RSA_fp.h" -#endif // ALG_RSA -#if ALG_ECC -# include "X509_ECC_fp.h" -#endif // ALG_ECC -#if ALG_SM2 -//# include "X509_SM2_fp.h" -#endif // ALG_RSA - - - -//** Unmarshaling Functions - -//*** X509FindExtensionOID() -// This will search a list of X508 extensions to find an extension with the -// requested OID. If the extension is found, the output context ('ctx') is set up -// to point to the OID in the extension. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure (could be catastrophic) -BOOL -X509FindExtensionByOID( - ASN1UnmarshalContext *ctxIn, // IN: the context to search - ASN1UnmarshalContext *ctx, // OUT: the extension context - const BYTE *OID // IN: oid to search for -) -{ - INT16 length; -// - pAssert(ctxIn != NULL); - // Make the search non-destructive of the input if ctx provided. Otherwise, use - // the provided context. - if (ctx == NULL) - ctx = ctxIn; - else if(ctx != ctxIn) - *ctx = *ctxIn; - for(;ctx->size > ctx->offset; ctx->offset += length) - { - VERIFY((length = ASN1NextTag(ctx)) >= 0); - // If this is not a constructed sequence, then it doesn't belong - // in the extensions. - VERIFY(ctx->tag == ASN1_CONSTRUCTED_SEQUENCE); - // Make sure that this entry could hold the OID - if (length >= OID_SIZE(OID)) - { - // See if this is a match for the provided object identifier. - if (MemoryEqual(OID, &(ctx->buffer[ctx->offset]), OID_SIZE(OID))) - { - // Return with ' ctx' set to point to the start of the OID with the size - // set to be the size of the SEQUENCE - ctx->buffer += ctx->offset; - ctx->offset = 0; - ctx->size = length; - return TRUE; - } - } - } - VERIFY(ctx->offset == ctx->size); - return FALSE; -Error: - ctxIn->size = -1; - ctx->size = -1; - return FALSE; -} - -//*** X509GetExtensionBits() -// This function will extract a bit field from an extension. If the extension doesn't -// contain a bit string, it will fail. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -UINT32 -X509GetExtensionBits( - ASN1UnmarshalContext *ctx, - UINT32 *value -) -{ - INT16 length; -// - while (((length = ASN1NextTag(ctx)) > 0) && (ctx->size > ctx->offset)) - { - // Since this is an extension, the extension value will be in an OCTET STRING - if (ctx->tag == ASN1_OCTET_STRING) - { - return ASN1GetBitStringValue(ctx, value); - } - ctx->offset += length; - } - ctx->size = -1; - return FALSE; -} - -//***X509ProcessExtensions() -// This function is used to process the TPMA_OBJECT and KeyUsage extensions. It is not -// in the CertifyX509.c code because it makes the code harder to follow. -// Return Type: TPM_RC -// TPM_RCS_ATTRIBUTES the attributes of object are not consistent with -// the extension setting -// TPM_RC_VALUE problem parsing the extensions -TPM_RC -X509ProcessExtensions( - OBJECT *object, // IN: The object with the attributes to - // check - stringRef *extension // IN: The start and length of the extensions -) -{ - ASN1UnmarshalContext ctx; - ASN1UnmarshalContext extensionCtx; - INT16 length; - UINT32 value; -// - if(!ASN1UnmarshalContextInitialize(&ctx, extension->len, extension->buf) - || ((length = ASN1NextTag(&ctx)) < 0) - || (ctx.tag != X509_EXTENSIONS)) - return TPM_RCS_VALUE; - if( ((length = ASN1NextTag(&ctx)) < 0) - || (ctx.tag != (ASN1_CONSTRUCTED_SEQUENCE))) - return TPM_RCS_VALUE; - - // Get the extension for the TPMA_OBJECT if there is one - if(X509FindExtensionByOID(&ctx, &extensionCtx, OID_TCG_TPMA_OBJECT) && - X509GetExtensionBits(&extensionCtx, &value)) - { - // If an keyAttributes extension was found, it must be exactly the same as the - // attributes of the object. - // This cast will work because we know that a TPMA_OBJECT is in a UINT32. - // Set RUNTIME_SIZE_CHECKS to YES to force a check to verify this assumption - // during debug. Doing this is lot easier than having to revisit the code - // any time a new attribute is added. - // NOTE: MemoryEqual() is used to avoid type-punned pointer warning/error. - if(!MemoryEqual(&value, &object->publicArea.objectAttributes, sizeof(value))) - return TPM_RCS_ATTRIBUTES; - } - // Make sure the failure to find the value wasn't because of a fatal error - else if(extensionCtx.size < 0) - return TPM_RCS_VALUE; - - // Get the keyUsage extension. This one is required - if(X509FindExtensionByOID(&ctx, &extensionCtx, OID_KEY_USAGE_EXTENSTION) && - X509GetExtensionBits(&extensionCtx, &value)) - { - x509KeyUsageUnion keyUsage; - TPMA_OBJECT attributes = object->publicArea.objectAttributes; - // - keyUsage.integer = value; - // For KeyUsage: - // the 'sign' attribute is SET if Key Usage includes signing - if( ( (keyUsageSign.integer & keyUsage.integer) != 0 - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign)) - // OR the 'decrypt' attribute is Set if Key Usage includes decryption uses - || ( (keyUsageDecrypt.integer & keyUsage.integer) != 0 - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt)) - // OR that 'fixedTPM' is SET if Key Usage is non-repudiation - || ( IS_ATTRIBUTE(keyUsage.x509, TPMA_X509_KEY_USAGE, nonrepudiation) - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedTPM)) - // OR that 'restricted' is SET if Key Usage is key agreement - || ( IS_ATTRIBUTE(keyUsage.x509, TPMA_X509_KEY_USAGE, keyAgreement) - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted)) - ) - return TPM_RCS_ATTRIBUTES; - } - else - // The KeyUsage extension is required - return TPM_RCS_VALUE; - - return TPM_RC_SUCCESS; -} - -//** Marshaling Functions - -//*** X509AddSigningAlgorithm() -// This creates the singing algorithm data. -// Return Type: INT16 -// > 0 number of octets added -// <= 0 failure -INT16 -X509AddSigningAlgorithm( - ASN1MarshalContext *ctx, - OBJECT *signKey, - TPMT_SIG_SCHEME *scheme -) -{ - switch(signKey->publicArea.type) - { -#if ALG_RSA - case ALG_RSA_VALUE: - return X509AddSigningAlgorithmRSA(signKey, scheme, ctx); -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - return X509AddSigningAlgorithmECC(signKey, scheme, ctx); -#endif // ALG_ECC -#if ALG_SM2 - case ALG_SM2: - return X509AddSigningAlgorithmSM2(signKey, scheme,ctx); -#endif // ALG_SM2 - default: - break; - } - return 0; -} - -//*** X509AddPublicKey() -// This function will add the publicKey description to the DER data. If fillPtr is -// NULL, then no data is transferred and this function will indicate if the TPM -// has the values for DER-encoding of the public key. -// Return Type: INT16 -// > 0 number of octets added -// == 0 failure -INT16 -X509AddPublicKey( - ASN1MarshalContext *ctx, - OBJECT *object -) -{ - switch(object->publicArea.type) - { -#if ALG_RSA - case ALG_RSA_VALUE: - return X509AddPublicRSA(object, ctx); -#endif -#if ALG_ECC - case ALG_ECC_VALUE: - return X509AddPublicECC(object, ctx); -#endif -#if ALG_SM2 - case ALG_SM2_VALUE: - break; -#endif - default: - break; - } - return FALSE; -} - - -//*** X509PushAlgorithmIdentifierSequence() -// Return Type: INT16 -// > 0 number of bytes added -// == 0 failure -INT16 -X509PushAlgorithmIdentifierSequence( - ASN1MarshalContext *ctx, - const BYTE *OID - ) -{ - ASN1StartMarshalContext(ctx); // hash algorithm - ASN1PushNull(ctx); - ASN1PushOID(ctx, OID); - return ASN1EndEncapsulation(ctx, ASN1_CONSTRUCTED_SEQUENCE); -} - - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECC_Parameters.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECC_Parameters.c deleted file mode 100644 index c03476879..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECC_Parameters.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ECC_Parameters_fp.h" - -#if CC_ECC_Parameters // Conditional expansion of this file - -/*(See part 3 specification) -// This command returns the parameters of an ECC curve identified by its TCG -// assigned curveID -*/ -// Return Type: TPM_RC -// TPM_RC_VALUE Unsupported ECC curve ID -TPM_RC -TPM2_ECC_Parameters( - ECC_Parameters_In *in, // IN: input parameter list - ECC_Parameters_Out *out // OUT: output parameter list - ) -{ -// Command Output - - // Get ECC curve parameters - if(CryptEccGetParameters(in->curveID, &out->parameters)) - return TPM_RC_SUCCESS; - else - return TPM_RCS_VALUE + RC_ECC_Parameters_curveID; -} - -#endif // CC_ECC_Parameters \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECDH_KeyGen.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECDH_KeyGen.c deleted file mode 100644 index 9c7ac3341..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECDH_KeyGen.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ECDH_KeyGen_fp.h" - -#if CC_ECDH_KeyGen // Conditional expansion of this file - -/*(See part 3 specification) -// This command uses the TPM to generate an ephemeral public key and the product -// of the ephemeral private key and the public portion of an ECC key. -*/ -// Return Type: TPM_RC -// TPM_RC_KEY 'keyHandle' does not reference an ECC key -TPM_RC -TPM2_ECDH_KeyGen( - ECDH_KeyGen_In *in, // IN: input parameter list - ECDH_KeyGen_Out *out // OUT: output parameter list - ) -{ - OBJECT *eccKey; - TPM2B_ECC_PARAMETER sensitive; - TPM_RC result; - -// Input Validation - - eccKey = HandleToObject(in->keyHandle); - - // Referenced key must be an ECC key - if(eccKey->publicArea.type != TPM_ALG_ECC) - return TPM_RCS_KEY + RC_ECDH_KeyGen_keyHandle; - -// Command Output - do - { - TPMT_PUBLIC *keyPublic = &eccKey->publicArea; - // Create ephemeral ECC key - result = CryptEccNewKeyPair(&out->pubPoint.point, &sensitive, - keyPublic->parameters.eccDetail.curveID); - if(result == TPM_RC_SUCCESS) - { - // Compute Z - result = CryptEccPointMultiply(&out->zPoint.point, - keyPublic->parameters.eccDetail.curveID, - &keyPublic->unique.ecc, - &sensitive, - NULL, NULL); - // The point in the key is not on the curve. Indicate - // that the key is bad. - if(result == TPM_RC_ECC_POINT) - return TPM_RCS_KEY + RC_ECDH_KeyGen_keyHandle; - // The other possible error from CryptEccPointMultiply is - // TPM_RC_NO_RESULT indicating that the multiplication resulted in - // the point at infinity, so get a new random key and start over - // BTW, this never happens. - } - } while(result == TPM_RC_NO_RESULT); - return result; -} - -#endif // CC_ECDH_KeyGen \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECDH_ZGen.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECDH_ZGen.c deleted file mode 100644 index f2a6135b1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ECDH_ZGen.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ECDH_ZGen_fp.h" - -#if CC_ECDH_ZGen // Conditional expansion of this file - -/*(See part 3 specification) -// This command uses the TPM to recover the Z value from a public point -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES key referenced by 'keyA' is restricted or -// not a decrypt key -// TPM_RC_KEY key referenced by 'keyA' is not an ECC key -// TPM_RC_NO_RESULT multiplying 'inPoint' resulted in a -// point at infinity -// TPM_RC_SCHEME the scheme of the key referenced by 'keyA' -// is not TPM_ALG_NULL, TPM_ALG_ECDH, -TPM_RC -TPM2_ECDH_ZGen( - ECDH_ZGen_In *in, // IN: input parameter list - ECDH_ZGen_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - OBJECT *eccKey; - -// Input Validation - eccKey = HandleToObject(in->keyHandle); - - // Selected key must be a non-restricted, decrypt ECC key - if(eccKey->publicArea.type != TPM_ALG_ECC) - return TPM_RCS_KEY + RC_ECDH_ZGen_keyHandle; - // Selected key needs to be unrestricted with the 'decrypt' attribute - if(IS_ATTRIBUTE(eccKey->publicArea.objectAttributes, TPMA_OBJECT, restricted) - || !IS_ATTRIBUTE(eccKey->publicArea.objectAttributes, TPMA_OBJECT, decrypt)) - return TPM_RCS_ATTRIBUTES + RC_ECDH_ZGen_keyHandle; - // Make sure the scheme allows this use - if(eccKey->publicArea.parameters.eccDetail.scheme.scheme != TPM_ALG_ECDH - && eccKey->publicArea.parameters.eccDetail.scheme.scheme != TPM_ALG_NULL) - return TPM_RCS_SCHEME + RC_ECDH_ZGen_keyHandle; -// Command Output - // Compute Z. TPM_RC_ECC_POINT or TPM_RC_NO_RESULT may be returned here. - result = CryptEccPointMultiply(&out->outPoint.point, - eccKey->publicArea.parameters.eccDetail.curveID, - &in->inPoint.point, - &eccKey->sensitive.sensitive.ecc, - NULL, NULL); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_ECDH_ZGen_inPoint); - return result; -} - -#endif // CC_ECDH_ZGen \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/EC_Ephemeral.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/EC_Ephemeral.c deleted file mode 100644 index 6125e586b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/EC_Ephemeral.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "EC_Ephemeral_fp.h" - -#if CC_EC_Ephemeral // Conditional expansion of this file - -/*(See part 3 specification) -// This command creates an ephemeral key using the commit mechanism -*/ -// Return Type: TPM_RC -// TPM_RC_NO_RESULT the TPM is not able to generate an 'r' value -TPM_RC -TPM2_EC_Ephemeral( - EC_Ephemeral_In *in, // IN: input parameter list - EC_Ephemeral_Out *out // OUT: output parameter list - ) -{ - TPM2B_ECC_PARAMETER r; - TPM_RC result; -// - do - { - // Get the random value that will be used in the point multiplications - // Note: this does not commit the count. - if(!CryptGenerateR(&r, NULL, in->curveID, NULL)) - return TPM_RC_NO_RESULT; - // do a point multiply - result = CryptEccPointMultiply(&out->Q.point, in->curveID, NULL, &r, - NULL, NULL); - // commit the count value if either the r value results in the point at - // infinity or if the value is good. The commit on the r value for infinity - // is so that the r value will be skipped. - if((result == TPM_RC_SUCCESS) || (result == TPM_RC_NO_RESULT)) - out->counter = CryptCommit(); - } while(result == TPM_RC_NO_RESULT); - - return TPM_RC_SUCCESS; -} - -#endif // CC_EC_Ephemeral \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/RSA_Decrypt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/RSA_Decrypt.c deleted file mode 100644 index 0e41fa4e0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/RSA_Decrypt.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "RSA_Decrypt_fp.h" - -#if CC_RSA_Decrypt // Conditional expansion of this file - -/*(See part 3 specification) -// decrypts the provided data block and removes the padding if applicable -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'decrypt' is not SET or if 'restricted' is SET in -// the key referenced by 'keyHandle' -// TPM_RC_BINDING The public an private parts of the key are not -// properly bound -// TPM_RC_KEY 'keyHandle' does not reference an unrestricted -// decrypt key -// TPM_RC_SCHEME incorrect input scheme, or the chosen -// 'scheme' is not a valid RSA decrypt scheme -// TPM_RC_SIZE 'cipherText' is not the size of the modulus -// of key referenced by 'keyHandle' -// TPM_RC_VALUE 'label' is not a null terminated string or the value -// of 'cipherText' is greater that the modulus of -// 'keyHandle' or the encoding of the data is not -// valid - -TPM_RC -TPM2_RSA_Decrypt( - RSA_Decrypt_In *in, // IN: input parameter list - RSA_Decrypt_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - OBJECT *rsaKey; - TPMT_RSA_DECRYPT *scheme; - -// Input Validation - - rsaKey = HandleToObject(in->keyHandle); - - // The selected key must be an RSA key - if(rsaKey->publicArea.type != TPM_ALG_RSA) - return TPM_RCS_KEY + RC_RSA_Decrypt_keyHandle; - - // The selected key must be an unrestricted decryption key - if(IS_ATTRIBUTE(rsaKey->publicArea.objectAttributes, TPMA_OBJECT, restricted) - || !IS_ATTRIBUTE(rsaKey->publicArea.objectAttributes, TPMA_OBJECT, decrypt)) - return TPM_RCS_ATTRIBUTES + RC_RSA_Decrypt_keyHandle; - - // NOTE: Proper operation of this command requires that the sensitive area - // of the key is loaded. This is assured because authorization is required - // to use the sensitive area of the key. In order to check the authorization, - // the sensitive area has to be loaded, even if authorization is with policy. - - // If label is present, make sure that it is a NULL-terminated string - if(!IsLabelProperlyFormatted(&in->label.b)) - return TPM_RCS_VALUE + RC_RSA_Decrypt_label; -// Command Output - // Select a scheme for decrypt. - scheme = CryptRsaSelectScheme(in->keyHandle, &in->inScheme); - if(scheme == NULL) - return TPM_RCS_SCHEME + RC_RSA_Decrypt_inScheme; - - // Decryption. TPM_RC_VALUE, TPM_RC_SIZE, and TPM_RC_KEY error may be - // returned by CryptRsaDecrypt. - // NOTE: CryptRsaDecrypt can also return TPM_RC_ATTRIBUTES or TPM_RC_BINDING - // when the key is not a decryption key but that was checked above. - out->message.t.size = sizeof(out->message.t.buffer); - result = CryptRsaDecrypt(&out->message.b, &in->cipherText.b, rsaKey, - scheme, &in->label.b); - return result; -} - -#endif // CC_RSA_Decrypt \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/RSA_Encrypt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/RSA_Encrypt.c deleted file mode 100644 index 3ba397c90..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/RSA_Encrypt.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "RSA_Encrypt_fp.h" - -#if CC_RSA_Encrypt // Conditional expansion of this file - -/*(See part 3 specification) -// This command performs the padding and encryption of a data block -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'decrypt' attribute is not SET in key referenced -// by 'keyHandle' -// TPM_RC_KEY 'keyHandle' does not reference an RSA key -// TPM_RC_SCHEME incorrect input scheme, or the chosen -// scheme is not a valid RSA decrypt scheme -// TPM_RC_VALUE the numeric value of 'message' is greater than -// the public modulus of the key referenced by -// 'keyHandle', or 'label' is not a null-terminated -// string -TPM_RC -TPM2_RSA_Encrypt( - RSA_Encrypt_In *in, // IN: input parameter list - RSA_Encrypt_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - OBJECT *rsaKey; - TPMT_RSA_DECRYPT *scheme; -// Input Validation - rsaKey = HandleToObject(in->keyHandle); - - // selected key must be an RSA key - if(rsaKey->publicArea.type != TPM_ALG_RSA) - return TPM_RCS_KEY + RC_RSA_Encrypt_keyHandle; - // selected key must have the decryption attribute - if(!IS_ATTRIBUTE(rsaKey->publicArea.objectAttributes, TPMA_OBJECT, decrypt)) - return TPM_RCS_ATTRIBUTES + RC_RSA_Encrypt_keyHandle; - - // Is there a label? - if(!IsLabelProperlyFormatted(&in->label.b)) - return TPM_RCS_VALUE + RC_RSA_Encrypt_label; -// Command Output - // Select a scheme for encryption - scheme = CryptRsaSelectScheme(in->keyHandle, &in->inScheme); - if(scheme == NULL) - return TPM_RCS_SCHEME + RC_RSA_Encrypt_inScheme; - - // Encryption. TPM_RC_VALUE, or TPM_RC_SCHEME errors my be returned buy - // CryptEncyptRSA. - out->outData.t.size = sizeof(out->outData.t.buffer); - - result = CryptRsaEncrypt(&out->outData, &in->message.b, rsaKey, scheme, - &in->label.b, NULL); - return result; -} - -#endif // CC_RSA_Encrypt \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ZGen_2Phase.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ZGen_2Phase.c deleted file mode 100644 index 955ba0b56..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Asymmetric/ZGen_2Phase.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ZGen_2Phase_fp.h" - -#if CC_ZGen_2Phase // Conditional expansion of this file - -// This command uses the TPM to recover one or two Z values in a two phase key -// exchange protocol -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES key referenced by 'keyA' is restricted or -// not a decrypt key -// TPM_RC_ECC_POINT 'inQsB' or 'inQeB' is not on the curve of -// the key reference by 'keyA' -// TPM_RC_KEY key referenced by 'keyA' is not an ECC key -// TPM_RC_SCHEME the scheme of the key referenced by 'keyA' -// is not TPM_ALG_NULL, TPM_ALG_ECDH, -// ALG_ECMQV or TPM_ALG_SM2 -TPM_RC -TPM2_ZGen_2Phase( - ZGen_2Phase_In *in, // IN: input parameter list - ZGen_2Phase_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - OBJECT *eccKey; - TPM2B_ECC_PARAMETER r; - TPM_ALG_ID scheme; - -// Input Validation - - eccKey = HandleToObject(in->keyA); - - // keyA must be an ECC key - if(eccKey->publicArea.type != TPM_ALG_ECC) - return TPM_RCS_KEY + RC_ZGen_2Phase_keyA; - - // keyA must not be restricted and must be a decrypt key - if(IS_ATTRIBUTE(eccKey->publicArea.objectAttributes, TPMA_OBJECT, restricted) - || !IS_ATTRIBUTE(eccKey->publicArea.objectAttributes, TPMA_OBJECT, decrypt)) - return TPM_RCS_ATTRIBUTES + RC_ZGen_2Phase_keyA; - - // if the scheme of keyA is TPM_ALG_NULL, then use the input scheme; otherwise - // the input scheme must be the same as the scheme of keyA - scheme = eccKey->publicArea.parameters.asymDetail.scheme.scheme; - if(scheme != TPM_ALG_NULL) - { - if(scheme != in->inScheme) - return TPM_RCS_SCHEME + RC_ZGen_2Phase_inScheme; - } - else - scheme = in->inScheme; - if(scheme == TPM_ALG_NULL) - return TPM_RCS_SCHEME + RC_ZGen_2Phase_inScheme; - - // Input points must be on the curve of keyA - if(!CryptEccIsPointOnCurve(eccKey->publicArea.parameters.eccDetail.curveID, - &in->inQsB.point)) - return TPM_RCS_ECC_POINT + RC_ZGen_2Phase_inQsB; - - if(!CryptEccIsPointOnCurve(eccKey->publicArea.parameters.eccDetail.curveID, - &in->inQeB.point)) - return TPM_RCS_ECC_POINT + RC_ZGen_2Phase_inQeB; - - if(!CryptGenerateR(&r, &in->counter, - eccKey->publicArea.parameters.eccDetail.curveID, - NULL)) - return TPM_RCS_VALUE + RC_ZGen_2Phase_counter; - -// Command Output - - result = - CryptEcc2PhaseKeyExchange(&out->outZ1.point, - &out->outZ2.point, - eccKey->publicArea.parameters.eccDetail.curveID, - scheme, - &eccKey->sensitive.sensitive.ecc, - &r, - &in->inQsB.point, - &in->inQeB.point); - if(result == TPM_RC_SCHEME) - return TPM_RCS_SCHEME + RC_ZGen_2Phase_inScheme; - - if(result == TPM_RC_SUCCESS) - CryptEndCommit(in->counter); - - return result; -} -#endif // CC_ZGen_2Phase \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_GetCapability.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_GetCapability.c deleted file mode 100644 index 18106eaaf..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_GetCapability.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "AC_GetCapability_fp.h" -#include "AC_spt_fp.h" - -#if CC_AC_GetCapability // Conditional expansion of this file - -/*(See part 3 specification) -// This command returns various information regarding Attached Components -*/ -TPM_RC -TPM2_AC_GetCapability( - AC_GetCapability_In *in, // IN: input parameter list - AC_GetCapability_Out *out // OUT: output parameter list - ) -{ -// Command Output - out->moreData = AcCapabilitiesGet(in->ac, in->count, &out->capabilitiesData); - - return TPM_RC_SUCCESS; -} - -#endif // CC_AC_GetCapability \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_Send.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_Send.c deleted file mode 100644 index 1477c7f24..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_Send.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "AC_Send_fp.h" -#include "AC_spt_fp.h" - - -#if CC_AC_Send // Conditional expansion of this file - -/*(See part 3 specification) -// Duplicate a loaded object -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES key to duplicate has 'fixedParent' SET -// TPM_RC_HASH for an RSA key, the nameAlg digest size for the -// newParent is not compatible with the key size -// TPM_RC_HIERARCHY 'encryptedDuplication' is SET and 'newParentHandle' -// specifies Null Hierarchy -// TPM_RC_KEY 'newParentHandle' references invalid ECC key (public -// point not on the curve) -// TPM_RC_SIZE input encryption key size does not match the -// size specified in symmetric algorithm -// TPM_RC_SYMMETRIC 'encryptedDuplication' is SET but no symmetric -// algorithm is provided -// TPM_RC_TYPE 'newParentHandle' is neither a storage key nor -// TPM_RH_NULL; or the object has a NULL nameAlg -// TPM_RC_VALUE for an RSA newParent, the sizes of the digest and -// the encryption key are too large to be OAEP encoded -TPM_RC -TPM2_AC_Send( - AC_Send_In *in, // IN: input parameter list - AC_Send_Out *out // OUT: output parameter list -) -{ - NV_REF locator; - TPM_HANDLE nvAlias = ((in->ac - AC_FIRST) + NV_AC_FIRST); - NV_INDEX *nvIndex = NvGetIndexInfo(nvAlias, &locator); - OBJECT *object = HandleToObject(in->sendObject); - TPM_RC result; -// Input validation - // If there is an NV alias, then the index must allow the authorization provided - if(nvIndex != NULL) - { - // Common access checks, NvWriteAccessCheck() may return - // TPM_RC_NV_AUTHORIZATION or TPM_RC_NV_LOCKED - result = NvWriteAccessChecks(in->authHandle, nvAlias, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - } - // If 'ac' did not have an alias then the authorization had to be with either - // platform or owner authorization. The type of TPMI_RH_NV_AUTH only allows - // owner or platform or an NV index. If it was a valid index, it would have had - // an alias and be processed above, so only success here is if this is a - // permanent handle. - else if(HandleGetType(in->authHandle) != TPM_HT_PERMANENT) - return TPM_RCS_HANDLE + RC_AC_Send_authHandle; - // Make sure that the object to be duplicated has the right attributes - if(IS_ATTRIBUTE(object->publicArea.objectAttributes, - TPMA_OBJECT, encryptedDuplication) - || IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, - fixedParent) - || IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, fixedTPM)) - return TPM_RCS_ATTRIBUTES + RC_AC_Send_sendObject; -// Command output - // Do the implementation dependent send - return AcSendObject(in->ac, object, &out->acDataOut); -} - -#endif // TPM_CC_AC_Send \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_spt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_spt.c deleted file mode 100644 index b938bee30..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/AC_spt.c +++ /dev/null @@ -1,149 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" -#include "AC_spt_fp.h" - - -#if 1 // This is the simulated AC data. - -typedef struct { - TPMI_RH_AC ac; - TPML_AC_CAPABILITIES *acData; - -} acCapabilities; - - -TPML_AC_CAPABILITIES acData0001 = {1, - {{TPM_AT_PV1, 0x01234567}}}; - -acCapabilities ac[1] = { {0x0001, &acData0001} }; - -#define NUM_AC (sizeof(ac) / sizeof(acCapabilities)) - -#endif // 1 The simulated AC data - -//*** AcToCapabilities() -// This function returns a pointer to a list of AC capabilities. -TPML_AC_CAPABILITIES * -AcToCapabilities( - TPMI_RH_AC component // IN: component -) -{ - UINT32 index; -// - for(index = 0; index < NUM_AC; index++) - { - if(ac[index].ac == component) - return ac[index].acData; - } - return NULL; -} - -//*** AcIsAccessible() -// Function to determine if an AC handle references an actual AC -// Return Type: BOOL -BOOL -AcIsAccessible( - TPM_HANDLE acHandle - ) -{ - // In this implementation, the AC exists if there are some capabilities to go - // with the handle - return AcToCapabilities(acHandle) != NULL; -} - -//*** AcCapabilitiesGet() -// This function returns a list of capabilities associated with an AC -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -AcCapabilitiesGet( - TPMI_RH_AC component, // IN: the component - TPM_AT type, // IN: start capability type - TPML_AC_CAPABILITIES *capabilityList // OUT: list of handle -) -{ - TPMI_YES_NO more = NO; - UINT32 i; - TPML_AC_CAPABILITIES *capabilities = AcToCapabilities(component); - - pAssert(HandleGetType(component) == TPM_HT_AC); - - // Initialize output handle list - capabilityList->count = 0; - - if(capabilities != NULL) - { - // Find the first capability less than or equal to type - for(i = 0; i < capabilities->count; i++) - { - if(capabilities->acCapabilities[i].tag >= type) - { - // copy the capabilities until we run out or fill the list - for(; (capabilityList->count < MAX_AC_CAPABILITIES) - && (i < capabilities->count); i++) - { - capabilityList->acCapabilities[capabilityList->count] - = capabilities->acCapabilities[i]; - capabilityList->count++; - } - more = i < capabilities->count; - } - } - } - return more; -} - - -//*** AcSendObject() -// Stub to handle sending of an AC object -// Return Type: TPM_RC -TPM_RC -AcSendObject( - TPM_HANDLE acHandle, // IN: Handle of AC receiving object - OBJECT *object, // IN: object structure to send - TPMS_AC_OUTPUT *acDataOut // OUT: results of operation -) -{ - NOT_REFERENCED(object); - NOT_REFERENCED(acHandle); - acDataOut->tag = TPM_AT_ERROR; // indicate that the response contains an - // error code - acDataOut->data = TPM_AE_NONE; // but there is no error. - - return TPM_RC_SUCCESS; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/Policy_AC_SendSelect.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/Policy_AC_SendSelect.c deleted file mode 100644 index 8973e1911..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/AttachedComponent/Policy_AC_SendSelect.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Policy_AC_SendSelect_fp.h" - -#if CC_Policy_AC_SendSelect // Conditional expansion of this file - -/*(See part 3 specification) -// allows qualification of attached component and object to be sent. -*/ -// Return Type: TPM_RC -// TPM_RC_COMMAND_CODE 'commandCode' of 'policySession; is not empty -// TPM_RC_CPHASH 'cpHash' of 'policySession' is not empty -TPM_RC -TPM2_Policy_AC_SendSelect( - Policy_AC_SendSelect_In *in // IN: input parameter list - ) -{ - SESSION *session; - HASH_STATE hashState; - TPM_CC commandCode = TPM_CC_Policy_AC_SendSelect; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // cpHash in session context must be empty - if(session->u1.cpHash.t.size != 0) - return TPM_RC_CPHASH; - // commandCode in session context must be empty - if(session->commandCode != 0) - return TPM_RC_COMMAND_CODE; -// Internal Data Update - // Update name hash - session->u1.cpHash.t.size = CryptHashStart(&hashState, session->authHashAlg); - - // add objectName - CryptDigestUpdate2B(&hashState, &in->objectName.b); - - // add authHandleName - CryptDigestUpdate2B(&hashState, &in->authHandleName.b); - - // add ac name - CryptDigestUpdate2B(&hashState, &in->acName.b); - - // complete hash - CryptHashEnd2B(&hashState, &session->u1.cpHash.b); - - // update policy hash - // Old policyDigest size should be the same as the new policyDigest size since - // they are using the same hash algorithm - session->u2.policyDigest.t.size - = CryptHashStart(&hashState, session->authHashAlg); -// add old policy - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add command code - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add objectName - if(in->includeObject == YES) - CryptDigestUpdate2B(&hashState, &in->objectName.b); - - // add authHandleName - CryptDigestUpdate2B(&hashState, &in->authHandleName.b); - - // add acName - CryptDigestUpdate2B(&hashState, &in->acName.b); - - // add includeObject - CryptDigestUpdateInt(&hashState, sizeof(TPMI_YES_NO), in->includeObject); - - // complete digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // set commandCode in session context - session->commandCode = TPM_CC_AC_Send; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyDuplicationSelect \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Attest_spt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Attest_spt.c deleted file mode 100644 index 2715c38f7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Attest_spt.c +++ /dev/null @@ -1,198 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" -#include "Attest_spt_fp.h" - -//** Functions - -//***FillInAttestInfo() -// Fill in common fields of TPMS_ATTEST structure. -void -FillInAttestInfo( - TPMI_DH_OBJECT signHandle, // IN: handle of signing object - TPMT_SIG_SCHEME *scheme, // IN/OUT: scheme to be used for signing - TPM2B_DATA *data, // IN: qualifying data - TPMS_ATTEST *attest // OUT: attest structure - ) -{ - OBJECT *signObject = HandleToObject(signHandle); - - // Magic number - attest->magic = TPM_GENERATED_VALUE; - - if(signObject == NULL) - { - // The name for a null handle is TPM_RH_NULL - // This is defined because UINT32_TO_BYTE_ARRAY does a cast. If the - // size of the cast is smaller than a constant, the compiler warns - // about the truncation of a constant value. - TPM_HANDLE nullHandle = TPM_RH_NULL; - attest->qualifiedSigner.t.size = sizeof(TPM_HANDLE); - UINT32_TO_BYTE_ARRAY(nullHandle, attest->qualifiedSigner.t.name); - } - else - { - // Certifying object qualified name - // if the scheme is anonymous, this is an empty buffer - if(CryptIsSchemeAnonymous(scheme->scheme)) - attest->qualifiedSigner.t.size = 0; - else - attest->qualifiedSigner = signObject->qualifiedName; - } - // current clock in plain text - TimeFillInfo(&attest->clockInfo); - - // Firmware version in plain text - attest->firmwareVersion = ((UINT64)gp.firmwareV1 << (sizeof(UINT32) * 8)); - attest->firmwareVersion += gp.firmwareV2; - - // Check the hierarchy of sign object. For NULL sign handle, the hierarchy - // will be TPM_RH_NULL - if((signObject == NULL) - || (!signObject->attributes.epsHierarchy - && !signObject->attributes.ppsHierarchy)) - { - // For signing key that is not in platform or endorsement hierarchy, - // obfuscate the reset, restart and firmware version information - UINT64 obfuscation[2]; - CryptKDFa(CONTEXT_INTEGRITY_HASH_ALG, &gp.shProof.b, OBFUSCATE_STRING, - &attest->qualifiedSigner.b, NULL, 128, - (BYTE *)&obfuscation[0], NULL, FALSE); - // Obfuscate data - attest->firmwareVersion += obfuscation[0]; - attest->clockInfo.resetCount += (UINT32)(obfuscation[1] >> 32); - attest->clockInfo.restartCount += (UINT32)obfuscation[1]; - } - // External data - if(CryptIsSchemeAnonymous(scheme->scheme)) - attest->extraData.t.size = 0; - else - { - // If we move the data to the attestation structure, then it is not - // used in the signing operation except as part of the signed data - attest->extraData = *data; - data->t.size = 0; - } -} - -//***SignAttestInfo() -// Sign a TPMS_ATTEST structure. If signHandle is TPM_RH_NULL, a null signature -// is returned. -// -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'signHandle' references not a signing key -// TPM_RC_SCHEME 'scheme' is not compatible with 'signHandle' type -// TPM_RC_VALUE digest generated for the given 'scheme' is greater than -// the modulus of 'signHandle' (for an RSA key); -// invalid commit status or failed to generate "r" value -// (for an ECC key) -TPM_RC -SignAttestInfo( - OBJECT *signKey, // IN: sign object - TPMT_SIG_SCHEME *scheme, // IN: sign scheme - TPMS_ATTEST *certifyInfo, // IN: the data to be signed - TPM2B_DATA *qualifyingData, // IN: extra data for the signing - // process - TPM2B_ATTEST *attest, // OUT: marshaled attest blob to be - // signed - TPMT_SIGNATURE *signature // OUT: signature - ) -{ - BYTE *buffer; - HASH_STATE hashState; - TPM2B_DIGEST digest; - TPM_RC result; - - // Marshal TPMS_ATTEST structure for hash - buffer = attest->t.attestationData; - attest->t.size = TPMS_ATTEST_Marshal(certifyInfo, &buffer, NULL); - - if(signKey == NULL) - { - signature->sigAlg = TPM_ALG_NULL; - result = TPM_RC_SUCCESS; - } - else - { - TPMI_ALG_HASH hashAlg; - // Compute hash - hashAlg = scheme->details.any.hashAlg; - // need to set the receive buffer to get something put in it - digest.t.size = sizeof(digest.t.buffer); - digest.t.size = CryptHashBlock(hashAlg, attest->t.size, - attest->t.attestationData, - digest.t.size, digest.t.buffer); - // If there is qualifying data, need to rehash the data - // hash(qualifyingData || hash(attestationData)) - if(qualifyingData->t.size != 0) - { - CryptHashStart(&hashState, hashAlg); - CryptDigestUpdate2B(&hashState, &qualifyingData->b); - CryptDigestUpdate2B(&hashState, &digest.b); - CryptHashEnd2B(&hashState, &digest.b); - } - // Sign the hash. A TPM_RC_VALUE, TPM_RC_SCHEME, or - // TPM_RC_ATTRIBUTES error may be returned at this point - result = CryptSign(signKey, scheme, &digest, signature); - - // Since the clock is used in an attestation, the state in NV is no longer - // "orderly" with respect to the data in RAM if the signature is valid - if(result == TPM_RC_SUCCESS) - { - // Command uses the clock so need to clear the orderly state if it is - // set. - result = NvClearOrderly(); - } - } - return result; -} - -//*** IsSigningObject() -// Checks to see if the object is OK for signing. This is here rather than in -// Object_spt.c because all the attestation commands use this file but not -// Object_spt.c. -// Return Type: BOOL -// TRUE(1) object may sign -// FALSE(0) object may not sign -BOOL -IsSigningObject( - OBJECT *object // IN: - ) -{ - return ((object == NULL) - || ((IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, sign) - && object->publicArea.type != TPM_ALG_SYMCIPHER))); -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Certify.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Certify.c deleted file mode 100644 index 0bdc22361..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Certify.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Attest_spt_fp.h" -#include "Certify_fp.h" - -#if CC_Certify // Conditional expansion of this file - -/*(See part 3 specification) -// prove an object with a specific Name is loaded in the TPM -*/ -// Return Type: TPM_RC -// TPM_RC_KEY key referenced by 'signHandle' is not a signing key -// TPM_RC_SCHEME 'inScheme' is not compatible with 'signHandle' -// TPM_RC_VALUE digest generated for 'inScheme' is greater or has larger -// size than the modulus of 'signHandle', or the buffer for -// the result in 'signature' is too small (for an RSA key); -// invalid commit status (for an ECC key with a split scheme) -TPM_RC -TPM2_Certify( - Certify_In *in, // IN: input parameter list - Certify_Out *out // OUT: output parameter list - ) -{ - TPMS_ATTEST certifyInfo; - OBJECT *signObject = HandleToObject(in->signHandle); - OBJECT *certifiedObject = HandleToObject(in->objectHandle); -// Input validation - if(!IsSigningObject(signObject)) - return TPM_RCS_KEY + RC_Certify_signHandle; - if(!CryptSelectSignScheme(signObject, &in->inScheme)) - return TPM_RCS_SCHEME + RC_Certify_inScheme; - -// Command Output - // Filling in attest information - // Common fields - FillInAttestInfo(in->signHandle, &in->inScheme, &in->qualifyingData, - &certifyInfo); - - // Certify specific fields - certifyInfo.type = TPM_ST_ATTEST_CERTIFY; - // NOTE: the certified object is not allowed to be TPM_ALG_NULL so - // 'certifiedObject' will never be NULL - certifyInfo.attested.certify.name = certifiedObject->name; - - // When using an anonymous signing scheme, need to set the qualified Name to the - // empty buffer to avoid correlation between keys - if(CryptIsSchemeAnonymous(in->inScheme.scheme)) - certifyInfo.attested.certify.qualifiedName.t.size = 0; - else - certifyInfo.attested.certify.qualifiedName = certifiedObject->qualifiedName; - - - // Sign attestation structure. A NULL signature will be returned if - // signHandle is TPM_RH_NULL. A TPM_RC_NV_UNAVAILABLE, TPM_RC_NV_RATE, - // TPM_RC_VALUE, TPM_RC_SCHEME or TPM_RC_ATTRIBUTES error may be returned - // by SignAttestInfo() - return SignAttestInfo(signObject, &in->inScheme, &certifyInfo, - &in->qualifyingData, &out->certifyInfo, &out->signature); -} - -#endif // CC_Certify \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/CertifyCreation.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/CertifyCreation.c deleted file mode 100644 index 2cb7f1837..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/CertifyCreation.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Attest_spt_fp.h" -#include "CertifyCreation_fp.h" - -#if CC_CertifyCreation // Conditional expansion of this file - -/*(See part 3 specification) -// Prove the association between an object and its creation data -*/ -// Return Type: TPM_RC -// TPM_RC_KEY key referenced by 'signHandle' is not a signing key -// TPM_RC_SCHEME 'inScheme' is not compatible with 'signHandle' -// TPM_RC_TICKET 'creationTicket' does not match 'objectHandle' -// TPM_RC_VALUE digest generated for 'inScheme' is greater or has larger -// size than the modulus of 'signHandle', or the buffer for -// the result in 'signature' is too small (for an RSA key); -// invalid commit status (for an ECC key with a split scheme). -TPM_RC -TPM2_CertifyCreation( - CertifyCreation_In *in, // IN: input parameter list - CertifyCreation_Out *out // OUT: output parameter list - ) -{ - TPMT_TK_CREATION ticket; - TPMS_ATTEST certifyInfo; - OBJECT *certified = HandleToObject(in->objectHandle); - OBJECT *signObject = HandleToObject(in->signHandle); -// Input Validation - if(!IsSigningObject(signObject)) - return TPM_RCS_KEY + RC_CertifyCreation_signHandle; - if(!CryptSelectSignScheme(signObject, &in->inScheme)) - return TPM_RCS_SCHEME + RC_CertifyCreation_inScheme; - - // CertifyCreation specific input validation - // Re-compute ticket - TicketComputeCreation(in->creationTicket.hierarchy, &certified->name, - &in->creationHash, &ticket); - // Compare ticket - if(!MemoryEqual2B(&ticket.digest.b, &in->creationTicket.digest.b)) - return TPM_RCS_TICKET + RC_CertifyCreation_creationTicket; - -// Command Output - // Common fields - FillInAttestInfo(in->signHandle, &in->inScheme, &in->qualifyingData, - &certifyInfo); - - // CertifyCreation specific fields - // Attestation type - certifyInfo.type = TPM_ST_ATTEST_CREATION; - certifyInfo.attested.creation.objectName = certified->name; - - // Copy the creationHash - certifyInfo.attested.creation.creationHash = in->creationHash; - - // Sign attestation structure. A NULL signature will be returned if - // signObject is TPM_RH_NULL. A TPM_RC_NV_UNAVAILABLE, TPM_RC_NV_RATE, - // TPM_RC_VALUE, TPM_RC_SCHEME or TPM_RC_ATTRIBUTES error may be returned at - // this point - return SignAttestInfo(signObject, &in->inScheme, &certifyInfo, - &in->qualifyingData, &out->certifyInfo, - &out->signature); -} - -#endif // CC_CertifyCreation \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/CertifyX509.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/CertifyX509.c deleted file mode 100644 index 961ed47d7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/CertifyX509.c +++ /dev/null @@ -1,276 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "CertifyX509_fp.h" -#include "X509.h" -#include "TpmASN1_fp.h" -#include "X509_spt_fp.h" -#include "Attest_spt_fp.h" - -#if CC_CertifyX509 // Conditional expansion of this file - -/*(See part 3 specification) -// Certify -*/ -// return type: TPM_RC -// TPM_RC_ATTRIBUTES the attributes of 'objectHandle' are not compatible -// with the KeyUsage or TPMA_OBJECT values in the -// extensions fields -// TPM_RC_BINDING the public and private portions of the key are not -// properly bound. -// TPM_RC_HASH the hash algorithm in the scheme is not supported -// TPM_RC_KEY 'signHandle' does not reference a signing key; -// TPM_RC_SCHEME the scheme is not compatible with sign key type, -// or input scheme is not compatible with default -// scheme, or the chosen scheme is not a valid -// sign scheme -// TPM_RC_VALUE most likely a problem with the format of -// 'partialCertificate' -TPM_RC -TPM2_CertifyX509( - CertifyX509_In *in, // IN: input parameter list - CertifyX509_Out *out // OUT: output parameter list -) -{ - TPM_RC result; - OBJECT *signKey = HandleToObject(in->signHandle); - OBJECT *object = HandleToObject(in->objectHandle); - HASH_STATE hash; - INT16 length; // length for a tagged element - ASN1UnmarshalContext ctx; - ASN1MarshalContext ctxOut; - // certTBS holds an array of pointers and lengths. Each entry references the - // corresponding value in a TBSCertificate structure. For example, the 1th - // element references the version number - stringRef certTBS[REF_COUNT] = {{0}}; -#define ALLOWED_SEQUENCES (SUBJECT_PUBLIC_KEY_REF - SIGNATURE_REF) - stringRef partial[ALLOWED_SEQUENCES] = {{0}}; - INT16 countOfSequences = 0; - INT16 i; - // -#if CERTIFYX509_DEBUG - DebugFileOpen(); - DebugDumpBuffer(in->partialCertificate.t.size, in->partialCertificate.t.buffer, - "partialCertificate"); -#endif - - // Input Validation - // signing key must be able to sign - if(!IsSigningObject(signKey)) - return TPM_RCS_KEY + RC_CertifyX509_signHandle; - // Pick a scheme for sign. If the input sign scheme is not compatible with - // the default scheme, return an error. - if(!CryptSelectSignScheme(signKey, &in->inScheme)) - return TPM_RCS_SCHEME + RC_CertifyX509_inScheme; - // Make sure that the public Key encoding is known - if(X509AddPublicKey(NULL, object) == 0) - return TPM_RCS_ASYMMETRIC + RC_CertifyX509_objectHandle; - // Unbundle 'partialCertificate'. - // Initialize the unmarshaling context - if(!ASN1UnmarshalContextInitialize(&ctx, in->partialCertificate.t.size, - in->partialCertificate.t.buffer)) - return TPM_RCS_VALUE + RC_CertifyX509_partialCertificate; - // Make sure that this is a constructed SEQUENCE - length = ASN1NextTag(&ctx); - // Must be a constructed SEQUENCE that uses all of the input parameter - if((ctx.tag != (ASN1_CONSTRUCTED_SEQUENCE)) - || ((ctx.offset + length) != in->partialCertificate.t.size)) - return TPM_RCS_SIZE + RC_CertifyX509_partialCertificate; - - // This scans through the contents of the outermost SEQUENCE. This would be the - // 'issuer', 'validity', 'subject', 'issuerUniqueID' (optional), - // 'subjectUniqueID' (optional), and 'extensions.' - while(ctx.offset < ctx.size) - { - INT16 startOfElement = ctx.offset; - // - // Read the next tag and length field. - length = ASN1NextTag(&ctx); - if(length < 0) - break; - if(ctx.tag == ASN1_CONSTRUCTED_SEQUENCE) - { - partial[countOfSequences].buf = &ctx.buffer[startOfElement]; - ctx.offset += length; - partial[countOfSequences].len = (INT16)ctx.offset - startOfElement; - if(++countOfSequences > ALLOWED_SEQUENCES) - break; - } - else if(ctx.tag == X509_EXTENSIONS) - { - if(certTBS[EXTENSIONS_REF].len != 0) - return TPM_RCS_VALUE + RC_CertifyX509_partialCertificate; - certTBS[EXTENSIONS_REF].buf = &ctx.buffer[startOfElement]; - ctx.offset += length; - certTBS[EXTENSIONS_REF].len = - (INT16)ctx.offset - startOfElement; - } - else - return TPM_RCS_VALUE + RC_CertifyX509_partialCertificate; - } - // Make sure that we used all of the data and found at least the required - // number of elements. - if((ctx.offset != ctx.size) || (countOfSequences < 3) - || (countOfSequences > 4) - || (certTBS[EXTENSIONS_REF].buf == NULL)) - return TPM_RCS_VALUE + RC_CertifyX509_partialCertificate; - // Now that we know how many sequences there were, we can put them where they - // belong - for(i = 0; i < countOfSequences; i++) - certTBS[SUBJECT_KEY_REF - i] = partial[countOfSequences - 1 - i]; - - // If only three SEQUENCES, then the TPM needs to produce the signature algorithm. - // See if it can - if((countOfSequences == 3) && - (X509AddSigningAlgorithm(NULL, signKey, &in->inScheme) == 0)) - return TPM_RCS_SCHEME + RC_CertifyX509_signHandle; - - // Process the extensions - result = X509ProcessExtensions(object, &certTBS[EXTENSIONS_REF]); - if(result != TPM_RC_SUCCESS) - // If the extension has the TPMA_OBJECT extension and the attributes don't - // match, then the error code will be TPM_RCS_ATTRIBUTES. Otherwise, the error - // indicates a malformed partialCertificate. - return result + ((result == TPM_RCS_ATTRIBUTES) - ? RC_CertifyX509_objectHandle - : RC_CertifyX509_partialCertificate); -// Command Output -// Create the addedToCertificate values - - // Build the addedToCertificate from the bottom up. - // Initialize the context structure - ASN1InitialializeMarshalContext(&ctxOut, sizeof(out->addedToCertificate.t.buffer), - out->addedToCertificate.t.buffer); - // Place a marker for the overall context - ASN1StartMarshalContext(&ctxOut); // SEQUENCE for addedToCertificate - - // Add the subject public key descriptor - certTBS[SUBJECT_PUBLIC_KEY_REF].len = X509AddPublicKey(&ctxOut, object); - certTBS[SUBJECT_PUBLIC_KEY_REF].buf = ctxOut.buffer + ctxOut.offset; - // If the caller didn't provide the algorithm identifier, create it - if(certTBS[SIGNATURE_REF].len == 0) - { - certTBS[SIGNATURE_REF].len = X509AddSigningAlgorithm(&ctxOut, signKey, - &in->inScheme); - certTBS[SIGNATURE_REF].buf = ctxOut.buffer + ctxOut.offset; - } - // Create the serial number value. Use the out->tbsDigest as scratch. - { - TPM2B *digest = &out->tbsDigest.b; - // - digest->size = (INT16)CryptHashStart(&hash, signKey->publicArea.nameAlg); - pAssert(digest->size != 0); - - // The serial number size is the smaller of the digest and the vendor-defined - // value - digest->size = MIN(digest->size, SIZE_OF_X509_SERIAL_NUMBER); - // Add all the parts of the certificate other than the serial number - // and version number - for(i = SIGNATURE_REF; i < REF_COUNT; i++) - CryptDigestUpdate(&hash, certTBS[i].len, certTBS[i].buf); - // throw in the Name of the signing key... - CryptDigestUpdate2B(&hash, &signKey->name.b); - // ...and the Name of the signed key. - CryptDigestUpdate2B(&hash, &object->name.b); - // Done - CryptHashEnd2B(&hash, digest); - } - - // Add the serial number - certTBS[SERIAL_NUMBER_REF].len = - ASN1PushInteger(&ctxOut, out->tbsDigest.t.size, out->tbsDigest.t.buffer); - certTBS[SERIAL_NUMBER_REF].buf = ctxOut.buffer + ctxOut.offset; - - // Add the static version number - ASN1StartMarshalContext(&ctxOut); - ASN1PushUINT(&ctxOut, 2); - certTBS[VERSION_REF].len = - ASN1EndEncapsulation(&ctxOut, ASN1_APPLICAIION_SPECIFIC); - certTBS[VERSION_REF].buf = ctxOut.buffer + ctxOut.offset; - - // Create a fake tag and length for the TBS in the space used for - // 'addedToCertificate' - { - for(length = 0, i = 0; i < REF_COUNT; i++) - length += certTBS[i].len; - // Put a fake tag and length into the buffer for use in the tbsDigest - certTBS[ENCODED_SIZE_REF].len = - ASN1PushTagAndLength(&ctxOut, ASN1_CONSTRUCTED_SEQUENCE, length); - certTBS[ENCODED_SIZE_REF].buf = ctxOut.buffer + ctxOut.offset; - // Restore the buffer pointer to add back the number of octets used for the - // tag and length - ctxOut.offset += certTBS[ENCODED_SIZE_REF].len; - } - // sanity check - if(ctxOut.offset < 0) - return TPM_RC_FAILURE; - // Create the tbsDigest to sign - out->tbsDigest.t.size = CryptHashStart(&hash, in->inScheme.details.any.hashAlg); - for(i = 0; i < REF_COUNT; i++) - CryptDigestUpdate(&hash, certTBS[i].len, certTBS[i].buf); - CryptHashEnd2B(&hash, &out->tbsDigest.b); - -#if CERTIFYX509_DEBUG - { - BYTE fullTBS[4096]; - BYTE *fill = fullTBS; - int j; - for (j = 0; j < REF_COUNT; j++) - { - MemoryCopy(fill, certTBS[j].buf, certTBS[j].len); - fill += certTBS[j].len; - } - DebugDumpBuffer((int)(fill - &fullTBS[0]), fullTBS, "\nfull TBS"); - } -#endif - -// Finish up the processing of addedToCertificate - // Create the actual tag and length for the addedToCertificate structure - out->addedToCertificate.t.size = - ASN1EndEncapsulation(&ctxOut, ASN1_CONSTRUCTED_SEQUENCE); - // Now move all the addedToContext to the start of the buffer - MemoryCopy(out->addedToCertificate.t.buffer, ctxOut.buffer + ctxOut.offset, - out->addedToCertificate.t.size); -#if CERTIFYX509_DEBUG - DebugDumpBuffer(out->addedToCertificate.t.size, out->addedToCertificate.t.buffer, - "\naddedToCertificate"); -#endif - // only thing missing is the signature - result = CryptSign(signKey, &in->inScheme, &out->tbsDigest, &out->signature); - - return result; -} - -#endif // CC_CertifyX509 diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetCommandAuditDigest.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetCommandAuditDigest.c deleted file mode 100644 index 5ecc90153..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetCommandAuditDigest.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Attest_spt_fp.h" -#include "GetCommandAuditDigest_fp.h" - -#if CC_GetCommandAuditDigest // Conditional expansion of this file - -/*(See part 3 specification) -// Get current value of command audit log -*/ -// Return Type: TPM_RC -// TPM_RC_KEY key referenced by 'signHandle' is not a signing key -// TPM_RC_SCHEME 'inScheme' is incompatible with 'signHandle' type; or -// both 'scheme' and key's default scheme are empty; or -// 'scheme' is empty while key's default scheme requires -// explicit input scheme (split signing); or -// non-empty default key scheme differs from 'scheme' -// TPM_RC_VALUE digest generated for the given 'scheme' is greater than -// the modulus of 'signHandle' (for an RSA key); -// invalid commit status or failed to generate "r" value -// (for an ECC key) -TPM_RC -TPM2_GetCommandAuditDigest( - GetCommandAuditDigest_In *in, // IN: input parameter list - GetCommandAuditDigest_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - TPMS_ATTEST auditInfo; - OBJECT *signObject = HandleToObject(in->signHandle); -// Input validation - if(!IsSigningObject(signObject)) - return TPM_RCS_KEY + RC_GetCommandAuditDigest_signHandle; - if(!CryptSelectSignScheme(signObject, &in->inScheme)) - return TPM_RCS_SCHEME + RC_GetCommandAuditDigest_inScheme; - -// Command Output - // Fill in attest information common fields - FillInAttestInfo(in->signHandle, &in->inScheme, &in->qualifyingData, - &auditInfo); - - // CommandAuditDigest specific fields - auditInfo.type = TPM_ST_ATTEST_COMMAND_AUDIT; - auditInfo.attested.commandAudit.digestAlg = gp.auditHashAlg; - auditInfo.attested.commandAudit.auditCounter = gp.auditCounter; - - // Copy command audit log - auditInfo.attested.commandAudit.auditDigest = gr.commandAuditDigest; - CommandAuditGetDigest(&auditInfo.attested.commandAudit.commandDigest); - - // Sign attestation structure. A NULL signature will be returned if - // signHandle is TPM_RH_NULL. A TPM_RC_NV_UNAVAILABLE, TPM_RC_NV_RATE, - // TPM_RC_VALUE, TPM_RC_SCHEME or TPM_RC_ATTRIBUTES error may be returned at - // this point - result = SignAttestInfo(signObject, &in->inScheme, &auditInfo, - &in->qualifyingData, &out->auditInfo, - &out->signature); - // Internal Data Update - if(result == TPM_RC_SUCCESS && in->signHandle != TPM_RH_NULL) - // Reset log - gr.commandAuditDigest.t.size = 0; - - return result; -} - -#endif // CC_GetCommandAuditDigest \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetSessionAuditDigest.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetSessionAuditDigest.c deleted file mode 100644 index e9ed0470d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetSessionAuditDigest.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Attest_spt_fp.h" -#include "GetSessionAuditDigest_fp.h" - -#if CC_GetSessionAuditDigest // Conditional expansion of this file - -/*(See part 3 specification) -// Get audit session digest -*/ -// Return Type: TPM_RC -// TPM_RC_KEY key referenced by 'signHandle' is not a signing key -// TPM_RC_SCHEME 'inScheme' is incompatible with 'signHandle' type; or -// both 'scheme' and key's default scheme are empty; or -// 'scheme' is empty while key's default scheme requires -// explicit input scheme (split signing); or -// non-empty default key scheme differs from 'scheme' -// TPM_RC_TYPE 'sessionHandle' does not reference an audit session -// TPM_RC_VALUE digest generated for the given 'scheme' is greater than -// the modulus of 'signHandle' (for an RSA key); -// invalid commit status or failed to generate "r" value -// (for an ECC key) -TPM_RC -TPM2_GetSessionAuditDigest( - GetSessionAuditDigest_In *in, // IN: input parameter list - GetSessionAuditDigest_Out *out // OUT: output parameter list - ) -{ - SESSION *session = SessionGet(in->sessionHandle); - TPMS_ATTEST auditInfo; - OBJECT *signObject = HandleToObject(in->signHandle); -// Input Validation - if(!IsSigningObject(signObject)) - return TPM_RCS_KEY + RC_GetSessionAuditDigest_signHandle; - if(!CryptSelectSignScheme(signObject, &in->inScheme)) - return TPM_RCS_SCHEME + RC_GetSessionAuditDigest_inScheme; - - // session must be an audit session - if(session->attributes.isAudit == CLEAR) - return TPM_RCS_TYPE + RC_GetSessionAuditDigest_sessionHandle; - -// Command Output - // Fill in attest information common fields - FillInAttestInfo(in->signHandle, &in->inScheme, &in->qualifyingData, - &auditInfo); - - // SessionAuditDigest specific fields - auditInfo.type = TPM_ST_ATTEST_SESSION_AUDIT; - auditInfo.attested.sessionAudit.sessionDigest = session->u2.auditDigest; - - // Exclusive audit session - auditInfo.attested.sessionAudit.exclusiveSession - = (g_exclusiveAuditSession == in->sessionHandle); - - // Sign attestation structure. A NULL signature will be returned if - // signObject is NULL. - return SignAttestInfo(signObject, &in->inScheme, &auditInfo, - &in->qualifyingData, &out->auditInfo, - &out->signature); -} - -#endif // CC_GetSessionAuditDigest \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetTime.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetTime.c deleted file mode 100644 index fe24c7e6a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/GetTime.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Attest_spt_fp.h" -#include "GetTime_fp.h" - -#if CC_GetTime // Conditional expansion of this file - -/*(See part 3 specification) -// Applies a time stamp to the passed blob (qualifyingData). -*/ -// Return Type: TPM_RC -// TPM_RC_KEY key referenced by 'signHandle' is not a signing key -// TPM_RC_SCHEME 'inScheme' is incompatible with 'signHandle' type; or -// both 'scheme' and key's default scheme are empty; or -// 'scheme' is empty while key's default scheme requires -// explicit input scheme (split signing); or -// non-empty default key scheme differs from 'scheme' -// TPM_RC_VALUE digest generated for the given 'scheme' is greater than -// the modulus of 'signHandle' (for an RSA key); -// invalid commit status or failed to generate "r" value -// (for an ECC key) -TPM_RC -TPM2_GetTime( - GetTime_In *in, // IN: input parameter list - GetTime_Out *out // OUT: output parameter list - ) -{ - TPMS_ATTEST timeInfo; - OBJECT *signObject = HandleToObject(in->signHandle); -// Input Validation - if(!IsSigningObject(signObject)) - return TPM_RCS_KEY + RC_GetTime_signHandle; - if(!CryptSelectSignScheme(signObject, &in->inScheme)) - return TPM_RCS_SCHEME + RC_GetTime_inScheme; - -// Command Output - // Fill in attest common fields - FillInAttestInfo(in->signHandle, &in->inScheme, &in->qualifyingData, &timeInfo); - - // GetClock specific fields - timeInfo.type = TPM_ST_ATTEST_TIME; - timeInfo.attested.time.time.time = g_time; - TimeFillInfo(&timeInfo.attested.time.time.clockInfo); - - // Firmware version in plain text - timeInfo.attested.time.firmwareVersion - = (((UINT64)gp.firmwareV1) << 32) + gp.firmwareV2; - - // Sign attestation structure. A NULL signature will be returned if - // signObject is NULL. - return SignAttestInfo(signObject, &in->inScheme, &timeInfo, &in->qualifyingData, - &out->timeInfo, &out->signature); -} - -#endif // CC_GetTime \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Quote.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Quote.c deleted file mode 100644 index f22e3cde2..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Attestation/Quote.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Attest_spt_fp.h" -#include "Quote_fp.h" - -#if CC_Quote // Conditional expansion of this file - -/*(See part 3 specification) -// quote PCR values -*/ -// Return Type: TPM_RC -// TPM_RC_KEY 'signHandle' does not reference a signing key; -// TPM_RC_SCHEME the scheme is not compatible with sign key type, -// or input scheme is not compatible with default -// scheme, or the chosen scheme is not a valid -// sign scheme -TPM_RC -TPM2_Quote( - Quote_In *in, // IN: input parameter list - Quote_Out *out // OUT: output parameter list - ) -{ - TPMI_ALG_HASH hashAlg; - TPMS_ATTEST quoted; - OBJECT *signObject = HandleToObject(in->signHandle); -// Input Validation - if(!IsSigningObject(signObject)) - return TPM_RCS_KEY + RC_Quote_signHandle; - if(!CryptSelectSignScheme(signObject, &in->inScheme)) - return TPM_RCS_SCHEME + RC_Quote_inScheme; - -// Command Output - - // Filling in attest information - // Common fields - // FillInAttestInfo may return TPM_RC_SCHEME or TPM_RC_KEY - FillInAttestInfo(in->signHandle, &in->inScheme, &in->qualifyingData, "ed); - - // Quote specific fields - // Attestation type - quoted.type = TPM_ST_ATTEST_QUOTE; - - // Get hash algorithm in sign scheme. This hash algorithm is used to - // compute PCR digest. If there is no algorithm, then the PCR cannot - // be digested and this command returns TPM_RC_SCHEME - hashAlg = in->inScheme.details.any.hashAlg; - - if(hashAlg == TPM_ALG_NULL) - return TPM_RCS_SCHEME + RC_Quote_inScheme; - - // Compute PCR digest - PCRComputeCurrentDigest(hashAlg, &in->PCRselect, - "ed.attested.quote.pcrDigest); - - // Copy PCR select. "PCRselect" is modified in PCRComputeCurrentDigest - // function - quoted.attested.quote.pcrSelect = in->PCRselect; - - // Sign attestation structure. A NULL signature will be returned if - // signObject is NULL. - return SignAttestInfo(signObject, &in->inScheme, "ed, &in->qualifyingData, - &out->quoted, &out->signature); -} - -#endif // CC_Quote \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Capability/GetCapability.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Capability/GetCapability.c deleted file mode 100644 index a3c5cf7e4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Capability/GetCapability.c +++ /dev/null @@ -1,180 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "GetCapability_fp.h" - -#if CC_GetCapability // Conditional expansion of this file - -/*(See part 3 specification) -// This command returns various information regarding the TPM and its current -// state -*/ -// Return Type: TPM_RC -// TPM_RC_HANDLE value of 'property' is in an unsupported handle range -// for the TPM_CAP_HANDLES 'capability' value -// TPM_RC_VALUE invalid 'capability'; or 'property' is not 0 for the -// TPM_CAP_PCRS 'capability' value -TPM_RC -TPM2_GetCapability( - GetCapability_In *in, // IN: input parameter list - GetCapability_Out *out // OUT: output parameter list - ) -{ - TPMU_CAPABILITIES *data = &out->capabilityData.data; -// Command Output - - // Set output capability type the same as input type - out->capabilityData.capability = in->capability; - - switch(in->capability) - { - case TPM_CAP_ALGS: - out->moreData = AlgorithmCapGetImplemented((TPM_ALG_ID)in->property, - in->propertyCount, - &data->algorithms); - break; - case TPM_CAP_HANDLES: - switch(HandleGetType((TPM_HANDLE)in->property)) - { - case TPM_HT_TRANSIENT: - // Get list of handles of loaded transient objects - out->moreData = ObjectCapGetLoaded((TPM_HANDLE)in->property, - in->propertyCount, - &data->handles); - break; - case TPM_HT_PERSISTENT: - // Get list of handles of persistent objects - out->moreData = NvCapGetPersistent((TPM_HANDLE)in->property, - in->propertyCount, - &data->handles); - break; - case TPM_HT_NV_INDEX: - // Get list of defined NV index - out->moreData = NvCapGetIndex((TPM_HANDLE)in->property, - in->propertyCount, - &data->handles); - break; - case TPM_HT_LOADED_SESSION: - // Get list of handles of loaded sessions - out->moreData = SessionCapGetLoaded((TPM_HANDLE)in->property, - in->propertyCount, - &data->handles); - break; -#ifdef TPM_HT_SAVED_SESSION - case TPM_HT_SAVED_SESSION: -#else - case TPM_HT_ACTIVE_SESSION: -#endif - // Get list of handles of - out->moreData = SessionCapGetSaved((TPM_HANDLE)in->property, - in->propertyCount, - &data->handles); - break; - case TPM_HT_PCR: - // Get list of handles of PCR - out->moreData = PCRCapGetHandles((TPM_HANDLE)in->property, - in->propertyCount, - &data->handles); - break; - case TPM_HT_PERMANENT: - // Get list of permanent handles - out->moreData = PermanentCapGetHandles((TPM_HANDLE)in->property, - in->propertyCount, - &data->handles); - break; - default: - // Unsupported input handle type - return TPM_RCS_HANDLE + RC_GetCapability_property; - break; - } - break; - case TPM_CAP_COMMANDS: - out->moreData = CommandCapGetCCList((TPM_CC)in->property, - in->propertyCount, - &data->command); - break; - case TPM_CAP_PP_COMMANDS: - out->moreData = PhysicalPresenceCapGetCCList((TPM_CC)in->property, - in->propertyCount, - &data->ppCommands); - break; - case TPM_CAP_AUDIT_COMMANDS: - out->moreData = CommandAuditCapGetCCList((TPM_CC)in->property, - in->propertyCount, - &data->auditCommands); - break; - case TPM_CAP_PCRS: - // Input property must be 0 - if(in->property != 0) - return TPM_RCS_VALUE + RC_GetCapability_property; - out->moreData = PCRCapGetAllocation(in->propertyCount, - &data->assignedPCR); - break; - case TPM_CAP_PCR_PROPERTIES: - out->moreData = PCRCapGetProperties((TPM_PT_PCR)in->property, - in->propertyCount, - &data->pcrProperties); - break; - case TPM_CAP_TPM_PROPERTIES: - out->moreData = TPMCapGetProperties((TPM_PT)in->property, - in->propertyCount, - &data->tpmProperties); - break; -#if ALG_ECC - case TPM_CAP_ECC_CURVES: - out->moreData = CryptCapGetECCCurve((TPM_ECC_CURVE)in->property, - in->propertyCount, - &data->eccCurves); - break; -#endif // ALG_ECC - case TPM_CAP_AUTH_POLICIES: - if(HandleGetType((TPM_HANDLE)in->property) != TPM_HT_PERMANENT) - return TPM_RCS_VALUE + RC_GetCapability_property; - out->moreData = PermanentHandleGetPolicy((TPM_HANDLE)in->property, - in->propertyCount, - &data->authPolicies); - break; - case TPM_CAP_VENDOR_PROPERTY: - // vendor property is not implemented - default: - // Unsupported TPM_CAP value - return TPM_RCS_VALUE + RC_GetCapability_capability; - break; - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_GetCapability \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Capability/TestParms.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Capability/TestParms.c deleted file mode 100644 index 3e5435e4a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Capability/TestParms.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "TestParms_fp.h" - -#if CC_TestParms // Conditional expansion of this file - -/*(See part 3 specification) -// TestParms -*/ -TPM_RC -TPM2_TestParms( - TestParms_In *in // IN: input parameter list - ) -{ - // Input parameter is not reference in command action - NOT_REFERENCED(in); - - // The parameters are tested at unmarshal process. We do nothing in command - // action - return TPM_RC_SUCCESS; -} - -#endif // CC_TestParms \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ClockRateAdjust.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ClockRateAdjust.c deleted file mode 100644 index 59148af03..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ClockRateAdjust.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ClockRateAdjust_fp.h" - -#if CC_ClockRateAdjust // Conditional expansion of this file - -/*(See part 3 specification) -// adjusts the rate of advance of Clock and Timer to provide a better -// approximation to real time. -*/ -TPM_RC -TPM2_ClockRateAdjust( - ClockRateAdjust_In *in // IN: input parameter list - ) -{ -// Internal Data Update - TimeSetAdjustRate(in->rateAdjust); - - return TPM_RC_SUCCESS; -} - -#endif // CC_ClockRateAdjust \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ClockSet.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ClockSet.c deleted file mode 100644 index 9e0a8d34d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ClockSet.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ClockSet_fp.h" - -#if CC_ClockSet // Conditional expansion of this file - -// Read the current TPMS_TIMER_INFO structure settings -// Return Type: TPM_RC -// TPM_RC_NV_RATE NV is unavailable because of rate limit -// TPM_RC_NV_UNAVAILABLE NV is inaccessible -// TPM_RC_VALUE invalid new clock - -TPM_RC -TPM2_ClockSet( - ClockSet_In *in // IN: input parameter list - ) -{ -// Input Validation - // new time can not be bigger than 0xFFFF000000000000 or smaller than - // current clock - if(in->newTime > 0xFFFF000000000000ULL - || in->newTime < go.clock) - return TPM_RCS_VALUE + RC_ClockSet_newTime; - -// Internal Data Update - // Can't modify the clock if NV is not available. - RETURN_IF_NV_IS_NOT_AVAILABLE; - - TimeClockUpdate(in->newTime); - return TPM_RC_SUCCESS; -} - -#endif // CC_ClockSet \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ReadClock.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ReadClock.c deleted file mode 100644 index f405d057e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/ClockTimer/ReadClock.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ReadClock_fp.h" - -#if CC_ReadClock // Conditional expansion of this file - -/*(See part 3 specification) -// read the current TPMS_TIMER_INFO structure settings -*/ -TPM_RC -TPM2_ReadClock( - ReadClock_Out *out // OUT: output parameter list - ) -{ -// Command Output - - out->currentTime.time = g_time; - TimeFillInfo(&out->currentTime.clockInfo); - - return TPM_RC_SUCCESS; -} - -#endif // CC_ReadClock \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/CommandAudit/SetCommandCodeAuditStatus.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/CommandAudit/SetCommandCodeAuditStatus.c deleted file mode 100644 index b7f52e8c1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/CommandAudit/SetCommandCodeAuditStatus.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "SetCommandCodeAuditStatus_fp.h" - -#if CC_SetCommandCodeAuditStatus // Conditional expansion of this file - -/*(See part 3 specification) -// change the audit status of a command or to set the hash algorithm used for -// the audit digest. -*/ -TPM_RC -TPM2_SetCommandCodeAuditStatus( - SetCommandCodeAuditStatus_In *in // IN: input parameter list - ) -{ - - // The command needs NV update. Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Internal Data Update - - // Update hash algorithm - if(in->auditAlg != TPM_ALG_NULL && in->auditAlg != gp.auditHashAlg) - { - // Can't change the algorithm and command list at the same time - if(in->setList.count != 0 || in->clearList.count != 0) - return TPM_RCS_VALUE + RC_SetCommandCodeAuditStatus_auditAlg; - - // Change the hash algorithm for audit - gp.auditHashAlg = in->auditAlg; - - // Set the digest size to a unique value that indicates that the digest - // algorithm has been changed. The size will be cleared to zero in the - // command audit processing on exit. - gr.commandAuditDigest.t.size = 1; - - // Save the change of command audit data (this sets g_updateNV so that NV - // will be updated on exit.) - NV_SYNC_PERSISTENT(auditHashAlg); - } - else - { - UINT32 i; - BOOL changed = FALSE; - - // Process set list - for(i = 0; i < in->setList.count; i++) - - // If change is made in CommandAuditSet, set changed flag - if(CommandAuditSet(in->setList.commandCodes[i])) - changed = TRUE; - - // Process clear list - for(i = 0; i < in->clearList.count; i++) - // If change is made in CommandAuditClear, set changed flag - if(CommandAuditClear(in->clearList.commandCodes[i])) - changed = TRUE; - - // if change was made to command list, update NV - if(changed) - // this sets g_updateNV so that NV will be updated on exit. - NV_SYNC_PERSISTENT(auditCommands); - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_SetCommandCodeAuditStatus \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/ContextLoad.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/ContextLoad.c deleted file mode 100644 index 4977f9827..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/ContextLoad.c +++ /dev/null @@ -1,193 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ContextLoad_fp.h" - -#if CC_ContextLoad // Conditional expansion of this file - -#include "Context_spt_fp.h" - -/*(See part 3 specification) -// Load context -*/ - -// Return Type: TPM_RC -// TPM_RC_CONTEXT_GAP there is only one available slot and this is not -// the oldest saved session context -// TPM_RC_HANDLE context.savedHandle' does not reference a saved -// session -// TPM_RC_HIERARCHY 'context.hierarchy' is disabled -// TPM_RC_INTEGRITY 'context' integrity check fail -// TPM_RC_OBJECT_MEMORY no free slot for an object -// TPM_RC_SESSION_MEMORY no free session slots -// TPM_RC_SIZE incorrect context blob size -TPM_RC -TPM2_ContextLoad( - ContextLoad_In *in, // IN: input parameter list - ContextLoad_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - TPM2B_DIGEST integrityToCompare; - TPM2B_DIGEST integrity; - BYTE *buffer; // defined to save some typing - INT32 size; // defined to save some typing - TPM_HT handleType; - TPM2B_SYM_KEY symKey; - TPM2B_IV iv; - -// Input Validation - -// See discussion about the context format in TPM2_ContextSave Detailed Actions - - // IF this is a session context, make sure that the sequence number is - // consistent with the version in the slot - - // Check context blob size - handleType = HandleGetType(in->context.savedHandle); - - // Get integrity from context blob - buffer = in->context.contextBlob.t.buffer; - size = (INT32)in->context.contextBlob.t.size; - result = TPM2B_DIGEST_Unmarshal(&integrity, &buffer, &size); - if(result != TPM_RC_SUCCESS) - return result; - - // the size of the integrity value has to match the size of digest produced - // by the integrity hash - if(integrity.t.size != CryptHashGetDigestSize(CONTEXT_INTEGRITY_HASH_ALG)) - return TPM_RCS_SIZE + RC_ContextLoad_context; - - // Make sure that the context blob has enough space for the fingerprint. This - // is elastic pants to go with the belt and suspenders we already have to make - // sure that the context is complete and untampered. - if((unsigned)size < sizeof(in->context.sequence)) - return TPM_RCS_SIZE + RC_ContextLoad_context; - - // After unmarshaling the integrity value, 'buffer' is pointing at the first - // byte of the integrity protected and encrypted buffer and 'size' is the number - // of integrity protected and encrypted bytes. - - // Compute context integrity - ComputeContextIntegrity(&in->context, &integrityToCompare); - - // Compare integrity - if(!MemoryEqual2B(&integrity.b, &integrityToCompare.b)) - return TPM_RCS_INTEGRITY + RC_ContextLoad_context; - // Compute context encryption key - ComputeContextProtectionKey(&in->context, &symKey, &iv); - - // Decrypt context data in place - CryptSymmetricDecrypt(buffer, CONTEXT_ENCRYPT_ALG, CONTEXT_ENCRYPT_KEY_BITS, - symKey.t.buffer, &iv, ALG_CFB_VALUE, size, buffer); - // See if the fingerprint value matches. If not, it is symptomatic of either - // a broken TPM or that the TPM is under attack so go into failure mode. - if(!MemoryEqual(buffer, &in->context.sequence, sizeof(in->context.sequence))) - FAIL(FATAL_ERROR_INTERNAL); - - // step over fingerprint - buffer += sizeof(in->context.sequence); - - // set the remaining size of the context - size -= sizeof(in->context.sequence); - - // Perform object or session specific input check - switch(handleType) - { - case TPM_HT_TRANSIENT: - { - OBJECT *outObject; - - if(size > (INT32)sizeof(OBJECT)) - FAIL(FATAL_ERROR_INTERNAL); - - // Discard any changes to the handle that the TRM might have made - in->context.savedHandle = TRANSIENT_FIRST; - - // If hierarchy is disabled, no object context can be loaded in this - // hierarchy - if(!HierarchyIsEnabled(in->context.hierarchy)) - return TPM_RCS_HIERARCHY + RC_ContextLoad_context; - - // Restore object. If there is no empty space, indicate as much - outObject = ObjectContextLoad((ANY_OBJECT_BUFFER *)buffer, - &out->loadedHandle); - if(outObject == NULL) - return TPM_RC_OBJECT_MEMORY; - - break; - } - case TPM_HT_POLICY_SESSION: - case TPM_HT_HMAC_SESSION: - { - if(size != sizeof(SESSION)) - FAIL(FATAL_ERROR_INTERNAL); - - // This command may cause the orderlyState to be cleared due to - // the update of state reset data. If this is the case, check if NV is - // available first - RETURN_IF_ORDERLY; - - // Check if input handle points to a valid saved session and that the - // sequence number makes sense - if(!SequenceNumberForSavedContextIsValid(&in->context)) - return TPM_RCS_HANDLE + RC_ContextLoad_context; - - // Restore session. A TPM_RC_SESSION_MEMORY, TPM_RC_CONTEXT_GAP error - // may be returned at this point - result = SessionContextLoad((SESSION_BUF *)buffer, - &in->context.savedHandle); - if(result != TPM_RC_SUCCESS) - return result; - - out->loadedHandle = in->context.savedHandle; - - // orderly state should be cleared because of the update of state - // reset and state clear data - g_clearOrderly = TRUE; - - break; - } - default: - // Context blob may only have an object handle or a session handle. - // All the other handle type should be filtered out at unmarshal - FAIL(FATAL_ERROR_INTERNAL); - break; - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_ContextLoad \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/ContextSave.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/ContextSave.c deleted file mode 100644 index ff3c4cdf8..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/ContextSave.c +++ /dev/null @@ -1,232 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ContextSave_fp.h" - -#if CC_ContextSave // Conditional expansion of this file - -#include "Context_spt_fp.h" - -/*(See part 3 specification) - Save context -*/ -// Return Type: TPM_RC -// TPM_RC_CONTEXT_GAP a contextID could not be assigned for a session -// context save -// TPM_RC_TOO_MANY_CONTEXTS no more contexts can be saved as the counter has -// maxed out -TPM_RC -TPM2_ContextSave( - ContextSave_In *in, // IN: input parameter list - ContextSave_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - UINT16 fingerprintSize; // The size of fingerprint in context - // blob. - UINT64 contextID = 0; // session context ID - TPM2B_SYM_KEY symKey; - TPM2B_IV iv; - - TPM2B_DIGEST integrity; - UINT16 integritySize; - BYTE *buffer; - - // This command may cause the orderlyState to be cleared due to - // the update of state reset data. If the state is orderly and - // cannot be changed, exit early. - RETURN_IF_ORDERLY; - -// Internal Data Update - -// This implementation does not do things in quite the same way as described in -// Part 2 of the specification. In Part 2, it indicates that the -// TPMS_CONTEXT_DATA contains two TPM2B values. That is not how this is -// implemented. Rather, the size field of the TPM2B_CONTEXT_DATA is used to -// determine the amount of data in the encrypted data. That part is not -// independently sized. This makes the actual size 2 bytes smaller than -// calculated using Part 2. Since this is opaque to the caller, it is not -// necessary to fix. The actual size is returned by TPM2_GetCapabilties(). - - // Initialize output handle. At the end of command action, the output - // handle of an object will be replaced, while the output handle - // for a session will be the same as input - out->context.savedHandle = in->saveHandle; - - // Get the size of fingerprint in context blob. The sequence value in - // TPMS_CONTEXT structure is used as the fingerprint - fingerprintSize = sizeof(out->context.sequence); - - // Compute the integrity size at the beginning of context blob - integritySize = sizeof(integrity.t.size) - + CryptHashGetDigestSize(CONTEXT_INTEGRITY_HASH_ALG); - -// Perform object or session specific context save - switch(HandleGetType(in->saveHandle)) - { - case TPM_HT_TRANSIENT: - { - OBJECT *object = HandleToObject(in->saveHandle); - ANY_OBJECT_BUFFER *outObject; - UINT16 objectSize = ObjectIsSequence(object) - ? sizeof(HASH_OBJECT) : sizeof(OBJECT); - - outObject = (ANY_OBJECT_BUFFER *)(out->context.contextBlob.t.buffer - + integritySize + fingerprintSize); - - // Set size of the context data. The contents of context blob is vendor - // defined. In this implementation, the size is size of integrity - // plus fingerprint plus the whole internal OBJECT structure - out->context.contextBlob.t.size = integritySize + - fingerprintSize + objectSize; -#if ALG_RSA - // For an RSA key, make sure that the key has had the private exponent - // computed before saving. - if(object->publicArea.type == TPM_ALG_RSA && - !(object->attributes.publicOnly)) - CryptRsaLoadPrivateExponent(&object->publicArea, &object->sensitive); -#endif - // Make sure things fit - pAssert(out->context.contextBlob.t.size - <= sizeof(out->context.contextBlob.t.buffer)); - // Copy the whole internal OBJECT structure to context blob - MemoryCopy(outObject, object, objectSize); - - // Increment object context ID - gr.objectContextID++; - // If object context ID overflows, TPM should be put in failure mode - if(gr.objectContextID == 0) - FAIL(FATAL_ERROR_INTERNAL); - - // Fill in other return values for an object. - out->context.sequence = gr.objectContextID; - // For regular object, savedHandle is 0x80000000. For sequence object, - // savedHandle is 0x80000001. For object with stClear, savedHandle - // is 0x80000002 - if(ObjectIsSequence(object)) - { - out->context.savedHandle = 0x80000001; - SequenceDataExport((HASH_OBJECT *)object, - (HASH_OBJECT_BUFFER *)outObject); - } - else - out->context.savedHandle = (object->attributes.stClear == SET) - ? 0x80000002 : 0x80000000; -// Get object hierarchy - out->context.hierarchy = ObjectGetHierarchy(object); - - break; - } - case TPM_HT_HMAC_SESSION: - case TPM_HT_POLICY_SESSION: - { - SESSION *session = SessionGet(in->saveHandle); - - // Set size of the context data. The contents of context blob is vendor - // defined. In this implementation, the size of context blob is the - // size of a internal session structure plus the size of - // fingerprint plus the size of integrity - out->context.contextBlob.t.size = integritySize + - fingerprintSize + sizeof(*session); - - // Make sure things fit - pAssert(out->context.contextBlob.t.size - < sizeof(out->context.contextBlob.t.buffer)); - - // Copy the whole internal SESSION structure to context blob. - // Save space for fingerprint at the beginning of the buffer - // This is done before anything else so that the actual context - // can be reclaimed after this call - pAssert(sizeof(*session) <= sizeof(out->context.contextBlob.t.buffer) - - integritySize - fingerprintSize); - MemoryCopy(out->context.contextBlob.t.buffer + integritySize - + fingerprintSize, session, sizeof(*session)); - // Fill in the other return parameters for a session - // Get a context ID and set the session tracking values appropriately - // TPM_RC_CONTEXT_GAP is a possible error. - // SessionContextSave() will flush the in-memory context - // so no additional errors may occur after this call. - result = SessionContextSave(out->context.savedHandle, &contextID); - if(result != TPM_RC_SUCCESS) - return result; - // sequence number is the current session contextID - out->context.sequence = contextID; - - // use TPM_RH_NULL as hierarchy for session context - out->context.hierarchy = TPM_RH_NULL; - - break; - } - default: - // SaveContext may only take an object handle or a session handle. - // All the other handle type should be filtered out at unmarshal - FAIL(FATAL_ERROR_INTERNAL); - break; - } - - // Save fingerprint at the beginning of encrypted area of context blob. - // Reserve the integrity space - pAssert(sizeof(out->context.sequence) <= - sizeof(out->context.contextBlob.t.buffer) - integritySize); - MemoryCopy(out->context.contextBlob.t.buffer + integritySize, - &out->context.sequence, sizeof(out->context.sequence)); - - // Compute context encryption key - ComputeContextProtectionKey(&out->context, &symKey, &iv); - - // Encrypt context blob - CryptSymmetricEncrypt(out->context.contextBlob.t.buffer + integritySize, - CONTEXT_ENCRYPT_ALG, CONTEXT_ENCRYPT_KEY_BITS, - symKey.t.buffer, &iv, ALG_CFB_VALUE, - out->context.contextBlob.t.size - integritySize, - out->context.contextBlob.t.buffer + integritySize); - - // Compute integrity hash for the object - // In this implementation, the same routine is used for both sessions - // and objects. - ComputeContextIntegrity(&out->context, &integrity); - - // add integrity at the beginning of context blob - buffer = out->context.contextBlob.t.buffer; - TPM2B_DIGEST_Marshal(&integrity, &buffer, NULL); - - // orderly state should be cleared because of the update of state reset and - // state clear data - g_clearOrderly = TRUE; - - return result; -} - -#endif // CC_ContextSave \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/Context_spt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/Context_spt.c deleted file mode 100644 index 7a5fea817..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/Context_spt.c +++ /dev/null @@ -1,244 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes - -#include "Tpm.h" -#include "Context_spt_fp.h" - -//** Functions - -//*** ComputeContextProtectionKey() -// This function retrieves the symmetric protection key for context encryption -// It is used by TPM2_ConextSave and TPM2_ContextLoad to create the symmetric -// encryption key and iv -/*(See part 1 specification) - KDFa is used to generate the symmetric encryption key and IV. The parameters - of the call are: - Symkey = KDFa(hashAlg, hProof, vendorString, sequence, handle, bits) - where - hashAlg a vendor-defined hash algorithm - hProof the hierarchy proof as selected by the hierarchy parameter - of the TPMS_CONTEXT - vendorString a value used to differentiate the uses of the KDF - sequence the sequence parameter of the TPMS_CONTEXT - handle the handle parameter of the TPMS_CONTEXT - bits the number of bits needed for a symmetric key and IV for - the context encryption -*/ -// Return Type: void -void -ComputeContextProtectionKey( - TPMS_CONTEXT *contextBlob, // IN: context blob - TPM2B_SYM_KEY *symKey, // OUT: the symmetric key - TPM2B_IV *iv // OUT: the IV. - ) -{ - UINT16 symKeyBits; // number of bits in the parent's - // symmetric key - TPM2B_PROOF *proof = NULL; // the proof value to use. Is null for - // everything but a primary object in - // the Endorsement Hierarchy - - BYTE kdfResult[sizeof(TPMU_HA) * 2];// Value produced by the KDF - - TPM2B_DATA sequence2B, handle2B; - - // Get proof value - proof = HierarchyGetProof(contextBlob->hierarchy); - - // Get sequence value in 2B format - sequence2B.t.size = sizeof(contextBlob->sequence); - cAssert(sizeof(contextBlob->sequence) <= sizeof(sequence2B.t.buffer)); - MemoryCopy(sequence2B.t.buffer, &contextBlob->sequence, - sizeof(contextBlob->sequence)); - - // Get handle value in 2B format - handle2B.t.size = sizeof(contextBlob->savedHandle); - cAssert(sizeof(contextBlob->savedHandle) <= sizeof(handle2B.t.buffer)); - MemoryCopy(handle2B.t.buffer, &contextBlob->savedHandle, - sizeof(contextBlob->savedHandle)); - - // Get the symmetric encryption key size - symKey->t.size = CONTEXT_ENCRYPT_KEY_BYTES; - symKeyBits = CONTEXT_ENCRYPT_KEY_BITS; - // Get the size of the IV for the algorithm - iv->t.size = CryptGetSymmetricBlockSize(CONTEXT_ENCRYPT_ALG, symKeyBits); - - // KDFa to generate symmetric key and IV value - CryptKDFa(CONTEXT_INTEGRITY_HASH_ALG, &proof->b, CONTEXT_KEY, &sequence2B.b, - &handle2B.b, (symKey->t.size + iv->t.size) * 8, kdfResult, NULL, - FALSE); - - // Copy part of the returned value as the key - pAssert(symKey->t.size <= sizeof(symKey->t.buffer)); - MemoryCopy(symKey->t.buffer, kdfResult, symKey->t.size); - - // Copy the rest as the IV - pAssert(iv->t.size <= sizeof(iv->t.buffer)); - MemoryCopy(iv->t.buffer, &kdfResult[symKey->t.size], iv->t.size); - - return; -} - -//*** ComputeContextIntegrity() -// Generate the integrity hash for a context -// It is used by TPM2_ContextSave to create an integrity hash -// and by TPM2_ContextLoad to compare an integrity hash -/*(See part 1 specification) - The HMAC integrity computation for a saved context is: - HMACvendorAlg(hProof, resetValue {|| clearCount} || sequence || handle || - encContext) - where - HMACvendorAlg HMAC using a vendor-defined hash algorithm - hProof the hierarchy proof as selected by the hierarchy - parameter of the TPMS_CONTEXT - resetValue either a counter value that increments on each TPM Reset - and is not reset over the lifetime of the TPM or a random - value that changes on each TPM Reset and has the size of - the digest produced by vendorAlg - clearCount a counter value that is incremented on each TPM Reset - or TPM Restart. This value is only included if the handle - value is 0x80000002. - sequence the sequence parameter of the TPMS_CONTEXT - handle the handle parameter of the TPMS_CONTEXT - encContext the encrypted context blob -*/ -// Return Type: void -void -ComputeContextIntegrity( - TPMS_CONTEXT *contextBlob, // IN: context blob - TPM2B_DIGEST *integrity // OUT: integrity - ) -{ - HMAC_STATE hmacState; - TPM2B_PROOF *proof; - UINT16 integritySize; - - // Get proof value - proof = HierarchyGetProof(contextBlob->hierarchy); - - // Start HMAC - integrity->t.size = CryptHmacStart2B(&hmacState, CONTEXT_INTEGRITY_HASH_ALG, - &proof->b); - - // Compute integrity size at the beginning of context blob - integritySize = sizeof(integrity->t.size) + integrity->t.size; - - // Adding total reset counter so that the context cannot be - // used after a TPM Reset - CryptDigestUpdateInt(&hmacState.hashState, sizeof(gp.totalResetCount), - gp.totalResetCount); - - // If this is a ST_CLEAR object, add the clear count - // so that this contest cannot be loaded after a TPM Restart - if(contextBlob->savedHandle == 0x80000002) - CryptDigestUpdateInt(&hmacState.hashState, sizeof(gr.clearCount), - gr.clearCount); - - // Adding sequence number to the HMAC to make sure that it doesn't - // get changed - CryptDigestUpdateInt(&hmacState.hashState, sizeof(contextBlob->sequence), - contextBlob->sequence); - - // Protect the handle - CryptDigestUpdateInt(&hmacState.hashState, sizeof(contextBlob->savedHandle), - contextBlob->savedHandle); - - // Adding sensitive contextData, skip the leading integrity area - CryptDigestUpdate(&hmacState.hashState, - contextBlob->contextBlob.t.size - integritySize, - contextBlob->contextBlob.t.buffer + integritySize); - - // Complete HMAC - CryptHmacEnd2B(&hmacState, &integrity->b); - - return; -} - -//*** SequenceDataExport(); -// This function is used scan through the sequence object and -// either modify the hash state data for export (contextSave) or to -// import it into the internal format (contextLoad). -// This function should only be called after the sequence object has been copied -// to the context buffer (contextSave) or from the context buffer into the sequence -// object. The presumption is that the context buffer version of the data is the -// same size as the internal representation so nothing outsize of the hash context -// area gets modified. -void -SequenceDataExport( - HASH_OBJECT *object, // IN: an internal hash object - HASH_OBJECT_BUFFER *exportObject // OUT: a sequence context in a buffer - ) -{ - // If the hash object is not an event, then only one hash context is needed - int count = (object->attributes.eventSeq) ? HASH_COUNT : 1; - - for(count--; count >= 0; count--) - { - HASH_STATE *hash = &object->state.hashState[count]; - size_t offset = (BYTE *)hash - (BYTE *)object; - BYTE *exportHash = &((BYTE *)exportObject)[offset]; - - CryptHashExportState(hash, (EXPORT_HASH_STATE *)exportHash); - } -} - -//*** SequenceDataImport(); -// This function is used scan through the sequence object and -// either modify the hash state data for export (contextSave) or to -// import it into the internal format (contextLoad). -// This function should only be called after the sequence object has been copied -// to the context buffer (contextSave) or from the context buffer into the sequence -// object. The presumption is that the context buffer version of the data is the -// same size as the internal representation so nothing outsize of the hash context -// area gets modified. -void -SequenceDataImport( - HASH_OBJECT *object, // IN/OUT: an internal hash object - HASH_OBJECT_BUFFER *exportObject // IN/OUT: a sequence context in a buffer - ) -{ - // If the hash object is not an event, then only one hash context is needed - int count = (object->attributes.eventSeq) ? HASH_COUNT : 1; - - for(count--; count >= 0; count--) - { - HASH_STATE *hash = &object->state.hashState[count]; - size_t offset = (BYTE *)hash - (BYTE *)object; - BYTE *importHash = &((BYTE *)exportObject)[offset]; -// - CryptHashImportState(hash, (EXPORT_HASH_STATE *)importHash); - } -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/EvictControl.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/EvictControl.c deleted file mode 100644 index e4ed13489..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/EvictControl.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "EvictControl_fp.h" - -#if CC_EvictControl // Conditional expansion of this file - -/*(See part 3 specification) -// Make a transient object persistent or evict a persistent object -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES an object with 'temporary', 'stClear' or 'publicOnly' -// attribute SET cannot be made persistent -// TPM_RC_HIERARCHY 'auth' cannot authorize the operation in the hierarchy -// of 'evictObject' -// TPM_RC_HANDLE 'evictHandle' of the persistent object to be evicted is -// not the same as the 'persistentHandle' argument -// TPM_RC_NV_HANDLE 'persistentHandle' is unavailable -// TPM_RC_NV_SPACE no space in NV to make 'evictHandle' persistent -// TPM_RC_RANGE 'persistentHandle' is not in the range corresponding to -// the hierarchy of 'evictObject' -TPM_RC -TPM2_EvictControl( - EvictControl_In *in // IN: input parameter list - ) -{ - TPM_RC result; - OBJECT *evictObject; - -// Input Validation - - // Get internal object pointer - evictObject = HandleToObject(in->objectHandle); - - // Temporary, stClear or public only objects can not be made persistent - if(evictObject->attributes.temporary == SET - || evictObject->attributes.stClear == SET - || evictObject->attributes.publicOnly == SET) - return TPM_RCS_ATTRIBUTES + RC_EvictControl_objectHandle; - - // If objectHandle refers to a persistent object, it should be the same as - // input persistentHandle - if(evictObject->attributes.evict == SET - && evictObject->evictHandle != in->persistentHandle) - return TPM_RCS_HANDLE + RC_EvictControl_objectHandle; - - // Additional authorization validation - if(in->auth == TPM_RH_PLATFORM) - { - // To make persistent - if(evictObject->attributes.evict == CLEAR) - { - // PlatformAuth can not set evict object in storage or endorsement - // hierarchy - if(evictObject->attributes.ppsHierarchy == CLEAR) - return TPM_RCS_HIERARCHY + RC_EvictControl_objectHandle; - // Platform cannot use a handle outside of platform persistent range. - if(!NvIsPlatformPersistentHandle(in->persistentHandle)) - return TPM_RCS_RANGE + RC_EvictControl_persistentHandle; - } - // PlatformAuth can delete any persistent object - } - else if(in->auth == TPM_RH_OWNER) - { - // OwnerAuth can not set or clear evict object in platform hierarchy - if(evictObject->attributes.ppsHierarchy == SET) - return TPM_RCS_HIERARCHY + RC_EvictControl_objectHandle; - - // Owner cannot use a handle outside of owner persistent range. - if(evictObject->attributes.evict == CLEAR - && !NvIsOwnerPersistentHandle(in->persistentHandle)) - return TPM_RCS_RANGE + RC_EvictControl_persistentHandle; - } - else - { - // Other authorization is not allowed in this command and should have been - // filtered out in unmarshal process - FAIL(FATAL_ERROR_INTERNAL); - } -// Internal Data Update - // Change evict state - if(evictObject->attributes.evict == CLEAR) - { - // Make object persistent - if(NvFindHandle(in->persistentHandle) != 0) - return TPM_RC_NV_DEFINED; - // A TPM_RC_NV_HANDLE or TPM_RC_NV_SPACE error may be returned at this - // point - result = NvAddEvictObject(in->persistentHandle, evictObject); - } - else - { - // Delete the persistent object in NV - result = NvDeleteEvict(evictObject->evictHandle); - } - return result; -} - -#endif // CC_EvictControl \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/FlushContext.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/FlushContext.c deleted file mode 100644 index 87982850b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Context/FlushContext.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "FlushContext_fp.h" - -#if CC_FlushContext // Conditional expansion of this file - -/*(See part 3 specification) -// Flush a specific object or session -*/ -// Return Type: TPM_RC -// TPM_RC_HANDLE 'flushHandle' does not reference a loaded object or session -TPM_RC -TPM2_FlushContext( - FlushContext_In *in // IN: input parameter list - ) -{ -// Internal Data Update - - // Call object or session specific routine to flush - switch(HandleGetType(in->flushHandle)) - { - case TPM_HT_TRANSIENT: - if(!IsObjectPresent(in->flushHandle)) - return TPM_RCS_HANDLE + RC_FlushContext_flushHandle; - // Flush object - FlushObject(in->flushHandle); - break; - case TPM_HT_HMAC_SESSION: - case TPM_HT_POLICY_SESSION: - if(!SessionIsLoaded(in->flushHandle) - && !SessionIsSaved(in->flushHandle) - ) - return TPM_RCS_HANDLE + RC_FlushContext_flushHandle; - - // If the session to be flushed is the exclusive audit session, then - // indicate that there is no exclusive audit session any longer. - if(in->flushHandle == g_exclusiveAuditSession) - g_exclusiveAuditSession = TPM_RH_UNASSIGNED; - - // Flush session - SessionFlush(in->flushHandle); - break; - default: - // This command only takes object or session handle. Other handles - // should be filtered out at handle unmarshal - FAIL(FATAL_ERROR_INTERNAL); - break; - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_FlushContext \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/DA/DictionaryAttackLockReset.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/DA/DictionaryAttackLockReset.c deleted file mode 100644 index 78ceafc27..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/DA/DictionaryAttackLockReset.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "DictionaryAttackLockReset_fp.h" - -#if CC_DictionaryAttackLockReset // Conditional expansion of this file - -/*(See part 3 specification) -// This command cancels the effect of a TPM lockout due to a number of -// successive authorization failures. If this command is properly authorized, -// the lockout counter is set to 0. -*/ -TPM_RC -TPM2_DictionaryAttackLockReset( - DictionaryAttackLockReset_In *in // IN: input parameter list - ) -{ - // Input parameter is not reference in command action - NOT_REFERENCED(in); - - // The command needs NV update. - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Internal Data Update - - // Set failed tries to 0 - gp.failedTries = 0; - - // Record the changes to NV - NV_SYNC_PERSISTENT(failedTries); - - return TPM_RC_SUCCESS; -} - -#endif // CC_DictionaryAttackLockReset \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/DA/DictionaryAttackParameters.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/DA/DictionaryAttackParameters.c deleted file mode 100644 index e5f98da37..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/DA/DictionaryAttackParameters.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "DictionaryAttackParameters_fp.h" - -#if CC_DictionaryAttackParameters // Conditional expansion of this file - -/*(See part 3 specification) -// change the lockout parameters -*/ -TPM_RC -TPM2_DictionaryAttackParameters( - DictionaryAttackParameters_In *in // IN: input parameter list - ) -{ - // The command needs NV update. - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Internal Data Update - - // Set dictionary attack parameters - gp.maxTries = in->newMaxTries; - gp.recoveryTime = in->newRecoveryTime; - gp.lockoutRecovery = in->lockoutRecovery; - -#if 0 // Errata eliminates this code - // This functionality has been disabled. The preferred implementation is now - // to leave failedTries unchanged when the parameters are changed. This could - // have the effect of putting the TPM into DA lockout if in->newMaxTries is - // not greater than the current value of gp.failedTries. - // Set failed tries to 0 - gp.failedTries = 0; -#endif - - // Record the changes to NV - NV_SYNC_PERSISTENT(failedTries); - NV_SYNC_PERSISTENT(maxTries); - NV_SYNC_PERSISTENT(recoveryTime); - NV_SYNC_PERSISTENT(lockoutRecovery); - - return TPM_RC_SUCCESS; -} - -#endif // CC_DictionaryAttackParameters \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Duplicate.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Duplicate.c deleted file mode 100644 index 9e9164f5d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Duplicate.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Duplicate_fp.h" - -#if CC_Duplicate // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// Duplicate a loaded object -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES key to duplicate has 'fixedParent' SET -// TPM_RC_HASH for an RSA key, the nameAlg digest size for the -// newParent is not compatible with the key size -// TPM_RC_HIERARCHY 'encryptedDuplication' is SET and 'newParentHandle' -// specifies Null Hierarchy -// TPM_RC_KEY 'newParentHandle' references invalid ECC key (public -// point not on the curve) -// TPM_RC_SIZE input encryption key size does not match the -// size specified in symmetric algorithm -// TPM_RC_SYMMETRIC 'encryptedDuplication' is SET but no symmetric -// algorithm is provided -// TPM_RC_TYPE 'newParentHandle' is neither a storage key nor -// TPM_RH_NULL; or the object has a NULL nameAlg -// TPM_RC_VALUE for an RSA newParent, the sizes of the digest and -// the encryption key are too large to be OAEP encoded -TPM_RC -TPM2_Duplicate( - Duplicate_In *in, // IN: input parameter list - Duplicate_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - TPMT_SENSITIVE sensitive; - - UINT16 innerKeySize = 0; // encrypt key size for inner wrap - - OBJECT *object; - OBJECT *newParent; - TPM2B_DATA data; - -// Input Validation - - // Get duplicate object pointer - object = HandleToObject(in->objectHandle); - // Get new parent - newParent = HandleToObject(in->newParentHandle); - - // duplicate key must have fixParent bit CLEAR. - if(IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, fixedParent)) - return TPM_RCS_ATTRIBUTES + RC_Duplicate_objectHandle; - - // Do not duplicate object with NULL nameAlg - if(object->publicArea.nameAlg == TPM_ALG_NULL) - return TPM_RCS_TYPE + RC_Duplicate_objectHandle; - - // new parent key must be a storage object or TPM_RH_NULL - if(in->newParentHandle != TPM_RH_NULL - && !ObjectIsStorage(in->newParentHandle)) - return TPM_RCS_TYPE + RC_Duplicate_newParentHandle; - - // If the duplicated object has encryptedDuplication SET, then there must be - // an inner wrapper and the new parent may not be TPM_RH_NULL - if(IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, - encryptedDuplication)) - { - if(in->symmetricAlg.algorithm == TPM_ALG_NULL) - return TPM_RCS_SYMMETRIC + RC_Duplicate_symmetricAlg; - if(in->newParentHandle == TPM_RH_NULL) - return TPM_RCS_HIERARCHY + RC_Duplicate_newParentHandle; - } - - if(in->symmetricAlg.algorithm == TPM_ALG_NULL) - { - // if algorithm is TPM_ALG_NULL, input key size must be 0 - if(in->encryptionKeyIn.t.size != 0) - return TPM_RCS_SIZE + RC_Duplicate_encryptionKeyIn; - } - else - { - // Get inner wrap key size - innerKeySize = in->symmetricAlg.keyBits.sym; - - // If provided the input symmetric key must match the size of the algorithm - if(in->encryptionKeyIn.t.size != 0 - && in->encryptionKeyIn.t.size != (innerKeySize + 7) / 8) - return TPM_RCS_SIZE + RC_Duplicate_encryptionKeyIn; - } - -// Command Output - - if(in->newParentHandle != TPM_RH_NULL) - { - // Make encrypt key and its associated secret structure. A TPM_RC_KEY - // error may be returned at this point - out->outSymSeed.t.size = sizeof(out->outSymSeed.t.secret); - result = CryptSecretEncrypt(newParent, DUPLICATE_STRING, &data, - &out->outSymSeed); - if(result != TPM_RC_SUCCESS) - return result; - } - else - { - // Do not apply outer wrapper - data.t.size = 0; - out->outSymSeed.t.size = 0; - } - - // Copy sensitive area - sensitive = object->sensitive; - - // Prepare output private data from sensitive. - // Note: If there is no encryption key, one will be provided by - // SensitiveToDuplicate(). This is why the assignment of encryptionKeyIn to - // encryptionKeyOut will work properly and is not conditional. - SensitiveToDuplicate(&sensitive, &object->name.b, newParent, - object->publicArea.nameAlg, &data.b, - &in->symmetricAlg, &in->encryptionKeyIn, - &out->duplicate); - - out->encryptionKeyOut = in->encryptionKeyIn; - - return TPM_RC_SUCCESS; -} - -#endif // CC_Duplicate \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Import.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Import.c deleted file mode 100644 index 2ed53ccb6..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Import.c +++ /dev/null @@ -1,209 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Import_fp.h" - -#if CC_Import // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// This command allows an asymmetrically encrypted blob, containing a duplicated -// object to be re-encrypted using the group symmetric key associated with the -// parent. -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'FixedTPM' and 'fixedParent' of 'objectPublic' are not -// both CLEAR; or 'inSymSeed' is nonempty and -// 'parentHandle' does not reference a decryption key; or -// 'objectPublic' and 'parentHandle' have incompatible -// or inconsistent attributes; or -// encrytpedDuplication is SET in 'objectPublic' but the -// inner or outer wrapper is missing. -// Note that if the TPM provides parameter values, the -// parameter number will indicate 'symmetricKey' (missing -// inner wrapper) or 'inSymSeed' (missing outer wrapper) -// TPM_RC_BINDING 'duplicate' and 'objectPublic' are not -// cryptographically bound -// TPM_RC_ECC_POINT 'inSymSeed' is nonempty and ECC point in 'inSymSeed' -// is not on the curve -// TPM_RC_HASH 'objectPublic' does not have a valid nameAlg -// TPM_RC_INSUFFICIENT 'inSymSeed' is nonempty and failed to retrieve ECC -// point from the secret; or unmarshaling sensitive value -// from 'duplicate' failed the result of 'inSymSeed' -// decryption -// TPM_RC_INTEGRITY 'duplicate' integrity is broken -// TPM_RC_KDF 'objectPublic' representing decrypting keyed hash -// object specifies invalid KDF -// TPM_RC_KEY inconsistent parameters of 'objectPublic'; or -// 'inSymSeed' is nonempty and 'parentHandle' does not -// reference a key of supported type; or -// invalid key size in 'objectPublic' representing an -// asymmetric key -// TPM_RC_NO_RESULT 'inSymSeed' is nonempty and multiplication resulted in -// ECC point at infinity -// TPM_RC_OBJECT_MEMORY no available object slot -// TPM_RC_SCHEME inconsistent attributes 'decrypt', 'sign', -// 'restricted' and key's scheme ID in 'objectPublic'; -// or hash algorithm is inconsistent with the scheme ID -// for keyed hash object -// TPM_RC_SIZE 'authPolicy' size does not match digest size of the -// name algorithm in 'objectPublic'; or -// 'symmetricAlg' and 'encryptionKey' have different -// sizes; or -// 'inSymSeed' is nonempty and it size is not -// consistent with the type of 'parentHandle'; or -// unmarshaling sensitive value from 'duplicate' failed -// TPM_RC_SYMMETRIC 'objectPublic' is either a storage key with no -// symmetric algorithm or a non-storage key with -// symmetric algorithm different from TPM_ALG_NULL -// TPM_RC_TYPE unsupported type of 'objectPublic'; or -// 'parentHandle' is not a storage key; or -// only the public portion of 'parentHandle' is loaded; -// or 'objectPublic' and 'duplicate' are of different -// types -// TPM_RC_VALUE nonempty 'inSymSeed' and its numeric value is -// greater than the modulus of the key referenced by -// 'parentHandle' or 'inSymSeed' is larger than the -// size of the digest produced by the name algorithm of -// the symmetric key referenced by 'parentHandle' -TPM_RC -TPM2_Import( - Import_In *in, // IN: input parameter list - Import_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - OBJECT *parentObject; - TPM2B_DATA data; // symmetric key - TPMT_SENSITIVE sensitive; - TPM2B_NAME name; - TPMA_OBJECT attributes; - UINT16 innerKeySize = 0; // encrypt key size for inner - // wrapper - -// Input Validation - // to save typing - attributes = in->objectPublic.publicArea.objectAttributes; - // FixedTPM and fixedParent must be CLEAR - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedTPM) - || IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedParent)) - return TPM_RCS_ATTRIBUTES + RC_Import_objectPublic; - - // Get parent pointer - parentObject = HandleToObject(in->parentHandle); - - if(!ObjectIsParent(parentObject)) - return TPM_RCS_TYPE + RC_Import_parentHandle; - - if(in->symmetricAlg.algorithm != TPM_ALG_NULL) - { - // Get inner wrap key size - innerKeySize = in->symmetricAlg.keyBits.sym; - // Input symmetric key must match the size of algorithm. - if(in->encryptionKey.t.size != (innerKeySize + 7) / 8) - return TPM_RCS_SIZE + RC_Import_encryptionKey; - } - else - { - // If input symmetric algorithm is NULL, input symmetric key size must - // be 0 as well - if(in->encryptionKey.t.size != 0) - return TPM_RCS_SIZE + RC_Import_encryptionKey; - // If encryptedDuplication is SET, then the object must have an inner - // wrapper - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, encryptedDuplication)) - return TPM_RCS_ATTRIBUTES + RC_Import_encryptionKey; - } - // See if there is an outer wrapper - if(in->inSymSeed.t.size != 0) - { - // in->inParentHandle is a parent, but in order to decrypt an outer wrapper, - // it must be able to do key exchange and a symmetric key can't do that. - if(parentObject->publicArea.type == TPM_ALG_SYMCIPHER) - return TPM_RCS_TYPE + RC_Import_parentHandle; - - // Decrypt input secret data via asymmetric decryption. TPM_RC_ATTRIBUTES, - // TPM_RC_ECC_POINT, TPM_RC_INSUFFICIENT, TPM_RC_KEY, TPM_RC_NO_RESULT, - // TPM_RC_SIZE, TPM_RC_VALUE may be returned at this point - result = CryptSecretDecrypt(parentObject, NULL, DUPLICATE_STRING, - &in->inSymSeed, &data); - pAssert(result != TPM_RC_BINDING); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_Import_inSymSeed); - } - else - { - // If encrytpedDuplication is set, then the object must have an outer - // wrapper - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, encryptedDuplication)) - return TPM_RCS_ATTRIBUTES + RC_Import_inSymSeed; - data.t.size = 0; - } - // Compute name of object - PublicMarshalAndComputeName(&(in->objectPublic.publicArea), &name); - if(name.t.size == 0) - return TPM_RCS_HASH + RC_Import_objectPublic; - - // Retrieve sensitive from private. - // TPM_RC_INSUFFICIENT, TPM_RC_INTEGRITY, TPM_RC_SIZE may be returned here. - result = DuplicateToSensitive(&in->duplicate.b, &name.b, parentObject, - in->objectPublic.publicArea.nameAlg, - &data.b, &in->symmetricAlg, - &in->encryptionKey.b, &sensitive); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_Import_duplicate); - - // If the parent of this object has fixedTPM SET, then validate this - // object as if it were being loaded so that validation can be skipped - // when it is actually loaded. - if(IS_ATTRIBUTE(parentObject->publicArea.objectAttributes, TPMA_OBJECT, fixedTPM)) - { - result = ObjectLoad(NULL, NULL, &in->objectPublic.publicArea, - &sensitive, RC_Import_objectPublic, RC_Import_duplicate, - NULL); - } -// Command output - if(result == TPM_RC_SUCCESS) - { - // Prepare output private data from sensitive - SensitiveToPrivate(&sensitive, &name, parentObject, - in->objectPublic.publicArea.nameAlg, - &out->outPrivate); - } - return result; -} - -#endif // CC_Import \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Rewrap.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Rewrap.c deleted file mode 100644 index ed29e4e1d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Duplication/Rewrap.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Rewrap_fp.h" - -#if CC_Rewrap // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// This command allows the TPM to serve in the role as an MA. -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'newParent' is not a decryption key -// TPM_RC_HANDLE 'oldParent' does not consistent with inSymSeed -// TPM_RC_INTEGRITY the integrity check of 'inDuplicate' failed -// TPM_RC_KEY for an ECC key, the public key is not on the curve -// of the curve ID -// TPM_RC_KEY_SIZE the decrypted input symmetric key size -// does not matches the symmetric algorithm -// key size of 'oldParent' -// TPM_RC_TYPE 'oldParent' is not a storage key, or 'newParent -// is not a storage key -// TPM_RC_VALUE for an 'oldParent; RSA key, the data to be decrypted -// is greater than the public exponent -// Unmarshal errors errors during unmarshaling the input -// encrypted buffer to a ECC public key, or -// unmarshal the private buffer to sensitive -TPM_RC -TPM2_Rewrap( - Rewrap_In *in, // IN: input parameter list - Rewrap_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - TPM2B_DATA data; // symmetric key - UINT16 hashSize = 0; - TPM2B_PRIVATE privateBlob; // A temporary private blob - // to transit between old - // and new wrappers -// Input Validation - if((in->inSymSeed.t.size == 0 && in->oldParent != TPM_RH_NULL) - || (in->inSymSeed.t.size != 0 && in->oldParent == TPM_RH_NULL)) - return TPM_RCS_HANDLE + RC_Rewrap_oldParent; - if(in->oldParent != TPM_RH_NULL) - { - OBJECT *oldParent = HandleToObject(in->oldParent); - - // old parent key must be a storage object - if(!ObjectIsStorage(in->oldParent)) - return TPM_RCS_TYPE + RC_Rewrap_oldParent; - // Decrypt input secret data via asymmetric decryption. A - // TPM_RC_VALUE, TPM_RC_KEY or unmarshal errors may be returned at this - // point - result = CryptSecretDecrypt(oldParent, NULL, DUPLICATE_STRING, - &in->inSymSeed, &data); - if(result != TPM_RC_SUCCESS) - return TPM_RCS_VALUE + RC_Rewrap_inSymSeed; - // Unwrap Outer - result = UnwrapOuter(oldParent, &in->name.b, - oldParent->publicArea.nameAlg, &data.b, - FALSE, - in->inDuplicate.t.size, in->inDuplicate.t.buffer); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_Rewrap_inDuplicate); - // Copy unwrapped data to temporary variable, remove the integrity field - hashSize = sizeof(UINT16) + - CryptHashGetDigestSize(oldParent->publicArea.nameAlg); - privateBlob.t.size = in->inDuplicate.t.size - hashSize; - pAssert(privateBlob.t.size <= sizeof(privateBlob.t.buffer)); - MemoryCopy(privateBlob.t.buffer, in->inDuplicate.t.buffer + hashSize, - privateBlob.t.size); - } - else - { - // No outer wrap from input blob. Direct copy. - privateBlob = in->inDuplicate; - } - if(in->newParent != TPM_RH_NULL) - { - OBJECT *newParent; - newParent = HandleToObject(in->newParent); - - // New parent must be a storage object - if(!ObjectIsStorage(in->newParent)) - return TPM_RCS_TYPE + RC_Rewrap_newParent; - // Make new encrypt key and its associated secret structure. A - // TPM_RC_VALUE error may be returned at this point if RSA algorithm is - // enabled in TPM - out->outSymSeed.t.size = sizeof(out->outSymSeed.t.secret); - result = CryptSecretEncrypt(newParent, DUPLICATE_STRING, &data, - &out->outSymSeed); - if(result != TPM_RC_SUCCESS) - return result; - // Copy temporary variable to output, reserve the space for integrity - hashSize = sizeof(UINT16) + - CryptHashGetDigestSize(newParent->publicArea.nameAlg); - // Make sure that everything fits into the output buffer - // Note: this is mostly only an issue if there was no outer wrapper on - // 'inDuplicate'. It could be as large as a TPM2B_PRIVATE buffer. If we add - // a digest for an outer wrapper, it won't fit anymore. - if((privateBlob.t.size + hashSize) > sizeof(out->outDuplicate.t.buffer)) - return TPM_RCS_VALUE + RC_Rewrap_inDuplicate; -// Command output - out->outDuplicate.t.size = privateBlob.t.size; - pAssert(privateBlob.t.size - <= sizeof(out->outDuplicate.t.buffer) - hashSize); - MemoryCopy(out->outDuplicate.t.buffer + hashSize, privateBlob.t.buffer, - privateBlob.t.size); - // Produce outer wrapper for output - out->outDuplicate.t.size = ProduceOuterWrap(newParent, &in->name.b, - newParent->publicArea.nameAlg, - &data.b, - FALSE, - out->outDuplicate.t.size, - out->outDuplicate.t.buffer); - } - else // New parent is a null key so there is no seed - { - out->outSymSeed.t.size = 0; - - // Copy privateBlob directly - out->outDuplicate = privateBlob; - } - return TPM_RC_SUCCESS; -} - -#endif // CC_Rewrap \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthValue.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthValue.c deleted file mode 100644 index 8f395d842..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthValue.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyAuthValue_fp.h" - -#if CC_PolicyAuthValue // Conditional expansion of this file - -#include "Policy_spt_fp.h" - -/*(See part 3 specification) -// allows a policy to be bound to the authorization value of the authorized -// object -*/ -TPM_RC -TPM2_PolicyAuthValue( - PolicyAuthValue_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM_CC commandCode = TPM_CC_PolicyAuthValue; - HASH_STATE hashState; - -// Internal Data Update - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyAuthValue) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // complete the hash and get the results - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // update isAuthValueNeeded bit in the session context - session->attributes.isAuthValueNeeded = SET; - session->attributes.isPasswordNeeded = CLEAR; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyAuthValue \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthorize.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthorize.c deleted file mode 100644 index a3b35aba6..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthorize.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyAuthorize_fp.h" - -#if CC_PolicyAuthorize // Conditional expansion of this file - -#include "Policy_spt_fp.h" - -/*(See part 3 specification) -// Change policy by a signature from authority -*/ -// Return Type: TPM_RC -// TPM_RC_HASH hash algorithm in 'keyName' is not supported -// TPM_RC_SIZE 'keyName' is not the correct size for its hash algorithm -// TPM_RC_VALUE the current policyDigest of 'policySession' does not -// match 'approvedPolicy'; or 'checkTicket' doesn't match -// the provided values -TPM_RC -TPM2_PolicyAuthorize( - PolicyAuthorize_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM2B_DIGEST authHash; - HASH_STATE hashState; - TPMT_TK_VERIFIED ticket; - TPM_ALG_ID hashAlg; - UINT16 digestSize; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // Extract from the Name of the key, the algorithm used to compute it's Name - hashAlg = BYTE_ARRAY_TO_UINT16(in->keySign.t.name); - - // 'keySign' parameter needs to use a supported hash algorithm, otherwise - // can't tell how large the digest should be - if(!CryptHashIsValidAlg(hashAlg, FALSE)) - return TPM_RCS_HASH + RC_PolicyAuthorize_keySign; - - digestSize = CryptHashGetDigestSize(hashAlg); - if(digestSize != (in->keySign.t.size - 2)) - return TPM_RCS_SIZE + RC_PolicyAuthorize_keySign; - - //If this is a trial policy, skip all validations - if(session->attributes.isTrialPolicy == CLEAR) - { - // Check that "approvedPolicy" matches the current value of the - // policyDigest in policy session - if(!MemoryEqual2B(&session->u2.policyDigest.b, - &in->approvedPolicy.b)) - return TPM_RCS_VALUE + RC_PolicyAuthorize_approvedPolicy; - - // Validate ticket TPMT_TK_VERIFIED - // Compute aHash. The authorizing object sign a digest - // aHash := hash(approvedPolicy || policyRef). - // Start hash - authHash.t.size = CryptHashStart(&hashState, hashAlg); - - // add approvedPolicy - CryptDigestUpdate2B(&hashState, &in->approvedPolicy.b); - - // add policyRef - CryptDigestUpdate2B(&hashState, &in->policyRef.b); - - // complete hash - CryptHashEnd2B(&hashState, &authHash.b); - - // re-compute TPMT_TK_VERIFIED - TicketComputeVerified(in->checkTicket.hierarchy, &authHash, - &in->keySign, &ticket); - - // Compare ticket digest. If not match, return error - if(!MemoryEqual2B(&in->checkTicket.digest.b, &ticket.digest.b)) - return TPM_RCS_VALUE + RC_PolicyAuthorize_checkTicket; - } - -// Internal Data Update - - // Set policyDigest to zero digest - PolicyDigestClear(session); - - // Update policyDigest - PolicyContextUpdate(TPM_CC_PolicyAuthorize, &in->keySign, &in->policyRef, - NULL, 0, session); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyAuthorize \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthorizeNV.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthorizeNV.c deleted file mode 100644 index 019548a40..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyAuthorizeNV.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" - -#if CC_PolicyAuthorizeNV // Conditional expansion of this file -#include "PolicyAuthorizeNV_fp.h" -#include "Policy_spt_fp.h" - -/*(See part 3 specification) -// Change policy by a signature from authority -*/ -// Return Type: TPM_RC -// TPM_RC_HASH hash algorithm in 'keyName' is not supported or is not -// the same as the hash algorithm of the policy session -// TPM_RC_SIZE 'keyName' is not the correct size for its hash algorithm -// TPM_RC_VALUE the current policyDigest of 'policySession' does not -// match 'approvedPolicy'; or 'checkTicket' doesn't match -// the provided values -TPM_RC -TPM2_PolicyAuthorizeNV( - PolicyAuthorizeNV_In *in - ) -{ - SESSION *session; - TPM_RC result; - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - TPM2B_NAME name; - TPMT_HA policyInNv; - BYTE nvTemp[sizeof(TPMT_HA)]; - BYTE *buffer = nvTemp; - INT32 size; - -// Input Validation - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // Skip checks if this is a trial policy - if(!session->attributes.isTrialPolicy) - { - // Check the authorizations for reading - // Common read access checks. NvReadAccessChecks() returns - // TPM_RC_NV_AUTHORIZATION, TPM_RC_NV_LOCKED, or TPM_RC_NV_UNINITIALIZED - // error may be returned at this point - result = NvReadAccessChecks(in->authHandle, in->nvIndex, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - - // Read the contents of the index into a temp buffer - size = MIN(nvIndex->publicArea.dataSize, sizeof(TPMT_HA)); - NvGetIndexData(nvIndex, locator, 0, (UINT16)size, nvTemp); - - // Unmarshal the contents of the buffer into the internal format of a - // TPMT_HA so that the hash and digest elements can be accessed from the - // structure rather than the byte array that is in the Index (written by - // user of the Index). - result = TPMT_HA_Unmarshal(&policyInNv, &buffer, &size, FALSE); - if(result != TPM_RC_SUCCESS) - return result; - - // Verify that the hash is the same - if(policyInNv.hashAlg != session->authHashAlg) - return TPM_RC_HASH; - - // See if the contents of the digest in the Index matches the value - // in the policy - if(!MemoryEqual(&policyInNv.digest, &session->u2.policyDigest.t.buffer, - session->u2.policyDigest.t.size)) - return TPM_RC_VALUE; - } - -// Internal Data Update - - // Set policyDigest to zero digest - PolicyDigestClear(session); - - // Update policyDigest - PolicyContextUpdate(TPM_CC_PolicyAuthorizeNV, EntityGetName(in->nvIndex, &name), - NULL, NULL, 0, session); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyAuthorize \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCommandCode.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCommandCode.c deleted file mode 100644 index dcd7f54dd..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCommandCode.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyCommandCode_fp.h" - -#if CC_PolicyCommandCode // Conditional expansion of this file - -/*(See part 3 specification) -// Add a Command Code restriction to the policyDigest -*/ -// Return Type: TPM_RC -// TPM_RC_VALUE 'commandCode' of 'policySession' previously set to -// a different value - -TPM_RC -TPM2_PolicyCommandCode( - PolicyCommandCode_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM_CC commandCode = TPM_CC_PolicyCommandCode; - HASH_STATE hashState; - -// Input validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - if(session->commandCode != 0 && session->commandCode != in->code) - return TPM_RCS_VALUE + RC_PolicyCommandCode_code; - if(CommandCodeToCommandIndex(in->code) == UNIMPLEMENTED_COMMAND_INDEX) - return TPM_RCS_POLICY_CC + RC_PolicyCommandCode_code; - -// Internal Data Update - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyCommandCode || code) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add input commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), in->code); - - // complete the hash and get the results - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // update commandCode value in session context - session->commandCode = in->code; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyCommandCode \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCounterTimer.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCounterTimer.c deleted file mode 100644 index 1c447071f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCounterTimer.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyCounterTimer_fp.h" - -#if CC_PolicyCounterTimer // Conditional expansion of this file - -#include "Policy_spt_fp.h" - -/*(See part 3 specification) -// Add a conditional gating of a policy based on the contents of the -// TPMS_TIME_INFO structure. -*/ -// Return Type: TPM_RC -// TPM_RC_POLICY the comparison of the selected portion of the -// TPMS_TIME_INFO with 'operandB' failed -// TPM_RC_RANGE 'offset' + 'size' exceed size of TPMS_TIME_INFO -// structure -TPM_RC -TPM2_PolicyCounterTimer( - PolicyCounterTimer_In *in // IN: input parameter list - ) -{ - SESSION *session; - TIME_INFO infoData; // data buffer of TPMS_TIME_INFO - BYTE *pInfoData = (BYTE *)&infoData; - UINT16 infoDataSize; - TPM_CC commandCode = TPM_CC_PolicyCounterTimer; - HASH_STATE hashState; - TPM2B_DIGEST argHash; - -// Input Validation - // Get a marshaled time structure - infoDataSize = TimeGetMarshaled(&infoData); - // Make sure that the referenced stays within the bounds of the structure. - // NOTE: the offset checks are made even for a trial policy because the policy - // will not make any sense if the references are out of bounds of the timer - // structure. - if(in->offset > infoDataSize) - return TPM_RCS_VALUE + RC_PolicyCounterTimer_offset; - if((UINT32)in->offset + (UINT32)in->operandB.t.size > infoDataSize) - return TPM_RCS_RANGE; - // Get pointer to the session structure - session = SessionGet(in->policySession); - - //If this is a trial policy, skip the check to see if the condition is met. - if(session->attributes.isTrialPolicy == CLEAR) - { - // If the command is going to use any part of the counter or timer, need - // to verify that time is advancing. - // The time and clock vales are the first two 64-bit values in the clock - if(in->offset < sizeof(UINT64) + sizeof(UINT64)) - { - // Using Clock or Time so see if clock is running. Clock doesn't - // run while NV is unavailable. - // TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned here. - RETURN_IF_NV_IS_NOT_AVAILABLE; - } - // offset to the starting position - pInfoData = (BYTE *)infoData; - // Check to see if the condition is valid - if(!PolicySptCheckCondition(in->operation, pInfoData + in->offset, - in->operandB.t.buffer, in->operandB.t.size)) - return TPM_RC_POLICY; - } -// Internal Data Update - // Start argument list hash - argHash.t.size = CryptHashStart(&hashState, session->authHashAlg); - // add operandB - CryptDigestUpdate2B(&hashState, &in->operandB.b); - // add offset - CryptDigestUpdateInt(&hashState, sizeof(UINT16), in->offset); - // add operation - CryptDigestUpdateInt(&hashState, sizeof(TPM_EO), in->operation); - // complete argument hash - CryptHashEnd2B(&hashState, &argHash.b); - - // update policyDigest - // start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add argument digest - CryptDigestUpdate2B(&hashState, &argHash.b); - - // complete the digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyCounterTimer \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCpHash.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCpHash.c deleted file mode 100644 index cdcfcb7ee..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyCpHash.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyCpHash_fp.h" - -#if CC_PolicyCpHash // Conditional expansion of this file - -/*(See part 3 specification) -// Add a cpHash restriction to the policyDigest -*/ -// Return Type: TPM_RC -// TPM_RC_CPHASH cpHash of 'policySession' has previously been set -// to a different value -// TPM_RC_SIZE 'cpHashA' is not the size of a digest produced -// by the hash algorithm associated with -// 'policySession' -TPM_RC -TPM2_PolicyCpHash( - PolicyCpHash_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM_CC commandCode = TPM_CC_PolicyCpHash; - HASH_STATE hashState; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // A valid cpHash must have the same size as session hash digest - // NOTE: the size of the digest can't be zero because TPM_ALG_NULL - // can't be used for the authHashAlg. - if(in->cpHashA.t.size != CryptHashGetDigestSize(session->authHashAlg)) - return TPM_RCS_SIZE + RC_PolicyCpHash_cpHashA; - - // error if the cpHash in session context is not empty and is not the same - // as the input or is not a cpHash - if((session->u1.cpHash.t.size != 0) - && (!session->attributes.isCpHashDefined - || !MemoryEqual2B(&in->cpHashA.b, &session->u1.cpHash.b))) - return TPM_RC_CPHASH; - - -// Internal Data Update - - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyCpHash || cpHashA) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add cpHashA - CryptDigestUpdate2B(&hashState, &in->cpHashA.b); - - // complete the digest and get the results - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // update cpHash in session context - session->u1.cpHash = in->cpHashA; - session->attributes.isCpHashDefined = SET; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyCpHash \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyDuplicationSelect.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyDuplicationSelect.c deleted file mode 100644 index 6eec4a773..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyDuplicationSelect.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyDuplicationSelect_fp.h" - -#if CC_PolicyDuplicationSelect // Conditional expansion of this file - -/*(See part 3 specification) -// allows qualification of duplication so that it a specific new parent may be -// selected or a new parent selected for a specific object. -*/ -// Return Type: TPM_RC -// TPM_RC_COMMAND_CODE 'commandCode' of 'policySession; is not empty -// TPM_RC_CPHASH 'cpHash' of 'policySession' is not empty -TPM_RC -TPM2_PolicyDuplicationSelect( - PolicyDuplicationSelect_In *in // IN: input parameter list - ) -{ - SESSION *session; - HASH_STATE hashState; - TPM_CC commandCode = TPM_CC_PolicyDuplicationSelect; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // cpHash in session context must be empty - if(session->u1.cpHash.t.size != 0) - return TPM_RC_CPHASH; - - // commandCode in session context must be empty - if(session->commandCode != 0) - return TPM_RC_COMMAND_CODE; - -// Internal Data Update - - // Update name hash - session->u1.cpHash.t.size = CryptHashStart(&hashState, session->authHashAlg); - - // add objectName - CryptDigestUpdate2B(&hashState, &in->objectName.b); - - // add new parent name - CryptDigestUpdate2B(&hashState, &in->newParentName.b); - - // complete hash - CryptHashEnd2B(&hashState, &session->u1.cpHash.b); - - // update policy hash - // Old policyDigest size should be the same as the new policyDigest size since - // they are using the same hash algorithm - session->u2.policyDigest.t.size - = CryptHashStart(&hashState, session->authHashAlg); -// add old policy - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add command code - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add objectName - if(in->includeObject == YES) - CryptDigestUpdate2B(&hashState, &in->objectName.b); - - // add new parent name - CryptDigestUpdate2B(&hashState, &in->newParentName.b); - - // add includeObject - CryptDigestUpdateInt(&hashState, sizeof(TPMI_YES_NO), in->includeObject); - - // complete digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // set commandCode in session context - session->commandCode = TPM_CC_Duplicate; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyDuplicationSelect \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyGetDigest.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyGetDigest.c deleted file mode 100644 index decadfc03..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyGetDigest.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyGetDigest_fp.h" - -#if CC_PolicyGetDigest // Conditional expansion of this file - -/*(See part 3 specification) -// returns the current policyDigest of the session -*/ -TPM_RC -TPM2_PolicyGetDigest( - PolicyGetDigest_In *in, // IN: input parameter list - PolicyGetDigest_Out *out // OUT: output parameter list - ) -{ - SESSION *session; - -// Command Output - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - out->policyDigest = session->u2.policyDigest; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyGetDigest \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyLocality.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyLocality.c deleted file mode 100644 index cff6c77a8..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyLocality.c +++ /dev/null @@ -1,138 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyLocality_fp.h" - - -#if CC_PolicyLocality // Conditional expansion of this file - -// Return Type: TPM_RC -// TPM_RC_RANGE all the locality values selected by -// 'locality' have been disabled -// by previous TPM2_PolicyLocality() calls. -TPM_RC -TPM2_PolicyLocality( - PolicyLocality_In *in // IN: input parameter list - ) -{ - SESSION *session; - BYTE marshalBuffer[sizeof(TPMA_LOCALITY)]; - BYTE prevSetting[sizeof(TPMA_LOCALITY)]; - UINT32 marshalSize; - BYTE *buffer; - TPM_CC commandCode = TPM_CC_PolicyLocality; - HASH_STATE hashState; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // Get new locality setting in canonical form - marshalBuffer[0] = 0; // Code analysis says that this is not initialized - buffer = marshalBuffer; - marshalSize = TPMA_LOCALITY_Marshal(&in->locality, &buffer, NULL); - - // Its an error if the locality parameter is zero - if(marshalBuffer[0] == 0) - return TPM_RCS_RANGE + RC_PolicyLocality_locality; - - // Get existing locality setting in canonical form - prevSetting[0] = 0; // Code analysis says that this is not initialized - buffer = prevSetting; - TPMA_LOCALITY_Marshal(&session->commandLocality, &buffer, NULL); - - // If the locality has previously been set - if(prevSetting[0] != 0 - // then the current locality setting and the requested have to be the same - // type (that is, either both normal or both extended - && ((prevSetting[0] < 32) != (marshalBuffer[0] < 32))) - return TPM_RCS_RANGE + RC_PolicyLocality_locality; - - // See if the input is a regular or extended locality - if(marshalBuffer[0] < 32) - { - // if there was no previous setting, start with all normal localities - // enabled - if(prevSetting[0] == 0) - prevSetting[0] = 0x1F; - - // AND the new setting with the previous setting and store it in prevSetting - prevSetting[0] &= marshalBuffer[0]; - - // The result setting can not be 0 - if(prevSetting[0] == 0) - return TPM_RCS_RANGE + RC_PolicyLocality_locality; - } - else - { - // for extended locality - // if the locality has already been set, then it must match the - if(prevSetting[0] != 0 && prevSetting[0] != marshalBuffer[0]) - return TPM_RCS_RANGE + RC_PolicyLocality_locality; - - // Setting is OK - prevSetting[0] = marshalBuffer[0]; - } - -// Internal Data Update - - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyLocality || locality) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add input locality - CryptDigestUpdate(&hashState, marshalSize, marshalBuffer); - - // complete the digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // update session locality by unmarshal function. The function must succeed - // because both input and existing locality setting have been validated. - buffer = prevSetting; - TPMA_LOCALITY_Unmarshal(&session->commandLocality, &buffer, - (INT32 *)&marshalSize); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyLocality \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNV.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNV.c deleted file mode 100644 index 65e7a91f0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNV.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyNV_fp.h" - -#if CC_PolicyNV // Conditional expansion of this file - -#include "Policy_spt_fp.h" - -/*(See part 3 specification) -// Do comparison to NV location -*/ -// Return Type: TPM_RC -// TPM_RC_AUTH_TYPE NV index authorization type is not correct -// TPM_RC_NV_LOCKED NV index read locked -// TPM_RC_NV_UNINITIALIZED the NV index has not been initialized -// TPM_RC_POLICY the comparison to the NV contents failed -// TPM_RC_SIZE the size of 'nvIndex' data starting at 'offset' -// is less than the size of 'operandB' -// TPM_RC_VALUE 'offset' is too large -TPM_RC -TPM2_PolicyNV( - PolicyNV_In *in // IN: input parameter list - ) -{ - TPM_RC result; - SESSION *session; - NV_REF locator; - NV_INDEX *nvIndex; - BYTE nvBuffer[sizeof(in->operandB.t.buffer)]; - TPM2B_NAME nvName; - TPM_CC commandCode = TPM_CC_PolicyNV; - HASH_STATE hashState; - TPM2B_DIGEST argHash; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - //If this is a trial policy, skip all validations and the operation - if(session->attributes.isTrialPolicy == CLEAR) - { - // No need to access the actual NV index information for a trial policy. - nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - - // Common read access checks. NvReadAccessChecks() may return - // TPM_RC_NV_AUTHORIZATION, TPM_RC_NV_LOCKED, or TPM_RC_NV_UNINITIALIZED - result = NvReadAccessChecks(in->authHandle, - in->nvIndex, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - - // Make sure that offset is withing range - if(in->offset > nvIndex->publicArea.dataSize) - return TPM_RCS_VALUE + RC_PolicyNV_offset; - - // Valid NV data size should not be smaller than input operandB size - if((nvIndex->publicArea.dataSize - in->offset) < in->operandB.t.size) - return TPM_RCS_SIZE + RC_PolicyNV_operandB; - - - // Get NV data. The size of NV data equals the input operand B size - NvGetIndexData(nvIndex, locator, in->offset, in->operandB.t.size, nvBuffer); - - // Check to see if the condition is valid - if(!PolicySptCheckCondition(in->operation, nvBuffer, - in->operandB.t.buffer, in->operandB.t.size)) - return TPM_RC_POLICY; - } -// Internal Data Update - - // Start argument hash - argHash.t.size = CryptHashStart(&hashState, session->authHashAlg); - - // add operandB - CryptDigestUpdate2B(&hashState, &in->operandB.b); - - // add offset - CryptDigestUpdateInt(&hashState, sizeof(UINT16), in->offset); - - // add operation - CryptDigestUpdateInt(&hashState, sizeof(TPM_EO), in->operation); - - // complete argument digest - CryptHashEnd2B(&hashState, &argHash.b); - - // Update policyDigest - // Start digest - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add argument digest - CryptDigestUpdate2B(&hashState, &argHash.b); - - // Adding nvName - CryptDigestUpdate2B(&hashState, &EntityGetName(in->nvIndex, &nvName)->b); - - // complete the digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyNV \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNameHash.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNameHash.c deleted file mode 100644 index fc9e28e4d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNameHash.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyNameHash_fp.h" - -#if CC_PolicyNameHash // Conditional expansion of this file - -/*(See part 3 specification) -// Add a nameHash restriction to the policyDigest -*/ -// Return Type: TPM_RC -// TPM_RC_CPHASH 'nameHash' has been previously set to a different value -// TPM_RC_SIZE 'nameHash' is not the size of the digest produced by the -// hash algorithm associated with 'policySession' -TPM_RC -TPM2_PolicyNameHash( - PolicyNameHash_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM_CC commandCode = TPM_CC_PolicyNameHash; - HASH_STATE hashState; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // A valid nameHash must have the same size as session hash digest - // Since the authHashAlg for a session cannot be TPM_ALG_NULL, the digest size - // is always non-zero. - if(in->nameHash.t.size != CryptHashGetDigestSize(session->authHashAlg)) - return TPM_RCS_SIZE + RC_PolicyNameHash_nameHash; - - // u1 in the policy session context cannot otherwise be occupied - if(session->u1.cpHash.b.size != 0 - || session->attributes.isBound - || session->attributes.isCpHashDefined - || session->attributes.isTemplateSet) - return TPM_RC_CPHASH; - -// Internal Data Update - - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyNameHash || nameHash) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add nameHash - CryptDigestUpdate2B(&hashState, &in->nameHash.b); - - // complete the digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // update nameHash in session context - session->u1.cpHash = in->nameHash; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyNameHash \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNvWritten.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNvWritten.c deleted file mode 100644 index d71af6c0a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyNvWritten.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyNvWritten_fp.h" - -#if CC_PolicyNvWritten // Conditional expansion of this file - -// Make an NV Index policy dependent on the state of the TPMA_NV_WRITTEN -// attribute of the index. -// Return Type: TPM_RC -// TPM_RC_VALUE a conflicting request for the attribute has -// already been processed -TPM_RC -TPM2_PolicyNvWritten( - PolicyNvWritten_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM_CC commandCode = TPM_CC_PolicyNvWritten; - HASH_STATE hashState; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // If already set is this a duplicate (the same setting)? If it - // is a conflicting setting, it is an error - if(session->attributes.checkNvWritten == SET) - { - if(((session->attributes.nvWrittenState == SET) - != (in->writtenSet == YES))) - return TPM_RCS_VALUE + RC_PolicyNvWritten_writtenSet; - } - -// Internal Data Update - - // Set session attributes so that the NV Index needs to be checked - session->attributes.checkNvWritten = SET; - session->attributes.nvWrittenState = (in->writtenSet == YES); - - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyNvWritten - // || writtenSet) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add the byte of writtenState - CryptDigestUpdateInt(&hashState, sizeof(TPMI_YES_NO), in->writtenSet); - - // complete the digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyNvWritten \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyOR.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyOR.c deleted file mode 100644 index 8d0553628..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyOR.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyOR_fp.h" - -#if CC_PolicyOR // Conditional expansion of this file - -#include "Policy_spt_fp.h" - -/*(See part 3 specification) -// PolicyOR command -*/ -// Return Type: TPM_RC -// TPM_RC_VALUE no digest in 'pHashList' matched the current -// value of policyDigest for 'policySession' -TPM_RC -TPM2_PolicyOR( - PolicyOR_In *in // IN: input parameter list - ) -{ - SESSION *session; - UINT32 i; - -// Input Validation and Update - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // Compare and Update Internal Session policy if match - for(i = 0; i < in->pHashList.count; i++) - { - if(session->attributes.isTrialPolicy == SET - || (MemoryEqual2B(&session->u2.policyDigest.b, - &in->pHashList.digests[i].b))) - { - // Found a match - HASH_STATE hashState; - TPM_CC commandCode = TPM_CC_PolicyOR; - - // Start hash - session->u2.policyDigest.t.size - = CryptHashStart(&hashState, session->authHashAlg); - // Set policyDigest to 0 string and add it to hash - MemorySet(session->u2.policyDigest.t.buffer, 0, - session->u2.policyDigest.t.size); - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add command code - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // Add each of the hashes in the list - for(i = 0; i < in->pHashList.count; i++) - { - // Extend policyDigest - CryptDigestUpdate2B(&hashState, &in->pHashList.digests[i].b); - } - // Complete digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - return TPM_RC_SUCCESS; - } - } - // None of the values in the list matched the current policyDigest - return TPM_RCS_VALUE + RC_PolicyOR_pHashList; -} - -#endif // CC_PolicyOR \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPCR.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPCR.c deleted file mode 100644 index 53248f202..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPCR.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyPCR_fp.h" - -#if CC_PolicyPCR // Conditional expansion of this file - -/*(See part 3 specification) -// Add a PCR gate for a policy session -*/ -// Return Type: TPM_RC -// TPM_RC_VALUE if provided, 'pcrDigest' does not match the -// current PCR settings -// TPM_RC_PCR_CHANGED a previous TPM2_PolicyPCR() set -// pcrCounter and it has changed -TPM_RC -TPM2_PolicyPCR( - PolicyPCR_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM2B_DIGEST pcrDigest; - BYTE pcrs[sizeof(TPML_PCR_SELECTION)]; - UINT32 pcrSize; - BYTE *buffer; - TPM_CC commandCode = TPM_CC_PolicyPCR; - HASH_STATE hashState; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // Compute current PCR digest - PCRComputeCurrentDigest(session->authHashAlg, &in->pcrs, &pcrDigest); - - // Do validation for non trial session - if(session->attributes.isTrialPolicy == CLEAR) - { - // Make sure that this is not going to invalidate a previous PCR check - if(session->pcrCounter != 0 && session->pcrCounter != gr.pcrCounter) - return TPM_RC_PCR_CHANGED; - - // If the caller specified the PCR digest and it does not - // match the current PCR settings, return an error.. - if(in->pcrDigest.t.size != 0) - { - if(!MemoryEqual2B(&in->pcrDigest.b, &pcrDigest.b)) - return TPM_RCS_VALUE + RC_PolicyPCR_pcrDigest; - } - } - else - { - // For trial session, just use the input PCR digest if one provided - // Note: It can't be too big because it is a TPM2B_DIGEST and the size - // would have been checked during unmarshaling - if(in->pcrDigest.t.size != 0) - pcrDigest = in->pcrDigest; - } -// Internal Data Update - // Update policy hash - // policyDigestnew = hash( policyDigestold || TPM_CC_PolicyPCR - // || PCRS || pcrDigest) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add PCRS - buffer = pcrs; - pcrSize = TPML_PCR_SELECTION_Marshal(&in->pcrs, &buffer, NULL); - CryptDigestUpdate(&hashState, pcrSize, pcrs); - - // add PCR digest - CryptDigestUpdate2B(&hashState, &pcrDigest.b); - - // complete the hash and get the results - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // update pcrCounter in session context for non trial session - if(session->attributes.isTrialPolicy == CLEAR) - { - session->pcrCounter = gr.pcrCounter; - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyPCR \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPassword.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPassword.c deleted file mode 100644 index 310df5e31..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPassword.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyPassword_fp.h" - -#if CC_PolicyPassword // Conditional expansion of this file - -#include "Policy_spt_fp.h" - -/*(See part 3 specification) -// allows a policy to be bound to the authorization value of the authorized -// object -*/ -TPM_RC -TPM2_PolicyPassword( - PolicyPassword_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM_CC commandCode = TPM_CC_PolicyAuthValue; - HASH_STATE hashState; - -// Internal Data Update - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyAuthValue) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // complete the digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // Update isPasswordNeeded bit - session->attributes.isPasswordNeeded = SET; - session->attributes.isAuthValueNeeded = CLEAR; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyPassword \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPhysicalPresence.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPhysicalPresence.c deleted file mode 100644 index 23af572cd..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyPhysicalPresence.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyPhysicalPresence_fp.h" - -#if CC_PolicyPhysicalPresence // Conditional expansion of this file - -/*(See part 3 specification) -// indicate that physical presence will need to be asserted at the time the -// authorization is performed -*/ -TPM_RC -TPM2_PolicyPhysicalPresence( - PolicyPhysicalPresence_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM_CC commandCode = TPM_CC_PolicyPhysicalPresence; - HASH_STATE hashState; - -// Internal Data Update - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyPhysicalPresence) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // complete the digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // update session attribute - session->attributes.isPPRequired = SET; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyPhysicalPresence \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicySecret.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicySecret.c deleted file mode 100644 index da6583eda..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicySecret.c +++ /dev/null @@ -1,128 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicySecret_fp.h" - -#if CC_PolicySecret // Conditional expansion of this file - -#include "Policy_spt_fp.h" -#include "NV_spt_fp.h" - -/*(See part 3 specification) -// Add a secret-based authorization to the policy evaluation -*/ -// Return Type: TPM_RC -// TPM_RC_CPHASH cpHash for policy was previously set to a -// value that is not the same as 'cpHashA' -// TPM_RC_EXPIRED 'expiration' indicates a time in the past -// TPM_RC_NONCE 'nonceTPM' does not match the nonce associated -// with 'policySession' -// TPM_RC_SIZE 'cpHashA' is not the size of a digest for the -// hash associated with 'policySession' -TPM_RC -TPM2_PolicySecret( - PolicySecret_In *in, // IN: input parameter list - PolicySecret_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - SESSION *session; - TPM2B_NAME entityName; - UINT64 authTimeout = 0; -// Input Validation - // Get pointer to the session structure - session = SessionGet(in->policySession); - - //Only do input validation if this is not a trial policy session - if(session->attributes.isTrialPolicy == CLEAR) - { - authTimeout = ComputeAuthTimeout(session, in->expiration, &in->nonceTPM); - - result = PolicyParameterChecks(session, authTimeout, - &in->cpHashA, &in->nonceTPM, - RC_PolicySecret_nonceTPM, - RC_PolicySecret_cpHashA, - RC_PolicySecret_expiration); - if(result != TPM_RC_SUCCESS) - return result; - } -// Internal Data Update - // Update policy context with input policyRef and name of authorizing key - // This value is computed even for trial sessions. Possibly update the cpHash - PolicyContextUpdate(TPM_CC_PolicySecret, - EntityGetName(in->authHandle, &entityName), &in->policyRef, - &in->cpHashA, authTimeout, session); -// Command Output - // Create ticket and timeout buffer if in->expiration < 0 and this is not - // a trial session. - // NOTE: PolicyParameterChecks() makes sure that nonceTPM is present - // when expiration is non-zero. - if(in->expiration < 0 - && session->attributes.isTrialPolicy == CLEAR - && !NvIsPinPassIndex(in->authHandle)) - { - BOOL expiresOnReset = (in->nonceTPM.t.size == 0); - // Compute policy ticket - authTimeout &= ~EXPIRATION_BIT; - TicketComputeAuth(TPM_ST_AUTH_SECRET, EntityGetHierarchy(in->authHandle), - authTimeout, expiresOnReset, &in->cpHashA, &in->policyRef, - &entityName, &out->policyTicket); - // Generate timeout buffer. The format of output timeout buffer is - // TPM-specific. - // Note: In this implementation, the timeout buffer value is computed after - // the ticket is produced so, when the ticket is checked, the expiration - // flag needs to be extracted before the ticket is checked. - out->timeout.t.size = sizeof(authTimeout); - // In the Windows compatible version, the least-significant bit of the - // timeout value is used as a flag to indicate if the authorization expires - // on reset. The flag is the MSb. - if(expiresOnReset) - authTimeout |= EXPIRATION_BIT; - UINT64_TO_BYTE_ARRAY(authTimeout, out->timeout.t.buffer); - } - else - { - // timeout buffer is null - out->timeout.t.size = 0; - - // authorization ticket is null - out->policyTicket.tag = TPM_ST_AUTH_SECRET; - out->policyTicket.hierarchy = TPM_RH_NULL; - out->policyTicket.digest.t.size = 0; - } - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicySecret \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicySigned.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicySigned.c deleted file mode 100644 index 1928da6d9..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicySigned.c +++ /dev/null @@ -1,180 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Policy_spt_fp.h" -#include "PolicySigned_fp.h" - -#if CC_PolicySigned // Conditional expansion of this file - -/*(See part 3 specification) -// Include an asymmetrically signed authorization to the policy evaluation -*/ -// Return Type: TPM_RC -// TPM_RC_CPHASH cpHash was previously set to a different value -// TPM_RC_EXPIRED 'expiration' indicates a time in the past or -// 'expiration' is non-zero but no nonceTPM is present -// TPM_RC_NONCE 'nonceTPM' is not the nonce associated with the -// 'policySession' -// TPM_RC_SCHEME the signing scheme of 'auth' is not supported by the -// TPM -// TPM_RC_SIGNATURE the signature is not genuine -// TPM_RC_SIZE input cpHash has wrong size -TPM_RC -TPM2_PolicySigned( - PolicySigned_In *in, // IN: input parameter list - PolicySigned_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - SESSION *session; - TPM2B_NAME entityName; - TPM2B_DIGEST authHash; - HASH_STATE hashState; - UINT64 authTimeout = 0; -// Input Validation - // Set up local pointers - session = SessionGet(in->policySession); // the session structure - - // Only do input validation if this is not a trial policy session - if(session->attributes.isTrialPolicy == CLEAR) - { - authTimeout = ComputeAuthTimeout(session, in->expiration, &in->nonceTPM); - - result = PolicyParameterChecks(session, authTimeout, - &in->cpHashA, &in->nonceTPM, - RC_PolicySigned_nonceTPM, - RC_PolicySigned_cpHashA, - RC_PolicySigned_expiration); - if(result != TPM_RC_SUCCESS) - return result; - // Re-compute the digest being signed - /*(See part 3 specification) - // The digest is computed as: - // aHash := hash ( nonceTPM | expiration | cpHashA | policyRef) - // where: - // hash() the hash associated with the signed authorization - // nonceTPM the nonceTPM value from the TPM2_StartAuthSession . - // response If the authorization is not limited to this - // session, the size of this value is zero. - // expiration time limit on authorization set by authorizing object. - // This 32-bit value is set to zero if the expiration - // time is not being set. - // cpHashA hash of the command parameters for the command being - // approved using the hash algorithm of the PSAP session. - // Set to NULLauth if the authorization is not limited - // to a specific command. - // policyRef hash of an opaque value determined by the authorizing - // object. Set to the NULLdigest if no hash is present. - */ - // Start hash - authHash.t.size = CryptHashStart(&hashState, - CryptGetSignHashAlg(&in->auth)); - // If there is no digest size, then we don't have a verification function - // for this algorithm (e.g. TPM_ALG_ECDAA) so indicate that it is a - // bad scheme. - if(authHash.t.size == 0) - return TPM_RCS_SCHEME + RC_PolicySigned_auth; - - // nonceTPM - CryptDigestUpdate2B(&hashState, &in->nonceTPM.b); - - // expiration - CryptDigestUpdateInt(&hashState, sizeof(UINT32), in->expiration); - - // cpHashA - CryptDigestUpdate2B(&hashState, &in->cpHashA.b); - - // policyRef - CryptDigestUpdate2B(&hashState, &in->policyRef.b); - - // Complete digest - CryptHashEnd2B(&hashState, &authHash.b); - - // Validate Signature. A TPM_RC_SCHEME, TPM_RC_HANDLE or TPM_RC_SIGNATURE - // error may be returned at this point - result = CryptValidateSignature(in->authObject, &authHash, &in->auth); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_PolicySigned_auth); - } -// Internal Data Update - // Update policy with input policyRef and name of authorization key - // These values are updated even if the session is a trial session - PolicyContextUpdate(TPM_CC_PolicySigned, - EntityGetName(in->authObject, &entityName), - &in->policyRef, - &in->cpHashA, authTimeout, session); -// Command Output - // Create ticket and timeout buffer if in->expiration < 0 and this is not - // a trial session. - // NOTE: PolicyParameterChecks() makes sure that nonceTPM is present - // when expiration is non-zero. - if(in->expiration < 0 - && session->attributes.isTrialPolicy == CLEAR) - { - BOOL expiresOnReset = (in->nonceTPM.t.size == 0); - // Compute policy ticket - authTimeout &= ~EXPIRATION_BIT; - - TicketComputeAuth(TPM_ST_AUTH_SIGNED, EntityGetHierarchy(in->authObject), - authTimeout, expiresOnReset, &in->cpHashA, &in->policyRef, - &entityName, &out->policyTicket); - // Generate timeout buffer. The format of output timeout buffer is - // TPM-specific. - // Note: In this implementation, the timeout buffer value is computed after - // the ticket is produced so, when the ticket is checked, the expiration - // flag needs to be extracted before the ticket is checked. - // In the Windows compatible version, the least-significant bit of the - // timeout value is used as a flag to indicate if the authorization expires - // on reset. The flag is the MSb. - out->timeout.t.size = sizeof(authTimeout); - if(expiresOnReset) - authTimeout |= EXPIRATION_BIT; - UINT64_TO_BYTE_ARRAY(authTimeout, out->timeout.t.buffer); - } - else - { - // Generate a null ticket. - // timeout buffer is null - out->timeout.t.size = 0; - - // authorization ticket is null - out->policyTicket.tag = TPM_ST_AUTH_SIGNED; - out->policyTicket.hierarchy = TPM_RH_NULL; - out->policyTicket.digest.t.size = 0; - } - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicySigned \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyTemplate.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyTemplate.c deleted file mode 100644 index 38be244e0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyTemplate.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyTemplate_fp.h" - -#if CC_PolicyTemplate // Conditional expansion of this file - -/*(See part 3 specification) -// Add a cpHash restriction to the policyDigest -*/ -// Return Type: TPM_RC -// TPM_RC_CPHASH cpHash of 'policySession' has previously been set -// to a different value -// TPM_RC_SIZE 'templateHash' is not the size of a digest produced -// by the hash algorithm associated with -// 'policySession' -TPM_RC -TPM2_PolicyTemplate( - PolicyTemplate_In *in // IN: input parameter list - ) -{ - SESSION *session; - TPM_CC commandCode = TPM_CC_PolicyTemplate; - HASH_STATE hashState; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // If the template is set, make sure that it is the same as the input value - if(session->attributes.isTemplateSet) - { - if(!MemoryEqual2B(&in->templateHash.b, &session->u1.cpHash.b)) - return TPM_RCS_VALUE + RC_PolicyTemplate_templateHash; - } - // error if cpHash contains something that is not a template - else if(session->u1.templateHash.t.size != 0) - return TPM_RC_CPHASH; - - // A valid templateHash must have the same size as session hash digest - if(in->templateHash.t.size != CryptHashGetDigestSize(session->authHashAlg)) - return TPM_RCS_SIZE + RC_PolicyTemplate_templateHash; - -// Internal Data Update - // Update policy hash - // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyCpHash - // || cpHashA.buffer) - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), commandCode); - - // add cpHashA - CryptDigestUpdate2B(&hashState, &in->templateHash.b); - - // complete the digest and get the results - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // update cpHash in session context - session->u1.templateHash = in->templateHash; - session->attributes.isTemplateSet = SET; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyTemplateHash \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyTicket.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyTicket.c deleted file mode 100644 index b19aec4e0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/PolicyTicket.c +++ /dev/null @@ -1,128 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyTicket_fp.h" - -#if CC_PolicyTicket // Conditional expansion of this file - -#include "Policy_spt_fp.h" - -/*(See part 3 specification) -// Include ticket to the policy evaluation -*/ -// Return Type: TPM_RC -// TPM_RC_CPHASH policy's cpHash was previously set to a different -// value -// TPM_RC_EXPIRED 'timeout' value in the ticket is in the past and the -// ticket has expired -// TPM_RC_SIZE 'timeout' or 'cpHash' has invalid size for the -// TPM_RC_TICKET 'ticket' is not valid -TPM_RC -TPM2_PolicyTicket( - PolicyTicket_In *in // IN: input parameter list - ) -{ - TPM_RC result; - SESSION *session; - UINT64 authTimeout; - TPMT_TK_AUTH ticketToCompare; - TPM_CC commandCode = TPM_CC_PolicySecret; - BOOL expiresOnReset; - -// Input Validation - - // Get pointer to the session structure - session = SessionGet(in->policySession); - - // NOTE: A trial policy session is not allowed to use this command. - // A ticket is used in place of a previously given authorization. Since - // a trial policy doesn't actually authenticate, the validated - // ticket is not necessary and, in place of using a ticket, one - // should use the intended authorization for which the ticket - // would be a substitute. - if(session->attributes.isTrialPolicy) - return TPM_RCS_ATTRIBUTES + RC_PolicyTicket_policySession; - // Restore timeout data. The format of timeout buffer is TPM-specific. - // In this implementation, the most significant bit of the timeout value is - // used as the flag to indicate that the ticket expires on TPM Reset or - // TPM Restart. The flag has to be removed before the parameters and ticket - // are checked. - if(in->timeout.t.size != sizeof(UINT64)) - return TPM_RCS_SIZE + RC_PolicyTicket_timeout; - authTimeout = BYTE_ARRAY_TO_UINT64(in->timeout.t.buffer); - - // extract the flag - expiresOnReset = (authTimeout & EXPIRATION_BIT) != 0; - authTimeout &= ~EXPIRATION_BIT; - - // Do the normal checks on the cpHashA and timeout values - result = PolicyParameterChecks(session, authTimeout, - &in->cpHashA, - NULL, // no nonce - 0, // no bad nonce return - RC_PolicyTicket_cpHashA, - RC_PolicyTicket_timeout); - if(result != TPM_RC_SUCCESS) - return result; - // Validate Ticket - // Re-generate policy ticket by input parameters - TicketComputeAuth(in->ticket.tag, in->ticket.hierarchy, - authTimeout, expiresOnReset, &in->cpHashA, &in->policyRef, - &in->authName, &ticketToCompare); - // Compare generated digest with input ticket digest - if(!MemoryEqual2B(&in->ticket.digest.b, &ticketToCompare.digest.b)) - return TPM_RCS_TICKET + RC_PolicyTicket_ticket; - -// Internal Data Update - - // Is this ticket to take the place of a TPM2_PolicySigned() or - // a TPM2_PolicySecret()? - if(in->ticket.tag == TPM_ST_AUTH_SIGNED) - commandCode = TPM_CC_PolicySigned; - else if(in->ticket.tag == TPM_ST_AUTH_SECRET) - commandCode = TPM_CC_PolicySecret; - else - // There could only be two possible tag values. Any other value should - // be caught by the ticket validation process. - FAIL(FATAL_ERROR_INTERNAL); - - // Update policy context - PolicyContextUpdate(commandCode, &in->authName, &in->policyRef, - &in->cpHashA, authTimeout, session); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyTicket \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/Policy_spt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/Policy_spt.c deleted file mode 100644 index 255dc7ead..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/EA/Policy_spt.c +++ /dev/null @@ -1,290 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" -#include "Policy_spt_fp.h" -#include "PolicySigned_fp.h" -#include "PolicySecret_fp.h" -#include "PolicyTicket_fp.h" - -//** Functions -//*** PolicyParameterChecks() -// This function validates the common parameters of TPM2_PolicySiged() -// and TPM2_PolicySecret(). The common parameters are 'nonceTPM', -// 'expiration', and 'cpHashA'. -TPM_RC -PolicyParameterChecks( - SESSION *session, - UINT64 authTimeout, - TPM2B_DIGEST *cpHashA, - TPM2B_NONCE *nonce, - TPM_RC blameNonce, - TPM_RC blameCpHash, - TPM_RC blameExpiration - ) -{ - // Validate that input nonceTPM is correct if present - if(nonce != NULL && nonce->t.size != 0) - { - if(!MemoryEqual2B(&nonce->b, &session->nonceTPM.b)) - return TPM_RCS_NONCE + blameNonce; - } - // If authTimeout is set (expiration != 0... - if(authTimeout != 0) - { - // Validate input expiration. - // Cannot compare time if clock stop advancing. A TPM_RC_NV_UNAVAILABLE - // or TPM_RC_NV_RATE error may be returned here. - RETURN_IF_NV_IS_NOT_AVAILABLE; - - // if the time has already passed or the time epoch has changed then the - // time value is no longer good. - if((authTimeout < g_time) - || (session->epoch != g_timeEpoch)) - return TPM_RCS_EXPIRED + blameExpiration; - } - // If the cpHash is present, then check it - if(cpHashA != NULL && cpHashA->t.size != 0) - { - // The cpHash input has to have the correct size - if(cpHashA->t.size != session->u2.policyDigest.t.size) - return TPM_RCS_SIZE + blameCpHash; - - // If the cpHash has already been set, then this input value - // must match the current value. - if(session->u1.cpHash.b.size != 0 - && !MemoryEqual2B(&cpHashA->b, &session->u1.cpHash.b)) - return TPM_RC_CPHASH; - } - return TPM_RC_SUCCESS; -} - -//*** PolicyContextUpdate() -// Update policy hash -// Update the policyDigest in policy session by extending policyRef and -// objectName to it. This will also update the cpHash if it is present. -// Return Type: void -void -PolicyContextUpdate( - TPM_CC commandCode, // IN: command code - TPM2B_NAME *name, // IN: name of entity - TPM2B_NONCE *ref, // IN: the reference data - TPM2B_DIGEST *cpHash, // IN: the cpHash (optional) - UINT64 policyTimeout, // IN: the timeout value for the policy - SESSION *session // IN/OUT: policy session to be updated - ) -{ - HASH_STATE hashState; - - // Start hash - CryptHashStart(&hashState, session->authHashAlg); - - - // policyDigest size should always be the digest size of session hash algorithm. - pAssert(session->u2.policyDigest.t.size - == CryptHashGetDigestSize(session->authHashAlg)); - - // add old digest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add commandCode - CryptDigestUpdateInt(&hashState, sizeof(commandCode), commandCode); - - // add name if applicable - if(name != NULL) - CryptDigestUpdate2B(&hashState, &name->b); - - // Complete the digest and get the results - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - - // If the policy reference is not null, do a second update to the digest. - if(ref != NULL) - { - - // Start second hash computation - CryptHashStart(&hashState, session->authHashAlg); - - // add policyDigest - CryptDigestUpdate2B(&hashState, &session->u2.policyDigest.b); - - // add policyRef - CryptDigestUpdate2B(&hashState, &ref->b); - - // Complete second digest - CryptHashEnd2B(&hashState, &session->u2.policyDigest.b); - } - // Deal with the cpHash. If the cpHash value is present - // then it would have already been checked to make sure that - // it is compatible with the current value so all we need - // to do here is copy it and set the isCpHashDefined attribute - if(cpHash != NULL && cpHash->t.size != 0) - { - session->u1.cpHash = *cpHash; - session->attributes.isCpHashDefined = SET; - } - - // update the timeout if it is specified - if(policyTimeout != 0) - { - // If the timeout has not been set, then set it to the new value - // than the current timeout then set it to the new value - if(session->timeout == 0 || session->timeout > policyTimeout) - session->timeout = policyTimeout; - } - return; -} -//*** ComputeAuthTimeout() -// This function is used to determine what the authorization timeout value for -// the session should be. -UINT64 -ComputeAuthTimeout( - SESSION *session, // IN: the session containing the time - // values - INT32 expiration, // IN: either the number of seconds from - // the start of the session or the - // time in g_timer; - TPM2B_NONCE *nonce // IN: indicator of the time base - ) -{ - UINT64 policyTime; - // If no expiration, policy time is 0 - if(expiration == 0) - policyTime = 0; - else - { - if(expiration < 0) - expiration = -expiration; - if(nonce->t.size == 0) - // The input time is absolute Time (not Clock), but it is expressed - // in seconds. To make sure that we don't time out too early, take the - // current value of milliseconds in g_time and add that to the input - // seconds value. - policyTime = (((UINT64)expiration) * 1000) + g_time % 1000; - else - // The policy timeout is the absolute value of the expiration in seconds - // added to the start time of the policy. - policyTime = session->startTime + (((UINT64)expiration) * 1000); - - } - return policyTime; -} - -//*** PolicyDigestClear() -// Function to reset the policyDigest of a session -void -PolicyDigestClear( - SESSION *session - ) -{ - session->u2.policyDigest.t.size = CryptHashGetDigestSize(session->authHashAlg); - MemorySet(session->u2.policyDigest.t.buffer, 0, - session->u2.policyDigest.t.size); -} - -BOOL -PolicySptCheckCondition( - TPM_EO operation, - BYTE *opA, - BYTE *opB, - UINT16 size - ) -{ - // Arithmetic Comparison - switch(operation) - { - case TPM_EO_EQ: - // compare A = B - return (UnsignedCompareB(size, opA, size, opB) == 0); - break; - case TPM_EO_NEQ: - // compare A != B - return (UnsignedCompareB(size, opA, size, opB) != 0); - break; - case TPM_EO_SIGNED_GT: - // compare A > B signed - return (SignedCompareB(size, opA, size, opB) > 0); - break; - case TPM_EO_UNSIGNED_GT: - // compare A > B unsigned - return (UnsignedCompareB(size, opA, size, opB) > 0); - break; - case TPM_EO_SIGNED_LT: - // compare A < B signed - return (SignedCompareB(size, opA, size, opB) < 0); - break; - case TPM_EO_UNSIGNED_LT: - // compare A < B unsigned - return (UnsignedCompareB(size, opA, size, opB) < 0); - break; - case TPM_EO_SIGNED_GE: - // compare A >= B signed - return (SignedCompareB(size, opA, size, opB) >= 0); - break; - case TPM_EO_UNSIGNED_GE: - // compare A >= B unsigned - return (UnsignedCompareB(size, opA, size, opB) >= 0); - break; - case TPM_EO_SIGNED_LE: - // compare A <= B signed - return (SignedCompareB(size, opA, size, opB) <= 0); - break; - case TPM_EO_UNSIGNED_LE: - // compare A <= B unsigned - return (UnsignedCompareB(size, opA, size, opB) <= 0); - break; - case TPM_EO_BITSET: - // All bits SET in B are SET in A. ((A&B)=B) - { - UINT32 i; - for(i = 0; i < size; i++) - if((opA[i] & opB[i]) != opB[i]) - return FALSE; - } - break; - case TPM_EO_BITCLEAR: - // All bits SET in B are CLEAR in A. ((A&B)=0) - { - UINT32 i; - for(i = 0; i < size; i++) - if((opA[i] & opB[i]) != 0) - return FALSE; - } - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - return TRUE; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Ecdaa/Commit.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Ecdaa/Commit.c deleted file mode 100644 index 40203c2cf..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Ecdaa/Commit.c +++ /dev/null @@ -1,169 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Commit_fp.h" - -#if CC_Commit // Conditional expansion of this file - -/*(See part 3 specification) -// This command performs the point multiply operations for anonymous signing -// scheme. -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'keyHandle' references a restricted key that is not a -// signing key -// TPM_RC_ECC_POINT either 'P1' or the point derived from 's2' is not on -// the curve of 'keyHandle' -// TPM_RC_HASH invalid name algorithm in 'keyHandle' -// TPM_RC_KEY 'keyHandle' does not reference an ECC key -// TPM_RC_SCHEME the scheme of 'keyHandle' is not an anonymous scheme -// TPM_RC_NO_RESULT 'K', 'L' or 'E' was a point at infinity; or -// failed to generate "r" value -// TPM_RC_SIZE 's2' is empty but 'y2' is not or 's2' provided but -// 'y2' is not -TPM_RC -TPM2_Commit( - Commit_In *in, // IN: input parameter list - Commit_Out *out // OUT: output parameter list - ) -{ - OBJECT *eccKey; - TPMS_ECC_POINT P2; - TPMS_ECC_POINT *pP2 = NULL; - TPMS_ECC_POINT *pP1 = NULL; - TPM2B_ECC_PARAMETER r; - TPM2B_ECC_PARAMETER p; - TPM_RC result; - TPMS_ECC_PARMS *parms; - -// Input Validation - - eccKey = HandleToObject(in->signHandle); - parms = &eccKey->publicArea.parameters.eccDetail; - - // Input key must be an ECC key - if(eccKey->publicArea.type != TPM_ALG_ECC) - return TPM_RCS_KEY + RC_Commit_signHandle; - - // This command may only be used with a sign-only key using an anonymous - // scheme. - // NOTE: a sign + decrypt key has no scheme so it will not be an anonymous one - // and an unrestricted sign key might no have a signing scheme but it can't - // be use in Commit() - if(!CryptIsSchemeAnonymous(parms->scheme.scheme)) - return TPM_RCS_SCHEME + RC_Commit_signHandle; - -// Make sure that both parts of P2 are present if either is present - if((in->s2.t.size == 0) != (in->y2.t.size == 0)) - return TPM_RCS_SIZE + RC_Commit_y2; - - // Get prime modulus for the curve. This is needed later but getting this now - // allows confirmation that the curve exists. - if(!CryptEccGetParameter(&p, 'p', parms->curveID)) - return TPM_RCS_KEY + RC_Commit_signHandle; - - // Get the random value that will be used in the point multiplications - // Note: this does not commit the count. - if(!CryptGenerateR(&r, NULL, parms->curveID, &eccKey->name)) - return TPM_RC_NO_RESULT; - - // Set up P2 if s2 and Y2 are provided - if(in->s2.t.size != 0) - { - TPM2B_DIGEST x2; - - pP2 = &P2; - - // copy y2 for P2 - P2.y = in->y2; - - // Compute x2 HnameAlg(s2) mod p - // do the hash operation on s2 with the size of curve 'p' - x2.t.size = CryptHashBlock(eccKey->publicArea.nameAlg, - in->s2.t.size, - in->s2.t.buffer, - sizeof(x2.t.buffer), - x2.t.buffer); - - // If there were error returns in the hash routine, indicate a problem - // with the hash algorithm selection - if(x2.t.size == 0) - return TPM_RCS_HASH + RC_Commit_signHandle; - // The size of the remainder will be same as the size of p. DivideB() will - // pad the results (leading zeros) if necessary to make the size the same - P2.x.t.size = p.t.size; - // set p2.x = hash(s2) mod p - if(DivideB(&x2.b, &p.b, NULL, &P2.x.b) != TPM_RC_SUCCESS) - return TPM_RC_NO_RESULT; - - if(!CryptEccIsPointOnCurve(parms->curveID, pP2)) - return TPM_RCS_ECC_POINT + RC_Commit_s2; - - if(eccKey->attributes.publicOnly == SET) - return TPM_RCS_KEY + RC_Commit_signHandle; - } - // If there is a P1, make sure that it is on the curve - // NOTE: an "empty" point has two UINT16 values which are the size values - // for each of the coordinates. - if(in->P1.size > 4) - { - pP1 = &in->P1.point; - if(!CryptEccIsPointOnCurve(parms->curveID, pP1)) - return TPM_RCS_ECC_POINT + RC_Commit_P1; - } - - // Pass the parameters to CryptCommit. - // The work is not done in-line because it does several point multiplies - // with the same curve. It saves work by not having to reload the curve - // parameters multiple times. - result = CryptEccCommitCompute(&out->K.point, - &out->L.point, - &out->E.point, - parms->curveID, - pP1, - pP2, - &eccKey->sensitive.sensitive.ecc, - &r); - if(result != TPM_RC_SUCCESS) - return result; - - // The commit computation was successful so complete the commit by setting - // the bit - out->counter = CryptCommit(); - - return TPM_RC_SUCCESS; -} - -#endif // CC_Commit \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeData.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeData.c deleted file mode 100644 index 18f537da8..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeData.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "FieldUpgradeData_fp.h" -#if CC_FieldUpgradeData // Conditional expansion of this file - -/*(See part 3 specification) -// FieldUpgradeData -*/ -TPM_RC -TPM2_FieldUpgradeData( - FieldUpgradeData_In *in, // IN: input parameter list - FieldUpgradeData_Out *out // OUT: output parameter list - ) -{ - // Not implemented - UNUSED_PARAMETER(in); - UNUSED_PARAMETER(out); - return TPM_RC_SUCCESS; -} -#endif \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeStart.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeStart.c deleted file mode 100644 index f4f89b14a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FieldUpgradeStart.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "FieldUpgradeStart_fp.h" -#if CC_FieldUpgradeStart // Conditional expansion of this file - -/*(See part 3 specification) -// FieldUpgradeStart -*/ -TPM_RC -TPM2_FieldUpgradeStart( - FieldUpgradeStart_In *in // IN: input parameter list - ) -{ - // Not implemented - UNUSED_PARAMETER(in); - return TPM_RC_SUCCESS; -} -#endif \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FirmwareRead.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FirmwareRead.c deleted file mode 100644 index 810483dba..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/FieldUpgrade/FirmwareRead.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "FirmwareRead_fp.h" - -#if CC_FirmwareRead // Conditional expansion of this file - -/*(See part 3 specification) -// FirmwareRead -*/ -TPM_RC -TPM2_FirmwareRead( - FirmwareRead_In *in, // IN: input parameter list - FirmwareRead_Out *out // OUT: output parameter list - ) -{ - // Not implemented - UNUSED_PARAMETER(in); - UNUSED_PARAMETER(out); - return TPM_RC_SUCCESS; -} - -#endif // CC_FirmwareRead \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/EventSequenceComplete.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/EventSequenceComplete.c deleted file mode 100644 index 5a1e79017..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/EventSequenceComplete.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "EventSequenceComplete_fp.h" - -#if CC_EventSequenceComplete // Conditional expansion of this file - -/*(See part 3 specification) - Complete an event sequence and flush the object. -*/ -// Return Type: TPM_RC -// TPM_RC_LOCALITY PCR extension is not allowed at the current locality -// TPM_RC_MODE input handle is not a valid event sequence object -TPM_RC -TPM2_EventSequenceComplete( - EventSequenceComplete_In *in, // IN: input parameter list - EventSequenceComplete_Out *out // OUT: output parameter list - ) -{ - HASH_OBJECT *hashObject; - UINT32 i; - TPM_ALG_ID hashAlg; -// Input validation - // get the event sequence object pointer - hashObject = (HASH_OBJECT *)HandleToObject(in->sequenceHandle); - - // input handle must reference an event sequence object - if(hashObject->attributes.eventSeq != SET) - return TPM_RCS_MODE + RC_EventSequenceComplete_sequenceHandle; - - // see if a PCR extend is requested in call - if(in->pcrHandle != TPM_RH_NULL) - { - // see if extend of the PCR is allowed at the locality of the command, - if(!PCRIsExtendAllowed(in->pcrHandle)) - return TPM_RC_LOCALITY; - // if an extend is going to take place, then check to see if there has - // been an orderly shutdown. If so, and the selected PCR is one of the - // state saved PCR, then the orderly state has to change. The orderly state - // does not change for PCR that are not preserved. - // NOTE: This doesn't just check for Shutdown(STATE) because the orderly - // state will have to change if this is a state-saved PCR regardless - // of the current state. This is because a subsequent Shutdown(STATE) will - // check to see if there was an orderly shutdown and not do anything if - // there was. So, this must indicate that a future Shutdown(STATE) has - // something to do. - if(PCRIsStateSaved(in->pcrHandle)) - RETURN_IF_ORDERLY; - } -// Command Output - out->results.count = 0; - - for(i = 0; i < HASH_COUNT; i++) - { - hashAlg = CryptHashGetAlgByIndex(i); - // Update last piece of data - CryptDigestUpdate2B(&hashObject->state.hashState[i], &in->buffer.b); - // Complete hash - out->results.digests[out->results.count].hashAlg = hashAlg; - CryptHashEnd(&hashObject->state.hashState[i], - CryptHashGetDigestSize(hashAlg), - (BYTE *)&out->results.digests[out->results.count].digest); - // Extend PCR - if(in->pcrHandle != TPM_RH_NULL) - PCRExtend(in->pcrHandle, hashAlg, - CryptHashGetDigestSize(hashAlg), - (BYTE *)&out->results.digests[out->results.count].digest); - out->results.count++; - } -// Internal Data Update - // mark sequence object as evict so it will be flushed on the way out - hashObject->attributes.evict = SET; - - return TPM_RC_SUCCESS; -} - -#endif // CC_EventSequenceComplete \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/HMAC_Start.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/HMAC_Start.c deleted file mode 100644 index 518348dd9..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/HMAC_Start.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "HMAC_Start_fp.h" - -#if CC_HMAC_Start // Conditional expansion of this file - -/*(See part 3 specification) -// Initialize a HMAC sequence and create a sequence object -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES key referenced by 'handle' is not a signing key -// or is restricted -// TPM_RC_OBJECT_MEMORY no space to create an internal object -// TPM_RC_KEY key referenced by 'handle' is not an HMAC key -// TPM_RC_VALUE 'hashAlg' is not compatible with the hash algorithm -// of the scheme of the object referenced by 'handle' -TPM_RC -TPM2_HMAC_Start( - HMAC_Start_In *in, // IN: input parameter list - HMAC_Start_Out *out // OUT: output parameter list - ) -{ - OBJECT *keyObject; - TPMT_PUBLIC *publicArea; - TPM_ALG_ID hashAlg; - -// Input Validation - - // Get HMAC key object and public area pointers - keyObject = HandleToObject(in->handle); - publicArea = &keyObject->publicArea; - - // Make sure that the key is an HMAC key - if(publicArea->type != TPM_ALG_KEYEDHASH) - return TPM_RCS_TYPE + RC_HMAC_Start_handle; - - // and that it is unrestricted - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, restricted)) - return TPM_RCS_ATTRIBUTES + RC_HMAC_Start_handle; - - // and that it is a signing key - if(!IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign)) - return TPM_RCS_KEY + RC_HMAC_Start_handle; - - // See if the key has a default - if(publicArea->parameters.keyedHashDetail.scheme.scheme == TPM_ALG_NULL) - // it doesn't so use the input value - hashAlg = in->hashAlg; - else - { - // key has a default so use it - hashAlg - = publicArea->parameters.keyedHashDetail.scheme.details.hmac.hashAlg; - // and verify that the input was either the TPM_ALG_NULL or the default - if(in->hashAlg != TPM_ALG_NULL && in->hashAlg != hashAlg) - hashAlg = TPM_ALG_NULL; - } - // if we ended up without a hash algorithm then return an error - if(hashAlg == TPM_ALG_NULL) - return TPM_RCS_VALUE + RC_HMAC_Start_hashAlg; - -// Internal Data Update - - // Create a HMAC sequence object. A TPM_RC_OBJECT_MEMORY error may be - // returned at this point - return ObjectCreateHMACSequence(hashAlg, - keyObject, - &in->auth, - &out->sequenceHandle); -} - -#endif // CC_HMAC_Start \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/HashSequenceStart.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/HashSequenceStart.c deleted file mode 100644 index 296363231..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/HashSequenceStart.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "HashSequenceStart_fp.h" - -#if CC_HashSequenceStart // Conditional expansion of this file - -/*(See part 3 specification) -// Start a hash or an event sequence -*/ -// Return Type: TPM_RC -// TPM_RC_OBJECT_MEMORY no space to create an internal object -TPM_RC -TPM2_HashSequenceStart( - HashSequenceStart_In *in, // IN: input parameter list - HashSequenceStart_Out *out // OUT: output parameter list - ) -{ -// Internal Data Update - - if(in->hashAlg == TPM_ALG_NULL) - // Start a event sequence. A TPM_RC_OBJECT_MEMORY error may be - // returned at this point - return ObjectCreateEventSequence(&in->auth, &out->sequenceHandle); - - // Start a hash sequence. A TPM_RC_OBJECT_MEMORY error may be - // returned at this point - return ObjectCreateHashSequence(in->hashAlg, &in->auth, &out->sequenceHandle); -} - -#endif // CC_HashSequenceStart \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/MAC_Start.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/MAC_Start.c deleted file mode 100644 index 42abe1fee..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/MAC_Start.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "MAC_Start_fp.h" - -#if CC_MAC_Start // Conditional expansion of this file - -/*(See part 3 specification) -// Initialize a HMAC sequence and create a sequence object -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES key referenced by 'handle' is not a signing key -// or is restricted -// TPM_RC_OBJECT_MEMORY no space to create an internal object -// TPM_RC_KEY key referenced by 'handle' is not an HMAC key -// TPM_RC_VALUE 'hashAlg' is not compatible with the hash algorithm -// of the scheme of the object referenced by 'handle' -TPM_RC -TPM2_MAC_Start( - MAC_Start_In *in, // IN: input parameter list - MAC_Start_Out *out // OUT: output parameter list - ) -{ - OBJECT *keyObject; - TPMT_PUBLIC *publicArea; - TPM_RC result; - -// Input Validation - - // Get HMAC key object and public area pointers - keyObject = HandleToObject(in->handle); - publicArea = &keyObject->publicArea; - - // Make sure that the key can do what is required - result = CryptSelectMac(publicArea, &in->inScheme); - // If the key is not able to do a MAC, indicate that the handle selects an - // object that can't do a MAC - if(result == TPM_RCS_TYPE) - return TPM_RCS_TYPE + RC_MAC_Start_handle; - // If there is another error type, indicate that the scheme and key are not - // compatible - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_MAC_Start_inScheme); - // Make sure that the key is not restricted - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, restricted)) - return TPM_RCS_ATTRIBUTES + RC_MAC_Start_handle; - // and that it is a signing key - if(!IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign)) - return TPM_RCS_KEY + RC_MAC_Start_handle; - -// Internal Data Update - // Create a HMAC sequence object. A TPM_RC_OBJECT_MEMORY error may be - // returned at this point - return ObjectCreateHMACSequence(in->inScheme, - keyObject, - &in->auth, - &out->sequenceHandle); -} - -#endif // CC_MAC_Start \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/SequenceComplete.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/SequenceComplete.c deleted file mode 100644 index d342ed85e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/SequenceComplete.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "SequenceComplete_fp.h" - -#if CC_SequenceComplete // Conditional expansion of this file - -/*(See part 3 specification) -// Complete a sequence and flush the object. -*/ -// Return Type: TPM_RC -// TPM_RC_MODE 'sequenceHandle' does not reference a hash or HMAC -// sequence object -TPM_RC -TPM2_SequenceComplete( - SequenceComplete_In *in, // IN: input parameter list - SequenceComplete_Out *out // OUT: output parameter list - ) -{ - HASH_OBJECT *hashObject; -// Input validation - // Get hash object pointer - hashObject = (HASH_OBJECT *)HandleToObject(in->sequenceHandle); - - // input handle must be a hash or HMAC sequence object. - if(hashObject->attributes.hashSeq == CLEAR - && hashObject->attributes.hmacSeq == CLEAR) - return TPM_RCS_MODE + RC_SequenceComplete_sequenceHandle; -// Command Output - if(hashObject->attributes.hashSeq == SET) // sequence object for hash - { - // Get the hash algorithm before the algorithm is lost in CryptHashEnd - TPM_ALG_ID hashAlg = hashObject->state.hashState[0].hashAlg; - - // Update last piece of the data - CryptDigestUpdate2B(&hashObject->state.hashState[0], &in->buffer.b); - - // Complete hash - out->result.t.size = CryptHashEnd(&hashObject->state.hashState[0], - sizeof(out->result.t.buffer), - out->result.t.buffer); - // Check if the first block of the sequence has been received - if(hashObject->attributes.firstBlock == CLEAR) - { - // If not, then this is the first block so see if it is 'safe' - // to sign. - if(TicketIsSafe(&in->buffer.b)) - hashObject->attributes.ticketSafe = SET; - } - // Output ticket - out->validation.tag = TPM_ST_HASHCHECK; - out->validation.hierarchy = in->hierarchy; - - if(in->hierarchy == TPM_RH_NULL) - { - // Ticket is not required - out->validation.digest.t.size = 0; - } - else if(hashObject->attributes.ticketSafe == CLEAR) - { - // Ticket is not safe to generate - out->validation.hierarchy = TPM_RH_NULL; - out->validation.digest.t.size = 0; - } - else - { - // Compute ticket - TicketComputeHashCheck(out->validation.hierarchy, hashAlg, - &out->result, &out->validation); - } - } - else - { - // Update last piece of data - CryptDigestUpdate2B(&hashObject->state.hmacState.hashState, &in->buffer.b); -#if !SMAC_IMPLEMENTED - // Complete HMAC - out->result.t.size = CryptHmacEnd(&(hashObject->state.hmacState), - sizeof(out->result.t.buffer), - out->result.t.buffer); -#else - // Complete the MAC - out->result.t.size = CryptMacEnd(&hashObject->state.hmacState, - sizeof(out->result.t.buffer), - out->result.t.buffer); -#endif - // No ticket is generated for HMAC sequence - out->validation.tag = TPM_ST_HASHCHECK; - out->validation.hierarchy = TPM_RH_NULL; - out->validation.digest.t.size = 0; - } -// Internal Data Update - // mark sequence object as evict so it will be flushed on the way out - hashObject->attributes.evict = SET; - - return TPM_RC_SUCCESS; -} - -#endif // CC_SequenceComplete \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/SequenceUpdate.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/SequenceUpdate.c deleted file mode 100644 index a02264704..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/HashHMAC/SequenceUpdate.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "SequenceUpdate_fp.h" - -#if CC_SequenceUpdate // Conditional expansion of this file - -/*(See part 3 specification) -// This function is used to add data to a sequence object. -*/ -// Return Type: TPM_RC -// TPM_RC_MODE 'sequenceHandle' does not reference a hash or HMAC -// sequence object -TPM_RC -TPM2_SequenceUpdate( - SequenceUpdate_In *in // IN: input parameter list - ) -{ - OBJECT *object; - HASH_OBJECT *hashObject; - -// Input Validation - - // Get sequence object pointer - object = HandleToObject(in->sequenceHandle); - hashObject = (HASH_OBJECT *)object; - - // Check that referenced object is a sequence object. - if(!ObjectIsSequence(object)) - return TPM_RCS_MODE + RC_SequenceUpdate_sequenceHandle; - -// Internal Data Update - - if(object->attributes.eventSeq == SET) - { - // Update event sequence object - UINT32 i; - for(i = 0; i < HASH_COUNT; i++) - { - // Update sequence object - CryptDigestUpdate2B(&hashObject->state.hashState[i], &in->buffer.b); - } - } - else - { - // Update hash/HMAC sequence object - if(hashObject->attributes.hashSeq == SET) - { - // Is this the first block of the sequence - if(hashObject->attributes.firstBlock == CLEAR) - { - // If so, indicate that first block was received - hashObject->attributes.firstBlock = SET; - - // Check the first block to see if the first block can contain - // the TPM_GENERATED_VALUE. If it does, it is not safe for - // a ticket. - if(TicketIsSafe(&in->buffer.b)) - hashObject->attributes.ticketSafe = SET; - } - // Update sequence object hash/HMAC stack - CryptDigestUpdate2B(&hashObject->state.hashState[0], &in->buffer.b); - } - else if(object->attributes.hmacSeq == SET) - { - // Update sequence object HMAC stack - CryptDigestUpdate2B(&hashObject->state.hmacState.hashState, - &in->buffer.b); - } - } - return TPM_RC_SUCCESS; -} - -#endif // CC_SequenceUpdate \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ChangeEPS.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ChangeEPS.c deleted file mode 100644 index 2735e1118..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ChangeEPS.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ChangeEPS_fp.h" - -#if CC_ChangeEPS // Conditional expansion of this file - -/*(See part 3 specification) -// Reset current EPS value -*/ -TPM_RC -TPM2_ChangeEPS( - ChangeEPS_In *in // IN: input parameter list - ) -{ - // The command needs NV update. Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - - // Input parameter is not reference in command action - NOT_REFERENCED(in); - -// Internal Data Update - - // Reset endorsement hierarchy seed from RNG - CryptRandomGenerate(sizeof(gp.EPSeed.t.buffer), gp.EPSeed.t.buffer); - - // Create new ehProof value from RNG - CryptRandomGenerate(sizeof(gp.ehProof.t.buffer), gp.ehProof.t.buffer); - - // Enable endorsement hierarchy - gc.ehEnable = TRUE; - - // set authValue buffer to zeros - MemorySet(gp.endorsementAuth.t.buffer, 0, gp.endorsementAuth.t.size); - // Set endorsement authValue to null - gp.endorsementAuth.t.size = 0; - - // Set endorsement authPolicy to null - gp.endorsementAlg = TPM_ALG_NULL; - gp.endorsementPolicy.t.size = 0; - - // Flush loaded object in endorsement hierarchy - ObjectFlushHierarchy(TPM_RH_ENDORSEMENT); - - // Flush evict object of endorsement hierarchy stored in NV - NvFlushHierarchy(TPM_RH_ENDORSEMENT); - - // Save hierarchy changes to NV - NV_SYNC_PERSISTENT(EPSeed); - NV_SYNC_PERSISTENT(ehProof); - NV_SYNC_PERSISTENT(endorsementAuth); - NV_SYNC_PERSISTENT(endorsementAlg); - NV_SYNC_PERSISTENT(endorsementPolicy); - - // orderly state should be cleared because of the update to state clear data - g_clearOrderly = TRUE; - - return TPM_RC_SUCCESS; -} - -#endif // CC_ChangeEPS \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ChangePPS.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ChangePPS.c deleted file mode 100644 index 5637a8847..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ChangePPS.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ChangePPS_fp.h" - -#if CC_ChangePPS // Conditional expansion of this file - -/*(See part 3 specification) -// Reset current PPS value -*/ -TPM_RC -TPM2_ChangePPS( - ChangePPS_In *in // IN: input parameter list - ) -{ - UINT32 i; - - // Check if NV is available. A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE - // error may be returned at this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - - // Input parameter is not reference in command action - NOT_REFERENCED(in); - -// Internal Data Update - - // Reset platform hierarchy seed from RNG - CryptRandomGenerate(sizeof(gp.PPSeed.t.buffer), gp.PPSeed.t.buffer); - - // Create a new phProof value from RNG to prevent the saved platform - // hierarchy contexts being loaded - CryptRandomGenerate(sizeof(gp.phProof.t.buffer), gp.phProof.t.buffer); - - // Set platform authPolicy to null - gc.platformAlg = TPM_ALG_NULL; - gc.platformPolicy.t.size = 0; - - // Flush loaded object in platform hierarchy - ObjectFlushHierarchy(TPM_RH_PLATFORM); - - // Flush platform evict object and index in NV - NvFlushHierarchy(TPM_RH_PLATFORM); - - // Save hierarchy changes to NV - NV_SYNC_PERSISTENT(PPSeed); - NV_SYNC_PERSISTENT(phProof); - - // Re-initialize PCR policies -#if defined NUM_POLICY_PCR_GROUP && NUM_POLICY_PCR_GROUP > 0 - for(i = 0; i < NUM_POLICY_PCR_GROUP; i++) - { - gp.pcrPolicies.hashAlg[i] = TPM_ALG_NULL; - gp.pcrPolicies.policy[i].t.size = 0; - } - NV_SYNC_PERSISTENT(pcrPolicies); -#endif - - // orderly state should be cleared because of the update to state clear data - g_clearOrderly = TRUE; - - return TPM_RC_SUCCESS; -} - -#endif // CC_ChangePPS \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/Clear.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/Clear.c deleted file mode 100644 index b38932a85..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/Clear.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Clear_fp.h" - -#if CC_Clear // Conditional expansion of this file - -/*(See part 3 specification) -// Clear owner -*/ -// Return Type: TPM_RC -// TPM_RC_DISABLED Clear command has been disabled -TPM_RC -TPM2_Clear( - Clear_In *in // IN: input parameter list - ) -{ - // Input parameter is not reference in command action - NOT_REFERENCED(in); - - // The command needs NV update. Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Input Validation - - // If Clear command is disabled, return an error - if(gp.disableClear) - return TPM_RC_DISABLED; - -// Internal Data Update - - // Reset storage hierarchy seed from RNG - CryptRandomGenerate(sizeof(gp.SPSeed.t.buffer), gp.SPSeed.t.buffer); - - // Create new shProof and ehProof value from RNG - CryptRandomGenerate(sizeof(gp.shProof.t.buffer), gp.shProof.t.buffer); - CryptRandomGenerate(sizeof(gp.ehProof.t.buffer), gp.ehProof.t.buffer); - - // Enable storage and endorsement hierarchy - gc.shEnable = gc.ehEnable = TRUE; - - // set the authValue buffers to zero - MemorySet(&gp.ownerAuth, 0, sizeof(gp.ownerAuth)); - MemorySet(&gp.endorsementAuth, 0, sizeof(gp.endorsementAuth)); - MemorySet(&gp.lockoutAuth, 0, sizeof(gp.lockoutAuth)); - - // Set storage, endorsement, and lockout authPolicy to null - gp.ownerAlg = gp.endorsementAlg = gp.lockoutAlg = TPM_ALG_NULL; - MemorySet(&gp.ownerPolicy, 0, sizeof(gp.ownerPolicy)); - MemorySet(&gp.endorsementPolicy, 0, sizeof(gp.endorsementPolicy)); - MemorySet(&gp.lockoutPolicy, 0, sizeof(gp.lockoutPolicy)); - - // Flush loaded object in storage and endorsement hierarchy - ObjectFlushHierarchy(TPM_RH_OWNER); - ObjectFlushHierarchy(TPM_RH_ENDORSEMENT); - - // Flush owner and endorsement object and owner index in NV - NvFlushHierarchy(TPM_RH_OWNER); - NvFlushHierarchy(TPM_RH_ENDORSEMENT); - - // Initialize dictionary attack parameters - DAPreInstall_Init(); - - // Reset clock - go.clock = 0; - go.clockSafe = YES; - NvWrite(NV_ORDERLY_DATA, sizeof(ORDERLY_DATA), &go); - - // Reset counters - gp.resetCount = gr.restartCount = gr.clearCount = 0; - gp.auditCounter = 0; - - // Save persistent data changes to NV - // Note: since there are so many changes to the persistent data structure, the - // entire PERSISTENT_DATA structure is written as a unit - NvWrite(NV_PERSISTENT_DATA, sizeof(PERSISTENT_DATA), &gp); - - // Reset the PCR authValues (this does not change the PCRs) - PCR_ClearAuth(); - - // Bump the PCR counter - PCRChanged(0); - - - // orderly state should be cleared because of the update to state clear data - g_clearOrderly = TRUE; - - return TPM_RC_SUCCESS; -} - -#endif // CC_Clear \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ClearControl.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ClearControl.c deleted file mode 100644 index 4bf2407e7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/ClearControl.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ClearControl_fp.h" - -#if CC_ClearControl // Conditional expansion of this file - -/*(See part 3 specification) -// Enable or disable the execution of TPM2_Clear command -*/ -// Return Type: TPM_RC -// TPM_RC_AUTH_FAIL authorization is not properly given -TPM_RC -TPM2_ClearControl( - ClearControl_In *in // IN: input parameter list - ) -{ - // The command needs NV update. - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Input Validation - - // LockoutAuth may be used to set disableLockoutClear to TRUE but not to FALSE - if(in->auth == TPM_RH_LOCKOUT && in->disable == NO) - return TPM_RC_AUTH_FAIL; - -// Internal Data Update - - if(in->disable == YES) - gp.disableClear = TRUE; - else - gp.disableClear = FALSE; - - // Record the change to NV - NV_SYNC_PERSISTENT(disableClear); - - return TPM_RC_SUCCESS; -} - -#endif // CC_ClearControl \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/CreatePrimary.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/CreatePrimary.c deleted file mode 100644 index b0c3c6d8c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/CreatePrimary.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "CreatePrimary_fp.h" - -#if CC_CreatePrimary // Conditional expansion of this file - -/*(See part 3 specification) -// Creates a primary or temporary object from a primary seed. -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES sensitiveDataOrigin is CLEAR when sensitive.data is an -// Empty Buffer 'fixedTPM', 'fixedParent', or -// 'encryptedDuplication' attributes are inconsistent -// between themselves or with those of the parent object; -// inconsistent 'restricted', 'decrypt' and 'sign' -// attributes -// attempt to inject sensitive data for an asymmetric -// key; -// TPM_RC_KDF incorrect KDF specified for decrypting keyed hash -// object -// TPM_RC_KEY a provided symmetric key value is not allowed -// TPM_RC_OBJECT_MEMORY there is no free slot for the object -// TPM_RC_SCHEME inconsistent attributes 'decrypt', 'sign', -// 'restricted' and key's scheme ID; or hash algorithm is -// inconsistent with the scheme ID for keyed hash object -// TPM_RC_SIZE size of public authorization policy or sensitive -// authorization value does not match digest size of the -// name algorithm; or sensitive data size for the keyed -// hash object is larger than is allowed for the scheme -// TPM_RC_SYMMETRIC a storage key with no symmetric algorithm specified; -// or non-storage key with symmetric algorithm different -// from TPM_ALG_NULL -// TPM_RC_TYPE unknown object type -TPM_RC -TPM2_CreatePrimary( - CreatePrimary_In *in, // IN: input parameter list - CreatePrimary_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - TPMT_PUBLIC *publicArea; - DRBG_STATE rand; - OBJECT *newObject; - TPM2B_NAME name; - -// Input Validation - // Will need a place to put the result - newObject = FindEmptyObjectSlot(&out->objectHandle); - if(newObject == NULL) - return TPM_RC_OBJECT_MEMORY; - // Get the address of the public area in the new object - // (this is just to save typing) - publicArea = &newObject->publicArea; - - *publicArea = in->inPublic.publicArea; - - // Check attributes in input public area. CreateChecks() checks the things that - // are unique to creation and then validates the attributes and values that are - // common to create and load. - result = CreateChecks(NULL, publicArea, - in->inSensitive.sensitive.data.t.size); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_CreatePrimary_inPublic); - // Validate the sensitive area values - if(!AdjustAuthSize(&in->inSensitive.sensitive.userAuth, - publicArea->nameAlg)) - return TPM_RCS_SIZE + RC_CreatePrimary_inSensitive; -// Command output - // Compute the name using out->name as a scratch area (this is not the value - // that ultimately will be returned, then instantiate the state that will be - // used as a random number generator during the object creation. - // The caller does not know the seed values so the actual name does not have - // to be over the input, it can be over the unmarshaled structure. - result = DRBG_InstantiateSeeded(&rand, - &HierarchyGetPrimarySeed(in->primaryHandle)->b, - PRIMARY_OBJECT_CREATION, - (TPM2B *)PublicMarshalAndComputeName(publicArea, &name), - &in->inSensitive.sensitive.data.b); - if(result == TPM_RC_SUCCESS) - { - newObject->attributes.primary = SET; - if(in->primaryHandle == TPM_RH_ENDORSEMENT) - newObject->attributes.epsHierarchy = SET; - - // Create the primary object. - result = CryptCreateObject(newObject, &in->inSensitive.sensitive, - (RAND_STATE *)&rand); - } - if(result != TPM_RC_SUCCESS) - return result; - - // Set the publicArea and name from the computed values - out->outPublic.publicArea = newObject->publicArea; - out->name = newObject->name; - - // Fill in creation data - FillInCreationData(in->primaryHandle, publicArea->nameAlg, - &in->creationPCR, &in->outsideInfo, &out->creationData, - &out->creationHash); - - // Compute creation ticket - TicketComputeCreation(EntityGetHierarchy(in->primaryHandle), &out->name, - &out->creationHash, &out->creationTicket); - - // Set the remaining attributes for a loaded object - ObjectSetLoadedAttributes(newObject, in->primaryHandle); - return result; -} - -#endif // CC_CreatePrimary \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/HierarchyChangeAuth.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/HierarchyChangeAuth.c deleted file mode 100644 index db398f531..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/HierarchyChangeAuth.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "HierarchyChangeAuth_fp.h" - -#if CC_HierarchyChangeAuth // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// Set a hierarchy authValue -*/ -// Return Type: TPM_RC -// TPM_RC_SIZE 'newAuth' size is greater than that of integrity hash -// digest -TPM_RC -TPM2_HierarchyChangeAuth( - HierarchyChangeAuth_In *in // IN: input parameter list - ) -{ - // The command needs NV update. - RETURN_IF_NV_IS_NOT_AVAILABLE; - - // Make sure that the authorization value is a reasonable size (not larger than - // the size of the digest produced by the integrity hash. The integrity - // hash is assumed to produce the longest digest of any hash implemented - // on the TPM. This will also remove trailing zeros from the authValue. - if(MemoryRemoveTrailingZeros(&in->newAuth) > CONTEXT_INTEGRITY_HASH_SIZE) - return TPM_RCS_SIZE + RC_HierarchyChangeAuth_newAuth; - - // Set hierarchy authValue - switch(in->authHandle) - { - case TPM_RH_OWNER: - gp.ownerAuth = in->newAuth; - NV_SYNC_PERSISTENT(ownerAuth); - break; - case TPM_RH_ENDORSEMENT: - gp.endorsementAuth = in->newAuth; - NV_SYNC_PERSISTENT(endorsementAuth); - break; - case TPM_RH_PLATFORM: - gc.platformAuth = in->newAuth; - // orderly state should be cleared - g_clearOrderly = TRUE; - break; - case TPM_RH_LOCKOUT: - gp.lockoutAuth = in->newAuth; - NV_SYNC_PERSISTENT(lockoutAuth); - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_HierarchyChangeAuth \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/HierarchyControl.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/HierarchyControl.c deleted file mode 100644 index 5e1b527d4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/HierarchyControl.c +++ /dev/null @@ -1,144 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "HierarchyControl_fp.h" - -#if CC_HierarchyControl // Conditional expansion of this file - -/*(See part 3 specification) -// Enable or disable use of a hierarchy -*/ -// Return Type: TPM_RC -// TPM_RC_AUTH_TYPE 'authHandle' is not applicable to 'hierarchy' in its -// current state -TPM_RC -TPM2_HierarchyControl( - HierarchyControl_In *in // IN: input parameter list - ) -{ - BOOL select = (in->state == YES); - BOOL *selected = NULL; - -// Input Validation - switch(in->enable) - { - // Platform hierarchy has to be disabled by PlatformAuth - // If the platform hierarchy has already been disabled, only a reboot - // can enable it again - case TPM_RH_PLATFORM: - case TPM_RH_PLATFORM_NV: - if(in->authHandle != TPM_RH_PLATFORM) - return TPM_RC_AUTH_TYPE; - break; - - // ShEnable may be disabled if PlatformAuth/PlatformPolicy or - // OwnerAuth/OwnerPolicy is provided. If ShEnable is disabled, then it - // may only be enabled if PlatformAuth/PlatformPolicy is provided. - case TPM_RH_OWNER: - if(in->authHandle != TPM_RH_PLATFORM - && in->authHandle != TPM_RH_OWNER) - return TPM_RC_AUTH_TYPE; - if(gc.shEnable == FALSE && in->state == YES - && in->authHandle != TPM_RH_PLATFORM) - return TPM_RC_AUTH_TYPE; - break; - - // EhEnable may be disabled if either PlatformAuth/PlatformPolicy or - // EndosementAuth/EndorsementPolicy is provided. If EhEnable is disabled, - // then it may only be enabled if PlatformAuth/PlatformPolicy is - // provided. - case TPM_RH_ENDORSEMENT: - if(in->authHandle != TPM_RH_PLATFORM - && in->authHandle != TPM_RH_ENDORSEMENT) - return TPM_RC_AUTH_TYPE; - if(gc.ehEnable == FALSE && in->state == YES - && in->authHandle != TPM_RH_PLATFORM) - return TPM_RC_AUTH_TYPE; - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - -// Internal Data Update - - // Enable or disable the selected hierarchy - // Note: the authorization processing for this command may keep these - // command actions from being executed. For example, if phEnable is - // CLEAR, then platformAuth cannot be used for authorization. This - // means that would not be possible to use platformAuth to change the - // state of phEnable from CLEAR to SET. - // If it is decided that platformPolicy can still be used when phEnable - // is CLEAR, then this code could SET phEnable when proper platform - // policy is provided. - switch(in->enable) - { - case TPM_RH_OWNER: - selected = &gc.shEnable; - break; - case TPM_RH_ENDORSEMENT: - selected = &gc.ehEnable; - break; - case TPM_RH_PLATFORM: - selected = &g_phEnable; - break; - case TPM_RH_PLATFORM_NV: - selected = &gc.phEnableNV; - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - if(selected != NULL && *selected != select) - { - // Before changing the internal state, make sure that NV is available. - // Only need to update NV if changing the orderly state - RETURN_IF_ORDERLY; - - // state is changing and NV is available so modify - *selected = select; - // If a hierarchy was just disabled, flush it - if(select == CLEAR && in->enable != TPM_RH_PLATFORM_NV) - // Flush hierarchy - ObjectFlushHierarchy(in->enable); - - // orderly state should be cleared because of the update to state clear data - // This gets processed in ExecuteCommand() on the way out. - g_clearOrderly = TRUE; - } - return TPM_RC_SUCCESS; -} - -#endif // CC_HierarchyControl \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/SetPrimaryPolicy.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/SetPrimaryPolicy.c deleted file mode 100644 index e51fe1501..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Hierarchy/SetPrimaryPolicy.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "SetPrimaryPolicy_fp.h" - -#if CC_SetPrimaryPolicy // Conditional expansion of this file - -/*(See part 3 specification) -// Set a hierarchy policy -*/ -// Return Type: TPM_RC -// TPM_RC_SIZE size of input authPolicy is not consistent with -// input hash algorithm -TPM_RC -TPM2_SetPrimaryPolicy( - SetPrimaryPolicy_In *in // IN: input parameter list - ) -{ -// Input Validation - - // Check the authPolicy consistent with hash algorithm. If the policy size is - // zero, then the algorithm is required to be TPM_ALG_NULL - if(in->authPolicy.t.size != CryptHashGetDigestSize(in->hashAlg)) - return TPM_RCS_SIZE + RC_SetPrimaryPolicy_authPolicy; - - // The command need NV update for OWNER and ENDORSEMENT hierarchy, and - // might need orderlyState update for PLATFROM hierarchy. - // Check if NV is available. A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE - // error may be returned at this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Internal Data Update - - // Set hierarchy policy - switch(in->authHandle) - { - case TPM_RH_OWNER: - gp.ownerAlg = in->hashAlg; - gp.ownerPolicy = in->authPolicy; - NV_SYNC_PERSISTENT(ownerAlg); - NV_SYNC_PERSISTENT(ownerPolicy); - break; - case TPM_RH_ENDORSEMENT: - gp.endorsementAlg = in->hashAlg; - gp.endorsementPolicy = in->authPolicy; - NV_SYNC_PERSISTENT(endorsementAlg); - NV_SYNC_PERSISTENT(endorsementPolicy); - break; - case TPM_RH_PLATFORM: - gc.platformAlg = in->hashAlg; - gc.platformPolicy = in->authPolicy; - // need to update orderly state - g_clearOrderly = TRUE; - break; - case TPM_RH_LOCKOUT: - gp.lockoutAlg = in->hashAlg; - gp.lockoutPolicy = in->authPolicy; - NV_SYNC_PERSISTENT(lockoutAlg); - NV_SYNC_PERSISTENT(lockoutPolicy); - break; - - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_SetPrimaryPolicy \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Misc/PP_Commands.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Misc/PP_Commands.c deleted file mode 100644 index 6365bf7a9..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Misc/PP_Commands.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PP_Commands_fp.h" - -#if CC_PP_Commands // Conditional expansion of this file - -/*(See part 3 specification) -// This command is used to determine which commands require assertion of -// Physical Presence in addition to platformAuth/platformPolicy. -*/ -TPM_RC -TPM2_PP_Commands( - PP_Commands_In *in // IN: input parameter list - ) -{ - UINT32 i; - - // The command needs NV update. Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Internal Data Update - - // Process set list - for(i = 0; i < in->setList.count; i++) - // If command is implemented, set it as PP required. If the input - // command is not a PP command, it will be ignored at - // PhysicalPresenceCommandSet(). - // Note: PhysicalPresenceCommandSet() checks if the command is implemented. - PhysicalPresenceCommandSet(in->setList.commandCodes[i]); - - // Process clear list - for(i = 0; i < in->clearList.count; i++) - // If command is implemented, clear it as PP required. If the input - // command is not a PP command, it will be ignored at - // PhysicalPresenceCommandClear(). If the input command is - // TPM2_PP_Commands, it will be ignored as well - PhysicalPresenceCommandClear(in->clearList.commandCodes[i]); - - // Save the change of PP list - NV_SYNC_PERSISTENT(ppList); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PP_Commands \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Misc/SetAlgorithmSet.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Misc/SetAlgorithmSet.c deleted file mode 100644 index 5df8ebe5c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Misc/SetAlgorithmSet.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "SetAlgorithmSet_fp.h" - -#if CC_SetAlgorithmSet // Conditional expansion of this file - -/*(See part 3 specification) -// This command allows the platform to change the algorithm set setting of the TPM -*/ -TPM_RC -TPM2_SetAlgorithmSet( - SetAlgorithmSet_In *in // IN: input parameter list - ) -{ - // The command needs NV update. Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Internal Data Update - gp.algorithmSet = in->algorithmSet; - - // Write the algorithm set changes to NV - NV_SYNC_PERSISTENT(algorithmSet); - - return TPM_RC_SUCCESS; -} - -#endif // CC_SetAlgorithmSet \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Certify.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Certify.c deleted file mode 100644 index 6bd424766..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Certify.c +++ /dev/null @@ -1,141 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Attest_spt_fp.h" -#include "NV_Certify_fp.h" - -#if CC_NV_Certify // Conditional expansion of this file - -/*(See part 3 specification) -// certify the contents of an NV index or portion of an NV index -*/ -// Return Type: TPM_RC -// TPM_RC_NV_AUTHORIZATION the authorization was valid but the -// authorizing entity ('authHandle') -// is not allowed to read from the Index -// referenced by 'nvIndex' -// TPM_RC_KEY 'signHandle' does not reference a signing -// key -// TPM_RC_NV_LOCKED Index referenced by 'nvIndex' is locked -// for reading -// TPM_RC_NV_RANGE 'offset' plus 'size' extends outside of the -// data range of the Index referenced by -// 'nvIndex' -// TPM_RC_NV_UNINITIALIZED Index referenced by 'nvIndex' has not been -// written -// TPM_RC_SCHEME 'inScheme' is not an allowed value for the -// key definition -TPM_RC -TPM2_NV_Certify( - NV_Certify_In *in, // IN: input parameter list - NV_Certify_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - TPMS_ATTEST certifyInfo; - OBJECT *signObject = HandleToObject(in->signHandle); -// Input Validation - if(!IsSigningObject(signObject)) - return TPM_RCS_KEY + RC_NV_Certify_signHandle; - if(!CryptSelectSignScheme(signObject, &in->inScheme)) - return TPM_RCS_SCHEME + RC_NV_Certify_inScheme; - - // Common access checks, NvWriteAccessCheck() may return TPM_RC_NV_AUTHORIZATION - // or TPM_RC_NV_LOCKED - result = NvReadAccessChecks(in->authHandle, in->nvIndex, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - - // make sure that the selection is within the range of the Index (cast to avoid - // any wrap issues with addition) - if((UINT32)in->size + (UINT32)in->offset > (UINT32)nvIndex->publicArea.dataSize) - return TPM_RC_NV_RANGE; - // Make sure the data will fit the return buffer. - // NOTE: This check may be modified if the output buffer will not hold the - // maximum sized NV buffer as part of the certified data. The difference in - // size could be substantial if the signature scheme was produced a large - // signature (e.g., RSA 4096). - if(in->size > MAX_NV_BUFFER_SIZE) - return TPM_RCS_VALUE + RC_NV_Certify_size; - -// Command Output - - // Fill in attest information common fields - FillInAttestInfo(in->signHandle, &in->inScheme, &in->qualifyingData, - &certifyInfo); - - // Get the name of the index - NvGetIndexName(nvIndex, &certifyInfo.attested.nv.indexName); - - // See if this is old format or new format - if ((in->size != 0) || (in->offset != 0)) - { - // NV certify specific fields - // Attestation type - certifyInfo.type = TPM_ST_ATTEST_NV; - - // Set the return size - certifyInfo.attested.nv.nvContents.t.size = in->size; - - // Set the offset - certifyInfo.attested.nv.offset = in->offset; - - // Perform the read - NvGetIndexData(nvIndex, locator, in->offset, in->size, - certifyInfo.attested.nv.nvContents.t.buffer); - } - else - { - HASH_STATE hashState; - // This is to sign a digest of the data - certifyInfo.type = TPM_ST_ATTEST_NV_DIGEST; - // Initialize the hash before calling the function to add the Index data to - // the hash. - certifyInfo.attested.nvDigest.nvDigest.t.size = - CryptHashStart(&hashState, in->inScheme.details.any.hashAlg); - NvHashIndexData(&hashState, nvIndex, locator, 0, - nvIndex->publicArea.dataSize); - CryptHashEnd2B(&hashState, &certifyInfo.attested.nvDigest.nvDigest.b); - } - // Sign attestation structure. A NULL signature will be returned if - // signObject is NULL. - return SignAttestInfo(signObject, &in->inScheme, &certifyInfo, - &in->qualifyingData, &out->certifyInfo, &out->signature); -} - -#endif // CC_NV_Certify \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ChangeAuth.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ChangeAuth.c deleted file mode 100644 index 5cb2a69e6..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ChangeAuth.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_ChangeAuth_fp.h" - -#if CC_NV_ChangeAuth // Conditional expansion of this file - -/*(See part 3 specification) -// change authorization value of a NV index -*/ -// Return Type: TPM_RC -// TPM_RC_SIZE 'newAuth' size is larger than the digest -// size of the Name algorithm for the Index -// referenced by 'nvIndex -TPM_RC -TPM2_NV_ChangeAuth( - NV_ChangeAuth_In *in // IN: input parameter list - ) -{ - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - -// Input Validation - - // Remove trailing zeros and make sure that the result is not larger than the - // digest of the nameAlg. - if(MemoryRemoveTrailingZeros(&in->newAuth) - > CryptHashGetDigestSize(nvIndex->publicArea.nameAlg)) - return TPM_RCS_SIZE + RC_NV_ChangeAuth_newAuth; - -// Internal Data Update - // Change authValue - return NvWriteIndexAuth(locator, &in->newAuth); -} - -#endif // CC_NV_ChangeAuth \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace.c deleted file mode 100644 index 45e1dc107..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_DefineSpace.c +++ /dev/null @@ -1,226 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_DefineSpace_fp.h" - -#if CC_NV_DefineSpace // Conditional expansion of this file - -/*(See part 3 specification) -// Define a NV index space -*/ -// Return Type: TPM_RC -// TPM_RC_HIERARCHY for authorizations using TPM_RH_PLATFORM -// phEnable_NV is clear preventing access to NV -// data in the platform hierarchy. -// TPM_RC_ATTRIBUTES attributes of the index are not consistent -// TPM_RC_NV_DEFINED index already exists -// TPM_RC_NV_SPACE insufficient space for the index -// TPM_RC_SIZE 'auth->size' or 'publicInfo->authPolicy.size' is -// larger than the digest size of -// 'publicInfo->nameAlg'; or 'publicInfo->dataSize' -// is not consistent with 'publicInfo->attributes' -// (this includes the case when the index is -// larger than a MAX_NV_BUFFER_SIZE but the -// TPMA_NV_WRITEALL attribute is SET) -TPM_RC -TPM2_NV_DefineSpace( - NV_DefineSpace_In *in // IN: input parameter list - ) -{ - TPMA_NV attributes = in->publicInfo.nvPublic.attributes; - UINT16 nameSize; - - nameSize = CryptHashGetDigestSize(in->publicInfo.nvPublic.nameAlg); - -// Input Validation - - // Checks not specific to type - - // If the UndefineSpaceSpecial command is not implemented, then can't have - // an index that can only be deleted with policy -#if CC_NV_UndefineSpaceSpecial == NO - if(IS_ATTRIBUTE(attributes, TPMA_NV, POLICY_DELETE)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; -#endif - - // check that the authPolicy consistent with hash algorithm - - if(in->publicInfo.nvPublic.authPolicy.t.size != 0 - && in->publicInfo.nvPublic.authPolicy.t.size != nameSize) - return TPM_RCS_SIZE + RC_NV_DefineSpace_publicInfo; - - // make sure that the authValue is not too large - if(MemoryRemoveTrailingZeros(&in->auth) - > CryptHashGetDigestSize(in->publicInfo.nvPublic.nameAlg)) - return TPM_RCS_SIZE + RC_NV_DefineSpace_auth; - - // If an index is being created by the owner and shEnable is - // clear, then we would not reach this point because ownerAuth - // can't be given when shEnable is CLEAR. However, if phEnable - // is SET but phEnableNV is CLEAR, we have to check here - if(in->authHandle == TPM_RH_PLATFORM && gc.phEnableNV == CLEAR) - return TPM_RCS_HIERARCHY + RC_NV_DefineSpace_authHandle; - - // Attribute checks - // Eliminate the unsupported types - switch(GET_TPM_NT(attributes)) - { -#if CC_NV_Increment == YES - case TPM_NT_COUNTER: -#endif -#if CC_NV_SetBits == YES - case TPM_NT_BITS: -#endif -#if CC_NV_Extend == YES - case TPM_NT_EXTEND: -#endif -#if CC_PolicySecret == YES && defined TPM_NT_PIN_PASS - case TPM_NT_PIN_PASS: - case TPM_NT_PIN_FAIL: -#endif - case TPM_NT_ORDINARY: - break; - default: - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; - break; - } - // Check that the sizes are OK based on the type - switch(GET_TPM_NT(attributes)) - { - case TPM_NT_ORDINARY: - // Can't exceed the allowed size for the implementation - if(in->publicInfo.nvPublic.dataSize > MAX_NV_INDEX_SIZE) - return TPM_RCS_SIZE + RC_NV_DefineSpace_publicInfo; - break; - case TPM_NT_EXTEND: - if(in->publicInfo.nvPublic.dataSize != nameSize) - return TPM_RCS_SIZE + RC_NV_DefineSpace_publicInfo; - break; - default: - // Everything else needs a size of 8 - if(in->publicInfo.nvPublic.dataSize != 8) - return TPM_RCS_SIZE + RC_NV_DefineSpace_publicInfo; - break; - } - // Handle other specifics - switch(GET_TPM_NT(attributes)) - { - case TPM_NT_COUNTER: - // Counter can't have TPMA_NV_CLEAR_STCLEAR SET (don't clear counters) - if(IS_ATTRIBUTE(attributes, TPMA_NV, CLEAR_STCLEAR)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; - break; -#ifdef TPM_NT_PIN_FAIL - case TPM_NT_PIN_FAIL: - // NV_NO_DA must be SET and AUTHWRITE must be CLEAR - // NOTE: As with a PIN_PASS index, the authValue of the index is not - // available until the index is written. If AUTHWRITE is the only way to - // write then index, it could never be written. Rather than go through - // all of the other possible ways to write the Index, it is simply - // prohibited to write the index with the authValue. Other checks - // below will insure that there seems to be a way to write the index - // (i.e., with platform authorization , owner authorization, - // or with policyAuth.) - // It is not allowed to create a PIN Index that can't be modified. - if(!IS_ATTRIBUTE(attributes, TPMA_NV, NO_DA)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; -#endif -#ifdef TPM_NT_PIN_PASS - case TPM_NT_PIN_PASS: - // AUTHWRITE must be CLEAR (see note above to TPM_NT_PIN_FAIL) - if(IS_ATTRIBUTE(attributes, TPMA_NV, AUTHWRITE) - || IS_ATTRIBUTE(attributes, TPMA_NV, GLOBALLOCK) - || IS_ATTRIBUTE(attributes, TPMA_NV, WRITEDEFINE)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; -#endif // this comes before break because PIN_FAIL falls through - break; - default: - break; - } - - // Locks may not be SET and written cannot be SET - if(IS_ATTRIBUTE(attributes, TPMA_NV, WRITTEN) - || IS_ATTRIBUTE(attributes, TPMA_NV, WRITELOCKED) - || IS_ATTRIBUTE(attributes, TPMA_NV, READLOCKED)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; - - // There must be a way to read the index. - if(!IS_ATTRIBUTE(attributes, TPMA_NV, OWNERREAD) - && !IS_ATTRIBUTE(attributes, TPMA_NV, PPREAD) - && !IS_ATTRIBUTE(attributes, TPMA_NV, AUTHREAD) - && !IS_ATTRIBUTE(attributes, TPMA_NV, POLICYREAD)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; - - // There must be a way to write the index - if(!IS_ATTRIBUTE(attributes, TPMA_NV, OWNERWRITE) - && !IS_ATTRIBUTE(attributes, TPMA_NV, PPWRITE) - && !IS_ATTRIBUTE(attributes, TPMA_NV, AUTHWRITE) - && !IS_ATTRIBUTE(attributes, TPMA_NV, POLICYWRITE)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; - - // An index with TPMA_NV_CLEAR_STCLEAR can't have TPMA_NV_WRITEDEFINE SET - if(IS_ATTRIBUTE(attributes, TPMA_NV, CLEAR_STCLEAR) - && IS_ATTRIBUTE(attributes, TPMA_NV, WRITEDEFINE)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; - - // Make sure that the creator of the index can delete the index - if((IS_ATTRIBUTE(attributes, TPMA_NV, PLATFORMCREATE) - && in->authHandle == TPM_RH_OWNER) - || (!IS_ATTRIBUTE(attributes, TPMA_NV, PLATFORMCREATE) - && in->authHandle == TPM_RH_PLATFORM)) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_authHandle; - - // If TPMA_NV_POLICY_DELETE is SET, then the index must be defined by - // the platform - if(IS_ATTRIBUTE(attributes, TPMA_NV, POLICY_DELETE) - && TPM_RH_PLATFORM != in->authHandle) - return TPM_RCS_ATTRIBUTES + RC_NV_DefineSpace_publicInfo; - - // Make sure that the TPMA_NV_WRITEALL is not set if the index size is larger - // than the allowed NV buffer size. - if(in->publicInfo.nvPublic.dataSize > MAX_NV_BUFFER_SIZE - && IS_ATTRIBUTE(attributes, TPMA_NV, WRITEALL)) - return TPM_RCS_SIZE + RC_NV_DefineSpace_publicInfo; - - // And finally, see if the index is already defined. - if(NvIndexIsDefined(in->publicInfo.nvPublic.nvIndex)) - return TPM_RC_NV_DEFINED; - -// Internal Data Update - // define the space. A TPM_RC_NV_SPACE error may be returned at this point - return NvDefineIndex(&in->publicInfo.nvPublic, &in->auth); -} - -#endif // CC_NV_DefineSpace \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Extend.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Extend.c deleted file mode 100644 index 682d8d89f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Extend.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_Extend_fp.h" - -#if CC_NV_Extend // Conditional expansion of this file - -/*(See part 3 specification) -// Write to a NV index -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES the TPMA_NV_EXTEND attribute is not SET in -// the Index referenced by 'nvIndex' -// TPM_RC_NV_AUTHORIZATION the authorization was valid but the -// authorizing entity ('authHandle') -// is not allowed to write to the Index -// referenced by 'nvIndex' -// TPM_RC_NV_LOCKED the Index referenced by 'nvIndex' is locked -// for writing -TPM_RC -TPM2_NV_Extend( - NV_Extend_In *in // IN: input parameter list - ) -{ - TPM_RC result; - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - - TPM2B_DIGEST oldDigest; - TPM2B_DIGEST newDigest; - HASH_STATE hashState; - -// Input Validation - - // Common access checks, NvWriteAccessCheck() may return TPM_RC_NV_AUTHORIZATION - // or TPM_RC_NV_LOCKED - result = NvWriteAccessChecks(in->authHandle, - in->nvIndex, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - - // Make sure that this is an extend index - if(!IsNvExtendIndex(nvIndex->publicArea.attributes)) - return TPM_RCS_ATTRIBUTES + RC_NV_Extend_nvIndex; - -// Internal Data Update - - // Perform the write. - oldDigest.t.size = CryptHashGetDigestSize(nvIndex->publicArea.nameAlg); - pAssert(oldDigest.t.size <= sizeof(oldDigest.t.buffer)); - if(IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, WRITTEN)) - { - NvGetIndexData(nvIndex, locator, 0, oldDigest.t.size, oldDigest.t.buffer); - } - else - { - MemorySet(oldDigest.t.buffer, 0, oldDigest.t.size); - } - // Start hash - newDigest.t.size = CryptHashStart(&hashState, nvIndex->publicArea.nameAlg); - - // Adding old digest - CryptDigestUpdate2B(&hashState, &oldDigest.b); - - // Adding new data - CryptDigestUpdate2B(&hashState, &in->data.b); - - // Complete hash - CryptHashEnd2B(&hashState, &newDigest.b); - - // Write extended hash back. - // Note, this routine will SET the TPMA_NV_WRITTEN attribute if necessary - return NvWriteIndexData(nvIndex, 0, newDigest.t.size, newDigest.t.buffer); -} - -#endif // CC_NV_Extend \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_GlobalWriteLock.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_GlobalWriteLock.c deleted file mode 100644 index 53f983d8f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_GlobalWriteLock.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_GlobalWriteLock_fp.h" - -#if CC_NV_GlobalWriteLock // Conditional expansion of this file - -/*(See part 3 specification) -// Set global write lock for NV index -*/ -TPM_RC -TPM2_NV_GlobalWriteLock( - NV_GlobalWriteLock_In *in // IN: input parameter list - ) -{ - // Input parameter (the authorization handle) is not reference in command action. - NOT_REFERENCED(in); - -// Internal Data Update - - // Implementation dependent method of setting the global lock - return NvSetGlobalLock(); -} - -#endif // CC_NV_GlobalWriteLock \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Increment.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Increment.c deleted file mode 100644 index a42d11715..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Increment.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_Increment_fp.h" - -#if CC_NV_Increment // Conditional expansion of this file - -/*(See part 3 specification) -// Increment a NV counter -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES NV index is not a counter -// TPM_RC_NV_AUTHORIZATION authorization failure -// TPM_RC_NV_LOCKED Index is write locked -TPM_RC -TPM2_NV_Increment( - NV_Increment_In *in // IN: input parameter list - ) -{ - TPM_RC result; - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - UINT64 countValue; - -// Input Validation - - // Common access checks, NvWriteAccessCheck() may return TPM_RC_NV_AUTHORIZATION - // or TPM_RC_NV_LOCKED - result = NvWriteAccessChecks(in->authHandle, - in->nvIndex, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - - // Make sure that this is a counter - if(!IsNvCounterIndex(nvIndex->publicArea.attributes)) - return TPM_RCS_ATTRIBUTES + RC_NV_Increment_nvIndex; - -// Internal Data Update - - // If counter index is not been written, initialize it - if(!IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, WRITTEN)) - countValue = NvReadMaxCount(); - else - // Read NV data in native format for TPM CPU. - countValue = NvGetUINT64Data(nvIndex, locator); - - // Do the increment - countValue++; - - // Write NV data back. A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may - // be returned at this point. If necessary, this function will set the - // TPMA_NV_WRITTEN attribute - result = NvWriteUINT64Data(nvIndex, countValue); - if(result == TPM_RC_SUCCESS) - { - // If a counter just rolled over, then force the NV update. - // Note, if this is an orderly counter, then the write-back needs to be - // forced, for other counters, the write-back will happen anyway - if(IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, ORDERLY) - && (countValue & MAX_ORDERLY_COUNT) == 0 ) - { - // Need to force an NV update of orderly data - SET_NV_UPDATE(UT_ORDERLY); - } - } - return result; -} - -#endif // CC_NV_Increment \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Read.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Read.c deleted file mode 100644 index 745a7c666..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Read.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_Read_fp.h" - -#if CC_NV_Read // Conditional expansion of this file - -/*(See part 3 specification) -// Read of an NV index -*/ -// Return Type: TPM_RC -// TPM_RC_NV_AUTHORIZATION the authorization was valid but the -// authorizing entity ('authHandle') -// is not allowed to read from the Index -// referenced by 'nvIndex' -// TPM_RC_NV_LOCKED the Index referenced by 'nvIndex' is -// read locked -// TPM_RC_NV_RANGE read range defined by 'size' and 'offset' -// is outside the range of the Index referenced -// by 'nvIndex' -// TPM_RC_NV_UNINITIALIZED the Index referenced by 'nvIndex' has -// not been initialized (written) -// TPM_RC_VALUE the read size is larger than the -// MAX_NV_BUFFER_SIZE -TPM_RC -TPM2_NV_Read( - NV_Read_In *in, // IN: input parameter list - NV_Read_Out *out // OUT: output parameter list - ) -{ - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - TPM_RC result; - -// Input Validation - // Common read access checks. NvReadAccessChecks() may return - // TPM_RC_NV_AUTHORIZATION, TPM_RC_NV_LOCKED, or TPM_RC_NV_UNINITIALIZED - result = NvReadAccessChecks(in->authHandle, in->nvIndex, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - - // Make sure the data will fit the return buffer - if(in->size > MAX_NV_BUFFER_SIZE) - return TPM_RCS_VALUE + RC_NV_Read_size; - - // Verify that the offset is not too large - if(in->offset > nvIndex->publicArea.dataSize) - return TPM_RCS_VALUE + RC_NV_Read_offset; - - // Make sure that the selection is within the range of the Index - if(in->size > (nvIndex->publicArea.dataSize - in->offset)) - return TPM_RC_NV_RANGE; - -// Command Output - // Set the return size - out->data.t.size = in->size; - - // Perform the read - NvGetIndexData(nvIndex, locator, in->offset, in->size, out->data.t.buffer); - - return TPM_RC_SUCCESS; -} - -#endif // CC_NV_Read \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ReadLock.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ReadLock.c deleted file mode 100644 index 776300f36..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ReadLock.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_ReadLock_fp.h" - -#if CC_NV_ReadLock // Conditional expansion of this file - -/*(See part 3 specification) -// Set read lock on a NV index -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES TPMA_NV_READ_STCLEAR is not SET so -// Index referenced by 'nvIndex' may not be -// write locked -// TPM_RC_NV_AUTHORIZATION the authorization was valid but the -// authorizing entity ('authHandle') -// is not allowed to read from the Index -// referenced by 'nvIndex' -TPM_RC -TPM2_NV_ReadLock( - NV_ReadLock_In *in // IN: input parameter list - ) -{ - TPM_RC result; - NV_REF locator; - // The referenced index has been checked multiple times before this is called - // so it must be present and will be loaded into cache - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - TPMA_NV nvAttributes = nvIndex->publicArea.attributes; - -// Input Validation - // Common read access checks. NvReadAccessChecks() may return - // TPM_RC_NV_AUTHORIZATION, TPM_RC_NV_LOCKED, or TPM_RC_NV_UNINITIALIZED - result = NvReadAccessChecks(in->authHandle, - in->nvIndex, - nvAttributes); - if(result == TPM_RC_NV_AUTHORIZATION) - return TPM_RC_NV_AUTHORIZATION; - // Index is already locked for write - else if(result == TPM_RC_NV_LOCKED) - return TPM_RC_SUCCESS; - - // If NvReadAccessChecks return TPM_RC_NV_UNINITALIZED, then continue. - // It is not an error to read lock an uninitialized Index. - - // if TPMA_NV_READ_STCLEAR is not set, the index can not be read-locked - if(!IS_ATTRIBUTE(nvAttributes, TPMA_NV, READ_STCLEAR)) - return TPM_RCS_ATTRIBUTES + RC_NV_ReadLock_nvIndex; - -// Internal Data Update - - // Set the READLOCK attribute - SET_ATTRIBUTE(nvAttributes, TPMA_NV, READLOCKED); - - // Write NV info back - return NvWriteIndexAttributes(nvIndex->publicArea.nvIndex, - locator, - nvAttributes); -} - -#endif // CC_NV_ReadLock \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic.c deleted file mode 100644 index 4f9ce320c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_ReadPublic.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_ReadPublic_fp.h" - -#if CC_NV_ReadPublic // Conditional expansion of this file - -/*(See part 3 specification) -// Read the public information of a NV index -*/ -TPM_RC -TPM2_NV_ReadPublic( - NV_ReadPublic_In *in, // IN: input parameter list - NV_ReadPublic_Out *out // OUT: output parameter list - ) -{ - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, NULL); - -// Command Output - - // Copy index public data to output - out->nvPublic.nvPublic = nvIndex->publicArea; - - // Compute NV name - NvGetIndexName(nvIndex, &out->nvName); - - return TPM_RC_SUCCESS; -} - -#endif // CC_NV_ReadPublic \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_SetBits.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_SetBits.c deleted file mode 100644 index 045872f9f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_SetBits.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_SetBits_fp.h" - -#if CC_NV_SetBits // Conditional expansion of this file - -/*(See part 3 specification) -// Set bits in a NV index -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES the TPMA_NV_BITS attribute is not SET in the -// Index referenced by 'nvIndex' -// TPM_RC_NV_AUTHORIZATION the authorization was valid but the -// authorizing entity ('authHandle') -// is not allowed to write to the Index -// referenced by 'nvIndex' -// TPM_RC_NV_LOCKED the Index referenced by 'nvIndex' is locked -// for writing -TPM_RC -TPM2_NV_SetBits( - NV_SetBits_In *in // IN: input parameter list - ) -{ - TPM_RC result; - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - UINT64 oldValue; - UINT64 newValue; - -// Input Validation - - // Common access checks, NvWriteAccessCheck() may return TPM_RC_NV_AUTHORIZATION - // or TPM_RC_NV_LOCKED - result = NvWriteAccessChecks(in->authHandle, - in->nvIndex, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - - // Make sure that this is a bit field - if(!IsNvBitsIndex(nvIndex->publicArea.attributes)) - return TPM_RCS_ATTRIBUTES + RC_NV_SetBits_nvIndex; - - // If index is not been written, initialize it - if(!IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, WRITTEN)) - oldValue = 0; - else - // Read index data - oldValue = NvGetUINT64Data(nvIndex, locator); - - // Figure out what the new value is going to be - newValue = oldValue | in->bits; - -// Internal Data Update - return NvWriteUINT64Data(nvIndex, newValue); -} - -#endif // CC_NV_SetBits \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpace.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpace.c deleted file mode 100644 index bfe3fa866..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpace.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_UndefineSpace_fp.h" - -#if CC_NV_UndefineSpace // Conditional expansion of this file - -/*(See part 3 specification) -// Delete an NV Index -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES TPMA_NV_POLICY_DELETE is SET in the Index -// referenced by 'nvIndex' so this command may -// not be used to delete this Index (see -// TPM2_NV_UndefineSpaceSpecial()) -// TPM_RC_NV_AUTHORIZATION attempt to use ownerAuth to delete an index -// created by the platform -// -TPM_RC -TPM2_NV_UndefineSpace( - NV_UndefineSpace_In *in // IN: input parameter list - ) -{ - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - -// Input Validation - // This command can't be used to delete an index with TPMA_NV_POLICY_DELETE SET - if(IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, POLICY_DELETE)) - return TPM_RCS_ATTRIBUTES + RC_NV_UndefineSpace_nvIndex; - - // The owner may only delete an index that was defined with ownerAuth. The - // platform may delete an index that was created with either authorization. - if(in->authHandle == TPM_RH_OWNER - && IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, PLATFORMCREATE)) - return TPM_RC_NV_AUTHORIZATION; - -// Internal Data Update - - // Call implementation dependent internal routine to delete NV index - return NvDeleteIndex(nvIndex, locator); -} - -#endif // CC_NV_UndefineSpace \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpaceSpecial.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpaceSpecial.c deleted file mode 100644 index b672a8cfe..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_UndefineSpaceSpecial.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_UndefineSpaceSpecial_fp.h" -#include "SessionProcess_fp.h" - -#if CC_NV_UndefineSpaceSpecial // Conditional expansion of this file - -/*(See part 3 specification) -// Delete a NV index that requires policy to delete. -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES TPMA_NV_POLICY_DELETE is not SET in the -// Index referenced by 'nvIndex' -TPM_RC -TPM2_NV_UndefineSpaceSpecial( - NV_UndefineSpaceSpecial_In *in // IN: input parameter list - ) -{ - TPM_RC result; - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); -// Input Validation - // This operation only applies when the TPMA_NV_POLICY_DELETE attribute is SET - if(!IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, POLICY_DELETE)) - return TPM_RCS_ATTRIBUTES + RC_NV_UndefineSpaceSpecial_nvIndex; -// Internal Data Update - // Call implementation dependent internal routine to delete NV index - result = NvDeleteIndex(nvIndex, locator); - - // If we just removed the index providing the authorization, make sure that the - // authorization session computation is modified so that it doesn't try to - // access the authValue of the just deleted index - if(result == TPM_RC_SUCCESS) - SessionRemoveAssociationToHandle(in->nvIndex); - return result; -} - -#endif // CC_NV_UndefineSpaceSpecial \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Write.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Write.c deleted file mode 100644 index 673868ad4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_Write.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_Write_fp.h" - -#if CC_NV_Write // Conditional expansion of this file - -/*(See part 3 specification) -// Write to a NV index -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES Index referenced by 'nvIndex' has either -// TPMA_NV_BITS, TPMA_NV_COUNTER, or -// TPMA_NV_EVENT attribute SET -// TPM_RC_NV_AUTHORIZATION the authorization was valid but the -// authorizing entity ('authHandle') -// is not allowed to write to the Index -// referenced by 'nvIndex' -// TPM_RC_NV_LOCKED Index referenced by 'nvIndex' is write -// locked -// TPM_RC_NV_RANGE if TPMA_NV_WRITEALL is SET then the write -// is not the size of the Index referenced by -// 'nvIndex'; otherwise, the write extends -// beyond the limits of the Index -// -TPM_RC -TPM2_NV_Write( - NV_Write_In *in // IN: input parameter list - ) -{ - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, NULL); - TPMA_NV attributes = nvIndex->publicArea.attributes; - TPM_RC result; - -// Input Validation - - // Common access checks, NvWriteAccessCheck() may return TPM_RC_NV_AUTHORIZATION - // or TPM_RC_NV_LOCKED - result = NvWriteAccessChecks(in->authHandle, - in->nvIndex, - attributes); - if(result != TPM_RC_SUCCESS) - return result; - - // Bits index, extend index or counter index may not be updated by - // TPM2_NV_Write - if(IsNvCounterIndex(attributes) - || IsNvBitsIndex(attributes) - || IsNvExtendIndex(attributes)) - return TPM_RC_ATTRIBUTES; - - // Make sure that the offset is not too large - if(in->offset > nvIndex->publicArea.dataSize) - return TPM_RCS_VALUE + RC_NV_Write_offset; - - // Make sure that the selection is within the range of the Index - if(in->data.t.size > (nvIndex->publicArea.dataSize - in->offset)) - return TPM_RC_NV_RANGE; - - // If this index requires a full sized write, make sure that input range is - // full sized. - // Note: if the requested size is the same as the Index data size, then offset - // will have to be zero. Otherwise, the range check above would have failed. - if(IS_ATTRIBUTE(attributes, TPMA_NV, WRITEALL) - && in->data.t.size < nvIndex->publicArea.dataSize) - return TPM_RC_NV_RANGE; - -// Internal Data Update - - // Perform the write. This called routine will SET the TPMA_NV_WRITTEN - // attribute if it has not already been SET. If NV isn't available, an error - // will be returned. - return NvWriteIndexData(nvIndex, in->offset, in->data.t.size, - in->data.t.buffer); -} - -#endif // CC_NV_Write \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_WriteLock.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_WriteLock.c deleted file mode 100644 index ec8d201de..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_WriteLock.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "NV_WriteLock_fp.h" - -#if CC_NV_WriteLock // Conditional expansion of this file - -/*(See part 3 specification) -// Set write lock on a NV index -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES neither TPMA_NV_WRITEDEFINE nor -// TPMA_NV_WRITE_STCLEAR is SET in Index -// referenced by 'nvIndex' -// TPM_RC_NV_AUTHORIZATION the authorization was valid but the -// authorizing entity ('authHandle') -// is not allowed to write to the Index -// referenced by 'nvIndex' -// -TPM_RC -TPM2_NV_WriteLock( - NV_WriteLock_In *in // IN: input parameter list - ) -{ - TPM_RC result; - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(in->nvIndex, &locator); - TPMA_NV nvAttributes = nvIndex->publicArea.attributes; - -// Input Validation: - - // Common access checks, NvWriteAccessCheck() may return TPM_RC_NV_AUTHORIZATION - // or TPM_RC_NV_LOCKED - result = NvWriteAccessChecks(in->authHandle, in->nvIndex, nvAttributes); - if(result != TPM_RC_SUCCESS) - { - if(result == TPM_RC_NV_AUTHORIZATION) - return result; - // If write access failed because the index is already locked, then it is - // no error. - return TPM_RC_SUCCESS; - } - // if neither TPMA_NV_WRITEDEFINE nor TPMA_NV_WRITE_STCLEAR is set, the index - // can not be write-locked - if(!IS_ATTRIBUTE(nvAttributes, TPMA_NV, WRITEDEFINE) - && !IS_ATTRIBUTE(nvAttributes, TPMA_NV, WRITE_STCLEAR)) - return TPM_RCS_ATTRIBUTES + RC_NV_WriteLock_nvIndex; -// Internal Data Update - // Set the WRITELOCK attribute. - // Note: if TPMA_NV_WRITELOCKED were already SET, then the write access check - // above would have failed and this code isn't executed. - SET_ATTRIBUTE(nvAttributes, TPMA_NV, WRITELOCKED); - - // Write index info back - return NvWriteIndexAttributes(nvIndex->publicArea.nvIndex, locator, - nvAttributes); -} - -#endif // CC_NV_WriteLock \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_spt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_spt.c deleted file mode 100644 index 605c343e3..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/NVStorage/NV_spt.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" -#include "NV_spt_fp.h" - -//** Functions - -//*** NvReadAccessChecks() -// Common routine for validating a read -// Used by TPM2_NV_Read, TPM2_NV_ReadLock and TPM2_PolicyNV -// Return Type: TPM_RC -// TPM_RC_NV_AUTHORIZATION autHandle is not allowed to authorize read -// of the index -// TPM_RC_NV_LOCKED Read locked -// TPM_RC_NV_UNINITIALIZED Try to read an uninitialized index -// -TPM_RC -NvReadAccessChecks( - TPM_HANDLE authHandle, // IN: the handle that provided the - // authorization - TPM_HANDLE nvHandle, // IN: the handle of the NV index to be read - TPMA_NV attributes // IN: the attributes of 'nvHandle' - ) -{ - // If data is read locked, returns an error - if(IS_ATTRIBUTE(attributes, TPMA_NV, READLOCKED)) - return TPM_RC_NV_LOCKED; - // If the authorization was provided by the owner or platform, then check - // that the attributes allow the read. If the authorization handle - // is the same as the index, then the checks were made when the authorization - // was checked.. - if(authHandle == TPM_RH_OWNER) - { - // If Owner provided authorization then ONWERWRITE must be SET - if(!IS_ATTRIBUTE(attributes, TPMA_NV, OWNERREAD)) - return TPM_RC_NV_AUTHORIZATION; - } - else if(authHandle == TPM_RH_PLATFORM) - { - // If Platform provided authorization then PPWRITE must be SET - if(!IS_ATTRIBUTE(attributes, TPMA_NV, PPREAD)) - return TPM_RC_NV_AUTHORIZATION; - } - // If neither Owner nor Platform provided authorization, make sure that it was - // provided by this index. - else if(authHandle != nvHandle) - return TPM_RC_NV_AUTHORIZATION; - -// If the index has not been written, then the value cannot be read -// NOTE: This has to come after other access checks to make sure that -// the proper authorization is given to TPM2_NV_ReadLock() - if(!IS_ATTRIBUTE(attributes, TPMA_NV, WRITTEN)) - return TPM_RC_NV_UNINITIALIZED; - - return TPM_RC_SUCCESS; -} - -//*** NvWriteAccessChecks() -// Common routine for validating a write -// Used by TPM2_NV_Write, TPM2_NV_Increment, TPM2_SetBits, and TPM2_NV_WriteLock -// Return Type: TPM_RC -// TPM_RC_NV_AUTHORIZATION Authorization fails -// TPM_RC_NV_LOCKED Write locked -// -TPM_RC -NvWriteAccessChecks( - TPM_HANDLE authHandle, // IN: the handle that provided the - // authorization - TPM_HANDLE nvHandle, // IN: the handle of the NV index to be written - TPMA_NV attributes // IN: the attributes of 'nvHandle' - ) -{ - // If data is write locked, returns an error - if(IS_ATTRIBUTE(attributes, TPMA_NV, WRITELOCKED)) - return TPM_RC_NV_LOCKED; - // If the authorization was provided by the owner or platform, then check - // that the attributes allow the write. If the authorization handle - // is the same as the index, then the checks were made when the authorization - // was checked.. - if(authHandle == TPM_RH_OWNER) - { - // If Owner provided authorization then ONWERWRITE must be SET - if(!IS_ATTRIBUTE(attributes, TPMA_NV, OWNERWRITE)) - return TPM_RC_NV_AUTHORIZATION; - } - else if(authHandle == TPM_RH_PLATFORM) - { - // If Platform provided authorization then PPWRITE must be SET - if(!IS_ATTRIBUTE(attributes, TPMA_NV, PPWRITE)) - return TPM_RC_NV_AUTHORIZATION; - } - // If neither Owner nor Platform provided authorization, make sure that it was - // provided by this index. - else if(authHandle != nvHandle) - return TPM_RC_NV_AUTHORIZATION; - return TPM_RC_SUCCESS; -} - -//*** NvClearOrderly() -// This function is used to cause gp.orderlyState to be cleared to the -// non-orderly state. -TPM_RC -NvClearOrderly( - void - ) -{ - if(gp.orderlyState < SU_DA_USED_VALUE) - RETURN_IF_NV_IS_NOT_AVAILABLE; - g_clearOrderly = TRUE; - return TPM_RC_SUCCESS; -} - -//*** NvIsPinPassIndex() -// Function to check to see if an NV index is a PIN Pass Index -// Return Type: BOOL -// TRUE(1) is pin pass -// FALSE(0) is not pin pass -BOOL -NvIsPinPassIndex( - TPM_HANDLE index // IN: Handle to check - ) -{ - if(HandleGetType(index) == TPM_HT_NV_INDEX) - { - NV_INDEX *nvIndex = NvGetIndexInfo(index, NULL); - - return IsNvPinPassIndex(nvIndex->publicArea.attributes); - } - return FALSE; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ActivateCredential.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ActivateCredential.c deleted file mode 100644 index ae644ce02..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ActivateCredential.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ActivateCredential_fp.h" - -#if CC_ActivateCredential // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// Activate Credential with an object -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'keyHandle' does not reference a decryption key -// TPM_RC_ECC_POINT 'secret' is invalid (when 'keyHandle' is an ECC key) -// TPM_RC_INSUFFICIENT 'secret' is invalid (when 'keyHandle' is an ECC key) -// TPM_RC_INTEGRITY 'credentialBlob' fails integrity test -// TPM_RC_NO_RESULT 'secret' is invalid (when 'keyHandle' is an ECC key) -// TPM_RC_SIZE 'secret' size is invalid or the 'credentialBlob' -// does not unmarshal correctly -// TPM_RC_TYPE 'keyHandle' does not reference an asymmetric key. -// TPM_RC_VALUE 'secret' is invalid (when 'keyHandle' is an RSA key) -TPM_RC -TPM2_ActivateCredential( - ActivateCredential_In *in, // IN: input parameter list - ActivateCredential_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - OBJECT *object; // decrypt key - OBJECT *activateObject; // key associated with credential - TPM2B_DATA data; // credential data - -// Input Validation - - // Get decrypt key pointer - object = HandleToObject(in->keyHandle); - - // Get certificated object pointer - activateObject = HandleToObject(in->activateHandle); - - // input decrypt key must be an asymmetric, restricted decryption key - if(!CryptIsAsymAlgorithm(object->publicArea.type) - || !IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, decrypt) - || !IS_ATTRIBUTE(object->publicArea.objectAttributes, - TPMA_OBJECT, restricted)) - return TPM_RCS_TYPE + RC_ActivateCredential_keyHandle; - -// Command output - - // Decrypt input credential data via asymmetric decryption. A - // TPM_RC_VALUE, TPM_RC_KEY or unmarshal errors may be returned at this - // point - result = CryptSecretDecrypt(object, NULL, IDENTITY_STRING, &in->secret, &data); - if(result != TPM_RC_SUCCESS) - { - if(result == TPM_RC_KEY) - return TPM_RC_FAILURE; - return RcSafeAddToResult(result, RC_ActivateCredential_secret); - } - - // Retrieve secret data. A TPM_RC_INTEGRITY error or unmarshal - // errors may be returned at this point - result = CredentialToSecret(&in->credentialBlob.b, - &activateObject->name.b, - &data.b, - object, - &out->certInfo); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_ActivateCredential_credentialBlob); - - return TPM_RC_SUCCESS; -} - -#endif // CC_ActivateCredential \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Create.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Create.c deleted file mode 100644 index 392ec7863..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Create.c +++ /dev/null @@ -1,155 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Object_spt_fp.h" -#include "Create_fp.h" - -#if CC_Create // Conditional expansion of this file - -/*(See part 3 specification) -// Create a regular object -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'sensitiveDataOrigin' is CLEAR when 'sensitive.data' -// is an Empty Buffer, or is SET when 'sensitive.data' is -// not empty; -// 'fixedTPM', 'fixedParent', or 'encryptedDuplication' -// attributes are inconsistent between themselves or with -// those of the parent object; -// inconsistent 'restricted', 'decrypt' and 'sign' -// attributes; -// attempt to inject sensitive data for an asymmetric -// key; -// TPM_RC_HASH non-duplicable storage key and its parent have -// different name algorithm -// TPM_RC_KDF incorrect KDF specified for decrypting keyed hash -// object -// TPM_RC_KEY invalid key size values in an asymmetric key public -// area or a provided symmetric key has a value that is -// not allowed -// TPM_RC_KEY_SIZE key size in public area for symmetric key differs from -// the size in the sensitive creation area; may also be -// returned if the TPM does not allow the key size to be -// used for a Storage Key -// TPM_RC_OBJECT_MEMORY a free slot is not available as scratch memory for -// object creation -// TPM_RC_RANGE the exponent value of an RSA key is not supported. -// TPM_RC_SCHEME inconsistent attributes 'decrypt', 'sign', or -// 'restricted' and key's scheme ID; or hash algorithm is -// inconsistent with the scheme ID for keyed hash object -// TPM_RC_SIZE size of public authPolicy or sensitive authValue does -// not match digest size of the name algorithm -// sensitive data size for the keyed hash object is -// larger than is allowed for the scheme -// TPM_RC_SYMMETRIC a storage key with no symmetric algorithm specified; -// or non-storage key with symmetric algorithm different -// from ALG_NULL -// TPM_RC_TYPE unknown object type; -// 'parentHandle' does not reference a restricted -// decryption key in the storage hierarchy with both -// public and sensitive portion loaded -// TPM_RC_VALUE exponent is not prime or could not find a prime using -// the provided parameters for an RSA key; -// unsupported name algorithm for an ECC key -// TPM_RC_OBJECT_MEMORY there is no free slot for the object -TPM_RC -TPM2_Create( - Create_In *in, // IN: input parameter list - Create_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - OBJECT *parentObject; - OBJECT *newObject; - TPMT_PUBLIC *publicArea; - -// Input Validation - parentObject = HandleToObject(in->parentHandle); - pAssert(parentObject != NULL); - - // Does parent have the proper attributes? - if(!ObjectIsParent(parentObject)) - return TPM_RCS_TYPE + RC_Create_parentHandle; - - // Get a slot for the creation - newObject = FindEmptyObjectSlot(NULL); - if(newObject == NULL) - return TPM_RC_OBJECT_MEMORY; - // If the TPM2B_PUBLIC was passed as a structure, marshal it into is canonical - // form for processing - - // to save typing. - publicArea = &newObject->publicArea; - - // Copy the input structure to the allocated structure - *publicArea = in->inPublic.publicArea; - - // Check attributes in input public area. CreateChecks() checks the things that - // are unique to creation and then validates the attributes and values that are - // common to create and load. - result = CreateChecks(parentObject, publicArea, - in->inSensitive.sensitive.data.t.size); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_Create_inPublic); - // Clean up the authValue if necessary - if(!AdjustAuthSize(&in->inSensitive.sensitive.userAuth, publicArea->nameAlg)) - return TPM_RCS_SIZE + RC_Create_inSensitive; - -// Command Output - // Create the object using the default TPM random-number generator - result = CryptCreateObject(newObject, &in->inSensitive.sensitive, NULL); - if(result != TPM_RC_SUCCESS) - return result; - // Fill in creation data - FillInCreationData(in->parentHandle, publicArea->nameAlg, - &in->creationPCR, &in->outsideInfo, - &out->creationData, &out->creationHash); - - // Compute creation ticket - TicketComputeCreation(EntityGetHierarchy(in->parentHandle), &newObject->name, - &out->creationHash, &out->creationTicket); - - // Prepare output private data from sensitive - SensitiveToPrivate(&newObject->sensitive, &newObject->name, parentObject, - publicArea->nameAlg, - &out->outPrivate); - - // Finish by copying the remaining return values - out->outPublic.publicArea = newObject->publicArea; - - return TPM_RC_SUCCESS; -} - -#endif // CC_Create \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/CreateLoaded.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/CreateLoaded.c deleted file mode 100644 index d58a3cd78..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/CreateLoaded.c +++ /dev/null @@ -1,221 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "CreateLoaded_fp.h" - -#if CC_CreateLoaded // Conditional expansion of this file - -/*(See part 3 of specification) - * Create and load any type of key, including a temporary key. - * The input template is an marshaled public area rather than an unmarshaled one as - * used in Create and CreatePrimary. This is so that the label and context that - * could be in the template can be processed without changing the formats for the - * calls to Create and CreatePrimary. -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'sensitiveDataOrigin' is CLEAR when 'sensitive.data' -// is an Empty Buffer; -// 'fixedTPM', 'fixedParent', or 'encryptedDuplication' -// attributes are inconsistent between themselves or with -// those of the parent object; -// inconsistent 'restricted', 'decrypt' and 'sign' -// attributes; -// attempt to inject sensitive data for an asymmetric -// key; -// attempt to create a symmetric cipher key that is not -// a decryption key -// TPM_RC_KDF incorrect KDF specified for decrypting keyed hash -// object -// TPM_RC_KEY the value of a provided symmetric key is not allowed -// TPM_RC_OBJECT_MEMORY there is no free slot for the object -// TPM_RC_SCHEME inconsistent attributes 'decrypt', 'sign', -// 'restricted' and key's scheme ID; or hash algorithm is -// inconsistent with the scheme ID for keyed hash object -// TPM_RC_SIZE size of public authorization policy or sensitive -// authorization value does not match digest size of the -// name algorithm sensitive data size for the keyed hash -// object is larger than is allowed for the scheme -// TPM_RC_SYMMETRIC a storage key with no symmetric algorithm specified; -// or non-storage key with symmetric algorithm different -// from TPM_ALG_NULL -// TPM_RC_TYPE cannot create the object of the indicated type -// (usually only occurs if trying to derive an RSA key). -TPM_RC -TPM2_CreateLoaded( - CreateLoaded_In *in, // IN: input parameter list - CreateLoaded_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - OBJECT *parent = HandleToObject(in->parentHandle); - OBJECT *newObject; - BOOL derivation; - TPMT_PUBLIC *publicArea; - RAND_STATE randState; - RAND_STATE *rand = &randState; - TPMS_DERIVE labelContext; - -// Input Validation - - // How the public area is unmarshaled is determined by the parent, so - // see if parent is a derivation parent - derivation = (parent != NULL && parent->attributes.derivation); - - // If the parent is an object, then make sure that it is either a parent or - // derivation parent - if(parent != NULL && !parent->attributes.isParent && !derivation) - return TPM_RCS_TYPE + RC_CreateLoaded_parentHandle; - - // Get a spot in which to create the newObject - newObject = FindEmptyObjectSlot(&out->objectHandle); - if(newObject == NULL) - return TPM_RC_OBJECT_MEMORY; - - // Do this to save typing - publicArea = &newObject->publicArea; - - // Unmarshal the template into the object space. TPM2_Create() and - // TPM2_CreatePrimary() have the publicArea unmarshaled by CommandDispatcher. - // This command is different because of an unfortunate property of the - // unique field of an ECC key. It is a structure rather than a single TPM2B. If - // if had been a TPM2B, then the label and context could be within a TPM2B and - // unmarshaled like other public areas. Since it is not, this command needs its - // on template that is a TPM2B that is unmarshaled as a BYTE array with a - // its own unmarshal function. - result = UnmarshalToPublic(publicArea, &in->inPublic, derivation, - &labelContext); - if(result != TPM_RC_SUCCESS) - return result + RC_CreateLoaded_inPublic; - - // Validate that the authorization size is appropriate - if(!AdjustAuthSize(&in->inSensitive.sensitive.userAuth, publicArea->nameAlg)) - return TPM_RCS_SIZE + RC_CreateLoaded_inSensitive; - - // Command output - if(derivation) - { - TPMT_KEYEDHASH_SCHEME *scheme; - scheme = &parent->publicArea.parameters.keyedHashDetail.scheme; - - // SP800-108 is the only KDF supported by this implementation and there is - // no default hash algorithm. - pAssert(scheme->details.xor.hashAlg != TPM_ALG_NULL - && scheme->details.xor.kdf == TPM_ALG_KDF1_SP800_108); - // Don't derive RSA keys - if(publicArea->type == ALG_RSA_VALUE) - return TPM_RCS_TYPE + RC_CreateLoaded_inPublic; - // sensitiveDataOrigin has to be CLEAR in a derived object. Since this - // is specific to a derived object, it is checked here. - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, - sensitiveDataOrigin)) - return TPM_RCS_ATTRIBUTES; - // Check the reset of the attributes - result = PublicAttributesValidation(parent, publicArea); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_CreateLoaded_inPublic); - // Process the template and sensitive areas to get the actual 'label' and - // 'context' values to be used for this derivation. - result = SetLabelAndContext(&labelContext, &in->inSensitive.sensitive.data); - if(result != TPM_RC_SUCCESS) - return result; - // Set up the KDF for object generation - DRBG_InstantiateSeededKdf((KDF_STATE *)rand, - scheme->details.xor.hashAlg, - scheme->details.xor.kdf, - &parent->sensitive.sensitive.bits.b, - &labelContext.label.b, - &labelContext.context.b, - TPM_MAX_DERIVATION_BITS); - // Clear the sensitive size so that the creation functions will not try - // to use this value. - in->inSensitive.sensitive.data.t.size = 0; - } - else - { - // Check attributes in input public area. CreateChecks() checks the things - // that are unique to creation and then validates the attributes and values - // that are common to create and load. - result = CreateChecks(parent, publicArea, - in->inSensitive.sensitive.data.t.size); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_CreateLoaded_inPublic); - // Creating a primary object - if(parent == NULL) - { - TPM2B_NAME name; - newObject->attributes.primary = SET; - if(in->parentHandle == TPM_RH_ENDORSEMENT) - newObject->attributes.epsHierarchy = SET; - // If so, use the primary seed and the digest of the template - // to seed the DRBG - result = DRBG_InstantiateSeeded((DRBG_STATE *)rand, - &HierarchyGetPrimarySeed(in->parentHandle)->b, - PRIMARY_OBJECT_CREATION, - (TPM2B *)PublicMarshalAndComputeName(publicArea, - &name), - &in->inSensitive.sensitive.data.b); - if(result != TPM_RC_SUCCESS) - return result; - } - else - { - // This is an ordinary object so use the normal random number generator - rand = NULL; - } - } -// Internal data update - // Create the object - result = CryptCreateObject(newObject, &in->inSensitive.sensitive, rand); - if(result != TPM_RC_SUCCESS) - return result; - // if this is not a Primary key and not a derived key, then return the sensitive - // area - if(parent != NULL && !derivation) - // Prepare output private data from sensitive - SensitiveToPrivate(&newObject->sensitive, &newObject->name, - parent, newObject->publicArea.nameAlg, - &out->outPrivate); - else - out->outPrivate.t.size = 0; - // Set the remaining return values - out->outPublic.publicArea = newObject->publicArea; - out->name = newObject->name; - // Set the remaining attributes for a loaded object - ObjectSetLoadedAttributes(newObject, in->parentHandle); - - return result; -} - -#endif // CC_CreateLoaded \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Load.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Load.c deleted file mode 100644 index 86cea9685..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Load.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Load_fp.h" - -#if CC_Load // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// Load an ordinary or temporary object -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'inPulblic' attributes are not allowed with selected -// parent -// TPM_RC_BINDING 'inPrivate' and 'inPublic' are not -// cryptographically bound -// TPM_RC_HASH incorrect hash selection for signing key or -// the 'nameAlg' for 'inPubic is not valid -// TPM_RC_INTEGRITY HMAC on 'inPrivate' was not valid -// TPM_RC_KDF KDF selection not allowed -// TPM_RC_KEY the size of the object's 'unique' field is not -// consistent with the indicated size in the object's -// parameters -// TPM_RC_OBJECT_MEMORY no available object slot -// TPM_RC_SCHEME the signing scheme is not valid for the key -// TPM_RC_SENSITIVE the 'inPrivate' did not unmarshal correctly -// TPM_RC_SIZE 'inPrivate' missing, or 'authPolicy' size for -// 'inPublic' or is not valid -// TPM_RC_SYMMETRIC symmetric algorithm not provided when required -// TPM_RC_TYPE 'parentHandle' is not a storage key, or the object -// to load is a storage key but its parameters do not -// match the parameters of the parent. -// TPM_RC_VALUE decryption failure -TPM_RC -TPM2_Load( - Load_In *in, // IN: input parameter list - Load_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - TPMT_SENSITIVE sensitive; - OBJECT *parentObject; - OBJECT *newObject; - -// Input Validation - // Don't get invested in loading if there is no place to put it. - newObject = FindEmptyObjectSlot(&out->objectHandle); - if(newObject == NULL) - return TPM_RC_OBJECT_MEMORY; - - if(in->inPrivate.t.size == 0) - return TPM_RCS_SIZE + RC_Load_inPrivate; - - parentObject = HandleToObject(in->parentHandle); - pAssert(parentObject != NULL); - // Is the object that is being used as the parent actually a parent. - if(!ObjectIsParent(parentObject)) - return TPM_RCS_TYPE + RC_Load_parentHandle; - - // Compute the name of object. If there isn't one, it is because the nameAlg is - // not valid. - PublicMarshalAndComputeName(&in->inPublic.publicArea, &out->name); - if(out->name.t.size == 0) - return TPM_RCS_HASH + RC_Load_inPublic; - - // Retrieve sensitive data. - result = PrivateToSensitive(&in->inPrivate.b, &out->name.b, parentObject, - in->inPublic.publicArea.nameAlg, - &sensitive); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_Load_inPrivate); - -// Internal Data Update - // Load and validate object - result = ObjectLoad(newObject, parentObject, - &in->inPublic.publicArea, &sensitive, - RC_Load_inPublic, RC_Load_inPrivate, - &out->name); - if(result == TPM_RC_SUCCESS) - { - // Set the common OBJECT attributes for a loaded object. - ObjectSetLoadedAttributes(newObject, in->parentHandle); - } - return result; - -} - -#endif // CC_Load \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/LoadExternal.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/LoadExternal.c deleted file mode 100644 index 61d59b2b1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/LoadExternal.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "LoadExternal_fp.h" - -#if CC_LoadExternal // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// to load an object that is not a Protected Object into the public portion -// of an object into the TPM. The command allows loading of a public area or -// both a public and sensitive area -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'fixedParent", 'fixedTPM', and 'restricted' must -// be CLEAR if sensitive portion of an object is loaded -// TPM_RC_BINDING the 'inPublic' and 'inPrivate' structures are not -// cryptographically bound -// TPM_RC_HASH incorrect hash selection for signing key -// TPM_RC_HIERARCHY 'hierarchy' is turned off, or only NULL hierarchy -// is allowed when loading public and private parts -// of an object -// TPM_RC_KDF incorrect KDF selection for decrypting -// keyedHash object -// TPM_RC_KEY the size of the object's 'unique' field is not -// consistent with the indicated size in the object's -// parameters -// TPM_RC_OBJECT_MEMORY if there is no free slot for an object -// TPM_RC_ECC_POINT for a public-only ECC key, the ECC point is not -// on the curve -// TPM_RC_SCHEME the signing scheme is not valid for the key -// TPM_RC_SIZE 'authPolicy' is not zero and is not the size of a -// digest produced by the object's 'nameAlg' -// TPM_RH_NULL hierarchy -// TPM_RC_SYMMETRIC symmetric algorithm not provided when required -// TPM_RC_TYPE 'inPublic' and 'inPrivate' are not the same type -TPM_RC -TPM2_LoadExternal( - LoadExternal_In *in, // IN: input parameter list - LoadExternal_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - OBJECT *object; - TPMT_SENSITIVE *sensitive = NULL; - -// Input Validation - // Don't get invested in loading if there is no place to put it. - object = FindEmptyObjectSlot(&out->objectHandle); - if(object == NULL) - return TPM_RC_OBJECT_MEMORY; - - - // If the hierarchy to be associated with this object is turned off, the object - // cannot be loaded. - if(!HierarchyIsEnabled(in->hierarchy)) - return TPM_RCS_HIERARCHY + RC_LoadExternal_hierarchy; - - // For loading an object with both public and sensitive - if(in->inPrivate.size != 0) - { - // An external object with a sensitive area can only be loaded in the - // NULL hierarchy - if(in->hierarchy != TPM_RH_NULL) - return TPM_RCS_HIERARCHY + RC_LoadExternal_hierarchy; - // An external object with a sensitive area must have fixedTPM == CLEAR - // fixedParent == CLEAR so that it does not appear to be a key created by - // this TPM. - if(IS_ATTRIBUTE(in->inPublic.publicArea.objectAttributes, TPMA_OBJECT, - fixedTPM) - || IS_ATTRIBUTE(in->inPublic.publicArea.objectAttributes, TPMA_OBJECT, - fixedParent) - || IS_ATTRIBUTE(in->inPublic.publicArea.objectAttributes, TPMA_OBJECT, - restricted)) - return TPM_RCS_ATTRIBUTES + RC_LoadExternal_inPublic; - - // Have sensitive point to something other than NULL so that object - // initialization will load the sensitive part too - sensitive = &in->inPrivate.sensitiveArea; - } - - // Need the name to initialize the object structure - PublicMarshalAndComputeName(&in->inPublic.publicArea, &out->name); - - // Load and validate key - result = ObjectLoad(object, NULL, - &in->inPublic.publicArea, sensitive, - RC_LoadExternal_inPublic, RC_LoadExternal_inPrivate, - &out->name); - if(result == TPM_RC_SUCCESS) - { - object->attributes.external = SET; - // Set the common OBJECT attributes for a loaded object. - ObjectSetLoadedAttributes(object, in->hierarchy); - } - return result; -} - -#endif // CC_LoadExternal \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/MakeCredential.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/MakeCredential.c deleted file mode 100644 index 44e5e99ab..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/MakeCredential.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "MakeCredential_fp.h" - -#if CC_MakeCredential // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// Make Credential with an object -*/ -// Return Type: TPM_RC -// TPM_RC_KEY 'handle' referenced an ECC key that has a unique -// field that is not a point on the curve of the key -// TPM_RC_SIZE 'credential' is larger than the digest size of -// Name algorithm of 'handle' -// TPM_RC_TYPE 'handle' does not reference an asymmetric -// decryption key -TPM_RC -TPM2_MakeCredential( - MakeCredential_In *in, // IN: input parameter list - MakeCredential_Out *out // OUT: output parameter list - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - - OBJECT *object; - TPM2B_DATA data; - -// Input Validation - - // Get object pointer - object = HandleToObject(in->handle); - - // input key must be an asymmetric, restricted decryption key - // NOTE: Needs to be restricted to have a symmetric value. - if(!CryptIsAsymAlgorithm(object->publicArea.type) - || !IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, decrypt) - || !IS_ATTRIBUTE(object->publicArea.objectAttributes, - TPMA_OBJECT, restricted)) - return TPM_RCS_TYPE + RC_MakeCredential_handle; - - // The credential information may not be larger than the digest size used for - // the Name of the key associated with handle. - if(in->credential.t.size > CryptHashGetDigestSize(object->publicArea.nameAlg)) - return TPM_RCS_SIZE + RC_MakeCredential_credential; - -// Command Output - - // Make encrypt key and its associated secret structure. - out->secret.t.size = sizeof(out->secret.t.secret); - result = CryptSecretEncrypt(object, IDENTITY_STRING, &data, &out->secret); - if(result != TPM_RC_SUCCESS) - return result; - - // Prepare output credential data from secret - SecretToCredential(&in->credential, &in->objectName.b, &data.b, - object, &out->credentialBlob); - - return TPM_RC_SUCCESS; -} - -#endif // CC_MakeCredential \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ObjectChangeAuth.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ObjectChangeAuth.c deleted file mode 100644 index d339b83fd..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ObjectChangeAuth.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ObjectChangeAuth_fp.h" - -#if CC_ObjectChangeAuth // Conditional expansion of this file - -#include "Object_spt_fp.h" - -/*(See part 3 specification) -// Create an object -*/ -// Return Type: TPM_RC -// TPM_RC_SIZE 'newAuth' is larger than the size of the digest -// of the Name algorithm of 'objectHandle' -// TPM_RC_TYPE the key referenced by 'parentHandle' is not the -// parent of the object referenced by 'objectHandle'; -// or 'objectHandle' is a sequence object. -TPM_RC -TPM2_ObjectChangeAuth( - ObjectChangeAuth_In *in, // IN: input parameter list - ObjectChangeAuth_Out *out // OUT: output parameter list - ) -{ - TPMT_SENSITIVE sensitive; - - OBJECT *object = HandleToObject(in->objectHandle); - TPM2B_NAME QNCompare; - -// Input Validation - - // Can not change authorization on sequence object - if(ObjectIsSequence(object)) - return TPM_RCS_TYPE + RC_ObjectChangeAuth_objectHandle; - - // Make sure that the authorization value is consistent with the nameAlg - if(!AdjustAuthSize(&in->newAuth, object->publicArea.nameAlg)) - return TPM_RCS_SIZE + RC_ObjectChangeAuth_newAuth; - - // Parent handle should be the parent of object handle. In this - // implementation we verify this by checking the QN of object. Other - // implementation may choose different method to verify this attribute. - ComputeQualifiedName(in->parentHandle, - object->publicArea.nameAlg, - &object->name, &QNCompare); - if(!MemoryEqual2B(&object->qualifiedName.b, &QNCompare.b)) - return TPM_RCS_TYPE + RC_ObjectChangeAuth_parentHandle; - -// Command Output - // Prepare the sensitive area with the new authorization value - sensitive = object->sensitive; - sensitive.authValue = in->newAuth; - - // Protect the sensitive area - SensitiveToPrivate(&sensitive, &object->name, HandleToObject(in->parentHandle), - object->publicArea.nameAlg, - &out->outPrivate); - return TPM_RC_SUCCESS; -} - -#endif // CC_ObjectChangeAuth \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Object_spt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Object_spt.c deleted file mode 100644 index 3de47904b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Object_spt.c +++ /dev/null @@ -1,1584 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" -#include "Object_spt_fp.h" - -//** Local Functions - -//*** GetIV2BSize() -// Get the size of TPM2B_IV in canonical form that will be append to the start of -// the sensitive data. It includes both size of size field and size of iv data -static UINT16 -GetIV2BSize( - OBJECT *protector // IN: the protector handle - ) -{ - TPM_ALG_ID symAlg; - UINT16 keyBits; - - // Determine the symmetric algorithm and size of key - if(protector == NULL) - { - // Use the context encryption algorithm and key size - symAlg = CONTEXT_ENCRYPT_ALG; - keyBits = CONTEXT_ENCRYPT_KEY_BITS; - } - else - { - symAlg = protector->publicArea.parameters.asymDetail.symmetric.algorithm; - keyBits = protector->publicArea.parameters.asymDetail.symmetric.keyBits.sym; - } - - // The IV size is a UINT16 size field plus the block size of the symmetric - // algorithm - return sizeof(UINT16) + CryptGetSymmetricBlockSize(symAlg, keyBits); -} - -//*** ComputeProtectionKeyParms() -// This function retrieves the symmetric protection key parameters for -// the sensitive data -// The parameters retrieved from this function include encryption algorithm, -// key size in bit, and a TPM2B_SYM_KEY containing the key material as well as -// the key size in bytes -// This function is used for any action that requires encrypting or decrypting of -// the sensitive area of an object or a credential blob -// -/*(See part 1 specification) - KDF for generating the protection key material: - KDFa(hashAlg, seed, "STORAGE", Name, NULL , bits) -where - hashAlg for a Primary Object, an algorithm chosen by the TPM vendor - for derivations from Primary Seeds. For all other objects, - the nameAlg of the object's parent. - seed for a Primary Object in the Platform Hierarchy, the PPS. - For Primary Objects in either Storage or Endorsement Hierarchy, - the SPS. For Temporary Objects, the context encryption seed. - For all other objects, the symmetric seed value in the - sensitive area of the object's parent. - STORAGE label to differentiate use of KDFa() (see 4.7) - Name the Name of the object being encrypted - bits the number of bits required for a symmetric key and IV -*/ -// Return Type: void -static void -ComputeProtectionKeyParms( - OBJECT *protector, // IN: the protector object - TPM_ALG_ID hashAlg, // IN: hash algorithm for KDFa - TPM2B *name, // IN: name of the object - TPM2B *seedIn, // IN: optional seed for duplication blob. - // For non duplication blob, this - // parameter should be NULL - TPM_ALG_ID *symAlg, // OUT: the symmetric algorithm - UINT16 *keyBits, // OUT: the symmetric key size in bits - TPM2B_SYM_KEY *symKey // OUT: the symmetric key - ) -{ - const TPM2B *seed = seedIn; - - // Determine the algorithms for the KDF and the encryption/decryption - // For TPM_RH_NULL, using context settings - if(protector == NULL) - { - // Use the context encryption algorithm and key size - *symAlg = CONTEXT_ENCRYPT_ALG; - symKey->t.size = CONTEXT_ENCRYPT_KEY_BYTES; - *keyBits = CONTEXT_ENCRYPT_KEY_BITS; - } - else - { - TPMT_SYM_DEF_OBJECT *symDef; - symDef = &protector->publicArea.parameters.asymDetail.symmetric; - *symAlg = symDef->algorithm; - *keyBits = symDef->keyBits.sym; - symKey->t.size = (*keyBits + 7) / 8; - } - // Get seed for KDF - if(seed == NULL) - seed = GetSeedForKDF(protector); - // KDFa to generate symmetric key and IV value - CryptKDFa(hashAlg, seed, STORAGE_KEY, name, NULL, - symKey->t.size * 8, symKey->t.buffer, NULL, FALSE); - return; -} - -//*** ComputeOuterIntegrity() -// The sensitive area parameter is a buffer that holds a space for -// the integrity value and the marshaled sensitive area. The caller should -// skip over the area set aside for the integrity value -// and compute the hash of the remainder of the object. -// The size field of sensitive is in unmarshaled form and the -// sensitive area contents is an array of bytes. -/*(See part 1 specification) - KDFa(hashAlg, seed, "INTEGRITY", NULL, NULL , bits) (38) -where - hashAlg for a Primary Object, the nameAlg of the object. For all other - objects the nameAlg of the object's parent. - seed for a Primary Object in the Platform Hierarchy, the PPS. For - Primary Objects in either Storage or Endorsement Hierarchy, - the SPS. For a Temporary Object, the context encryption key. - For all other objects, the symmetric seed value in the sensitive - area of the object's parent. - "INTEGRITY" a value used to differentiate the uses of the KDF. - bits the number of bits in the digest produced by hashAlg. -Key is then used in the integrity computation. - HMACnameAlg(HMACkey, encSensitive || Name ) -where - HMACnameAlg() the HMAC function using nameAlg of the object's parent - HMACkey value derived from the parent symmetric protection value - encSensitive symmetrically encrypted sensitive area - Name the Name of the object being protected -*/ -// Return Type: void -static void -ComputeOuterIntegrity( - TPM2B *name, // IN: the name of the object - OBJECT *protector, // IN: the object that - // provides protection. For an object, - // it is a parent. For a credential, it - // is the encrypt object. For - // a Temporary Object, it is NULL - TPMI_ALG_HASH hashAlg, // IN: algorithm to use for integrity - TPM2B *seedIn, // IN: an external seed may be provided for - // duplication blob. For non duplication - // blob, this parameter should be NULL - UINT32 sensitiveSize, // IN: size of the marshaled sensitive data - BYTE *sensitiveData, // IN: sensitive area - TPM2B_DIGEST *integrity // OUT: integrity - ) -{ - HMAC_STATE hmacState; - TPM2B_DIGEST hmacKey; - const TPM2B *seed = seedIn; -// - // Get seed for KDF - if(seed == NULL) - seed = GetSeedForKDF(protector); - // Determine the HMAC key bits - hmacKey.t.size = CryptHashGetDigestSize(hashAlg); - - // KDFa to generate HMAC key - CryptKDFa(hashAlg, seed, INTEGRITY_KEY, NULL, NULL, - hmacKey.t.size * 8, hmacKey.t.buffer, NULL, FALSE); - // Start HMAC and get the size of the digest which will become the integrity - integrity->t.size = CryptHmacStart2B(&hmacState, hashAlg, &hmacKey.b); - - // Adding the marshaled sensitive area to the integrity value - CryptDigestUpdate(&hmacState.hashState, sensitiveSize, sensitiveData); - - // Adding name - CryptDigestUpdate2B(&hmacState.hashState, name); - - // Compute HMAC - CryptHmacEnd2B(&hmacState, &integrity->b); - - return; -} - -//*** ComputeInnerIntegrity() -// This function computes the integrity of an inner wrap -static void -ComputeInnerIntegrity( - TPM_ALG_ID hashAlg, // IN: hash algorithm for inner wrap - TPM2B *name, // IN: the name of the object - UINT16 dataSize, // IN: the size of sensitive data - BYTE *sensitiveData, // IN: sensitive data - TPM2B_DIGEST *integrity // OUT: inner integrity - ) -{ - HASH_STATE hashState; -// - // Start hash and get the size of the digest which will become the integrity - integrity->t.size = CryptHashStart(&hashState, hashAlg); - - // Adding the marshaled sensitive area to the integrity value - CryptDigestUpdate(&hashState, dataSize, sensitiveData); - - // Adding name - CryptDigestUpdate2B(&hashState, name); - - // Compute hash - CryptHashEnd2B(&hashState, &integrity->b); - - return; -} - -//*** ProduceInnerIntegrity() -// This function produces an inner integrity for regular private, credential or -// duplication blob -// It requires the sensitive data being marshaled to the innerBuffer, with the -// leading bytes reserved for integrity hash. It assume the sensitive data -// starts at address (innerBuffer + integrity size). -// This function integrity at the beginning of the inner buffer -// It returns the total size of buffer with the inner wrap -static UINT16 -ProduceInnerIntegrity( - TPM2B *name, // IN: the name of the object - TPM_ALG_ID hashAlg, // IN: hash algorithm for inner wrap - UINT16 dataSize, // IN: the size of sensitive data, excluding the - // leading integrity buffer size - BYTE *innerBuffer // IN/OUT: inner buffer with sensitive data in - // it. At input, the leading bytes of this - // buffer is reserved for integrity - ) -{ - BYTE *sensitiveData; // pointer to the sensitive data - TPM2B_DIGEST integrity; - UINT16 integritySize; - BYTE *buffer; // Auxiliary buffer pointer -// - // sensitiveData points to the beginning of sensitive data in innerBuffer - integritySize = sizeof(UINT16) + CryptHashGetDigestSize(hashAlg); - sensitiveData = innerBuffer + integritySize; - - ComputeInnerIntegrity(hashAlg, name, dataSize, sensitiveData, &integrity); - - // Add integrity at the beginning of inner buffer - buffer = innerBuffer; - TPM2B_DIGEST_Marshal(&integrity, &buffer, NULL); - - return dataSize + integritySize; -} - -//*** CheckInnerIntegrity() -// This function check integrity of inner blob -// Return Type: TPM_RC -// TPM_RC_INTEGRITY if the outer blob integrity is bad -// unmarshal errors unmarshal errors while unmarshaling integrity -static TPM_RC -CheckInnerIntegrity( - TPM2B *name, // IN: the name of the object - TPM_ALG_ID hashAlg, // IN: hash algorithm for inner wrap - UINT16 dataSize, // IN: the size of sensitive data, including the - // leading integrity buffer size - BYTE *innerBuffer // IN/OUT: inner buffer with sensitive data in - // it - ) -{ - TPM_RC result; - TPM2B_DIGEST integrity; - TPM2B_DIGEST integrityToCompare; - BYTE *buffer; // Auxiliary buffer pointer - INT32 size; -// - // Unmarshal integrity - buffer = innerBuffer; - size = (INT32)dataSize; - result = TPM2B_DIGEST_Unmarshal(&integrity, &buffer, &size); - if(result == TPM_RC_SUCCESS) - { - // Compute integrity to compare - ComputeInnerIntegrity(hashAlg, name, (UINT16)size, buffer, - &integrityToCompare); - // Compare outer blob integrity - if(!MemoryEqual2B(&integrity.b, &integrityToCompare.b)) - result = TPM_RC_INTEGRITY; - } - return result; -} - -//** Public Functions - -//*** AdjustAuthSize() -// This function will validate that the input authValue is no larger than the -// digestSize for the nameAlg. It will then pad with zeros to the size of the -// digest. -BOOL -AdjustAuthSize( - TPM2B_AUTH *auth, // IN/OUT: value to adjust - TPMI_ALG_HASH nameAlg // IN: - ) -{ - UINT16 digestSize; -// - // If there is no nameAlg, then this is a LoadExternal and the authVale can - // be any size up to the maximum allowed by the - digestSize = (nameAlg == TPM_ALG_NULL) ? sizeof(TPMU_HA) - : CryptHashGetDigestSize(nameAlg); - if(digestSize < MemoryRemoveTrailingZeros(auth)) - return FALSE; - else if(digestSize > auth->t.size) - MemoryPad2B(&auth->b, digestSize); - auth->t.size = digestSize; - - return TRUE; -} - -//*** AreAttributesForParent() -// This function is called by create, load, and import functions. -// Note: The 'isParent' attribute is SET when an object is loaded and it has -// attributes that are suitable for a parent object. -// Return Type: BOOL -// TRUE(1) properties are those of a parent -// FALSE(0) properties are not those of a parent -BOOL -ObjectIsParent( - OBJECT *parentObject // IN: parent handle - ) -{ - return parentObject->attributes.isParent; -} - -//*** CreateChecks() -// Attribute checks that are unique to creation. -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES sensitiveDataOrigin is not consistent with the -// object type -// other returns from PublicAttributesValidation() -TPM_RC -CreateChecks( - OBJECT *parentObject, - TPMT_PUBLIC *publicArea, - UINT16 sensitiveDataSize - ) -{ - TPMA_OBJECT attributes = publicArea->objectAttributes; - TPM_RC result = TPM_RC_SUCCESS; -// - // If the caller indicates that they have provided the data, then make sure that - // they have provided some data. - if((!IS_ATTRIBUTE(attributes, TPMA_OBJECT, sensitiveDataOrigin)) - && (sensitiveDataSize == 0)) - return TPM_RCS_ATTRIBUTES; - // For an ordinary object, data can only be provided when sensitiveDataOrigin - // is CLEAR - if((parentObject != NULL) - && (IS_ATTRIBUTE(attributes, TPMA_OBJECT, sensitiveDataOrigin)) - && (sensitiveDataSize != 0)) - return TPM_RCS_ATTRIBUTES; - switch(publicArea->type) - { - case ALG_KEYEDHASH_VALUE: - // if this is a data object (sign == decrypt == CLEAR) then the - // TPM cannot be the data source. - if(!IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign) - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt) - && IS_ATTRIBUTE(attributes, TPMA_OBJECT, sensitiveDataOrigin)) - result = TPM_RC_ATTRIBUTES; - // comment out the next line in order to prevent a fixedTPM derivation - // parent -// break; - case ALG_SYMCIPHER_VALUE: - // A restricted key symmetric key (SYMCIPHER and KEYEDHASH) - // must have sensitiveDataOrigin SET unless it has fixedParent and - // fixedTPM CLEAR. - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted)) - if(!IS_ATTRIBUTE(attributes, TPMA_OBJECT, sensitiveDataOrigin)) - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedParent) - || IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedTPM)) - result = TPM_RCS_ATTRIBUTES; - break; - default: // Asymmetric keys cannot have the sensitive portion provided - if(!IS_ATTRIBUTE(attributes, TPMA_OBJECT, sensitiveDataOrigin)) - result = TPM_RCS_ATTRIBUTES; - break; - } - if(TPM_RC_SUCCESS == result) - { - result = PublicAttributesValidation(parentObject, publicArea); - } - return result; -} -//*** SchemeChecks -// This function is called by TPM2_LoadExternal() and PublicAttributesValidation(). -// This function validates the schemes in the public area of an object. -// Return Type: TPM_RC -// TPM_RC_HASH non-duplicable storage key and its parent have different -// name algorithm -// TPM_RC_KDF incorrect KDF specified for decrypting keyed hash object -// TPM_RC_KEY invalid key size values in an asymmetric key public area -// TPM_RCS_SCHEME inconsistent attributes 'decrypt', 'sign', 'restricted' -// and key's scheme ID; or hash algorithm is inconsistent -// with the scheme ID for keyed hash object -// TPM_RC_SYMMETRIC a storage key with no symmetric algorithm specified; or -// non-storage key with symmetric algorithm different from -// ALG_NULL -TPM_RC -SchemeChecks( - OBJECT *parentObject, // IN: parent (null if primary seed) - TPMT_PUBLIC *publicArea // IN: public area of the object - ) -{ - TPMT_SYM_DEF_OBJECT *symAlgs = NULL; - TPM_ALG_ID scheme = TPM_ALG_NULL; - TPMA_OBJECT attributes = publicArea->objectAttributes; - TPMU_PUBLIC_PARMS *parms = &publicArea->parameters; -// - switch(publicArea->type) - { - case ALG_SYMCIPHER_VALUE: - symAlgs = &parms->symDetail.sym; - // If this is a decrypt key, then only the block cipher modes (not - // SMAC) are valid. TPM_ALG_NULL is OK too. If this is a 'sign' key, - // then any mode that got through the unmarshaling is OK. - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt) - && !CryptSymModeIsValid(symAlgs->mode.sym, TRUE)) - return TPM_RCS_SCHEME; - break; - case ALG_KEYEDHASH_VALUE: - scheme = parms->keyedHashDetail.scheme.scheme; - // if both sign and decrypt - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign) - == IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt)) - { - // if both sign and decrypt are set or clear, then need - // ALG_NULL as scheme - if(scheme != TPM_ALG_NULL) - return TPM_RCS_SCHEME; - } - else if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign) - && scheme != TPM_ALG_HMAC) - return TPM_RCS_SCHEME; - else if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt)) - { - if(scheme != TPM_ALG_XOR) - return TPM_RCS_SCHEME; - // If this is a derivation parent, then the KDF needs to be - // SP800-108 for this implementation. This is the only derivation - // supported by this implementation. Other implementations could - // support additional schemes. There is no default. - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted)) - { - if(parms->keyedHashDetail.scheme.details.xor.kdf - != TPM_ALG_KDF1_SP800_108) - return TPM_RCS_SCHEME; - // Must select a digest. - if(CryptHashGetDigestSize( - parms->keyedHashDetail.scheme.details.xor.hashAlg) == 0) - return TPM_RCS_HASH; - } - } - break; - default: // handling for asymmetric - scheme = parms->asymDetail.scheme.scheme; - symAlgs = &parms->asymDetail.symmetric; - // if the key is both sign and decrypt, then the scheme must be - // ALG_NULL because there is no way to specify both a sign and a - // decrypt scheme in the key. - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign) - == IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt)) - { - // scheme must be TPM_ALG_NULL - if(scheme != TPM_ALG_NULL) - return TPM_RCS_SCHEME; - } - else if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign)) - { - // If this is a signing key, see if it has a signing scheme - if(CryptIsAsymSignScheme(publicArea->type, scheme)) - { - // if proper signing scheme then it needs a proper hash - if(parms->asymDetail.scheme.details.anySig.hashAlg - == TPM_ALG_NULL) - return TPM_RCS_SCHEME; - } - else - { - // signing key that does not have a proper signing scheme. - // This is OK if the key is not restricted and its scheme - // is TPM_ALG_NULL - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted) - || scheme != TPM_ALG_NULL) - return TPM_RCS_SCHEME; - } - } - else if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt)) - { - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted)) - { - // for a restricted decryption key (a parent), scheme - // is required to be TPM_ALG_NULL - if(scheme != TPM_ALG_NULL) - return TPM_RCS_SCHEME; - } - else - { - // For an unrestricted decryption key, the scheme has to - // be a valid scheme or TPM_ALG_NULL - if(scheme != TPM_ALG_NULL && - !CryptIsAsymDecryptScheme(publicArea->type, scheme)) - return TPM_RCS_SCHEME; - } - } - if(!IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted) - || !IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt)) - { - // For an asymmetric key that is not a parent, the symmetric - // algorithms must be TPM_ALG_NULL - if(symAlgs->algorithm != TPM_ALG_NULL) - return TPM_RCS_SYMMETRIC; - } - // Special checks for an ECC key -#if ALG_ECC - if(publicArea->type == TPM_ALG_ECC) - { - TPM_ECC_CURVE curveID; - const TPMT_ECC_SCHEME *curveScheme; - - curveID = publicArea->parameters.eccDetail.curveID; - curveScheme = CryptGetCurveSignScheme(curveID); - // The curveId must be valid or the unmarshaling is busted. - pAssert(curveScheme != NULL); - - // If the curveID requires a specific scheme, then the key must - // select the same scheme - if(curveScheme->scheme != TPM_ALG_NULL) - { - TPMS_ECC_PARMS *ecc = &publicArea->parameters.eccDetail; - if(scheme != curveScheme->scheme) - return TPM_RCS_SCHEME; - // The scheme can allow any hash, or not... - if(curveScheme->details.anySig.hashAlg != TPM_ALG_NULL - && (ecc->scheme.details.anySig.hashAlg - != curveScheme->details.anySig.hashAlg)) - return TPM_RCS_SCHEME; - } - // For now, the KDF must be TPM_ALG_NULL - if(publicArea->parameters.eccDetail.kdf.scheme != TPM_ALG_NULL) - return TPM_RCS_KDF; - } -#endif - break; - } - // If this is a restricted decryption key with symmetric algorithms, then it - // is an ordinary parent (not a derivation parent). It needs to specific - // symmetric algorithms other than TPM_ALG_NULL - if(symAlgs != NULL - && IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted) - && IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt)) - { - if(symAlgs->algorithm == TPM_ALG_NULL) - return TPM_RCS_SYMMETRIC; -#if 0 //?? -// This next check is under investigation. Need to see if it will break Windows -// before it is enabled. If it does not, then it should be default because a -// the mode used with a parent is always CFB and Part 2 indicates as much. - if(symAlgs->mode.sym != TPM_ALG_CFB) - return TPM_RCS_MODE; -#endif - // If this parent is not duplicable, then the symmetric algorithms - // (encryption and hash) must match those of its parent - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedParent) - && (parentObject != NULL)) - { - if(publicArea->nameAlg != parentObject->publicArea.nameAlg) - return TPM_RCS_HASH; - if(!MemoryEqual(symAlgs, &parentObject->publicArea.parameters, - sizeof(TPMT_SYM_DEF_OBJECT))) - return TPM_RCS_SYMMETRIC; - } - } - return TPM_RC_SUCCESS; -} - -//*** PublicAttributesValidation() -// This function validates the values in the public area of an object. -// This function is used in the processing of TPM2_Create, TPM2_CreatePrimary, -// TPM2_CreateLoaded(), TPM2_Load(), TPM2_Import(), and TPM2_LoadExternal(). -// For TPM2_Import() this is only used if the new parent has fixedTPM SET. For -// TPM2_LoadExternal(), this is not used for a public-only key -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'fixedTPM', 'fixedParent', or 'encryptedDuplication' -// attributes are inconsistent between themselves or with -// those of the parent object; -// inconsistent 'restricted', 'decrypt' and 'sign' -// attributes; -// attempt to inject sensitive data for an asymmetric key; -// attempt to create a symmetric cipher key that is not -// a decryption key -// TPM_RC_HASH nameAlg is TPM_ALG_NULL -// TPM_RC_SIZE 'authPolicy' size does not match digest size of the name -// algorithm in 'publicArea' -// other returns from SchemeChecks() -TPM_RC -PublicAttributesValidation( - OBJECT *parentObject, // IN: input parent object - TPMT_PUBLIC *publicArea // IN: public area of the object - ) -{ - TPMA_OBJECT attributes = publicArea->objectAttributes; - TPMA_OBJECT parentAttributes = TPMA_ZERO_INITIALIZER(); -// - if(parentObject != NULL) - parentAttributes = parentObject->publicArea.objectAttributes; - if(publicArea->nameAlg == TPM_ALG_NULL) - return TPM_RCS_HASH; - // If there is an authPolicy, it needs to be the size of the digest produced - // by the nameAlg of the object - if((publicArea->authPolicy.t.size != 0 - && (publicArea->authPolicy.t.size - != CryptHashGetDigestSize(publicArea->nameAlg)))) - return TPM_RCS_SIZE; - // If the parent is fixedTPM (including a Primary Object) the object must have - // the same value for fixedTPM and fixedParent - if(parentObject == NULL - || IS_ATTRIBUTE(parentAttributes, TPMA_OBJECT, fixedTPM)) - { - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedParent) - != IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedTPM)) - return TPM_RCS_ATTRIBUTES; - } - else - { - // The parent is not fixedTPM so the object can't be fixedTPM - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedTPM)) - return TPM_RCS_ATTRIBUTES; - } - // See if sign and decrypt are the same - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign) - == IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt)) - { - // a restricted key cannot have both SET or both CLEAR - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted)) - return TPM_RC_ATTRIBUTES; - // only a data object may have both sign and decrypt CLEAR - // BTW, since we know that decrypt==sign, no need to check both - if(publicArea->type != TPM_ALG_KEYEDHASH - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign)) - return TPM_RC_ATTRIBUTES; - } - // If the object can't be duplicated (directly or indirectly) then there - // is no justification for having encryptedDuplication SET - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedTPM) - && IS_ATTRIBUTE(attributes, TPMA_OBJECT, encryptedDuplication)) - return TPM_RCS_ATTRIBUTES; - // If a parent object has fixedTPM CLEAR, the child must have the - // same encryptedDuplication value as its parent. - // Primary objects are considered to have a fixedTPM parent (the seeds). - if(parentObject != NULL - && !IS_ATTRIBUTE(parentAttributes, TPMA_OBJECT, fixedTPM)) - { - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, encryptedDuplication) - != IS_ATTRIBUTE(parentAttributes, TPMA_OBJECT, encryptedDuplication)) - return TPM_RCS_ATTRIBUTES; - } - // Special checks for derived objects - if((parentObject != NULL) && (parentObject->attributes.derivation == SET)) - { - // A derived object has the same settings for fixedTPM as its parent - if(IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedTPM) - != IS_ATTRIBUTE(parentAttributes, TPMA_OBJECT, fixedTPM)) - return TPM_RCS_ATTRIBUTES; - // A derived object is required to be fixedParent - if(!IS_ATTRIBUTE(attributes, TPMA_OBJECT, fixedParent)) - return TPM_RCS_ATTRIBUTES; - } - return SchemeChecks(parentObject, publicArea); -} - -//*** FillInCreationData() -// Fill in creation data for an object. -// Return Type: void -void -FillInCreationData( - TPMI_DH_OBJECT parentHandle, // IN: handle of parent - TPMI_ALG_HASH nameHashAlg, // IN: name hash algorithm - TPML_PCR_SELECTION *creationPCR, // IN: PCR selection - TPM2B_DATA *outsideData, // IN: outside data - TPM2B_CREATION_DATA *outCreation, // OUT: creation data for output - TPM2B_DIGEST *creationDigest // OUT: creation digest - ) -{ - BYTE creationBuffer[sizeof(TPMS_CREATION_DATA)]; - BYTE *buffer; - HASH_STATE hashState; -// - // Fill in TPMS_CREATION_DATA in outCreation - - // Compute PCR digest - PCRComputeCurrentDigest(nameHashAlg, creationPCR, - &outCreation->creationData.pcrDigest); - - // Put back PCR selection list - outCreation->creationData.pcrSelect = *creationPCR; - - // Get locality - outCreation->creationData.locality - = LocalityGetAttributes(_plat__LocalityGet()); - outCreation->creationData.parentNameAlg = TPM_ALG_NULL; - - // If the parent is either a primary seed or TPM_ALG_NULL, then the Name - // and QN of the parent are the parent's handle. - if(HandleGetType(parentHandle) == TPM_HT_PERMANENT) - { - buffer = &outCreation->creationData.parentName.t.name[0]; - outCreation->creationData.parentName.t.size = - TPM_HANDLE_Marshal(&parentHandle, &buffer, NULL); - // For a primary or temporary object, the parent name (a handle) and the - // parent's QN are the same - outCreation->creationData.parentQualifiedName - = outCreation->creationData.parentName; - } - else // Regular object - { - OBJECT *parentObject = HandleToObject(parentHandle); -// - // Set name algorithm - outCreation->creationData.parentNameAlg = parentObject->publicArea.nameAlg; - - // Copy parent name - outCreation->creationData.parentName = parentObject->name; - - // Copy parent qualified name - outCreation->creationData.parentQualifiedName = parentObject->qualifiedName; - } - // Copy outside information - outCreation->creationData.outsideInfo = *outsideData; - - // Marshal creation data to canonical form - buffer = creationBuffer; - outCreation->size = TPMS_CREATION_DATA_Marshal(&outCreation->creationData, - &buffer, NULL); - // Compute hash for creation field in public template - creationDigest->t.size = CryptHashStart(&hashState, nameHashAlg); - CryptDigestUpdate(&hashState, outCreation->size, creationBuffer); - CryptHashEnd2B(&hashState, &creationDigest->b); - - return; -} - -//*** GetSeedForKDF() -// Get a seed for KDF. The KDF for encryption and HMAC key use the same seed. -const TPM2B * -GetSeedForKDF( - OBJECT *protector // IN: the protector handle - ) -{ - // Get seed for encryption key. Use input seed if provided. - // Otherwise, using protector object's seedValue. TPM_RH_NULL is the only - // exception that we may not have a loaded object as protector. In such a - // case, use nullProof as seed. - if(protector == NULL) - return &gr.nullProof.b; - else - return &protector->sensitive.seedValue.b; -} - -//*** ProduceOuterWrap() -// This function produce outer wrap for a buffer containing the sensitive data. -// It requires the sensitive data being marshaled to the outerBuffer, with the -// leading bytes reserved for integrity hash. If iv is used, iv space should -// be reserved at the beginning of the buffer. It assumes the sensitive data -// starts at address (outerBuffer + integrity size {+ iv size}). -// This function performs: -// 1. Add IV before sensitive area if required -// 2. encrypt sensitive data, if iv is required, encrypt by iv. otherwise, -// encrypted by a NULL iv -// 3. add HMAC integrity at the beginning of the buffer -// It returns the total size of blob with outer wrap -UINT16 -ProduceOuterWrap( - OBJECT *protector, // IN: The handle of the object that provides - // protection. For object, it is parent - // handle. For credential, it is the handle - // of encrypt object. - TPM2B *name, // IN: the name of the object - TPM_ALG_ID hashAlg, // IN: hash algorithm for outer wrap - TPM2B *seed, // IN: an external seed may be provided for - // duplication blob. For non duplication - // blob, this parameter should be NULL - BOOL useIV, // IN: indicate if an IV is used - UINT16 dataSize, // IN: the size of sensitive data, excluding the - // leading integrity buffer size or the - // optional iv size - BYTE *outerBuffer // IN/OUT: outer buffer with sensitive data in - // it - ) -{ - TPM_ALG_ID symAlg; - UINT16 keyBits; - TPM2B_SYM_KEY symKey; - TPM2B_IV ivRNG; // IV from RNG - TPM2B_IV *iv = NULL; - UINT16 ivSize = 0; // size of iv area, including the size field - BYTE *sensitiveData; // pointer to the sensitive data - TPM2B_DIGEST integrity; - UINT16 integritySize; - BYTE *buffer; // Auxiliary buffer pointer -// - // Compute the beginning of sensitive data. The outer integrity should - // always exist if this function is called to make an outer wrap - integritySize = sizeof(UINT16) + CryptHashGetDigestSize(hashAlg); - sensitiveData = outerBuffer + integritySize; - - // If iv is used, adjust the pointer of sensitive data and add iv before it - if(useIV) - { - ivSize = GetIV2BSize(protector); - - // Generate IV from RNG. The iv data size should be the total IV area - // size minus the size of size field - ivRNG.t.size = ivSize - sizeof(UINT16); - CryptRandomGenerate(ivRNG.t.size, ivRNG.t.buffer); - - // Marshal IV to buffer - buffer = sensitiveData; - TPM2B_IV_Marshal(&ivRNG, &buffer, NULL); - - // adjust sensitive data starting after IV area - sensitiveData += ivSize; - - // Use iv for encryption - iv = &ivRNG; - } - // Compute symmetric key parameters for outer buffer encryption - ComputeProtectionKeyParms(protector, hashAlg, name, seed, - &symAlg, &keyBits, &symKey); - // Encrypt inner buffer in place - CryptSymmetricEncrypt(sensitiveData, symAlg, keyBits, - symKey.t.buffer, iv, TPM_ALG_CFB, dataSize, - sensitiveData); - // Compute outer integrity. Integrity computation includes the optional IV - // area - ComputeOuterIntegrity(name, protector, hashAlg, seed, dataSize + ivSize, - outerBuffer + integritySize, &integrity); - // Add integrity at the beginning of outer buffer - buffer = outerBuffer; - TPM2B_DIGEST_Marshal(&integrity, &buffer, NULL); - - // return the total size in outer wrap - return dataSize + integritySize + ivSize; -} - -//*** UnwrapOuter() -// This function remove the outer wrap of a blob containing sensitive data -// This function performs: -// 1. check integrity of outer blob -// 2. decrypt outer blob -// -// Return Type: TPM_RC -// TPM_RCS_INSUFFICIENT error during sensitive data unmarshaling -// TPM_RCS_INTEGRITY sensitive data integrity is broken -// TPM_RCS_SIZE error during sensitive data unmarshaling -// TPM_RCS_VALUE IV size for CFB does not match the encryption -// algorithm block size -TPM_RC -UnwrapOuter( - OBJECT *protector, // IN: The object that provides - // protection. For object, it is parent - // handle. For credential, it is the - // encrypt object. - TPM2B *name, // IN: the name of the object - TPM_ALG_ID hashAlg, // IN: hash algorithm for outer wrap - TPM2B *seed, // IN: an external seed may be provided for - // duplication blob. For non duplication - // blob, this parameter should be NULL. - BOOL useIV, // IN: indicates if an IV is used - UINT16 dataSize, // IN: size of sensitive data in outerBuffer, - // including the leading integrity buffer - // size, and an optional iv area - BYTE *outerBuffer // IN/OUT: sensitive data - ) -{ - TPM_RC result; - TPM_ALG_ID symAlg = TPM_ALG_NULL; - TPM2B_SYM_KEY symKey; - UINT16 keyBits = 0; - TPM2B_IV ivIn; // input IV retrieved from input buffer - TPM2B_IV *iv = NULL; - BYTE *sensitiveData; // pointer to the sensitive data - TPM2B_DIGEST integrityToCompare; - TPM2B_DIGEST integrity; - INT32 size; -// - // Unmarshal integrity - sensitiveData = outerBuffer; - size = (INT32)dataSize; - result = TPM2B_DIGEST_Unmarshal(&integrity, &sensitiveData, &size); - if(result == TPM_RC_SUCCESS) - { - // Compute integrity to compare - ComputeOuterIntegrity(name, protector, hashAlg, seed, - (UINT16)size, sensitiveData, - &integrityToCompare); - // Compare outer blob integrity - if(!MemoryEqual2B(&integrity.b, &integrityToCompare.b)) - return TPM_RCS_INTEGRITY; - // Get the symmetric algorithm parameters used for encryption - ComputeProtectionKeyParms(protector, hashAlg, name, seed, - &symAlg, &keyBits, &symKey); - // Retrieve IV if it is used - if(useIV) - { - result = TPM2B_IV_Unmarshal(&ivIn, &sensitiveData, &size); - if(result == TPM_RC_SUCCESS) - { - // The input iv size for CFB must match the encryption algorithm - // block size - if(ivIn.t.size != CryptGetSymmetricBlockSize(symAlg, keyBits)) - result = TPM_RC_VALUE; - else - iv = &ivIn; - } - } - } - // If no errors, decrypt private in place. Since this function uses CFB, - // CryptSymmetricDecrypt() will not return any errors. It may fail but it will - // not return an error. - if(result == TPM_RC_SUCCESS) - CryptSymmetricDecrypt(sensitiveData, symAlg, keyBits, - symKey.t.buffer, iv, TPM_ALG_CFB, - (UINT16)size, sensitiveData); - return result; -} - -//*** MarshalSensitive() -// This function is used to marshal a sensitive area. Among other things, it -// adjusts the size of the authValue to be no smaller than the digest of -// 'nameAlg'. It will also make sure that the RSA sensitive contains the right number -// of values. -// Returns the size of the marshaled area. -static UINT16 -MarshalSensitive( - OBJECT *parent, // IN: the object parent (optional) - BYTE *buffer, // OUT: receiving buffer - TPMT_SENSITIVE *sensitive, // IN: the sensitive area to marshal - TPMI_ALG_HASH nameAlg // IN: - ) -{ - BYTE *sizeField = buffer; // saved so that size can be - // marshaled after it is known - UINT16 retVal; -// - // Pad the authValue if needed - MemoryPad2B(&sensitive->authValue.b, CryptHashGetDigestSize(nameAlg)); - buffer += 2; - - // Marshal the structure -#if ALG_RSA - // If the sensitive size is the special case for a prime in the type - if((sensitive->sensitive.rsa.t.size & RSA_prime_flag) > 0) - { - UINT16 sizeSave = sensitive->sensitive.rsa.t.size; - // - // Turn off the flag that indicates that the sensitive->sensitive contains - // the CRT form of the exponent. - sensitive->sensitive.rsa.t.size &= ~(RSA_prime_flag); - // If the parent isn't fixedTPM, then truncate the sensitive data to be - // the size of the prime. Otherwise, leave it at the current size which - // is the full CRT size. - if(parent == NULL - || !IS_ATTRIBUTE(parent->publicArea.objectAttributes, - TPMA_OBJECT, fixedTPM)) - sensitive->sensitive.rsa.t.size /= 5; - retVal = TPMT_SENSITIVE_Marshal(sensitive, &buffer, NULL); - // Restore the flag and the size. - sensitive->sensitive.rsa.t.size = sizeSave; - } - else -#endif - retVal = TPMT_SENSITIVE_Marshal(sensitive, &buffer, NULL); - - // Marshal the size - retVal = (UINT16)(retVal + UINT16_Marshal(&retVal, &sizeField, NULL)); - - return retVal; -} - -//*** SensitiveToPrivate() -// This function prepare the private blob for off the chip storage -// The operations in this function: -// 1. marshal TPM2B_SENSITIVE structure into the buffer of TPM2B_PRIVATE -// 2. apply encryption to the sensitive area. -// 3. apply outer integrity computation. -void -SensitiveToPrivate( - TPMT_SENSITIVE *sensitive, // IN: sensitive structure - TPM2B_NAME *name, // IN: the name of the object - OBJECT *parent, // IN: The parent object - TPM_ALG_ID nameAlg, // IN: hash algorithm in public area. This - // parameter is used when parentHandle is - // NULL, in which case the object is - // temporary. - TPM2B_PRIVATE *outPrivate // OUT: output private structure - ) -{ - BYTE *sensitiveData; // pointer to the sensitive data - UINT16 dataSize; // data blob size - TPMI_ALG_HASH hashAlg; // hash algorithm for integrity - UINT16 integritySize; - UINT16 ivSize; -// - pAssert(name != NULL && name->t.size != 0); - - // Find the hash algorithm for integrity computation - if(parent == NULL) - { - // For Temporary Object, using self name algorithm - hashAlg = nameAlg; - } - else - { - // Otherwise, using parent's name algorithm - hashAlg = parent->publicArea.nameAlg; - } - // Starting of sensitive data without wrappers - sensitiveData = outPrivate->t.buffer; - - // Compute the integrity size - integritySize = sizeof(UINT16) + CryptHashGetDigestSize(hashAlg); - - // Reserve space for integrity - sensitiveData += integritySize; - - // Get iv size - ivSize = GetIV2BSize(parent); - - // Reserve space for iv - sensitiveData += ivSize; - - // Marshal the sensitive area including authValue size adjustments. - dataSize = MarshalSensitive(parent, sensitiveData, sensitive, nameAlg); - - //Produce outer wrap, including encryption and HMAC - outPrivate->t.size = ProduceOuterWrap(parent, &name->b, hashAlg, NULL, - TRUE, dataSize, outPrivate->t.buffer); - return; -} - -//*** PrivateToSensitive() -// Unwrap a input private area. Check the integrity, decrypt and retrieve data -// to a sensitive structure. -// The operations in this function: -// 1. check the integrity HMAC of the input private area -// 2. decrypt the private buffer -// 3. unmarshal TPMT_SENSITIVE structure into the buffer of TPMT_SENSITIVE -// Return Type: TPM_RC -// TPM_RCS_INTEGRITY if the private area integrity is bad -// TPM_RC_SENSITIVE unmarshal errors while unmarshaling TPMS_ENCRYPT -// from input private -// TPM_RCS_SIZE error during sensitive data unmarshaling -// TPM_RCS_VALUE outer wrapper does not have an iV of the correct -// size -TPM_RC -PrivateToSensitive( - TPM2B *inPrivate, // IN: input private structure - TPM2B *name, // IN: the name of the object - OBJECT *parent, // IN: parent object - TPM_ALG_ID nameAlg, // IN: hash algorithm in public area. It is - // passed separately because we only pass - // name, rather than the whole public area - // of the object. This parameter is used in - // the following two cases: 1. primary - // objects. 2. duplication blob with inner - // wrap. In other cases, this parameter - // will be ignored - TPMT_SENSITIVE *sensitive // OUT: sensitive structure - ) -{ - TPM_RC result; - BYTE *buffer; - INT32 size; - BYTE *sensitiveData; // pointer to the sensitive data - UINT16 dataSize; - UINT16 dataSizeInput; - TPMI_ALG_HASH hashAlg; // hash algorithm for integrity - UINT16 integritySize; - UINT16 ivSize; -// - // Make sure that name is provided - pAssert(name != NULL && name->size != 0); - - // Find the hash algorithm for integrity computation - // For Temporary Object (parent == NULL) use self name algorithm; - // Otherwise, using parent's name algorithm - hashAlg = (parent == NULL) ? nameAlg : parent->publicArea.nameAlg; - - // unwrap outer - result = UnwrapOuter(parent, name, hashAlg, NULL, TRUE, - inPrivate->size, inPrivate->buffer); - if(result != TPM_RC_SUCCESS) - return result; - // Compute the inner integrity size. - integritySize = sizeof(UINT16) + CryptHashGetDigestSize(hashAlg); - - // Get iv size - ivSize = GetIV2BSize(parent); - - // The starting of sensitive data and data size without outer wrapper - sensitiveData = inPrivate->buffer + integritySize + ivSize; - dataSize = inPrivate->size - integritySize - ivSize; - - // Unmarshal input data size - buffer = sensitiveData; - size = (INT32)dataSize; - result = UINT16_Unmarshal(&dataSizeInput, &buffer, &size); - if(result == TPM_RC_SUCCESS) - { - if((dataSizeInput + sizeof(UINT16)) != dataSize) - result = TPM_RC_SENSITIVE; - else - { - // Unmarshal sensitive buffer to sensitive structure - result = TPMT_SENSITIVE_Unmarshal(sensitive, &buffer, &size); - if(result != TPM_RC_SUCCESS || size != 0) - { - result = TPM_RC_SENSITIVE; - } - } - } - return result; -} - -//*** SensitiveToDuplicate() -// This function prepare the duplication blob from the sensitive area. -// The operations in this function: -// 1. marshal TPMT_SENSITIVE structure into the buffer of TPM2B_PRIVATE -// 2. apply inner wrap to the sensitive area if required -// 3. apply outer wrap if required -void -SensitiveToDuplicate( - TPMT_SENSITIVE *sensitive, // IN: sensitive structure - TPM2B *name, // IN: the name of the object - OBJECT *parent, // IN: The new parent object - TPM_ALG_ID nameAlg, // IN: hash algorithm in public area. It - // is passed separately because we - // only pass name, rather than the - // whole public area of the object. - TPM2B *seed, // IN: the external seed. If external - // seed is provided with size of 0, - // no outer wrap should be applied - // to duplication blob. - TPMT_SYM_DEF_OBJECT *symDef, // IN: Symmetric key definition. If the - // symmetric key algorithm is NULL, - // no inner wrap should be applied. - TPM2B_DATA *innerSymKey, // IN/OUT: a symmetric key may be - // provided to encrypt the inner - // wrap of a duplication blob. May - // be generated here if needed. - TPM2B_PRIVATE *outPrivate // OUT: output private structure - ) -{ - BYTE *sensitiveData; // pointer to the sensitive data - TPMI_ALG_HASH outerHash = TPM_ALG_NULL;// The hash algorithm for outer wrap - TPMI_ALG_HASH innerHash = TPM_ALG_NULL;// The hash algorithm for inner wrap - UINT16 dataSize; // data blob size - BOOL doInnerWrap = FALSE; - BOOL doOuterWrap = FALSE; -// - // Make sure that name is provided - pAssert(name != NULL && name->size != 0); - - // Make sure symDef and innerSymKey are not NULL - pAssert(symDef != NULL && innerSymKey != NULL); - - // Starting of sensitive data without wrappers - sensitiveData = outPrivate->t.buffer; - - // Find out if inner wrap is required - if(symDef->algorithm != TPM_ALG_NULL) - { - doInnerWrap = TRUE; - - // Use self nameAlg as inner hash algorithm - innerHash = nameAlg; - - // Adjust sensitive data pointer - sensitiveData += sizeof(UINT16) + CryptHashGetDigestSize(innerHash); - } - // Find out if outer wrap is required - if(seed->size != 0) - { - doOuterWrap = TRUE; - - // Use parent nameAlg as outer hash algorithm - outerHash = parent->publicArea.nameAlg; - - // Adjust sensitive data pointer - sensitiveData += sizeof(UINT16) + CryptHashGetDigestSize(outerHash); - } - // Marshal sensitive area - dataSize = MarshalSensitive(NULL, sensitiveData, sensitive, nameAlg); - - // Apply inner wrap for duplication blob. It includes both integrity and - // encryption - if(doInnerWrap) - { - BYTE *innerBuffer = NULL; - BOOL symKeyInput = TRUE; - innerBuffer = outPrivate->t.buffer; - // Skip outer integrity space - if(doOuterWrap) - innerBuffer += sizeof(UINT16) + CryptHashGetDigestSize(outerHash); - dataSize = ProduceInnerIntegrity(name, innerHash, dataSize, - innerBuffer); - // Generate inner encryption key if needed - if(innerSymKey->t.size == 0) - { - innerSymKey->t.size = (symDef->keyBits.sym + 7) / 8; - CryptRandomGenerate(innerSymKey->t.size, innerSymKey->t.buffer); - - // TPM generates symmetric encryption. Set the flag to FALSE - symKeyInput = FALSE; - } - else - { - // assume the input key size should matches the symmetric definition - pAssert(innerSymKey->t.size == (symDef->keyBits.sym + 7) / 8); - } - - // Encrypt inner buffer in place - CryptSymmetricEncrypt(innerBuffer, symDef->algorithm, - symDef->keyBits.sym, innerSymKey->t.buffer, NULL, - TPM_ALG_CFB, dataSize, innerBuffer); - - // If the symmetric encryption key is imported, clear the buffer for - // output - if(symKeyInput) - innerSymKey->t.size = 0; - } - // Apply outer wrap for duplication blob. It includes both integrity and - // encryption - if(doOuterWrap) - { - dataSize = ProduceOuterWrap(parent, name, outerHash, seed, FALSE, - dataSize, outPrivate->t.buffer); - } - // Data size for output - outPrivate->t.size = dataSize; - - return; -} - -//*** DuplicateToSensitive() -// Unwrap a duplication blob. Check the integrity, decrypt and retrieve data -// to a sensitive structure. -// The operations in this function: -// 1. check the integrity HMAC of the input private area -// 2. decrypt the private buffer -// 3. unmarshal TPMT_SENSITIVE structure into the buffer of TPMT_SENSITIVE -// -// Return Type: TPM_RC -// TPM_RC_INSUFFICIENT unmarshaling sensitive data from 'inPrivate' failed -// TPM_RC_INTEGRITY 'inPrivate' data integrity is broken -// TPM_RC_SIZE unmarshaling sensitive data from 'inPrivate' failed -TPM_RC -DuplicateToSensitive( - TPM2B *inPrivate, // IN: input private structure - TPM2B *name, // IN: the name of the object - OBJECT *parent, // IN: the parent - TPM_ALG_ID nameAlg, // IN: hash algorithm in public area. - TPM2B *seed, // IN: an external seed may be provided. - // If external seed is provided with - // size of 0, no outer wrap is - // applied - TPMT_SYM_DEF_OBJECT *symDef, // IN: Symmetric key definition. If the - // symmetric key algorithm is NULL, - // no inner wrap is applied - TPM2B *innerSymKey, // IN: a symmetric key may be provided - // to decrypt the inner wrap of a - // duplication blob. - TPMT_SENSITIVE *sensitive // OUT: sensitive structure - ) -{ - TPM_RC result; - BYTE *buffer; - INT32 size; - BYTE *sensitiveData; // pointer to the sensitive data - UINT16 dataSize; - UINT16 dataSizeInput; -// - // Make sure that name is provided - pAssert(name != NULL && name->size != 0); - - // Make sure symDef and innerSymKey are not NULL - pAssert(symDef != NULL && innerSymKey != NULL); - - // Starting of sensitive data - sensitiveData = inPrivate->buffer; - dataSize = inPrivate->size; - - // Find out if outer wrap is applied - if(seed->size != 0) - { - // Use parent nameAlg as outer hash algorithm - TPMI_ALG_HASH outerHash = parent->publicArea.nameAlg; - - result = UnwrapOuter(parent, name, outerHash, seed, FALSE, - dataSize, sensitiveData); - if(result != TPM_RC_SUCCESS) - return result; - // Adjust sensitive data pointer and size - sensitiveData += sizeof(UINT16) + CryptHashGetDigestSize(outerHash); - dataSize -= sizeof(UINT16) + CryptHashGetDigestSize(outerHash); - } - // Find out if inner wrap is applied - if(symDef->algorithm != TPM_ALG_NULL) - { - // assume the input key size matches the symmetric definition - pAssert(innerSymKey->size == (symDef->keyBits.sym + 7) / 8); - - // Decrypt inner buffer in place - CryptSymmetricDecrypt(sensitiveData, symDef->algorithm, - symDef->keyBits.sym, innerSymKey->buffer, NULL, - TPM_ALG_CFB, dataSize, sensitiveData); - // Check inner integrity - result = CheckInnerIntegrity(name, nameAlg, dataSize, sensitiveData); - if(result != TPM_RC_SUCCESS) - return result; - // Adjust sensitive data pointer and size - sensitiveData += sizeof(UINT16) + CryptHashGetDigestSize(nameAlg); - dataSize -= sizeof(UINT16) + CryptHashGetDigestSize(nameAlg); - } - // Unmarshal input data size - buffer = sensitiveData; - size = (INT32)dataSize; - result = UINT16_Unmarshal(&dataSizeInput, &buffer, &size); - if(result == TPM_RC_SUCCESS) - { - if((dataSizeInput + sizeof(UINT16)) != dataSize) - result = TPM_RC_SIZE; - else - { - // Unmarshal sensitive buffer to sensitive structure - result = TPMT_SENSITIVE_Unmarshal(sensitive, &buffer, &size); - - // if the results is OK make sure that all the data was unmarshaled - if(result == TPM_RC_SUCCESS && size != 0) - result = TPM_RC_SIZE; - } - } - return result; -} - -//*** SecretToCredential() -// This function prepare the credential blob from a secret (a TPM2B_DIGEST) -// The operations in this function: -// 1. marshal TPM2B_DIGEST structure into the buffer of TPM2B_ID_OBJECT -// 2. encrypt the private buffer, excluding the leading integrity HMAC area -// 3. compute integrity HMAC and append to the beginning of the buffer. -// 4. Set the total size of TPM2B_ID_OBJECT buffer -void -SecretToCredential( - TPM2B_DIGEST *secret, // IN: secret information - TPM2B *name, // IN: the name of the object - TPM2B *seed, // IN: an external seed. - OBJECT *protector, // IN: the protector - TPM2B_ID_OBJECT *outIDObject // OUT: output credential - ) -{ - BYTE *buffer; // Auxiliary buffer pointer - BYTE *sensitiveData; // pointer to the sensitive data - TPMI_ALG_HASH outerHash; // The hash algorithm for outer wrap - UINT16 dataSize; // data blob size -// - pAssert(secret != NULL && outIDObject != NULL); - - // use protector's name algorithm as outer hash ???? - outerHash = protector->publicArea.nameAlg; - - // Marshal secret area to credential buffer, leave space for integrity - sensitiveData = outIDObject->t.credential - + sizeof(UINT16) + CryptHashGetDigestSize(outerHash); -// Marshal secret area - buffer = sensitiveData; - dataSize = TPM2B_DIGEST_Marshal(secret, &buffer, NULL); - - // Apply outer wrap - outIDObject->t.size = ProduceOuterWrap(protector, name, outerHash, seed, FALSE, - dataSize, outIDObject->t.credential); - return; -} - -//*** CredentialToSecret() -// Unwrap a credential. Check the integrity, decrypt and retrieve data -// to a TPM2B_DIGEST structure. -// The operations in this function: -// 1. check the integrity HMAC of the input credential area -// 2. decrypt the credential buffer -// 3. unmarshal TPM2B_DIGEST structure into the buffer of TPM2B_DIGEST -// -// Return Type: TPM_RC -// TPM_RC_INSUFFICIENT error during credential unmarshaling -// TPM_RC_INTEGRITY credential integrity is broken -// TPM_RC_SIZE error during credential unmarshaling -// TPM_RC_VALUE IV size does not match the encryption algorithm -// block size -TPM_RC -CredentialToSecret( - TPM2B *inIDObject, // IN: input credential blob - TPM2B *name, // IN: the name of the object - TPM2B *seed, // IN: an external seed. - OBJECT *protector, // IN: the protector - TPM2B_DIGEST *secret // OUT: secret information - ) -{ - TPM_RC result; - BYTE *buffer; - INT32 size; - TPMI_ALG_HASH outerHash; // The hash algorithm for outer wrap - BYTE *sensitiveData; // pointer to the sensitive data - UINT16 dataSize; -// - // use protector's name algorithm as outer hash - outerHash = protector->publicArea.nameAlg; - - // Unwrap outer, a TPM_RC_INTEGRITY error may be returned at this point - result = UnwrapOuter(protector, name, outerHash, seed, FALSE, - inIDObject->size, inIDObject->buffer); - if(result == TPM_RC_SUCCESS) - { - // Compute the beginning of sensitive data - sensitiveData = inIDObject->buffer - + sizeof(UINT16) + CryptHashGetDigestSize(outerHash); - dataSize = inIDObject->size - - (sizeof(UINT16) + CryptHashGetDigestSize(outerHash)); - // Unmarshal secret buffer to TPM2B_DIGEST structure - buffer = sensitiveData; - size = (INT32)dataSize; - result = TPM2B_DIGEST_Unmarshal(secret, &buffer, &size); - - // If there were no other unmarshaling errors, make sure that the - // expected amount of data was recovered - if(result == TPM_RC_SUCCESS && size != 0) - return TPM_RC_SIZE; - } - return result; -} - -//*** MemoryRemoveTrailingZeros() -// This function is used to adjust the length of an authorization value. -// It adjusts the size of the TPM2B so that it does not include octets -// at the end of the buffer that contain zero. -// The function returns the number of non-zero octets in the buffer. -UINT16 -MemoryRemoveTrailingZeros( - TPM2B_AUTH *auth // IN/OUT: value to adjust - ) -{ - while((auth->t.size > 0) && (auth->t.buffer[auth->t.size - 1] == 0)) - auth->t.size--; - return auth->t.size; -} - -//*** SetLabelAndContext() -// This function sets the label and context for a derived key. It is possible -// that 'label' or 'context' can end up being an Empty Buffer. -TPM_RC -SetLabelAndContext( - TPMS_DERIVE *labelContext, // IN/OUT: the recovered label and - // context - TPM2B_SENSITIVE_DATA *sensitive // IN: the sensitive data - ) -{ - TPMS_DERIVE sensitiveValue; - TPM_RC result; - INT32 size; - BYTE *buff; -// - // Unmarshal a TPMS_DERIVE from the TPM2B_SENSITIVE_DATA buffer - // If there is something to unmarshal... - if(sensitive->t.size != 0) - { - size = sensitive->t.size; - buff = sensitive->t.buffer; - result = TPMS_DERIVE_Unmarshal(&sensitiveValue, &buff, &size); - if(result != TPM_RC_SUCCESS) - return result; - // If there was a label in the public area leave it there, otherwise, copy - // the new value - if(labelContext->label.t.size == 0) - MemoryCopy2B(&labelContext->label.b, &sensitiveValue.label.b, - sizeof(labelContext->label.t.buffer)); - // if there was a context string in publicArea, it overrides - if(labelContext->context.t.size == 0) - MemoryCopy2B(&labelContext->context.b, &sensitiveValue.context.b, - sizeof(labelContext->label.t.buffer)); - } - return TPM_RC_SUCCESS; -} - -//*** UnmarshalToPublic() -// Support function to unmarshal the template. This is used because the -// Input may be a TPMT_TEMPLATE and that structure does not have the same -// size as a TPMT_PUBLIC because of the difference between the 'unique' and -// 'seed' fields. -// If 'derive' is not NULL, then the 'seed' field is assumed to contain -// a 'label' and 'context' that are unmarshaled into 'derive'. -TPM_RC -UnmarshalToPublic( - TPMT_PUBLIC *tOut, // OUT: output - TPM2B_TEMPLATE *tIn, // IN: - BOOL derivation, // IN: indicates if this is for a derivation - TPMS_DERIVE *labelContext// OUT: label and context if derivation - ) -{ - BYTE *buffer = tIn->t.buffer; - INT32 size = tIn->t.size; - TPM_RC result; -// - // make sure that tOut is zeroed so that there are no remnants from previous - // uses - MemorySet(tOut, 0, sizeof(TPMT_PUBLIC)); - // Unmarshal the components of the TPMT_PUBLIC up to the unique field - result = TPMI_ALG_PUBLIC_Unmarshal(&tOut->type, &buffer, &size); - if(result != TPM_RC_SUCCESS) - return result; - result = TPMI_ALG_HASH_Unmarshal(&tOut->nameAlg, &buffer, &size, FALSE); - if(result != TPM_RC_SUCCESS) - return result; - result = TPMA_OBJECT_Unmarshal(&tOut->objectAttributes, &buffer, &size); - if(result != TPM_RC_SUCCESS) - return result; - result = TPM2B_DIGEST_Unmarshal(&tOut->authPolicy, &buffer, &size); - if(result != TPM_RC_SUCCESS) - return result; - result = TPMU_PUBLIC_PARMS_Unmarshal(&tOut->parameters, &buffer, &size, - tOut->type); - if(result != TPM_RC_SUCCESS) - return result; - // Now unmarshal a TPMS_DERIVE if this is for derivation - if(derivation) - result = TPMS_DERIVE_Unmarshal(labelContext, &buffer, &size); - else - // otherwise, unmarshal a TPMU_PUBLIC_ID - result = TPMU_PUBLIC_ID_Unmarshal(&tOut->unique, &buffer, &size, - tOut->type); - // Make sure the template was used up - if((result == TPM_RC_SUCCESS) && (size != 0)) - result = TPM_RC_SIZE; - return result; -} - - -//*** ObjectSetExternal() -// Set the external attributes for an object. -void -ObjectSetExternal( - OBJECT *object - ) -{ - object->attributes.external = SET; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ReadPublic.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ReadPublic.c deleted file mode 100644 index a8e9ea27e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/ReadPublic.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "ReadPublic_fp.h" - -#if CC_ReadPublic // Conditional expansion of this file - -/*(See part 3 specification) -// read public area of a loaded object -*/ -// Return Type: TPM_RC -// TPM_RC_SEQUENCE can not read the public area of a sequence -// object -TPM_RC -TPM2_ReadPublic( - ReadPublic_In *in, // IN: input parameter list - ReadPublic_Out *out // OUT: output parameter list - ) -{ - OBJECT *object = HandleToObject(in->objectHandle); - -// Input Validation - // Can not read public area of a sequence object - if(ObjectIsSequence(object)) - return TPM_RC_SEQUENCE; - -// Command Output - out->outPublic.publicArea = object->publicArea; - out->name = object->name; - out->qualifiedName = object->qualifiedName; - - return TPM_RC_SUCCESS; -} - -#endif // CC_ReadPublic \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Unseal.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Unseal.c deleted file mode 100644 index f7a9d6edf..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Object/Unseal.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Unseal_fp.h" - -#if CC_Unseal // Conditional expansion of this file - -/*(See part 3 specification) -// return data in a sealed data blob -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'itemHandle' has wrong attributes -// TPM_RC_TYPE 'itemHandle' is not a KEYEDHASH data object -TPM_RC -TPM2_Unseal( - Unseal_In *in, - Unseal_Out *out - ) -{ - OBJECT *object; -// Input Validation - // Get pointer to loaded object - object = HandleToObject(in->itemHandle); - - // Input handle must be a data object - if(object->publicArea.type != TPM_ALG_KEYEDHASH) - return TPM_RCS_TYPE + RC_Unseal_itemHandle; - if(IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, decrypt) - || IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, sign) - || IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, restricted)) - return TPM_RCS_ATTRIBUTES + RC_Unseal_itemHandle; -// Command Output - // Copy data - out->outData = object->sensitive.sensitive.bits; - return TPM_RC_SUCCESS; -} - -#endif // CC_Unseal \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Allocate.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Allocate.c deleted file mode 100644 index e9cfacb7f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Allocate.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PCR_Allocate_fp.h" - -#if CC_PCR_Allocate // Conditional expansion of this file - -/*(See part 3 specification) -// Allocate PCR banks -*/ -// Return Type: TPM_RC -// TPM_RC_PCR the allocation did not have required PCR -// TPM_RC_NV_UNAVAILABLE NV is not accessible -// TPM_RC_NV_RATE NV is in a rate-limiting mode -TPM_RC -TPM2_PCR_Allocate( - PCR_Allocate_In *in, // IN: input parameter list - PCR_Allocate_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - - // The command needs NV update. Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point. - // Note: These codes are not listed in the return values above because it is - // an implementation choice to check in this routine rather than in a common - // function that is called before these actions are called. These return values - // are described in the Response Code section of Part 3. - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Command Output - - // Call PCR Allocation function. - result = PCRAllocate(&in->pcrAllocation, &out->maxPCR, - &out->sizeNeeded, &out->sizeAvailable); - if(result == TPM_RC_PCR) - return result; - - // - out->allocationSuccess = (result == TPM_RC_SUCCESS); - - // if re-configuration succeeds, set the flag to indicate PCR configuration is - // going to be changed in next boot - if(out->allocationSuccess == YES) - g_pcrReConfig = TRUE; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PCR_Allocate \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Event.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Event.c deleted file mode 100644 index 0cf39aa3a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Event.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PCR_Event_fp.h" - -#if CC_PCR_Event // Conditional expansion of this file - -/*(See part 3 specification) -// Update PCR -*/ -// Return Type: TPM_RC -// TPM_RC_LOCALITY current command locality is not allowed to -// extend the PCR referenced by 'pcrHandle' -TPM_RC -TPM2_PCR_Event( - PCR_Event_In *in, // IN: input parameter list - PCR_Event_Out *out // OUT: output parameter list - ) -{ - HASH_STATE hashState; - UINT32 i; - UINT16 size; - -// Input Validation - - // If a PCR extend is required - if(in->pcrHandle != TPM_RH_NULL) - { - // If the PCR is not allow to extend, return error - if(!PCRIsExtendAllowed(in->pcrHandle)) - return TPM_RC_LOCALITY; - - // If PCR is state saved and we need to update orderlyState, check NV - // availability - if(PCRIsStateSaved(in->pcrHandle)) - RETURN_IF_ORDERLY; - } - -// Internal Data Update - - out->digests.count = HASH_COUNT; - - // Iterate supported PCR bank algorithms to extend - for(i = 0; i < HASH_COUNT; i++) - { - TPM_ALG_ID hash = CryptHashGetAlgByIndex(i); - out->digests.digests[i].hashAlg = hash; - size = CryptHashStart(&hashState, hash); - CryptDigestUpdate2B(&hashState, &in->eventData.b); - CryptHashEnd(&hashState, size, - (BYTE *)&out->digests.digests[i].digest); - if(in->pcrHandle != TPM_RH_NULL) - PCRExtend(in->pcrHandle, hash, size, - (BYTE *)&out->digests.digests[i].digest); - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_PCR_Event \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Extend.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Extend.c deleted file mode 100644 index d789e7408..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Extend.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PCR_Extend_fp.h" - -#if CC_PCR_Extend // Conditional expansion of this file - -/*(See part 3 specification) -// Update PCR -*/ -// Return Type: TPM_RC -// TPM_RC_LOCALITY current command locality is not allowed to -// extend the PCR referenced by 'pcrHandle' -TPM_RC -TPM2_PCR_Extend( - PCR_Extend_In *in // IN: input parameter list - ) -{ - UINT32 i; - -// Input Validation - - // NOTE: This function assumes that the unmarshaling function for 'digests' will - // have validated that all of the indicated hash algorithms are valid. If the - // hash algorithms are correct, the unmarshaling code will unmarshal a digest - // of the size indicated by the hash algorithm. If the overall size is not - // consistent, the unmarshaling code will run out of input data or have input - // data left over. In either case, it will cause an unmarshaling error and this - // function will not be called. - - // For NULL handle, do nothing and return success - if(in->pcrHandle == TPM_RH_NULL) - return TPM_RC_SUCCESS; - - // Check if the extend operation is allowed by the current command locality - if(!PCRIsExtendAllowed(in->pcrHandle)) - return TPM_RC_LOCALITY; - - // If PCR is state saved and we need to update orderlyState, check NV - // availability - if(PCRIsStateSaved(in->pcrHandle)) - RETURN_IF_ORDERLY; - -// Internal Data Update - - // Iterate input digest list to extend - for(i = 0; i < in->digests.count; i++) - { - PCRExtend(in->pcrHandle, in->digests.digests[i].hashAlg, - CryptHashGetDigestSize(in->digests.digests[i].hashAlg), - (BYTE *)&in->digests.digests[i].digest); - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_PCR_Extend \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Read.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Read.c deleted file mode 100644 index f4dd6bf71..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Read.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PCR_Read_fp.h" - -#if CC_PCR_Read // Conditional expansion of this file - -/*(See part 3 specification) -// Read a set of PCR -*/ -TPM_RC -TPM2_PCR_Read( - PCR_Read_In *in, // IN: input parameter list - PCR_Read_Out *out // OUT: output parameter list - ) -{ -// Command Output - - // Call PCR read function. input pcrSelectionIn parameter could be changed - // to reflect the actual PCR being returned - PCRRead(&in->pcrSelectionIn, &out->pcrValues, &out->pcrUpdateCounter); - - out->pcrSelectionOut = in->pcrSelectionIn; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PCR_Read \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Reset.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Reset.c deleted file mode 100644 index de2daab58..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_Reset.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PCR_Reset_fp.h" - -#if CC_PCR_Reset // Conditional expansion of this file - -/*(See part 3 specification) -// Reset PCR -*/ -// Return Type: TPM_RC -// TPM_RC_LOCALITY current command locality is not allowed to -// reset the PCR referenced by 'pcrHandle' -TPM_RC -TPM2_PCR_Reset( - PCR_Reset_In *in // IN: input parameter list - ) -{ -// Input Validation - - // Check if the reset operation is allowed by the current command locality - if(!PCRIsResetAllowed(in->pcrHandle)) - return TPM_RC_LOCALITY; - - // If PCR is state saved and we need to update orderlyState, check NV - // availability - if(PCRIsStateSaved(in->pcrHandle)) - RETURN_IF_ORDERLY; - -// Internal Data Update - - // Reset selected PCR in all banks to 0 - PCRSetValue(in->pcrHandle, 0); - - // Indicate that the PCR changed so that pcrCounter will be incremented if - // necessary. - PCRChanged(in->pcrHandle); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PCR_Reset \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_SetAuthPolicy.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_SetAuthPolicy.c deleted file mode 100644 index b749de4be..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_SetAuthPolicy.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PCR_SetAuthPolicy_fp.h" - -#if CC_PCR_SetAuthPolicy // Conditional expansion of this file - -/*(See part 3 specification) -// Set authPolicy to a group of PCR -*/ -// Return Type: TPM_RC -// TPM_RC_SIZE size of 'authPolicy' is not the size of a digest -// produced by 'policyDigest' -// TPM_RC_VALUE PCR referenced by 'pcrNum' is not a member -// of a PCR policy group -TPM_RC -TPM2_PCR_SetAuthPolicy( - PCR_SetAuthPolicy_In *in // IN: input parameter list - ) -{ - UINT32 groupIndex; - - // The command needs NV update. Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Input Validation: - - // Check the authPolicy consistent with hash algorithm - if(in->authPolicy.t.size != CryptHashGetDigestSize(in->hashAlg)) - return TPM_RCS_SIZE + RC_PCR_SetAuthPolicy_authPolicy; - - // If PCR does not belong to a policy group, return TPM_RC_VALUE - if(!PCRBelongsPolicyGroup(in->pcrNum, &groupIndex)) - return TPM_RCS_VALUE + RC_PCR_SetAuthPolicy_pcrNum; - -// Internal Data Update - - // Set PCR policy - gp.pcrPolicies.hashAlg[groupIndex] = in->hashAlg; - gp.pcrPolicies.policy[groupIndex] = in->authPolicy; - - // Save new policy to NV - NV_SYNC_PERSISTENT(pcrPolicies); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PCR_SetAuthPolicy \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_SetAuthValue.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_SetAuthValue.c deleted file mode 100644 index cee6d156a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/PCR/PCR_SetAuthValue.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PCR_SetAuthValue_fp.h" - -#if CC_PCR_SetAuthValue // Conditional expansion of this file - -/*(See part 3 specification) -// Set authValue to a group of PCR -*/ -// Return Type: TPM_RC -// TPM_RC_VALUE PCR referenced by 'pcrHandle' is not a member -// of a PCR authorization group -TPM_RC -TPM2_PCR_SetAuthValue( - PCR_SetAuthValue_In *in // IN: input parameter list - ) -{ - UINT32 groupIndex; -// Input Validation: - - // If PCR does not belong to an auth group, return TPM_RC_VALUE - if(!PCRBelongsAuthGroup(in->pcrHandle, &groupIndex)) - return TPM_RC_VALUE; - - // The command may cause the orderlyState to be cleared due to the update of - // state clear data. If this is the case, Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point - RETURN_IF_ORDERLY; - -// Internal Data Update - - // Set PCR authValue - MemoryRemoveTrailingZeros(&in->auth); - gc.pcrAuthValues.auth[groupIndex] = in->auth; - - return TPM_RC_SUCCESS; -} - -#endif // CC_PCR_SetAuthValue \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Random/GetRandom.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Random/GetRandom.c deleted file mode 100644 index 9e69818ee..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Random/GetRandom.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "GetRandom_fp.h" - -#if CC_GetRandom // Conditional expansion of this file - -/*(See part 3 specification) -// random number generator -*/ -TPM_RC -TPM2_GetRandom( - GetRandom_In *in, // IN: input parameter list - GetRandom_Out *out // OUT: output parameter list - ) -{ -// Command Output - - // if the requested bytes exceed the output buffer size, generates the - // maximum bytes that the output buffer allows - if(in->bytesRequested > sizeof(TPMU_HA)) - out->randomBytes.t.size = sizeof(TPMU_HA); - else - out->randomBytes.t.size = in->bytesRequested; - - CryptRandomGenerate(out->randomBytes.t.size, out->randomBytes.t.buffer); - - return TPM_RC_SUCCESS; -} - -#endif // CC_GetRandom \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Random/StirRandom.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Random/StirRandom.c deleted file mode 100644 index befa55b32..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Random/StirRandom.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "StirRandom_fp.h" - -#if CC_StirRandom // Conditional expansion of this file - -/*(See part 3 specification) -// add entropy to the RNG state -*/ -TPM_RC -TPM2_StirRandom( - StirRandom_In *in // IN: input parameter list - ) -{ -// Internal Data Update - CryptRandomStir(in->inData.t.size, in->inData.t.buffer); - - return TPM_RC_SUCCESS; -} - -#endif // CC_StirRandom \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Session/PolicyRestart.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Session/PolicyRestart.c deleted file mode 100644 index f4af4458c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Session/PolicyRestart.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "PolicyRestart_fp.h" - -#if CC_PolicyRestart // Conditional expansion of this file - -/*(See part 3 specification) -// Restore a policy session to its initial state -*/ -TPM_RC -TPM2_PolicyRestart( - PolicyRestart_In *in // IN: input parameter list - ) -{ - // Initialize policy session data - SessionResetPolicyData(SessionGet(in->sessionHandle)); - - return TPM_RC_SUCCESS; -} - -#endif // CC_PolicyRestart \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Session/StartAuthSession.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Session/StartAuthSession.c deleted file mode 100644 index 56eca7fe0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Session/StartAuthSession.c +++ /dev/null @@ -1,165 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "StartAuthSession_fp.h" - -#if CC_StartAuthSession // Conditional expansion of this file - -/*(See part 3 specification) -// Start an authorization session -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'tpmKey' does not reference a decrypt key -// TPM_RC_CONTEXT_GAP the difference between the most recently created -// active context and the oldest active context is at -// the limits of the TPM -// TPM_RC_HANDLE input decrypt key handle only has public portion -// loaded -// TPM_RC_MODE 'symmetric' specifies a block cipher but the mode -// is not TPM_ALG_CFB. -// TPM_RC_SESSION_HANDLES no session handle is available -// TPM_RC_SESSION_MEMORY no more slots for loading a session -// TPM_RC_SIZE nonce less than 16 octets or greater than the size -// of the digest produced by 'authHash' -// TPM_RC_VALUE secret size does not match decrypt key type; or the -// recovered secret is larger than the digest size of -// the nameAlg of 'tpmKey'; or, for an RSA decrypt key, -// if 'encryptedSecret' is greater than the -// public modulus of 'tpmKey'. -TPM_RC -TPM2_StartAuthSession( - StartAuthSession_In *in, // IN: input parameter buffer - StartAuthSession_Out *out // OUT: output parameter buffer - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - OBJECT *tpmKey; // TPM key for decrypt salt - TPM2B_DATA salt; - -// Input Validation - - // Check input nonce size. IT should be at least 16 bytes but not larger - // than the digest size of session hash. - if(in->nonceCaller.t.size < 16 - || in->nonceCaller.t.size > CryptHashGetDigestSize(in->authHash)) - return TPM_RCS_SIZE + RC_StartAuthSession_nonceCaller; - - // If an decrypt key is passed in, check its validation - if(in->tpmKey != TPM_RH_NULL) - { - // Get pointer to loaded decrypt key - tpmKey = HandleToObject(in->tpmKey); - - // key must be asymmetric with its sensitive area loaded. Since this - // command does not require authorization, the presence of the sensitive - // area was not already checked as it is with most other commands that - // use the sensitive are so check it here - if(!CryptIsAsymAlgorithm(tpmKey->publicArea.type)) - return TPM_RCS_KEY + RC_StartAuthSession_tpmKey; - // secret size cannot be 0 - if(in->encryptedSalt.t.size == 0) - return TPM_RCS_VALUE + RC_StartAuthSession_encryptedSalt; - // Decrypting salt requires accessing the private portion of a key. - // Therefore, tmpKey can not be a key with only public portion loaded - if(tpmKey->attributes.publicOnly) - return TPM_RCS_HANDLE + RC_StartAuthSession_tpmKey; - // HMAC session input handle check. - // tpmKey should be a decryption key - if(!IS_ATTRIBUTE(tpmKey->publicArea.objectAttributes, TPMA_OBJECT, decrypt)) - return TPM_RCS_ATTRIBUTES + RC_StartAuthSession_tpmKey; - // Secret Decryption. A TPM_RC_VALUE, TPM_RC_KEY or Unmarshal errors - // may be returned at this point - result = CryptSecretDecrypt(tpmKey, &in->nonceCaller, SECRET_KEY, - &in->encryptedSalt, &salt); - if(result != TPM_RC_SUCCESS) - return TPM_RCS_VALUE + RC_StartAuthSession_encryptedSalt; - } - else - { - // secret size must be 0 - if(in->encryptedSalt.t.size != 0) - return TPM_RCS_VALUE + RC_StartAuthSession_encryptedSalt; - salt.t.size = 0; - } - switch(HandleGetType(in->bind)) - { - case TPM_HT_TRANSIENT: - { - OBJECT *object = HandleToObject(in->bind); - // If the bind handle references a transient object, make sure that we - // can get to the authorization value. Also, make sure that the object - // has a proper Name (nameAlg != TPM_ALG_NULL). If it doesn't, then - // it might be possible to bind to an object where the authValue is - // known. This does not create a real issue in that, if you know the - // authorization value, you can actually bind to the object. However, - // there is a potential - if(object->attributes.publicOnly == SET) - return TPM_RCS_HANDLE + RC_StartAuthSession_bind; - break; - } - case TPM_HT_NV_INDEX: - // a PIN index can't be a bind object - { - NV_INDEX *nvIndex = NvGetIndexInfo(in->bind, NULL); - if(IsNvPinPassIndex(nvIndex->publicArea.attributes) - || IsNvPinFailIndex(nvIndex->publicArea.attributes)) - return TPM_RCS_HANDLE + RC_StartAuthSession_bind; - break; - } - default: - break; - } - // If 'symmetric' is a symmetric block cipher (not TPM_ALG_NULL or TPM_ALG_XOR) - // then the mode must be CFB. - if(in->symmetric.algorithm != TPM_ALG_NULL - && in->symmetric.algorithm != TPM_ALG_XOR - && in->symmetric.mode.sym != TPM_ALG_CFB) - return TPM_RCS_MODE + RC_StartAuthSession_symmetric; - -// Internal Data Update and command output - - // Create internal session structure. TPM_RC_CONTEXT_GAP, TPM_RC_NO_HANDLES - // or TPM_RC_SESSION_MEMORY errors may be returned at this point. - // - // The detailed actions for creating the session context are not shown here - // as the details are implementation dependent - // SessionCreate sets the output handle and nonceTPM - result = SessionCreate(in->sessionType, in->authHash, &in->nonceCaller, - &in->symmetric, in->bind, &salt, &out->sessionHandle, - &out->nonceTPM); - return result; -} - -#endif // CC_StartAuthSession \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Signature/Sign.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Signature/Sign.c deleted file mode 100644 index 286ac853a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Signature/Sign.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Sign_fp.h" - -#if CC_Sign // Conditional expansion of this file - -#include "Attest_spt_fp.h" - -/*(See part 3 specification) -// sign an externally provided hash using an asymmetric signing key -*/ -// Return Type: TPM_RC -// TPM_RC_BINDING The public and private portions of the key are not -// properly bound. -// TPM_RC_KEY 'signHandle' does not reference a signing key; -// TPM_RC_SCHEME the scheme is not compatible with sign key type, -// or input scheme is not compatible with default -// scheme, or the chosen scheme is not a valid -// sign scheme -// TPM_RC_TICKET 'validation' is not a valid ticket -// TPM_RC_VALUE the value to sign is larger than allowed for the -// type of 'keyHandle' - -TPM_RC -TPM2_Sign( - Sign_In *in, // IN: input parameter list - Sign_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - TPMT_TK_HASHCHECK ticket; - OBJECT *signObject = HandleToObject(in->keyHandle); -// -// Input Validation - if(!IsSigningObject(signObject)) - return TPM_RCS_KEY + RC_Sign_keyHandle; - - // A key that will be used for x.509 signatures can't be used in TPM2_Sign(). - if(IS_ATTRIBUTE(signObject->publicArea.objectAttributes, TPMA_OBJECT, x509sign)) - return TPM_RCS_ATTRIBUTES + RC_Sign_keyHandle; - - // pick a scheme for sign. If the input sign scheme is not compatible with - // the default scheme, return an error. - if(!CryptSelectSignScheme(signObject, &in->inScheme)) - return TPM_RCS_SCHEME + RC_Sign_inScheme; - - // If validation is provided, or the key is restricted, check the ticket - if(in->validation.digest.t.size != 0 - || IS_ATTRIBUTE(signObject->publicArea.objectAttributes, - TPMA_OBJECT, restricted)) - { - // Compute and compare ticket - TicketComputeHashCheck(in->validation.hierarchy, - in->inScheme.details.any.hashAlg, - &in->digest, &ticket); - - if(!MemoryEqual2B(&in->validation.digest.b, &ticket.digest.b)) - return TPM_RCS_TICKET + RC_Sign_validation; - } - else - // If we don't have a ticket, at least verify that the provided 'digest' - // is the size of the scheme hashAlg digest. - // NOTE: this does not guarantee that the 'digest' is actually produced using - // the indicated hash algorithm, but at least it might be. - { - if(in->digest.t.size - != CryptHashGetDigestSize(in->inScheme.details.any.hashAlg)) - return TPM_RCS_SIZE + RC_Sign_digest; - } - -// Command Output - // Sign the hash. A TPM_RC_VALUE or TPM_RC_SCHEME - // error may be returned at this point - result = CryptSign(signObject, &in->inScheme, &in->digest, &out->signature); - - return result; -} - -#endif // CC_Sign \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Signature/VerifySignature.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Signature/VerifySignature.c deleted file mode 100644 index 52e7d3013..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Signature/VerifySignature.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "VerifySignature_fp.h" - -#if CC_VerifySignature // Conditional expansion of this file - -/*(See part 3 specification) -// This command uses loaded key to validate an asymmetric signature on a message -// with the message digest passed to the TPM. -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'keyHandle' does not reference a signing key -// TPM_RC_SIGNATURE signature is not genuine -// TPM_RC_SCHEME CryptValidateSignature() -// TPM_RC_HANDLE the input handle is references an HMAC key but -// the private portion is not loaded -TPM_RC -TPM2_VerifySignature( - VerifySignature_In *in, // IN: input parameter list - VerifySignature_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - OBJECT *signObject = HandleToObject(in->keyHandle); - TPMI_RH_HIERARCHY hierarchy; - -// Input Validation - // The object to validate the signature must be a signing key. - if(!IS_ATTRIBUTE(signObject->publicArea.objectAttributes, TPMA_OBJECT, sign)) - return TPM_RCS_ATTRIBUTES + RC_VerifySignature_keyHandle; - - // Validate Signature. TPM_RC_SCHEME, TPM_RC_HANDLE or TPM_RC_SIGNATURE - // error may be returned by CryptCVerifySignatrue() - result = CryptValidateSignature(in->keyHandle, &in->digest, &in->signature); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_VerifySignature_signature); - -// Command Output - - hierarchy = GetHeriarchy(in->keyHandle); - if(hierarchy == TPM_RH_NULL - || signObject->publicArea.nameAlg == TPM_ALG_NULL) - { - // produce empty ticket if hierarchy is TPM_RH_NULL or nameAlg is - // ALG_NULL - out->validation.tag = TPM_ST_VERIFIED; - out->validation.hierarchy = TPM_RH_NULL; - out->validation.digest.t.size = 0; - } - else - { - // Compute ticket - TicketComputeVerified(hierarchy, &in->digest, &signObject->name, - &out->validation); - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_VerifySignature \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Startup/Shutdown.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Startup/Shutdown.c deleted file mode 100644 index faa4b9e9e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Startup/Shutdown.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Shutdown_fp.h" - -#if CC_Shutdown // Conditional expansion of this file - -/*(See part 3 specification) -// Shut down TPM for power off -*/ -// Return Type: TPM_RC -// TPM_RC_TYPE if PCR bank has been re-configured, a -// CLEAR StateSave is required -TPM_RC -TPM2_Shutdown( - Shutdown_In *in // IN: input parameter list - ) -{ - // The command needs NV update. Check if NV is available. - // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at - // this point - RETURN_IF_NV_IS_NOT_AVAILABLE; - -// Input Validation - - // If PCR bank has been reconfigured, a CLEAR state save is required - if(g_pcrReConfig && in->shutdownType == TPM_SU_STATE) - return TPM_RCS_TYPE + RC_Shutdown_shutdownType; - -// Internal Data Update - - gp.orderlyState = in->shutdownType; - - // PCR private date state save - PCRStateSave(in->shutdownType); - - // Save RAM backed NV index data - NvUpdateIndexOrderlyData(); - -#if ACCUMULATE_SELF_HEAL_TIMER - // Save the current time value - go.time = g_time; -#endif - - // Save all orderly data - NvWrite(NV_ORDERLY_DATA, sizeof(ORDERLY_DATA), &go); - - if(in->shutdownType == TPM_SU_STATE) - { - // Save STATE_RESET and STATE_CLEAR data - NvWrite(NV_STATE_CLEAR_DATA, sizeof(STATE_CLEAR_DATA), &gc); - NvWrite(NV_STATE_RESET_DATA, sizeof(STATE_RESET_DATA), &gr); - - // Save the startup flags for resume - if(g_DrtmPreStartup) - gp.orderlyState = TPM_SU_STATE | PRE_STARTUP_FLAG; - else if(g_StartupLocality3) - gp.orderlyState = TPM_SU_STATE | STARTUP_LOCALITY_3; - } - // only two shutdown options. - else if(in->shutdownType != TPM_SU_CLEAR) - return TPM_RCS_VALUE + RC_Shutdown_shutdownType; - - NV_SYNC_PERSISTENT(orderlyState); - - return TPM_RC_SUCCESS; -} - -#endif // CC_Shutdown \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Startup/Startup.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Startup/Startup.c deleted file mode 100644 index 1039e95aa..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Startup/Startup.c +++ /dev/null @@ -1,244 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Startup_fp.h" - -#if CC_Startup // Conditional expansion of this file - -/*(See part 3 specification) -// Initialize TPM because a system-wide reset -*/ -// Return Type: TPM_RC -// TPM_RC_LOCALITY a Startup(STATE) does not have the same H-CRTM -// state as the previous Startup() or the locality -// of the startup is not 0 pr 3 -// TPM_RC_NV_UNINITIALIZED the saved state cannot be recovered and a -// Startup(CLEAR) is required. -// TPM_RC_VALUE start up type is not compatible with previous -// shutdown sequence - -TPM_RC -TPM2_Startup( - Startup_In *in // IN: input parameter list - ) -{ - STARTUP_TYPE startup; - BYTE locality = _plat__LocalityGet(); - BOOL OK = TRUE; -// - // The command needs NV update. - RETURN_IF_NV_IS_NOT_AVAILABLE; - - // Get the flags for the current startup locality and the H-CRTM. - // Rather than generalizing the locality setting, this code takes advantage - // of the fact that the PC Client specification only allows Startup() - // from locality 0 and 3. To generalize this probably would require a - // redo of the NV space and since this is a feature that is hardly ever used - // outside of the PC Client, this code just support the PC Client needs. - -// Input Validation - // Check that the locality is a supported value - if(locality != 0 && locality != 3) - return TPM_RC_LOCALITY; - // If there was a H-CRTM, then treat the locality as being 3 - // regardless of what the Startup() was. This is done to preserve the - // H-CRTM PCR so that they don't get overwritten with the normal - // PCR startup initialization. This basically means that g_StartupLocality3 - // and g_DrtmPreStartup can't both be SET at the same time. - if(g_DrtmPreStartup) - locality = 0; - g_StartupLocality3 = (locality == 3); - -#if USE_DA_USED - // If there was no orderly shutdown, then their might have been a write to - // failedTries that didn't get recorded but only if g_daUsed was SET in the - // shutdown state - g_daUsed = (gp.orderlyState == SU_DA_USED_VALUE); - if(g_daUsed) - gp.orderlyState = SU_NONE_VALUE; -#endif - - g_prevOrderlyState = gp.orderlyState; - - // If there was a proper shutdown, then the startup modifiers are in the - // orderlyState. Turn them off in the copy. - if(IS_ORDERLY(g_prevOrderlyState)) - g_prevOrderlyState &= ~(PRE_STARTUP_FLAG | STARTUP_LOCALITY_3); - // If this is a Resume, - if(in->startupType == TPM_SU_STATE) - { - // then there must have been a prior TPM2_ShutdownState(STATE) - if(g_prevOrderlyState != TPM_SU_STATE) - return TPM_RCS_VALUE + RC_Startup_startupType; - // and the part of NV used for state save must have been recovered - // correctly. - // NOTE: if this fails, then the caller will need to do Startup(CLEAR). The - // code for Startup(Clear) cannot fail if the NV can't be read correctly - // because that would prevent the TPM from ever getting unstuck. - if(g_nvOk == FALSE) - return TPM_RC_NV_UNINITIALIZED; - // For Resume, the H-CRTM has to be the same as the previous boot - if(g_DrtmPreStartup != ((gp.orderlyState & PRE_STARTUP_FLAG) != 0)) - return TPM_RCS_VALUE + RC_Startup_startupType; - if(g_StartupLocality3 != ((gp.orderlyState & STARTUP_LOCALITY_3) != 0)) - return TPM_RC_LOCALITY; - } - // Clean up the gp state - gp.orderlyState = g_prevOrderlyState; - -// Internal Date Update - if((gp.orderlyState == TPM_SU_STATE) && (g_nvOk == TRUE)) - { - // Always read the data that is only cleared on a Reset because this is not - // a reset - NvRead(&gr, NV_STATE_RESET_DATA, sizeof(gr)); - if(in->startupType == TPM_SU_STATE) - { - // If this is a startup STATE (a Resume) need to read the data - // that is cleared on a startup CLEAR because this is not a Reset - // or Restart. - NvRead(&gc, NV_STATE_CLEAR_DATA, sizeof(gc)); - startup = SU_RESUME; - } - else - startup = SU_RESTART; - } - else - // Will do a TPM reset if Shutdown(CLEAR) and Startup(CLEAR) or no shutdown - // or there was a failure reading the NV data. - startup = SU_RESET; - // Startup for cryptographic library. Don't do this until after the orderly - // state has been read in from NV. - OK = OK && CryptStartup(startup); - - // When the cryptographic library has been started, indicate that a TPM2_Startup - // command has been received. - OK = OK && TPMRegisterStartup(); - -#ifdef VENDOR_PERMANENT - // Read the platform unique value that is used as VENDOR_PERMANENT - // authorization value - g_platformUniqueDetails.t.size - = (UINT16)_plat__GetUnique(1, sizeof(g_platformUniqueDetails.t.buffer), - g_platformUniqueDetails.t.buffer); -#endif - -// Start up subsystems - // Start set the safe flag - OK = OK && TimeStartup(startup); - - // Start dictionary attack subsystem - OK = OK && DAStartup(startup); - - // Enable hierarchies - OK = OK && HierarchyStartup(startup); - - // Restore/Initialize PCR - OK = OK && PCRStartup(startup, locality); - - // Restore/Initialize command audit information - OK = OK && CommandAuditStartup(startup); - -//// The following code was moved from Time.c where it made no sense - if(OK) - { - switch(startup) - { - case SU_RESUME: - // Resume sequence - gr.restartCount++; - break; - case SU_RESTART: - // Hibernate sequence - gr.clearCount++; - gr.restartCount++; - break; - default: - // Reset object context ID to 0 - gr.objectContextID = 0; - // Reset clearCount to 0 - gr.clearCount = 0; - - // Reset sequence - // Increase resetCount - gp.resetCount++; - - // Write resetCount to NV - NV_SYNC_PERSISTENT(resetCount); - - gp.totalResetCount++; - // We do not expect the total reset counter overflow during the life - // time of TPM. if it ever happens, TPM will be put to failure mode - // and there is no way to recover it. - // The reason that there is no recovery is that we don't increment - // the NV totalResetCount when incrementing would make it 0. When the - // TPM starts up again, the old value of totalResetCount will be read - // and we will get right back to here with the increment failing. - if(gp.totalResetCount == 0) - FAIL(FATAL_ERROR_INTERNAL); - - // Write total reset counter to NV - NV_SYNC_PERSISTENT(totalResetCount); - - // Reset restartCount - gr.restartCount = 0; - - break; - } - } - // Initialize session table - OK = OK && SessionStartup(startup); - - // Initialize object table - OK = OK && ObjectStartup(); - - // Initialize index/evict data. This function clears read/write locks - // in NV index - OK = OK && NvEntityStartup(startup); - - // Initialize the orderly shut down flag for this cycle to SU_NONE_VALUE. - gp.orderlyState = SU_NONE_VALUE; - - OK = OK && NV_SYNC_PERSISTENT(orderlyState); - - // This can be reset after the first completion of a TPM2_Startup() after - // a power loss. It can probably be reset earlier but this is an OK place. - if(OK) - g_powerWasLost = FALSE; - - return (OK) ? TPM_RC_SUCCESS : TPM_RC_FAILURE; -} - -#endif // CC_Startup \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt.c deleted file mode 100644 index 16fd4bb89..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "EncryptDecrypt_fp.h" -#if CC_EncryptDecrypt2 -#include "EncryptDecrypt_spt_fp.h" -#endif - -#if CC_EncryptDecrypt // Conditional expansion of this file - -/*(See part 3 specification) -// symmetric encryption or decryption -*/ -// Return Type: TPM_RC -// TPM_RC_KEY is not a symmetric decryption key with both -// public and private portions loaded -// TPM_RC_SIZE 'IvIn' size is incompatible with the block cipher mode; -// or 'inData' size is not an even multiple of the block -// size for CBC or ECB mode -// TPM_RC_VALUE 'keyHandle' is restricted and the argument 'mode' does -// not match the key's mode -TPM_RC -TPM2_EncryptDecrypt( - EncryptDecrypt_In *in, // IN: input parameter list - EncryptDecrypt_Out *out // OUT: output parameter list - ) -{ -#if CC_EncryptDecrypt2 - return EncryptDecryptShared(in->keyHandle, in->decrypt, in->mode, - &in->ivIn, &in->inData, out); -#else - OBJECT *symKey; - UINT16 keySize; - UINT16 blockSize; - BYTE *key; - TPM_ALG_ID alg; - TPM_ALG_ID mode; - TPM_RC result; - BOOL OK; - TPMA_OBJECT attributes; - -// Input Validation - symKey = HandleToObject(in->keyHandle); - mode = symKey->publicArea.parameters.symDetail.sym.mode.sym; - attributes = symKey->publicArea.objectAttributes; - - // The input key should be a symmetric key - if(symKey->publicArea.type != TPM_ALG_SYMCIPHER) - return TPM_RCS_KEY + RC_EncryptDecrypt_keyHandle; - // The key must be unrestricted and allow the selected operation - OK = IS_ATTRIBUTE(attributes, TPMA_OBJECT, restricted) - if(YES == in->decrypt) - OK = OK && IS_ATTRIBUTE(attributes, TPMA_OBJECT, decrypt); - else - OK = OK && IS_ATTRIBUTE(attributes, TPMA_OBJECT, sign); - if(!OK) - return TPM_RCS_ATTRIBUTES + RC_EncryptDecrypt_keyHandle; - - // If the key mode is not TPM_ALG_NULL... - // or TPM_ALG_NULL - if(mode != TPM_ALG_NULL) - { - // then the input mode has to be TPM_ALG_NULL or the same as the key - if((in->mode != TPM_ALG_NULL) && (in->mode != mode)) - return TPM_RCS_MODE + RC_EncryptDecrypt_mode; - } - else - { - // if the key mode is null, then the input can't be null - if(in->mode == TPM_ALG_NULL) - return TPM_RCS_MODE + RC_EncryptDecrypt_mode; - mode = in->mode; - } - // The input iv for ECB mode should be an Empty Buffer. All the other modes - // should have an iv size same as encryption block size - keySize = symKey->publicArea.parameters.symDetail.sym.keyBits.sym; - alg = symKey->publicArea.parameters.symDetail.sym.algorithm; - blockSize = CryptGetSymmetricBlockSize(alg, keySize); - - // reverify the algorithm. This is mainly to keep static analysis tools happy - if(blockSize == 0) - return TPM_RCS_KEY + RC_EncryptDecrypt_keyHandle; - - // Note: When an algorithm is not supported by a TPM, the TPM_ALG_xxx for that - // algorithm is not defined. However, it is assumed that the ALG_xxx_VALUE for - // the algorithm is always defined. Both have the same numeric value. - // ALG_xxx_VALUE is used here so that the code does not get cluttered with - // #ifdef's. Having this check does not mean that the algorithm is supported. - // If it was not supported the unmarshaling code would have rejected it before - // this function were called. This means that, depending on the implementation, - // the check could be redundant but it doesn't hurt. - if(((mode == ALG_ECB_VALUE) && (in->ivIn.t.size != 0)) - || ((mode != ALG_ECB_VALUE) && (in->ivIn.t.size != blockSize))) - return TPM_RCS_SIZE + RC_EncryptDecrypt_ivIn; - - // The input data size of CBC mode or ECB mode must be an even multiple of - // the symmetric algorithm's block size - if(((mode == ALG_CBC_VALUE) || (mode == ALG_ECB_VALUE)) - && ((in->inData.t.size % blockSize) != 0)) - return TPM_RCS_SIZE + RC_EncryptDecrypt_inData; - - // Copy IV - // Note: This is copied here so that the calls to the encrypt/decrypt functions - // will modify the output buffer, not the input buffer - out->ivOut = in->ivIn; - -// Command Output - key = symKey->sensitive.sensitive.sym.t.buffer; - // For symmetric encryption, the cipher data size is the same as plain data - // size. - out->outData.t.size = in->inData.t.size; - if(in->decrypt == YES) - { - // Decrypt data to output - result = CryptSymmetricDecrypt(out->outData.t.buffer, alg, keySize, key, - &(out->ivOut), mode, in->inData.t.size, - in->inData.t.buffer); - } - else - { - // Encrypt data to output - result = CryptSymmetricEncrypt(out->outData.t.buffer, alg, keySize, key, - &(out->ivOut), mode, in->inData.t.size, - in->inData.t.buffer); - } - return result; -#endif // CC_EncryptDecrypt2 - -} - -#endif // CC_EncryptDecrypt \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt2.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt2.c deleted file mode 100644 index 4623c8999..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt2.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "EncryptDecrypt2_fp.h" -#include "EncryptDecrypt_fp.h" -#include "EncryptDecrypt_spt_fp.h" - -#if CC_EncryptDecrypt2 // Conditional expansion of this file - -/*(See part 3 specification) -// symmetric encryption or decryption using modified parameter list -*/ -// Return Type: TPM_RC -// TPM_RC_KEY is not a symmetric decryption key with both -// public and private portions loaded -// TPM_RC_SIZE 'IvIn' size is incompatible with the block cipher mode; -// or 'inData' size is not an even multiple of the block -// size for CBC or ECB mode -// TPM_RC_VALUE 'keyHandle' is restricted and the argument 'mode' does -// not match the key's mode -TPM_RC -TPM2_EncryptDecrypt2( - EncryptDecrypt2_In *in, // IN: input parameter list - EncryptDecrypt2_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; - // EncryptDecyrptShared() performs the operations as shown in - // TPM2_EncrypDecrypt - result = EncryptDecryptShared(in->keyHandle, in->decrypt, in->mode, - &in->ivIn, &in->inData, - (EncryptDecrypt_Out *)out); - // Handle response code swizzle. - switch(result) - { - case TPM_RCS_MODE + RC_EncryptDecrypt_mode: - result = TPM_RCS_MODE + RC_EncryptDecrypt2_mode; - break; - case TPM_RCS_SIZE + RC_EncryptDecrypt_ivIn: - result = TPM_RCS_SIZE + RC_EncryptDecrypt2_ivIn; - break; - case TPM_RCS_SIZE + RC_EncryptDecrypt_inData: - result = TPM_RCS_SIZE + RC_EncryptDecrypt2_inData; - break; - default: - break; - } - return result; -} - -#endif // CC_EncryptDecrypt2 \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt_spt.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt_spt.c deleted file mode 100644 index 593986648..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/EncryptDecrypt_spt.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "EncryptDecrypt_fp.h" -#include "EncryptDecrypt_spt_fp.h" - -#if CC_EncryptDecrypt2 - -/*(See part 3 specification) -// symmetric encryption or decryption -*/ -// Return Type: TPM_RC -// TPM_RC_KEY is not a symmetric decryption key with both -// public and private portions loaded -// TPM_RC_SIZE 'IvIn' size is incompatible with the block cipher mode; -// or 'inData' size is not an even multiple of the block -// size for CBC or ECB mode -// TPM_RC_VALUE 'keyHandle' is restricted and the argument 'mode' does -// not match the key's mode -TPM_RC -EncryptDecryptShared( - TPMI_DH_OBJECT keyHandleIn, - TPMI_YES_NO decryptIn, - TPMI_ALG_SYM_MODE modeIn, - TPM2B_IV *ivIn, - TPM2B_MAX_BUFFER *inData, - EncryptDecrypt_Out *out - ) -{ - OBJECT *symKey; - UINT16 keySize; - UINT16 blockSize; - BYTE *key; - TPM_ALG_ID alg; - TPM_ALG_ID mode; - TPM_RC result; - BOOL OK; -// Input Validation - symKey = HandleToObject(keyHandleIn); - mode = symKey->publicArea.parameters.symDetail.sym.mode.sym; - - // The input key should be a symmetric key - if(symKey->publicArea.type != TPM_ALG_SYMCIPHER) - return TPM_RCS_KEY + RC_EncryptDecrypt_keyHandle; - // The key must be unrestricted and allow the selected operation - OK = !IS_ATTRIBUTE(symKey->publicArea.objectAttributes, - TPMA_OBJECT, restricted); - if(YES == decryptIn) - OK = OK && IS_ATTRIBUTE(symKey->publicArea.objectAttributes, - TPMA_OBJECT, decrypt); - else - OK = OK && IS_ATTRIBUTE(symKey->publicArea.objectAttributes, - TPMA_OBJECT, sign); - if(!OK) - return TPM_RCS_ATTRIBUTES + RC_EncryptDecrypt_keyHandle; - - // Make sure that key is an encrypt/decrypt key and not SMAC - if(!CryptSymModeIsValid(mode, TRUE)) - return TPM_RCS_MODE + RC_EncryptDecrypt_keyHandle; - - // If the key mode is not TPM_ALG_NULL... - // or TPM_ALG_NULL - if(mode != TPM_ALG_NULL) - { - // then the input mode has to be TPM_ALG_NULL or the same as the key - if((modeIn != TPM_ALG_NULL) && (modeIn != mode)) - return TPM_RCS_MODE + RC_EncryptDecrypt_mode; - } - else - { - // if the key mode is null, then the input can't be null - if(modeIn == TPM_ALG_NULL) - return TPM_RCS_MODE + RC_EncryptDecrypt_mode; - mode = modeIn; - } - // The input iv for ECB mode should be an Empty Buffer. All the other modes - // should have an iv size same as encryption block size - keySize = symKey->publicArea.parameters.symDetail.sym.keyBits.sym; - alg = symKey->publicArea.parameters.symDetail.sym.algorithm; - blockSize = CryptGetSymmetricBlockSize(alg, keySize); - - // reverify the algorithm. This is mainly to keep static analysis tools happy - if(blockSize == 0) - return TPM_RCS_KEY + RC_EncryptDecrypt_keyHandle; - - // Note: When an algorithm is not supported by a TPM, the TPM_ALG_xxx for that - // algorithm is not defined. However, it is assumed that the ALG_xxx_VALUE for - // the algorithm is always defined. Both have the same numeric value. - // ALG_xxx_VALUE is used here so that the code does not get cluttered with - // #ifdef's. Having this check does not mean that the algorithm is supported. - // If it was not supported the unmarshaling code would have rejected it before - // this function were called. This means that, depending on the implementation, - // the check could be redundant but it doesn't hurt. - if(((mode == ALG_ECB_VALUE) && (ivIn->t.size != 0)) - || ((mode != ALG_ECB_VALUE) && (ivIn->t.size != blockSize))) - return TPM_RCS_SIZE + RC_EncryptDecrypt_ivIn; - - // The input data size of CBC mode or ECB mode must be an even multiple of - // the symmetric algorithm's block size - if(((mode == ALG_CBC_VALUE) || (mode == ALG_ECB_VALUE)) - && ((inData->t.size % blockSize) != 0)) - return TPM_RCS_SIZE + RC_EncryptDecrypt_inData; - - // Copy IV - // Note: This is copied here so that the calls to the encrypt/decrypt functions - // will modify the output buffer, not the input buffer - out->ivOut = *ivIn; - -// Command Output - key = symKey->sensitive.sensitive.sym.t.buffer; - // For symmetric encryption, the cipher data size is the same as plain data - // size. - out->outData.t.size = inData->t.size; - if(decryptIn == YES) - { - // Decrypt data to output - result = CryptSymmetricDecrypt(out->outData.t.buffer, alg, keySize, key, - &(out->ivOut), mode, inData->t.size, - inData->t.buffer); - } - else - { - // Encrypt data to output - result = CryptSymmetricEncrypt(out->outData.t.buffer, alg, keySize, key, - &(out->ivOut), mode, inData->t.size, - inData->t.buffer); - } - return result; -} - -#endif // CC_EncryptDecrypt \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/HMAC.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/HMAC.c deleted file mode 100644 index 29ec971d4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/HMAC.c +++ /dev/null @@ -1,108 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "HMAC_fp.h" - -#if CC_HMAC // Conditional expansion of this file - -/*(See part 3 specification) -// Compute HMAC on a data buffer -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES key referenced by 'handle' is a restricted key -// TPM_RC_KEY 'handle' does not reference a signing key -// TPM_RC_TYPE key referenced by 'handle' is not an HMAC key -// TPM_RC_VALUE 'hashAlg' is not compatible with the hash algorithm -// of the scheme of the object referenced by 'handle' -TPM_RC -TPM2_HMAC( - HMAC_In *in, // IN: input parameter list - HMAC_Out *out // OUT: output parameter list - ) -{ - HMAC_STATE hmacState; - OBJECT *hmacObject; - TPMI_ALG_HASH hashAlg; - TPMT_PUBLIC *publicArea; - -// Input Validation - - // Get HMAC key object and public area pointers - hmacObject = HandleToObject(in->handle); - publicArea = &hmacObject->publicArea; - // Make sure that the key is an HMAC key - if(publicArea->type != TPM_ALG_KEYEDHASH) - return TPM_RCS_TYPE + RC_HMAC_handle; - - // and that it is unrestricted - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, restricted)) - return TPM_RCS_ATTRIBUTES + RC_HMAC_handle; - - // and that it is a signing key - if(!IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign)) - return TPM_RCS_KEY + RC_HMAC_handle; - - // See if the key has a default - if(publicArea->parameters.keyedHashDetail.scheme.scheme == TPM_ALG_NULL) - // it doesn't so use the input value - hashAlg = in->hashAlg; - else - { - // key has a default so use it - hashAlg - = publicArea->parameters.keyedHashDetail.scheme.details.hmac.hashAlg; - // and verify that the input was either the TPM_ALG_NULL or the default - if(in->hashAlg != TPM_ALG_NULL && in->hashAlg != hashAlg) - hashAlg = TPM_ALG_NULL; - } - // if we ended up without a hash algorithm then return an error - if(hashAlg == TPM_ALG_NULL) - return TPM_RCS_VALUE + RC_HMAC_hashAlg; - -// Command Output - - // Start HMAC stack - out->outHMAC.t.size = CryptHmacStart2B(&hmacState, hashAlg, - &hmacObject->sensitive.sensitive.bits.b); - // Adding HMAC data - CryptDigestUpdate2B(&hmacState.hashState, &in->buffer.b); - - // Complete HMAC - CryptHmacEnd2B(&hmacState, &out->outHMAC.b); - - return TPM_RC_SUCCESS; -} - -#endif // CC_HMAC \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/Hash.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/Hash.c deleted file mode 100644 index 9736185b3..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/Hash.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "Hash_fp.h" - -#if CC_Hash // Conditional expansion of this file - -/*(See part 3 specification) -// Hash a data buffer -*/ -TPM_RC -TPM2_Hash( - Hash_In *in, // IN: input parameter list - Hash_Out *out // OUT: output parameter list - ) -{ - HASH_STATE hashState; - -// Command Output - - // Output hash - // Start hash stack - out->outHash.t.size = CryptHashStart(&hashState, in->hashAlg); - // Adding hash data - CryptDigestUpdate2B(&hashState, &in->data.b); - // Complete hash - CryptHashEnd2B(&hashState, &out->outHash.b); - - // Output ticket - out->validation.tag = TPM_ST_HASHCHECK; - out->validation.hierarchy = in->hierarchy; - - if(in->hierarchy == TPM_RH_NULL) - { - // Ticket is not required - out->validation.hierarchy = TPM_RH_NULL; - out->validation.digest.t.size = 0; - } - else if(in->data.t.size >= sizeof(TPM_GENERATED) - && !TicketIsSafe(&in->data.b)) - { - // Ticket is not safe - out->validation.hierarchy = TPM_RH_NULL; - out->validation.digest.t.size = 0; - } - else - { - // Compute ticket - TicketComputeHashCheck(in->hierarchy, in->hashAlg, - &out->outHash, &out->validation); - } - - return TPM_RC_SUCCESS; -} - -#endif // CC_Hash \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/MAC.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/MAC.c deleted file mode 100644 index 219406c8e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Symmetric/MAC.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "MAC_fp.h" - -#if CC_MAC // Conditional expansion of this file - -/*(See part 3 specification) -// Compute MAC on a data buffer -*/ -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES key referenced by 'handle' is a restricted key -// TPM_RC_KEY 'handle' does not reference a signing key -// TPM_RC_TYPE key referenced by 'handle' is not an HMAC key -// TPM_RC_VALUE 'hashAlg' is not compatible with the hash algorithm -// of the scheme of the object referenced by 'handle' -TPM_RC -TPM2_MAC( - MAC_In *in, // IN: input parameter list - MAC_Out *out // OUT: output parameter list - ) -{ - OBJECT *keyObject; - HMAC_STATE state; - TPMT_PUBLIC *publicArea; - TPM_RC result; - -// Input Validation - // Get MAC key object and public area pointers - keyObject = HandleToObject(in->handle); - publicArea = &keyObject->publicArea; - - // If the key is not able to do a MAC, indicate that the handle selects an - // object that can't do a MAC - result = CryptSelectMac(publicArea, &in->inScheme); - if(result == TPM_RCS_TYPE) - return TPM_RCS_TYPE + RC_MAC_handle; - // If there is another error type, indicate that the scheme and key are not - // compatible - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, RC_MAC_inScheme); - // Make sure that the key is not restricted - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, restricted)) - return TPM_RCS_ATTRIBUTES + RC_MAC_handle; - // and that it is a signing key - if(!IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign)) - return TPM_RCS_KEY + RC_MAC_handle; -// Command Output - out->outMAC.t.size = CryptMacStart(&state, &publicArea->parameters, - in->inScheme, - &keyObject->sensitive.sensitive.any.b); - // If the mac can't start, treat it as a fatal error - if(out->outMAC.t.size == 0) - return TPM_RC_FAILURE; - CryptDigestUpdate2B(&state.hashState, &in->buffer.b); - // If the MAC result is not what was expected, it is a fatal error - if(CryptHmacEnd2B(&state, &out->outMAC.b) != out->outMAC.t.size) - return TPM_RC_FAILURE; - return TPM_RC_SUCCESS; -} - -#endif // CC_MAC \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/GetTestResult.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/GetTestResult.c deleted file mode 100644 index 3ded75a36..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/GetTestResult.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "GetTestResult_fp.h" - -#if CC_GetTestResult // Conditional expansion of this file - -/*(See part 3 specification) -// returns manufacturer-specific information regarding the results of a self- -// test and an indication of the test status. -*/ - -// In the reference implementation, this function is only reachable if the TPM is -// not in failure mode meaning that all tests that have been run have completed -// successfully. There is not test data and the test result is TPM_RC_SUCCESS. -TPM_RC -TPM2_GetTestResult( - GetTestResult_Out *out // OUT: output parameter list - ) -{ -// Command Output - - // Call incremental self test function in crypt module - out->testResult = CryptGetTestResult(&out->outData); - - return TPM_RC_SUCCESS; -} - -#endif // CC_GetTestResult \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/IncrementalSelfTest.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/IncrementalSelfTest.c deleted file mode 100644 index 2b62e7a67..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/IncrementalSelfTest.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "IncrementalSelfTest_fp.h" - -#if CC_IncrementalSelfTest // Conditional expansion of this file - -/*(See part 3 specification) -// perform a test of selected algorithms -*/ -// Return Type: TPM_RC -// TPM_RC_CANCELED the command was canceled (some tests may have -// completed) -// TPM_RC_VALUE an algorithm in the toTest list is not implemented -TPM_RC -TPM2_IncrementalSelfTest( - IncrementalSelfTest_In *in, // IN: input parameter list - IncrementalSelfTest_Out *out // OUT: output parameter list - ) -{ - TPM_RC result; -// Command Output - - // Call incremental self test function in crypt module. If this function - // returns TPM_RC_VALUE, it means that an algorithm on the 'toTest' list is - // not implemented. - result = CryptIncrementalSelfTest(&in->toTest, &out->toDoList); - if(result == TPM_RC_VALUE) - return TPM_RCS_VALUE + RC_IncrementalSelfTest_toTest; - return result; -} - -#endif // CC_IncrementalSelfTest \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/SelfTest.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/SelfTest.c deleted file mode 100644 index f5e0106f1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Testing/SelfTest.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "SelfTest_fp.h" - -#if CC_SelfTest // Conditional expansion of this file - -/*(See part 3 specification) -// perform a test of TPM capabilities -*/ -// Return Type: TPM_RC -// TPM_RC_CANCELED the command was canceled (some incremental -// process may have been made) -// TPM_RC_TESTING self test in process -TPM_RC -TPM2_SelfTest( - SelfTest_In *in // IN: input parameter list - ) -{ -// Command Output - - // Call self test function in crypt module - return CryptSelfTest(in->fullTest); -} - -#endif // CC_SelfTest \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Vendor/Vendor_TCG_Test.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Vendor/Vendor_TCG_Test.c deleted file mode 100644 index c06d50813..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/command/Vendor/Vendor_TCG_Test.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" - -#if CC_Vendor_TCG_Test // Conditional expansion of this file -#include "Vendor_TCG_Test_fp.h" - -TPM_RC -TPM2_Vendor_TCG_Test( - Vendor_TCG_Test_In *in, // IN: input parameter list - Vendor_TCG_Test_Out *out // OUT: output parameter list - ) -{ - out->outputData = in->inputData; - return TPM_RC_SUCCESS; -} - -#endif // CC_Vendor_TCG_Test \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/AlgorithmTests.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/AlgorithmTests.c deleted file mode 100644 index 9d203e5f4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/AlgorithmTests.c +++ /dev/null @@ -1,963 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the code to perform the various self-test functions. -// -// NOTE: In this implementation, large local variables are made static to minimize -// stack usage, which is critical for stack-constrained platforms. - -//** Includes and Defines -#include "Tpm.h" - -#define SELF_TEST_DATA - -#if SELF_TEST - -// These includes pull in the data structures. They contain data definitions for the -// various tests. -#include "SelfTest.h" -#include "SymmetricTest.h" -#include "RsaTestData.h" -#include "EccTestData.h" -#include "HashTestData.h" -#include "KdfTestData.h" - -#define TEST_DEFAULT_TEST_HASH(vector) \ - if(TEST_BIT(DEFAULT_TEST_HASH, g_toTest)) \ - TestHash(DEFAULT_TEST_HASH, vector); - -// Make sure that the algorithm has been tested -#define CLEAR_BOTH(alg) { CLEAR_BIT(alg, *toTest); \ - if(toTest != &g_toTest) \ - CLEAR_BIT(alg, g_toTest); } - -#define SET_BOTH(alg) { SET_BIT(alg, *toTest); \ - if(toTest != &g_toTest) \ - SET_BIT(alg, g_toTest); } - -#define TEST_BOTH(alg) ((toTest != &g_toTest) \ - ? TEST_BIT(alg, *toTest) || TEST_BIT(alg, g_toTest) \ - : TEST_BIT(alg, *toTest)) - -// Can only cancel if doing a list. -#define CHECK_CANCELED \ - if(_plat__IsCanceled() && toTest != &g_toTest) \ - return TPM_RC_CANCELED; - -//** Hash Tests - -//*** Description -// The hash test does a known-value HMAC using the specified hash algorithm. - -//*** TestHash() -// The hash test function. -static TPM_RC -TestHash( - TPM_ALG_ID hashAlg, - ALGORITHM_VECTOR *toTest - ) -{ - static TPM2B_DIGEST computed; // value computed - static HMAC_STATE state; - UINT16 digestSize; - const TPM2B *testDigest = NULL; -// TPM2B_TYPE(HMAC_BLOCK, DEFAULT_TEST_HASH_BLOCK_SIZE); - - pAssert(hashAlg != ALG_NULL_VALUE); - switch(hashAlg) - { -#if ALG_SHA1 - case ALG_SHA1_VALUE: - testDigest = &c_SHA1_digest.b; - break; -#endif -#if ALG_SHA256 - case ALG_SHA256_VALUE: - testDigest = &c_SHA256_digest.b; - break; -#endif -#if ALG_SHA384 - case ALG_SHA384_VALUE: - testDigest = &c_SHA384_digest.b; - break; -#endif -#if ALG_SHA512 - case ALG_SHA512_VALUE: - testDigest = &c_SHA512_digest.b; - break; -#endif -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: - testDigest = &c_SM3_256_digest.b; - break; -#endif - default: - FAIL(FATAL_ERROR_INTERNAL); - } - // Clear the to-test bits - CLEAR_BOTH(hashAlg); - - // Set the HMAC key to twice the digest size - digestSize = CryptHashGetDigestSize(hashAlg); - CryptHmacStart(&state, hashAlg, digestSize * 2, - (BYTE *)c_hashTestKey.t.buffer); - CryptDigestUpdate(&state.hashState, 2 * CryptHashGetBlockSize(hashAlg), - (BYTE *)c_hashTestData.t.buffer); - computed.t.size = digestSize; - CryptHmacEnd(&state, digestSize, computed.t.buffer); - if((testDigest->size != computed.t.size) - || (memcmp(testDigest->buffer, computed.t.buffer, computed.b.size) != 0)) - SELF_TEST_FAILURE; - return TPM_RC_SUCCESS; -} - -//** Symmetric Test Functions - -//*** MakeIv() -// Internal function to make the appropriate IV depending on the mode. -static UINT32 -MakeIv( - TPM_ALG_ID mode, // IN: symmetric mode - UINT32 size, // IN: block size of the algorithm - BYTE *iv // OUT: IV to fill in - ) -{ - BYTE i; - - if(mode == ALG_ECB_VALUE) - return 0; - if(mode == ALG_CTR_VALUE) - { - // The test uses an IV that has 0xff in the last byte - for(i = 1; i <= size; i++) - *iv++ = 0xff - (BYTE)(size - i); - } - else - { - for(i = 0; i < size; i++) - *iv++ = i; - } - return size; -} - -//*** TestSymmetricAlgorithm() -// Function to test a specific algorithm, key size, and mode. -static void -TestSymmetricAlgorithm( - const SYMMETRIC_TEST_VECTOR *test, // - TPM_ALG_ID mode // - ) -{ - static BYTE encrypted[MAX_SYM_BLOCK_SIZE * 2]; - static BYTE decrypted[MAX_SYM_BLOCK_SIZE * 2]; - static TPM2B_IV iv; -// - // Get the appropriate IV - iv.t.size = (UINT16)MakeIv(mode, test->ivSize, iv.t.buffer); - - // Encrypt known data - CryptSymmetricEncrypt(encrypted, test->alg, test->keyBits, test->key, &iv, - mode, test->dataInOutSize, test->dataIn); - // Check that it matches the expected value - if(!MemoryEqual(encrypted, test->dataOut[mode - ALG_CTR_VALUE], - test->dataInOutSize)) - SELF_TEST_FAILURE; - // Reinitialize the iv for decryption - MakeIv(mode, test->ivSize, iv.t.buffer); - CryptSymmetricDecrypt(decrypted, test->alg, test->keyBits, test->key, &iv, - mode, test->dataInOutSize, - test->dataOut[mode - ALG_CTR_VALUE]); - // Make sure that it matches what we started with - if(!MemoryEqual(decrypted, test->dataIn, test->dataInOutSize)) - SELF_TEST_FAILURE; -} - -//*** AllSymsAreDone() -// Checks if both symmetric algorithms have been tested. This is put here -// so that addition of a symmetric algorithm will be relatively easy to handle -// Return Type: BOOL -// TRUE(1) all symmetric algorithms tested -// FALSE(0) not all symmetric algorithms tested -static BOOL -AllSymsAreDone( - ALGORITHM_VECTOR *toTest - ) -{ - return (!TEST_BOTH(ALG_AES_VALUE) && !TEST_BOTH(ALG_SM4_VALUE)); -} - -//*** AllModesAreDone() -// Checks if all the modes have been tested -// Return Type: BOOL -// TRUE(1) all modes tested -// FALSE(0) all modes not tested -static BOOL -AllModesAreDone( - ALGORITHM_VECTOR *toTest - ) -{ - TPM_ALG_ID alg; - for(alg = TPM_SYM_MODE_FIRST; alg <= TPM_SYM_MODE_LAST; alg++) - if(TEST_BOTH(alg)) - return FALSE; - return TRUE; -} - -//*** TestSymmetric() -// If 'alg' is a symmetric block cipher, then all of the modes that are selected are -// tested. If 'alg' is a mode, then all algorithms of that mode are tested. -static TPM_RC -TestSymmetric( - TPM_ALG_ID alg, - ALGORITHM_VECTOR *toTest - ) -{ - SYM_INDEX index; - TPM_ALG_ID mode; -// - if(!TEST_BIT(alg, *toTest)) - return TPM_RC_SUCCESS; - if(alg == ALG_AES_VALUE || alg == ALG_SM4_VALUE || alg == ALG_CAMELLIA_VALUE) - { - // Will test the algorithm for all modes and key sizes - CLEAR_BOTH(alg); - - // A test this algorithm for all modes - for(index = 0; index < NUM_SYMS; index++) - { - if(c_symTestValues[index].alg == alg) - { - for(mode = TPM_SYM_MODE_FIRST; - mode <= TPM_SYM_MODE_LAST; - mode++) - { - if(TEST_BIT(mode, *toTest)) - TestSymmetricAlgorithm(&c_symTestValues[index], mode); - } - } - } - // if all the symmetric tests are done - if(AllSymsAreDone(toTest)) - { - // all symmetric algorithms tested so no modes should be set - for(alg = TPM_SYM_MODE_FIRST; alg <= TPM_SYM_MODE_LAST; alg++) - CLEAR_BOTH(alg); - } - } - else if(TPM_SYM_MODE_FIRST <= alg && alg <= TPM_SYM_MODE_LAST) - { - // Test this mode for all key sizes and algorithms - for(index = 0; index < NUM_SYMS; index++) - { - // The mode testing only comes into play when doing self tests - // by command. When doing self tests by command, the block ciphers are - // tested first. That means that all of their modes would have been - // tested for all key sizes. If there is no block cipher left to - // test, then clear this mode bit. - if(!TEST_BIT(ALG_AES_VALUE, *toTest) - && !TEST_BIT(ALG_SM4_VALUE, *toTest)) - { - CLEAR_BOTH(alg); - } - else - { - for(index = 0; index < NUM_SYMS; index++) - { - if(TEST_BIT(c_symTestValues[index].alg, *toTest)) - TestSymmetricAlgorithm(&c_symTestValues[index], alg); - } - // have tested this mode for all algorithms - CLEAR_BOTH(alg); - } - } - if(AllModesAreDone(toTest)) - { - CLEAR_BOTH(ALG_AES_VALUE); - CLEAR_BOTH(ALG_SM4_VALUE); - } - } - else - pAssert(alg == 0 && alg != 0); - return TPM_RC_SUCCESS; -} - -//** RSA Tests -#if ALG_RSA - -//*** Introduction -// The tests are for public key only operations and for private key operations. -// Signature verification and encryption are public key operations. They are tested -// by using a KVT. For signature verification, this means that a known good -// signature is checked by CryptRsaValidateSignature(). If it fails, then the -// TPM enters failure mode. For encryption, the TPM encrypts known values using -// the selected scheme and checks that the returned value matches the expected -// value. -// -// For private key operations, a full scheme check is used. For a signing key, a -// known key is used to sign a known message. Then that signature is verified. -// since the signature may involve use of random values, the signature will be -// different each time and we can't always check that the signature matches a -// known value. The same technique is used for decryption (RSADP/RSAEP). -// -// When an operation uses the public key and the verification has not been -// tested, the TPM will do a KVT. -// -// The test for the signing algorithm is built into the call for the algorithm - -//*** RsaKeyInitialize() -// The test key is defined by a public modulus and a private prime. The TPM's RSA -// code computes the second prime and the private exponent. -static void -RsaKeyInitialize( - OBJECT *testObject - ) -{ - MemoryCopy2B(&testObject->publicArea.unique.rsa.b, (P2B)&c_rsaPublicModulus, - sizeof(c_rsaPublicModulus)); - MemoryCopy2B(&testObject->sensitive.sensitive.rsa.b, (P2B)&c_rsaPrivatePrime, - sizeof(testObject->sensitive.sensitive.rsa.t.buffer)); - testObject->publicArea.parameters.rsaDetail.keyBits = RSA_TEST_KEY_SIZE * 8; - // Use the default exponent - testObject->publicArea.parameters.rsaDetail.exponent = 0; -} - -//*** TestRsaEncryptDecrypt() -// These tests are for a public key encryption that uses a random value. -static TPM_RC -TestRsaEncryptDecrypt( - TPM_ALG_ID scheme, // IN: the scheme - ALGORITHM_VECTOR *toTest // - ) -{ - static TPM2B_PUBLIC_KEY_RSA testInput; - static TPM2B_PUBLIC_KEY_RSA testOutput; - static OBJECT testObject; - const TPM2B_RSA_TEST_KEY *kvtValue = NULL; - TPM_RC result = TPM_RC_SUCCESS; - const TPM2B *testLabel = NULL; - TPMT_RSA_DECRYPT rsaScheme; -// - // Don't need to initialize much of the test object - RsaKeyInitialize(&testObject); - rsaScheme.scheme = scheme; - rsaScheme.details.anySig.hashAlg = DEFAULT_TEST_HASH; - CLEAR_BOTH(scheme); - CLEAR_BOTH(ALG_NULL_VALUE); - if(scheme == ALG_NULL_VALUE) - { - // This is an encryption scheme using the private key without any encoding. - memcpy(testInput.t.buffer, c_RsaTestValue, sizeof(c_RsaTestValue)); - testInput.t.size = sizeof(c_RsaTestValue); - if(TPM_RC_SUCCESS != CryptRsaEncrypt(&testOutput, &testInput.b, - &testObject, &rsaScheme, NULL, NULL)) - SELF_TEST_FAILURE; - if(!MemoryEqual(testOutput.t.buffer, c_RsaepKvt.buffer, c_RsaepKvt.size)) - SELF_TEST_FAILURE; - MemoryCopy2B(&testInput.b, &testOutput.b, sizeof(testInput.t.buffer)); - if(TPM_RC_SUCCESS != CryptRsaDecrypt(&testOutput.b, &testInput.b, - &testObject, &rsaScheme, NULL)) - SELF_TEST_FAILURE; - if(!MemoryEqual(testOutput.t.buffer, c_RsaTestValue, - sizeof(c_RsaTestValue))) - SELF_TEST_FAILURE; - } - else - { - // ALG_RSAES_VALUE: - // This is an decryption scheme using padding according to - // PKCS#1v2.1, 7.2. This padding uses random bits. To test a public - // key encryption that uses random data, encrypt a value and then - // decrypt the value and see that we get the encrypted data back. - // The hash is not used by this encryption so it can be TMP_ALG_NULL - - // ALG_OAEP_VALUE: - // This is also an decryption scheme and it also uses a - // pseudo-random - // value. However, this also uses a hash algorithm. So, we may need - // to test that algorithm before use. - if(scheme == ALG_OAEP_VALUE) - { - TEST_DEFAULT_TEST_HASH(toTest); - kvtValue = &c_OaepKvt; - testLabel = OAEP_TEST_STRING; - } - else if(scheme == ALG_RSAES_VALUE) - { - kvtValue = &c_RsaesKvt; - testLabel = NULL; - } - else - SELF_TEST_FAILURE; - // Only use a digest-size portion of the test value - memcpy(testInput.t.buffer, c_RsaTestValue, DEFAULT_TEST_DIGEST_SIZE); - testInput.t.size = DEFAULT_TEST_DIGEST_SIZE; - - // See if the encryption works - if(TPM_RC_SUCCESS != CryptRsaEncrypt(&testOutput, &testInput.b, - &testObject, &rsaScheme, testLabel, - NULL)) - SELF_TEST_FAILURE; - MemoryCopy2B(&testInput.b, &testOutput.b, sizeof(testInput.t.buffer)); - // see if we can decrypt this value and get the original data back - if(TPM_RC_SUCCESS != CryptRsaDecrypt(&testOutput.b, &testInput.b, - &testObject, &rsaScheme, testLabel)) - SELF_TEST_FAILURE; - // See if the results compare - if(testOutput.t.size != DEFAULT_TEST_DIGEST_SIZE - || !MemoryEqual(testOutput.t.buffer, c_RsaTestValue, - DEFAULT_TEST_DIGEST_SIZE)) - SELF_TEST_FAILURE; - // Now check that the decryption works on a known value - MemoryCopy2B(&testInput.b, (P2B)kvtValue, - sizeof(testInput.t.buffer)); - if(TPM_RC_SUCCESS != CryptRsaDecrypt(&testOutput.b, &testInput.b, - &testObject, &rsaScheme, testLabel)) - SELF_TEST_FAILURE; - if(testOutput.t.size != DEFAULT_TEST_DIGEST_SIZE - || !MemoryEqual(testOutput.t.buffer, c_RsaTestValue, - DEFAULT_TEST_DIGEST_SIZE)) - SELF_TEST_FAILURE; - } - return result; -} - -//*** TestRsaSignAndVerify() -// This function does the testing of the RSA sign and verification functions. This -// test does a KVT. -static TPM_RC -TestRsaSignAndVerify( - TPM_ALG_ID scheme, - ALGORITHM_VECTOR *toTest - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - static OBJECT testObject; - static TPM2B_DIGEST testDigest; - static TPMT_SIGNATURE testSig; - - // Do a sign and signature verification. - // RSASSA: - // This is a signing scheme according to PKCS#1-v2.1 8.2. It does not - // use random data so there is a KVT for the signing operation. On - // first use of the scheme for signing, use the TPM's RSA key to - // sign a portion of c_RsaTestData and compare the results to c_RsassaKvt. Then - // decrypt the data to see that it matches the starting value. This verifies - // the signature with a KVT - - // Clear the bits indicating that the function has not been checked. This is to - // prevent looping - CLEAR_BOTH(scheme); - CLEAR_BOTH(ALG_NULL_VALUE); - CLEAR_BOTH(ALG_RSA_VALUE); - - RsaKeyInitialize(&testObject); - memcpy(testDigest.t.buffer, (BYTE *)c_RsaTestValue, DEFAULT_TEST_DIGEST_SIZE); - testDigest.t.size = DEFAULT_TEST_DIGEST_SIZE; - testSig.sigAlg = scheme; - testSig.signature.rsapss.hash = DEFAULT_TEST_HASH; - - // RSAPSS: - // This is a signing scheme a according to PKCS#1-v2.2 8.1 it uses - // random data in the signature so there is no KVT for the signing - // operation. To test signing, the TPM will use the TPM's RSA key - // to sign a portion of c_RsaTestValue and then it will verify the - // signature. For verification, c_RsapssKvt is verified before the - // user signature blob is verified. The worst case for testing of this - // algorithm is two private and one public key operation. - - // The process is to sign known data. If RSASSA is being done, verify that the - // signature matches the precomputed value. For both, use the signed value and - // see that the verification says that it is a good signature. Then - // if testing RSAPSS, do a verify of a known good signature. This ensures that - // the validation function works. - - if(TPM_RC_SUCCESS != CryptRsaSign(&testSig, &testObject, &testDigest, NULL)) - SELF_TEST_FAILURE; - // For RSASSA, make sure the results is what we are looking for - if(testSig.sigAlg == ALG_RSASSA_VALUE) - { - if(testSig.signature.rsassa.sig.t.size != RSA_TEST_KEY_SIZE - || !MemoryEqual(c_RsassaKvt.buffer, - testSig.signature.rsassa.sig.t.buffer, - RSA_TEST_KEY_SIZE)) - SELF_TEST_FAILURE; - } - // See if the TPM will validate its own signatures - if(TPM_RC_SUCCESS != CryptRsaValidateSignature(&testSig, &testObject, - &testDigest)) - SELF_TEST_FAILURE; - // If this is RSAPSS, check the verification with known signature - // Have to copy because CrytpRsaValidateSignature() eats the signature - if(ALG_RSAPSS_VALUE == scheme) - { - MemoryCopy2B(&testSig.signature.rsapss.sig.b, (P2B)&c_RsapssKvt, - sizeof(testSig.signature.rsapss.sig.t.buffer)); - if(TPM_RC_SUCCESS != CryptRsaValidateSignature(&testSig, &testObject, - &testDigest)) - SELF_TEST_FAILURE; - } - return result; -} - -//*** TestRSA() -// Function uses the provided vector to indicate which tests to run. It will clear -// the vector after each test is run and also clear g_toTest -static TPM_RC -TestRsa( - TPM_ALG_ID alg, - ALGORITHM_VECTOR *toTest - ) -{ - TPM_RC result = TPM_RC_SUCCESS; -// - switch(alg) - { - case ALG_NULL_VALUE: - // This is the RSAEP/RSADP function. If we are processing a list, don't - // need to test these now because any other test will validate - // RSAEP/RSADP. Can tell this is list of test by checking to see if - // 'toTest' is pointing at g_toTest. If so, this is an isolated test - // an need to go ahead and do the test; - if((toTest == &g_toTest) - || (!TEST_BIT(ALG_RSASSA_VALUE, *toTest) - && !TEST_BIT(ALG_RSAES_VALUE, *toTest) - && !TEST_BIT(ALG_RSAPSS_VALUE, *toTest) - && !TEST_BIT(ALG_OAEP_VALUE, *toTest))) - // Not running a list of tests or no other tests on the list - // so run the test now - result = TestRsaEncryptDecrypt(alg, toTest); - // if not running the test now, leave the bit on, just in case things - // get interrupted - break; - case ALG_OAEP_VALUE: - case ALG_RSAES_VALUE: - result = TestRsaEncryptDecrypt(alg, toTest); - break; - case ALG_RSAPSS_VALUE: - case ALG_RSASSA_VALUE: - result = TestRsaSignAndVerify(alg, toTest); - break; - default: - SELF_TEST_FAILURE; - } - return result; -} - -#endif // ALG_RSA - -//** ECC Tests - -#if ALG_ECC - -//*** LoadEccParameter() -// This function is mostly for readability and type checking -static void -LoadEccParameter( - TPM2B_ECC_PARAMETER *to, // target - const TPM2B_EC_TEST *from // source - ) -{ - MemoryCopy2B(&to->b, &from->b, sizeof(to->t.buffer)); -} - -//*** LoadEccPoint() -static void -LoadEccPoint( - TPMS_ECC_POINT *point, // target - const TPM2B_EC_TEST *x, // source - const TPM2B_EC_TEST *y - ) -{ - MemoryCopy2B(&point->x.b, (TPM2B *)x, sizeof(point->x.t.buffer)); - MemoryCopy2B(&point->y.b, (TPM2B *)y, sizeof(point->y.t.buffer)); -} - -//*** TestECDH() -// This test does a KVT on a point multiply. -static TPM_RC -TestECDH( - TPM_ALG_ID scheme, // IN: for consistency - ALGORITHM_VECTOR *toTest // IN/OUT: modified after test is run - ) -{ - static TPMS_ECC_POINT Z; - static TPMS_ECC_POINT Qe; - static TPM2B_ECC_PARAMETER ds; - TPM_RC result = TPM_RC_SUCCESS; -// - NOT_REFERENCED(scheme); - CLEAR_BOTH(ALG_ECDH_VALUE); - LoadEccParameter(&ds, &c_ecTestKey_ds); - LoadEccPoint(&Qe, &c_ecTestKey_QeX, &c_ecTestKey_QeY); - if(TPM_RC_SUCCESS != CryptEccPointMultiply(&Z, c_testCurve, &Qe, &ds, - NULL, NULL)) - SELF_TEST_FAILURE; - if(!MemoryEqual2B(&c_ecTestEcdh_X.b, &Z.x.b) - || !MemoryEqual2B(&c_ecTestEcdh_Y.b, &Z.y.b)) - SELF_TEST_FAILURE; - return result; -} - -//*** TestEccSignAndVerify() -static TPM_RC -TestEccSignAndVerify( - TPM_ALG_ID scheme, - ALGORITHM_VECTOR *toTest - ) -{ - static OBJECT testObject; - static TPMT_SIGNATURE testSig; - static TPMT_ECC_SCHEME eccScheme; - - testSig.sigAlg = scheme; - testSig.signature.ecdsa.hash = DEFAULT_TEST_HASH; - - eccScheme.scheme = scheme; - eccScheme.details.anySig.hashAlg = DEFAULT_TEST_HASH; - - CLEAR_BOTH(scheme); - CLEAR_BOTH(ALG_ECDH_VALUE); - - // ECC signature verification testing uses a KVT. - switch(scheme) - { - case ALG_ECDSA_VALUE: - LoadEccParameter(&testSig.signature.ecdsa.signatureR, &c_TestEcDsa_r); - LoadEccParameter(&testSig.signature.ecdsa.signatureS, &c_TestEcDsa_s); - break; - case ALG_ECSCHNORR_VALUE: - LoadEccParameter(&testSig.signature.ecschnorr.signatureR, - &c_TestEcSchnorr_r); - LoadEccParameter(&testSig.signature.ecschnorr.signatureS, - &c_TestEcSchnorr_s); - break; - case ALG_SM2_VALUE: - // don't have a test for SM2 - return TPM_RC_SUCCESS; - default: - SELF_TEST_FAILURE; - break; - } - TEST_DEFAULT_TEST_HASH(toTest); - - // Have to copy the key. This is because the size used in the test vectors - // is the size of the ECC parameter for the test key while the size of a point - // is TPM dependent - MemoryCopy2B(&testObject.sensitive.sensitive.ecc.b, &c_ecTestKey_ds.b, - sizeof(testObject.sensitive.sensitive.ecc.t.buffer)); - LoadEccPoint(&testObject.publicArea.unique.ecc, &c_ecTestKey_QsX, - &c_ecTestKey_QsY); - testObject.publicArea.parameters.eccDetail.curveID = c_testCurve; - - if(TPM_RC_SUCCESS != CryptEccValidateSignature(&testSig, &testObject, - (TPM2B_DIGEST *)&c_ecTestValue.b)) - { - SELF_TEST_FAILURE; - } - CHECK_CANCELED; - - // Now sign and verify some data - if(TPM_RC_SUCCESS != CryptEccSign(&testSig, &testObject, - (TPM2B_DIGEST *)&c_ecTestValue, - &eccScheme, NULL)) - SELF_TEST_FAILURE; - - CHECK_CANCELED; - - if(TPM_RC_SUCCESS != CryptEccValidateSignature(&testSig, &testObject, - (TPM2B_DIGEST *)&c_ecTestValue)) - SELF_TEST_FAILURE; - - CHECK_CANCELED; - - return TPM_RC_SUCCESS; -} - -//*** TestKDFa() -static TPM_RC -TestKDFa( - ALGORITHM_VECTOR *toTest - ) -{ - static TPM2B_KDF_TEST_KEY keyOut; - UINT32 counter = 0; -// - CLEAR_BOTH(ALG_KDF1_SP800_108_VALUE); - - keyOut.t.size = CryptKDFa(KDF_TEST_ALG, &c_kdfTestKeyIn.b, &c_kdfTestLabel.b, - &c_kdfTestContextU.b, &c_kdfTestContextV.b, - TEST_KDF_KEY_SIZE * 8, keyOut.t.buffer, - &counter, FALSE); - if ( keyOut.t.size != TEST_KDF_KEY_SIZE - || !MemoryEqual(keyOut.t.buffer, c_kdfTestKeyOut.t.buffer, - TEST_KDF_KEY_SIZE)) - SELF_TEST_FAILURE; - - return TPM_RC_SUCCESS; -} - -//*** TestEcc() -static TPM_RC -TestEcc( - TPM_ALG_ID alg, - ALGORITHM_VECTOR *toTest - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - NOT_REFERENCED(toTest); - switch(alg) - { - case ALG_ECC_VALUE: - case ALG_ECDH_VALUE: - // If this is in a loop then see if another test is going to deal with - // this. - // If toTest is not a self-test list - if((toTest == &g_toTest) - // or this is the only ECC test in the list - || !(TEST_BIT(ALG_ECDSA_VALUE, *toTest) - || TEST_BIT(ALG_ECSCHNORR, *toTest) - || TEST_BIT(ALG_SM2_VALUE, *toTest))) - { - result = TestECDH(alg, toTest); - } - break; - case ALG_ECDSA_VALUE: - case ALG_ECSCHNORR_VALUE: - case ALG_SM2_VALUE: - result = TestEccSignAndVerify(alg, toTest); - break; - default: - SELF_TEST_FAILURE; - break; - } - return result; -} - -#endif // ALG_ECC - -//*** TestAlgorithm() -// Dispatches to the correct test function for the algorithm or gets a list of -// testable algorithms. -// -// If 'toTest' is not NULL, then the test decisions are based on the algorithm -// selections in 'toTest'. Otherwise, 'g_toTest' is used. When bits are clear in -// 'g_toTest' they will also be cleared 'toTest'. -// -// If there doesn't happen to be a test for the algorithm, its associated bit is -// quietly cleared. -// -// If 'alg' is zero (TPM_ALG_ERROR), then the toTest vector is cleared of any bits -// for which there is no test (i.e. no tests are actually run but the vector is -// cleared). -// -// Note: 'toTest' will only ever have bits set for implemented algorithms but 'alg' -// can be anything. -// Return Type: TPM_RC -// TPM_RC_CANCELED test was canceled -LIB_EXPORT -TPM_RC -TestAlgorithm( - TPM_ALG_ID alg, - ALGORITHM_VECTOR *toTest - ) -{ - TPM_ALG_ID first = (alg == ALG_ERROR_VALUE) ? ALG_FIRST_VALUE : alg; - TPM_ALG_ID last = (alg == ALG_ERROR_VALUE) ? ALG_LAST_VALUE : alg; - BOOL doTest = (alg != ALG_ERROR_VALUE); - TPM_RC result = TPM_RC_SUCCESS; - - if(toTest == NULL) - toTest = &g_toTest; - - // This is kind of strange. This function will either run a test of the selected - // algorithm or just clear a bit if there is no test for the algorithm. So, - // either this loop will be executed once for the selected algorithm or once for - // each of the possible algorithms. If it is executed more than once ('alg' == - // ALG_ERROR), then no test will be run but bits will be cleared for - // unimplemented algorithms. This was done this way so that there is only one - // case statement with all of the algorithms. It was easier to have one case - // statement than to have multiple ones to manage whenever an algorithm ID is - // added. - for(alg = first; (alg <= last); alg++) - { - // if 'alg' was TPM_ALG_ERROR, then we will be cycling through - // values, some of which may not be implemented. If the bit in toTest - // happens to be set, then we could either generated an assert, or just - // silently CLEAR it. Decided to just clear. - if(!TEST_BIT(alg, g_implementedAlgorithms)) - { - CLEAR_BIT(alg, *toTest); - continue; - } - // Process whatever is left. - // NOTE: since this switch will only be called if the algorithm is - // implemented, it is not necessary to modify this list except to comment - // out the algorithms for which there is no test - switch(alg) - { - // Symmetric block ciphers -#if ALG_AES - case ALG_AES_VALUE: -#endif // ALG_AES -#if ALG_SM4 - // if SM4 is implemented, its test is like other block ciphers but there - // aren't any test vectors for it yet -// case ALG_SM4_VALUE: -#endif // ALG_SM4 -#if ALG_CAMELLIA - // no test vectors for camellia -// case ALG_CAMELLIA_VALUE: -#endif - // Symmetric modes -#if !ALG_CFB -# error CFB is required in all TPM implementations -#endif // !ALG_CFB - case ALG_CFB_VALUE: - if(doTest) - result = TestSymmetric(alg, toTest); - break; -#if ALG_CTR - case ALG_CTR_VALUE: -#endif // ALG_CRT -#if ALG_OFB - case ALG_OFB_VALUE: -#endif // ALG_OFB -#if ALG_CBC - case ALG_CBC_VALUE: -#endif // ALG_CBC -#if ALG_ECB - case ALG_ECB_VALUE: -#endif - if(doTest) - result = TestSymmetric(alg, toTest); - else - // If doing the initialization of g_toTest vector, only need - // to test one of the modes for the symmetric algorithms. If - // initializing for a SelfTest(FULL_TEST), allow all the modes. - if(toTest == &g_toTest) - CLEAR_BIT(alg, *toTest); - break; -#if !ALG_HMAC -# error HMAC is required in all TPM implementations -#endif - case ALG_HMAC_VALUE: - // Clear the bit that indicates that HMAC is required because - // HMAC is used as the basic test for all hash algorithms. - CLEAR_BOTH(alg); - // Testing HMAC means test the default hash - if(doTest) - TestHash(DEFAULT_TEST_HASH, toTest); - else - // If not testing, then indicate that the hash needs to be - // tested because this uses HMAC - SET_BOTH(DEFAULT_TEST_HASH); - break; -#if ALG_SHA1 - case ALG_SHA1_VALUE: -#endif // ALG_SHA1 -#if ALG_SHA256 - case ALG_SHA256_VALUE: -#endif // ALG_SHA256 -#if ALG_SHA384 - case ALG_SHA384_VALUE: -#endif // ALG_SHA384 -#if ALG_SHA512 - case ALG_SHA512_VALUE: -#endif // ALG_SHA512 - // if SM3 is implemented its test is like any other hash, but there - // aren't any test vectors yet. -#if ALG_SM3_256 -// case ALG_SM3_256_VALUE: -#endif // ALG_SM3_256 - if(doTest) - result = TestHash(alg, toTest); - break; - // RSA-dependent -#if ALG_RSA - case ALG_RSA_VALUE: - CLEAR_BOTH(alg); - if(doTest) - result = TestRsa(ALG_NULL_VALUE, toTest); - else - SET_BOTH(ALG_NULL_VALUE); - break; - case ALG_RSASSA_VALUE: - case ALG_RSAES_VALUE: - case ALG_RSAPSS_VALUE: - case ALG_OAEP_VALUE: - case ALG_NULL_VALUE: // used or RSADP - if(doTest) - result = TestRsa(alg, toTest); - break; -#endif // ALG_RSA -#if ALG_KDF1_SP800_108 - case ALG_KDF1_SP800_108_VALUE: - if(doTest) - result = TestKDFa(toTest); - break; -#endif // ALG_KDF1_SP800_108 -#if ALG_ECC - // ECC dependent but no tests - // case ALG_ECDAA_VALUE: - // case ALG_ECMQV_VALUE: - // case ALG_KDF1_SP800_56a_VALUE: - // case ALG_KDF2_VALUE: - // case ALG_MGF1_VALUE: - case ALG_ECC_VALUE: - CLEAR_BOTH(alg); - if(doTest) - result = TestEcc(ALG_ECDH_VALUE, toTest); - else - SET_BOTH(ALG_ECDH_VALUE); - break; - case ALG_ECDSA_VALUE: - case ALG_ECDH_VALUE: - case ALG_ECSCHNORR_VALUE: -// case ALG_SM2_VALUE: - if(doTest) - result = TestEcc(alg, toTest); - break; -#endif // ALG_ECC - default: - CLEAR_BIT(alg, *toTest); - break; - } - if(result != TPM_RC_SUCCESS) - break; - } - return result; -} - -#endif // SELF_TESTS \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnConvert.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnConvert.c deleted file mode 100644 index f729cfe6f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnConvert.c +++ /dev/null @@ -1,295 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the basic conversion functions that will convert TPM2B -// to/from the internal format. The internal format is a bigNum, -// - -//** Includes - -#include "Tpm.h" - -//** Functions - -//*** BnFromBytes() -// This function will convert a big-endian byte array to the internal number -// format. If bn is NULL, then the output is NULL. If bytes is null or the -// required size is 0, then the output is set to zero -LIB_EXPORT bigNum -BnFromBytes( - bigNum bn, - const BYTE *bytes, - NUMBYTES nBytes - ) -{ - const BYTE *pFrom; // 'p' points to the least significant bytes of source - BYTE *pTo; // points to least significant bytes of destination - crypt_uword_t size; -// - - size = (bytes != NULL) ? BYTES_TO_CRYPT_WORDS(nBytes) : 0; - - // If nothing in, nothing out - if(bn == NULL) - return NULL; - - // make sure things fit - pAssert(BnGetAllocated(bn) >= size); - - if(size > 0) - { - // Clear the topmost word in case it is not filled with data - bn->d[size - 1] = 0; - // Moving the input bytes from the end of the list (LSB) end - pFrom = bytes + nBytes - 1; - // To the LS0 of the LSW of the bigNum. - pTo = (BYTE *)bn->d; - for(; nBytes != 0; nBytes--) - *pTo++ = *pFrom--; - // For a little-endian machine, the conversion is a straight byte - // reversal. For a big-endian machine, we have to put the words in - // big-endian byte order -#if BIG_ENDIAN_TPM - { - crypt_word_t t; - for(t = (crypt_word_t)size - 1; t >= 0; t--) - bn->d[t] = SWAP_CRYPT_WORD(bn->d[t]); - } -#endif - } - BnSetTop(bn, size); - return bn; -} - -//*** BnFrom2B() -// Convert an TPM2B to a BIG_NUM. -// If the input value does not exist, or the output does not exist, or the input -// will not fit into the output the function returns NULL -LIB_EXPORT bigNum -BnFrom2B( - bigNum bn, // OUT: - const TPM2B *a2B // IN: number to convert - ) -{ - if(a2B != NULL) - return BnFromBytes(bn, a2B->buffer, a2B->size); - // Make sure that the number has an initialized value rather than whatever - // was there before - BnSetTop(bn, 0); // Function accepts NULL - return NULL; -} - -//*** BnFromHex() -// Convert a hex string into a bigNum. This is primarily used in debugging. -LIB_EXPORT bigNum -BnFromHex( - bigNum bn, // OUT: - const char *hex // IN: - ) -{ -#define FromHex(a) ((a) - (((a) > 'a') ? ('a' + 10) \ - : ((a) > 'A') ? ('A' - 10) : '0')) - unsigned i; - unsigned wordCount; - const char *p; - BYTE *d = (BYTE *)&(bn->d[0]); -// - pAssert(bn && hex); - i = (unsigned)strlen(hex); - wordCount = BYTES_TO_CRYPT_WORDS((i + 1) / 2); - if((i == 0) || (wordCount >= BnGetAllocated(bn))) - BnSetWord(bn, 0); - else - { - bn->d[wordCount - 1] = 0; - p = hex + i - 1; - for(;i > 1; i -= 2) - { - BYTE a; - a = FromHex(*p); - p--; - *d++ = a + (FromHex(*p) << 4); - p--; - } - if(i == 1) - *d = FromHex(*p); - } -#if !BIG_ENDIAN_TPM - for(i = 0; i < wordCount; i++) - bn->d[i] = SWAP_CRYPT_WORD(bn->d[i]); -#endif // BIG_ENDIAN_TPM - BnSetTop(bn, wordCount); - return bn; -} - -//*** BnToBytes() -// This function converts a BIG_NUM to a byte array. It converts the bigNum to a -// big-endian byte string and sets 'size' to the normalized value. If 'size' is an -// input 0, then the receiving buffer is guaranteed to be large enough for the result -// and the size will be set to the size required for bigNum (leading zeros -// suppressed). -// -// The conversion for a little-endian machine simply requires that all significant -// bytes of the bigNum be reversed. For a big-endian machine, rather than -// unpack each word individually, the bigNum is converted to little-endian words, -// copied, and then converted back to big-endian. -LIB_EXPORT BOOL -BnToBytes( - bigConst bn, - BYTE *buffer, - NUMBYTES *size // This the number of bytes that are - // available in the buffer. The result - // should be this big. - ) -{ - crypt_uword_t requiredSize; - BYTE *pFrom; - BYTE *pTo; - crypt_uword_t count; -// - // validate inputs - pAssert(bn && buffer && size); - - requiredSize = (BnSizeInBits(bn) + 7) / 8; - if(requiredSize == 0) - { - // If the input value is 0, return a byte of zero - *size = 1; - *buffer = 0; - } - else - { -#if BIG_ENDIAN_TPM - // Copy the constant input value into a modifiable value - BN_VAR(bnL, LARGEST_NUMBER_BITS * 2); - BnCopy(bnL, bn); - // byte swap the words in the local value to make them little-endian - for(count = 0; count < bnL->size; count++) - bnL->d[count] = SWAP_CRYPT_WORD(bnL->d[count]); - bn = (bigConst)bnL; -#endif - if(*size == 0) - *size = (NUMBYTES)requiredSize; - pAssert(requiredSize <= *size); - // Byte swap the number (not words but the whole value) - count = *size; - // Start from the least significant word and offset to the most significant - // byte which is in some high word - pFrom = (BYTE *)(&bn->d[0]) + requiredSize - 1; - pTo = buffer; - - // If the number of output bytes is larger than the number bytes required - // for the input number, pad with zeros - for(count = *size; count > requiredSize; count--) - *pTo++ = 0; - // Move the most significant byte at the end of the BigNum to the next most - // significant byte position of the 2B and repeat for all significant bytes. - for(; requiredSize > 0; requiredSize--) - *pTo++ = *pFrom--; - } - return TRUE; -} - -//*** BnTo2B() -// Function to convert a BIG_NUM to TPM2B. -// The TPM2B size is set to the requested 'size' which may require padding. -// If 'size' is non-zero and less than required by the value in 'bn' then an error -// is returned. If 'size' is zero, then the TPM2B is assumed to be large enough -// for the data and a2b->size will be adjusted accordingly. -LIB_EXPORT BOOL -BnTo2B( - bigConst bn, // IN: - TPM2B *a2B, // OUT: - NUMBYTES size // IN: the desired size - ) -{ - // Set the output size - if(bn && a2B) - { - a2B->size = size; - return BnToBytes(bn, a2B->buffer, &a2B->size); - } - return FALSE; -} - -#if ALG_ECC - -//*** BnPointFrom2B() -// Function to create a BIG_POINT structure from a 2B point. -// A point is going to be two ECC values in the same buffer. The values are going -// to be the size of the modulus. They are in modular form. -LIB_EXPORT bn_point_t * -BnPointFrom2B( - bigPoint ecP, // OUT: the preallocated point structure - TPMS_ECC_POINT *p // IN: the number to convert - ) -{ - if(p == NULL) - return NULL; - - if(NULL != ecP) - { - BnFrom2B(ecP->x, &p->x.b); - BnFrom2B(ecP->y, &p->y.b); - BnSetWord(ecP->z, 1); - } - return ecP; -} - -//*** BnPointTo2B() -// This function converts a BIG_POINT into a TPMS_ECC_POINT. A TPMS_ECC_POINT -// contains two TPM2B_ECC_PARAMETER values. The maximum size of the parameters -// is dependent on the maximum EC key size used in an implementation. -// The presumption is that the TPMS_ECC_POINT is large enough to hold 2 TPM2B -// values, each as large as a MAX_ECC_PARAMETER_BYTES -LIB_EXPORT BOOL -BnPointTo2B( - TPMS_ECC_POINT *p, // OUT: the converted 2B structure - bigPoint ecP, // IN: the values to be converted - bigCurve E // IN: curve descriptor for the point - ) -{ - UINT16 size; -// - pAssert(p && ecP && E); - pAssert(BnEqualWord(ecP->z, 1)); - // BnMsb is the bit number of the MSB. This is one less than the number of bits - size = (UINT16)BITS_TO_BYTES(BnSizeInBits(CurveGetOrder(AccessCurveData(E)))); - BnTo2B(ecP->x, &p->x.b, size); - BnTo2B(ecP->y, &p->y.b, size); - return TRUE; -} - -#endif // ALG_ECC \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnMath.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnMath.c deleted file mode 100644 index 84d3e9eeb..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnMath.c +++ /dev/null @@ -1,597 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// The simulator code uses the canonical form whenever possible in order to make -// the code in Part 3 more accessible. The canonical data formats are simple and -// not well suited for complex big number computations. When operating on big -// numbers, the data format is changed for easier manipulation. The format is native -// words in little-endian format. As the magnitude of the number decreases, the -// length of the array containing the number decreases but the starting address -// doesn't change. -// -// The functions in this file perform simple operations on these big numbers. Only -// the more complex operations are passed to the underlying support library. -// Although the support library would have most of these functions, the interface -// code to convert the format for the values is greater than the size of the -// code to implement the functions here. So, rather than incur the overhead of -// conversion, they are done here. -// -// If an implementer would prefer, the underlying library can be used simply by -// making code substitutions here. -// -// NOTE: There is an intention to continue to augment these functions so that there -// would be no need to use an external big number library. -// -// Many of these functions have no error returns and will always return TRUE. This -// is to allow them to be used in "guarded" sequences. That is: -// OK = OK || BnSomething(s); -// where the BnSomething function should not be called if OK isn't true. - -//** Includes -#include "Tpm.h" - -// A constant value of zero as a stand in for NULL bigNum values -const bignum_t BnConstZero = {1, 0, {0}}; - -//** Functions - -//*** AddSame() -// Adds two values that are the same size. This function allows 'result' to be -// the same as either of the addends. This is a nice function to put into assembly -// because handling the carry for multi-precision stuff is not as easy in C -// (unless there is a REALLY smart compiler). It would be nice if there were idioms -// in a language that a compiler could recognize what is going on and optimize -// loops like this. -// Return Type: int -// 0 no carry out -// 1 carry out -static BOOL -AddSame( - crypt_uword_t *result, - const crypt_uword_t *op1, - const crypt_uword_t *op2, - int count - ) -{ - int carry = 0; - int i; - - for(i = 0; i < count; i++) - { - crypt_uword_t a = op1[i]; - crypt_uword_t sum = a + op2[i]; - result[i] = sum + carry; - // generate a carry if the sum is less than either of the inputs - // propagate a carry if there was a carry and the sum + carry is zero - // do this using bit operations rather than logical operations so that - // the time is about the same. - // propagate term | generate term - carry = ((result[i] == 0) & carry) | (sum < a); - } - return carry; -} - -//*** CarryProp() -// Propagate a carry -static int -CarryProp( - crypt_uword_t *result, - const crypt_uword_t *op, - int count, - int carry - ) -{ - for(; count; count--) - carry = ((*result++ = *op++ + carry) == 0) & carry; - return carry; -} - -static void -CarryResolve( - bigNum result, - int stop, - int carry - ) -{ - if(carry) - { - pAssert((unsigned)stop < result->allocated); - result->d[stop++] = 1; - } - BnSetTop(result, stop); -} - -//*** BnAdd() -// This function adds two bigNum values. This function always returns TRUE. -LIB_EXPORT BOOL -BnAdd( - bigNum result, - bigConst op1, - bigConst op2 - ) -{ - crypt_uword_t stop; - int carry; - const bignum_t *n1 = op1; - const bignum_t *n2 = op2; - -// - if(n2->size > n1->size) - { - n1 = op2; - n2 = op1; - } - pAssert(result->allocated >= n1->size); - stop = MIN(n1->size, n2->allocated); - carry = (int)AddSame(result->d, n1->d, n2->d, (int)stop); - if(n1->size > stop) - carry = CarryProp(&result->d[stop], &n1->d[stop], (int)(n1->size - stop), carry); - CarryResolve(result, (int)n1->size, carry); - return TRUE; -} - -//*** BnAddWord() -// This function adds a word value to a bigNum. This function always returns TRUE. -LIB_EXPORT BOOL -BnAddWord( - bigNum result, - bigConst op, - crypt_uword_t word - ) -{ - int carry; -// - carry = (result->d[0] = op->d[0] + word) < word; - carry = CarryProp(&result->d[1], &op->d[1], (int)(op->size - 1), carry); - CarryResolve(result, (int)op->size, carry); - return TRUE; -} - -//*** SubSame() -// This function subtracts two values that have the same size. -static int -SubSame( - crypt_uword_t *result, - const crypt_uword_t *op1, - const crypt_uword_t *op2, - int count - ) -{ - int borrow = 0; - int i; - for(i = 0; i < count; i++) - { - crypt_uword_t a = op1[i]; - crypt_uword_t diff = a - op2[i]; - result[i] = diff - borrow; - // generate | propagate - borrow = (diff > a) | ((diff == 0) & borrow); - } - return borrow; -} - -//*** BorrowProp() -// This propagates a borrow. If borrow is true when the end -// of the array is reached, then it means that op2 was larger than -// op1 and we don't handle that case so an assert is generated. -// This design choice was made because our only bigNum computations -// are on large positive numbers (primes) or on fields. -// Propagate a borrow. -static int -BorrowProp( - crypt_uword_t *result, - const crypt_uword_t *op, - int size, - int borrow - ) -{ - for(; size > 0; size--) - borrow = ((*result++ = *op++ - borrow) == MAX_CRYPT_UWORD) && borrow; - return borrow; -} - -//*** BnSub() -// This function does subtraction of two bigNum values and returns result = op1 - op2 -// when op1 is greater than op2. If op2 is greater than op1, then a fault is -// generated. This function always returns TRUE. -LIB_EXPORT BOOL -BnSub( - bigNum result, - bigConst op1, - bigConst op2 - ) -{ - int borrow; - int stop = (int)MIN(op1->size, op2->allocated); -// - // Make sure that op2 is not obviously larger than op1 - pAssert(op1->size >= op2->size); - borrow = SubSame(result->d, op1->d, op2->d, stop); - if(op1->size > (crypt_uword_t)stop) - borrow = BorrowProp(&result->d[stop], &op1->d[stop], (int)(op1->size - stop), - borrow); - pAssert(!borrow); - BnSetTop(result, op1->size); - return TRUE; -} - -//*** BnSubWord() -// This function subtracts a word value from a bigNum. This function always -// returns TRUE. -LIB_EXPORT BOOL -BnSubWord( - bigNum result, - bigConst op, - crypt_uword_t word - ) -{ - int borrow; -// - pAssert(op->size > 1 || word <= op->d[0]); - borrow = word > op->d[0]; - result->d[0] = op->d[0] - word; - borrow = BorrowProp(&result->d[1], &op->d[1], (int)(op->size - 1), borrow); - pAssert(!borrow); - BnSetTop(result, op->size); - return TRUE; -} - -//*** BnUnsignedCmp() -// This function performs a comparison of op1 to op2. The compare is approximately -// constant time if the size of the values used in the compare is consistent -// across calls (from the same line in the calling code). -// Return Type: int -// < 0 op1 is less than op2 -// 0 op1 is equal to op2 -// > 0 op1 is greater than op2 -LIB_EXPORT int -BnUnsignedCmp( - bigConst op1, - bigConst op2 - ) -{ - int retVal; - int diff; - int i; -// - pAssert((op1 != NULL) && (op2 != NULL)); - retVal = (int)(op1->size - op2->size); - if(retVal == 0) - { - for(i = (int)(op1->size - 1); i >= 0; i--) - { - diff = (op1->d[i] < op2->d[i]) ? -1 : (op1->d[i] != op2->d[i]); - retVal = retVal == 0 ? diff : retVal; - } - } - else - retVal = (retVal < 0) ? -1 : 1; - return retVal; -} - -//*** BnUnsignedCmpWord() -// Compare a bigNum to a crypt_uword_t. -// Return Type: int -// -1 op1 is less that word -// 0 op1 is equal to word -// 1 op1 is greater than word -LIB_EXPORT int -BnUnsignedCmpWord( - bigConst op1, - crypt_uword_t word - ) -{ - if(op1->size > 1) - return 1; - else if(op1->size == 1) - return (op1->d[0] < word) ? -1 : (op1->d[0] > word); - else // op1 is zero - // equal if word is zero - return (word == 0) ? 0 : -1; -} - -//*** BnModWord() -// This function does modular division of a big number when the modulus is a -// word value. -LIB_EXPORT crypt_word_t -BnModWord( - bigConst numerator, - crypt_word_t modulus - ) -{ - BN_MAX(remainder); - BN_VAR(mod, RADIX_BITS); -// - mod->d[0] = modulus; - mod->size = (modulus != 0); - BnDiv(NULL, remainder, numerator, mod); - return remainder->d[0]; -} - -//*** Msb() -// This function returns the bit number of the most significant bit of a -// crypt_uword_t. The number for the least significant bit of any bigNum value is 0. -// The maximum return value is RADIX_BITS - 1, -// Return Type: int -// -1 the word was zero -// n the bit number of the most significant bit in the word -LIB_EXPORT int -Msb( - crypt_uword_t word - ) -{ - int retVal = -1; -// -#if RADIX_BITS == 64 - if(word & 0xffffffff00000000) { retVal += 32; word >>= 32; } -#endif - if(word & 0xffff0000) { retVal += 16; word >>= 16; } - if(word & 0x0000ff00) { retVal += 8; word >>= 8; } - if(word & 0x000000f0) { retVal += 4; word >>= 4; } - if(word & 0x0000000c) { retVal += 2; word >>= 2; } - if(word & 0x00000002) { retVal += 1; word >>= 1; } - return retVal + (int)word; -} - -//*** BnMsb() -// This function returns the number of the MSb of a bigNum value. -// Return Type: int -// -1 the word was zero or 'bn' was NULL -// n the bit number of the most significant bit in the word -LIB_EXPORT int -BnMsb( - bigConst bn - ) -{ - // If the value is NULL, or the size is zero then treat as zero and return -1 - if(bn != NULL && bn->size > 0) - { - int retVal = Msb(bn->d[bn->size - 1]); - retVal += (int)(bn->size - 1) * RADIX_BITS; - return retVal; - } - else - return -1; -} - -//*** BnSizeInBits() -// This function returns the number of bits required to hold a number. It is one -// greater than the Msb. -// -LIB_EXPORT unsigned -BnSizeInBits( - bigConst n - ) -{ - int bits = BnMsb(n) + 1; -// - return bits < 0? 0 : (unsigned)bits; -} - -//*** BnSetWord() -// Change the value of a bignum_t to a word value. -LIB_EXPORT bigNum -BnSetWord( - bigNum n, - crypt_uword_t w - ) -{ - if(n != NULL) - { - pAssert(n->allocated > 1); - n->d[0] = w; - BnSetTop(n, (w != 0) ? 1 : 0); - } - return n; -} - -//*** BnSetBit() -// This function will SET a bit in a bigNum. Bit 0 is the least-significant bit in -// the 0th digit_t. The function always return TRUE -LIB_EXPORT BOOL -BnSetBit( - bigNum bn, // IN/OUT: big number to modify - unsigned int bitNum // IN: Bit number to SET - ) -{ - crypt_uword_t offset = bitNum / RADIX_BITS; - pAssert(bn->allocated * RADIX_BITS >= bitNum); - // Grow the number if necessary to set the bit. - while(bn->size <= offset) - bn->d[bn->size++] = 0; - bn->d[offset] |= ((crypt_uword_t)1 << RADIX_MOD(bitNum)); - return TRUE; -} - -//*** BnTestBit() -// This function is used to check to see if a bit is SET in a bignum_t. The 0th bit -// is the LSb of d[0]. -// Return Type: BOOL -// TRUE(1) the bit is set -// FALSE(0) the bit is not set or the number is out of range -LIB_EXPORT BOOL -BnTestBit( - bigNum bn, // IN: number to check - unsigned int bitNum // IN: bit to test - ) -{ - crypt_uword_t offset = RADIX_DIV(bitNum); -// - if(bn->size > offset) - return ((bn->d[offset] & (((crypt_uword_t)1) << RADIX_MOD(bitNum))) != 0); - else - return FALSE; -} - -//***BnMaskBits() -// This function is used to mask off high order bits of a big number. -// The returned value will have no more than 'maskBit' bits -// set. -// Note: There is a requirement that unused words of a bignum_t are set to zero. -// Return Type: BOOL -// TRUE(1) result masked -// FALSE(0) the input was not as large as the mask -LIB_EXPORT BOOL -BnMaskBits( - bigNum bn, // IN/OUT: number to mask - crypt_uword_t maskBit // IN: the bit number for the mask. - ) -{ - crypt_uword_t finalSize; - BOOL retVal; - - finalSize = BITS_TO_CRYPT_WORDS(maskBit); - retVal = (finalSize <= bn->allocated); - if(retVal && (finalSize > 0)) - { - crypt_uword_t mask; - mask = ~((crypt_uword_t)0) >> RADIX_MOD(maskBit); - bn->d[finalSize - 1] &= mask; - } - BnSetTop(bn, finalSize); - return retVal; -} - -//*** BnShiftRight() -// This function will shift a bigNum to the right by the shiftAmount. -// This function always returns TRUE. -LIB_EXPORT BOOL -BnShiftRight( - bigNum result, - bigConst toShift, - uint32_t shiftAmount - ) -{ - uint32_t offset = (shiftAmount >> RADIX_LOG2); - uint32_t i; - uint32_t shiftIn; - crypt_uword_t finalSize; -// - shiftAmount = shiftAmount & RADIX_MASK; - shiftIn = RADIX_BITS - shiftAmount; - - // The end size is toShift->size - offset less one additional - // word if the shiftAmount would make the upper word == 0 - if(toShift->size > offset) - { - finalSize = toShift->size - offset; - finalSize -= (toShift->d[toShift->size - 1] >> shiftAmount) == 0 ? 1 : 0; - } - else - finalSize = 0; - - pAssert(finalSize <= result->allocated); - if(finalSize != 0) - { - for(i = 0; i < finalSize; i++) - { - result->d[i] = (toShift->d[i + offset] >> shiftAmount) - | (toShift->d[i + offset + 1] << shiftIn); - } - if(offset == 0) - result->d[i] = toShift->d[i] >> shiftAmount; - } - BnSetTop(result, finalSize); - return TRUE; -} - -//*** BnGetRandomBits() -// This function gets random bits for use in various places. To make sure that the -// number is generated in a portable format, it is created as a TPM2B and then -// converted to the internal format. -// -// One consequence of the generation scheme is that, if the number of bits requested -// is not a multiple of 8, then the high-order bits are set to zero. This would come -// into play when generating a 521-bit ECC key. A 66-byte (528-bit) value is -// generated an the high order 7 bits are masked off (CLEAR). -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -LIB_EXPORT BOOL -BnGetRandomBits( - bigNum n, - size_t bits, - RAND_STATE *rand -) -{ - // Since this could be used for ECC key generation using the extra bits method, - // make sure that the value is large enough - TPM2B_TYPE(LARGEST, LARGEST_NUMBER + 8); - TPM2B_LARGEST large; -// - large.b.size = (UINT16)BITS_TO_BYTES(bits); - if(DRBG_Generate(rand, large.t.buffer, large.t.size) == large.t.size) - { - if(BnFrom2B(n, &large.b) != NULL) - { - if(BnMaskBits(n, bits)) - return TRUE; - } - } - return FALSE; -} - -//*** BnGenerateRandomInRange() -// This function is used to generate a random number r in the range 1 <= r < limit. -// The function gets a random number of bits that is the size of limit. There is some -// some probability that the returned number is going to be greater than or equal -// to the limit. If it is, try again. There is no more than 50% chance that the -// next number is also greater, so try again. We keep trying until we get a -// value that meets the criteria. Since limit is very often a number with a LOT of -// high order ones, this rarely would need a second try. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure ('limit' is too small) -LIB_EXPORT BOOL -BnGenerateRandomInRange( - bigNum dest, - bigConst limit, - RAND_STATE *rand - ) -{ - size_t bits = BnSizeInBits(limit); -// - if(bits < 2) - { - BnSetWord(dest, 0); - return FALSE; - } - else - { - while(BnGetRandomBits(dest, bits, rand) - && (BnEqualZero(dest) || (BnUnsignedCmp(dest, limit) >= 0))); - } - return !g_inFailureMode; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnMemory.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnMemory.c deleted file mode 100644 index ec70a476f..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/BnMemory.c +++ /dev/null @@ -1,187 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the memory setup functions used by the bigNum functions -// in CryptoEngine - -//** Includes -#include "Tpm.h" - -//** Functions - -//*** BnSetTop() -// This function is used when the size of a bignum_t is changed. It -// makes sure that the unused words are set to zero and that any significant -// words of zeros are eliminated from the used size indicator. -LIB_EXPORT bigNum -BnSetTop( - bigNum bn, // IN/OUT: number to clean - crypt_uword_t top // IN: the new top - ) -{ - if(bn != NULL) - { - pAssert(top <= bn->allocated); - // If forcing the size to be decreased, make sure that the words being - // discarded are being set to 0 - while(bn->size > top) - bn->d[--bn->size] = 0; - bn->size = top; - // Now make sure that the words that are left are 'normalized' (no high-order - // words of zero. - while((bn->size > 0) && (bn->d[bn->size - 1] == 0)) - bn->size -= 1; - } - return bn; -} - -//*** BnClearTop() -// This function will make sure that all unused words are zero. -LIB_EXPORT bigNum -BnClearTop( - bigNum bn - ) -{ - crypt_uword_t i; -// - if(bn != NULL) - { - for(i = bn->size; i < bn->allocated; i++) - bn->d[i] = 0; - while((bn->size > 0) && (bn->d[bn->size] == 0)) - bn->size -= 1; - } - return bn; -} - -//*** BnInitializeWord() -// This function is used to initialize an allocated bigNum with a word value. The -// bigNum does not have to be allocated with a single word. -LIB_EXPORT bigNum -BnInitializeWord( - bigNum bn, // IN: - crypt_uword_t allocated, // IN: - crypt_uword_t word // IN: - ) -{ - bn->allocated = allocated; - bn->size = (word != 0); - bn->d[0] = word; - while(allocated > 1) - bn->d[--allocated] = 0; - return bn; -} - -//*** BnInit() -// This function initializes a stack allocated bignum_t. It initializes -// 'allocated' and 'size' and zeros the words of 'd'. -LIB_EXPORT bigNum -BnInit( - bigNum bn, - crypt_uword_t allocated - ) -{ - if(bn != NULL) - { - bn->allocated = allocated; - bn->size = 0; - while(allocated != 0) - bn->d[--allocated] = 0; - } - return bn; -} - -//*** BnCopy() -// Function to copy a bignum_t. If the output is NULL, then -// nothing happens. If the input is NULL, the output is set -// to zero. -LIB_EXPORT BOOL -BnCopy( - bigNum out, - bigConst in - ) -{ - if(in == out) - BnSetTop(out, BnGetSize(out)); - else if(out != NULL) - { - if(in != NULL) - { - unsigned int i; - pAssert(BnGetAllocated(out) >= BnGetSize(in)); - for(i = 0; i < BnGetSize(in); i++) - out->d[i] = in->d[i]; - BnSetTop(out, BnGetSize(in)); - } - else - BnSetTop(out, 0); - } - return TRUE; -} - -#if ALG_ECC - -//*** BnPointCopy() -// Function to copy a bn point. -LIB_EXPORT BOOL -BnPointCopy( - bigPoint pOut, - pointConst pIn - ) -{ - return BnCopy(pOut->x, pIn->x) - && BnCopy(pOut->y, pIn->y) - && BnCopy(pOut->z, pIn->z); -} - -//*** BnInitializePoint() -// This function is used to initialize a point structure with the addresses -// of the coordinates. -LIB_EXPORT bn_point_t * -BnInitializePoint( - bigPoint p, // OUT: structure to receive pointers - bigNum x, // IN: x coordinate - bigNum y, // IN: y coordinate - bigNum z // IN: x coordinate - ) -{ - p->x = x; - p->y = y; - p->z = z; - BnSetWord(z, 1); - return p; -} - -#endif // ALG_ECC \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptCmac.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptCmac.c deleted file mode 100644 index 7440d5f6b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptCmac.c +++ /dev/null @@ -1,176 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This file contains the implementation of the message authentication codes based -// on a symmetric block cipher. These functions only use the single block -// encryption functions of the selected symmetric cryptographic library. - -//** Includes, Defines, and Typedefs -#define _CRYPT_HASH_C_ -#include "Tpm.h" -#include "CryptSym.h" - -#if ALG_CMAC - -//** Functions - -//*** CryptCmacStart() -// This is the function to start the CMAC sequence operation. It initializes the -// dispatch functions for the data and end operations for CMAC and initializes the -// parameters that are used for the processing of data, including the key, key size -// and block cipher algorithm. -UINT16 -CryptCmacStart( - SMAC_STATE *state, - TPMU_PUBLIC_PARMS *keyParms, - TPM_ALG_ID macAlg, - TPM2B *key -) -{ - tpmCmacState_t *cState = &state->state.cmac; - TPMT_SYM_DEF_OBJECT *def = &keyParms->symDetail.sym; -// - if(macAlg != TPM_ALG_CMAC) - return 0; - // set up the encryption algorithm and parameters - cState->symAlg = def->algorithm; - cState->keySizeBits = def->keyBits.sym; - cState->iv.t.size = CryptGetSymmetricBlockSize(def->algorithm, - def->keyBits.sym); - MemoryCopy2B(&cState->symKey.b, key, sizeof(cState->symKey.t.buffer)); - - // Set up the dispatch methods for the CMAC - state->smacMethods.data = CryptCmacData; - state->smacMethods.end = CryptCmacEnd; - return cState->iv.t.size; -} - - -//*** CryptCmacData() -// This function is used to add data to the CMAC sequence computation. The function -// will XOR new data into the IV. If the buffer is full, and there is additional -// input data, the data is encrypted into the IV buffer, the new data is then -// XOR into the IV. When the data runs out, the function returns without encrypting -// even if the buffer is full. The last data block of a sequence will not be -// encrypted until the call to CryptCmacEnd(). This is to allow the proper subkey -// to be computed and applied before the last block is encrypted. -void -CryptCmacData( - SMAC_STATES *state, - UINT32 size, - const BYTE *buffer -) -{ - tpmCmacState_t *cmacState = &state->cmac; - TPM_ALG_ID algorithm = cmacState->symAlg; - BYTE *key = cmacState->symKey.t.buffer; - UINT16 keySizeInBits = cmacState->keySizeBits; - tpmCryptKeySchedule_t keySchedule; - TpmCryptSetSymKeyCall_t encrypt; -// - SELECT(ENCRYPT); - while(size > 0) - { - if(cmacState->bcount == cmacState->iv.t.size) - { - ENCRYPT(&keySchedule, cmacState->iv.t.buffer, cmacState->iv.t.buffer); - cmacState->bcount = 0; - } - for(;(size > 0) && (cmacState->bcount < cmacState->iv.t.size); - size--, cmacState->bcount++) - { - cmacState->iv.t.buffer[cmacState->bcount] ^= *buffer++; - } - } -} - -//*** CryptCmacEnd() -// This is the completion function for the CMAC. It does padding, if needed, and -// selects the subkey to be applied before the last block is encrypted. -UINT16 -CryptCmacEnd( - SMAC_STATES *state, - UINT32 outSize, - BYTE *outBuffer -) -{ - tpmCmacState_t *cState = &state->cmac; - // Need to set algorithm, key, and keySizeInBits in the local context so that - // the SELECT and ENCRYPT macros will work here - TPM_ALG_ID algorithm = cState->symAlg; - BYTE *key = cState->symKey.t.buffer; - UINT16 keySizeInBits = cState->keySizeBits; - tpmCryptKeySchedule_t keySchedule; - TpmCryptSetSymKeyCall_t encrypt; - TPM2B_IV subkey = {{0, {0}}}; - BOOL xorVal; - UINT16 i; - - subkey.t.size = cState->iv.t.size; - // Encrypt a block of zero - SELECT(ENCRYPT); - ENCRYPT(&keySchedule, subkey.t.buffer, subkey.t.buffer); - - // shift left by 1 and XOR with 0x0...87 if the MSb was 0 - xorVal = ((subkey.t.buffer[0] & 0x80) == 0) ? 0 : 0x87; - ShiftLeft(&subkey.b); - subkey.t.buffer[subkey.t.size - 1] ^= xorVal; - // this is a sanity check to make sure that the algorithm is working properly. - // remove this check when debug is done - pAssert(cState->bcount <= cState->iv.t.size); - // If the buffer is full then no need to compute subkey 2. - if(cState->bcount < cState->iv.t.size) - { - //Pad the data - cState->iv.t.buffer[cState->bcount++] ^= 0x80; - // The rest of the data is a pad of zero which would simply be XORed - // with the iv value so nothing to do... - // Now compute K2 - xorVal = ((subkey.t.buffer[0] & 0x80) == 0) ? 0 : 0x87; - ShiftLeft(&subkey.b); - subkey.t.buffer[subkey.t.size - 1] ^= xorVal; - } - // XOR the subkey into the IV - for(i = 0; i < subkey.t.size; i++) - cState->iv.t.buffer[i] ^= subkey.t.buffer[i]; - ENCRYPT(&keySchedule, cState->iv.t.buffer, cState->iv.t.buffer); - i = (UINT16)MIN(cState->iv.t.size, outSize); - MemoryCopy(outBuffer, cState->iv.t.buffer, i); - - return i; -} -#endif - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptDes.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptDes.c deleted file mode 100644 index dd0b6f6ed..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptDes.c +++ /dev/null @@ -1,188 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This file contains the extra functions required for TDES. - -//** Includes, Defines, and Typedefs -#include "Tpm.h" - -#if ALG_TDES - - -#define DES_NUM_WEAK 64 -const UINT64 DesWeakKeys[DES_NUM_WEAK] = { - 0x0101010101010101ULL, 0xFEFEFEFEFEFEFEFEULL, - 0xE0E0E0E0F1F1F1F1ULL, 0x1F1F1F1F0E0E0E0EULL, - 0x011F011F010E010EULL, 0x1F011F010E010E01ULL, - 0x01E001E001F101F1ULL, 0xE001E001F101F101ULL, - 0x01FE01FE01FE01FEULL, 0xFE01FE01FE01FE01ULL, - 0x1FE01FE00EF10EF1ULL, 0xE01FE01FF10EF10EULL, - 0x1FFE1FFE0EFE0EFEULL, 0xFE1FFE1FFE0EFE0EULL, - 0xE0FEE0FEF1FEF1FEULL, 0xFEE0FEE0FEF1FEF1ULL, - 0x01011F1F01010E0EULL, 0x1F1F01010E0E0101ULL, - 0xE0E01F1FF1F10E0EULL, 0x0101E0E00101F1F1ULL, - 0x1F1FE0E00E0EF1F1ULL, 0xE0E0FEFEF1F1FEFEULL, - 0x0101FEFE0101FEFEULL, 0x1F1FFEFE0E0EFEFEULL, - 0xE0FE011FF1FE010EULL, 0x011F1F01010E0E01ULL, - 0x1FE001FE0EF101FEULL, 0xE0FE1F01F1FE0E01ULL, - 0x011FE0FE010EF1FEULL, 0x1FE0E01F0EF1F10EULL, - 0xE0FEFEE0F1FEFEF1ULL, 0x011FFEE0010EFEF1ULL, - 0x1FE0FE010EF1FE01ULL, 0xFE0101FEFE0101FEULL, - 0x01E01FFE01F10EFEULL, 0x1FFE01E00EFE01F1ULL, - 0xFE011FE0FE010EF1ULL, 0xFE01E01FFE01F10EULL, - 0x1FFEE0010EFEF101ULL, 0xFE1F01E0FE0E01F1ULL, - 0x01E0E00101F1F101ULL, 0x1FFEFE1F0EFEFE0EULL, - 0xFE1FE001FE0EF101ULL, 0x01E0FE1F01F1FE0EULL, - 0xE00101E0F10101F1ULL, 0xFE1F1FFEFE0E0EFEULL, - 0x01FE1FE001FE0EF1ULL, 0xE0011FFEF1010EFEULL, - 0xFEE0011FFEF1010EULL, 0x01FEE01F01FEF10EULL, - 0xE001FE1FF101FE0EULL, 0xFEE01F01FEF10E01ULL, - 0x01FEFE0101FEFE01ULL, 0xE01F01FEF10E01FEULL, - 0xFEE0E0FEFEF1F1FEULL, 0x1F01011F0E01010EULL, - 0xE01F1FE0F10E0EF1ULL, 0xFEFE0101FEFE0101ULL, - 0x1F01E0FE0E01F1FEULL, 0xE01FFE01F10EFE01ULL, - 0xFEFE1F1FFEFE0E0EULL, 0x1F01FEE00E01FEF1ULL, - 0xE0E00101F1F10101ULL, 0xFEFEE0E0FEFEF1F1ULL}; - - -//*** CryptSetOddByteParity() -// This function sets the per byte parity of a 64-bit value. The least-significant -// bit is of each byte is replaced with the odd parity of the other 7 bits in the -// byte. With odd parity, no byte will ever be 0x00. -UINT64 -CryptSetOddByteParity( - UINT64 k - ) -{ -#define PMASK 0x0101010101010101ULL - UINT64 out; - k |= PMASK; // set the parity bit - out = k; - k ^= k >> 4; - k ^= k >> 2; - k ^= k >> 1; - k &= PMASK; // odd parity extracted - out ^= k; // out is now even parity because parity bit was already set - out ^= PMASK; // out is now even parity - return out; -} - - -//*** CryptDesIsWeakKey() -// Check to see if a DES key is on the list of weak, semi-weak, or possibly weak -// keys. -// Return Type: BOOL -// TRUE(1) DES key is weak -// FALSE(0) DES key is not weak -static BOOL -CryptDesIsWeakKey( - UINT64 k - ) -{ - int i; -// - for(i = 0; i < DES_NUM_WEAK; i++) - { - if(k == DesWeakKeys[i]) - return TRUE; - } - return FALSE; -} - -//*** CryptDesValidateKey() -// Function to check to see if the input key is a valid DES key where the definition -// of valid is that none of the elements are on the list of weak, semi-weak, or -// possibly weak keys; and that for two keys, K1!=K2, and for three keys that -// K1!=K2 and K2!=K3. -BOOL -CryptDesValidateKey( - TPM2B_SYM_KEY *desKey // IN: key to validate - ) -{ - UINT64 k[3]; - int i; - int keys = (desKey->t.size + 7) / 8; - BYTE *pk = desKey->t.buffer; - BOOL ok; -// - // Note: 'keys' is the number of keys, not the maximum index for 'k' - ok = ((keys == 2) || (keys == 3)) && ((desKey->t.size % 8) == 0); - for(i = 0; ok && i < keys; pk += 8, i++) - { - k[i] = CryptSetOddByteParity(BYTE_ARRAY_TO_UINT64(pk)); - ok = !CryptDesIsWeakKey(k[i]); - } - ok = ok && k[0] != k[1]; - if(keys == 3) - ok = ok && k[1] != k[2]; - return ok; -} - -//*** CryptGenerateKeyDes() -// This function is used to create a DES key of the appropriate size. The key will -// have odd parity in the bytes. -TPM_RC -CryptGenerateKeyDes( - TPMT_PUBLIC *publicArea, // IN/OUT: The public area template - // for the new key. - TPMT_SENSITIVE *sensitive, // OUT: sensitive area - RAND_STATE *rand // IN: the "entropy" source for - ) -{ - - // Assume that the publicArea key size has been validated and is a supported - // number of bits. - sensitive->sensitive.sym.t.size = - BITS_TO_BYTES(publicArea->parameters.symDetail.sym.keyBits.sym); - do - { - BYTE *pK = sensitive->sensitive.sym.t.buffer; - int i = (sensitive->sensitive.sym.t.size + 7) / 8; -// Use the random number generator to generate the required number of bits - if(DRBG_Generate(rand, pK, sensitive->sensitive.sym.t.size) == 0) - return TPM_RC_NO_RESULT; - for(; i > 0; pK += 8, i--) - { - UINT64 k = BYTE_ARRAY_TO_UINT64(pK); - k = CryptSetOddByteParity(k); - UINT64_TO_BYTE_ARRAY(k, pK); - } - } while(!CryptDesValidateKey(&sensitive->sensitive.sym)); - return TPM_RC_SUCCESS; -} - -#endif -//*** diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccData.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccData.c deleted file mode 100644 index 06fb85e90..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccData.c +++ /dev/null @@ -1,657 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmStructures; Version 4.1 Dec 8, 2018 - * Date: Jan 28, 2019 Time: 01:24:09AM - */ - -#include "Tpm.h" -#include "OIDs.h" - - -// This file contains the ECC curve data. The format of the data depends on the -// setting of USE_BN_ECC_DATA. If it is defined, then the TPM's BigNum format is -// used. Otherwise, it is kept in TPM2B format. The purpose of having the data in -// BigNum format is so that it does not have to be reformatted before being used -// by the crypto library. - -#if ALG_ECC - -#if USE_BN_ECC_DATA -# define TO_ECC_64 TO_CRYPT_WORD_64 -# define TO_ECC_56(a, b, c, d, e, f, g) TO_ECC_64(0, a, b, c, d, e, f, g) -# define TO_ECC_48(a, b, c, d, e, f) TO_ECC_64(0, 0, a, b, c, d, e, f) -# define TO_ECC_40(a, b, c, d, e) TO_ECC_64(0, 0, 0, a, b, c, d, e) -# if RADIX_BITS > 32 -# define TO_ECC_32(a, b, c, d) TO_ECC_64(0, 0, 0, 0, a, b, c, d) -# define TO_ECC_24(a, b, c) TO_ECC_64(0, 0, 0, 0, 0, a, b, c) -# define TO_ECC_16(a, b) TO_ECC_64(0, 0, 0, 0, 0, 0, a, b) -# define TO_ECC_8(a) TO_ECC_64(0, 0, 0, 0, 0, 0, 0, a) -# else // RADIX_BITS == 32 -# define TO_ECC_32 BIG_ENDIAN_BYTES_TO_UINT32 -# define TO_ECC_24(a, b, c) TO_ECC_32(0, a, b, c) -# define TO_ECC_16(a, b) TO_ECC_32(0, 0, a, b) -# define TO_ECC_8(a) TO_ECC_32(0, 0, 0, a) -# endif -#else // TPM2B_ -# define TO_ECC_64(a, b, c, d, e, f, g, h) a, b, c, d, e, f, g, h -# define TO_ECC_56(a, b, c, d, e, f, g) a, b, c, d, e, f, g -# define TO_ECC_48(a, b, c, d, e, f) a, b, c, d, e, f -# define TO_ECC_40(a, b, c, d, e) a, b, c, d, e -# define TO_ECC_32(a, b, c, d) a, b, c, d -# define TO_ECC_24(a, b, c) a, b, c -# define TO_ECC_16(a, b) a, b -# define TO_ECC_8(a) a -#endif - -#if USE_BN_ECC_DATA -#define BN_MIN_ALLOC(bytes) \ - (BYTES_TO_CRYPT_WORDS(bytes) == 0) ? 1 : BYTES_TO_CRYPT_WORDS(bytes) -# define ECC_CONST(NAME, bytes, initializer) \ - const struct { \ - crypt_uword_t allocate, size, d[BN_MIN_ALLOC(bytes)]; \ - } NAME = {BN_MIN_ALLOC(bytes), BYTES_TO_CRYPT_WORDS(bytes),{initializer}} - -ECC_CONST(ECC_ZERO, 0, 0); - -#else -# define ECC_CONST(NAME, bytes, initializer) \ - const TPM2B_##bytes##_BYTE_VALUE NAME = {bytes, {initializer}} - -// Have to special case ECC_ZERO -TPM2B_BYTE_VALUE(1); -TPM2B_1_BYTE_VALUE ECC_ZERO = {1, {0}}; - - -#endif - -ECC_CONST(ECC_ONE, 1, 1); - -#if !USE_BN_ECC_DATA -TPM2B_BYTE_VALUE(24); -#define TO_ECC_192(a, b, c) a, b, c -TPM2B_BYTE_VALUE(28); -#define TO_ECC_224(a, b, c, d) a, b, c, d -TPM2B_BYTE_VALUE(32); -#define TO_ECC_256(a, b, c, d) a, b, c, d -TPM2B_BYTE_VALUE(48); -#define TO_ECC_384(a, b, c, d, e, f) a, b, c, d, e, f -TPM2B_BYTE_VALUE(66); -#define TO_ECC_528(a, b, c, d, e, f, g, h, i) a, b, c, d, e, f, g, h, i -TPM2B_BYTE_VALUE(80); -#define TO_ECC_640(a, b, c, d, e, f, g, h, i, j) a, b, c, d, e, f, g, h, i, j -#else -#define TO_ECC_192(a, b, c) c, b, a -#define TO_ECC_224(a, b, c, d) d, c, b, a -#define TO_ECC_256(a, b, c, d) d, c, b, a -#define TO_ECC_384(a, b, c, d, e, f) f, e, d, c, b, a -#define TO_ECC_528(a, b, c, d, e, f, g, h, i) i, h, g, f, e, d, c, b, a -#define TO_ECC_640(a, b, c, d, e, f, g, h, i, j) j, i, h, g, f, e, d, c, b, a -#endif // !USE_BN_ECC_DATA - -#if ECC_NIST_P192 -ECC_CONST(NIST_P192_p, 24, TO_ECC_192( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF))); -ECC_CONST(NIST_P192_a, 24, TO_ECC_192( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC))); -ECC_CONST(NIST_P192_b, 24, TO_ECC_192( - TO_ECC_64(0x64, 0x21, 0x05, 0x19, 0xE5, 0x9C, 0x80, 0xE7), - TO_ECC_64(0x0F, 0xA7, 0xE9, 0xAB, 0x72, 0x24, 0x30, 0x49), - TO_ECC_64(0xFE, 0xB8, 0xDE, 0xEC, 0xC1, 0x46, 0xB9, 0xB1))); -ECC_CONST(NIST_P192_gX, 24, TO_ECC_192( - TO_ECC_64(0x18, 0x8D, 0xA8, 0x0E, 0xB0, 0x30, 0x90, 0xF6), - TO_ECC_64(0x7C, 0xBF, 0x20, 0xEB, 0x43, 0xA1, 0x88, 0x00), - TO_ECC_64(0xF4, 0xFF, 0x0A, 0xFD, 0x82, 0xFF, 0x10, 0x12))); -ECC_CONST(NIST_P192_gY, 24, TO_ECC_192( - TO_ECC_64(0x07, 0x19, 0x2B, 0x95, 0xFF, 0xC8, 0xDA, 0x78), - TO_ECC_64(0x63, 0x10, 0x11, 0xED, 0x6B, 0x24, 0xCD, 0xD5), - TO_ECC_64(0x73, 0xF9, 0x77, 0xA1, 0x1E, 0x79, 0x48, 0x11))); -ECC_CONST(NIST_P192_n, 24, TO_ECC_192( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0xDE, 0xF8, 0x36), - TO_ECC_64(0x14, 0x6B, 0xC9, 0xB1, 0xB4, 0xD2, 0x28, 0x31))); -#define NIST_P192_h ECC_ONE -#define NIST_P192_gZ ECC_ONE - -#if USE_BN_ECC_DATA - const ECC_CURVE_DATA NIST_P192 = { - (bigNum)&NIST_P192_p, (bigNum)&NIST_P192_n, (bigNum)&NIST_P192_h, - (bigNum)&NIST_P192_a, (bigNum)&NIST_P192_b, - {(bigNum)&NIST_P192_gX, (bigNum)&NIST_P192_gY, (bigNum)&NIST_P192_gZ}}; - -#else - const ECC_CURVE_DATA NIST_P192 = { - &NIST_P192_p.b, &NIST_P192_n.b, &NIST_P192_h.b, - &NIST_P192_a.b, &NIST_P192_b.b, - {&NIST_P192_gX.b, &NIST_P192_gY.b, &NIST_P192_gZ.b}}; - -#endif // USE_BN_ECC_DATA - -#endif // ECC_NIST_P192 - - -#if ECC_NIST_P224 -ECC_CONST(NIST_P224_p, 28, TO_ECC_224( - TO_ECC_32(0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01))); -ECC_CONST(NIST_P224_a, 28, TO_ECC_224( - TO_ECC_32(0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE))); -ECC_CONST(NIST_P224_b, 28, TO_ECC_224( - TO_ECC_32(0xB4, 0x05, 0x0A, 0x85), - TO_ECC_64(0x0C, 0x04, 0xB3, 0xAB, 0xF5, 0x41, 0x32, 0x56), - TO_ECC_64(0x50, 0x44, 0xB0, 0xB7, 0xD7, 0xBF, 0xD8, 0xBA), - TO_ECC_64(0x27, 0x0B, 0x39, 0x43, 0x23, 0x55, 0xFF, 0xB4))); -ECC_CONST(NIST_P224_gX, 28, TO_ECC_224( - TO_ECC_32(0xB7, 0x0E, 0x0C, 0xBD), - TO_ECC_64(0x6B, 0xB4, 0xBF, 0x7F, 0x32, 0x13, 0x90, 0xB9), - TO_ECC_64(0x4A, 0x03, 0xC1, 0xD3, 0x56, 0xC2, 0x11, 0x22), - TO_ECC_64(0x34, 0x32, 0x80, 0xD6, 0x11, 0x5C, 0x1D, 0x21))); -ECC_CONST(NIST_P224_gY, 28, TO_ECC_224( - TO_ECC_32(0xBD, 0x37, 0x63, 0x88), - TO_ECC_64(0xB5, 0xF7, 0x23, 0xFB, 0x4C, 0x22, 0xDF, 0xE6), - TO_ECC_64(0xCD, 0x43, 0x75, 0xA0, 0x5A, 0x07, 0x47, 0x64), - TO_ECC_64(0x44, 0xD5, 0x81, 0x99, 0x85, 0x00, 0x7E, 0x34))); -ECC_CONST(NIST_P224_n, 28, TO_ECC_224( - TO_ECC_32(0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0x16, 0xA2, 0xE0, 0xB8, 0xF0, 0x3E), - TO_ECC_64(0x13, 0xDD, 0x29, 0x45, 0x5C, 0x5C, 0x2A, 0x3D))); -#define NIST_P224_h ECC_ONE -#define NIST_P224_gZ ECC_ONE - -#if USE_BN_ECC_DATA - const ECC_CURVE_DATA NIST_P224 = { - (bigNum)&NIST_P224_p, (bigNum)&NIST_P224_n, (bigNum)&NIST_P224_h, - (bigNum)&NIST_P224_a, (bigNum)&NIST_P224_b, - {(bigNum)&NIST_P224_gX, (bigNum)&NIST_P224_gY, (bigNum)&NIST_P224_gZ}}; - -#else - const ECC_CURVE_DATA NIST_P224 = { - &NIST_P224_p.b, &NIST_P224_n.b, &NIST_P224_h.b, - &NIST_P224_a.b, &NIST_P224_b.b, - {&NIST_P224_gX.b, &NIST_P224_gY.b, &NIST_P224_gZ.b}}; - -#endif // USE_BN_ECC_DATA - -#endif // ECC_NIST_P224 - - -#if ECC_NIST_P256 -ECC_CONST(NIST_P256_p, 32, TO_ECC_256( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF))); -ECC_CONST(NIST_P256_a, 32, TO_ECC_256( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC))); -ECC_CONST(NIST_P256_b, 32, TO_ECC_256( - TO_ECC_64(0x5A, 0xC6, 0x35, 0xD8, 0xAA, 0x3A, 0x93, 0xE7), - TO_ECC_64(0xB3, 0xEB, 0xBD, 0x55, 0x76, 0x98, 0x86, 0xBC), - TO_ECC_64(0x65, 0x1D, 0x06, 0xB0, 0xCC, 0x53, 0xB0, 0xF6), - TO_ECC_64(0x3B, 0xCE, 0x3C, 0x3E, 0x27, 0xD2, 0x60, 0x4B))); -ECC_CONST(NIST_P256_gX, 32, TO_ECC_256( - TO_ECC_64(0x6B, 0x17, 0xD1, 0xF2, 0xE1, 0x2C, 0x42, 0x47), - TO_ECC_64(0xF8, 0xBC, 0xE6, 0xE5, 0x63, 0xA4, 0x40, 0xF2), - TO_ECC_64(0x77, 0x03, 0x7D, 0x81, 0x2D, 0xEB, 0x33, 0xA0), - TO_ECC_64(0xF4, 0xA1, 0x39, 0x45, 0xD8, 0x98, 0xC2, 0x96))); -ECC_CONST(NIST_P256_gY, 32, TO_ECC_256( - TO_ECC_64(0x4F, 0xE3, 0x42, 0xE2, 0xFE, 0x1A, 0x7F, 0x9B), - TO_ECC_64(0x8E, 0xE7, 0xEB, 0x4A, 0x7C, 0x0F, 0x9E, 0x16), - TO_ECC_64(0x2B, 0xCE, 0x33, 0x57, 0x6B, 0x31, 0x5E, 0xCE), - TO_ECC_64(0xCB, 0xB6, 0x40, 0x68, 0x37, 0xBF, 0x51, 0xF5))); -ECC_CONST(NIST_P256_n, 32, TO_ECC_256( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84), - TO_ECC_64(0xF3, 0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51))); -#define NIST_P256_h ECC_ONE -#define NIST_P256_gZ ECC_ONE - -#if USE_BN_ECC_DATA - const ECC_CURVE_DATA NIST_P256 = { - (bigNum)&NIST_P256_p, (bigNum)&NIST_P256_n, (bigNum)&NIST_P256_h, - (bigNum)&NIST_P256_a, (bigNum)&NIST_P256_b, - {(bigNum)&NIST_P256_gX, (bigNum)&NIST_P256_gY, (bigNum)&NIST_P256_gZ}}; - -#else - const ECC_CURVE_DATA NIST_P256 = { - &NIST_P256_p.b, &NIST_P256_n.b, &NIST_P256_h.b, - &NIST_P256_a.b, &NIST_P256_b.b, - {&NIST_P256_gX.b, &NIST_P256_gY.b, &NIST_P256_gZ.b}}; - -#endif // USE_BN_ECC_DATA - -#endif // ECC_NIST_P256 - - -#if ECC_NIST_P384 -ECC_CONST(NIST_P384_p, 48, TO_ECC_384( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF))); -ECC_CONST(NIST_P384_a, 48, TO_ECC_384( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFC))); -ECC_CONST(NIST_P384_b, 48, TO_ECC_384( - TO_ECC_64(0xB3, 0x31, 0x2F, 0xA7, 0xE2, 0x3E, 0xE7, 0xE4), - TO_ECC_64(0x98, 0x8E, 0x05, 0x6B, 0xE3, 0xF8, 0x2D, 0x19), - TO_ECC_64(0x18, 0x1D, 0x9C, 0x6E, 0xFE, 0x81, 0x41, 0x12), - TO_ECC_64(0x03, 0x14, 0x08, 0x8F, 0x50, 0x13, 0x87, 0x5A), - TO_ECC_64(0xC6, 0x56, 0x39, 0x8D, 0x8A, 0x2E, 0xD1, 0x9D), - TO_ECC_64(0x2A, 0x85, 0xC8, 0xED, 0xD3, 0xEC, 0x2A, 0xEF))); -ECC_CONST(NIST_P384_gX, 48, TO_ECC_384( - TO_ECC_64(0xAA, 0x87, 0xCA, 0x22, 0xBE, 0x8B, 0x05, 0x37), - TO_ECC_64(0x8E, 0xB1, 0xC7, 0x1E, 0xF3, 0x20, 0xAD, 0x74), - TO_ECC_64(0x6E, 0x1D, 0x3B, 0x62, 0x8B, 0xA7, 0x9B, 0x98), - TO_ECC_64(0x59, 0xF7, 0x41, 0xE0, 0x82, 0x54, 0x2A, 0x38), - TO_ECC_64(0x55, 0x02, 0xF2, 0x5D, 0xBF, 0x55, 0x29, 0x6C), - TO_ECC_64(0x3A, 0x54, 0x5E, 0x38, 0x72, 0x76, 0x0A, 0xB7))); -ECC_CONST(NIST_P384_gY, 48, TO_ECC_384( - TO_ECC_64(0x36, 0x17, 0xDE, 0x4A, 0x96, 0x26, 0x2C, 0x6F), - TO_ECC_64(0x5D, 0x9E, 0x98, 0xBF, 0x92, 0x92, 0xDC, 0x29), - TO_ECC_64(0xF8, 0xF4, 0x1D, 0xBD, 0x28, 0x9A, 0x14, 0x7C), - TO_ECC_64(0xE9, 0xDA, 0x31, 0x13, 0xB5, 0xF0, 0xB8, 0xC0), - TO_ECC_64(0x0A, 0x60, 0xB1, 0xCE, 0x1D, 0x7E, 0x81, 0x9D), - TO_ECC_64(0x7A, 0x43, 0x1D, 0x7C, 0x90, 0xEA, 0x0E, 0x5F))); -ECC_CONST(NIST_P384_n, 48, TO_ECC_384( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xC7, 0x63, 0x4D, 0x81, 0xF4, 0x37, 0x2D, 0xDF), - TO_ECC_64(0x58, 0x1A, 0x0D, 0xB2, 0x48, 0xB0, 0xA7, 0x7A), - TO_ECC_64(0xEC, 0xEC, 0x19, 0x6A, 0xCC, 0xC5, 0x29, 0x73))); -#define NIST_P384_h ECC_ONE -#define NIST_P384_gZ ECC_ONE - -#if USE_BN_ECC_DATA - const ECC_CURVE_DATA NIST_P384 = { - (bigNum)&NIST_P384_p, (bigNum)&NIST_P384_n, (bigNum)&NIST_P384_h, - (bigNum)&NIST_P384_a, (bigNum)&NIST_P384_b, - {(bigNum)&NIST_P384_gX, (bigNum)&NIST_P384_gY, (bigNum)&NIST_P384_gZ}}; - -#else - const ECC_CURVE_DATA NIST_P384 = { - &NIST_P384_p.b, &NIST_P384_n.b, &NIST_P384_h.b, - &NIST_P384_a.b, &NIST_P384_b.b, - {&NIST_P384_gX.b, &NIST_P384_gY.b, &NIST_P384_gZ.b}}; - -#endif // USE_BN_ECC_DATA - -#endif // ECC_NIST_P384 - - -#if ECC_NIST_P521 -ECC_CONST(NIST_P521_p, 66, TO_ECC_528( - TO_ECC_16(0x01, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF))); -ECC_CONST(NIST_P521_a, 66, TO_ECC_528( - TO_ECC_16(0x01, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC))); -ECC_CONST(NIST_P521_b, 66, TO_ECC_528( - TO_ECC_16(0x00, 0x51), - TO_ECC_64(0x95, 0x3E, 0xB9, 0x61, 0x8E, 0x1C, 0x9A, 0x1F), - TO_ECC_64(0x92, 0x9A, 0x21, 0xA0, 0xB6, 0x85, 0x40, 0xEE), - TO_ECC_64(0xA2, 0xDA, 0x72, 0x5B, 0x99, 0xB3, 0x15, 0xF3), - TO_ECC_64(0xB8, 0xB4, 0x89, 0x91, 0x8E, 0xF1, 0x09, 0xE1), - TO_ECC_64(0x56, 0x19, 0x39, 0x51, 0xEC, 0x7E, 0x93, 0x7B), - TO_ECC_64(0x16, 0x52, 0xC0, 0xBD, 0x3B, 0xB1, 0xBF, 0x07), - TO_ECC_64(0x35, 0x73, 0xDF, 0x88, 0x3D, 0x2C, 0x34, 0xF1), - TO_ECC_64(0xEF, 0x45, 0x1F, 0xD4, 0x6B, 0x50, 0x3F, 0x00))); -ECC_CONST(NIST_P521_gX, 66, TO_ECC_528( - TO_ECC_16(0x00, 0xC6), - TO_ECC_64(0x85, 0x8E, 0x06, 0xB7, 0x04, 0x04, 0xE9, 0xCD), - TO_ECC_64(0x9E, 0x3E, 0xCB, 0x66, 0x23, 0x95, 0xB4, 0x42), - TO_ECC_64(0x9C, 0x64, 0x81, 0x39, 0x05, 0x3F, 0xB5, 0x21), - TO_ECC_64(0xF8, 0x28, 0xAF, 0x60, 0x6B, 0x4D, 0x3D, 0xBA), - TO_ECC_64(0xA1, 0x4B, 0x5E, 0x77, 0xEF, 0xE7, 0x59, 0x28), - TO_ECC_64(0xFE, 0x1D, 0xC1, 0x27, 0xA2, 0xFF, 0xA8, 0xDE), - TO_ECC_64(0x33, 0x48, 0xB3, 0xC1, 0x85, 0x6A, 0x42, 0x9B), - TO_ECC_64(0xF9, 0x7E, 0x7E, 0x31, 0xC2, 0xE5, 0xBD, 0x66))); -ECC_CONST(NIST_P521_gY, 66, TO_ECC_528( - TO_ECC_16(0x01, 0x18), - TO_ECC_64(0x39, 0x29, 0x6A, 0x78, 0x9A, 0x3B, 0xC0, 0x04), - TO_ECC_64(0x5C, 0x8A, 0x5F, 0xB4, 0x2C, 0x7D, 0x1B, 0xD9), - TO_ECC_64(0x98, 0xF5, 0x44, 0x49, 0x57, 0x9B, 0x44, 0x68), - TO_ECC_64(0x17, 0xAF, 0xBD, 0x17, 0x27, 0x3E, 0x66, 0x2C), - TO_ECC_64(0x97, 0xEE, 0x72, 0x99, 0x5E, 0xF4, 0x26, 0x40), - TO_ECC_64(0xC5, 0x50, 0xB9, 0x01, 0x3F, 0xAD, 0x07, 0x61), - TO_ECC_64(0x35, 0x3C, 0x70, 0x86, 0xA2, 0x72, 0xC2, 0x40), - TO_ECC_64(0x88, 0xBE, 0x94, 0x76, 0x9F, 0xD1, 0x66, 0x50))); -ECC_CONST(NIST_P521_n, 66, TO_ECC_528( - TO_ECC_16(0x01, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA), - TO_ECC_64(0x51, 0x86, 0x87, 0x83, 0xBF, 0x2F, 0x96, 0x6B), - TO_ECC_64(0x7F, 0xCC, 0x01, 0x48, 0xF7, 0x09, 0xA5, 0xD0), - TO_ECC_64(0x3B, 0xB5, 0xC9, 0xB8, 0x89, 0x9C, 0x47, 0xAE), - TO_ECC_64(0xBB, 0x6F, 0xB7, 0x1E, 0x91, 0x38, 0x64, 0x09))); -#define NIST_P521_h ECC_ONE -#define NIST_P521_gZ ECC_ONE - -#if USE_BN_ECC_DATA - const ECC_CURVE_DATA NIST_P521 = { - (bigNum)&NIST_P521_p, (bigNum)&NIST_P521_n, (bigNum)&NIST_P521_h, - (bigNum)&NIST_P521_a, (bigNum)&NIST_P521_b, - {(bigNum)&NIST_P521_gX, (bigNum)&NIST_P521_gY, (bigNum)&NIST_P521_gZ}}; - -#else - const ECC_CURVE_DATA NIST_P521 = { - &NIST_P521_p.b, &NIST_P521_n.b, &NIST_P521_h.b, - &NIST_P521_a.b, &NIST_P521_b.b, - {&NIST_P521_gX.b, &NIST_P521_gY.b, &NIST_P521_gZ.b}}; - -#endif // USE_BN_ECC_DATA - -#endif // ECC_NIST_P521 - - -#if ECC_BN_P256 -ECC_CONST(BN_P256_p, 32, TO_ECC_256( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, 0xCD), - TO_ECC_64(0x46, 0xE5, 0xF2, 0x5E, 0xEE, 0x71, 0xA4, 0x9F), - TO_ECC_64(0x0C, 0xDC, 0x65, 0xFB, 0x12, 0x98, 0x0A, 0x82), - TO_ECC_64(0xD3, 0x29, 0x2D, 0xDB, 0xAE, 0xD3, 0x30, 0x13))); -#define BN_P256_a ECC_ZERO -ECC_CONST(BN_P256_b, 1, TO_ECC_8(3)); -#define BN_P256_gX ECC_ONE -ECC_CONST(BN_P256_gY, 1, TO_ECC_8(2)); -ECC_CONST(BN_P256_n, 32, TO_ECC_256( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF0, 0xCD), - TO_ECC_64(0x46, 0xE5, 0xF2, 0x5E, 0xEE, 0x71, 0xA4, 0x9E), - TO_ECC_64(0x0C, 0xDC, 0x65, 0xFB, 0x12, 0x99, 0x92, 0x1A), - TO_ECC_64(0xF6, 0x2D, 0x53, 0x6C, 0xD1, 0x0B, 0x50, 0x0D))); -#define BN_P256_h ECC_ONE -#define BN_P256_gZ ECC_ONE - -#if USE_BN_ECC_DATA - const ECC_CURVE_DATA BN_P256 = { - (bigNum)&BN_P256_p, (bigNum)&BN_P256_n, (bigNum)&BN_P256_h, - (bigNum)&BN_P256_a, (bigNum)&BN_P256_b, - {(bigNum)&BN_P256_gX, (bigNum)&BN_P256_gY, (bigNum)&BN_P256_gZ}}; - -#else - const ECC_CURVE_DATA BN_P256 = { - &BN_P256_p.b, &BN_P256_n.b, &BN_P256_h.b, - &BN_P256_a.b, &BN_P256_b.b, - {&BN_P256_gX.b, &BN_P256_gY.b, &BN_P256_gZ.b}}; - -#endif // USE_BN_ECC_DATA - -#endif // ECC_BN_P256 - - -#if ECC_BN_P638 -ECC_CONST(BN_P638_p, 80, TO_ECC_640( - TO_ECC_64(0x23, 0xFF, 0xFF, 0xFD, 0xC0, 0x00, 0x00, 0x0D), - TO_ECC_64(0x7F, 0xFF, 0xFF, 0xB8, 0x00, 0x00, 0x01, 0xD3), - TO_ECC_64(0xFF, 0xFF, 0xF9, 0x42, 0xD0, 0x00, 0x16, 0x5E), - TO_ECC_64(0x3F, 0xFF, 0x94, 0x87, 0x00, 0x00, 0xD5, 0x2F), - TO_ECC_64(0xFF, 0xFD, 0xD0, 0xE0, 0x00, 0x08, 0xDE, 0x55), - TO_ECC_64(0xC0, 0x00, 0x86, 0x52, 0x00, 0x21, 0xE5, 0x5B), - TO_ECC_64(0xFF, 0xFF, 0xF5, 0x1F, 0xFF, 0xF4, 0xEB, 0x80), - TO_ECC_64(0x00, 0x00, 0x00, 0x4C, 0x80, 0x01, 0x5A, 0xCD), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0xE0), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67))); -#define BN_P638_a ECC_ZERO -ECC_CONST(BN_P638_b, 2, TO_ECC_16(0x01,0x01)); -ECC_CONST(BN_P638_gX, 80, TO_ECC_640( - TO_ECC_64(0x23, 0xFF, 0xFF, 0xFD, 0xC0, 0x00, 0x00, 0x0D), - TO_ECC_64(0x7F, 0xFF, 0xFF, 0xB8, 0x00, 0x00, 0x01, 0xD3), - TO_ECC_64(0xFF, 0xFF, 0xF9, 0x42, 0xD0, 0x00, 0x16, 0x5E), - TO_ECC_64(0x3F, 0xFF, 0x94, 0x87, 0x00, 0x00, 0xD5, 0x2F), - TO_ECC_64(0xFF, 0xFD, 0xD0, 0xE0, 0x00, 0x08, 0xDE, 0x55), - TO_ECC_64(0xC0, 0x00, 0x86, 0x52, 0x00, 0x21, 0xE5, 0x5B), - TO_ECC_64(0xFF, 0xFF, 0xF5, 0x1F, 0xFF, 0xF4, 0xEB, 0x80), - TO_ECC_64(0x00, 0x00, 0x00, 0x4C, 0x80, 0x01, 0x5A, 0xCD), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0xE0), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66))); -ECC_CONST(BN_P638_gY, 1, TO_ECC_8(0x10)); -ECC_CONST(BN_P638_n, 80, TO_ECC_640( - TO_ECC_64(0x23, 0xFF, 0xFF, 0xFD, 0xC0, 0x00, 0x00, 0x0D), - TO_ECC_64(0x7F, 0xFF, 0xFF, 0xB8, 0x00, 0x00, 0x01, 0xD3), - TO_ECC_64(0xFF, 0xFF, 0xF9, 0x42, 0xD0, 0x00, 0x16, 0x5E), - TO_ECC_64(0x3F, 0xFF, 0x94, 0x87, 0x00, 0x00, 0xD5, 0x2F), - TO_ECC_64(0xFF, 0xFD, 0xD0, 0xE0, 0x00, 0x08, 0xDE, 0x55), - TO_ECC_64(0x60, 0x00, 0x86, 0x55, 0x00, 0x21, 0xE5, 0x55), - TO_ECC_64(0xFF, 0xFF, 0xF5, 0x4F, 0xFF, 0xF4, 0xEA, 0xC0), - TO_ECC_64(0x00, 0x00, 0x00, 0x49, 0x80, 0x01, 0x54, 0xD9), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xA0), - TO_ECC_64(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61))); -#define BN_P638_h ECC_ONE -#define BN_P638_gZ ECC_ONE - -#if USE_BN_ECC_DATA - const ECC_CURVE_DATA BN_P638 = { - (bigNum)&BN_P638_p, (bigNum)&BN_P638_n, (bigNum)&BN_P638_h, - (bigNum)&BN_P638_a, (bigNum)&BN_P638_b, - {(bigNum)&BN_P638_gX, (bigNum)&BN_P638_gY, (bigNum)&BN_P638_gZ}}; - -#else - const ECC_CURVE_DATA BN_P638 = { - &BN_P638_p.b, &BN_P638_n.b, &BN_P638_h.b, - &BN_P638_a.b, &BN_P638_b.b, - {&BN_P638_gX.b, &BN_P638_gY.b, &BN_P638_gZ.b}}; - -#endif // USE_BN_ECC_DATA - -#endif // ECC_BN_P638 - - -#if ECC_SM2_P256 -ECC_CONST(SM2_P256_p, 32, TO_ECC_256( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF))); -ECC_CONST(SM2_P256_a, 32, TO_ECC_256( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC))); -ECC_CONST(SM2_P256_b, 32, TO_ECC_256( - TO_ECC_64(0x28, 0xE9, 0xFA, 0x9E, 0x9D, 0x9F, 0x5E, 0x34), - TO_ECC_64(0x4D, 0x5A, 0x9E, 0x4B, 0xCF, 0x65, 0x09, 0xA7), - TO_ECC_64(0xF3, 0x97, 0x89, 0xF5, 0x15, 0xAB, 0x8F, 0x92), - TO_ECC_64(0xDD, 0xBC, 0xBD, 0x41, 0x4D, 0x94, 0x0E, 0x93))); -ECC_CONST(SM2_P256_gX, 32, TO_ECC_256( - TO_ECC_64(0x32, 0xC4, 0xAE, 0x2C, 0x1F, 0x19, 0x81, 0x19), - TO_ECC_64(0x5F, 0x99, 0x04, 0x46, 0x6A, 0x39, 0xC9, 0x94), - TO_ECC_64(0x8F, 0xE3, 0x0B, 0xBF, 0xF2, 0x66, 0x0B, 0xE1), - TO_ECC_64(0x71, 0x5A, 0x45, 0x89, 0x33, 0x4C, 0x74, 0xC7))); -ECC_CONST(SM2_P256_gY, 32, TO_ECC_256( - TO_ECC_64(0xBC, 0x37, 0x36, 0xA2, 0xF4, 0xF6, 0x77, 0x9C), - TO_ECC_64(0x59, 0xBD, 0xCE, 0xE3, 0x6B, 0x69, 0x21, 0x53), - TO_ECC_64(0xD0, 0xA9, 0x87, 0x7C, 0xC6, 0x2A, 0x47, 0x40), - TO_ECC_64(0x02, 0xDF, 0x32, 0xE5, 0x21, 0x39, 0xF0, 0xA0))); -ECC_CONST(SM2_P256_n, 32, TO_ECC_256( - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), - TO_ECC_64(0x72, 0x03, 0xDF, 0x6B, 0x21, 0xC6, 0x05, 0x2B), - TO_ECC_64(0x53, 0xBB, 0xF4, 0x09, 0x39, 0xD5, 0x41, 0x23))); -#define SM2_P256_h ECC_ONE -#define SM2_P256_gZ ECC_ONE - -#if USE_BN_ECC_DATA - const ECC_CURVE_DATA SM2_P256 = { - (bigNum)&SM2_P256_p, (bigNum)&SM2_P256_n, (bigNum)&SM2_P256_h, - (bigNum)&SM2_P256_a, (bigNum)&SM2_P256_b, - {(bigNum)&SM2_P256_gX, (bigNum)&SM2_P256_gY, (bigNum)&SM2_P256_gZ}}; - -#else - const ECC_CURVE_DATA SM2_P256 = { - &SM2_P256_p.b, &SM2_P256_n.b, &SM2_P256_h.b, - &SM2_P256_a.b, &SM2_P256_b.b, - {&SM2_P256_gX.b, &SM2_P256_gY.b, &SM2_P256_gZ.b}}; - -#endif // USE_BN_ECC_DATA - -#endif // ECC_SM2_P256 - - -#define comma -const ECC_CURVE eccCurves[] = { -#if ECC_NIST_P192 - comma - {TPM_ECC_NIST_P192, - 192, - {ALG_KDF1_SP800_56A_VALUE, {{ALG_SHA256_VALUE}}}, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - &NIST_P192, - OID_ECC_NIST_P192 - CURVE_NAME("NIST_P192")} -# undef comma -# define comma , -#endif // ECC_NIST_P192 -#if ECC_NIST_P224 - comma - {TPM_ECC_NIST_P224, - 224, - {ALG_KDF1_SP800_56A_VALUE, {{ALG_SHA256_VALUE}}}, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - &NIST_P224, - OID_ECC_NIST_P224 - CURVE_NAME("NIST_P224")} -# undef comma -# define comma , -#endif // ECC_NIST_P224 -#if ECC_NIST_P256 - comma - {TPM_ECC_NIST_P256, - 256, - {ALG_KDF1_SP800_56A_VALUE, {{ALG_SHA256_VALUE}}}, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - &NIST_P256, - OID_ECC_NIST_P256 - CURVE_NAME("NIST_P256")} -# undef comma -# define comma , -#endif // ECC_NIST_P256 -#if ECC_NIST_P384 - comma - {TPM_ECC_NIST_P384, - 384, - {ALG_KDF1_SP800_56A_VALUE, {{ALG_SHA384_VALUE}}}, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - &NIST_P384, - OID_ECC_NIST_P384 - CURVE_NAME("NIST_P384")} -# undef comma -# define comma , -#endif // ECC_NIST_P384 -#if ECC_NIST_P521 - comma - {TPM_ECC_NIST_P521, - 521, - {ALG_KDF1_SP800_56A_VALUE, {{ALG_SHA512_VALUE}}}, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - &NIST_P521, - OID_ECC_NIST_P521 - CURVE_NAME("NIST_P521")} -# undef comma -# define comma , -#endif // ECC_NIST_P521 -#if ECC_BN_P256 - comma - {TPM_ECC_BN_P256, - 256, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - &BN_P256, - OID_ECC_BN_P256 - CURVE_NAME("BN_P256")} -# undef comma -# define comma , -#endif // ECC_BN_P256 -#if ECC_BN_P638 - comma - {TPM_ECC_BN_P638, - 638, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - &BN_P638, - OID_ECC_BN_P638 - CURVE_NAME("BN_P638")} -# undef comma -# define comma , -#endif // ECC_BN_P638 -#if ECC_SM2_P256 - comma - {TPM_ECC_SM2_P256, - 256, - {ALG_KDF1_SP800_56A_VALUE, {{ALG_SM3_256_VALUE}}}, - {ALG_NULL_VALUE, {{ALG_NULL_VALUE}}}, - &SM2_P256, - OID_ECC_SM2_P256 - CURVE_NAME("SM2_P256")} -# undef comma -# define comma , -#endif // ECC_SM2_P256 -}; -#endif // TPM_ALG_ECC diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccKeyExchange.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccKeyExchange.c deleted file mode 100644 index 5e141cf3d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccKeyExchange.c +++ /dev/null @@ -1,383 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions that are used for the two-phase, ECC, -// key-exchange protocols - - -#include "Tpm.h" - -#if CC_ZGen_2Phase == YES - -//** Functions - -#if ALG_ECMQV - -//*** avf1() -// This function does the associated value computation required by MQV key -// exchange. -// Process: -// 1. Convert 'xQ' to an integer 'xqi' using the convention specified in Appendix C.3. -// 2. Calculate -// xqm = xqi mod 2^ceil(f/2) (where f = ceil(log2(n)). -// 3. Calculate the associate value function -// avf(Q) = xqm + 2ceil(f / 2) -// Always returns TRUE(1). -static BOOL -avf1( - bigNum bnX, // IN/OUT: the reduced value - bigNum bnN // IN: the order of the curve - ) -{ -// compute f = 2^(ceil(ceil(log2(n)) / 2)) - int f = (BnSizeInBits(bnN) + 1) / 2; -// x' = 2^f + (x mod 2^f) - BnMaskBits(bnX, f); // This is mod 2*2^f but it doesn't matter because - // the next operation will SET the extra bit anyway - BnSetBit(bnX, f); - return TRUE; -} - -//*** C_2_2_MQV() -// This function performs the key exchange defined in SP800-56A -// 6.1.1.4 Full MQV, C(2, 2, ECC MQV). -// -// CAUTION: Implementation of this function may require use of essential claims in -// patents not owned by TCG members. -// -// Points 'QsB' and 'QeB' are required to be on the curve of 'inQsA'. The function -// will fail, possibly catastrophically, if this is not the case. -// Return Type: TPM_RC -// TPM_RC_NO_RESULT the value for dsA does not give a valid point on the -// curve -static TPM_RC -C_2_2_MQV( - TPMS_ECC_POINT *outZ, // OUT: the computed point - TPM_ECC_CURVE curveId, // IN: the curve for the computations - TPM2B_ECC_PARAMETER *dsA, // IN: static private TPM key - TPM2B_ECC_PARAMETER *deA, // IN: ephemeral private TPM key - TPMS_ECC_POINT *QsB, // IN: static public party B key - TPMS_ECC_POINT *QeB // IN: ephemeral public party B key - ) -{ - CURVE_INITIALIZED(E, curveId); - const ECC_CURVE_DATA *C; - POINT(pQeA); - POINT_INITIALIZED(pQeB, QeB); - POINT_INITIALIZED(pQsB, QsB); - ECC_NUM(bnTa); - ECC_INITIALIZED(bnDeA, deA); - ECC_INITIALIZED(bnDsA, dsA); - ECC_NUM(bnN); - ECC_NUM(bnXeB); - TPM_RC retVal; -// - // Parameter checks - if(E == NULL) - ERROR_RETURN(TPM_RC_VALUE); - pAssert(outZ != NULL && pQeB != NULL && pQsB != NULL && deA != NULL - && dsA != NULL); - C = AccessCurveData(E); -// Process: -// 1. implicitsigA = (de,A + avf(Qe,A)ds,A ) mod n. -// 2. P = h(implicitsigA)(Qe,B + avf(Qe,B)Qs,B). -// 3. If P = O, output an error indicator. -// 4. Z=xP, where xP is the x-coordinate of P. - - // Compute the public ephemeral key pQeA = [de,A]G - if((retVal = BnPointMult(pQeA, CurveGetG(C), bnDeA, NULL, NULL, E)) - != TPM_RC_SUCCESS) - goto Exit; - -// 1. implicitsigA = (de,A + avf(Qe,A)ds,A ) mod n. -// tA := (ds,A + de,A avf(Xe,A)) mod n (3) -// Compute 'tA' = ('deA' + 'dsA' avf('XeA')) mod n - // Ta = avf(XeA); - BnCopy(bnTa, pQeA->x); - avf1(bnTa, bnN); - // do Ta = ds,A * Ta mod n = dsA * avf(XeA) mod n - BnModMult(bnTa, bnDsA, bnTa, bnN); - // now Ta = deA + Ta mod n = deA + dsA * avf(XeA) mod n - BnAdd(bnTa, bnTa, bnDeA); - BnMod(bnTa, bnN); - -// 2. P = h(implicitsigA)(Qe,B + avf(Qe,B)Qs,B). -// Put this in because almost every case of h is == 1 so skip the call when - // not necessary. - if(!BnEqualWord(CurveGetCofactor(C), 1)) - // Cofactor is not 1 so compute Ta := Ta * h mod n - BnModMult(bnTa, bnTa, CurveGetCofactor(C), CurveGetOrder(C)); - - // Now that 'tA' is (h * 'tA' mod n) - // 'outZ' = (tA)(Qe,B + avf(Qe,B)Qs,B). - - // first, compute XeB = avf(XeB) - avf1(bnXeB, bnN); - - // QsB := [XeB]QsB - BnPointMult(pQsB, pQsB, bnXeB, NULL, NULL, E); - BnEccAdd(pQeB, pQeB, pQsB, E); - - // QeB := [tA]QeB = [tA](QsB + [Xe,B]QeB) and check for at infinity - // If the result is not the point at infinity, return QeB - BnPointMult(pQeB, pQeB, bnTa, NULL, NULL, E); - if(BnEqualZero(pQeB->z)) - ERROR_RETURN(TPM_RC_NO_RESULT); - // Convert BIGNUM E to TPM2B E - BnPointTo2B(outZ, pQeB, E); - -Exit: - CURVE_FREE(E); - return retVal; -} - -#endif // ALG_ECMQV - -//*** C_2_2_ECDH() -// This function performs the two phase key exchange defined in SP800-56A, -// 6.1.1.2 Full Unified Model, C(2, 2, ECC CDH). -// -static TPM_RC -C_2_2_ECDH( - TPMS_ECC_POINT *outZs, // OUT: Zs - TPMS_ECC_POINT *outZe, // OUT: Ze - TPM_ECC_CURVE curveId, // IN: the curve for the computations - TPM2B_ECC_PARAMETER *dsA, // IN: static private TPM key - TPM2B_ECC_PARAMETER *deA, // IN: ephemeral private TPM key - TPMS_ECC_POINT *QsB, // IN: static public party B key - TPMS_ECC_POINT *QeB // IN: ephemeral public party B key - ) -{ - CURVE_INITIALIZED(E, curveId); - ECC_INITIALIZED(bnAs, dsA); - ECC_INITIALIZED(bnAe, deA); - POINT_INITIALIZED(ecBs, QsB); - POINT_INITIALIZED(ecBe, QeB); - POINT(ecZ); - TPM_RC retVal; -// - // Parameter checks - if(E == NULL) - ERROR_RETURN(TPM_RC_CURVE); - pAssert(outZs != NULL && dsA != NULL && deA != NULL && QsB != NULL - && QeB != NULL); - - // Do the point multiply for the Zs value ([dsA]QsB) - retVal = BnPointMult(ecZ, ecBs, bnAs, NULL, NULL, E); - if(retVal == TPM_RC_SUCCESS) - { - // Convert the Zs value. - BnPointTo2B(outZs, ecZ, E); - // Do the point multiply for the Ze value ([deA]QeB) - retVal = BnPointMult(ecZ, ecBe, bnAe, NULL, NULL, E); - if(retVal == TPM_RC_SUCCESS) - BnPointTo2B(outZe, ecZ, E); - } -Exit: - CURVE_FREE(E); - return retVal; -} - -//*** CryptEcc2PhaseKeyExchange() -// This function is the dispatch routine for the EC key exchange functions that use -// two ephemeral and two static keys. -// Return Type: TPM_RC -// TPM_RC_SCHEME scheme is not defined -LIB_EXPORT TPM_RC -CryptEcc2PhaseKeyExchange( - TPMS_ECC_POINT *outZ1, // OUT: a computed point - TPMS_ECC_POINT *outZ2, // OUT: and optional second point - TPM_ECC_CURVE curveId, // IN: the curve for the computations - TPM_ALG_ID scheme, // IN: the key exchange scheme - TPM2B_ECC_PARAMETER *dsA, // IN: static private TPM key - TPM2B_ECC_PARAMETER *deA, // IN: ephemeral private TPM key - TPMS_ECC_POINT *QsB, // IN: static public party B key - TPMS_ECC_POINT *QeB // IN: ephemeral public party B key - ) -{ - pAssert(outZ1 != NULL - && dsA != NULL && deA != NULL - && QsB != NULL && QeB != NULL); - - // Initialize the output points so that they are empty until one of the - // functions decides otherwise - outZ1->x.b.size = 0; - outZ1->y.b.size = 0; - if(outZ2 != NULL) - { - outZ2->x.b.size = 0; - outZ2->y.b.size = 0; - } - switch(scheme) - { - case ALG_ECDH_VALUE: - return C_2_2_ECDH(outZ1, outZ2, curveId, dsA, deA, QsB, QeB); - break; -#if ALG_ECMQV - case ALG_ECMQV_VALUE: - return C_2_2_MQV(outZ1, curveId, dsA, deA, QsB, QeB); - break; -#endif -#if ALG_SM2 - case ALG_SM2_VALUE: - return SM2KeyExchange(outZ1, curveId, dsA, deA, QsB, QeB); - break; -#endif - default: - return TPM_RC_SCHEME; - } -} - -#if ALG_SM2 - -//*** ComputeWForSM2() -// Compute the value for w used by SM2 -static UINT32 -ComputeWForSM2( - bigCurve E - ) -{ - // w := ceil(ceil(log2(n)) / 2) - 1 - return (BnMsb(CurveGetOrder(AccessCurveData(E))) / 2 - 1); -} - -//*** avfSm2() -// This function does the associated value computation required by SM2 key -// exchange. This is different from the avf() in the international standards -// because it returns a value that is half the size of the value returned by the -// standard avf(). For example, if 'n' is 15, 'Ws' ('w' in the standard) is 2 but -// the 'W' here is 1. This means that an input value of 14 (1110b) would return a -// value of 110b with the standard but 10b with the scheme in SM2. -static bigNum -avfSm2( - bigNum bn, // IN/OUT: the reduced value - UINT32 w // IN: the value of w - ) -{ - // a) set w := ceil(ceil(log2(n)) / 2) - 1 - // b) set x' := 2^w + ( x & (2^w - 1)) - // This is just like the avf for MQV where x' = 2^w + (x mod 2^w) - - BnMaskBits(bn, w); // as with avf1, this is too big by a factor of 2 but - // it doesn't matter because we SET the extra bit - // anyway - BnSetBit(bn, w); - return bn; -} - -//*** SM2KeyExchange() -// This function performs the key exchange defined in SM2. -// The first step is to compute -// 'tA' = ('dsA' + 'deA' avf(Xe,A)) mod 'n' -// Then, compute the 'Z' value from -// 'outZ' = ('h' 'tA' mod 'n') ('QsA' + [avf('QeB.x')]('QeB')). -// The function will compute the ephemeral public key from the ephemeral -// private key. -// All points are required to be on the curve of 'inQsA'. The function will fail -// catastrophically if this is not the case -// Return Type: TPM_RC -// TPM_RC_NO_RESULT the value for dsA does not give a valid point on the -// curve -LIB_EXPORT TPM_RC -SM2KeyExchange( - TPMS_ECC_POINT *outZ, // OUT: the computed point - TPM_ECC_CURVE curveId, // IN: the curve for the computations - TPM2B_ECC_PARAMETER *dsAIn, // IN: static private TPM key - TPM2B_ECC_PARAMETER *deAIn, // IN: ephemeral private TPM key - TPMS_ECC_POINT *QsBIn, // IN: static public party B key - TPMS_ECC_POINT *QeBIn // IN: ephemeral public party B key - ) -{ - CURVE_INITIALIZED(E, curveId); - const ECC_CURVE_DATA *C; - ECC_INITIALIZED(dsA, dsAIn); - ECC_INITIALIZED(deA, deAIn); - POINT_INITIALIZED(QsB, QsBIn); - POINT_INITIALIZED(QeB, QeBIn); - BN_WORD_INITIALIZED(One, 1); - POINT(QeA); - ECC_NUM(XeB); - POINT(Z); - ECC_NUM(Ta); - UINT32 w; - TPM_RC retVal = TPM_RC_NO_RESULT; -// - // Parameter checks - if(E == NULL) - ERROR_RETURN(TPM_RC_CURVE); - C = AccessCurveData(E); - pAssert(outZ != NULL && dsA != NULL && deA != NULL && QsB != NULL - && QeB != NULL); - - // Compute the value for w - w = ComputeWForSM2(E); - - // Compute the public ephemeral key pQeA = [de,A]G - if(!BnEccModMult(QeA, CurveGetG(C), deA, E)) - goto Exit; - - // tA := (ds,A + de,A avf(Xe,A)) mod n (3) - // Compute 'tA' = ('dsA' + 'deA' avf('XeA')) mod n - // Ta = avf(XeA); - // do Ta = de,A * Ta = deA * avf(XeA) - BnMult(Ta, deA, avfSm2(QeA->x, w)); - // now Ta = dsA + Ta = dsA + deA * avf(XeA) - BnAdd(Ta, dsA, Ta); - BnMod(Ta, CurveGetOrder(C)); - - // outZ = [h tA mod n] (Qs,B + [avf(Xe,B)](Qe,B)) (4) - // Put this in because almost every case of h is == 1 so skip the call when - // not necessary. - if(!BnEqualWord(CurveGetCofactor(C), 1)) - // Cofactor is not 1 so compute Ta := Ta * h mod n - BnModMult(Ta, Ta, CurveGetCofactor(C), CurveGetOrder(C)); - // Now that 'tA' is (h * 'tA' mod n) - // 'outZ' = ['tA'](QsB + [avf(QeB.x)](QeB)). - BnCopy(XeB, QeB->x); - if(!BnEccModMult2(Z, QsB, One, QeB, avfSm2(XeB, w), E)) - goto Exit; - // QeB := [tA]QeB = [tA](QsB + [Xe,B]QeB) and check for at infinity - if(!BnEccModMult(Z, Z, Ta, E)) - goto Exit; - // Convert BIGNUM E to TPM2B E - BnPointTo2B(outZ, Z, E); - retVal = TPM_RC_SUCCESS; -Exit: - CURVE_FREE(E); - return retVal; -} -#endif - -#endif // CC_ZGen_2Phase \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccMain.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccMain.c deleted file mode 100644 index 79bebfa57..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccMain.c +++ /dev/null @@ -1,820 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes and Defines -#include "Tpm.h" - -#if ALG_ECC - -// This version requires that the new format for ECC data be used -#if !USE_BN_ECC_DATA -#error "Need to SET USE_BN_ECC_DATA to YES in Implementaion.h" -#endif - -//** Functions - -#if SIMULATION -void -EccSimulationEnd( - void - ) -{ -#if SIMULATION -// put things to be printed at the end of the simulation here -#endif -} -#endif // SIMULATION - -//*** CryptEccInit() -// This function is called at _TPM_Init -BOOL -CryptEccInit( - void - ) -{ - return TRUE; -} - -//*** CryptEccStartup() -// This function is called at TPM2_Startup(). -BOOL -CryptEccStartup( - void - ) -{ - return TRUE; -} - -//*** ClearPoint2B(generic) -// Initialize the size values of a TPMS_ECC_POINT structure. -void -ClearPoint2B( - TPMS_ECC_POINT *p // IN: the point - ) -{ - if(p != NULL) - { - p->x.t.size = 0; - p->y.t.size = 0; - } -} - -//*** CryptEccGetParametersByCurveId() -// This function returns a pointer to the curve data that is associated with -// the indicated curveId. -// If there is no curve with the indicated ID, the function returns NULL. This -// function is in this module so that it can be called by GetCurve data. -// Return Type: const ECC_CURVE_DATA -// NULL curve with the indicated TPM_ECC_CURVE is not implemented -// != NULL pointer to the curve data -LIB_EXPORT const ECC_CURVE * -CryptEccGetParametersByCurveId( - TPM_ECC_CURVE curveId // IN: the curveID - ) -{ - int i; - for(i = 0; i < ECC_CURVE_COUNT; i++) - { - if(eccCurves[i].curveId == curveId) - return &eccCurves[i]; - } - return NULL; -} - -//*** CryptEccGetKeySizeForCurve() -// This function returns the key size in bits of the indicated curve. -LIB_EXPORT UINT16 -CryptEccGetKeySizeForCurve( - TPM_ECC_CURVE curveId // IN: the curve - ) -{ - const ECC_CURVE *curve = CryptEccGetParametersByCurveId(curveId); - UINT16 keySizeInBits; -// - keySizeInBits = (curve != NULL) ? curve->keySizeBits : 0; - return keySizeInBits; -} - -//*** GetCurveData() -// This function returns the a pointer for the parameter data -// associated with a curve. -const ECC_CURVE_DATA * -GetCurveData( - TPM_ECC_CURVE curveId // IN: the curveID - ) -{ - const ECC_CURVE *curve = CryptEccGetParametersByCurveId(curveId); - return (curve != NULL) ? curve->curveData : NULL; -} - -//***CryptEccGetOID() -const BYTE * -CryptEccGetOID( - TPM_ECC_CURVE curveId -) -{ - const ECC_CURVE *curve = CryptEccGetParametersByCurveId(curveId); - return (curve != NULL) ? curve->OID : NULL; -} - -//*** CryptEccGetCurveByIndex() -// This function returns the number of the 'i'-th implemented curve. The normal -// use would be to call this function with 'i' starting at 0. When the 'i' is greater -// than or equal to the number of implemented curves, TPM_ECC_NONE is returned. -LIB_EXPORT TPM_ECC_CURVE -CryptEccGetCurveByIndex( - UINT16 i - ) -{ - if(i >= ECC_CURVE_COUNT) - return TPM_ECC_NONE; - return eccCurves[i].curveId; -} - -//*** CryptEccGetParameter() -// This function returns an ECC curve parameter. The parameter is -// selected by a single character designator from the set of ""PNABXYH"". -// Return Type: BOOL -// TRUE(1) curve exists and parameter returned -// FALSE(0) curve does not exist or parameter selector -LIB_EXPORT BOOL -CryptEccGetParameter( - TPM2B_ECC_PARAMETER *out, // OUT: place to put parameter - char p, // IN: the parameter selector - TPM_ECC_CURVE curveId // IN: the curve id - ) -{ - const ECC_CURVE_DATA *curve = GetCurveData(curveId); - bigConst parameter = NULL; - - if(curve != NULL) - { - switch(p) - { - case 'p': - parameter = CurveGetPrime(curve); - break; - case 'n': - parameter = CurveGetOrder(curve); - break; - case 'a': - parameter = CurveGet_a(curve); - break; - case 'b': - parameter = CurveGet_b(curve); - break; - case 'x': - parameter = CurveGetGx(curve); - break; - case 'y': - parameter = CurveGetGy(curve); - break; - case 'h': - parameter = CurveGetCofactor(curve); - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - } - // If not debugging and we get here with parameter still NULL, had better - // not try to convert so just return FALSE instead. - return (parameter != NULL) ? BnTo2B(parameter, &out->b, 0) : 0; -} - -//*** CryptCapGetECCCurve() -// This function returns the list of implemented ECC curves. -// Return Type: TPMI_YES_NO -// YES if no more ECC curve is available -// NO if there are more ECC curves not reported -TPMI_YES_NO -CryptCapGetECCCurve( - TPM_ECC_CURVE curveID, // IN: the starting ECC curve - UINT32 maxCount, // IN: count of returned curves - TPML_ECC_CURVE *curveList // OUT: ECC curve list - ) -{ - TPMI_YES_NO more = NO; - UINT16 i; - UINT32 count = ECC_CURVE_COUNT; - TPM_ECC_CURVE curve; - - // Initialize output property list - curveList->count = 0; - - // The maximum count of curves we may return is MAX_ECC_CURVES - if(maxCount > MAX_ECC_CURVES) maxCount = MAX_ECC_CURVES; - - // Scan the eccCurveValues array - for(i = 0; i < count; i++) - { - curve = CryptEccGetCurveByIndex(i); - // If curveID is less than the starting curveID, skip it - if(curve < curveID) - continue; - if(curveList->count < maxCount) - { - // If we have not filled up the return list, add more curves to - // it - curveList->eccCurves[curveList->count] = curve; - curveList->count++; - } - else - { - // If the return list is full but we still have curves - // available, report this and stop iterating - more = YES; - break; - } - } - return more; -} - -//*** CryptGetCurveSignScheme() -// This function will return a pointer to the scheme of the curve. -const TPMT_ECC_SCHEME * -CryptGetCurveSignScheme( - TPM_ECC_CURVE curveId // IN: The curve selector - ) -{ - const ECC_CURVE *curve = CryptEccGetParametersByCurveId(curveId); - - if(curve != NULL) - return &(curve->sign); - else - return NULL; -} - -//*** CryptGenerateR() -// This function computes the commit random value for a split signing scheme. -// -// If 'c' is NULL, it indicates that 'r' is being generated -// for TPM2_Commit. -// If 'c' is not NULL, the TPM will validate that the 'gr.commitArray' -// bit associated with the input value of 'c' is SET. If not, the TPM -// returns FALSE and no 'r' value is generated. -// Return Type: BOOL -// TRUE(1) r value computed -// FALSE(0) no r value computed -BOOL -CryptGenerateR( - TPM2B_ECC_PARAMETER *r, // OUT: the generated random value - UINT16 *c, // IN/OUT: count value. - TPMI_ECC_CURVE curveID, // IN: the curve for the value - TPM2B_NAME *name // IN: optional name of a key to - // associate with 'r' - ) -{ - // This holds the marshaled g_commitCounter. - TPM2B_TYPE(8B, 8); - TPM2B_8B cntr = {{8,{0}}}; - UINT32 iterations; - TPM2B_ECC_PARAMETER n; - UINT64 currentCount = gr.commitCounter; - UINT16 t1; -// - if(!CryptEccGetParameter(&n, 'n', curveID)) - return FALSE; - - // If this is the commit phase, use the current value of the commit counter - if(c != NULL) - { - // if the array bit is not set, can't use the value. - if(!TEST_BIT((*c & COMMIT_INDEX_MASK), gr.commitArray)) - return FALSE; - - // If it is the sign phase, figure out what the counter value was - // when the commitment was made. - // - // When gr.commitArray has less than 64K bits, the extra - // bits of 'c' are used as a check to make sure that the - // signing operation is not using an out of range count value - t1 = (UINT16)currentCount; - - // If the lower bits of c are greater or equal to the lower bits of t1 - // then the upper bits of t1 must be one more than the upper bits - // of c - if((*c & COMMIT_INDEX_MASK) >= (t1 & COMMIT_INDEX_MASK)) - // Since the counter is behind, reduce the current count - currentCount = currentCount - (COMMIT_INDEX_MASK + 1); - - t1 = (UINT16)currentCount; - if((t1 & ~COMMIT_INDEX_MASK) != (*c & ~COMMIT_INDEX_MASK)) - return FALSE; - // set the counter to the value that was - // present when the commitment was made - currentCount = (currentCount & 0xffffffffffff0000) | *c; - } - // Marshal the count value to a TPM2B buffer for the KDF - cntr.t.size = sizeof(currentCount); - UINT64_TO_BYTE_ARRAY(currentCount, cntr.t.buffer); - - // Now can do the KDF to create the random value for the signing operation - // During the creation process, we may generate an r that does not meet the - // requirements of the random value. - // want to generate a new r. - r->t.size = n.t.size; - - for(iterations = 1; iterations < 1000000;) - { - int i; - CryptKDFa(CONTEXT_INTEGRITY_HASH_ALG, &gr.commitNonce.b, COMMIT_STRING, - &name->b, &cntr.b, n.t.size * 8, r->t.buffer, &iterations, FALSE); - - // "random" value must be less than the prime - if(UnsignedCompareB(r->b.size, r->b.buffer, n.t.size, n.t.buffer) >= 0) - continue; - - // in this implementation it is required that at least bit - // in the upper half of the number be set - for(i = n.t.size / 2; i >= 0; i--) - if(r->b.buffer[i] != 0) - return TRUE; - } - return FALSE; -} - -//*** CryptCommit() -// This function is called when the count value is committed. The 'gr.commitArray' -// value associated with the current count value is SET and g_commitCounter is -// incremented. The low-order 16 bits of old value of the counter is returned. -UINT16 -CryptCommit( - void - ) -{ - UINT16 oldCount = (UINT16)gr.commitCounter; - gr.commitCounter++; - SET_BIT(oldCount & COMMIT_INDEX_MASK, gr.commitArray); - return oldCount; -} - -//*** CryptEndCommit() -// This function is called when the signing operation using the committed value -// is completed. It clears the gr.commitArray bit associated with the count -// value so that it can't be used again. -void -CryptEndCommit( - UINT16 c // IN: the counter value of the commitment - ) -{ - ClearBit((c & COMMIT_INDEX_MASK), gr.commitArray, sizeof(gr.commitArray)); -} - -//*** CryptEccGetParameters() -// This function returns the ECC parameter details of the given curve. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) unsupported ECC curve ID -BOOL -CryptEccGetParameters( - TPM_ECC_CURVE curveId, // IN: ECC curve ID - TPMS_ALGORITHM_DETAIL_ECC *parameters // OUT: ECC parameters - ) -{ - const ECC_CURVE *curve = CryptEccGetParametersByCurveId(curveId); - const ECC_CURVE_DATA *data; - BOOL found = curve != NULL; - - if(found) - { - data = curve->curveData; - parameters->curveID = curve->curveId; - parameters->keySize = curve->keySizeBits; - parameters->kdf = curve->kdf; - parameters->sign = curve->sign; -// BnTo2B(data->prime, ¶meters->p.b, 0); - BnTo2B(data->prime, ¶meters->p.b, parameters->p.t.size); - BnTo2B(data->a, ¶meters->a.b, 0); - BnTo2B(data->b, ¶meters->b.b, 0); - BnTo2B(data->base.x, ¶meters->gX.b, parameters->p.t.size); - BnTo2B(data->base.y, ¶meters->gY.b, parameters->p.t.size); -// BnTo2B(data->base.x, ¶meters->gX.b, 0); -// BnTo2B(data->base.y, ¶meters->gY.b, 0); - BnTo2B(data->order, ¶meters->n.b, 0); - BnTo2B(data->h, ¶meters->h.b, 0); - } - return found; -} - -//*** BnGetCurvePrime() -// This function is used to get just the prime modulus associated with a curve. -const bignum_t * -BnGetCurvePrime( - TPM_ECC_CURVE curveId - ) -{ - const ECC_CURVE_DATA *C = GetCurveData(curveId); - return (C != NULL) ? CurveGetPrime(C) : NULL; -} - -//*** BnGetCurveOrder() -// This function is used to get just the curve order -const bignum_t * -BnGetCurveOrder( - TPM_ECC_CURVE curveId - ) -{ - const ECC_CURVE_DATA *C = GetCurveData(curveId); - return (C != NULL) ? CurveGetOrder(C) : NULL; -} - -//*** BnIsOnCurve() -// This function checks if a point is on the curve. -BOOL -BnIsOnCurve( - pointConst Q, - const ECC_CURVE_DATA *C - ) -{ - BN_VAR(right, (MAX_ECC_KEY_BITS * 3)); - BN_VAR(left, (MAX_ECC_KEY_BITS * 2)); - bigConst prime = CurveGetPrime(C); -// - // Show that point is on the curve y^2 = x^3 + ax + b; - // Or y^2 = x(x^2 + a) + b - // y^2 - BnMult(left, Q->y, Q->y); - - BnMod(left, prime); -// x^2 - BnMult(right, Q->x, Q->x); - - // x^2 + a - BnAdd(right, right, CurveGet_a(C)); - -// BnMod(right, CurveGetPrime(C)); - // x(x^2 + a) - BnMult(right, right, Q->x); - - // x(x^2 + a) + b - BnAdd(right, right, CurveGet_b(C)); - - BnMod(right, prime); - if(BnUnsignedCmp(left, right) == 0) - return TRUE; - else - return FALSE; -} - -//*** BnIsValidPrivateEcc() -// Checks that 0 < 'x' < 'q' -BOOL -BnIsValidPrivateEcc( - bigConst x, // IN: private key to check - bigCurve E // IN: the curve to check - ) -{ - BOOL retVal; - retVal = (!BnEqualZero(x) - && (BnUnsignedCmp(x, CurveGetOrder(AccessCurveData(E))) < 0)); - return retVal; -} - -LIB_EXPORT BOOL -CryptEccIsValidPrivateKey( - TPM2B_ECC_PARAMETER *d, - TPM_ECC_CURVE curveId - ) -{ - BN_INITIALIZED(bnD, MAX_ECC_PARAMETER_BYTES * 8, d); - return !BnEqualZero(bnD) && (BnUnsignedCmp(bnD, BnGetCurveOrder(curveId)) < 0); -} - -//*** BnPointMul() -// This function does a point multiply of the form 'R' = ['d']'S' + ['u']'Q' where the -// parameters are bigNum values. If 'S' is NULL and d is not NULL, then it computes -// 'R' = ['d']'G' + ['u']'Q' or just 'R' = ['d']'G' if 'u' and 'Q' are NULL. -// If 'skipChecks' is TRUE, then the function will not verify that the inputs are -// correct for the domain. This would be the case when the values were created by the -// CryptoEngine code. -// It will return TPM_RC_NO_RESULT if the resulting point is the point at infinity. -// Return Type: TPM_RC -// TPM_RC_NO_RESULT result of multiplication is a point at infinity -// TPM_RC_ECC_POINT 'S' or 'Q' is not on the curve -// TPM_RC_VALUE 'd' or 'u' is not < n -TPM_RC -BnPointMult( - bigPoint R, // OUT: computed point - pointConst S, // IN: optional point to multiply by 'd' - bigConst d, // IN: scalar for [d]S or [d]G - pointConst Q, // IN: optional second point - bigConst u, // IN: optional second scalar - bigCurve E // IN: curve parameters - ) -{ - BOOL OK; -// - TEST(TPM_ALG_ECDH); - - // Need one scalar - OK = (d != NULL || u != NULL); - - // If S is present, then d has to be present. If S is not - // present, then d may or may not be present - OK = OK && (((S == NULL) == (d == NULL)) || (d != NULL)); - - // either both u and Q have to be provided or neither can be provided (don't - // know what to do if only one is provided. - OK = OK && ((u == NULL) == (Q == NULL)); - - OK = OK && (E != NULL); - if(!OK) - return TPM_RC_VALUE; - - - OK = (S == NULL) || BnIsOnCurve(S, AccessCurveData(E)); - OK = OK && ((Q == NULL) || BnIsOnCurve(Q, AccessCurveData(E))); - if(!OK) - return TPM_RC_ECC_POINT; - - if((d != NULL) && (S == NULL)) - S = CurveGetG(AccessCurveData(E)); - // If only one scalar, don't need Shamir's trick - if((d == NULL) || (u == NULL)) - { - if(d == NULL) - OK = BnEccModMult(R, Q, u, E); - else - OK = BnEccModMult(R, S, d, E); - } - else - { - OK = BnEccModMult2(R, S, d, Q, u, E); - } - return (OK ? TPM_RC_SUCCESS : TPM_RC_NO_RESULT); -} - -//***BnEccGetPrivate() -// This function gets random values that are the size of the key plus 64 bits. The -// value is reduced (mod ('q' - 1)) and incremented by 1 ('q' is the order of the -// curve. This produces a value ('d') such that 1 <= 'd' < 'q'. This is the method -// of FIPS 186-4 Section B.4.1 ""Key Pair Generation Using Extra Random Bits"". -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure generating private key -BOOL -BnEccGetPrivate( - bigNum dOut, // OUT: the qualified random value - const ECC_CURVE_DATA *C, // IN: curve for which the private key - // needs to be appropriate - RAND_STATE *rand // IN: state for DRBG - ) -{ - bigConst order = CurveGetOrder(C); - BOOL OK; - UINT32 orderBits = BnSizeInBits(order); - UINT32 orderBytes = BITS_TO_BYTES(orderBits); - BN_VAR(bnExtraBits, MAX_ECC_KEY_BITS + 64); - BN_VAR(nMinus1, MAX_ECC_KEY_BITS); -// - OK = BnGetRandomBits(bnExtraBits, (orderBytes * 8) + 64, rand); - OK = OK && BnSubWord(nMinus1, order, 1); - OK = OK && BnMod(bnExtraBits, nMinus1); - OK = OK && BnAddWord(dOut, bnExtraBits, 1); - return OK && !g_inFailureMode; -} - -//*** BnEccGenerateKeyPair() -// This function gets a private scalar from the source of random bits and does -// the point multiply to get the public key. -BOOL -BnEccGenerateKeyPair( - bigNum bnD, // OUT: private scalar - bn_point_t *ecQ, // OUT: public point - bigCurve E, // IN: curve for the point - RAND_STATE *rand // IN: DRBG state to use - ) -{ - BOOL OK = FALSE; - // Get a private scalar - OK = BnEccGetPrivate(bnD, AccessCurveData(E), rand); - - // Do a point multiply - OK = OK && BnEccModMult(ecQ, NULL, bnD, E); - if(!OK) - BnSetWord(ecQ->z, 0); - else - BnSetWord(ecQ->z, 1); - return OK; -} - -//***CryptEccNewKeyPair(***) -// This function creates an ephemeral ECC. It is ephemeral in that -// is expected that the private part of the key will be discarded -LIB_EXPORT TPM_RC -CryptEccNewKeyPair( - TPMS_ECC_POINT *Qout, // OUT: the public point - TPM2B_ECC_PARAMETER *dOut, // OUT: the private scalar - TPM_ECC_CURVE curveId // IN: the curve for the key - ) -{ - CURVE_INITIALIZED(E, curveId); - POINT(ecQ); - ECC_NUM(bnD); - BOOL OK; - - if(E == NULL) - return TPM_RC_CURVE; - - TEST(TPM_ALG_ECDH); - OK = BnEccGenerateKeyPair(bnD, ecQ, E, NULL); - if(OK) - { - BnPointTo2B(Qout, ecQ, E); - BnTo2B(bnD, &dOut->b, Qout->x.t.size); - } - else - { - Qout->x.t.size = Qout->y.t.size = dOut->t.size = 0; - } - CURVE_FREE(E); - return OK ? TPM_RC_SUCCESS : TPM_RC_NO_RESULT; -} - -//*** CryptEccPointMultiply() -// This function computes 'R' := ['dIn']'G' + ['uIn']'QIn'. Where 'dIn' and -// 'uIn' are scalars, 'G' and 'QIn' are points on the specified curve and 'G' is the -// default generator of the curve. -// -// The 'xOut' and 'yOut' parameters are optional and may be set to NULL if not -// used. -// -// It is not necessary to provide 'uIn' if 'QIn' is specified but one of 'uIn' and -// 'dIn' must be provided. If 'dIn' and 'QIn' are specified but 'uIn' is not -// provided, then 'R' = ['dIn']'QIn'. -// -// If the multiply produces the point at infinity, the TPM_RC_NO_RESULT is returned. -// -// The sizes of 'xOut' and yOut' will be set to be the size of the degree of -// the curve -// -// It is a fatal error if 'dIn' and 'uIn' are both unspecified (NULL) or if 'Qin' -// or 'Rout' is unspecified. -// -// Return Type: TPM_RC -// TPM_RC_ECC_POINT the point 'Pin' or 'Qin' is not on the curve -// TPM_RC_NO_RESULT the product point is at infinity -// TPM_RC_CURVE bad curve -// TPM_RC_VALUE 'dIn' or 'uIn' out of range -// -LIB_EXPORT TPM_RC -CryptEccPointMultiply( - TPMS_ECC_POINT *Rout, // OUT: the product point R - TPM_ECC_CURVE curveId, // IN: the curve to use - TPMS_ECC_POINT *Pin, // IN: first point (can be null) - TPM2B_ECC_PARAMETER *dIn, // IN: scalar value for [dIn]Qin - // the Pin - TPMS_ECC_POINT *Qin, // IN: point Q - TPM2B_ECC_PARAMETER *uIn // IN: scalar value for the multiplier - // of Q - ) -{ - CURVE_INITIALIZED(E, curveId); - POINT_INITIALIZED(ecP, Pin); - ECC_INITIALIZED(bnD, dIn); // If dIn is null, then bnD is null - ECC_INITIALIZED(bnU, uIn); - POINT_INITIALIZED(ecQ, Qin); - POINT(ecR); - TPM_RC retVal; -// - retVal = BnPointMult(ecR, ecP, bnD, ecQ, bnU, E); - - if(retVal == TPM_RC_SUCCESS) - BnPointTo2B(Rout, ecR, E); - else - ClearPoint2B(Rout); - CURVE_FREE(E); - return retVal; -} - -//*** CryptEccIsPointOnCurve() -// This function is used to test if a point is on a defined curve. It does this -// by checking that 'y'^2 mod 'p' = 'x'^3 + 'a'*'x' + 'b' mod 'p'. -// -// It is a fatal error if 'Q' is not specified (is NULL). -// Return Type: BOOL -// TRUE(1) point is on curve -// FALSE(0) point is not on curve or curve is not supported -LIB_EXPORT BOOL -CryptEccIsPointOnCurve( - TPM_ECC_CURVE curveId, // IN: the curve selector - TPMS_ECC_POINT *Qin // IN: the point. - ) -{ - const ECC_CURVE_DATA *C = GetCurveData(curveId); - POINT_INITIALIZED(ecQ, Qin); - BOOL OK; -// - pAssert(Qin != NULL); - OK = (C != NULL && (BnIsOnCurve(ecQ, C))); - return OK; -} - -//*** CryptEccGenerateKey() -// This function generates an ECC key pair based on the input parameters. -// This routine uses KDFa to produce candidate numbers. The method is according -// to FIPS 186-3, section B.1.2 "Key Pair Generation by Testing Candidates." -// According to the method in FIPS 186-3, the resulting private value 'd' should be -// 1 <= 'd' < 'n' where 'n' is the order of the base point. -// -// It is a fatal error if 'Qout', 'dOut', is not provided (is NULL). -// -// If the curve is not supported -// If 'seed' is not provided, then a random number will be used for the key -// Return Type: TPM_RC -// TPM_RC_CURVE curve is not supported -// TPM_RC_NO_RESULT could not verify key with signature (FIPS only) -LIB_EXPORT TPM_RC -CryptEccGenerateKey( - TPMT_PUBLIC *publicArea, // IN/OUT: The public area template for - // the new key. The public key - // area will be replaced computed - // ECC public key - TPMT_SENSITIVE *sensitive, // OUT: the sensitive area will be - // updated to contain the private - // ECC key and the symmetric - // encryption key - RAND_STATE *rand // IN: if not NULL, the deterministic - // RNG state - ) -{ - CURVE_INITIALIZED(E, publicArea->parameters.eccDetail.curveID); - ECC_NUM(bnD); - POINT(ecQ); - BOOL OK; - TPM_RC retVal; -// - TEST(TPM_ALG_ECDSA); // ECDSA is used to verify each key - - // Validate parameters - if(E == NULL) - ERROR_RETURN(TPM_RC_CURVE); - - publicArea->unique.ecc.x.t.size = 0; - publicArea->unique.ecc.y.t.size = 0; - sensitive->sensitive.ecc.t.size = 0; - - OK = BnEccGenerateKeyPair(bnD, ecQ, E, rand); - if(OK) - { - BnPointTo2B(&publicArea->unique.ecc, ecQ, E); - BnTo2B(bnD, &sensitive->sensitive.ecc.b, publicArea->unique.ecc.x.t.size); - } -#if FIPS_COMPLIANT - // See if PWCT is required - if(OK && IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign)) - { - ECC_NUM(bnT); - ECC_NUM(bnS); - TPM2B_DIGEST digest; -// - TEST(TPM_ALG_ECDSA); - digest.t.size = MIN(sensitive->sensitive.ecc.t.size, sizeof(digest.t.buffer)); - // Get a random value to sign using the built in DRBG state - DRBG_Generate(NULL, digest.t.buffer, digest.t.size); - if(g_inFailureMode) - return TPM_RC_FAILURE; - BnSignEcdsa(bnT, bnS, E, bnD, &digest, NULL); - // and make sure that we can validate the signature - OK = BnValidateSignatureEcdsa(bnT, bnS, E, ecQ, &digest) == TPM_RC_SUCCESS; - } -#endif - retVal = (OK) ? TPM_RC_SUCCESS : TPM_RC_NO_RESULT; -Exit: - CURVE_FREE(E); - return retVal; -} - -#endif // ALG_ECC \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccSignature.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccSignature.c deleted file mode 100644 index 42a198224..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptEccSignature.c +++ /dev/null @@ -1,931 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes and Defines -#include "Tpm.h" -#include "CryptEccSignature_fp.h" - -#if ALG_ECC - -//** Utility Functions - -//*** EcdsaDigest() -// Function to adjust the digest so that it is no larger than the order of the -// curve. This is used for ECDSA sign and verification. -static bigNum -EcdsaDigest( - bigNum bnD, // OUT: the adjusted digest - const TPM2B_DIGEST *digest, // IN: digest to adjust - bigConst max // IN: value that indicates the maximum - // number of bits in the results - ) -{ - int bitsInMax = BnSizeInBits(max); - int shift; -// - if(digest == NULL) - BnSetWord(bnD, 0); - else - { - BnFromBytes(bnD, digest->t.buffer, - (NUMBYTES)MIN(digest->t.size, BITS_TO_BYTES(bitsInMax))); - shift = BnSizeInBits(bnD) - bitsInMax; - if(shift > 0) - BnShiftRight(bnD, bnD, shift); - } - return bnD; -} - -//*** BnSchnorrSign() -// This contains the Schnorr signature computation. It is used by both ECDSA and -// Schnorr signing. The result is computed as: ['s' = 'k' + 'r' * 'd' (mod 'n')] -// where -// 1) 's' is the signature -// 2) 'k' is a random value -// 3) 'r' is the value to sign -// 4) 'd' is the private EC key -// 5) 'n' is the order of the curve -// Return Type: TPM_RC -// TPM_RC_NO_RESULT the result of the operation was zero or 'r' (mod 'n') -// is zero -static TPM_RC -BnSchnorrSign( - bigNum bnS, // OUT: 's' component of the signature - bigConst bnK, // IN: a random value - bigNum bnR, // IN: the signature 'r' value - bigConst bnD, // IN: the private key - bigConst bnN // IN: the order of the curve - ) -{ - // Need a local temp value to store the intermediate computation because product - // size can be larger than will fit in bnS. - BN_VAR(bnT1, MAX_ECC_PARAMETER_BYTES * 2 * 8); -// - // Reduce bnR without changing the input value - BnDiv(NULL, bnT1, bnR, bnN); - if(BnEqualZero(bnT1)) - return TPM_RC_NO_RESULT; - // compute s = (k + r * d)(mod n) - // r * d - BnMult(bnT1, bnT1, bnD); - // k * r * d - BnAdd(bnT1, bnT1, bnK); - // k + r * d (mod n) - BnDiv(NULL, bnS, bnT1, bnN); - return (BnEqualZero(bnS)) ? TPM_RC_NO_RESULT : TPM_RC_SUCCESS; -} - -//** Signing Functions - -//*** BnSignEcdsa() -// This function implements the ECDSA signing algorithm. The method is described -// in the comments below. -TPM_RC -BnSignEcdsa( - bigNum bnR, // OUT: 'r' component of the signature - bigNum bnS, // OUT: 's' component of the signature - bigCurve E, // IN: the curve used in the signature - // process - bigNum bnD, // IN: private signing key - const TPM2B_DIGEST *digest, // IN: the digest to sign - RAND_STATE *rand // IN: used in debug of signing - ) -{ - ECC_NUM(bnK); - ECC_NUM(bnIk); - BN_VAR(bnE, MAX(MAX_ECC_KEY_BYTES, MAX_DIGEST_SIZE) * 8); - POINT(ecR); - bigConst order = CurveGetOrder(AccessCurveData(E)); - TPM_RC retVal = TPM_RC_SUCCESS; - INT32 tries = 10; - BOOL OK = FALSE; -// - pAssert(digest != NULL); - // The algorithm as described in "Suite B Implementer's Guide to FIPS - // 186-3(ECDSA)" - // 1. Use one of the routines in Appendix A.2 to generate (k, k^-1), a - // per-message secret number and its inverse modulo n. Since n is prime, - // the output will be invalid only if there is a failure in the RBG. - // 2. Compute the elliptic curve point R = [k]G = (xR, yR) using EC scalar - // multiplication (see [Routines]), where G is the base point included in - // the set of domain parameters. - // 3. Compute r = xR mod n. If r = 0, then return to Step 1. 1. - // 4. Use the selected hash function to compute H = Hash(M). - // 5. Convert the bit string H to an integer e as described in Appendix B.2. - // 6. Compute s = (k^-1 * (e + d * r)) mod q. If s = 0, return to Step 1.2. - // 7. Return (r, s). - // In the code below, q is n (that it, the order of the curve is p) - - do // This implements the loop at step 6. If s is zero, start over. - { - for(; tries > 0; tries--) - { - // Step 1 and 2 -- generate an ephemeral key and the modular inverse - // of the private key. - if(!BnEccGenerateKeyPair(bnK, ecR, E, rand)) - continue; - // x coordinate is mod p. Make it mod q - BnMod(ecR->x, order); - // Make sure that it is not zero; - if(BnEqualZero(ecR->x)) - continue; - // write the modular reduced version of r as part of the signature - BnCopy(bnR, ecR->x); - // Make sure that a modular inverse exists and try again if not - OK = (BnModInverse(bnIk, bnK, order)); - if(OK) - break; - } - if(!OK) - goto Exit; - - EcdsaDigest(bnE, digest, order); - - // now have inverse of K (bnIk), e (bnE), r (bnR), d (bnD) and - // CurveGetOrder(E) - // Compute s = k^-1 (e + r*d)(mod q) - // first do s = r*d mod q - BnModMult(bnS, bnR, bnD, order); - // s = e + s = e + r * d - BnAdd(bnS, bnE, bnS); - // s = k^(-1)s (mod n) = k^(-1)(e + r * d)(mod n) - BnModMult(bnS, bnIk, bnS, order); - - // If S is zero, try again - } while(BnEqualZero(bnS)); -Exit: - return retVal; -} - -#if ALG_ECDAA - -//*** BnSignEcdaa() -// -// This function performs 's' = 'r' + 'T' * 'd' mod 'q' where -// 1) 'r is a random, or pseudo-random value created in the commit phase -// 2) 'nonceK' is a TPM-generated, random value 0 < 'nonceK' < 'n' -// 3) 'T' is mod 'q' of "Hash"('nonceK' || 'digest'), and -// 4) 'd' is a private key. -// -// The signature is the tuple ('nonceK', 's') -// -// Regrettably, the parameters in this function kind of collide with the parameter -// names used in ECSCHNORR making for a lot of confusion. -// Return Type: TPM_RC -// TPM_RC_SCHEME unsupported hash algorithm -// TPM_RC_NO_RESULT cannot get values from random number generator -static TPM_RC -BnSignEcdaa( - TPM2B_ECC_PARAMETER *nonceK, // OUT: 'nonce' component of the signature - bigNum bnS, // OUT: 's' component of the signature - bigCurve E, // IN: the curve used in signing - bigNum bnD, // IN: the private key - const TPM2B_DIGEST *digest, // IN: the value to sign (mod 'q') - TPMT_ECC_SCHEME *scheme, // IN: signing scheme (contains the - // commit count value). - OBJECT *eccKey, // IN: The signing key - RAND_STATE *rand // IN: a random number state - ) -{ - TPM_RC retVal; - TPM2B_ECC_PARAMETER r; - HASH_STATE state; - TPM2B_DIGEST T; - BN_MAX(bnT); -// - NOT_REFERENCED(rand); - if(!CryptGenerateR(&r, &scheme->details.ecdaa.count, - eccKey->publicArea.parameters.eccDetail.curveID, - &eccKey->name)) - retVal = TPM_RC_VALUE; - else - { - // This allocation is here because 'r' doesn't have a value until - // CrypGenerateR() is done. - ECC_INITIALIZED(bnR, &r); - do - { - // generate nonceK such that 0 < nonceK < n - // use bnT as a temp. - if(!BnEccGetPrivate(bnT, AccessCurveData(E), rand)) - { - retVal = TPM_RC_NO_RESULT; - break; - } - BnTo2B(bnT, &nonceK->b, 0); - - T.t.size = CryptHashStart(&state, scheme->details.ecdaa.hashAlg); - if(T.t.size == 0) - { - retVal = TPM_RC_SCHEME; - } - else - { - CryptDigestUpdate2B(&state, &nonceK->b); - CryptDigestUpdate2B(&state, &digest->b); - CryptHashEnd2B(&state, &T.b); - BnFrom2B(bnT, &T.b); - // Watch out for the name collisions in this call!! - retVal = BnSchnorrSign(bnS, bnR, bnT, bnD, - AccessCurveData(E)->order); - } - } while(retVal == TPM_RC_NO_RESULT); - // Because the rule is that internal state is not modified if the command - // fails, only end the commit if the command succeeds. - // NOTE that if the result of the Schnorr computation was zero - // it will probably not be worthwhile to run the same command again because - // the result will still be zero. This means that the Commit command will - // need to be run again to get a new commit value for the signature. - if(retVal == TPM_RC_SUCCESS) - CryptEndCommit(scheme->details.ecdaa.count); - } - return retVal; -} -#endif // ALG_ECDAA - -#if ALG_ECSCHNORR - -//*** SchnorrReduce() -// Function to reduce a hash result if it's magnitude is too large. The size of -// 'number' is set so that it has no more bytes of significance than 'reference' -// value. If the resulting number can have more bits of significance than -// 'reference'. -static void -SchnorrReduce( - TPM2B *number, // IN/OUT: Value to reduce - bigConst reference // IN: the reference value - ) -{ - UINT16 maxBytes = (UINT16)BITS_TO_BYTES(BnSizeInBits(reference)); - if(number->size > maxBytes) - number->size = maxBytes; -} - -//*** SchnorrEcc() -// This function is used to perform a modified Schnorr signature. -// -// This function will generate a random value 'k' and compute -// a) ('xR', 'yR') = ['k']'G' -// b) 'r' = "Hash"('xR' || 'P')(mod 'q') -// c) 'rT' = truncated 'r' -// d) 's'= 'k' + 'rT' * 'ds' (mod 'q') -// e) return the tuple 'rT', 's' -// -// Return Type: TPM_RC -// TPM_RC_NO_RESULT failure in the Schnorr sign process -// TPM_RC_SCHEME hashAlg can't produce zero-length digest -static TPM_RC -BnSignEcSchnorr( - bigNum bnR, // OUT: 'r' component of the signature - bigNum bnS, // OUT: 's' component of the signature - bigCurve E, // IN: the curve used in signing - bigNum bnD, // IN: the signing key - const TPM2B_DIGEST *digest, // IN: the digest to sign - TPM_ALG_ID hashAlg, // IN: signing scheme (contains a hash) - RAND_STATE *rand // IN: non-NULL when testing - ) -{ - HASH_STATE hashState; - UINT16 digestSize = CryptHashGetDigestSize(hashAlg); - TPM2B_TYPE(T, MAX(MAX_DIGEST_SIZE, MAX_ECC_KEY_BYTES)); - TPM2B_T T2b; - TPM2B *e = &T2b.b; - TPM_RC retVal = TPM_RC_NO_RESULT; - const ECC_CURVE_DATA *C; - bigConst order; - bigConst prime; - ECC_NUM(bnK); - POINT(ecR); -// - // Parameter checks - if(E == NULL) - ERROR_RETURN(TPM_RC_VALUE); - C = AccessCurveData(E); - order = CurveGetOrder(C); - prime = CurveGetOrder(C); - - // If the digest does not produce a hash, then null the signature and return - // a failure. - if(digestSize == 0) - { - BnSetWord(bnR, 0); - BnSetWord(bnS, 0); - ERROR_RETURN(TPM_RC_SCHEME); - } - do - { - // Generate a random key pair - if(!BnEccGenerateKeyPair(bnK, ecR, E, rand)) - break; - // Convert R.x to a string - BnTo2B(ecR->x, e, (NUMBYTES)BITS_TO_BYTES(BnSizeInBits(prime))); - - // f) compute r = Hash(e || P) (mod n) - CryptHashStart(&hashState, hashAlg); - CryptDigestUpdate2B(&hashState, e); - CryptDigestUpdate2B(&hashState, &digest->b); - e->size = CryptHashEnd(&hashState, digestSize, e->buffer); - // Reduce the hash size if it is larger than the curve order - SchnorrReduce(e, order); - // Convert hash to number - BnFrom2B(bnR, e); - // Do the Schnorr computation - retVal = BnSchnorrSign(bnS, bnK, bnR, bnD, CurveGetOrder(C)); - } while(retVal == TPM_RC_NO_RESULT); -Exit: - return retVal; -} - -#endif // ALG_ECSCHNORR - -#if ALG_SM2 -#ifdef _SM2_SIGN_DEBUG - -//*** BnHexEqual() -// This function compares a bignum value to a hex string. -// Return Type: BOOL -// TRUE(1) values equal -// FALSE(0) values not equal -static BOOL -BnHexEqual( - bigNum bn, //IN: big number value - const char *c //IN: character string number - ) -{ - ECC_NUM(bnC); - BnFromHex(bnC, c); - return (BnUnsignedCmp(bn, bnC) == 0); -} -#endif // _SM2_SIGN_DEBUG - -//*** BnSignEcSm2() -// This function signs a digest using the method defined in SM2 Part 2. The method -// in the standard will add a header to the message to be signed that is a hash of -// the values that define the key. This then hashed with the message to produce a -// digest ('e'). This function signs 'e'. -// Return Type: TPM_RC -// TPM_RC_VALUE bad curve -static TPM_RC -BnSignEcSm2( - bigNum bnR, // OUT: 'r' component of the signature - bigNum bnS, // OUT: 's' component of the signature - bigCurve E, // IN: the curve used in signing - bigNum bnD, // IN: the private key - const TPM2B_DIGEST *digest, // IN: the digest to sign - RAND_STATE *rand // IN: random number generator (mostly for - // debug) - ) -{ - BN_MAX_INITIALIZED(bnE, digest); // Don't know how big digest might be - ECC_NUM(bnN); - ECC_NUM(bnK); - ECC_NUM(bnT); // temp - POINT(Q1); - bigConst order = (E != NULL) - ? CurveGetOrder(AccessCurveData(E)) : NULL; -// -#ifdef _SM2_SIGN_DEBUG - BnFromHex(bnE, "B524F552CD82B8B028476E005C377FB1" - "9A87E6FC682D48BB5D42E3D9B9EFFE76"); - BnFromHex(bnD, "128B2FA8BD433C6C068C8D803DFF7979" - "2A519A55171B1B650C23661D15897263"); -#endif - // A3: Use random number generator to generate random number 1 <= k <= n-1; - // NOTE: Ax: numbers are from the SM2 standard -loop: - { - // Get a random number 0 < k < n - BnGenerateRandomInRange(bnK, order, rand); -#ifdef _SM2_SIGN_DEBUG - BnFromHex(bnK, "6CB28D99385C175C94F94E934817663F" - "C176D925DD72B727260DBAAE1FB2F96F"); -#endif - // A4: Figure out the point of elliptic curve (x1, y1)=[k]G, and according - // to details specified in 4.2.7 in Part 1 of this document, transform the - // data type of x1 into an integer; - if(!BnEccModMult(Q1, NULL, bnK, E)) - goto loop; - // A5: Figure out 'r' = ('e' + 'x1') mod 'n', - BnAdd(bnR, bnE, Q1->x); - BnMod(bnR, order); -#ifdef _SM2_SIGN_DEBUG - pAssert(BnHexEqual(bnR, "40F1EC59F793D9F49E09DCEF49130D41" - "94F79FB1EED2CAA55BACDB49C4E755D1")); -#endif - // if r=0 or r+k=n, return to A3; - if(BnEqualZero(bnR)) - goto loop; - BnAdd(bnT, bnK, bnR); - if(BnUnsignedCmp(bnT, bnN) == 0) - goto loop; - // A6: Figure out s = ((1 + dA)^-1 (k - r dA)) mod n, - // if s=0, return to A3; - // compute t = (1+dA)^-1 - BnAddWord(bnT, bnD, 1); - BnModInverse(bnT, bnT, order); -#ifdef _SM2_SIGN_DEBUG - pAssert(BnHexEqual(bnT, "79BFCF3052C80DA7B939E0C6914A18CB" - "B2D96D8555256E83122743A7D4F5F956")); -#endif - // compute s = t * (k - r * dA) mod n - BnModMult(bnS, bnR, bnD, order); - // k - r * dA mod n = k + n - ((r * dA) mod n) - BnSub(bnS, order, bnS); - BnAdd(bnS, bnK, bnS); - BnModMult(bnS, bnS, bnT, order); -#ifdef _SM2_SIGN_DEBUG - pAssert(BnHexEqual(bnS, "6FC6DAC32C5D5CF10C77DFB20F7C2EB6" - "67A457872FB09EC56327A67EC7DEEBE7")); -#endif - if(BnEqualZero(bnS)) - goto loop; - } - // A7: According to details specified in 4.2.1 in Part 1 of this document, - // transform the data type of r, s into bit strings, signature of message M - // is (r, s). - // This is handled by the common return code -#ifdef _SM2_SIGN_DEBUG - pAssert(BnHexEqual(bnR, "40F1EC59F793D9F49E09DCEF49130D41" - "94F79FB1EED2CAA55BACDB49C4E755D1")); - pAssert(BnHexEqual(bnS, "6FC6DAC32C5D5CF10C77DFB20F7C2EB6" - "67A457872FB09EC56327A67EC7DEEBE7")); -#endif - return TPM_RC_SUCCESS; -} -#endif // ALG_SM2 - -//*** CryptEccSign() -// This function is the dispatch function for the various ECC-based -// signing schemes. -// There is a bit of ugliness to the parameter passing. In order to test this, -// we sometime would like to use a deterministic RNG so that we can get the same -// signatures during testing. The easiest way to do this for most schemes is to -// pass in a deterministic RNG and let it return canned values during testing. -// There is a competing need for a canned parameter to use in ECDAA. To accommodate -// both needs with minimal fuss, a special type of RAND_STATE is defined to carry -// the address of the commit value. The setup and handling of this is not very -// different for the caller than what was in previous versions of the code. -// Return Type: TPM_RC -// TPM_RC_SCHEME 'scheme' is not supported -LIB_EXPORT TPM_RC -CryptEccSign( - TPMT_SIGNATURE *signature, // OUT: signature - OBJECT *signKey, // IN: ECC key to sign the hash - const TPM2B_DIGEST *digest, // IN: digest to sign - TPMT_ECC_SCHEME *scheme, // IN: signing scheme - RAND_STATE *rand - ) -{ - CURVE_INITIALIZED(E, signKey->publicArea.parameters.eccDetail.curveID); - ECC_INITIALIZED(bnD, &signKey->sensitive.sensitive.ecc.b); - ECC_NUM(bnR); - ECC_NUM(bnS); - const ECC_CURVE_DATA *C; - TPM_RC retVal = TPM_RC_SCHEME; -// - NOT_REFERENCED(scheme); - if(E == NULL) - ERROR_RETURN(TPM_RC_VALUE); - C = AccessCurveData(E); - signature->signature.ecdaa.signatureR.t.size - = sizeof(signature->signature.ecdaa.signatureR.t.buffer); - signature->signature.ecdaa.signatureS.t.size - = sizeof(signature->signature.ecdaa.signatureS.t.buffer); - TEST(signature->sigAlg); - switch(signature->sigAlg) - { - case ALG_ECDSA_VALUE: - retVal = BnSignEcdsa(bnR, bnS, E, bnD, digest, rand); - break; -#if ALG_ECDAA - case ALG_ECDAA_VALUE: - retVal = BnSignEcdaa(&signature->signature.ecdaa.signatureR, bnS, E, - bnD, digest, scheme, signKey, rand); - bnR = NULL; - break; -#endif -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: - retVal = BnSignEcSchnorr(bnR, bnS, E, bnD, digest, - signature->signature.ecschnorr.hash, - rand); - break; -#endif -#if ALG_SM2 - case ALG_SM2_VALUE: - retVal = BnSignEcSm2(bnR, bnS, E, bnD, digest, rand); - break; -#endif - default: - break; - } - // If signature generation worked, convert the results. - if(retVal == TPM_RC_SUCCESS) - { - NUMBYTES orderBytes = - (NUMBYTES)BITS_TO_BYTES(BnSizeInBits(CurveGetOrder(C))); - if(bnR != NULL) - BnTo2B(bnR, &signature->signature.ecdaa.signatureR.b, orderBytes); - if(bnS != NULL) - BnTo2B(bnS, &signature->signature.ecdaa.signatureS.b, orderBytes); - } -Exit: - CURVE_FREE(E); - return retVal; -} - -//********************* Signature Validation ******************** - -#if ALG_ECDSA - -//*** BnValidateSignatureEcdsa() -// This function validates an ECDSA signature. rIn and sIn should have been checked -// to make sure that they are in the range 0 < 'v' < 'n' -// Return Type: TPM_RC -// TPM_RC_SIGNATURE signature not valid -TPM_RC -BnValidateSignatureEcdsa( - bigNum bnR, // IN: 'r' component of the signature - bigNum bnS, // IN: 's' component of the signature - bigCurve E, // IN: the curve used in the signature - // process - bn_point_t *ecQ, // IN: the public point of the key - const TPM2B_DIGEST *digest // IN: the digest that was signed - ) -{ - // Make sure that the allocation for the digest is big enough for a maximum - // digest - BN_VAR(bnE, MAX(MAX_ECC_KEY_BYTES, MAX_DIGEST_SIZE) * 8); - POINT(ecR); - ECC_NUM(bnU1); - ECC_NUM(bnU2); - ECC_NUM(bnW); - bigConst order = CurveGetOrder(AccessCurveData(E)); - TPM_RC retVal = TPM_RC_SIGNATURE; -// - // Get adjusted digest - EcdsaDigest(bnE, digest, order); - // 1. If r and s are not both integers in the interval [1, n - 1], output - // INVALID. - // bnR and bnS were validated by the caller - // 2. Use the selected hash function to compute H0 = Hash(M0). - // This is an input parameter - // 3. Convert the bit string H0 to an integer e as described in Appendix B.2. - // Done at entry - // 4. Compute w = (s')^-1 mod n, using the routine in Appendix B.1. - if(!BnModInverse(bnW, bnS, order)) - goto Exit; - // 5. Compute u1 = (e' * w) mod n, and compute u2 = (r' * w) mod n. - BnModMult(bnU1, bnE, bnW, order); - BnModMult(bnU2, bnR, bnW, order); - // 6. Compute the elliptic curve point R = (xR, yR) = u1G+u2Q, using EC - // scalar multiplication and EC addition (see [Routines]). If R is equal to - // the point at infinity O, output INVALID. - if(BnPointMult(ecR, CurveGetG(AccessCurveData(E)), bnU1, ecQ, bnU2, E) - != TPM_RC_SUCCESS) - goto Exit; - // 7. Compute v = Rx mod n. - BnMod(ecR->x, order); - // 8. Compare v and r0. If v = r0, output VALID; otherwise, output INVALID - if(BnUnsignedCmp(ecR->x, bnR) != 0) - goto Exit; - - retVal = TPM_RC_SUCCESS; -Exit: - return retVal; -} - -#endif // ALG_ECDSA - -#if ALG_SM2 - -//*** BnValidateSignatureEcSm2() -// This function is used to validate an SM2 signature. -// Return Type: TPM_RC -// TPM_RC_SIGNATURE signature not valid -static TPM_RC -BnValidateSignatureEcSm2( - bigNum bnR, // IN: 'r' component of the signature - bigNum bnS, // IN: 's' component of the signature - bigCurve E, // IN: the curve used in the signature - // process - bigPoint ecQ, // IN: the public point of the key - const TPM2B_DIGEST *digest // IN: the digest that was signed - ) -{ - POINT(P); - ECC_NUM(bnRp); - ECC_NUM(bnT); - BN_MAX_INITIALIZED(bnE, digest); - BOOL OK; - bigConst order = CurveGetOrder(AccessCurveData(E)); - -#ifdef _SM2_SIGN_DEBUG - // Make sure that the input signature is the test signature - pAssert(BnHexEqual(bnR, - "40F1EC59F793D9F49E09DCEF49130D41" - "94F79FB1EED2CAA55BACDB49C4E755D1")); - pAssert(BnHexEqual(bnS, - "6FC6DAC32C5D5CF10C77DFB20F7C2EB6" - "67A457872FB09EC56327A67EC7DEEBE7")); -#endif - // b) compute t := (r + s) mod n - BnAdd(bnT, bnR, bnS); - BnMod(bnT, order); -#ifdef _SM2_SIGN_DEBUG - pAssert(BnHexEqual(bnT, - "2B75F07ED7ECE7CCC1C8986B991F441A" - "D324D6D619FE06DD63ED32E0C997C801")); -#endif - // c) verify that t > 0 - OK = !BnEqualZero(bnT); - if(!OK) - // set T to a value that should allow rest of the computations to run - // without trouble - BnCopy(bnT, bnS); - // d) compute (x, y) := [s]G + [t]Q - OK = BnEccModMult2(P, NULL, bnS, ecQ, bnT, E); -#ifdef _SM2_SIGN_DEBUG - pAssert(OK && BnHexEqual(P->x, - "110FCDA57615705D5E7B9324AC4B856D" - "23E6D9188B2AE47759514657CE25D112")); -#endif - // e) compute r' := (e + x) mod n (the x coordinate is in bnT) - OK = OK && BnAdd(bnRp, bnE, P->x); - OK = OK && BnMod(bnRp, order); - - // f) verify that r' = r - OK = OK && (BnUnsignedCmp(bnR, bnRp) == 0); - - if(!OK) - return TPM_RC_SIGNATURE; - else - return TPM_RC_SUCCESS; -} - -#endif // ALG_SM2 - -#if ALG_ECSCHNORR - -//*** BnValidateSignatureEcSchnorr() -// This function is used to validate an EC Schnorr signature. -// Return Type: TPM_RC -// TPM_RC_SIGNATURE signature not valid -static TPM_RC -BnValidateSignatureEcSchnorr( - bigNum bnR, // IN: 'r' component of the signature - bigNum bnS, // IN: 's' component of the signature - TPM_ALG_ID hashAlg, // IN: hash algorithm of the signature - bigCurve E, // IN: the curve used in the signature - // process - bigPoint ecQ, // IN: the public point of the key - const TPM2B_DIGEST *digest // IN: the digest that was signed - ) -{ - BN_MAX(bnRn); - POINT(ecE); - BN_MAX(bnEx); - const ECC_CURVE_DATA *C = AccessCurveData(E); - bigConst order = CurveGetOrder(C); - UINT16 digestSize = CryptHashGetDigestSize(hashAlg); - HASH_STATE hashState; - TPM2B_TYPE(BUFFER, MAX(MAX_ECC_PARAMETER_BYTES, MAX_DIGEST_SIZE)); - TPM2B_BUFFER Ex2 = {{sizeof(Ex2.t.buffer),{ 0 }}}; - BOOL OK; -// - // E = [s]G - [r]Q - BnMod(bnR, order); - // Make -r = n - r - BnSub(bnRn, order, bnR); - // E = [s]G + [-r]Q - OK = BnPointMult(ecE, CurveGetG(C), bnS, ecQ, bnRn, E) == TPM_RC_SUCCESS; -// // reduce the x portion of E mod q -// OK = OK && BnMod(ecE->x, order); - // Convert to byte string - OK = OK && BnTo2B(ecE->x, &Ex2.b, - (NUMBYTES)(BITS_TO_BYTES(BnSizeInBits(order)))); - if(OK) - { -// Ex = h(pE.x || digest) - CryptHashStart(&hashState, hashAlg); - CryptDigestUpdate(&hashState, Ex2.t.size, Ex2.t.buffer); - CryptDigestUpdate(&hashState, digest->t.size, digest->t.buffer); - Ex2.t.size = CryptHashEnd(&hashState, digestSize, Ex2.t.buffer); - SchnorrReduce(&Ex2.b, order); - BnFrom2B(bnEx, &Ex2.b); - // see if Ex matches R - OK = BnUnsignedCmp(bnEx, bnR) == 0; - } - return (OK) ? TPM_RC_SUCCESS : TPM_RC_SIGNATURE; -} -#endif // ALG_ECSCHNORR - -//*** CryptEccValidateSignature() -// This function validates an EcDsa or EcSchnorr signature. -// The point 'Qin' needs to have been validated to be on the curve of 'curveId'. -// Return Type: TPM_RC -// TPM_RC_SIGNATURE not a valid signature -LIB_EXPORT TPM_RC -CryptEccValidateSignature( - TPMT_SIGNATURE *signature, // IN: signature to be verified - OBJECT *signKey, // IN: ECC key signed the hash - const TPM2B_DIGEST *digest // IN: digest that was signed - ) -{ - CURVE_INITIALIZED(E, signKey->publicArea.parameters.eccDetail.curveID); - ECC_NUM(bnR); - ECC_NUM(bnS); - POINT_INITIALIZED(ecQ, &signKey->publicArea.unique.ecc); - bigConst order; - TPM_RC retVal; - - if(E == NULL) - ERROR_RETURN(TPM_RC_VALUE); - - order = CurveGetOrder(AccessCurveData(E)); - -// // Make sure that the scheme is valid - switch(signature->sigAlg) - { - case ALG_ECDSA_VALUE: -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: -#endif -#if ALG_SM2 - case ALG_SM2_VALUE: -#endif - break; - default: - ERROR_RETURN(TPM_RC_SCHEME); - break; - } - // Can convert r and s after determining that the scheme is an ECC scheme. If - // this conversion doesn't work, it means that the unmarshaling code for - // an ECC signature is broken. - BnFrom2B(bnR, &signature->signature.ecdsa.signatureR.b); - BnFrom2B(bnS, &signature->signature.ecdsa.signatureS.b); - - // r and s have to be greater than 0 but less than the curve order - if(BnEqualZero(bnR) || BnEqualZero(bnS)) - ERROR_RETURN(TPM_RC_SIGNATURE); - if((BnUnsignedCmp(bnS, order) >= 0) - || (BnUnsignedCmp(bnR, order) >= 0)) - ERROR_RETURN(TPM_RC_SIGNATURE); - - switch(signature->sigAlg) - { - case ALG_ECDSA_VALUE: - retVal = BnValidateSignatureEcdsa(bnR, bnS, E, ecQ, digest); - break; - -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: - retVal = BnValidateSignatureEcSchnorr(bnR, bnS, - signature->signature.any.hashAlg, - E, ecQ, digest); - break; -#endif -#if ALG_SM2 - case ALG_SM2_VALUE: - retVal = BnValidateSignatureEcSm2(bnR, bnS, E, ecQ, digest); - break; -#endif - default: - FAIL(FATAL_ERROR_INTERNAL); - } -Exit: - CURVE_FREE(E); - return retVal; -} - -//***CryptEccCommitCompute() -// This function performs the point multiply operations required by TPM2_Commit. -// -// If 'B' or 'M' is provided, they must be on the curve defined by 'curveId'. This -// routine does not check that they are on the curve and results are unpredictable -// if they are not. -// -// It is a fatal error if 'r' is NULL. If 'B' is not NULL, then it is a -// fatal error if 'd' is NULL or if 'K' and 'L' are both NULL. -// If 'M' is not NULL, then it is a fatal error if 'E' is NULL. -// -// Return Type: TPM_RC -// TPM_RC_NO_RESULT if 'K', 'L' or 'E' was computed to be the point -// at infinity -// TPM_RC_CANCELED a cancel indication was asserted during this -// function -LIB_EXPORT TPM_RC -CryptEccCommitCompute( - TPMS_ECC_POINT *K, // OUT: [d]B or [r]Q - TPMS_ECC_POINT *L, // OUT: [r]B - TPMS_ECC_POINT *E, // OUT: [r]M - TPM_ECC_CURVE curveId, // IN: the curve for the computations - TPMS_ECC_POINT *M, // IN: M (optional) - TPMS_ECC_POINT *B, // IN: B (optional) - TPM2B_ECC_PARAMETER *d, // IN: d (optional) - TPM2B_ECC_PARAMETER *r // IN: the computed r value (required) - ) -{ - CURVE_INITIALIZED(curve, curveId); // Normally initialize E as the curve, but - // E means something else in this function - ECC_INITIALIZED(bnR, r); - TPM_RC retVal = TPM_RC_SUCCESS; -// - // Validate that the required parameters are provided. - // Note: E has to be provided if computing E := [r]Q or E := [r]M. Will do - // E := [r]Q if both M and B are NULL. - pAssert(r != NULL && E != NULL); - - // Initialize the output points in case they are not computed - ClearPoint2B(K); - ClearPoint2B(L); - ClearPoint2B(E); - - // Sizes of the r parameter may not be zero - pAssert(r->t.size > 0); - - // If B is provided, compute K=[d]B and L=[r]B - if(B != NULL) - { - ECC_INITIALIZED(bnD, d); - POINT_INITIALIZED(pB, B); - POINT(pK); - POINT(pL); -// - pAssert(d != NULL && K != NULL && L != NULL); - - if(!BnIsOnCurve(pB, AccessCurveData(curve))) - ERROR_RETURN(TPM_RC_VALUE); - // do the math for K = [d]B - if((retVal = BnPointMult(pK, pB, bnD, NULL, NULL, curve)) != TPM_RC_SUCCESS) - goto Exit; - // Convert BN K to TPM2B K - BnPointTo2B(K, pK, curve); - // compute L= [r]B after checking for cancel - if(_plat__IsCanceled()) - ERROR_RETURN(TPM_RC_CANCELED); - // compute L = [r]B - if(!BnIsValidPrivateEcc(bnR, curve)) - ERROR_RETURN(TPM_RC_VALUE); - if((retVal = BnPointMult(pL, pB, bnR, NULL, NULL, curve)) != TPM_RC_SUCCESS) - goto Exit; - // Convert BN L to TPM2B L - BnPointTo2B(L, pL, curve); - } - if((M != NULL) || (B == NULL)) - { - POINT_INITIALIZED(pM, M); - POINT(pE); -// - // Make sure that a place was provided for the result - pAssert(E != NULL); - - // if this is the third point multiply, check for cancel first - if((B != NULL) && _plat__IsCanceled()) - ERROR_RETURN(TPM_RC_CANCELED); - - // If M provided, then pM will not be NULL and will compute E = [r]M. - // However, if M was not provided, then pM will be NULL and E = [r]G - // will be computed - if((retVal = BnPointMult(pE, pM, bnR, NULL, NULL, curve)) != TPM_RC_SUCCESS) - goto Exit; - // Convert E to 2B format - BnPointTo2B(E, pE, curve); - } -Exit: - CURVE_FREE(curve); - return retVal; -} - -#endif // ALG_ECC \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptHash.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptHash.c deleted file mode 100644 index 3f6ac63a2..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptHash.c +++ /dev/null @@ -1,938 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// -// This file contains implementation of cryptographic functions for hashing. -// -//** Includes, Defines, and Types - -#define _CRYPT_HASH_C_ -#include "Tpm.h" -#include "CryptHash_fp.h" -#include "CryptHash.h" -#include "OIDs.h" - -#define HASH_TABLE_SIZE (HASH_COUNT + 1) - - -#if ALG_SHA1 -HASH_DEF_TEMPLATE(SHA1, Sha1); -#endif -#if ALG_SHA256 -HASH_DEF_TEMPLATE(SHA256, Sha256); -#endif -#if ALG_SHA384 -HASH_DEF_TEMPLATE(SHA384, Sha384); -#endif -#if ALG_SHA512 -HASH_DEF_TEMPLATE(SHA512, Sha512); -#endif -#if ALG_SM3_256 -HASH_DEF_TEMPLATE(SM3_256, Sm3_256); -#endif -HASH_DEF NULL_Def = {{0}}; - -PHASH_DEF HashDefArray[] = { -#if ALG_SHA1 - &Sha1_Def, -#endif -#if ALG_SHA256 - &Sha256_Def, -#endif -#if ALG_SHA384 - &Sha384_Def, -#endif -#if ALG_SHA512 - &Sha512_Def, -#endif -#if ALG_SM3_256 - &Sm3_256_Def, -#endif - &NULL_Def -}; - - -//** Obligatory Initialization Functions - -//*** CryptHashInit() -// This function is called by _TPM_Init do perform the initialization operations for -// the library. -BOOL -CryptHashInit( - void - ) -{ - LibHashInit(); - return TRUE; -} - -//*** CryptHashStartup() -// This function is called by TPM2_Startup(). It checks that the size of the -// HashDefArray is consistent with the HASH_COUNT. -BOOL -CryptHashStartup( - void - ) -{ - int i = sizeof(HashDefArray) / sizeof(PHASH_DEF) - 1; - return (i == HASH_COUNT); -} - -//** Hash Information Access Functions -//*** Introduction -// These functions provide access to the hash algorithm description information. - -//*** CryptGetHashDef() -// This function accesses the hash descriptor associated with a hash a -// algorithm. The function returns a pointer to a 'null' descriptor if hashAlg is -// TPM_ALG_NULL or not a defined algorithm. -PHASH_DEF -CryptGetHashDef( - TPM_ALG_ID hashAlg - ) -{ - size_t i; -#define HASHES (sizeof(HashDefArray) / sizeof(PHASH_DEF)) - for(i = 0; i < HASHES; i++) - { - PHASH_DEF p = HashDefArray[i]; - if(p->hashAlg == hashAlg) - return p; - } - return &NULL_Def; -} - -//*** CryptHashIsValidAlg() -// This function tests to see if an algorithm ID is a valid hash algorithm. If -// flag is true, then TPM_ALG_NULL is a valid hash. -// Return Type: BOOL -// TRUE(1) hashAlg is a valid, implemented hash on this TPM -// FALSE(0) hashAlg is not valid for this TPM -BOOL -CryptHashIsValidAlg( - TPM_ALG_ID hashAlg, // IN: the algorithm to check - BOOL flag // IN: TRUE if TPM_ALG_NULL is to be treated - // as a valid hash - ) -{ - if(hashAlg == TPM_ALG_NULL) - return flag; - return CryptGetHashDef(hashAlg) != &NULL_Def; -} - -//*** CryptHashGetAlgByIndex() -// This function is used to iterate through the hashes. TPM_ALG_NULL -// is returned for all indexes that are not valid hashes. -// If the TPM implements 3 hashes, then an 'index' value of 0 will -// return the first implemented hash and an 'index' of 2 will return the -// last. All other index values will return TPM_ALG_NULL. -// -// Return Type: TPM_ALG_ID -// TPM_ALG_xxx a hash algorithm -// TPM_ALG_NULL this can be used as a stop value -LIB_EXPORT TPM_ALG_ID -CryptHashGetAlgByIndex( - UINT32 index // IN: the index - ) -{ - TPM_ALG_ID hashAlg; - if(index >= HASH_COUNT) - hashAlg = TPM_ALG_NULL; - else - hashAlg = HashDefArray[index]->hashAlg; - return hashAlg; -} - -//*** CryptHashGetDigestSize() -// Returns the size of the digest produced by the hash. If 'hashAlg' is not a hash -// algorithm, the TPM will FAIL. -// Return Type: UINT16 -// 0 TPM_ALG_NULL -// > 0 the digest size -// -LIB_EXPORT UINT16 -CryptHashGetDigestSize( - TPM_ALG_ID hashAlg // IN: hash algorithm to look up - ) -{ - return CryptGetHashDef(hashAlg)->digestSize; -} - -//*** CryptHashGetBlockSize() -// Returns the size of the block used by the hash. If 'hashAlg' is not a hash -// algorithm, the TPM will FAIL. -// Return Type: UINT16 -// 0 TPM_ALG_NULL -// > 0 the digest size -// -LIB_EXPORT UINT16 -CryptHashGetBlockSize( - TPM_ALG_ID hashAlg // IN: hash algorithm to look up - ) -{ - return CryptGetHashDef(hashAlg)->blockSize; -} - -//*** CryptHashGetOid() -// This function returns a pointer to DER=encoded OID for a hash algorithm. All OIDs -// are full OID values including the Tag (0x06) and length byte. -LIB_EXPORT const BYTE * -CryptHashGetOid( - TPM_ALG_ID hashAlg -) -{ - return CryptGetHashDef(hashAlg)->OID; -} - -//*** CryptHashGetContextAlg() -// This function returns the hash algorithm associated with a hash context. -TPM_ALG_ID -CryptHashGetContextAlg( - PHASH_STATE state // IN: the context to check - ) -{ - return state->hashAlg; -} - -//** State Import and Export - -//*** CryptHashCopyState -// This function is used to clone a HASH_STATE. -LIB_EXPORT void -CryptHashCopyState( - HASH_STATE *out, // OUT: destination of the state - const HASH_STATE *in // IN: source of the state - ) -{ - pAssert(out->type == in->type); - out->hashAlg = in->hashAlg; - out->def = in->def; - if(in->hashAlg != TPM_ALG_NULL) - { - HASH_STATE_COPY(out, in); - } - if(in->type == HASH_STATE_HMAC) - { - const HMAC_STATE *hIn = (HMAC_STATE *)in; - HMAC_STATE *hOut = (HMAC_STATE *)out; - hOut->hmacKey = hIn->hmacKey; - } - return; -} - -//*** CryptHashExportState() -// This function is used to export a hash or HMAC hash state. This function -// would be called when preparing to context save a sequence object. -void -CryptHashExportState( - PCHASH_STATE internalFmt, // IN: the hash state formatted for use by - // library - PEXPORT_HASH_STATE externalFmt // OUT: the exported hash state - ) -{ - BYTE *outBuf = (BYTE *)externalFmt; -// - cAssert(sizeof(HASH_STATE) <= sizeof(EXPORT_HASH_STATE)); - // the following #define is used to move data from an aligned internal data - // structure to a byte buffer (external format data. -#define CopyToOffset(value) \ - memcpy(&outBuf[offsetof(HASH_STATE,value)], &internalFmt->value, \ - sizeof(internalFmt->value)) - // Copy the hashAlg - CopyToOffset(hashAlg); - CopyToOffset(type); -#ifdef HASH_STATE_SMAC - if(internalFmt->type == HASH_STATE_SMAC) - { - memcpy(outBuf, internalFmt, sizeof(HASH_STATE)); - return; - - } -#endif - if(internalFmt->type == HASH_STATE_HMAC) - { - HMAC_STATE *from = (HMAC_STATE *)internalFmt; - memcpy(&outBuf[offsetof(HMAC_STATE, hmacKey)], &from->hmacKey, - sizeof(from->hmacKey)); - } - if(internalFmt->hashAlg != TPM_ALG_NULL) - HASH_STATE_EXPORT(externalFmt, internalFmt); -} - -//*** CryptHashImportState() -// This function is used to import the hash state. This function -// would be called to import a hash state when the context of a sequence object -// was being loaded. -void -CryptHashImportState( - PHASH_STATE internalFmt, // OUT: the hash state formatted for use by - // the library - PCEXPORT_HASH_STATE externalFmt // IN: the exported hash state - ) -{ - BYTE *inBuf = (BYTE *)externalFmt; -// -#define CopyFromOffset(value) \ - memcpy(&internalFmt->value, &inBuf[offsetof(HASH_STATE,value)], \ - sizeof(internalFmt->value)) - - // Copy the hashAlg of the byte-aligned input structure to the structure-aligned - // internal structure. - CopyFromOffset(hashAlg); - CopyFromOffset(type); - if(internalFmt->hashAlg != TPM_ALG_NULL) - { -#ifdef HASH_STATE_SMAC - if(internalFmt->type == HASH_STATE_SMAC) - { - memcpy(internalFmt, inBuf, sizeof(HASH_STATE)); - return; - } -#endif - internalFmt->def = CryptGetHashDef(internalFmt->hashAlg); - HASH_STATE_IMPORT(internalFmt, inBuf); - if(internalFmt->type == HASH_STATE_HMAC) - { - HMAC_STATE *to = (HMAC_STATE *)internalFmt; - memcpy(&to->hmacKey, &inBuf[offsetof(HMAC_STATE, hmacKey)], - sizeof(to->hmacKey)); - } - } -} - -//** State Modification Functions - -//***HashEnd() -// Local function to complete a hash that uses the hashDef instead of an algorithm -// ID. This function is used to complete the hash and only return a partial digest. -// The return value is the size of the data copied. -static UINT16 -HashEnd( - PHASH_STATE hashState, // IN: the hash state - UINT32 dOutSize, // IN: the size of receive buffer - PBYTE dOut // OUT: the receive buffer - ) -{ - BYTE temp[MAX_DIGEST_SIZE]; - if((hashState->hashAlg == TPM_ALG_NULL) - || (hashState->type != HASH_STATE_HASH)) - dOutSize = 0; - if(dOutSize > 0) - { - hashState->def = CryptGetHashDef(hashState->hashAlg); - // Set the final size - dOutSize = MIN(dOutSize, hashState->def->digestSize); - // Complete into the temp buffer and then copy - HASH_END(hashState, temp); - // Don't want any other functions calling the HASH_END method - // directly. -#undef HASH_END - memcpy(dOut, &temp, dOutSize); - } - hashState->type = HASH_STATE_EMPTY; - return (UINT16)dOutSize; -} - -//*** CryptHashStart() -// Functions starts a hash stack -// Start a hash stack and returns the digest size. As a side effect, the -// value of 'stateSize' in hashState is updated to indicate the number of bytes -// of state that were saved. This function calls GetHashServer() and that function -// will put the TPM into failure mode if the hash algorithm is not supported. -// -// This function does not use the sequence parameter. If it is necessary to import -// or export context, this will start the sequence in a local state -// and export the state to the input buffer. Will need to add a flag to the state -// structure to indicate that it needs to be imported before it can be used. -// (BLEH). -// Return Type: UINT16 -// 0 hash is TPM_ALG_NULL -// >0 digest size -LIB_EXPORT UINT16 -CryptHashStart( - PHASH_STATE hashState, // OUT: the running hash state - TPM_ALG_ID hashAlg // IN: hash algorithm - ) -{ - UINT16 retVal; - - TEST(hashAlg); - - hashState->hashAlg = hashAlg; - if(hashAlg == TPM_ALG_NULL) - { - retVal = 0; - } - else - { - hashState->def = CryptGetHashDef(hashAlg); - HASH_START(hashState); - retVal = hashState->def->digestSize; - } -#undef HASH_START - hashState->type = HASH_STATE_HASH; - return retVal; -} - -//*** CryptDigestUpdate() -// Add data to a hash or HMAC, SMAC stack. -// -void -CryptDigestUpdate( - PHASH_STATE hashState, // IN: the hash context information - UINT32 dataSize, // IN: the size of data to be added - const BYTE *data // IN: data to be hashed - ) -{ - if(hashState->hashAlg != TPM_ALG_NULL) - { - if((hashState->type == HASH_STATE_HASH) - || (hashState->type == HASH_STATE_HMAC)) - HASH_DATA(hashState, dataSize, (BYTE *)data); -#if SMAC_IMPLEMENTED - else if(hashState->type == HASH_STATE_SMAC) - (hashState->state.smac.smacMethods.data)(&hashState->state.smac.state, - dataSize, data); -#endif // SMAC_IMPLEMENTED - else - FAIL(FATAL_ERROR_INTERNAL); - } - return; -} - -//*** CryptHashEnd() -// Complete a hash or HMAC computation. This function will place the smaller of -// 'digestSize' or the size of the digest in 'dOut'. The number of bytes in the -// placed in the buffer is returned. If there is a failure, the returned value -// is <= 0. -// Return Type: UINT16 -// 0 no data returned -// > 0 the number of bytes in the digest or dOutSize, whichever is smaller -LIB_EXPORT UINT16 -CryptHashEnd( - PHASH_STATE hashState, // IN: the state of hash stack - UINT32 dOutSize, // IN: size of digest buffer - BYTE *dOut // OUT: hash digest - ) -{ - pAssert(hashState->type == HASH_STATE_HASH); - return HashEnd(hashState, dOutSize, dOut); -} - -//*** CryptHashBlock() -// Start a hash, hash a single block, update 'digest' and return the size of -// the results. -// -// The 'digestSize' parameter can be smaller than the digest. If so, only the more -// significant bytes are returned. -// Return Type: UINT16 -// >= 0 number of bytes placed in 'dOut' -LIB_EXPORT UINT16 -CryptHashBlock( - TPM_ALG_ID hashAlg, // IN: The hash algorithm - UINT32 dataSize, // IN: size of buffer to hash - const BYTE *data, // IN: the buffer to hash - UINT32 dOutSize, // IN: size of the digest buffer - BYTE *dOut // OUT: digest buffer - ) -{ - HASH_STATE state; - CryptHashStart(&state, hashAlg); - CryptDigestUpdate(&state, dataSize, data); - return HashEnd(&state, dOutSize, dOut); -} - -//*** CryptDigestUpdate2B() -// This function updates a digest (hash or HMAC) with a TPM2B. -// -// This function can be used for both HMAC and hash functions so the -// 'digestState' is void so that either state type can be passed. -LIB_EXPORT void -CryptDigestUpdate2B( - PHASH_STATE state, // IN: the digest state - const TPM2B *bIn // IN: 2B containing the data - ) -{ - // Only compute the digest if a pointer to the 2B is provided. - // In CryptDigestUpdate(), if size is zero or buffer is NULL, then no change - // to the digest occurs. This function should not provide a buffer if bIn is - // not provided. - pAssert(bIn != NULL); - CryptDigestUpdate(state, bIn->size, bIn->buffer); - return; -} - -//*** CryptHashEnd2B() -// This function is the same as CryptCompleteHash() but the digest is -// placed in a TPM2B. This is the most common use and this is provided -// for specification clarity. 'digest.size' should be set to indicate the number of -// bytes to place in the buffer -// Return Type: UINT16 -// >=0 the number of bytes placed in 'digest.buffer' -LIB_EXPORT UINT16 -CryptHashEnd2B( - PHASH_STATE state, // IN: the hash state - P2B digest // IN: the size of the buffer Out: requested - // number of bytes - ) -{ - return CryptHashEnd(state, digest->size, digest->buffer); -} - -//*** CryptDigestUpdateInt() -// This function is used to include an integer value to a hash stack. The function -// marshals the integer into its canonical form before calling CryptDigestUpdate(). -LIB_EXPORT void -CryptDigestUpdateInt( - void *state, // IN: the state of hash stack - UINT32 intSize, // IN: the size of 'intValue' in bytes - UINT64 intValue // IN: integer value to be hashed - ) -{ -#if LITTLE_ENDIAN_TPM - intValue = REVERSE_ENDIAN_64(intValue); -#endif - CryptDigestUpdate(state, intSize, &((BYTE *)&intValue)[8 - intSize]); -} - -//** HMAC Functions - -//*** CryptHmacStart() -// This function is used to start an HMAC using a temp -// hash context. The function does the initialization -// of the hash with the HMAC key XOR iPad and updates the -// HMAC key XOR oPad. -// -// The function returns the number of bytes in a digest produced by 'hashAlg'. -// Return Type: UINT16 -// >= 0 number of bytes in digest produced by 'hashAlg' (may be zero) -// -LIB_EXPORT UINT16 -CryptHmacStart( - PHMAC_STATE state, // IN/OUT: the state buffer - TPM_ALG_ID hashAlg, // IN: the algorithm to use - UINT16 keySize, // IN: the size of the HMAC key - const BYTE *key // IN: the HMAC key - ) -{ - PHASH_DEF hashDef; - BYTE * pb; - UINT32 i; -// - hashDef = CryptGetHashDef(hashAlg); - if(hashDef->digestSize != 0) - { - // If the HMAC key is larger than the hash block size, it has to be reduced - // to fit. The reduction is a digest of the hashKey. - if(keySize > hashDef->blockSize) - { - // if the key is too big, reduce it to a digest of itself - state->hmacKey.t.size = CryptHashBlock(hashAlg, keySize, key, - hashDef->digestSize, - state->hmacKey.t.buffer); - } - else - { - memcpy(state->hmacKey.t.buffer, key, keySize); - state->hmacKey.t.size = keySize; - } - // XOR the key with iPad (0x36) - pb = state->hmacKey.t.buffer; - for(i = state->hmacKey.t.size; i > 0; i--) - *pb++ ^= 0x36; - - // if the keySize is smaller than a block, fill the rest with 0x36 - for(i = hashDef->blockSize - state->hmacKey.t.size; i > 0; i--) - *pb++ = 0x36; - - // Increase the oPadSize to a full block - state->hmacKey.t.size = hashDef->blockSize; - - // Start a new hash with the HMAC key - // This will go in the caller's state structure and may be a sequence or not - CryptHashStart((PHASH_STATE)state, hashAlg); - CryptDigestUpdate((PHASH_STATE)state, state->hmacKey.t.size, - state->hmacKey.t.buffer); - // XOR the key block with 0x5c ^ 0x36 - for(pb = state->hmacKey.t.buffer, i = hashDef->blockSize; i > 0; i--) - *pb++ ^= (0x5c ^ 0x36); - } - // Set the hash algorithm - state->hashState.hashAlg = hashAlg; - // Set the hash state type - state->hashState.type = HASH_STATE_HMAC; - - return hashDef->digestSize; -} - -//*** CryptHmacEnd() -// This function is called to complete an HMAC. It will finish the current -// digest, and start a new digest. It will then add the oPadKey and the -// completed digest and return the results in dOut. It will not return more -// than dOutSize bytes. -// Return Type: UINT16 -// >= 0 number of bytes in 'dOut' (may be zero) -LIB_EXPORT UINT16 -CryptHmacEnd( - PHMAC_STATE state, // IN: the hash state buffer - UINT32 dOutSize, // IN: size of digest buffer - BYTE *dOut // OUT: hash digest - ) -{ - BYTE temp[MAX_DIGEST_SIZE]; - PHASH_STATE hState = (PHASH_STATE)&state->hashState; - -#if SMAC_IMPLEMENTED - if(hState->type == HASH_STATE_SMAC) - return (state->hashState.state.smac.smacMethods.end) - (&state->hashState.state.smac.state, - dOutSize, - dOut); -#endif - pAssert(hState->type == HASH_STATE_HMAC); - hState->def = CryptGetHashDef(hState->hashAlg); - // Change the state type for completion processing - hState->type = HASH_STATE_HASH; - if(hState->hashAlg == TPM_ALG_NULL) - dOutSize = 0; - else - { - - // Complete the current hash - HashEnd(hState, hState->def->digestSize, temp); - // Do another hash starting with the oPad - CryptHashStart(hState, hState->hashAlg); - CryptDigestUpdate(hState, state->hmacKey.t.size, state->hmacKey.t.buffer); - CryptDigestUpdate(hState, hState->def->digestSize, temp); - } - return HashEnd(hState, dOutSize, dOut); -} - -//*** CryptHmacStart2B() -// This function starts an HMAC and returns the size of the digest -// that will be produced. -// -// This function is provided to support the most common use of starting an HMAC -// with a TPM2B key. -// -// The caller must provide a block of memory in which the hash sequence state -// is kept. The caller should not alter the contents of this buffer until the -// hash sequence is completed or abandoned. -// -// Return Type: UINT16 -// > 0 the digest size of the algorithm -// = 0 the hashAlg was TPM_ALG_NULL -LIB_EXPORT UINT16 -CryptHmacStart2B( - PHMAC_STATE hmacState, // OUT: the state of HMAC stack. It will be used - // in HMAC update and completion - TPMI_ALG_HASH hashAlg, // IN: hash algorithm - P2B key // IN: HMAC key - ) -{ - return CryptHmacStart(hmacState, hashAlg, key->size, key->buffer); -} - -//*** CryptHmacEnd2B() -// This function is the same as CryptHmacEnd() but the HMAC result -// is returned in a TPM2B which is the most common use. -// Return Type: UINT16 -// >=0 the number of bytes placed in 'digest' -LIB_EXPORT UINT16 -CryptHmacEnd2B( - PHMAC_STATE hmacState, // IN: the state of HMAC stack - P2B digest // OUT: HMAC - ) -{ - return CryptHmacEnd(hmacState, digest->size, digest->buffer); -} - -//** Mask and Key Generation Functions -//*** CryptMGF1() -// This function performs MGF1 using the selected hash. MGF1 is -// T(n) = T(n-1) || H(seed || counter). -// This function returns the length of the mask produced which -// could be zero if the digest algorithm is not supported -// Return Type: UINT16 -// 0 hash algorithm was TPM_ALG_NULL -// > 0 should be the same as 'mSize' -LIB_EXPORT UINT16 -CryptMGF1( - UINT32 mSize, // IN: length of the mask to be produced - BYTE *mask, // OUT: buffer to receive the mask - TPM_ALG_ID hashAlg, // IN: hash to use - UINT32 seedSize, // IN: size of the seed - BYTE *seed // IN: seed size - ) -{ - HASH_STATE hashState; - PHASH_DEF hDef = CryptGetHashDef(hashAlg); - UINT32 remaining; - UINT32 counter = 0; - BYTE swappedCounter[4]; - - // If there is no digest to compute return - if((hashAlg == TPM_ALG_NULL) || (mSize == 0)) - return 0; - - for(remaining = mSize; ; remaining -= hDef->digestSize) - { - // Because the system may be either Endian... - UINT32_TO_BYTE_ARRAY(counter, swappedCounter); - - // Start the hash and include the seed and counter - CryptHashStart(&hashState, hashAlg); - CryptDigestUpdate(&hashState, seedSize, seed); - CryptDigestUpdate(&hashState, 4, swappedCounter); - - // Handling the completion depends on how much space remains in the mask - // buffer. If it can hold the entire digest, put it there. If not - // put the digest in a temp buffer and only copy the amount that - // will fit into the mask buffer. - HashEnd(&hashState, remaining, mask); - if(remaining <= hDef->digestSize) - break; - mask = &mask[hDef->digestSize]; - counter++; - } - return (UINT16)mSize; -} - -//*** CryptKDFa() -// This function performs the key generation according to Part 1 of the -// TPM specification. -// -// This function returns the number of bytes generated which may be zero. -// -// The 'key' and 'keyStream' pointers are not allowed to be NULL. The other -// pointer values may be NULL. The value of 'sizeInBits' must be no larger -// than (2^18)-1 = 256K bits (32385 bytes). -// -// The 'once' parameter is set to allow incremental generation of a large -// value. If this flag is TRUE, 'sizeInBits' will be used in the HMAC computation -// but only one iteration of the KDF is performed. This would be used for -// XOR obfuscation so that the mask value can be generated in digest-sized -// chunks rather than having to be generated all at once in an arbitrarily -// large buffer and then XORed into the result. If 'once' is TRUE, then -// 'sizeInBits' must be a multiple of 8. -// -// Any error in the processing of this command is considered fatal. -// Return Type: UINT16 -// 0 hash algorithm is not supported or is TPM_ALG_NULL -// > 0 the number of bytes in the 'keyStream' buffer -LIB_EXPORT UINT16 -CryptKDFa( - TPM_ALG_ID hashAlg, // IN: hash algorithm used in HMAC - const TPM2B *key, // IN: HMAC key - const TPM2B *label, // IN: a label for the KDF - const TPM2B *contextU, // IN: context U - const TPM2B *contextV, // IN: context V - UINT32 sizeInBits, // IN: size of generated key in bits - BYTE *keyStream, // OUT: key buffer - UINT32 *counterInOut, // IN/OUT: caller may provide the iteration - // counter for incremental operations to - // avoid large intermediate buffers. - UINT16 blocks // IN: If non-zero, this is the maximum number - // of blocks to be returned, regardless - // of sizeInBits - ) -{ - UINT32 counter = 0; // counter value - INT16 bytes; // number of bytes to produce - UINT16 generated; // number of bytes generated - BYTE *stream = keyStream; - HMAC_STATE hState; - UINT16 digestSize = CryptHashGetDigestSize(hashAlg); - - pAssert(key != NULL && keyStream != NULL); - - TEST(TPM_ALG_KDF1_SP800_108); - - if(digestSize == 0) - return 0; - - if(counterInOut != NULL) - counter = *counterInOut; - - // If the size of the request is larger than the numbers will handle, - // it is a fatal error. - pAssert(((sizeInBits + 7) / 8) <= INT16_MAX); - - // The number of bytes to be generated is the smaller of the sizeInBits bytes or - // the number of requested blocks. The number of blocks is the smaller of the - // number requested or the number allowed by sizeInBits. A partial block is - // a full block. - bytes = (blocks > 0) ? blocks * digestSize : (UINT16)BITS_TO_BYTES(sizeInBits); - generated = bytes; - - // Generate required bytes - for(; bytes > 0; bytes -= digestSize) - { - counter++; - // Start HMAC - if(CryptHmacStart(&hState, hashAlg, key->size, key->buffer) == 0) - return 0; - // Adding counter - CryptDigestUpdateInt(&hState.hashState, 4, counter); - - // Adding label - if(label != NULL) - HASH_DATA(&hState.hashState, label->size, (BYTE *)label->buffer); - // Add a null. SP108 is not very clear about when the 0 is needed but to - // make this like the previous version that did not add an 0x00 after - // a null-terminated string, this version will only add a null byte - // if the label parameter did not end in a null byte, or if no label - // is present. - if((label == NULL) - || (label->size == 0) - || (label->buffer[label->size - 1] != 0)) - CryptDigestUpdateInt(&hState.hashState, 1, 0); - // Adding contextU - if(contextU != NULL) - HASH_DATA(&hState.hashState, contextU->size, contextU->buffer); - // Adding contextV - if(contextV != NULL) - HASH_DATA(&hState.hashState, contextV->size, contextV->buffer); - // Adding size in bits - CryptDigestUpdateInt(&hState.hashState, 4, sizeInBits); - - // Complete and put the data in the buffer - CryptHmacEnd(&hState, bytes, stream); - stream = &stream[digestSize]; - } - // Masking in the KDF is disabled. If the calling function wants something - // less than even number of bytes, then the caller should do the masking - // because there is no universal way to do it here - if(counterInOut != NULL) - *counterInOut = counter; - return generated; -} - -//*** CryptKDFe() -// This function implements KDFe() as defined in TPM specification part 1. -// -// This function returns the number of bytes generated which may be zero. -// -// The 'Z' and 'keyStream' pointers are not allowed to be NULL. The other -// pointer values may be NULL. The value of 'sizeInBits' must be no larger -// than (2^18)-1 = 256K bits (32385 bytes). -// Any error in the processing of this command is considered fatal. -// Return Type: UINT16 -// 0 hash algorithm is not supported or is TPM_ALG_NULL -// > 0 the number of bytes in the 'keyStream' buffer -// -LIB_EXPORT UINT16 -CryptKDFe( - TPM_ALG_ID hashAlg, // IN: hash algorithm used in HMAC - TPM2B *Z, // IN: Z - const TPM2B *label, // IN: a label value for the KDF - TPM2B *partyUInfo, // IN: PartyUInfo - TPM2B *partyVInfo, // IN: PartyVInfo - UINT32 sizeInBits, // IN: size of generated key in bits - BYTE *keyStream // OUT: key buffer - ) -{ - HASH_STATE hashState; - PHASH_DEF hashDef = CryptGetHashDef(hashAlg); - - UINT32 counter = 0; // counter value - UINT16 hLen; - BYTE *stream = keyStream; - INT16 bytes; // number of bytes to generate - - pAssert(keyStream != NULL && Z != NULL && ((sizeInBits + 7) / 8) < INT16_MAX); -// - hLen = hashDef->digestSize; - bytes = (INT16)((sizeInBits + 7) / 8); - if(hashAlg == TPM_ALG_NULL || bytes == 0) - return 0; - - // Generate required bytes - //The inner loop of that KDF uses: - // Hash[i] := H(counter | Z | OtherInfo) (5) - // Where: - // Hash[i] the hash generated on the i-th iteration of the loop. - // H() an approved hash function - // counter a 32-bit counter that is initialized to 1 and incremented - // on each iteration - // Z the X coordinate of the product of a public ECC key and a - // different private ECC key. - // OtherInfo a collection of qualifying data for the KDF defined below. - // In this specification, OtherInfo will be constructed by: - // OtherInfo := Use | PartyUInfo | PartyVInfo - for(; bytes > 0; stream = &stream[hLen], bytes = bytes - hLen) - { - if(bytes < hLen) - hLen = bytes; - counter++; - // Do the hash - CryptHashStart(&hashState, hashAlg); - // Add counter - CryptDigestUpdateInt(&hashState, 4, counter); - - // Add Z - if(Z != NULL) - CryptDigestUpdate2B(&hashState, Z); - // Add label - if(label != NULL) - CryptDigestUpdate2B(&hashState, label); - // Add a null. SP108 is not very clear about when the 0 is needed but to - // make this like the previous version that did not add an 0x00 after - // a null-terminated string, this version will only add a null byte - // if the label parameter did not end in a null byte, or if no label - // is present. - if((label == NULL) - || (label->size == 0) - || (label->buffer[label->size - 1] != 0)) - CryptDigestUpdateInt(&hashState, 1, 0); - // Add PartyUInfo - if(partyUInfo != NULL) - CryptDigestUpdate2B(&hashState, partyUInfo); - - // Add PartyVInfo - if(partyVInfo != NULL) - CryptDigestUpdate2B(&hashState, partyVInfo); - - // Compute Hash. hLen was changed to be the smaller of bytes or hLen - // at the start of each iteration. - CryptHashEnd(&hashState, hLen, stream); - } - - // Mask off bits if the required bits is not a multiple of byte size - if((sizeInBits % 8) != 0) - keyStream[0] &= ((1 << (sizeInBits % 8)) - 1); - - return (UINT16)((sizeInBits + 7) / 8); -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptPrime.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptPrime.c deleted file mode 100644 index 14af46216..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptPrime.c +++ /dev/null @@ -1,385 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the code for prime validation. - -#include "Tpm.h" -#include "CryptPrime_fp.h" - -//#define CPRI_PRIME -//#include "PrimeTable.h" - -#include "CryptPrimeSieve_fp.h" - -extern const uint32_t s_LastPrimeInTable; -extern const uint32_t s_PrimeTableSize; -extern const uint32_t s_PrimesInTable; -extern const unsigned char s_PrimeTable[]; -extern bigConst s_CompositeOfSmallPrimes; - -//** Functions - -//*** Root2() -// This finds ceil(sqrt(n)) to use as a stopping point for searching the prime -// table. -static uint32_t -Root2( - uint32_t n - ) -{ - int32_t last = (int32_t)(n >> 2); - int32_t next = (int32_t)(n >> 1); - int32_t diff; - int32_t stop = 10; -// - // get a starting point - for(; next != 0; last >>= 1, next >>= 2); - last++; - do - { - next = (last + (n / last)) >> 1; - diff = next - last; - last = next; - if(stop-- == 0) - FAIL(FATAL_ERROR_INTERNAL); - } while(diff < -1 || diff > 1); - if((n / next) > (unsigned)next) - next++; - pAssert(next != 0); - pAssert(((n / next) <= (unsigned)next) && (n / (next + 1) < (unsigned)next)); - return next; -} - -//*** IsPrimeInt() -// This will do a test of a word of up to 32-bits in size. -BOOL -IsPrimeInt( - uint32_t n - ) -{ - uint32_t i; - uint32_t stop; - if(n < 3 || ((n & 1) == 0)) - return (n == 2); - if(n <= s_LastPrimeInTable) - { - n >>= 1; - return ((s_PrimeTable[n >> 3] >> (n & 7)) & 1); - } - // Need to search - stop = Root2(n) >> 1; - // starting at 1 is equivalent to staring at (1 << 1) + 1 = 3 - for(i = 1; i < stop; i++) - { - if((s_PrimeTable[i >> 3] >> (i & 7)) & 1) - // see if this prime evenly divides the number - if((n % ((i << 1) + 1)) == 0) - return FALSE; - } - return TRUE; -} - -//*** BnIsProbablyPrime() -// This function is used when the key sieve is not implemented. This function -// Will try to eliminate some of the obvious things before going on -// to perform MillerRabin as a final verification of primeness. -BOOL -BnIsProbablyPrime( - bigNum prime, // IN: - RAND_STATE *rand // IN: the random state just - // in case Miller-Rabin is required - ) -{ -#if RADIX_BITS > 32 - if(BnUnsignedCmpWord(prime, UINT32_MAX) <= 0) -#else - if(BnGetSize(prime) == 1) -#endif - return IsPrimeInt((uint32_t)prime->d[0]); - - if(BnIsEven(prime)) - return FALSE; - if(BnUnsignedCmpWord(prime, s_LastPrimeInTable) <= 0) - { - crypt_uword_t temp = prime->d[0] >> 1; - return ((s_PrimeTable[temp >> 3] >> (temp & 7)) & 1); - } - { - BN_VAR(n, LARGEST_NUMBER_BITS); - BnGcd(n, prime, s_CompositeOfSmallPrimes); - if(!BnEqualWord(n, 1)) - return FALSE; - } - return MillerRabin(prime, rand); -} - -//*** MillerRabinRounds() -// Function returns the number of Miller-Rabin rounds necessary to give an -// error probability equal to the security strength of the prime. These values -// are from FIPS 186-3. -UINT32 -MillerRabinRounds( - UINT32 bits // IN: Number of bits in the RSA prime - ) -{ - if(bits < 511) return 8; // don't really expect this - if(bits < 1536) return 5; // for 512 and 1K primes - return 4; // for 3K public modulus and greater -} - -//*** MillerRabin() -// This function performs a Miller-Rabin test from FIPS 186-3. It does -// 'iterations' trials on the number. In all likelihood, if the number -// is not prime, the first test fails. -// Return Type: BOOL -// TRUE(1) probably prime -// FALSE(0) composite -BOOL -MillerRabin( - bigNum bnW, - RAND_STATE *rand - ) -{ - BN_MAX(bnWm1); - BN_PRIME(bnM); - BN_PRIME(bnB); - BN_PRIME(bnZ); - BOOL ret = FALSE; // Assumed composite for easy exit - unsigned int a; - unsigned int j; - int wLen; - int i; - int iterations = MillerRabinRounds(BnSizeInBits(bnW)); -// - INSTRUMENT_INC(MillerRabinTrials[PrimeIndex]); - - pAssert(bnW->size > 1); - // Let a be the largest integer such that 2^a divides w1. - BnSubWord(bnWm1, bnW, 1); - pAssert(bnWm1->size != 0); - - // Since w is odd (w-1) is even so start at bit number 1 rather than 0 - // Get the number of bits in bnWm1 so that it doesn't have to be recomputed - // on each iteration. - i = (int)(bnWm1->size * RADIX_BITS); - // Now find the largest power of 2 that divides w1 - for(a = 1; - (a < (bnWm1->size * RADIX_BITS)) && - (BnTestBit(bnWm1, a) == 0); - a++); - // 2. m = (w1) / 2^a - BnShiftRight(bnM, bnWm1, a); - // 3. wlen = len (w). - wLen = BnSizeInBits(bnW); - // 4. For i = 1 to iterations do - for(i = 0; i < iterations; i++) - { - // 4.1 Obtain a string b of wlen bits from an RBG. - // Ensure that 1 < b < w1. - // 4.2 If ((b <= 1) or (b >= w1)), then go to step 4.1. - while(BnGetRandomBits(bnB, wLen, rand) && ((BnUnsignedCmpWord(bnB, 1) <= 0) - || (BnUnsignedCmp(bnB, bnWm1) >= 0))); - if(g_inFailureMode) - return FALSE; - - // 4.3 z = b^m mod w. - // if ModExp fails, then say this is not - // prime and bail out. - BnModExp(bnZ, bnB, bnM, bnW); - - // 4.4 If ((z == 1) or (z = w == 1)), then go to step 4.7. - if((BnUnsignedCmpWord(bnZ, 1) == 0) - || (BnUnsignedCmp(bnZ, bnWm1) == 0)) - goto step4point7; - // 4.5 For j = 1 to a 1 do. - for(j = 1; j < a; j++) - { - // 4.5.1 z = z^2 mod w. - BnModMult(bnZ, bnZ, bnZ, bnW); - // 4.5.2 If (z = w1), then go to step 4.7. - if(BnUnsignedCmp(bnZ, bnWm1) == 0) - goto step4point7; - // 4.5.3 If (z = 1), then go to step 4.6. - if(BnEqualWord(bnZ, 1)) - goto step4point6; - } - // 4.6 Return COMPOSITE. -step4point6: - INSTRUMENT_INC(failedAtIteration[i]); - goto end; - // 4.7 Continue. Comment: Increment i for the do-loop in step 4. -step4point7: - continue; - } - // 5. Return PROBABLY PRIME - ret = TRUE; -end: - return ret; -} - -#if ALG_RSA - -//*** RsaCheckPrime() -// This will check to see if a number is prime and appropriate for an -// RSA prime. -// -// This has different functionality based on whether we are using key -// sieving or not. If not, the number checked to see if it is divisible by -// the public exponent, then the number is adjusted either up or down -// in order to make it a better candidate. It is then checked for being -// probably prime. -// -// If sieving is used, the number is used to root a sieving process. -// -TPM_RC -RsaCheckPrime( - bigNum prime, - UINT32 exponent, - RAND_STATE *rand - ) -{ -#if !RSA_KEY_SIEVE - TPM_RC retVal = TPM_RC_SUCCESS; - UINT32 modE = BnModWord(prime, exponent); - - NOT_REFERENCED(rand); - - if(modE == 0) - // evenly divisible so add two keeping the number odd - BnAddWord(prime, prime, 2); - // want 0 != (p - 1) mod e - // which is 1 != p mod e - else if(modE == 1) - // subtract 2 keeping number odd and insuring that - // 0 != (p - 1) mod e - BnSubWord(prime, prime, 2); - - if(BnIsProbablyPrime(prime, rand) == 0) - ERROR_RETURN(g_inFailureMode ? TPM_RC_FAILURE : TPM_RC_VALUE); -Exit: - return retVal; -#else - return PrimeSelectWithSieve(prime, exponent, rand); -#endif -} - -//*** AdjustPrimeCandiate() -// For this math, we assume that the RSA numbers are fixed-point numbers with -// the decimal point to the "left" of the most significant bit. This approach helps -// make it clear what is happening with the MSb of the values. -// The two RSA primes have to be large enough so that their product will be a number -// with the necessary number of significant bits. For example, we want to be able -// to multiply two 1024-bit numbers to produce a number with 2028 significant bits. If -// we accept any 1024-bit prime that has its MSb set, then it is possible to produce a -// product that does not have the MSb SET. For example, if we use tiny keys of 16 bits -// and have two 8-bit 'primes' of 0x80, then the public key would be 0x4000 which is -// only 15-bits. So, what we need to do is made sure that each of the primes is large -// enough so that the product of the primes is twice as large as each prime. A little -// arithmetic will show that the only way to do this is to make sure that each of the -// primes is no less than root(2)/2. That's what this functions does. -// This function adjusts the candidate prime so that it is odd and >= root(2)/2. -// This allows the product of these two numbers to be .5, which, in fixed point -// notation means that the most significant bit is 1. -// For this routine, the root(2)/2 (0.7071067811865475) approximated with 0xB505 -// which is, in fixed point, 0.7071075439453125 or an error of 0.000108%. Just setting -// the upper two bits would give a value > 0.75 which is an error of > 6%. Given the -// amount of time all the other computations take, reducing the error is not much of -// a cost, but it isn't totally required either. -// -// This function can be replaced with a function that just sets the two most -// significant bits of each prime candidate without introducing any computational -// issues. -// -// -LIB_EXPORT void -RsaAdjustPrimeCandidate( - bigNum prime - ) -{ - UINT32 msw; - UINT32 adjusted; - - // If the radix is 32, the compiler should turn this into a simple assignment - msw = prime->d[prime->size - 1] >> ((RADIX_BITS == 64) ? 32 : 0); - // Multiplying 0xff...f by 0x4AFB gives 0xff..f - 0xB5050...0 - adjusted = (msw >> 16) * 0x4AFB; - adjusted += ((msw & 0xFFFF) * 0x4AFB) >> 16; - adjusted += 0xB5050000UL; -#if RADIX_BITS == 64 - // Save the low-order 32 bits - prime->d[prime->size - 1] &= 0xFFFFFFFFUL; - // replace the upper 32-bits - prime->d[prime->size -1] |= ((crypt_uword_t)adjusted << 32); -#else - prime->d[prime->size - 1] = (crypt_uword_t)adjusted; -#endif - // make sure the number is odd - prime->d[0] |= 1; -} - -//***BnGeneratePrimeForRSA() -// Function to generate a prime of the desired size with the proper attributes -// for an RSA prime. -TPM_RC -BnGeneratePrimeForRSA( - bigNum prime, // IN/OUT: points to the BN that will get the - // random value - UINT32 bits, // IN: number of bits to get - UINT32 exponent, // IN: the exponent - RAND_STATE *rand // IN: the random state - ) -{ - BOOL found = FALSE; -// - // Make sure that the prime is large enough - pAssert(prime->allocated >= BITS_TO_CRYPT_WORDS(bits)); - // Only try to handle specific sizes of keys in order to save overhead - pAssert((bits % 32) == 0); - prime->size = BITS_TO_CRYPT_WORDS(bits); - while(!found) - { -// The change below is to make sure that all keys that are generated from the same -// seed value will be the same regardless of the endianess or word size of the CPU. -// DRBG_Generate(rand, (BYTE *)prime->d, (UINT16)BITS_TO_BYTES(bits));// old -// if(g_inFailureMode) // old - if(!BnGetRandomBits(prime, bits, rand)) // new - return TPM_RC_FAILURE; - RsaAdjustPrimeCandidate(prime); - found = RsaCheckPrime(prime, exponent, rand) == TPM_RC_SUCCESS; - } - return TPM_RC_SUCCESS; -} - -#endif // ALG_RSA \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptPrimeSieve.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptPrimeSieve.c deleted file mode 100644 index 6c9c0c174..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptPrimeSieve.c +++ /dev/null @@ -1,571 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes and defines - -#include "Tpm.h" - -#if RSA_KEY_SIEVE - -#include "CryptPrimeSieve_fp.h" - -// This determines the number of bits in the largest sieve field. -#define MAX_FIELD_SIZE 2048 - -extern const uint32_t s_LastPrimeInTable; -extern const uint32_t s_PrimeTableSize; -extern const uint32_t s_PrimesInTable; -extern const unsigned char s_PrimeTable[]; - -// This table is set of prime markers. Each entry is the prime value -// for the ((n + 1) * 1024) prime. That is, the entry in s_PrimeMarkers[1] -// is the value for the 2,048th prime. This is used in the PrimeSieve -// to adjust the limit for the prime search. When processing smaller -// prime candidates, fewer primes are checked directly before going to -// Miller-Rabin. As the prime grows, it is worth spending more time eliminating -// primes as, a) the density is lower, and b) the cost of Miller-Rabin is -// higher. -const uint32_t s_PrimeMarkersCount = 6; -const uint32_t s_PrimeMarkers[] = { - 8167, 17881, 28183, 38891, 49871, 60961 }; -uint32_t primeLimit; - -//** Functions - -//*** RsaAdjustPrimeLimit() -// This used during the sieve process. The iterator for getting the -// next prime (RsaNextPrime()) will return primes until it hits the -// limit (primeLimit) set up by this function. This causes the sieve -// process to stop when an appropriate number of primes have been -// sieved. -LIB_EXPORT void -RsaAdjustPrimeLimit( - uint32_t requestedPrimes - ) -{ - if(requestedPrimes == 0 || requestedPrimes > s_PrimesInTable) - requestedPrimes = s_PrimesInTable; - requestedPrimes = (requestedPrimes - 1) / 1024; - if(requestedPrimes < s_PrimeMarkersCount) - primeLimit = s_PrimeMarkers[requestedPrimes]; - else - primeLimit = s_LastPrimeInTable; - primeLimit >>= 1; - -} - -//*** RsaNextPrime() -// This the iterator used during the sieve process. The input is the -// last prime returned (or any starting point) and the output is the -// next higher prime. The function returns 0 when the primeLimit is -// reached. -LIB_EXPORT uint32_t -RsaNextPrime( - uint32_t lastPrime - ) -{ - if(lastPrime == 0) - return 0; - lastPrime >>= 1; - for(lastPrime += 1; lastPrime <= primeLimit; lastPrime++) - { - if(((s_PrimeTable[lastPrime >> 3] >> (lastPrime & 0x7)) & 1) == 1) - return ((lastPrime << 1) + 1); - } - return 0; -} - -// This table contains a previously sieved table. It has -// the bits for 3, 5, and 7 removed. Because of the -// factors, it needs to be aligned to 105 and has -// a repeat of 105. -const BYTE seedValues[] = { - 0x16, 0x29, 0xcb, 0xa4, 0x65, 0xda, 0x30, 0x6c, - 0x99, 0x96, 0x4c, 0x53, 0xa2, 0x2d, 0x52, 0x96, - 0x49, 0xcb, 0xb4, 0x61, 0xd8, 0x32, 0x2d, 0x99, - 0xa6, 0x44, 0x5b, 0xa4, 0x2c, 0x93, 0x96, 0x69, - 0xc3, 0xb0, 0x65, 0x5a, 0x32, 0x4d, 0x89, 0xb6, - 0x48, 0x59, 0x26, 0x2d, 0xd3, 0x86, 0x61, 0xcb, - 0xb4, 0x64, 0x9a, 0x12, 0x6d, 0x91, 0xb2, 0x4c, - 0x5a, 0xa6, 0x0d, 0xc3, 0x96, 0x69, 0xc9, 0x34, - 0x25, 0xda, 0x22, 0x65, 0x99, 0xb4, 0x4c, 0x1b, - 0x86, 0x2d, 0xd3, 0x92, 0x69, 0x4a, 0xb4, 0x45, - 0xca, 0x32, 0x69, 0x99, 0x36, 0x0c, 0x5b, 0xa6, - 0x25, 0xd3, 0x94, 0x68, 0x8b, 0x94, 0x65, 0xd2, - 0x32, 0x6d, 0x18, 0xb6, 0x4c, 0x4b, 0xa6, 0x29, - 0xd1}; - -#define USE_NIBBLE - -#ifndef USE_NIBBLE -static const BYTE bitsInByte[256] = { - 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, - 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, - 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, - 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, - 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, - 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, - 0x05, 0x06, 0x06, 0x07, 0x06, 0x07, 0x07, 0x08 -}; -#define BitsInByte(x) bitsInByte[(unsigned char)x] -#else -const BYTE bitsInNibble[16] = { - 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, - 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04}; -#define BitsInByte(x) \ - (bitsInNibble[(unsigned char)(x) & 0xf] \ - + bitsInNibble[((unsigned char)(x) >> 4) & 0xf]) -#endif - -//*** BitsInArry() -// This function counts the number of bits set in an array of bytes. -static int -BitsInArray( - const unsigned char *a, // IN: A pointer to an array of bytes - unsigned int aSize // IN: the number of bytes to sum - ) -{ - int j = 0; - for(; aSize; a++, aSize--) - j += BitsInByte(*a); - return j; -} - -//*** FindNthSetBit() -// This function finds the nth SET bit in a bit array. The 'n' parameter is -// between 1 and the number of bits in the array (always a multiple of 8). -// If called when the array does not have n bits set, it will return -1 -// Return Type: unsigned int -// <0 no bit is set or no bit with the requested number is set -// >=0 the number of the bit in the array that is the nth set -LIB_EXPORT int -FindNthSetBit( - const UINT16 aSize, // IN: the size of the array to check - const BYTE *a, // IN: the array to check - const UINT32 n // IN, the number of the SET bit - ) -{ - UINT16 i; - int retValue; - UINT32 sum = 0; - BYTE sel; - - //find the bit - for(i = 0; (i < (int)aSize) && (sum < n); i++) - sum += BitsInByte(a[i]); - i--; - // The chosen bit is in the byte that was just accessed - // Compute the offset to the start of that byte - retValue = i * 8 - 1; - sel = a[i]; - // Subtract the bits in the last byte added. - sum -= BitsInByte(sel); - // Now process the byte, one bit at a time. - for(; (sel != 0) && (sum != n); retValue++, sel = sel >> 1) - sum += (sel & 1) != 0; - return (sum == n) ? retValue : -1; -} - -typedef struct -{ - UINT16 prime; - UINT16 count; -} SIEVE_MARKS; - -const SIEVE_MARKS sieveMarks[5] = { - {31, 7}, {73, 5}, {241, 4}, {1621, 3}, {UINT16_MAX, 2}}; - - -//*** PrimeSieve() -// This function does a prime sieve over the input 'field' which has as its -// starting address the value in bnN. Since this initializes the Sieve -// using a precomputed field with the bits associated with 3, 5 and 7 already -// turned off, the value of pnN may need to be adjusted by a few counts to allow -// the precomputed field to be used without modification. -// -// To get better performance, one could address the issue of developing the -// composite numbers. When the size of the prime gets large, the time for doing -// the divisions goes up, noticeably. It could be better to develop larger composite -// numbers even if they need to be bigNum's themselves. The object would be to -// reduce the number of times that the large prime is divided into a few large -// divides and then use smaller divides to get to the final 16 bit (or smaller) -// remainders. -LIB_EXPORT UINT32 -PrimeSieve( - bigNum bnN, // IN/OUT: number to sieve - UINT32 fieldSize, // IN: size of the field area in bytes - BYTE *field // IN: field - ) -{ - UINT32 i; - UINT32 j; - UINT32 fieldBits = fieldSize * 8; - UINT32 r; - BYTE *pField; - INT32 iter; - UINT32 adjust; - UINT32 mark = 0; - UINT32 count = sieveMarks[0].count; - UINT32 stop = sieveMarks[0].prime; - UINT32 composite; - UINT32 pList[8]; - UINT32 next; - - pAssert(field != NULL && bnN != NULL); - - // If the remainder is odd, then subtracting the value will give an even number, - // but we want an odd number, so subtract the 105+rem. Otherwise, just subtract - // the even remainder. - adjust = (UINT32)BnModWord(bnN, 105); - if(adjust & 1) - adjust += 105; - - // Adjust the input number so that it points to the first number in a - // aligned field. - BnSubWord(bnN, bnN, adjust); -// pAssert(BnModWord(bnN, 105) == 0); - pField = field; - for(i = fieldSize; i >= sizeof(seedValues); - pField += sizeof(seedValues), i -= sizeof(seedValues)) - { - memcpy(pField, seedValues, sizeof(seedValues)); - } - if(i != 0) - memcpy(pField, seedValues, i); - - // Cycle through the primes, clearing bits - // Have already done 3, 5, and 7 - iter = 7; - -#define NEXT_PRIME(iter) (iter = RsaNextPrime(iter)) - // Get the next N primes where N is determined by the mark in the sieveMarks - while((composite = NEXT_PRIME(iter)) != 0) - { - next = 0; - i = count; - pList[i--] = composite; - for(; i > 0; i--) - { - next = NEXT_PRIME(iter); - pList[i] = next; - if(next != 0) - composite *= next; - } - // Get the remainder when dividing the base field address - // by the composite - composite = (UINT32)BnModWord(bnN, composite); - // 'composite' is divisible by the composite components. for each of the - // composite components, divide 'composite'. That remainder (r) is used to - // pick a starting point for clearing the array. The stride is equal to the - // composite component. Note, the field only contains odd numbers. If the - // field were expanded to contain all numbers, then half of the bits would - // have already been cleared. We can save the trouble of clearing them a - // second time by having a stride of 2*next. Or we can take all of the even - // numbers out of the field and use a stride of 'next' - for(i = count; i > 0; i--) - { - next = pList[i]; - if(next == 0) - goto done; - r = composite % next; - // these computations deal with the fact that we have picked a field-sized - // range that is aligned to a 105 count boundary. The problem is, this field - // only contains odd numbers. If we take our prime guess and walk through all - // the numbers using that prime as the 'stride', then every other 'stride' is - // going to be an even number. So, we are actually counting by 2 * the stride - // We want the count to start on an odd number at the start of our field. That - // is, we want to assume that we have counted up to the edge of the field by - // the 'stride' and now we are going to start flipping bits in the field as we - // continue to count up by 'stride'. If we take the base of our field and - // divide by the stride, we find out how much we find out how short the last - // count was from reaching the edge of the bit field. Say we get a quotient of - // 3 and remainder of 1. This means that after 3 strides, we are 1 short of - // the start of the field and the next stride will either land within the - // field or step completely over it. The confounding factor is that our field - // only contains odd numbers and our stride is actually 2 * stride. If the - // quoitent is even, then that means that when we add 2 * stride, we are going - // to hit another even number. So, we have to know if we need to back off - // by 1 stride before we start couting by 2 * stride. - // We can tell from the remainder whether we are on an even or odd - // stride when we hit the beginning of the table. If we are on an odd stride - // (r & 1), we would start half a stride in (next - r)/2. If we are on an - // even stride, we need 0.5 strides (next - r/2) because the table only has - // odd numbers. If the remainder happens to be zero, then the start of the - // table is on stride so no adjustment is necessary. - if(r & 1) j = (next - r) / 2; - else if(r == 0) j = 0; - else j = next - (r / 2); - for(; j < fieldBits; j += next) - ClearBit(j, field, fieldSize); - } - if(next >= stop) - { - mark++; - count = sieveMarks[mark].count; - stop = sieveMarks[mark].prime; - } - } -done: - INSTRUMENT_INC(totalFieldsSieved[PrimeIndex]); - i = BitsInArray(field, fieldSize); - INSTRUMENT_ADD(bitsInFieldAfterSieve[PrimeIndex], i); - INSTRUMENT_ADD(emptyFieldsSieved[PrimeIndex], (i == 0)); - return i; -} - - - -#ifdef SIEVE_DEBUG -static uint32_t fieldSize = 210; - -//***SetFieldSize() -// Function to set the field size used for prime generation. Used for tuning. -LIB_EXPORT uint32_t -SetFieldSize( - uint32_t newFieldSize - ) -{ - if(newFieldSize == 0 || newFieldSize > MAX_FIELD_SIZE) - fieldSize = MAX_FIELD_SIZE; - else - fieldSize = newFieldSize; - return fieldSize; -} -#endif // SIEVE_DEBUG - -//*** PrimeSelectWithSieve() -// This function will sieve the field around the input prime candidate. If the -// sieve field is not empty, one of the one bits in the field is chosen for testing -// with Miller-Rabin. If the value is prime, 'pnP' is updated with this value -// and the function returns success. If this value is not prime, another -// pseudo-random candidate is chosen and tested. This process repeats until -// all values in the field have been checked. If all bits in the field have -// been checked and none is prime, the function returns FALSE and a new random -// value needs to be chosen. -// Return Type: TPM_RC -// TPM_RC_FAILURE TPM in failure mode, probably due to entropy source -// TPM_RC_SUCCESS candidate is probably prime -// TPM_RC_NO_RESULT candidate is not prime and couldn't find and alternative -// in the field -LIB_EXPORT TPM_RC -PrimeSelectWithSieve( - bigNum candidate, // IN/OUT: The candidate to filter - UINT32 e, // IN: the exponent - RAND_STATE *rand // IN: the random number generator state - ) -{ - BYTE field[MAX_FIELD_SIZE]; - UINT32 first; - UINT32 ones; - INT32 chosen; - BN_PRIME(test); - UINT32 modE; -#ifndef SIEVE_DEBUG - UINT32 fieldSize = MAX_FIELD_SIZE; -#endif - UINT32 primeSize; -// - // Adjust the field size and prime table list to fit the size of the prime - // being tested. This is done to try to optimize the trade-off between the - // dividing done for sieving and the time for Miller-Rabin. When the size - // of the prime is large, the cost of Miller-Rabin is fairly high, as is the - // cost of the sieving. However, the time for Miller-Rabin goes up considerably - // faster than the cost of dividing by a number of primes. - primeSize = BnSizeInBits(candidate); - - if(primeSize <= 512) - { - RsaAdjustPrimeLimit(1024); // Use just the first 1024 primes - } - else if(primeSize <= 1024) - { - RsaAdjustPrimeLimit(4096); // Use just the first 4K primes - } - else - { - RsaAdjustPrimeLimit(0); // Use all available - } - - // Save the low-order word to use as a search generator and make sure that - // it has some interesting range to it - first = (UINT32)(candidate->d[0] | 0x80000000); - - // Sieve the field - ones = PrimeSieve(candidate, fieldSize, field); - pAssert(ones > 0 && ones < (fieldSize * 8)); - for(; ones > 0; ones--) - { - // Decide which bit to look at and find its offset - chosen = FindNthSetBit((UINT16)fieldSize, field, ((first % ones) + 1)); - - if((chosen < 0) || (chosen >= (INT32)(fieldSize * 8))) - FAIL(FATAL_ERROR_INTERNAL); - - // Set this as the trial prime - BnAddWord(test, candidate, (crypt_uword_t)(chosen * 2)); - - // The exponent might not have been one of the tested primes so - // make sure that it isn't divisible and make sure that 0 != (p-1) mod e - // Note: This is the same as 1 != p mod e - modE = (UINT32)BnModWord(test, e); - if((modE != 0) && (modE != 1) && MillerRabin(test, rand)) - { - BnCopy(candidate, test); - return TPM_RC_SUCCESS; - } - // Clear the bit just tested - ClearBit(chosen, field, fieldSize); - } - // Ran out of bits and couldn't find a prime in this field - INSTRUMENT_INC(noPrimeFields[PrimeIndex]); - return (g_inFailureMode ? TPM_RC_FAILURE : TPM_RC_NO_RESULT); -} - -#if RSA_INSTRUMENT -static char a[256]; - -//*** PrintTuple() -char * -PrintTuple( - UINT32 *i - ) -{ - sprintf(a, "{%d, %d, %d}", i[0], i[1], i[2]); - return a; -} - -#define CLEAR_VALUE(x) memset(x, 0, sizeof(x)) - -//*** RsaSimulationEnd() -void -RsaSimulationEnd( - void - ) -{ - int i; - UINT32 averages[3]; - UINT32 nonFirst = 0; - if((PrimeCounts[0] + PrimeCounts[1] + PrimeCounts[2]) != 0) - { - printf("Primes generated = %s\n", PrintTuple(PrimeCounts)); - printf("Fields sieved = %s\n", PrintTuple(totalFieldsSieved)); - printf("Fields with no primes = %s\n", PrintTuple(noPrimeFields)); - printf("Primes checked with Miller-Rabin = %s\n", - PrintTuple(MillerRabinTrials)); - for(i = 0; i < 3; i++) - averages[i] = (totalFieldsSieved[i] - != 0 ? bitsInFieldAfterSieve[i] / totalFieldsSieved[i] - : 0); - printf("Average candidates in field %s\n", PrintTuple(averages)); - for(i = 1; i < (sizeof(failedAtIteration) / sizeof(failedAtIteration[0])); - i++) - nonFirst += failedAtIteration[i]; - printf("Miller-Rabin failures not in first round = %d\n", nonFirst); - - } - CLEAR_VALUE(PrimeCounts); - CLEAR_VALUE(totalFieldsSieved); - CLEAR_VALUE(noPrimeFields); - CLEAR_VALUE(MillerRabinTrials); - CLEAR_VALUE(bitsInFieldAfterSieve); -} - -//*** GetSieveStats() -LIB_EXPORT void -GetSieveStats( - uint32_t *trials, - uint32_t *emptyFields, - uint32_t *averageBits - ) -{ - uint32_t totalBits; - uint32_t fields; - *trials = MillerRabinTrials[0] + MillerRabinTrials[1] + MillerRabinTrials[2]; - *emptyFields = noPrimeFields[0] + noPrimeFields[1] + noPrimeFields[2]; - fields = totalFieldsSieved[0] + totalFieldsSieved[1] - + totalFieldsSieved[2]; - totalBits = bitsInFieldAfterSieve[0] + bitsInFieldAfterSieve[1] - + bitsInFieldAfterSieve[2]; - if(fields != 0) - *averageBits = totalBits / fields; - else - *averageBits = 0; - CLEAR_VALUE(PrimeCounts); - CLEAR_VALUE(totalFieldsSieved); - CLEAR_VALUE(noPrimeFields); - CLEAR_VALUE(MillerRabinTrials); - CLEAR_VALUE(bitsInFieldAfterSieve); - -} -#endif - -#endif // RSA_KEY_SIEVE - -#if !RSA_INSTRUMENT - -//*** RsaSimulationEnd() -// Stub for call when not doing instrumentation. -void -RsaSimulationEnd( - void - ) -{ - return; -} -#endif \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptRand.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptRand.c deleted file mode 100644 index c41eb41af..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptRand.c +++ /dev/null @@ -1,950 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file implements a DRBG with a behavior according to SP800-90A using -// a block cypher. This is also compliant to ISO/IEC 18031:2011(E) C.3.2. -// -// A state structure is created for use by TPM.lib and functions -// within the CryptoEngine my use their own state structures when they need to have -// deterministic values. -// -// A debug mode is available that allows the random numbers generated for TPM.lib -// to be repeated during runs of the simulator. The switch for it is in -// TpmBuildSwitches.h. It is USE_DEBUG_RNG. -// -// -// This is the implementation layer of CTR DRGB mechanism as defined in SP800-90A -// and the functions are organized as closely as practical to the organization in -// SP800-90A. It is intended to be compiled as a separate module that is linked -// with a secure application so that both reside inside the same boundary -// [SP 800-90A 8.5]. The secure application in particular manages the accesses -// protected storage for the state of the DRBG instantiations, and supplies the -// implementation functions here with a valid pointer to the working state of the -// given instantiations (as a DRBG_STATE structure). -// -// This DRBG mechanism implementation does not support prediction resistance. Thus -// 'prediction_resistance_flag' is omitted from Instantiate_function(), -// Reseed_function(), Generate_function() argument lists [SP 800-90A 9.1, 9.2, -// 9.3], as well as from the working state data structure DRBG_STATE [SP 800-90A -// 9.1]. -// -// This DRBG mechanism implementation always uses the highest security strength of -// available in the block ciphers. Thus 'requested_security_strength' parameter is -// omitted from Instantiate_function() and Generate_function() argument lists -// [SP 800-90A 9.1, 9.2, 9.3], as well as from the working state data structure -// DRBG_STATE [SP 800-90A 9.1]. -// -// Internal functions (ones without Crypt prefix) expect validated arguments and -// therefore use assertions instead of runtime parameter checks and mostly return -// void instead of a status value. - -#include "Tpm.h" - -// Pull in the test vector definitions and define the space -#include "PRNG_TestVectors.h" - -const BYTE DRBG_NistTestVector_Entropy[] = {DRBG_TEST_INITIATE_ENTROPY}; -const BYTE DRBG_NistTestVector_GeneratedInterm[] = - {DRBG_TEST_GENERATED_INTERM}; - -const BYTE DRBG_NistTestVector_EntropyReseed[] = - {DRBG_TEST_RESEED_ENTROPY}; -const BYTE DRBG_NistTestVector_Generated[] = {DRBG_TEST_GENERATED}; - -//** Derivation Functions -//*** Description -// The functions in this section are used to reduce the personalization input values -// to make them usable as input for reseeding and instantiation. The overall -// behavior is intended to produce the same results as described in SP800-90A, -// section 10.4.2 "Derivation Function Using a Block Cipher Algorithm -// (Block_Cipher_df)." The code is broken into several subroutines to deal with the -// fact that the data used for personalization may come in several separate blocks -// such as a Template hash and a proof value and a primary seed. - -//*** Derivation Function Defines and Structures - -#define DF_COUNT (DRBG_KEY_SIZE_WORDS / DRBG_IV_SIZE_WORDS + 1) -#if DRBG_KEY_SIZE_BITS != 128 && DRBG_KEY_SIZE_BITS != 256 -# error "CryptRand.c only written for AES with 128- or 256-bit keys." -#endif - -typedef struct -{ - DRBG_KEY_SCHEDULE keySchedule; - DRBG_IV iv[DF_COUNT]; - DRBG_IV out1; - DRBG_IV buf; - int contents; -} DF_STATE, *PDF_STATE; - -//*** DfCompute() -// This function does the incremental update of the derivation function state. It -// encrypts the 'iv' value and XOR's the results into each of the blocks of the -// output. This is equivalent to processing all of input data for each output block. -static void -DfCompute( - PDF_STATE dfState - ) -{ - int i; - int iv; - crypt_uword_t *pIv; - crypt_uword_t temp[DRBG_IV_SIZE_WORDS] = {0}; -// - for(iv = 0; iv < DF_COUNT; iv++) - { - pIv = (crypt_uword_t *)&dfState->iv[iv].words[0]; - for(i = 0; i < DRBG_IV_SIZE_WORDS; i++) - { - temp[i] ^= pIv[i] ^ dfState->buf.words[i]; - } - DRBG_ENCRYPT(&dfState->keySchedule, &temp, pIv); - } - for(i = 0; i < DRBG_IV_SIZE_WORDS; i++) - dfState->buf.words[i] = 0; - dfState->contents = 0; -} - -//*** DfStart() -// This initializes the output blocks with an encrypted counter value and -// initializes the key schedule. -static void -DfStart( - PDF_STATE dfState, - uint32_t inputLength - ) -{ - BYTE init[8]; - int i; - UINT32 drbgSeedSize = sizeof(DRBG_SEED); - - const BYTE dfKey[DRBG_KEY_SIZE_BYTES] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f - #if DRBG_KEY_SIZE_BYTES > 16 - ,0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f - #endif - }; - memset(dfState, 0, sizeof(DF_STATE)); - DRBG_ENCRYPT_SETUP(&dfKey[0], DRBG_KEY_SIZE_BITS, &dfState->keySchedule); - // Create the first chaining values - for(i = 0; i < DF_COUNT; i++) - ((BYTE *)&dfState->iv[i])[3] = (BYTE)i; - DfCompute(dfState); - // initialize the first 64 bits of the IV in a way that doesn't depend - // on the size of the words used. - UINT32_TO_BYTE_ARRAY(inputLength, init); - UINT32_TO_BYTE_ARRAY(drbgSeedSize, &init[4]); - memcpy(&dfState->iv[0], init, 8); - dfState->contents = 4; -} - -//*** DfUpdate() -// This updates the state with the input data. A byte at a time is moved into the -// state buffer until it is full and then that block is encrypted by DfCompute(). -static void -DfUpdate( - PDF_STATE dfState, - int size, - const BYTE *data - ) -{ - while(size > 0) - { - int toFill = DRBG_IV_SIZE_BYTES - dfState->contents; - if(size < toFill) - toFill = size; - // Copy as many bytes as there are or until the state buffer is full - memcpy(&dfState->buf.bytes[dfState->contents], data, toFill); - // Reduce the size left by the amount copied - size -= toFill; - // Advance the data pointer by the amount copied - data += toFill; - // increase the buffer contents count by the amount copied - dfState->contents += toFill; - pAssert(dfState->contents <= DRBG_IV_SIZE_BYTES); - // If we have a full buffer, do a computation pass. - if(dfState->contents == DRBG_IV_SIZE_BYTES) - DfCompute(dfState); - } -} - -//*** DfEnd() -// This function is called to get the result of the derivation function computation. -// If the buffer is not full, it is padded with zeros. The output buffer is -// structured to be the same as a DRBG_SEED value so that the function can return -// a pointer to the DRBG_SEED value in the DF_STATE structure. -static DRBG_SEED * -DfEnd( - PDF_STATE dfState - ) -{ - // Since DfCompute is always called when a buffer is full, there is always - // space in the buffer for the terminator - dfState->buf.bytes[dfState->contents++] = 0x80; - // If the buffer is not full, pad with zeros - while(dfState->contents < DRBG_IV_SIZE_BYTES) - dfState->buf.bytes[dfState->contents++] = 0; - // Do a final state update - DfCompute(dfState); - return (DRBG_SEED *)&dfState->iv; -} - -//*** DfBuffer() -// Function to take an input buffer and do the derivation function to produce a -// DRBG_SEED value that can be used in DRBG_Reseed(); -static DRBG_SEED * -DfBuffer( - DRBG_SEED *output, // OUT: receives the result - int size, // IN: size of the buffer to add - BYTE *buf // IN: address of the buffer - ) -{ - DF_STATE dfState; - if(size == 0 || buf == NULL) - return NULL; - // Initialize the derivation function - DfStart(&dfState, size); - DfUpdate(&dfState, size, buf); - DfEnd(&dfState); - memcpy(output, &dfState.iv[0], sizeof(DRBG_SEED)); - return output; -} - -//*** DRBG_GetEntropy() -// Even though this implementation never fails, it may get blocked -// indefinitely long in the call to get entropy from the platform -// (DRBG_GetEntropy32()). -// This function is only used during instantiation of the DRBG for -// manufacturing and on each start-up after an non-orderly shutdown. -// Return Type: BOOL -// TRUE(1) requested entropy returned -// FALSE(0) entropy Failure -BOOL -DRBG_GetEntropy( - UINT32 requiredEntropy, // IN: requested number of bytes of full - // entropy - BYTE *entropy // OUT: buffer to return collected entropy - ) -{ -#if !USE_DEBUG_RNG - - UINT32 obtainedEntropy; - INT32 returnedEntropy; - -// If in debug mode, always use the self-test values for initialization - if(IsSelfTest()) - { -#endif - // If doing simulated DRBG, then check to see if the - // entropyFailure condition is being tested - if(!IsEntropyBad()) - { - // In self-test, the caller should be asking for exactly the seed - // size of entropy. - pAssert(requiredEntropy == sizeof(DRBG_NistTestVector_Entropy)); - memcpy(entropy, DRBG_NistTestVector_Entropy, - sizeof(DRBG_NistTestVector_Entropy)); - } -#if !USE_DEBUG_RNG - } - else if(!IsEntropyBad()) - { - // Collect entropy - // Note: In debug mode, the only "entropy" value ever returned - // is the value of the self-test vector. - for(returnedEntropy = 1, obtainedEntropy = 0; - obtainedEntropy < requiredEntropy && !IsEntropyBad(); - obtainedEntropy += returnedEntropy) - { - returnedEntropy = _plat__GetEntropy(&entropy[obtainedEntropy], - requiredEntropy - obtainedEntropy); - if(returnedEntropy <= 0) - SetEntropyBad(); - } - } -#endif - return !IsEntropyBad(); -} - -//*** IncrementIv() -// This function increments the IV value by 1. It is used by EncryptDRBG(). -void -IncrementIv( - DRBG_IV *iv - ) -{ - BYTE *ivP = ((BYTE *)iv) + DRBG_IV_SIZE_BYTES; - while((--ivP >= (BYTE *)iv) && ((*ivP = ((*ivP + 1) & 0xFF)) == 0)); -} - -//*** EncryptDRBG() -// This does the encryption operation for the DRBG. It will encrypt -// the input state counter (IV) using the state key. Into the output -// buffer for as many times as it takes to generate the required -// number of bytes. -static BOOL -EncryptDRBG( - BYTE *dOut, - UINT32 dOutBytes, - DRBG_KEY_SCHEDULE *keySchedule, - DRBG_IV *iv, - UINT32 *lastValue // Points to the last output value - ) -{ -#if FIPS_COMPLIANT -// For FIPS compliance, the DRBG has to do a continuous self-test to make sure that -// no two consecutive values are the same. This overhead is not incurred if the TPM -// is not required to be FIPS compliant -// - UINT32 temp[DRBG_IV_SIZE_BYTES / sizeof(UINT32)]; - int i; - BYTE *p; - - for(; dOutBytes > 0;) - { - // Increment the IV before each encryption (this is what makes this - // different from normal counter-mode encryption - IncrementIv(iv); - DRBG_ENCRYPT(keySchedule, iv, temp); -// Expect a 16 byte block -#if DRBG_IV_SIZE_BITS != 128 -#error "Unsuppored IV size in DRBG" -#endif - if((lastValue[0] == temp[0]) - && (lastValue[1] == temp[1]) - && (lastValue[2] == temp[2]) - && (lastValue[3] == temp[3]) - ) - { - LOG_FAILURE(FATAL_ERROR_ENTROPY); - return FALSE; - } - lastValue[0] = temp[0]; - lastValue[1] = temp[1]; - lastValue[2] = temp[2]; - lastValue[3] = temp[3]; - i = MIN(dOutBytes, DRBG_IV_SIZE_BYTES); - dOutBytes -= i; - for(p = (BYTE *)temp; i > 0; i--) - *dOut++ = *p++; - } -#else // version without continuous self-test - NOT_REFERENCED(lastValue); - for(; dOutBytes >= DRBG_IV_SIZE_BYTES; - dOut = &dOut[DRBG_IV_SIZE_BYTES], dOutBytes -= DRBG_IV_SIZE_BYTES) - { - // Increment the IV - IncrementIv(iv); - DRBG_ENCRYPT(keySchedule, iv, dOut); - } - // If there is a partial, generate into a block-sized - // temp buffer and copy to the output. - if(dOutBytes != 0) - { - BYTE temp[DRBG_IV_SIZE_BYTES]; - // Increment the IV - IncrementIv(iv); - DRBG_ENCRYPT(keySchedule, iv, temp); - memcpy(dOut, temp, dOutBytes); - } -#endif - return TRUE; -} - -//*** DRBG_Update() -// This function performs the state update function. -// According to SP800-90A, a temp value is created by doing CTR mode -// encryption of 'providedData' and replacing the key and IV with -// these values. The one difference is that, with counter mode, the -// IV is incremented after each block is encrypted and in this -// operation, the counter is incremented before each block is -// encrypted. This function implements an 'optimized' version -// of the algorithm in that it does the update of the drbgState->seed -// in place and then 'providedData' is XORed into drbgState->seed -// to complete the encryption of 'providedData'. This works because -// the IV is the last thing that gets encrypted. -// -static BOOL -DRBG_Update( - DRBG_STATE *drbgState, // IN:OUT state to update - DRBG_KEY_SCHEDULE *keySchedule, // IN: the key schedule (optional) - DRBG_SEED *providedData // IN: additional data - ) -{ - UINT32 i; - BYTE *temp = (BYTE *)&drbgState->seed; - DRBG_KEY *key = pDRBG_KEY(&drbgState->seed); - DRBG_IV *iv = pDRBG_IV(&drbgState->seed); - DRBG_KEY_SCHEDULE localKeySchedule; -// - pAssert(drbgState->magic == DRBG_MAGIC); - - // If an key schedule was not provided, make one - if(keySchedule == NULL) - { - if(DRBG_ENCRYPT_SETUP((BYTE *)key, - DRBG_KEY_SIZE_BITS, &localKeySchedule) != 0) - { - LOG_FAILURE(FATAL_ERROR_INTERNAL); - return FALSE; - } - keySchedule = &localKeySchedule; - } - // Encrypt the temp value - - EncryptDRBG(temp, sizeof(DRBG_SEED), keySchedule, iv, - drbgState->lastValue); - if(providedData != NULL) - { - BYTE *pP = (BYTE *)providedData; - for(i = DRBG_SEED_SIZE_BYTES; i != 0; i--) - *temp++ ^= *pP++; - } - // Since temp points to the input key and IV, we are done and - // don't need to copy the resulting 'temp' to drbgState->seed - return TRUE; -} - -//*** DRBG_Reseed() -// This function is used when reseeding of the DRBG is required. If -// entropy is provided, it is used in lieu of using hardware entropy. -// Note: the provided entropy must be the required size. -// Return Type: BOOL -// TRUE(1) reseed succeeded -// FALSE(0) reseed failed, probably due to the entropy generation -BOOL -DRBG_Reseed( - DRBG_STATE *drbgState, // IN: the state to update - DRBG_SEED *providedEntropy, // IN: entropy - DRBG_SEED *additionalData // IN: - ) -{ - DRBG_SEED seed; - - pAssert((drbgState != NULL) && (drbgState->magic == DRBG_MAGIC)); - - if(providedEntropy == NULL) - { - providedEntropy = &seed; - if(!DRBG_GetEntropy(sizeof(DRBG_SEED), (BYTE *)providedEntropy)) - return FALSE; - } - if(additionalData != NULL) - { - unsigned int i; - - // XOR the provided data into the provided entropy - for(i = 0; i < sizeof(DRBG_SEED); i++) - ((BYTE *)providedEntropy)[i] ^= ((BYTE *)additionalData)[i]; - } - DRBG_Update(drbgState, NULL, providedEntropy); - - drbgState->reseedCounter = 1; - - return TRUE; -} - -//*** DRBG_SelfTest() -// This is run when the DRBG is instantiated and at startup -// Return Type: BOOL -// TRUE(1) test OK -// FALSE(0) test failed -BOOL -DRBG_SelfTest( - void - ) -{ - BYTE buf[sizeof(DRBG_NistTestVector_Generated)]; - DRBG_SEED seed; - UINT32 i; - BYTE *p; - DRBG_STATE testState; -// - pAssert(!IsSelfTest()); - - SetSelfTest(); - SetDrbgTested(); - // Do an instantiate - if(!DRBG_Instantiate(&testState, 0, NULL)) - return FALSE; -#if DRBG_DEBUG_PRINT - dbgDumpMemBlock(pDRBG_KEY(&testState), DRBG_KEY_SIZE_BYTES, - "Key after Instantiate"); - dbgDumpMemBlock(pDRBG_IV(&testState), DRBG_IV_SIZE_BYTES, - "Value after Instantiate"); -#endif - if(DRBG_Generate((RAND_STATE *)&testState, buf, sizeof(buf)) == 0) - return FALSE; -#if DRBG_DEBUG_PRINT - dbgDumpMemBlock(pDRBG_KEY(&testState.seed), DRBG_KEY_SIZE_BYTES, - "Key after 1st Generate"); - dbgDumpMemBlock(pDRBG_IV(&testState.seed), DRBG_IV_SIZE_BYTES, - "Value after 1st Generate"); -#endif - if(memcmp(buf, DRBG_NistTestVector_GeneratedInterm, sizeof(buf)) != 0) - return FALSE; - memcpy(seed.bytes, DRBG_NistTestVector_EntropyReseed, sizeof(seed)); - DRBG_Reseed(&testState, &seed, NULL); -#if DRBG_DEBUG_PRINT - dbgDumpMemBlock((BYTE *)pDRBG_KEY(&testState.seed), DRBG_KEY_SIZE_BYTES, - "Key after 2nd Generate"); - dbgDumpMemBlock((BYTE *)pDRBG_IV(&testState.seed), DRBG_IV_SIZE_BYTES, - "Value after 2nd Generate"); - dbgDumpMemBlock(buf, sizeof(buf), "2nd Generated"); -#endif - if(DRBG_Generate((RAND_STATE *)&testState, buf, sizeof(buf)) == 0) - return FALSE; - if(memcmp(buf, DRBG_NistTestVector_Generated, sizeof(buf)) != 0) - return FALSE; - ClearSelfTest(); - - DRBG_Uninstantiate(&testState); - for(p = (BYTE *)&testState, i = 0; i < sizeof(DRBG_STATE); i++) - { - if(*p++) - return FALSE; - } - // Simulate hardware failure to make sure that we get an error when - // trying to instantiate - SetEntropyBad(); - if(DRBG_Instantiate(&testState, 0, NULL)) - return FALSE; - ClearEntropyBad(); - - return TRUE; -} - -//** Public Interface -//*** Description -// The functions in this section are the interface to the RNG. These -// are the functions that are used by TPM.lib. - -//*** CryptRandomStir() -// This function is used to cause a reseed. A DRBG_SEED amount of entropy is -// collected from the hardware and then additional data is added. -// Return Type: TPM_RC -// TPM_RC_NO_RESULT failure of the entropy generator -LIB_EXPORT TPM_RC -CryptRandomStir( - UINT16 additionalDataSize, - BYTE *additionalData - ) -{ -#if !USE_DEBUG_RNG - DRBG_SEED tmpBuf; - DRBG_SEED dfResult; -// - // All reseed with outside data starts with a buffer full of entropy - if(!DRBG_GetEntropy(sizeof(tmpBuf), (BYTE *)&tmpBuf)) - return TPM_RC_NO_RESULT; - - DRBG_Reseed(&drbgDefault, &tmpBuf, - DfBuffer(&dfResult, additionalDataSize, additionalData)); - drbgDefault.reseedCounter = 1; - - return TPM_RC_SUCCESS; - -#else - // If doing debug, use the input data as the initial setting for the RNG state - // so that the test can be reset at any time. - // Note: If this is called with a data size of 0 or less, nothing happens. The - // presumption is that, in a debug environment, the caller will have specific - // values for initialization, so this check is just a simple way to prevent - // inadvertent programming errors from screwing things up. This doesn't use an - // pAssert() because the non-debug version of this function will accept these - // parameters as meaning that there is no additionalData and only hardware - // entropy is used. - if((additionalDataSize > 0) && (additionalData != NULL)) - { - memset(drbgDefault.seed.bytes, 0, sizeof(drbgDefault.seed.bytes)); - memcpy(drbgDefault.seed.bytes, additionalData, - MIN(additionalDataSize, sizeof(drbgDefault.seed.bytes))); - } - drbgDefault.reseedCounter = 1; - - return TPM_RC_SUCCESS; -#endif -} - -//*** CryptRandomGenerate() -// Generate a 'randomSize' number or random bytes. -LIB_EXPORT UINT16 -CryptRandomGenerate( - UINT16 randomSize, - BYTE *buffer - ) -{ - return DRBG_Generate((RAND_STATE *)&drbgDefault, buffer, randomSize); -} - - - -//*** DRBG_InstantiateSeededKdf() -// This function is used to instantiate a KDF-based RNG. This is used for derivations. -// This function always returns TRUE. -LIB_EXPORT BOOL -DRBG_InstantiateSeededKdf( - KDF_STATE *state, // OUT: buffer to hold the state - TPM_ALG_ID hashAlg, // IN: hash algorithm - TPM_ALG_ID kdf, // IN: the KDF to use - TPM2B *seed, // IN: the seed to use - const TPM2B *label, // IN: a label for the generation process. - TPM2B *context, // IN: the context value - UINT32 limit // IN: Maximum number of bits from the KDF - ) -{ - state->magic = KDF_MAGIC; - state->limit = limit; - state->seed = seed; - state->hash = hashAlg; - state->kdf = kdf; - state->label = label; - state->context = context; - state->digestSize = CryptHashGetDigestSize(hashAlg); - state->counter = 0; - state->residual.t.size = 0; - return TRUE; -} - -//*** DRBG_AdditionalData() -// Function to reseed the DRBG with additional entropy. This is normally called -// before computing the protection value of a primary key in the Endorsement -// hierarchy. -LIB_EXPORT void -DRBG_AdditionalData( - DRBG_STATE *drbgState, // IN:OUT state to update - TPM2B *additionalData // IN: value to incorporate - ) -{ - DRBG_SEED dfResult; - if(drbgState->magic == DRBG_MAGIC) - { - DfBuffer(&dfResult, additionalData->size, additionalData->buffer); - DRBG_Reseed(drbgState, &dfResult, NULL); - } -} - - -//*** DRBG_InstantiateSeeded() -// This function is used to instantiate a random number generator from seed values. -// The nominal use of this generator is to create sequences of pseudo-random -// numbers from a seed value. -// Return Type: TPM_RC -// TPM_RC_FAILURE DRBG self-test failure -LIB_EXPORT TPM_RC -DRBG_InstantiateSeeded( - DRBG_STATE *drbgState, // IN/OUT: buffer to hold the state - const TPM2B *seed, // IN: the seed to use - const TPM2B *purpose, // IN: a label for the generation process. - const TPM2B *name, // IN: name of the object - const TPM2B *additional // IN: additional data - ) -{ - DF_STATE dfState; - int totalInputSize; - // DRBG should have been tested, but... - if(!IsDrbgTested() && !DRBG_SelfTest()) - { - LOG_FAILURE(FATAL_ERROR_SELF_TEST); - return TPM_RC_FAILURE; - } - // Initialize the DRBG state - memset(drbgState, 0, sizeof(DRBG_STATE)); - drbgState->magic = DRBG_MAGIC; - - // Size all of the values - totalInputSize = (seed != NULL) ? seed->size : 0; - totalInputSize += (purpose != NULL) ? purpose->size : 0; - totalInputSize += (name != NULL) ? name->size : 0; - totalInputSize += (additional != NULL) ? additional->size : 0; - - // Initialize the derivation - DfStart(&dfState, totalInputSize); - - // Run all the input strings through the derivation function - if(seed != NULL) - DfUpdate(&dfState, seed->size, seed->buffer); - if(purpose != NULL) - DfUpdate(&dfState, purpose->size, purpose->buffer); - if(name != NULL) - DfUpdate(&dfState, name->size, name->buffer); - if(additional != NULL) - DfUpdate(&dfState, additional->size, additional->buffer); - - // Used the derivation function output as the "entropy" input. This is not - // how it is described in SP800-90A but this is the equivalent function - DRBG_Reseed(((DRBG_STATE *)drbgState), DfEnd(&dfState), NULL); - - return TPM_RC_SUCCESS; -} - -//*** CryptRandStartup() -// This function is called when TPM_Startup is executed. This function always returns -// TRUE. -LIB_EXPORT BOOL -CryptRandStartup( - void - ) -{ -#if ! _DRBG_STATE_SAVE - // If not saved in NV, re-instantiate on each startup - DRBG_Instantiate(&drbgDefault, 0, NULL); -#else - // If the running state is saved in NV, NV has to be loaded before it can - // be updated - if(go.drbgState.magic == DRBG_MAGIC) - DRBG_Reseed(&go.drbgState, NULL, NULL); - else - DRBG_Instantiate(&go.drbgState, 0, NULL); -#endif - return TRUE; -} - -//**** CryptRandInit() -// This function is called when _TPM_Init is being processed. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -LIB_EXPORT BOOL -CryptRandInit( - void - ) -{ -#if !USE_DEBUG_RNG - _plat__GetEntropy(NULL, 0); -#endif - return DRBG_SelfTest(); -} - -//*** DRBG_Generate() -// This function generates a random sequence according SP800-90A. -// If 'random' is not NULL, then 'randomSize' bytes of random values are generated. -// If 'random' is NULL or 'randomSize' is zero, then the function returns -// zero without generating any bits or updating the reseed counter. -// This function returns the number of bytes produced which could be less than the -// number requested if the request is too large ("too large" is implementation -// dependent.) -LIB_EXPORT UINT16 -DRBG_Generate( - RAND_STATE *state, - BYTE *random, // OUT: buffer to receive the random values - UINT16 randomSize // IN: the number of bytes to generate - ) -{ - if(state == NULL) - state = (RAND_STATE *)&drbgDefault; - if(random == NULL) - return 0; - - // If the caller used a KDF state, generate a sequence from the KDF not to - // exceed the limit. - if(state->kdf.magic == KDF_MAGIC) - { - KDF_STATE *kdf = (KDF_STATE *)state; - UINT32 counter = (UINT32)kdf->counter; - INT32 bytesLeft = randomSize; -// - // If the number of bytes to be returned would put the generator - // over the limit, then return 0 - if((((kdf->counter * kdf->digestSize) + randomSize) * 8) > kdf->limit) - return 0; - // Process partial and full blocks until all requested bytes provided - while(bytesLeft > 0) - { - // If there is any residual data in the buffer, copy it to the output - // buffer - if(kdf->residual.t.size > 0) - { - INT32 size; -// - // Don't use more of the residual than will fit or more than are - // available - size = MIN(kdf->residual.t.size, bytesLeft); - - // Copy some or all of the residual to the output. The residual is - // at the end of the buffer. The residual might be a full buffer. - MemoryCopy(random, - &kdf->residual.t.buffer - [kdf->digestSize - kdf->residual.t.size], size); - - // Advance the buffer pointer - random += size; - - // Reduce the number of bytes left to get - bytesLeft -= size; - - // And reduce the residual size appropriately - kdf->residual.t.size -= (UINT16)size; - } - else - { - UINT16 blocks = (UINT16)(bytesLeft / kdf->digestSize); -// - // Get the number of required full blocks - if(blocks > 0) - { - UINT16 size = blocks * kdf->digestSize; -// Get some number of full blocks and put them in the return buffer - CryptKDFa(kdf->hash, kdf->seed, kdf->label, kdf->context, NULL, - kdf->limit, random, &counter, blocks); - - // reduce the size remaining to be moved and advance the pointer - bytesLeft -= size; - random += size; - } - else - { - // Fill the residual buffer with a full block and then loop to - // top to get part of it copied to the output. - kdf->residual.t.size = CryptKDFa(kdf->hash, kdf->seed, - kdf->label, kdf->context, NULL, - kdf->limit, - kdf->residual.t.buffer, - &counter, 1); - } - } - } - kdf->counter = counter; - return randomSize; - } - else if(state->drbg.magic == DRBG_MAGIC) - { - DRBG_STATE *drbgState = (DRBG_STATE *)state; - DRBG_KEY_SCHEDULE keySchedule; - DRBG_SEED *seed = &drbgState->seed; - - if(drbgState->reseedCounter >= CTR_DRBG_MAX_REQUESTS_PER_RESEED) - { - if(drbgState == &drbgDefault) - { - DRBG_Reseed(drbgState, NULL, NULL); - if(IsEntropyBad() && !IsSelfTest()) - return 0; - } - else - { - // If this is a PRNG then the only way to get - // here is if the SW has run away. - LOG_FAILURE(FATAL_ERROR_INTERNAL); - return 0; - } - } - // if the allowed number of bytes in a request is larger than the - // less than the number of bytes that can be requested, then check -#if UINT16_MAX >= CTR_DRBG_MAX_BYTES_PER_REQUEST - if(randomSize > CTR_DRBG_MAX_BYTES_PER_REQUEST) - randomSize = CTR_DRBG_MAX_BYTES_PER_REQUEST; -#endif - // Create encryption schedule - if(DRBG_ENCRYPT_SETUP((BYTE *)pDRBG_KEY(seed), - DRBG_KEY_SIZE_BITS, &keySchedule) != 0) - { - LOG_FAILURE(FATAL_ERROR_INTERNAL); - return 0; - } - // Generate the random data - EncryptDRBG(random, randomSize, &keySchedule, pDRBG_IV(seed), - drbgState->lastValue); - // Do a key update - DRBG_Update(drbgState, &keySchedule, NULL); - - // Increment the reseed counter - drbgState->reseedCounter += 1; - } - else - { - LOG_FAILURE(FATAL_ERROR_INTERNAL); - return FALSE; - } - return randomSize; -} - -//*** DRBG_Instantiate() -// This is CTR_DRBG_Instantiate_algorithm() from [SP 800-90A 10.2.1.3.1]. -// This is called when a the TPM DRBG is to be instantiated. This is -// called to instantiate a DRBG used by the TPM for normal -// operations. -// Return Type: BOOL -// TRUE(1) instantiation succeeded -// FALSE(0) instantiation failed -LIB_EXPORT BOOL -DRBG_Instantiate( - DRBG_STATE *drbgState, // OUT: the instantiated value - UINT16 pSize, // IN: Size of personalization string - BYTE *personalization // IN: The personalization string - ) -{ - DRBG_SEED seed; - DRBG_SEED dfResult; -// - pAssert((pSize == 0) || (pSize <= sizeof(seed)) || (personalization != NULL)); - // If the DRBG has not been tested, test when doing an instantiation. Since - // Instantiation is called during self test, make sure we don't get stuck in a - // loop. - if(!IsDrbgTested() && !IsSelfTest() && !DRBG_SelfTest()) - return FALSE; - // If doing a self test, DRBG_GetEntropy will return the NIST - // test vector value. - if(!DRBG_GetEntropy(sizeof(seed), (BYTE *)&seed)) - return FALSE; - // set everything to zero - memset(drbgState, 0, sizeof(DRBG_STATE)); - drbgState->magic = DRBG_MAGIC; - - // Steps 1, 2, 3, 6, 7 of SP 800-90A 10.2.1.3.1 are exactly what - // reseeding does. So, do a reduction on the personalization value (if any) - // and do a reseed. - DRBG_Reseed(drbgState, &seed, DfBuffer(&dfResult, pSize, personalization)); - - return TRUE; -} - -//*** DRBG_Uninstantiate() -// This is Uninstantiate_function() from [SP 800-90A 9.4]. -// -// Return Type: TPM_RC -// TPM_RC_VALUE not a valid state -LIB_EXPORT TPM_RC -DRBG_Uninstantiate( - DRBG_STATE *drbgState // IN/OUT: working state to erase - ) -{ - if((drbgState == NULL) || (drbgState->magic != DRBG_MAGIC)) - return TPM_RC_VALUE; - memset(drbgState, 0, sizeof(DRBG_STATE)); - return TPM_RC_SUCCESS; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptRsa.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptRsa.c deleted file mode 100644 index dc0ceed57..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptRsa.c +++ /dev/null @@ -1,1489 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This file contains implementation of cryptographic primitives for RSA. -// Vendors may replace the implementation in this file with their own library -// functions. - -//** Includes -// Need this define to get the 'private' defines for this function -#define CRYPT_RSA_C -#include "Tpm.h" - -#if ALG_RSA - -//** Obligatory Initialization Functions - -//*** CryptRsaInit() -// Function called at _TPM_Init(). -BOOL -CryptRsaInit( - void - ) -{ - return TRUE; -} - -//*** CryptRsaStartup() -// Function called at TPM2_Startup() -BOOL -CryptRsaStartup( - void - ) -{ - return TRUE; -} - -//** Internal Functions - -//*** RsaInitializeExponent() -// This function initializes the bignum data structure that holds the private -// exponent. This function returns the pointer to the private exponent value so that -// it can be used in an initializer for a data declaration. -static privateExponent * -RsaInitializeExponent( - privateExponent *Z - ) -{ - bigNum *bn = (bigNum *)&Z->P; - int i; -// - for(i = 0; i < 5; i++) - { - bn[i] = (bigNum)&Z->entries[i]; - BnInit(bn[i], BYTES_TO_CRYPT_WORDS(sizeof(Z->entries[0].d))); - } - return Z; -} - -//*** MakePgreaterThanQ() -// This function swaps the pointers for P and Q if Q happens to be larger than Q. -static void -MakePgreaterThanQ( - privateExponent *Z -) -{ - if(BnUnsignedCmp(Z->P, Z->Q) < 0) - { - bigNum bnT = Z->P; - Z->P = Z->Q; - Z->Q = bnT; - } -} - -//*** PackExponent() -// This function takes the bignum private exponent and converts it into TPM2B form. -// In this form, the size field contains the overall size of the packed data. The -// buffer contains 5, equal sized values in P, Q, dP, dQ, qInv order. For example, if -// a key has a 2Kb public key, then the packed private key will contain 5, 1Kb values. -// This form makes it relatively easy to load and save the values without changing -// the normal unmarshaling to do anything more than allow a larger TPM2B for the -// private key. Also, when exporting the value, all that is needed is to change the -// size field of the private key in order to save just the P value. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure // The data is too big to fit -static BOOL -PackExponent( - TPM2B_PRIVATE_KEY_RSA *packed, - privateExponent *Z -) -{ - int i; - UINT16 primeSize = (UINT16)BITS_TO_BYTES(BnMsb(Z->P)); - UINT16 pS = primeSize; -// - pAssert((primeSize * 5) <= sizeof(packed->t.buffer)); - packed->t.size = (primeSize * 5) + RSA_prime_flag; - for(i = 0; i < 5; i++) - if(!BnToBytes((bigNum)&Z->entries[i], &packed->t.buffer[primeSize * i], &pS)) - return FALSE; - if(pS != primeSize) - return FALSE; - return TRUE; -} - -//*** UnpackExponent() -// This function unpacks the private exponent from its TPM2B form into its bignum -// form. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) TPM2B is not the correct size -static BOOL -UnpackExponent( - TPM2B_PRIVATE_KEY_RSA *b, - privateExponent *Z -) -{ - UINT16 primeSize = b->t.size & ~RSA_prime_flag; - int i; - bigNum *bn = &Z->P; -// - VERIFY(b->t.size & RSA_prime_flag); - RsaInitializeExponent(Z); - VERIFY((primeSize % 5) == 0); - primeSize /= 5; - for(i = 0; i < 5; i++) - VERIFY(BnFromBytes(bn[i], &b->t.buffer[primeSize * i], primeSize) - != NULL); - MakePgreaterThanQ(Z); - return TRUE; -Error: - return FALSE; - } - -//*** ComputePrivateExponent() -// This function computes the private exponent from the primes. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -static BOOL -ComputePrivateExponent( - bigNum pubExp, // IN: the public exponent - privateExponent *Z // IN/OUT: on input, has primes P and Q. On - // output, has P, Q, dP, dQ, and pInv - ) -{ - BOOL pOK; - BOOL qOK; - BN_PRIME(pT); -// - // make p the larger value so that m2 is always less than p - MakePgreaterThanQ(Z); - - //dP = (1/e) mod (p-1) - pOK = BnSubWord(pT, Z->P, 1); - pOK = pOK && BnModInverse(Z->dP, pubExp, pT); - //dQ = (1/e) mod (q-1) - qOK = BnSubWord(pT, Z->Q, 1); - qOK = qOK && BnModInverse(Z->dQ, pubExp, pT); - // qInv = (1/q) mod p - if(pOK && qOK) - pOK = qOK = BnModInverse(Z->qInv, Z->Q, Z->P); - if(!pOK) - BnSetWord(Z->P, 0); - if(!qOK) - BnSetWord(Z->Q, 0); - return pOK && qOK; -} - -//*** RsaPrivateKeyOp() -// This function is called to do the exponentiation with the private key. Compile -// options allow use of the simple (but slow) private exponent, or the more complex -// but faster CRT method. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -static BOOL -RsaPrivateKeyOp( - bigNum inOut, // IN/OUT: number to be exponentiated - privateExponent *Z - ) -{ - BN_RSA(M1); - BN_RSA(M2); - BN_RSA(M); - BN_RSA(H); -// - MakePgreaterThanQ(Z); - // m1 = cdP mod p - VERIFY(BnModExp(M1, inOut, Z->dP, Z->P)); - // m2 = cdQ mod q - VERIFY(BnModExp(M2, inOut, Z->dQ, Z->Q)); - // h = qInv * (m1 - m2) mod p = qInv * (m1 + P - m2) mod P because Q < P - // so m2 < P - VERIFY(BnSub(H, Z->P, M2)); - VERIFY(BnAdd(H, H, M1)); - VERIFY(BnModMult(H, H, Z->qInv, Z->P)); - // m = m2 + h * q - VERIFY(BnMult(M, H, Z->Q)); - VERIFY(BnAdd(inOut, M2, M)); - return TRUE; -Error: - return FALSE; -} - -//*** RSAEP() -// This function performs the RSAEP operation defined in PKCS#1v2.1. It is -// an exponentiation of a value ('m') with the public exponent ('e'), modulo -// the public ('n'). -// -// Return Type: TPM_RC -// TPM_RC_VALUE number to exponentiate is larger than the modulus -// -static TPM_RC -RSAEP( - TPM2B *dInOut, // IN: size of the encrypted block and the size of - // the encrypted value. It must be the size of - // the modulus. - // OUT: the encrypted data. Will receive the - // decrypted value - OBJECT *key // IN: the key to use - ) -{ - TPM2B_TYPE(4BYTES, 4); - TPM2B_4BYTES e2B; - UINT32 e = key->publicArea.parameters.rsaDetail.exponent; -// - if(e == 0) - e = RSA_DEFAULT_PUBLIC_EXPONENT; - UINT32_TO_BYTE_ARRAY(e, e2B.t.buffer); - e2B.t.size = 4; - return ModExpB(dInOut->size, dInOut->buffer, dInOut->size, dInOut->buffer, - e2B.t.size, e2B.t.buffer, key->publicArea.unique.rsa.t.size, - key->publicArea.unique.rsa.t.buffer); -} - -//*** RSADP() -// This function performs the RSADP operation defined in PKCS#1v2.1. It is -// an exponentiation of a value ('c') with the private exponent ('d'), modulo -// the public modulus ('n'). The decryption is in place. -// -// This function also checks the size of the private key. If the size indicates -// that only a prime value is present, the key is converted to being a private -// exponent. -// -// Return Type: TPM_RC -// TPM_RC_SIZE the value to decrypt is larger than the modulus -// -static TPM_RC -RSADP( - TPM2B *inOut, // IN/OUT: the value to encrypt - OBJECT *key // IN: the key - ) -{ - BN_RSA_INITIALIZED(bnM, inOut); - NEW_PRIVATE_EXPONENT(Z); - if(UnsignedCompareB(inOut->size, inOut->buffer, - key->publicArea.unique.rsa.t.size, - key->publicArea.unique.rsa.t.buffer) >= 0) - return TPM_RC_SIZE; - // private key operation requires that private exponent be loaded - // During self-test, this might not be the case so load it up if it hasn't - // already done - // been done - if((key->sensitive.sensitive.rsa.t.size & RSA_prime_flag) == 0) - { - if(CryptRsaLoadPrivateExponent(&key->publicArea, &key->sensitive) - != TPM_RC_SUCCESS) - return TPM_RC_BINDING; - } - VERIFY(UnpackExponent(&key->sensitive.sensitive.rsa, Z)); - VERIFY(RsaPrivateKeyOp(bnM, Z)); - VERIFY(BnTo2B(bnM, inOut, inOut->size)); - return TPM_RC_SUCCESS; -Error: - return TPM_RC_FAILURE; -} - -//*** OaepEncode() -// This function performs OAEP padding. The size of the buffer to receive the -// OAEP padded data must equal the size of the modulus -// -// Return Type: TPM_RC -// TPM_RC_VALUE 'hashAlg' is not valid or message size is too large -// -static TPM_RC -OaepEncode( - TPM2B *padded, // OUT: the pad data - TPM_ALG_ID hashAlg, // IN: algorithm to use for padding - const TPM2B *label, // IN: null-terminated string (may be NULL) - TPM2B *message, // IN: the message being padded - RAND_STATE *rand // IN: the random number generator to use - ) -{ - INT32 padLen; - INT32 dbSize; - INT32 i; - BYTE mySeed[MAX_DIGEST_SIZE]; - BYTE *seed = mySeed; - UINT16 hLen = CryptHashGetDigestSize(hashAlg); - BYTE mask[MAX_RSA_KEY_BYTES]; - BYTE *pp; - BYTE *pm; - TPM_RC retVal = TPM_RC_SUCCESS; - - pAssert(padded != NULL && message != NULL); - - // A value of zero is not allowed because the KDF can't produce a result - // if the digest size is zero. - if(hLen == 0) - return TPM_RC_VALUE; - - // Basic size checks - // make sure digest isn't too big for key size - if(padded->size < (2 * hLen) + 2) - ERROR_RETURN(TPM_RC_HASH); - - // and that message will fit messageSize <= k - 2hLen - 2 - if(message->size > (padded->size - (2 * hLen) - 2)) - ERROR_RETURN(TPM_RC_VALUE); - - // Hash L even if it is null - // Offset into padded leaving room for masked seed and byte of zero - pp = &padded->buffer[hLen + 1]; - if(CryptHashBlock(hashAlg, label->size, (BYTE *)label->buffer, - hLen, pp) != hLen) - ERROR_RETURN(TPM_RC_FAILURE); - - // concatenate PS of k mLen 2hLen 2 - padLen = padded->size - message->size - (2 * hLen) - 2; - MemorySet(&pp[hLen], 0, padLen); - pp[hLen + padLen] = 0x01; - padLen += 1; - memcpy(&pp[hLen + padLen], message->buffer, message->size); - - // The total size of db = hLen + pad + mSize; - dbSize = hLen + padLen + message->size; - - // If testing, then use the provided seed. Otherwise, use values - // from the RNG - CryptRandomGenerate(hLen, mySeed); - DRBG_Generate(rand, mySeed, (UINT16)hLen); - if(g_inFailureMode) - ERROR_RETURN(TPM_RC_FAILURE); - // mask = MGF1 (seed, nSize hLen 1) - CryptMGF1(dbSize, mask, hashAlg, hLen, seed); - - // Create the masked db - pm = mask; - for(i = dbSize; i > 0; i--) - *pp++ ^= *pm++; - pp = &padded->buffer[hLen + 1]; - - // Run the masked data through MGF1 - if(CryptMGF1(hLen, &padded->buffer[1], hashAlg, dbSize, pp) != (unsigned)hLen) - ERROR_RETURN(TPM_RC_VALUE); -// Now XOR the seed to create masked seed - pp = &padded->buffer[1]; - pm = seed; - for(i = hLen; i > 0; i--) - *pp++ ^= *pm++; - // Set the first byte to zero - padded->buffer[0] = 0x00; -Exit: - return retVal; -} - -//*** OaepDecode() -// This function performs OAEP padding checking. The size of the buffer to receive -// the recovered data. If the padding is not valid, the 'dSize' size is set to zero -// and the function returns TPM_RC_VALUE. -// -// The 'dSize' parameter is used as an input to indicate the size available in the -// buffer. - -// If insufficient space is available, the size is not changed and the return code -// is TPM_RC_VALUE. -// -// Return Type: TPM_RC -// TPM_RC_VALUE the value to decode was larger than the modulus, or -// the padding is wrong or the buffer to receive the -// results is too small -// -// -static TPM_RC -OaepDecode( - TPM2B *dataOut, // OUT: the recovered data - TPM_ALG_ID hashAlg, // IN: algorithm to use for padding - const TPM2B *label, // IN: null-terminated string (may be NULL) - TPM2B *padded // IN: the padded data - ) -{ - UINT32 i; - BYTE seedMask[MAX_DIGEST_SIZE]; - UINT32 hLen = CryptHashGetDigestSize(hashAlg); - - BYTE mask[MAX_RSA_KEY_BYTES]; - BYTE *pp; - BYTE *pm; - TPM_RC retVal = TPM_RC_SUCCESS; - - // Strange size (anything smaller can't be an OAEP padded block) - // Also check for no leading 0 - if((padded->size < (unsigned)((2 * hLen) + 2)) || (padded->buffer[0] != 0)) - ERROR_RETURN(TPM_RC_VALUE); -// Use the hash size to determine what to put through MGF1 in order -// to recover the seedMask - CryptMGF1(hLen, seedMask, hashAlg, padded->size - hLen - 1, - &padded->buffer[hLen + 1]); - - // Recover the seed into seedMask - pAssert(hLen <= sizeof(seedMask)); - pp = &padded->buffer[1]; - pm = seedMask; - for(i = hLen; i > 0; i--) - *pm++ ^= *pp++; - - // Use the seed to generate the data mask - CryptMGF1(padded->size - hLen - 1, mask, hashAlg, hLen, seedMask); - - // Use the mask generated from seed to recover the padded data - pp = &padded->buffer[hLen + 1]; - pm = mask; - for(i = (padded->size - hLen - 1); i > 0; i--) - *pm++ ^= *pp++; - - // Make sure that the recovered data has the hash of the label - // Put trial value in the seed mask - if((CryptHashBlock(hashAlg, label->size, (BYTE *)label->buffer, - hLen, seedMask)) != hLen) - FAIL(FATAL_ERROR_INTERNAL); - if(memcmp(seedMask, mask, hLen) != 0) - ERROR_RETURN(TPM_RC_VALUE); - - // find the start of the data - pm = &mask[hLen]; - for(i = (UINT32)padded->size - (2 * hLen) - 1; i > 0; i--) - { - if(*pm++ != 0) - break; - } - // If we ran out of data or didn't end with 0x01, then return an error - if(i == 0 || pm[-1] != 0x01) - ERROR_RETURN(TPM_RC_VALUE); - - // pm should be pointing at the first part of the data - // and i is one greater than the number of bytes to move - i--; - if(i > dataOut->size) - // Special exit to preserve the size of the output buffer - return TPM_RC_VALUE; - memcpy(dataOut->buffer, pm, i); - dataOut->size = (UINT16)i; -Exit: - if(retVal != TPM_RC_SUCCESS) - dataOut->size = 0; - return retVal; -} - -//*** PKCS1v1_5Encode() -// This function performs the encoding for RSAES-PKCS1-V1_5-ENCRYPT as defined in -// PKCS#1V2.1 -// Return Type: TPM_RC -// TPM_RC_VALUE message size is too large -// -static TPM_RC -RSAES_PKCS1v1_5Encode( - TPM2B *padded, // OUT: the pad data - TPM2B *message, // IN: the message being padded - RAND_STATE *rand - ) -{ - UINT32 ps = padded->size - message->size - 3; -// - if(message->size > padded->size - 11) - return TPM_RC_VALUE; - // move the message to the end of the buffer - memcpy(&padded->buffer[padded->size - message->size], message->buffer, - message->size); - // Set the first byte to 0x00 and the second to 0x02 - padded->buffer[0] = 0; - padded->buffer[1] = 2; - - // Fill with random bytes - DRBG_Generate(rand, &padded->buffer[2], (UINT16)ps); - if(g_inFailureMode) - return TPM_RC_FAILURE; - - // Set the delimiter for the random field to 0 - padded->buffer[2 + ps] = 0; - - // Now, the only messy part. Make sure that all the 'ps' bytes are non-zero - // In this implementation, use the value of the current index - for(ps++; ps > 1; ps--) - { - if(padded->buffer[ps] == 0) - padded->buffer[ps] = 0x55; // In the < 0.5% of the cases that the - // random value is 0, just pick a value to - // put into the spot. - } - return TPM_RC_SUCCESS; -} - -//*** RSAES_Decode() -// This function performs the decoding for RSAES-PKCS1-V1_5-ENCRYPT as defined in -// PKCS#1V2.1 -// -// Return Type: TPM_RC -// TPM_RC_FAIL decoding error or results would no fit into provided buffer -// -static TPM_RC -RSAES_Decode( - TPM2B *message, // OUT: the recovered message - TPM2B *coded // IN: the encoded message - ) -{ - BOOL fail = FALSE; - UINT16 pSize; - - fail = (coded->size < 11); - fail = (coded->buffer[0] != 0x00) | fail; - fail = (coded->buffer[1] != 0x02) | fail; - for(pSize = 2; pSize < coded->size; pSize++) - { - if(coded->buffer[pSize] == 0) - break; - } - pSize++; - - // Make sure that pSize has not gone over the end and that there are at least 8 - // bytes of pad data. - fail = (pSize > coded->size) | fail; - fail = ((pSize - 2) < 8) | fail; - if((message->size < (UINT16)(coded->size - pSize)) || fail) - return TPM_RC_VALUE; - message->size = coded->size - pSize; - memcpy(message->buffer, &coded->buffer[pSize], coded->size - pSize); - return TPM_RC_SUCCESS; -} - -//*** CryptRsaPssSaltSize() -// This function computes the salt size used in PSS. It is broken out so that -// the X509 code can get the same value that is used by the encoding function in this -// module. -INT16 -CryptRsaPssSaltSize( - INT16 hashSize, - INT16 outSize -) -{ - INT16 saltSize; -// - // (Mask Length) = (outSize - hashSize - 1); - // Max saltSize is (Mask Length) - 1 - saltSize = (outSize - hashSize - 1) - 1; - // Use the maximum salt size allowed by FIPS 186-4 - if(saltSize > hashSize) - saltSize = hashSize; - else if(saltSize < 0) - saltSize = 0; - return saltSize; -} - -//*** PssEncode() -// This function creates an encoded block of data that is the size of modulus. -// The function uses the maximum salt size that will fit in the encoded block. -// -// Returns TPM_RC_SUCCESS or goes into failure mode. -static TPM_RC -PssEncode( - TPM2B *out, // OUT: the encoded buffer - TPM_ALG_ID hashAlg, // IN: hash algorithm for the encoding - TPM2B *digest, // IN: the digest - RAND_STATE *rand // IN: random number source - ) -{ - UINT32 hLen = CryptHashGetDigestSize(hashAlg); - BYTE salt[MAX_RSA_KEY_BYTES - 1]; - UINT16 saltSize; - BYTE *ps = salt; - BYTE *pOut; - UINT16 mLen; - HASH_STATE hashState; - - // These are fatal errors indicating bad TPM firmware - pAssert(out != NULL && hLen > 0 && digest != NULL); - - // Get the size of the mask - mLen = (UINT16)(out->size - hLen - 1); - - // Set the salt size - saltSize = CryptRsaPssSaltSize((INT16)hLen, (INT16)out->size); - -//using eOut for scratch space - // Set the first 8 bytes to zero - pOut = out->buffer; - memset(pOut, 0, 8); - - // Get set the salt - DRBG_Generate(rand, salt, saltSize); - if(g_inFailureMode) - return TPM_RC_FAILURE; - - // Create the hash of the pad || input hash || salt - CryptHashStart(&hashState, hashAlg); - CryptDigestUpdate(&hashState, 8, pOut); - CryptDigestUpdate2B(&hashState, digest); - CryptDigestUpdate(&hashState, saltSize, salt); - CryptHashEnd(&hashState, hLen, &pOut[out->size - hLen - 1]); - - // Create a mask - if(CryptMGF1(mLen, pOut, hashAlg, hLen, &pOut[mLen]) != mLen) - FAIL(FATAL_ERROR_INTERNAL); - - // Since this implementation uses key sizes that are all even multiples of - // 8, just need to make sure that the most significant bit is CLEAR - *pOut &= 0x7f; - - // Before we mess up the pOut value, set the last byte to 0xbc - pOut[out->size - 1] = 0xbc; - - // XOR a byte of 0x01 at the position just before where the salt will be XOR'ed - pOut = &pOut[mLen - saltSize - 1]; - *pOut++ ^= 0x01; - - // XOR the salt data into the buffer - for(; saltSize > 0; saltSize--) - *pOut++ ^= *ps++; - - // and we are done - return TPM_RC_SUCCESS; -} - -//*** PssDecode() -// This function checks that the PSS encoded block was built from the -// provided digest. If the check is successful, TPM_RC_SUCCESS is returned. -// Any other value indicates an error. -// -// This implementation of PSS decoding is intended for the reference TPM -// implementation and is not at all generalized. It is used to check -// signatures over hashes and assumptions are made about the sizes of values. -// Those assumptions are enforce by this implementation. -// This implementation does allow for a variable size salt value to have been -// used by the creator of the signature. -// -// Return Type: TPM_RC -// TPM_RC_SCHEME 'hashAlg' is not a supported hash algorithm -// TPM_RC_VALUE decode operation failed -// -static TPM_RC -PssDecode( - TPM_ALG_ID hashAlg, // IN: hash algorithm to use for the encoding - TPM2B *dIn, // In: the digest to compare - TPM2B *eIn // IN: the encoded data - ) -{ - UINT32 hLen = CryptHashGetDigestSize(hashAlg); - BYTE mask[MAX_RSA_KEY_BYTES]; - BYTE *pm = mask; - BYTE *pe; - BYTE pad[8] = {0}; - UINT32 i; - UINT32 mLen; - BYTE fail; - TPM_RC retVal = TPM_RC_SUCCESS; - HASH_STATE hashState; - - // These errors are indicative of failures due to programmer error - pAssert(dIn != NULL && eIn != NULL); - pe = eIn->buffer; - - // check the hash scheme - if(hLen == 0) - ERROR_RETURN(TPM_RC_SCHEME); - - // most significant bit must be zero - fail = pe[0] & 0x80; - - // last byte must be 0xbc - fail |= pe[eIn->size - 1] ^ 0xbc; - - // Use the hLen bytes at the end of the buffer to generate a mask - // Doesn't start at the end which is a flag byte - mLen = eIn->size - hLen - 1; - CryptMGF1(mLen, mask, hashAlg, hLen, &pe[mLen]); - - // Clear the MSO of the mask to make it consistent with the encoding. - mask[0] &= 0x7F; - - pAssert(mLen <= sizeof(mask)); - // XOR the data into the mask to recover the salt. This sequence - // advances eIn so that it will end up pointing to the seed data - // which is the hash of the signature data - for(i = mLen; i > 0; i--) - *pm++ ^= *pe++; - - // Find the first byte of 0x01 after a string of all 0x00 - for(pm = mask, i = mLen; i > 0; i--) - { - if(*pm == 0x01) - break; - else - fail |= *pm++; - } - // i should not be zero - fail |= (i == 0); - - // if we have failed, will continue using the entire mask as the salt value so - // that the timing attacks will not disclose anything (I don't think that this - // is a problem for TPM applications but, usually, we don't fail so this - // doesn't cost anything). - if(fail) - { - i = mLen; - pm = mask; - } - else - { - pm++; - i--; - } - // i contains the salt size and pm points to the salt. Going to use the input - // hash and the seed to recreate the hash in the lower portion of eIn. - CryptHashStart(&hashState, hashAlg); - - // add the pad of 8 zeros - CryptDigestUpdate(&hashState, 8, pad); - - // add the provided digest value - CryptDigestUpdate(&hashState, dIn->size, dIn->buffer); - - // and the salt - CryptDigestUpdate(&hashState, i, pm); - - // get the result - fail |= (CryptHashEnd(&hashState, hLen, mask) != hLen); - - // Compare all bytes - for(pm = mask; hLen > 0; hLen--) - // don't use fail = because that could skip the increment and compare - // operations after the first failure and that gives away timing - // information. - fail |= *pm++ ^ *pe++; - - retVal = (fail != 0) ? TPM_RC_VALUE : TPM_RC_SUCCESS; -Exit: - return retVal; -} - -//*** MakeDerTag() -// Construct the DER value that is used in RSASSA -// Return Type: INT16 -// > 0 size of value -// <= 0 no hash exists -INT16 -MakeDerTag( - TPM_ALG_ID hashAlg, - INT16 sizeOfBuffer, - BYTE *buffer -) -{ -// 0x30, 0x31, // SEQUENCE (2 elements) 1st -// 0x30, 0x0D, // SEQUENCE (2 elements) -// 0x06, 0x09, // HASH OID -// 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, -// 0x05, 0x00, // NULL -// 0x04, 0x20 // OCTET STRING - HASH_DEF *info = CryptGetHashDef(hashAlg); - INT16 oidSize; - // If no OID, can't do encode - VERIFY(info != NULL); - oidSize = 2 + (info->OID)[1]; - // make sure this fits in the buffer - VERIFY(sizeOfBuffer >= (oidSize + 8)); - *buffer++ = 0x30; // 1st SEQUENCE - // Size of the 1st SEQUENCE is 6 bytes + size of the hash OID + size of the - // digest size - *buffer++ = (BYTE)(6 + oidSize + info->digestSize); // - *buffer++ = 0x30; // 2nd SEQUENCE - // size is 4 bytes of overhead plus the side of the OID - *buffer++ = (BYTE)(2 + oidSize); - MemoryCopy(buffer, info->OID, oidSize); - buffer += oidSize; - *buffer++ = 0x05; // Add a NULL - *buffer++ = 0x00; - - *buffer++ = 0x04; - *buffer++ = (BYTE)(info->digestSize); - return oidSize + 8; -Error: - return 0; - -} - -//*** RSASSA_Encode() -// Encode a message using PKCS1v1.5 method. -// -// Return Type: TPM_RC -// TPM_RC_SCHEME 'hashAlg' is not a supported hash algorithm -// TPM_RC_SIZE 'eOutSize' is not large enough -// TPM_RC_VALUE 'hInSize' does not match the digest size of hashAlg -static TPM_RC -RSASSA_Encode( - TPM2B *pOut, // IN:OUT on in, the size of the public key - // on out, the encoded area - TPM_ALG_ID hashAlg, // IN: hash algorithm for PKCS1v1_5 - TPM2B *hIn // IN: digest value to encode - ) -{ - BYTE DER[20]; - BYTE *der = DER; - INT32 derSize = MakeDerTag(hashAlg, sizeof(DER), DER); - BYTE *eOut; - INT32 fillSize; - TPM_RC retVal = TPM_RC_SUCCESS; - - // Can't use this scheme if the algorithm doesn't have a DER string defined. - if(derSize == 0) - ERROR_RETURN(TPM_RC_SCHEME); - - // If the digest size of 'hashAl' doesn't match the input digest size, then - // the DER will misidentify the digest so return an error - if(CryptHashGetDigestSize(hashAlg) != hIn->size) - ERROR_RETURN(TPM_RC_VALUE); - fillSize = pOut->size - derSize - hIn->size - 3; - eOut = pOut->buffer; - - // Make sure that this combination will fit in the provided space - if(fillSize < 8) - ERROR_RETURN(TPM_RC_SIZE); - - // Start filling - *eOut++ = 0; // initial byte of zero - *eOut++ = 1; // byte of 0x01 - for(; fillSize > 0; fillSize--) - *eOut++ = 0xff; // bunch of 0xff - *eOut++ = 0; // another 0 - for(; derSize > 0; derSize--) - *eOut++ = *der++; // copy the DER - der = hIn->buffer; - for(fillSize = hIn->size; fillSize > 0; fillSize--) - *eOut++ = *der++; // copy the hash -Exit: - return retVal; -} - -//*** RSASSA_Decode() -// This function performs the RSASSA decoding of a signature. -// -// Return Type: TPM_RC -// TPM_RC_VALUE decode unsuccessful -// TPM_RC_SCHEME 'haslAlg' is not supported -// -static TPM_RC -RSASSA_Decode( - TPM_ALG_ID hashAlg, // IN: hash algorithm to use for the encoding - TPM2B *hIn, // In: the digest to compare - TPM2B *eIn // IN: the encoded data - ) -{ - BYTE fail; - BYTE DER[20]; - BYTE *der = DER; - INT32 derSize = MakeDerTag(hashAlg, sizeof(DER), DER); - BYTE *pe; - INT32 hashSize = CryptHashGetDigestSize(hashAlg); - INT32 fillSize; - TPM_RC retVal; - BYTE *digest; - UINT16 digestSize; - - pAssert(hIn != NULL && eIn != NULL); - pe = eIn->buffer; - - // Can't use this scheme if the algorithm doesn't have a DER string - // defined or if the provided hash isn't the right size - if(derSize == 0 || (unsigned)hashSize != hIn->size) - ERROR_RETURN(TPM_RC_SCHEME); - - // Make sure that this combination will fit in the provided space - // Since no data movement takes place, can just walk though this - // and accept nearly random values. This can only be called from - // CryptValidateSignature() so eInSize is known to be in range. - fillSize = eIn->size - derSize - hashSize - 3; - - // Start checking (fail will become non-zero if any of the bytes do not have - // the expected value. - fail = *pe++; // initial byte of zero - fail |= *pe++ ^ 1; // byte of 0x01 - for(; fillSize > 0; fillSize--) - fail |= *pe++ ^ 0xff; // bunch of 0xff - fail |= *pe++; // another 0 - for(; derSize > 0; derSize--) - fail |= *pe++ ^ *der++; // match the DER - digestSize = hIn->size; - digest = hIn->buffer; - for(; digestSize > 0; digestSize--) - fail |= *pe++ ^ *digest++; // match the hash - retVal = (fail != 0) ? TPM_RC_VALUE : TPM_RC_SUCCESS; -Exit: - return retVal; -} - -//** Externally Accessible Functions - -//*** CryptRsaSelectScheme() -// This function is used by TPM2_RSA_Decrypt and TPM2_RSA_Encrypt. It sets up -// the rules to select a scheme between input and object default. -// This function assume the RSA object is loaded. -// If a default scheme is defined in object, the default scheme should be chosen, -// otherwise, the input scheme should be chosen. -// In the case that both the object and 'scheme' are not TPM_ALG_NULL, then -// if the schemes are the same, the input scheme will be chosen. -// if the scheme are not compatible, a NULL pointer will be returned. -// -// The return pointer may point to a TPM_ALG_NULL scheme. -TPMT_RSA_DECRYPT* -CryptRsaSelectScheme( - TPMI_DH_OBJECT rsaHandle, // IN: handle of an RSA key - TPMT_RSA_DECRYPT *scheme // IN: a sign or decrypt scheme - ) -{ - OBJECT *rsaObject; - TPMT_ASYM_SCHEME *keyScheme; - TPMT_RSA_DECRYPT *retVal = NULL; - - // Get sign object pointer - rsaObject = HandleToObject(rsaHandle); - keyScheme = &rsaObject->publicArea.parameters.asymDetail.scheme; - - // if the default scheme of the object is TPM_ALG_NULL, then select the - // input scheme - if(keyScheme->scheme == TPM_ALG_NULL) - { - retVal = scheme; - } - // if the object scheme is not TPM_ALG_NULL and the input scheme is - // TPM_ALG_NULL, then select the default scheme of the object. - else if(scheme->scheme == TPM_ALG_NULL) - { - // if input scheme is NULL - retVal = (TPMT_RSA_DECRYPT *)keyScheme; - } - // get here if both the object scheme and the input scheme are - // not TPM_ALG_NULL. Need to insure that they are the same. - // IMPLEMENTATION NOTE: This could cause problems if future versions have - // schemes that have more values than just a hash algorithm. A new function - // (IsSchemeSame()) might be needed then. - else if(keyScheme->scheme == scheme->scheme - && keyScheme->details.anySig.hashAlg == scheme->details.anySig.hashAlg) - { - retVal = scheme; - } - // two different, incompatible schemes specified will return NULL - return retVal; -} - -//*** CryptRsaLoadPrivateExponent() -// This function is called to generate the private exponent of an RSA key. -// Return Type: TPM_RC -// TPM_RC_BINDING public and private parts of 'rsaKey' are not matched -TPM_RC -CryptRsaLoadPrivateExponent( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive - ) -{ -// - if((sensitive->sensitive.rsa.t.size & RSA_prime_flag) == 0) - { - if((sensitive->sensitive.rsa.t.size * 2) == publicArea->unique.rsa.t.size) - { - NEW_PRIVATE_EXPONENT(Z); - BN_RSA_INITIALIZED(bnN, &publicArea->unique.rsa); - BN_RSA(bnQr); - BN_VAR(bnE, RADIX_BITS); - - TEST(ALG_NULL_VALUE); - - VERIFY((sensitive->sensitive.rsa.t.size * 2) - == publicArea->unique.rsa.t.size); - // Initialize the exponent - BnSetWord(bnE, publicArea->parameters.rsaDetail.exponent); - if(BnEqualZero(bnE)) - BnSetWord(bnE, RSA_DEFAULT_PUBLIC_EXPONENT); - // Convert first prime to 2B - VERIFY(BnFrom2B(Z->P, &sensitive->sensitive.rsa.b) != NULL); - - // Find the second prime by division. This uses 'bQ' rather than Z->Q - // because the division could make the quotient larger than a prime during - // some intermediate step. - VERIFY(BnDiv(Z->Q, bnQr, bnN, Z->P)); - VERIFY(BnEqualZero(bnQr)); - // Compute the private exponent and return it if found - VERIFY(ComputePrivateExponent(bnE, Z)); - VERIFY(PackExponent(&sensitive->sensitive.rsa, Z)); - } - else - VERIFY(((sensitive->sensitive.rsa.t.size / 5) * 2) - == publicArea->unique.rsa.t.size); - sensitive->sensitive.rsa.t.size |= RSA_prime_flag; - } - return TPM_RC_SUCCESS; -Error: - return TPM_RC_BINDING; -} - -//*** CryptRsaEncrypt() -// This is the entry point for encryption using RSA. Encryption is -// use of the public exponent. The padding parameter determines what -// padding will be used. -// -// The 'cOutSize' parameter must be at least as large as the size of the key. -// -// If the padding is RSA_PAD_NONE, 'dIn' is treated as a number. It must be -// lower in value than the key modulus. -// NOTE: If dIn has fewer bytes than cOut, then we don't add low-order zeros to -// dIn to make it the size of the RSA key for the call to RSAEP. This is -// because the high order bytes of dIn might have a numeric value that is -// greater than the value of the key modulus. If this had low-order zeros -// added, it would have a numeric value larger than the modulus even though -// it started out with a lower numeric value. -// -// Return Type: TPM_RC -// TPM_RC_VALUE 'cOutSize' is too small (must be the size -// of the modulus) -// TPM_RC_SCHEME 'padType' is not a supported scheme -// -LIB_EXPORT TPM_RC -CryptRsaEncrypt( - TPM2B_PUBLIC_KEY_RSA *cOut, // OUT: the encrypted data - TPM2B *dIn, // IN: the data to encrypt - OBJECT *key, // IN: the key used for encryption - TPMT_RSA_DECRYPT *scheme, // IN: the type of padding and hash - // if needed - const TPM2B *label, // IN: in case it is needed - RAND_STATE *rand // IN: random number generator - // state (mostly for testing) - ) -{ - TPM_RC retVal = TPM_RC_SUCCESS; - TPM2B_PUBLIC_KEY_RSA dataIn; -// - // if the input and output buffers are the same, copy the input to a scratch - // buffer so that things don't get messed up. - if(dIn == &cOut->b) - { - MemoryCopy2B(&dataIn.b, dIn, sizeof(dataIn.t.buffer)); - dIn = &dataIn.b; - } - // All encryption schemes return the same size of data - cOut->t.size = key->publicArea.unique.rsa.t.size; - TEST(scheme->scheme); - - switch(scheme->scheme) - { - case ALG_NULL_VALUE: // 'raw' encryption - { - INT32 i; - INT32 dSize = dIn->size; - // dIn can have more bytes than cOut as long as the extra bytes - // are zero. Note: the more significant bytes of a number in a byte - // buffer are the bytes at the start of the array. - for(i = 0; (i < dSize) && (dIn->buffer[i] == 0); i++); - dSize -= i; - if(dSize > cOut->t.size) - ERROR_RETURN(TPM_RC_VALUE); - // Pad cOut with zeros if dIn is smaller - memset(cOut->t.buffer, 0, cOut->t.size - dSize); - // And copy the rest of the value - memcpy(&cOut->t.buffer[cOut->t.size - dSize], &dIn->buffer[i], dSize); - - // If the size of dIn is the same as cOut dIn could be larger than - // the modulus. If it is, then RSAEP() will catch it. - } - break; - case ALG_RSAES_VALUE: - retVal = RSAES_PKCS1v1_5Encode(&cOut->b, dIn, rand); - break; - case ALG_OAEP_VALUE: - retVal = OaepEncode(&cOut->b, scheme->details.oaep.hashAlg, label, dIn, - rand); - break; - default: - ERROR_RETURN(TPM_RC_SCHEME); - break; - } - // All the schemes that do padding will come here for the encryption step - // Check that the Encoding worked - if(retVal == TPM_RC_SUCCESS) - // Padding OK so do the encryption - retVal = RSAEP(&cOut->b, key); -Exit: - return retVal; -} - -//*** CryptRsaDecrypt() -// This is the entry point for decryption using RSA. Decryption is -// use of the private exponent. The 'padType' parameter determines what -// padding was used. -// -// Return Type: TPM_RC -// TPM_RC_SIZE 'cInSize' is not the same as the size of the public -// modulus of 'key'; or numeric value of the encrypted -// data is greater than the modulus -// TPM_RC_VALUE 'dOutSize' is not large enough for the result -// TPM_RC_SCHEME 'padType' is not supported -// -LIB_EXPORT TPM_RC -CryptRsaDecrypt( - TPM2B *dOut, // OUT: the decrypted data - TPM2B *cIn, // IN: the data to decrypt - OBJECT *key, // IN: the key to use for decryption - TPMT_RSA_DECRYPT *scheme, // IN: the padding scheme - const TPM2B *label // IN: in case it is needed for the scheme - ) -{ - TPM_RC retVal; - - // Make sure that the necessary parameters are provided - pAssert(cIn != NULL && dOut != NULL && key != NULL); - - // Size is checked to make sure that the encrypted value is the right size - if(cIn->size != key->publicArea.unique.rsa.t.size) - ERROR_RETURN(TPM_RC_SIZE); - - TEST(scheme->scheme); - - // For others that do padding, do the decryption in place and then - // go handle the decoding. - retVal = RSADP(cIn, key); - if(retVal == TPM_RC_SUCCESS) - { - // Remove padding - switch(scheme->scheme) - { - case ALG_NULL_VALUE: - if(dOut->size < cIn->size) - return TPM_RC_VALUE; - MemoryCopy2B(dOut, cIn, dOut->size); - break; - case ALG_RSAES_VALUE: - retVal = RSAES_Decode(dOut, cIn); - break; - case ALG_OAEP_VALUE: - retVal = OaepDecode(dOut, scheme->details.oaep.hashAlg, label, cIn); - break; - default: - retVal = TPM_RC_SCHEME; - break; - } - } -Exit: - return retVal; -} - -//*** CryptRsaSign() -// This function is used to generate an RSA signature of the type indicated in -// 'scheme'. -// -// Return Type: TPM_RC -// TPM_RC_SCHEME 'scheme' or 'hashAlg' are not supported -// TPM_RC_VALUE 'hInSize' does not match 'hashAlg' (for RSASSA) -// -LIB_EXPORT TPM_RC -CryptRsaSign( - TPMT_SIGNATURE *sigOut, - OBJECT *key, // IN: key to use - TPM2B_DIGEST *hIn, // IN: the digest to sign - RAND_STATE *rand // IN: the random number generator - // to use (mostly for testing) - ) -{ - TPM_RC retVal = TPM_RC_SUCCESS; - UINT16 modSize; - - // parameter checks - pAssert(sigOut != NULL && key != NULL && hIn != NULL); - - modSize = key->publicArea.unique.rsa.t.size; - - // for all non-null signatures, the size is the size of the key modulus - sigOut->signature.rsapss.sig.t.size = modSize; - - TEST(sigOut->sigAlg); - - switch(sigOut->sigAlg) - { - case ALG_NULL_VALUE: - sigOut->signature.rsapss.sig.t.size = 0; - return TPM_RC_SUCCESS; - case ALG_RSAPSS_VALUE: - retVal = PssEncode(&sigOut->signature.rsapss.sig.b, - sigOut->signature.rsapss.hash, &hIn->b, rand); - break; - case ALG_RSASSA_VALUE: - retVal = RSASSA_Encode(&sigOut->signature.rsassa.sig.b, - sigOut->signature.rsassa.hash, &hIn->b); - break; - default: - retVal = TPM_RC_SCHEME; - } - if(retVal == TPM_RC_SUCCESS) - { - // Do the encryption using the private key - retVal = RSADP(&sigOut->signature.rsapss.sig.b, key); - } - return retVal; -} - -//*** CryptRsaValidateSignature() -// This function is used to validate an RSA signature. If the signature is valid -// TPM_RC_SUCCESS is returned. If the signature is not valid, TPM_RC_SIGNATURE is -// returned. Other return codes indicate either parameter problems or fatal errors. -// -// Return Type: TPM_RC -// TPM_RC_SIGNATURE the signature does not check -// TPM_RC_SCHEME unsupported scheme or hash algorithm -// -LIB_EXPORT TPM_RC -CryptRsaValidateSignature( - TPMT_SIGNATURE *sig, // IN: signature - OBJECT *key, // IN: public modulus - TPM2B_DIGEST *digest // IN: The digest being validated - ) -{ - TPM_RC retVal; -// - // Fatal programming errors - pAssert(key != NULL && sig != NULL && digest != NULL); - switch(sig->sigAlg) - { - case ALG_RSAPSS_VALUE: - case ALG_RSASSA_VALUE: - break; - default: - return TPM_RC_SCHEME; - } - - // Errors that might be caused by calling parameters - if(sig->signature.rsassa.sig.t.size != key->publicArea.unique.rsa.t.size) - ERROR_RETURN(TPM_RC_SIGNATURE); - - TEST(sig->sigAlg); - - // Decrypt the block - retVal = RSAEP(&sig->signature.rsassa.sig.b, key); - if(retVal == TPM_RC_SUCCESS) - { - switch(sig->sigAlg) - { - case ALG_RSAPSS_VALUE: - retVal = PssDecode(sig->signature.any.hashAlg, &digest->b, - &sig->signature.rsassa.sig.b); - break; - case ALG_RSASSA_VALUE: - retVal = RSASSA_Decode(sig->signature.any.hashAlg, &digest->b, - &sig->signature.rsassa.sig.b); - break; - default: - return TPM_RC_SCHEME; - } - } -Exit: - return (retVal != TPM_RC_SUCCESS) ? TPM_RC_SIGNATURE : TPM_RC_SUCCESS; -} - -#if SIMULATION && USE_RSA_KEY_CACHE -extern int s_rsaKeyCacheEnabled; -int GetCachedRsaKey(TPMT_PUBLIC *publicArea, TPMT_SENSITIVE *sensitive, - RAND_STATE *rand); -#define GET_CACHED_KEY(publicArea, sensitive, rand) \ - (s_rsaKeyCacheEnabled && GetCachedRsaKey(publicArea, sensitive, rand)) -#else -#define GET_CACHED_KEY(key, rand) -#endif - -//*** CryptRsaGenerateKey() -// Generate an RSA key from a provided seed -/*(See part 1 specification) -// The formulation is: -// KDFa(hash, seed, label, Name, Counter, bits) -// Where: -// hash the nameAlg from the public template -// seed a seed (will be a primary seed for a primary key) -// label a distinguishing label including vendor ID and -// vendor-assigned part number for the TPM. -// Name the nameAlg from the template and the hash of the template -// using nameAlg. -// Counter a 32-bit integer that is incremented each time the KDF is -// called in order to produce a specific key. This value -// can be a 32-bit integer in host format and does not need -// to be put in canonical form. -// bits the number of bits needed for the key. -// The following process is implemented to find a RSA key pair: -// 1. pick a random number with enough bits from KDFa as a prime candidate -// 2. set the first two significant bits and the least significant bit of the -// prime candidate -// 3. check if the number is a prime. if not, pick another random number -// 4. Make sure the difference between the two primes are more than 2^104. -// Otherwise, restart the process for the second prime -// 5. If the counter has reached its maximum but we still can not find a valid -// RSA key pair, return an internal error. This is an artificial bound. -// Other implementation may choose a smaller number to indicate how many -// times they are willing to try. -*/ -// Return Type: TPM_RC -// TPM_RC_CANCELED operation was canceled -// TPM_RC_RANGE public exponent is not supported -// TPM_RC_VALUE could not find a prime using the provided parameters -LIB_EXPORT TPM_RC -CryptRsaGenerateKey( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive, - RAND_STATE *rand // IN: if not NULL, the deterministic - // RNG state - ) -{ - UINT32 i; - BN_RSA(bnD); - BN_RSA(bnN); - BN_WORD(bnPubExp); - UINT32 e = publicArea->parameters.rsaDetail.exponent; - int keySizeInBits; - TPM_RC retVal = TPM_RC_NO_RESULT; - NEW_PRIVATE_EXPONENT(Z); -// - -// Need to make sure that the caller did not specify an exponent that is -// not supported - e = publicArea->parameters.rsaDetail.exponent; - if(e == 0) - e = RSA_DEFAULT_PUBLIC_EXPONENT; - else - { - if(e < 65537) - ERROR_RETURN(TPM_RC_RANGE); - // Check that e is prime - if(!IsPrimeInt(e)) - ERROR_RETURN(TPM_RC_RANGE); - } - BnSetWord(bnPubExp, e); - - // check for supported key size. - keySizeInBits = publicArea->parameters.rsaDetail.keyBits; - if(((keySizeInBits % 1024) != 0) - || (keySizeInBits > MAX_RSA_KEY_BITS) // this might be redundant, but... - || (keySizeInBits == 0)) - ERROR_RETURN(TPM_RC_VALUE); - - // Set the prime size for instrumentation purposes - INSTRUMENT_SET(PrimeIndex, PRIME_INDEX(keySizeInBits / 2)); - -#if SIMULATION && USE_RSA_KEY_CACHE - if(GET_CACHED_KEY(publicArea, sensitive, rand)) - return TPM_RC_SUCCESS; -#endif - - // Make sure that key generation has been tested - TEST(ALG_NULL_VALUE); - - - // The prime is computed in P. When a new prime is found, Q is checked to - // see if it is zero. If so, P is copied to Q and a new P is found. - // When both P and Q are non-zero, the modulus and - // private exponent are computed and a trial encryption/decryption is - // performed. If the encrypt/decrypt fails, assume that at least one of the - // primes is composite. Since we don't know which one, set Q to zero and start - // over and find a new pair of primes. - - for(i = 1; (retVal == TPM_RC_NO_RESULT) && (i != 100); i++) - { - if(_plat__IsCanceled()) - ERROR_RETURN(TPM_RC_CANCELED); - - if(BnGeneratePrimeForRSA(Z->P, keySizeInBits / 2, e, rand) == TPM_RC_FAILURE) - { - retVal = TPM_RC_FAILURE; - goto Exit; - } - - INSTRUMENT_INC(PrimeCounts[PrimeIndex]); - - // If this is the second prime, make sure that it differs from the - // first prime by at least 2^100 - if(BnEqualZero(Z->Q)) - { - // copy p to q and compute another prime in p - BnCopy(Z->Q, Z->P); - continue; - } - // Make sure that the difference is at least 100 bits. Need to do it this - // way because the big numbers are only positive values - if(BnUnsignedCmp(Z->P, Z->Q) < 0) - BnSub(bnD, Z->Q, Z->P); - else - BnSub(bnD, Z->P, Z->Q); - if(BnMsb(bnD) < 100) - continue; - - //Form the public modulus and set the unique value - BnMult(bnN, Z->P, Z->Q); - BnTo2B(bnN, &publicArea->unique.rsa.b, - (NUMBYTES)BITS_TO_BYTES(keySizeInBits)); - // Make sure everything came out right. The MSb of the values must be one - if(((publicArea->unique.rsa.t.buffer[0] & 0x80) == 0) - || (publicArea->unique.rsa.t.size - != (NUMBYTES)BITS_TO_BYTES(keySizeInBits))) - FAIL(FATAL_ERROR_INTERNAL); - - - // Make sure that we can form the private exponent values - if(ComputePrivateExponent(bnPubExp, Z) != TRUE) - { - // If ComputePrivateExponent could not find an inverse for - // Q, then copy P and recompute P. This might - // cause both to be recomputed if P is also zero - if(BnEqualZero(Z->Q)) - BnCopy(Z->Q, Z->P); - continue; - } - - // Pack the private exponent into the sensitive area - PackExponent(&sensitive->sensitive.rsa, Z); - // Make sure everything came out right. The MSb of the values must be one - if(((publicArea->unique.rsa.t.buffer[0] & 0x80) == 0) - || ((sensitive->sensitive.rsa.t.buffer[0] & 0x80) == 0)) - FAIL(FATAL_ERROR_INTERNAL); - - retVal = TPM_RC_SUCCESS; - // Do a trial encryption decryption if this is a signing key - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign)) - { - BN_RSA(temp1); - BN_RSA(temp2); - BnGenerateRandomInRange(temp1, bnN, rand); - - // Encrypt with public exponent... - BnModExp(temp2, temp1, bnPubExp, bnN); - // ... then decrypt with private exponent - RsaPrivateKeyOp(temp2, Z); - - // If the starting and ending values are not the same, - // start over )-; - if(BnUnsignedCmp(temp2, temp1) != 0) - { - BnSetWord(Z->Q, 0); - retVal = TPM_RC_NO_RESULT; - } - } - } -Exit: - return retVal; -} - -#endif // ALG_RSA \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSelfTest.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSelfTest.c deleted file mode 100644 index 33b312e64..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSelfTest.c +++ /dev/null @@ -1,222 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// The functions in this file are designed to support self-test of cryptographic -// functions in the TPM. The TPM allows the user to decide whether to run self-test -// on a demand basis or to run all the self-tests before proceeding. -// -// The self-tests are controlled by a set of bit vectors. The -// 'g_untestedDecryptionAlgorithms' vector has a bit for each decryption algorithm -// that needs to be tested and 'g_untestedEncryptionAlgorithms' has a bit for -// each encryption algorithm that needs to be tested. Before an algorithm -// is used, the appropriate vector is checked (indexed using the algorithm ID). -// If the bit is 1, then the test function should be called. -// -// For more information, see TpmSelfTests.txt - -#include "Tpm.h" - -//** Functions - -//*** RunSelfTest() -// Local function to run self-test -static TPM_RC -CryptRunSelfTests( - ALGORITHM_VECTOR *toTest // IN: the vector of the algorithms to test - ) -{ - TPM_ALG_ID alg; - - // For each of the algorithms that are in the toTestVecor, need to run a - // test - for(alg = TPM_ALG_FIRST; alg <= TPM_ALG_LAST; alg++) - { - if(TEST_BIT(alg, *toTest)) - { - TPM_RC result = CryptTestAlgorithm(alg, toTest); - if(result != TPM_RC_SUCCESS) - return result; - } - } - return TPM_RC_SUCCESS; -} - -//*** CryptSelfTest() -// This function is called to start/complete a full self-test. -// If 'fullTest' is NO, then only the untested algorithms will be run. If -// 'fullTest' is YES, then 'g_untestedDecryptionAlgorithms' is reinitialized and then -// all tests are run. -// This implementation of the reference design does not support processing outside -// the framework of a TPM command. As a consequence, this command does not -// complete until all tests are done. Since this can take a long time, the TPM -// will check after each test to see if the command is canceled. If so, then the -// TPM will returned TPM_RC_CANCELLED. To continue with the self-tests, call -// TPM2_SelfTest(fullTest == No) and the TPM will complete the testing. -// Return Type: TPM_RC -// TPM_RC_CANCELED if the command is canceled -LIB_EXPORT -TPM_RC -CryptSelfTest( - TPMI_YES_NO fullTest // IN: if full test is required - ) -{ -#if SIMULATION - if(g_forceFailureMode) - FAIL(FATAL_ERROR_FORCED); -#endif - - // If the caller requested a full test, then reset the to test vector so that - // all the tests will be run - if(fullTest == YES) - { - MemoryCopy(g_toTest, - g_implementedAlgorithms, - sizeof(g_toTest)); - } - return CryptRunSelfTests(&g_toTest); -} - -//*** CryptIncrementalSelfTest() -// This function is used to perform an incremental self-test. This implementation -// will perform the toTest values before returning. That is, it assumes that the -// TPM cannot perform background tasks between commands. -// -// This command may be canceled. If it is, then there is no return result. -// However, this command can be run again and the incremental progress will not -// be lost. -// Return Type: TPM_RC -// TPM_RC_CANCELED processing of this command was canceled -// TPM_RC_TESTING if toTest list is not empty -// TPM_RC_VALUE an algorithm in the toTest list is not implemented -TPM_RC -CryptIncrementalSelfTest( - TPML_ALG *toTest, // IN: list of algorithms to be tested - TPML_ALG *toDoList // OUT: list of algorithms needing test - ) -{ - ALGORITHM_VECTOR toTestVector = {0}; - TPM_ALG_ID alg; - UINT32 i; - - pAssert(toTest != NULL && toDoList != NULL); - if(toTest->count > 0) - { - // Transcribe the toTest list into the toTestVector - for(i = 0; i < toTest->count; i++) - { - alg = toTest->algorithms[i]; - - // make sure that the algorithm value is not out of range - if((alg > TPM_ALG_LAST) || !TEST_BIT(alg, g_implementedAlgorithms)) - return TPM_RC_VALUE; - SET_BIT(alg, toTestVector); - } - // Run the test - if(CryptRunSelfTests(&toTestVector) == TPM_RC_CANCELED) - return TPM_RC_CANCELED; - } - // Fill in the toDoList with the algorithms that are still untested - toDoList->count = 0; - - for(alg = TPM_ALG_FIRST; - toDoList->count < MAX_ALG_LIST_SIZE && alg <= TPM_ALG_LAST; - alg++) - { - if(TEST_BIT(alg, g_toTest)) - toDoList->algorithms[toDoList->count++] = alg; - } - return TPM_RC_SUCCESS; -} - -//*** CryptInitializeToTest() -// This function will initialize the data structures for testing all the -// algorithms. This should not be called unless CryptAlgsSetImplemented() has -// been called -void -CryptInitializeToTest( - void - ) -{ - // Indicate that nothing has been tested - memset(&g_cryptoSelfTestState, 0, sizeof(g_cryptoSelfTestState)); - - // Copy the implemented algorithm vector - MemoryCopy(g_toTest, g_implementedAlgorithms, sizeof(g_toTest)); - - // Setting the algorithm to null causes the test function to just clear - // out any algorithms for which there is no test. - CryptTestAlgorithm(TPM_ALG_ERROR, &g_toTest); - - return; -} - -//*** CryptTestAlgorithm() -// Only point of contact with the actual self tests. If a self-test fails, there -// is no return and the TPM goes into failure mode. -// The call to TestAlgorithm uses an algorithm selector and a bit vector. When the -// test is run, the corresponding bit in 'toTest' and in 'g_toTest' is CLEAR. If -// 'toTest' is NULL, then only the bit in 'g_toTest' is CLEAR. -// There is a special case for the call to TestAlgorithm(). When 'alg' is -// ALG_ERROR, TestAlgorithm() will CLEAR any bit in 'toTest' for which it has -// no test. This allows the knowledge about which algorithms have test to be -// accessed through the interface that provides the test. -// Return Type: TPM_RC -// TPM_RC_CANCELED test was canceled -LIB_EXPORT -TPM_RC -CryptTestAlgorithm( - TPM_ALG_ID alg, - ALGORITHM_VECTOR *toTest - ) -{ - TPM_RC result; -#if SELF_TEST - result = TestAlgorithm(alg, toTest); -#else - // If this is an attempt to determine the algorithms for which there is a - // self test, pretend that all of them do. We do that by not clearing any - // of the algorithm bits. When/if this function is called to run tests, it - // will over report. This can be changed so that any call to check on which - // algorithms have tests, 'toTest' can be cleared. - if(alg != TPM_ALG_ERROR) - { - CLEAR_BIT(alg, g_toTest); - if(toTest != NULL) - CLEAR_BIT(alg, *toTest); - } - result = TPM_RC_SUCCESS; -#endif - return result; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSmac.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSmac.c deleted file mode 100644 index cd584cf22..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSmac.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This file contains the implementation of the message authentication codes based -// on a symmetric block cipher. These functions only use the single block -// encryption functions of the selected symmetric cryptographic library. - -//** Includes, Defines, and Typedefs -#define _CRYPT_HASH_C_ -#include "Tpm.h" - -#if SMAC_IMPLEMENTED - -//*** CryptSmacStart() -// Function to start an SMAC. -UINT16 -CryptSmacStart( - HASH_STATE *state, - TPMU_PUBLIC_PARMS *keyParameters, - TPM_ALG_ID macAlg, // IN: the type of MAC - TPM2B *key -) -{ - UINT16 retVal = 0; -// - // Make sure that the key size is correct. This should have been checked - // at key load, but... - if(BITS_TO_BYTES(keyParameters->symDetail.sym.keyBits.sym) == key->size) - { - switch(macAlg) - { -#if ALG_CMAC - case ALG_CMAC_VALUE: - retVal = CryptCmacStart(&state->state.smac, keyParameters, - macAlg, key); - break; -#endif - default: - break; - } - } - state->type = (retVal != 0) ? HASH_STATE_SMAC : HASH_STATE_EMPTY; - return retVal; -} - -//*** CryptMacStart() -// Function to start either an HMAC or an SMAC. Cannot reuse the CryptHmacStart -// function because of the difference in number of parameters. -UINT16 -CryptMacStart( - HMAC_STATE *state, - TPMU_PUBLIC_PARMS *keyParameters, - TPM_ALG_ID macAlg, // IN: the type of MAC - TPM2B *key -) -{ - MemorySet(state, 0, sizeof(HMAC_STATE)); - if(CryptHashIsValidAlg(macAlg, FALSE)) - { - return CryptHmacStart(state, macAlg, key->size, key->buffer); - } - else if(CryptSmacIsValidAlg(macAlg, FALSE)) - { - return CryptSmacStart(&state->hashState, keyParameters, macAlg, key); - } - else - return 0; -} - -//*** CryptMacEnd() -// Dispatch to the MAC end function using a size and buffer pointer. -UINT16 -CryptMacEnd( - HMAC_STATE *state, - UINT32 size, - BYTE *buffer -) -{ - UINT16 retVal = 0; - if(state->hashState.type == HASH_STATE_SMAC) - retVal = (state->hashState.state.smac.smacMethods.end)( - &state->hashState.state.smac.state, size, buffer); - else if(state->hashState.type == HASH_STATE_HMAC) - retVal = CryptHmacEnd(state, size, buffer); - state->hashState.type = HASH_STATE_EMPTY; - return retVal; -} - -//*** CryptMacEnd2B() -// Dispatch to the MAC end function using a 2B. -UINT16 -CryptMacEnd2B ( - HMAC_STATE *state, - TPM2B *data -) -{ - return CryptMacEnd(state, data->size, data->buffer); -} -#endif // SMAC_IMPLEMENTED diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c deleted file mode 100644 index 824c1fce5..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c +++ /dev/null @@ -1,478 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This file contains the implementation of the symmetric block cipher modes -// allowed for a TPM. These functions only use the single block encryption functions -// of the selected symmetric crypto library. - -//** Includes, Defines, and Typedefs -#include "Tpm.h" - -#include "CryptSym.h" - -#define KEY_BLOCK_SIZES(ALG, alg) \ -static const INT16 alg##KeyBlockSizes[] = { \ - ALG##_KEY_SIZES_BITS, -1, ALG##_BLOCK_SIZES }; - -#if ALG_AES - KEY_BLOCK_SIZES(AES, aes); -#endif // ALG_AES -#if ALG_SM4 - KEY_BLOCK_SIZES(SM4, sm4); -#endif -#if ALG_CAMELLIA - KEY_BLOCK_SIZES(CAMELLIA, camellia); -#endif -#if ALG_TDES - KEY_BLOCK_SIZES(TDES, tdes); -#endif - -//** Initialization and Data Access Functions -// -//*** CryptSymInit() -// This function is called to do _TPM_Init processing -BOOL -CryptSymInit( - void - ) -{ - return TRUE; -} - -//*** CryptSymStartup() -// This function is called to do TPM2_Startup() processing -BOOL -CryptSymStartup( - void - ) -{ - return TRUE; -} - -//*** CryptGetSymmetricBlockSize() -// This function returns the block size of the algorithm. The table of bit sizes has -// an entry for each allowed key size. The entry for a key size is 0 if the TPM does -// not implement that key size. The key size table is delimited with a negative number -// (-1). After the delimiter is a list of block sizes with each entry corresponding -// to the key bit size. For most symmetric algorithms, the block size is the same -// regardless of the key size but this arrangement allows them to be different. -// Return Type: INT16 -// <= 0 cipher not supported -// > 0 the cipher block size in bytes -LIB_EXPORT INT16 -CryptGetSymmetricBlockSize( - TPM_ALG_ID symmetricAlg, // IN: the symmetric algorithm - UINT16 keySizeInBits // IN: the key size - ) -{ - const INT16 *sizes; - INT16 i; -#define ALG_CASE(SYM, sym) case ALG_##SYM##_VALUE: sizes = sym##KeyBlockSizes; break - switch(symmetricAlg) - { -#if ALG_AES - ALG_CASE(AES, aes); -#endif -#if ALG_SM4 - ALG_CASE(SM4, sm4); -#endif -#if ALG_CAMELLIA - ALG_CASE(CAMELLIA, camellia); -#endif -#if ALG_TDES - ALG_CASE(TDES, tdes); -#endif - default: - return 0; - } - // Find the index of the indicated keySizeInBits - for(i = 0; *sizes >= 0; i++, sizes++) - { - if(*sizes == keySizeInBits) - break; - } - // If sizes is pointing at the end of the list of key sizes, then the desired - // key size was not found so set the block size to zero. - if(*sizes++ < 0) - return 0; - // Advance until the end of the list is found - while(*sizes++ >= 0); - // sizes is pointing to the first entry in the list of block sizes. Use the - // ith index to find the block size for the corresponding key size. - return sizes[i]; -} - -//** Symmetric Encryption -// This function performs symmetric encryption based on the mode. -// Return Type: TPM_RC -// TPM_RC_SIZE 'dSize' is not a multiple of the block size for an -// algorithm that requires it -// TPM_RC_FAILURE Fatal error -LIB_EXPORT TPM_RC -CryptSymmetricEncrypt( - BYTE *dOut, // OUT: - TPM_ALG_ID algorithm, // IN: the symmetric algorithm - UINT16 keySizeInBits, // IN: key size in bits - const BYTE *key, // IN: key buffer. The size of this buffer - // in bytes is (keySizeInBits + 7) / 8 - TPM2B_IV *ivInOut, // IN/OUT: IV for decryption. - TPM_ALG_ID mode, // IN: Mode to use - INT32 dSize, // IN: data size (may need to be a - // multiple of the blockSize) - const BYTE *dIn // IN: data buffer - ) -{ - BYTE *pIv; - int i; - BYTE tmp[MAX_SYM_BLOCK_SIZE]; - BYTE *pT; - tpmCryptKeySchedule_t keySchedule; - INT16 blockSize; - TpmCryptSetSymKeyCall_t encrypt; - BYTE *iv; - BYTE defaultIv[MAX_SYM_BLOCK_SIZE] = {0}; -// - pAssert(dOut != NULL && key != NULL && dIn != NULL); - if(dSize == 0) - return TPM_RC_SUCCESS; - - TEST(algorithm); - blockSize = CryptGetSymmetricBlockSize(algorithm, keySizeInBits); - if(blockSize == 0) - return TPM_RC_FAILURE; - // If the iv is provided, then it is expected to be block sized. In some cases, - // the caller is providing an array of 0's that is equal to [MAX_SYM_BLOCK_SIZE] - // with no knowledge of the actual block size. This function will set it. - if((ivInOut != NULL) && (mode != ALG_ECB_VALUE)) - { - ivInOut->t.size = blockSize; - iv = ivInOut->t.buffer; - } - else - iv = defaultIv; - pIv = iv; - - // Create encrypt key schedule and set the encryption function pointer. - - SELECT(ENCRYPT); - - switch(mode) - { -#if ALG_CTR - case ALG_CTR_VALUE: - for(; dSize > 0; dSize -= blockSize) - { - // Encrypt the current value of the IV(counter) - ENCRYPT(&keySchedule, iv, tmp); - - //increment the counter (counter is big-endian so start at end) - for(i = blockSize - 1; i >= 0; i--) - if((iv[i] += 1) != 0) - break; - // XOR the encrypted counter value with input and put into output - pT = tmp; - for(i = (dSize < blockSize) ? dSize : blockSize; i > 0; i--) - *dOut++ = *dIn++ ^ *pT++; - } - break; -#endif -#if ALG_OFB - case ALG_OFB_VALUE: - // This is written so that dIn and dOut may be the same - for(; dSize > 0; dSize -= blockSize) - { - // Encrypt the current value of the "IV" - ENCRYPT(&keySchedule, iv, iv); - - // XOR the encrypted IV into dIn to create the cipher text (dOut) - pIv = iv; - for(i = (dSize < blockSize) ? dSize : blockSize; i > 0; i--) - *dOut++ = (*pIv++ ^ *dIn++); - } - break; -#endif -#if ALG_CBC - case ALG_CBC_VALUE: - // For CBC the data size must be an even multiple of the - // cipher block size - if((dSize % blockSize) != 0) - return TPM_RC_SIZE; - // XOR the data block into the IV, encrypt the IV into the IV - // and then copy the IV to the output - for(; dSize > 0; dSize -= blockSize) - { - pIv = iv; - for(i = blockSize; i > 0; i--) - *pIv++ ^= *dIn++; - ENCRYPT(&keySchedule, iv, iv); - pIv = iv; - for(i = blockSize; i > 0; i--) - *dOut++ = *pIv++; - } - break; -#endif - // CFB is not optional - case ALG_CFB_VALUE: - // Encrypt the IV into the IV, XOR in the data, and copy to output - for(; dSize > 0; dSize -= blockSize) - { - // Encrypt the current value of the IV - ENCRYPT(&keySchedule, iv, iv); - pIv = iv; - for(i = (int)(dSize < blockSize) ? dSize : blockSize; i > 0; i--) - // XOR the data into the IV to create the cipher text - // and put into the output - *dOut++ = *pIv++ ^= *dIn++; - } - // If the inner loop (i loop) was smaller than blockSize, then dSize - // would have been smaller than blockSize and it is now negative. If - // it is negative, then it indicates how many bytes are needed to pad - // out the IV for the next round. - for(; dSize < 0; dSize++) - *pIv++ = 0; - break; -#if ALG_ECB - case ALG_ECB_VALUE: - // For ECB the data size must be an even multiple of the - // cipher block size - if((dSize % blockSize) != 0) - return TPM_RC_SIZE; - // Encrypt the input block to the output block - for(; dSize > 0; dSize -= blockSize) - { - ENCRYPT(&keySchedule, dIn, dOut); - dIn = &dIn[blockSize]; - dOut = &dOut[blockSize]; - } - break; -#endif - default: - return TPM_RC_FAILURE; - } - return TPM_RC_SUCCESS; -} - -//*** CryptSymmetricDecrypt() -// This function performs symmetric decryption based on the mode. -// Return Type: TPM_RC -// TPM_RC_FAILURE A fatal error -// TPM_RCS_SIZE 'dSize' is not a multiple of the block size for an -// algorithm that requires it -LIB_EXPORT TPM_RC -CryptSymmetricDecrypt( - BYTE *dOut, // OUT: decrypted data - TPM_ALG_ID algorithm, // IN: the symmetric algorithm - UINT16 keySizeInBits, // IN: key size in bits - const BYTE *key, // IN: key buffer. The size of this buffer - // in bytes is (keySizeInBits + 7) / 8 - TPM2B_IV *ivInOut, // IN/OUT: IV for decryption. - TPM_ALG_ID mode, // IN: Mode to use - INT32 dSize, // IN: data size (may need to be a - // multiple of the blockSize) - const BYTE *dIn // IN: data buffer - ) -{ - BYTE *pIv; - int i; - BYTE tmp[MAX_SYM_BLOCK_SIZE]; - BYTE *pT; - tpmCryptKeySchedule_t keySchedule; - INT16 blockSize; - BYTE *iv; - TpmCryptSetSymKeyCall_t encrypt; - TpmCryptSetSymKeyCall_t decrypt; - BYTE defaultIv[MAX_SYM_BLOCK_SIZE] = {0}; - - // These are used but the compiler can't tell because they are initialized - // in case statements and it can't tell if they are always initialized - // when needed, so... Comment these out if the compiler can tell or doesn't - // care that these are initialized before use. - encrypt = NULL; - decrypt = NULL; - - pAssert(dOut != NULL && key != NULL && dIn != NULL); - if(dSize == 0) - return TPM_RC_SUCCESS; - - TEST(algorithm); - blockSize = CryptGetSymmetricBlockSize(algorithm, keySizeInBits); - if(blockSize == 0) - return TPM_RC_FAILURE; - // If the iv is provided, then it is expected to be block sized. In some cases, - // the caller is providing an array of 0's that is equal to [MAX_SYM_BLOCK_SIZE] - // with no knowledge of the actual block size. This function will set it. - if((ivInOut != NULL) && (mode != ALG_ECB_VALUE)) - { - ivInOut->t.size = blockSize; - iv = ivInOut->t.buffer; - } - else - iv = defaultIv; - - pIv = iv; - // Use the mode to select the key schedule to create. Encrypt always uses the - // encryption schedule. Depending on the mode, decryption might use either - // the decryption or encryption schedule. - switch(mode) - { -#if ALG_CBC || ALG_ECB - case ALG_CBC_VALUE: // decrypt = decrypt - case ALG_ECB_VALUE: - // For ECB and CBC, the data size must be an even multiple of the - // cipher block size - if((dSize % blockSize) != 0) - return TPM_RC_SIZE; - SELECT(DECRYPT); - break; -#endif - default: - // For the remaining stream ciphers, use encryption to decrypt - SELECT(ENCRYPT); - break; - } - // Now do the mode-dependent decryption - switch(mode) - { -#if ALG_CBC - case ALG_CBC_VALUE: - // Copy the input data to a temp buffer, decrypt the buffer into the - // output, XOR in the IV, and copy the temp buffer to the IV and repeat. - for(; dSize > 0; dSize -= blockSize) - { - pT = tmp; - for(i = blockSize; i > 0; i--) - *pT++ = *dIn++; - DECRYPT(&keySchedule, tmp, dOut); - pIv = iv; - pT = tmp; - for(i = blockSize; i > 0; i--) - { - *dOut++ ^= *pIv; - *pIv++ = *pT++; - } - } - break; -#endif - case ALG_CFB_VALUE: - for(; dSize > 0; dSize -= blockSize) - { - // Encrypt the IV into the temp buffer - ENCRYPT(&keySchedule, iv, tmp); - pT = tmp; - pIv = iv; - for(i = (dSize < blockSize) ? dSize : blockSize; i > 0; i--) - // Copy the current cipher text to IV, XOR - // with the temp buffer and put into the output - *dOut++ = *pT++ ^ (*pIv++ = *dIn++); - } - // If the inner loop (i loop) was smaller than blockSize, then dSize - // would have been smaller than blockSize and it is now negative - // If it is negative, then it indicates how may fill bytes - // are needed to pad out the IV for the next round. - for(; dSize < 0; dSize++) - *pIv++ = 0; - - break; -#if ALG_CTR - case ALG_CTR_VALUE: - for(; dSize > 0; dSize -= blockSize) - { - // Encrypt the current value of the IV(counter) - ENCRYPT(&keySchedule, iv, tmp); - - //increment the counter (counter is big-endian so start at end) - for(i = blockSize - 1; i >= 0; i--) - if((iv[i] += 1) != 0) - break; - // XOR the encrypted counter value with input and put into output - pT = tmp; - for(i = (dSize < blockSize) ? dSize : blockSize; i > 0; i--) - *dOut++ = *dIn++ ^ *pT++; - } - break; -#endif -#if ALG_ECB - case ALG_ECB_VALUE: - for(; dSize > 0; dSize -= blockSize) - { - DECRYPT(&keySchedule, dIn, dOut); - dIn = &dIn[blockSize]; - dOut = &dOut[blockSize]; - } - break; -#endif -#if ALG_OFB - case ALG_OFB_VALUE: - // This is written so that dIn and dOut may be the same - for(; dSize > 0; dSize -= blockSize) - { - // Encrypt the current value of the "IV" - ENCRYPT(&keySchedule, iv, iv); - - // XOR the encrypted IV into dIn to create the cipher text (dOut) - pIv = iv; - for(i = (dSize < blockSize) ? dSize : blockSize; i > 0; i--) - *dOut++ = (*pIv++ ^ *dIn++); - } - break; -#endif - default: - return TPM_RC_FAILURE; - } - return TPM_RC_SUCCESS; -} - -//*** CryptSymKeyValidate() -// Validate that a provided symmetric key meets the requirements of the TPM -// Return Type: TPM_RC -// TPM_RC_KEY_SIZE Key size specifiers do not match -// TPM_RC_KEY Key is not allowed -TPM_RC -CryptSymKeyValidate( - TPMT_SYM_DEF_OBJECT *symDef, - TPM2B_SYM_KEY *key - ) -{ - if(key->t.size != BITS_TO_BYTES(symDef->keyBits.sym)) - return TPM_RCS_KEY_SIZE; -#if ALG_TDES - if(symDef->algorithm == TPM_ALG_TDES && !CryptDesValidateKey(key)) - return TPM_RCS_KEY; -#endif // ALG_TDES - return TPM_RC_SUCCESS; -} - - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptUtil.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptUtil.c deleted file mode 100644 index fdea4f6da..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptUtil.c +++ /dev/null @@ -1,1901 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This module contains the interfaces to the CryptoEngine and provides -// miscellaneous cryptographic functions in support of the TPM. -// - -//** Includes -#include "Tpm.h" - -//****************************************************************************/ -//** Hash/HMAC Functions -//****************************************************************************/ - -//*** CryptHmacSign() -// Sign a digest using an HMAC key. This an HMAC of a digest, not an HMAC of a -// message. -// Return Type: TPM_RC -// TPM_RC_HASH not a valid hash -static TPM_RC -CryptHmacSign( - TPMT_SIGNATURE *signature, // OUT: signature - OBJECT *signKey, // IN: HMAC key sign the hash - TPM2B_DIGEST *hashData // IN: hash to be signed - ) -{ - HMAC_STATE hmacState; - UINT32 digestSize; - - digestSize = CryptHmacStart2B(&hmacState, signature->signature.any.hashAlg, - &signKey->sensitive.sensitive.bits.b); - CryptDigestUpdate2B(&hmacState.hashState, &hashData->b); - CryptHmacEnd(&hmacState, digestSize, - (BYTE *)&signature->signature.hmac.digest); - return TPM_RC_SUCCESS; -} - -//*** CryptHMACVerifySignature() -// This function will verify a signature signed by a HMAC key. -// Note that a caller needs to prepare 'signature' with the signature algorithm -// (TPM_ALG_HMAC) and the hash algorithm to use. This function then builds a -// signature of that type. -// Return Type: TPM_RC -// TPM_RC_SCHEME not the proper scheme for this key type -// TPM_RC_SIGNATURE if invalid input or signature is not genuine -static TPM_RC -CryptHMACVerifySignature( - OBJECT *signKey, // IN: HMAC key signed the hash - TPM2B_DIGEST *hashData, // IN: digest being verified - TPMT_SIGNATURE *signature // IN: signature to be verified - ) -{ - TPMT_SIGNATURE test; - TPMT_KEYEDHASH_SCHEME *keyScheme = - &signKey->publicArea.parameters.keyedHashDetail.scheme; -// - if((signature->sigAlg != ALG_HMAC_VALUE) - || (signature->signature.hmac.hashAlg == ALG_NULL_VALUE)) - return TPM_RC_SCHEME; - // This check is not really needed for verification purposes. However, it does - // prevent someone from trying to validate a signature using a weaker hash - // algorithm than otherwise allowed by the key. That is, a key with a scheme - // other than TMP_ALG_NULL can only be used to validate signatures that have - // a matching scheme. - if((keyScheme->scheme != ALG_NULL_VALUE) - && ((keyScheme->scheme != signature->sigAlg) - || (keyScheme->details.hmac.hashAlg - != signature->signature.any.hashAlg))) - return TPM_RC_SIGNATURE; - test.sigAlg = signature->sigAlg; - test.signature.hmac.hashAlg = signature->signature.hmac.hashAlg; - - CryptHmacSign(&test, signKey, hashData); - - // Compare digest - if(!MemoryEqual(&test.signature.hmac.digest, - &signature->signature.hmac.digest, - CryptHashGetDigestSize(signature->signature.any.hashAlg))) - return TPM_RC_SIGNATURE; - - return TPM_RC_SUCCESS; -} - -//*** CryptGenerateKeyedHash() -// This function creates a keyedHash object. -// Return type: TPM_RC -// TPM_RC_NO_RESULT cannot get values from random number generator -// TPM_RC_SIZE sensitive data size is larger than allowed for -// the scheme -static TPM_RC -CryptGenerateKeyedHash( - TPMT_PUBLIC *publicArea, // IN/OUT: the public area template - // for the new key. - TPMT_SENSITIVE *sensitive, // OUT: sensitive area - TPMS_SENSITIVE_CREATE *sensitiveCreate, // IN: sensitive creation data - RAND_STATE *rand // IN: "entropy" source - ) -{ - TPMT_KEYEDHASH_SCHEME *scheme; - TPM_ALG_ID hashAlg; - UINT16 hashBlockSize; - UINT16 digestSize; - - scheme = &publicArea->parameters.keyedHashDetail.scheme; - - if(publicArea->type != ALG_KEYEDHASH_VALUE) - return TPM_RC_FAILURE; - - // Pick the limiting hash algorithm - if(scheme->scheme == ALG_NULL_VALUE) - hashAlg = publicArea->nameAlg; - else if(scheme->scheme == ALG_XOR_VALUE) - hashAlg = scheme->details.xor.hashAlg; - else - hashAlg = scheme->details.hmac.hashAlg; - hashBlockSize = CryptHashGetBlockSize(hashAlg); - digestSize = CryptHashGetDigestSize(hashAlg); - - // if this is a signing or a decryption key, then the limit - // for the data size is the block size of the hash. This limit - // is set because larger values have lower entropy because of the - // HMAC function. The lower limit is 1/2 the size of the digest - // - //If the user provided the key, check that it is a proper size - if(sensitiveCreate->data.t.size != 0) - { - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, decrypt) - || IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign)) - { - if(sensitiveCreate->data.t.size > hashBlockSize) - return TPM_RC_SIZE; -#if 0 // May make this a FIPS-mode requirement - if(sensitiveCreate->data.t.size < (digestSize / 2)) - return TPM_RC_SIZE; -#endif - } - // If this is a data blob, then anything that will get past the unmarshaling - // is OK - MemoryCopy2B(&sensitive->sensitive.bits.b, &sensitiveCreate->data.b, - sizeof(sensitive->sensitive.bits.t.buffer)); - } - else - { - // The TPM is going to generate the data so set the size to be the - // size of the digest of the algorithm - sensitive->sensitive.bits.t.size = - DRBG_Generate(rand, sensitive->sensitive.bits.t.buffer, digestSize); - if(sensitive->sensitive.bits.t.size == 0) - return (g_inFailureMode) ? TPM_RC_FAILURE : TPM_RC_NO_RESULT; - } - return TPM_RC_SUCCESS; -} - -//*** CryptIsSchemeAnonymous() -// This function is used to test a scheme to see if it is an anonymous scheme -// The only anonymous scheme is ECDAA. ECDAA can be used to do things -// like U-Prove. -BOOL -CryptIsSchemeAnonymous( - TPM_ALG_ID scheme // IN: the scheme algorithm to test - ) -{ - return scheme == ALG_ECDAA_VALUE; -} - -//**** ************************************************************************ -//** Symmetric Functions -//**** ************************************************************************ - -//*** ParmDecryptSym() -// This function performs parameter decryption using symmetric block cipher. -/*(See Part 1 specification) -// Symmetric parameter decryption -// When parameter decryption uses a symmetric block cipher, a decryption -// key and IV will be generated from: -// KDFa(hash, sessionAuth, "CFB", nonceNewer, nonceOlder, bits) (24) -// Where: -// hash the hash function associated with the session -// sessionAuth the sessionAuth associated with the session -// nonceNewer nonceCaller for a command -// nonceOlder nonceTPM for a command -// bits the number of bits required for the symmetric key -// plus an IV -*/ -void -ParmDecryptSym( - TPM_ALG_ID symAlg, // IN: the symmetric algorithm - TPM_ALG_ID hash, // IN: hash algorithm for KDFa - UINT16 keySizeInBits, // IN: the key size in bits - TPM2B *key, // IN: KDF HMAC key - TPM2B *nonceCaller, // IN: nonce caller - TPM2B *nonceTpm, // IN: nonce TPM - UINT32 dataSize, // IN: size of parameter buffer - BYTE *data // OUT: buffer to be decrypted - ) -{ - // KDF output buffer - // It contains parameters for the CFB encryption - // From MSB to LSB, they are the key and iv - BYTE symParmString[MAX_SYM_KEY_BYTES + MAX_SYM_BLOCK_SIZE]; - // Symmetric key size in byte - UINT16 keySize = (keySizeInBits + 7) / 8; - TPM2B_IV iv; - - iv.t.size = CryptGetSymmetricBlockSize(symAlg, keySizeInBits); - // If there is decryption to do... - if(iv.t.size > 0) - { - // Generate key and iv - CryptKDFa(hash, key, CFB_KEY, nonceCaller, nonceTpm, - keySizeInBits + (iv.t.size * 8), symParmString, NULL, FALSE); - MemoryCopy(iv.t.buffer, &symParmString[keySize], iv.t.size); - - CryptSymmetricDecrypt(data, symAlg, keySizeInBits, symParmString, - &iv, ALG_CFB_VALUE, dataSize, data); - } - return; -} - -//*** ParmEncryptSym() -// This function performs parameter encryption using symmetric block cipher. -/*(See part 1 specification) -// When parameter decryption uses a symmetric block cipher, an encryption -// key and IV will be generated from: -// KDFa(hash, sessionAuth, "CFB", nonceNewer, nonceOlder, bits) (24) -// Where: -// hash the hash function associated with the session -// sessionAuth the sessionAuth associated with the session -// nonceNewer nonceTPM for a response -// nonceOlder nonceCaller for a response -// bits the number of bits required for the symmetric key -// plus an IV -*/ -void -ParmEncryptSym( - TPM_ALG_ID symAlg, // IN: symmetric algorithm - TPM_ALG_ID hash, // IN: hash algorithm for KDFa - UINT16 keySizeInBits, // IN: symmetric key size in bits - TPM2B *key, // IN: KDF HMAC key - TPM2B *nonceCaller, // IN: nonce caller - TPM2B *nonceTpm, // IN: nonce TPM - UINT32 dataSize, // IN: size of parameter buffer - BYTE *data // OUT: buffer to be encrypted - ) -{ - // KDF output buffer - // It contains parameters for the CFB encryption - BYTE symParmString[MAX_SYM_KEY_BYTES + MAX_SYM_BLOCK_SIZE]; - - // Symmetric key size in bytes - UINT16 keySize = (keySizeInBits + 7) / 8; - - TPM2B_IV iv; - - iv.t.size = CryptGetSymmetricBlockSize(symAlg, keySizeInBits); - // See if there is any encryption to do - if(iv.t.size > 0) - { - // Generate key and iv - CryptKDFa(hash, key, CFB_KEY, nonceTpm, nonceCaller, - keySizeInBits + (iv.t.size * 8), symParmString, NULL, FALSE); - MemoryCopy(iv.t.buffer, &symParmString[keySize], iv.t.size); - - CryptSymmetricEncrypt(data, symAlg, keySizeInBits, symParmString, &iv, - ALG_CFB_VALUE, dataSize, data); - } - return; -} - -//*** CryptGenerateKeySymmetric() -// This function generates a symmetric cipher key. The derivation process is -// determined by the type of the provided 'rand' -// Return type: TPM_RC -// TPM_RC_NO_RESULT cannot get a random value -// TPM_RC_KEY_SIZE key size in the public area does not match the size -// in the sensitive creation area -// TPM_RC_KEY provided key value is not allowed -static TPM_RC -CryptGenerateKeySymmetric( - TPMT_PUBLIC *publicArea, // IN/OUT: The public area template - // for the new key. - TPMT_SENSITIVE *sensitive, // OUT: sensitive area - TPMS_SENSITIVE_CREATE *sensitiveCreate, // IN: sensitive creation data - RAND_STATE *rand // IN: the "entropy" source for - ) -{ - UINT16 keyBits = publicArea->parameters.symDetail.sym.keyBits.sym; - TPM_RC result; -// - // only do multiples of RADIX_BITS - if((keyBits % RADIX_BITS) != 0) - return TPM_RC_KEY_SIZE; - // If this is not a new key, then the provided key data must be the right size - if(sensitiveCreate->data.t.size != 0) - { - result = CryptSymKeyValidate(&publicArea->parameters.symDetail.sym, - (TPM2B_SYM_KEY *)&sensitiveCreate->data); - if(result == TPM_RC_SUCCESS) - MemoryCopy2B(&sensitive->sensitive.sym.b, &sensitiveCreate->data.b, - sizeof(sensitive->sensitive.sym.t.buffer)); - } -#if ALG_TDES - else if(publicArea->parameters.symDetail.sym.algorithm == ALG_TDES_VALUE) - { - result = CryptGenerateKeyDes(publicArea, sensitive, rand); - } -#endif - else - { - sensitive->sensitive.sym.t.size = - DRBG_Generate(rand, sensitive->sensitive.sym.t.buffer, - BITS_TO_BYTES(keyBits)); - if(g_inFailureMode) - result = TPM_RC_FAILURE; - else if(sensitive->sensitive.sym.t.size == 0) - result = TPM_RC_NO_RESULT; - else - result = TPM_RC_SUCCESS; - } - return result; -} - -//*** CryptXORObfuscation() -// This function implements XOR obfuscation. It should not be called if the -// hash algorithm is not implemented. The only return value from this function -// is TPM_RC_SUCCESS. -void -CryptXORObfuscation( - TPM_ALG_ID hash, // IN: hash algorithm for KDF - TPM2B *key, // IN: KDF key - TPM2B *contextU, // IN: contextU - TPM2B *contextV, // IN: contextV - UINT32 dataSize, // IN: size of data buffer - BYTE *data // IN/OUT: data to be XORed in place - ) -{ - BYTE mask[MAX_DIGEST_SIZE]; // Allocate a digest sized buffer - BYTE *pm; - UINT32 i; - UINT32 counter = 0; - UINT16 hLen = CryptHashGetDigestSize(hash); - UINT32 requestSize = dataSize * 8; - INT32 remainBytes = (INT32)dataSize; - - pAssert((key != NULL) && (data != NULL) && (hLen != 0)); - - // Call KDFa to generate XOR mask - for(; remainBytes > 0; remainBytes -= hLen) - { - // Make a call to KDFa to get next iteration - CryptKDFa(hash, key, XOR_KEY, contextU, contextV, - requestSize, mask, &counter, TRUE); - - // XOR next piece of the data - pm = mask; - for(i = hLen < remainBytes ? hLen : remainBytes; i > 0; i--) - *data++ ^= *pm++; - } - return; -} - -//**************************************************************************** -//** Initialization and shut down -//**************************************************************************** - -//*** CryptInit() -// This function is called when the TPM receives a _TPM_Init indication. -// -// NOTE: The hash algorithms do not have to be tested, they just need to be -// available. They have to be tested before the TPM can accept HMAC authorization -// or return any result that relies on a hash algorithm. -// Return Type: BOOL -// TRUE(1) initializations succeeded -// FALSE(0) initialization failed and caller should place the TPM into -// Failure Mode -BOOL -CryptInit( - void - ) -{ - BOOL ok; - // Initialize the vector of implemented algorithms - AlgorithmGetImplementedVector(&g_implementedAlgorithms); - - // Indicate that all test are necessary - CryptInitializeToTest(); - - // Do any library initializations that are necessary. If any fails, - // the caller should go into failure mode; - ok = SupportLibInit(); - ok = ok && CryptSymInit(); - ok = ok && CryptRandInit(); - ok = ok && CryptHashInit(); -#if ALG_RSA - ok = ok && CryptRsaInit(); -#endif // ALG_RSA -#if ALG_ECC - ok = ok && CryptEccInit(); -#endif // ALG_ECC - return ok; -} - -//*** CryptStartup() -// This function is called by TPM2_Startup() to initialize the functions in -// this cryptographic library and in the provided CryptoLibrary. This function -// and CryptUtilInit() are both provided so that the implementation may move the -// initialization around to get the best interaction. -// Return Type: BOOL -// TRUE(1) startup succeeded -// FALSE(0) startup failed and caller should place the TPM into -// Failure Mode -BOOL -CryptStartup( - STARTUP_TYPE type // IN: the startup type - ) -{ - BOOL OK; - NOT_REFERENCED(type); - - OK = CryptSymStartup() && CryptRandStartup() && CryptHashStartup() -#if ALG_RSA - && CryptRsaStartup() -#endif // ALG_RSA -#if ALG_ECC - && CryptEccStartup() -#endif // ALG_ECC - ; -#if ALG_ECC - // Don't directly check for SU_RESET because that is the default - if(OK && (type != SU_RESTART) && (type != SU_RESUME)) - { - // If the shutdown was orderly, then the values recovered from NV will - // be OK to use. - // Get a new random commit nonce - gr.commitNonce.t.size = sizeof(gr.commitNonce.t.buffer); - CryptRandomGenerate(gr.commitNonce.t.size, gr.commitNonce.t.buffer); - // Reset the counter and commit array - gr.commitCounter = 0; - MemorySet(gr.commitArray, 0, sizeof(gr.commitArray)); - } -#endif // ALG_ECC - return OK; -} - -//**************************************************************************** -//** Algorithm-Independent Functions -//**************************************************************************** -//*** Introduction -// These functions are used generically when a function of a general type -// (e.g., symmetric encryption) is required. The functions will modify the -// parameters as required to interface to the indicated algorithms. -// -//*** CryptIsAsymAlgorithm() -// This function indicates if an algorithm is an asymmetric algorithm. -// Return Type: BOOL -// TRUE(1) if it is an asymmetric algorithm -// FALSE(0) if it is not an asymmetric algorithm -BOOL -CryptIsAsymAlgorithm( - TPM_ALG_ID algID // IN: algorithm ID - ) -{ - switch(algID) - { -#if ALG_RSA - case ALG_RSA_VALUE: -#endif -#if ALG_ECC - case ALG_ECC_VALUE: -#endif - return TRUE; - break; - default: - break; - } - return FALSE; -} - -//*** CryptSecretEncrypt() -// This function creates a secret value and its associated secret structure using -// an asymmetric algorithm. -// -// This function is used by TPM2_Rewrap() TPM2_MakeCredential(), -// and TPM2_Duplicate(). -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES 'keyHandle' does not reference a valid decryption key -// TPM_RC_KEY invalid ECC key (public point is not on the curve) -// TPM_RC_SCHEME RSA key with an unsupported padding scheme -// TPM_RC_VALUE numeric value of the data to be decrypted is greater -// than the RSA key modulus -TPM_RC -CryptSecretEncrypt( - OBJECT *encryptKey, // IN: encryption key object - const TPM2B *label, // IN: a null-terminated string as L - TPM2B_DATA *data, // OUT: secret value - TPM2B_ENCRYPTED_SECRET *secret // OUT: secret structure - ) -{ - TPMT_RSA_DECRYPT scheme; - TPM_RC result = TPM_RC_SUCCESS; -// - if(data == NULL || secret == NULL) - return TPM_RC_FAILURE; - - // The output secret value has the size of the digest produced by the nameAlg. - data->t.size = CryptHashGetDigestSize(encryptKey->publicArea.nameAlg); - // The encryption scheme is OAEP using the nameAlg of the encrypt key. - scheme.scheme = ALG_OAEP_VALUE; - scheme.details.anySig.hashAlg = encryptKey->publicArea.nameAlg; - - if(!IS_ATTRIBUTE(encryptKey->publicArea.objectAttributes, TPMA_OBJECT, decrypt)) - return TPM_RC_ATTRIBUTES; - switch(encryptKey->publicArea.type) - { -#if ALG_RSA - case ALG_RSA_VALUE: - { - // Create secret data from RNG - CryptRandomGenerate(data->t.size, data->t.buffer); - - // Encrypt the data by RSA OAEP into encrypted secret - result = CryptRsaEncrypt((TPM2B_PUBLIC_KEY_RSA *)secret, &data->b, - encryptKey, &scheme, label, NULL); - } - break; -#endif // ALG_RSA - -#if ALG_ECC - case ALG_ECC_VALUE: - { - TPMS_ECC_POINT eccPublic; - TPM2B_ECC_PARAMETER eccPrivate; - TPMS_ECC_POINT eccSecret; - BYTE *buffer = secret->t.secret; - - // Need to make sure that the public point of the key is on the - // curve defined by the key. - if(!CryptEccIsPointOnCurve( - encryptKey->publicArea.parameters.eccDetail.curveID, - &encryptKey->publicArea.unique.ecc)) - result = TPM_RC_KEY; - else - { - // Call crypto engine to create an auxiliary ECC key - // We assume crypt engine initialization should always success. - // Otherwise, TPM should go to failure mode. - - CryptEccNewKeyPair(&eccPublic, &eccPrivate, - encryptKey->publicArea.parameters.eccDetail.curveID); - // Marshal ECC public to secret structure. This will be used by the - // recipient to decrypt the secret with their private key. - secret->t.size = TPMS_ECC_POINT_Marshal(&eccPublic, &buffer, NULL); - - // Compute ECDH shared secret which is R = [d]Q where d is the - // private part of the ephemeral key and Q is the public part of a - // TPM key. TPM_RC_KEY error return from CryptComputeECDHSecret - // because the auxiliary ECC key is just created according to the - // parameters of input ECC encrypt key. - if(CryptEccPointMultiply(&eccSecret, - encryptKey->publicArea.parameters.eccDetail.curveID, - &encryptKey->publicArea.unique.ecc, &eccPrivate, - NULL, NULL) - != TPM_RC_SUCCESS) - result = TPM_RC_KEY; - else - { - // The secret value is computed from Z using KDFe as: - // secret := KDFe(HashID, Z, Use, PartyUInfo, PartyVInfo, bits) - // Where: - // HashID the nameAlg of the decrypt key - // Z the x coordinate (Px) of the product (P) of the point - // (Q) of the secret and the private x coordinate (de,V) - // of the decryption key - // Use a null-terminated string containing "SECRET" - // PartyUInfo the x coordinate of the point in the secret - // (Qe,U ) - // PartyVInfo the x coordinate of the public key (Qs,V ) - // bits the number of bits in the digest of HashID - // Retrieve seed from KDFe - CryptKDFe(encryptKey->publicArea.nameAlg, &eccSecret.x.b, - label, &eccPublic.x.b, - &encryptKey->publicArea.unique.ecc.x.b, - data->t.size * 8, data->t.buffer); - } - } - } - break; -#endif // ALG_ECC - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - return result; -} - -//*** CryptSecretDecrypt() -// Decrypt a secret value by asymmetric (or symmetric) algorithm -// This function is used for ActivateCredential and Import for asymmetric -// decryption, and StartAuthSession for both asymmetric and symmetric -// decryption process -// -// Return Type: TPM_RC -// TPM_RC_ATTRIBUTES RSA key is not a decryption key -// TPM_RC_BINDING Invalid RSA key (public and private parts are not -// cryptographically bound. -// TPM_RC_ECC_POINT ECC point in the secret is not on the curve -// TPM_RC_INSUFFICIENT failed to retrieve ECC point from the secret -// TPM_RC_NO_RESULT multiplication resulted in ECC point at infinity -// TPM_RC_SIZE data to decrypt is not of the same size as RSA key -// TPM_RC_VALUE For RSA key, numeric value of the encrypted data is -// greater than the modulus, or the recovered data is -// larger than the output buffer. -// For keyedHash or symmetric key, the secret is -// larger than the size of the digest produced by -// the name algorithm. -// TPM_RC_FAILURE internal error -TPM_RC -CryptSecretDecrypt( - OBJECT *decryptKey, // IN: decrypt key - TPM2B_NONCE *nonceCaller, // IN: nonceCaller. It is needed for - // symmetric decryption. For - // asymmetric decryption, this - // parameter is NULL - const TPM2B *label, // IN: a value for L - TPM2B_ENCRYPTED_SECRET *secret, // IN: input secret - TPM2B_DATA *data // OUT: decrypted secret value - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - - // Decryption for secret - switch(decryptKey->publicArea.type) - { -#if ALG_RSA - case ALG_RSA_VALUE: - { - TPMT_RSA_DECRYPT scheme; - TPMT_RSA_SCHEME *keyScheme - = &decryptKey->publicArea.parameters.rsaDetail.scheme; - UINT16 digestSize; - - scheme = *(TPMT_RSA_DECRYPT *)keyScheme; - // If the key scheme is ALG_NULL_VALUE, set the scheme to OAEP and - // set the algorithm to the name algorithm. - if(scheme.scheme == ALG_NULL_VALUE) - { - // Use OAEP scheme - scheme.scheme = ALG_OAEP_VALUE; - scheme.details.oaep.hashAlg = decryptKey->publicArea.nameAlg; - } - // use the digestSize as an indicator of whether or not the scheme - // is using a supported hash algorithm. - // Note: depending on the scheme used for encryption, a hashAlg might - // not be needed. However, the return value has to have some upper - // limit on the size. In this case, it is the size of the digest of the - // hash algorithm. It is checked after the decryption is done but, there - // is no point in doing the decryption if the size is going to be - // 'wrong' anyway. - digestSize = CryptHashGetDigestSize(scheme.details.oaep.hashAlg); - if(scheme.scheme != ALG_OAEP_VALUE || digestSize == 0) - return TPM_RC_SCHEME; - - // Set the output buffer capacity - data->t.size = sizeof(data->t.buffer); - - // Decrypt seed by RSA OAEP - result = CryptRsaDecrypt(&data->b, &secret->b, - decryptKey, &scheme, label); - if((result == TPM_RC_SUCCESS) && (data->t.size > digestSize)) - result = TPM_RC_VALUE; - } - break; -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - { - TPMS_ECC_POINT eccPublic; - TPMS_ECC_POINT eccSecret; - BYTE *buffer = secret->t.secret; - INT32 size = secret->t.size; - - // Retrieve ECC point from secret buffer - result = TPMS_ECC_POINT_Unmarshal(&eccPublic, &buffer, &size); - if(result == TPM_RC_SUCCESS) - { - result = CryptEccPointMultiply(&eccSecret, - decryptKey->publicArea.parameters.eccDetail.curveID, - &eccPublic, &decryptKey->sensitive.sensitive.ecc, - NULL, NULL); - if(result == TPM_RC_SUCCESS) - { - // Set the size of the "recovered" secret value to be the size - // of the digest produced by the nameAlg. - data->t.size = - CryptHashGetDigestSize(decryptKey->publicArea.nameAlg); - - // The secret value is computed from Z using KDFe as: - // secret := KDFe(HashID, Z, Use, PartyUInfo, PartyVInfo, bits) - // Where: - // HashID -- the nameAlg of the decrypt key - // Z -- the x coordinate (Px) of the product (P) of the point - // (Q) of the secret and the private x coordinate (de,V) - // of the decryption key - // Use -- a null-terminated string containing "SECRET" - // PartyUInfo -- the x coordinate of the point in the secret - // (Qe,U ) - // PartyVInfo -- the x coordinate of the public key (Qs,V ) - // bits -- the number of bits in the digest of HashID - // Retrieve seed from KDFe - CryptKDFe(decryptKey->publicArea.nameAlg, &eccSecret.x.b, label, - &eccPublic.x.b, - &decryptKey->publicArea.unique.ecc.x.b, - data->t.size * 8, data->t.buffer); - } - } - } - break; -#endif // ALG_ECC -#if !ALG_KEYEDHASH -# error "KEYEDHASH support is required" -#endif - case ALG_KEYEDHASH_VALUE: - // The seed size can not be bigger than the digest size of nameAlg - if(secret->t.size > - CryptHashGetDigestSize(decryptKey->publicArea.nameAlg)) - result = TPM_RC_VALUE; - else - { - // Retrieve seed by XOR Obfuscation: - // seed = XOR(secret, hash, key, nonceCaller, nullNonce) - // where: - // secret the secret parameter from the TPM2_StartAuthHMAC - // command that contains the seed value - // hash nameAlg of tpmKey - // key the key or data value in the object referenced by - // entityHandle in the TPM2_StartAuthHMAC command - // nonceCaller the parameter from the TPM2_StartAuthHMAC command - // nullNonce a zero-length nonce - // XOR Obfuscation in place - CryptXORObfuscation(decryptKey->publicArea.nameAlg, - &decryptKey->sensitive.sensitive.bits.b, - &nonceCaller->b, NULL, - secret->t.size, secret->t.secret); - // Copy decrypted seed - MemoryCopy2B(&data->b, &secret->b, sizeof(data->t.buffer)); - } - break; - case ALG_SYMCIPHER_VALUE: - { - TPM2B_IV iv = {{0}}; - TPMT_SYM_DEF_OBJECT *symDef; - // The seed size can not be bigger than the digest size of nameAlg - if(secret->t.size > - CryptHashGetDigestSize(decryptKey->publicArea.nameAlg)) - result = TPM_RC_VALUE; - else - { - symDef = &decryptKey->publicArea.parameters.symDetail.sym; - iv.t.size = CryptGetSymmetricBlockSize(symDef->algorithm, - symDef->keyBits.sym); - if(iv.t.size == 0) - return TPM_RC_FAILURE; - if(nonceCaller->t.size >= iv.t.size) - { - MemoryCopy(iv.t.buffer, nonceCaller->t.buffer, iv.t.size); - } - else - { - if(nonceCaller->t.size > sizeof(iv.t.buffer)) - return TPM_RC_FAILURE; - MemoryCopy(iv.b.buffer, nonceCaller->t.buffer, - nonceCaller->t.size); - } - // make sure secret will fit - if(secret->t.size > data->t.size) - return TPM_RC_FAILURE; - data->t.size = secret->t.size; - // CFB decrypt, using nonceCaller as iv - CryptSymmetricDecrypt(data->t.buffer, symDef->algorithm, - symDef->keyBits.sym, - decryptKey->sensitive.sensitive.sym.t.buffer, - &iv, ALG_CFB_VALUE, secret->t.size, - secret->t.secret); - } - } - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - return result; -} - -//*** CryptParameterEncryption() -// This function does in-place encryption of a response parameter. -void -CryptParameterEncryption( - TPM_HANDLE handle, // IN: encrypt session handle - TPM2B *nonceCaller, // IN: nonce caller - UINT16 leadingSizeInByte, // IN: the size of the leading size field in - // bytes - TPM2B_AUTH *extraKey, // IN: additional key material other than - // sessionAuth - BYTE *buffer // IN/OUT: parameter buffer to be encrypted - ) -{ - SESSION *session = SessionGet(handle); // encrypt session - TPM2B_TYPE(TEMP_KEY, (sizeof(extraKey->t.buffer) - + sizeof(session->sessionKey.t.buffer))); - TPM2B_TEMP_KEY key; // encryption key - UINT32 cipherSize = 0; // size of cipher text -// - // Retrieve encrypted data size. - if(leadingSizeInByte == 2) - { - // Extract the first two bytes as the size field as the data size - // encrypt - cipherSize = (UINT32)BYTE_ARRAY_TO_UINT16(buffer); - // advance the buffer - buffer = &buffer[2]; - } -#ifdef TPM4B - else if(leadingSizeInByte == 4) - { - // use the first four bytes to indicate the number of bytes to encrypt - cipherSize = BYTE_ARRAY_TO_UINT32(buffer); - //advance pointer - buffer = &buffer[4]; - } -#endif - else - { - FAIL(FATAL_ERROR_INTERNAL); - } - - // Compute encryption key by concatenating sessionKey with extra key - MemoryCopy2B(&key.b, &session->sessionKey.b, sizeof(key.t.buffer)); - MemoryConcat2B(&key.b, &extraKey->b, sizeof(key.t.buffer)); - - if(session->symmetric.algorithm == ALG_XOR_VALUE) - - // XOR parameter encryption formulation: - // XOR(parameter, hash, sessionAuth, nonceNewer, nonceOlder) - CryptXORObfuscation(session->authHashAlg, &(key.b), - &(session->nonceTPM.b), - nonceCaller, cipherSize, buffer); - else - ParmEncryptSym(session->symmetric.algorithm, session->authHashAlg, - session->symmetric.keyBits.aes, &(key.b), - nonceCaller, &(session->nonceTPM.b), - cipherSize, buffer); - return; -} - -//*** CryptParameterDecryption() -// This function does in-place decryption of a command parameter. -// Return Type: TPM_RC -// TPM_RC_SIZE The number of bytes in the input buffer is less than -// the number of bytes to be decrypted. -TPM_RC -CryptParameterDecryption( - TPM_HANDLE handle, // IN: encrypted session handle - TPM2B *nonceCaller, // IN: nonce caller - UINT32 bufferSize, // IN: size of parameter buffer - UINT16 leadingSizeInByte, // IN: the size of the leading size field in - // byte - TPM2B_AUTH *extraKey, // IN: the authValue - BYTE *buffer // IN/OUT: parameter buffer to be decrypted - ) -{ - SESSION *session = SessionGet(handle); // encrypt session - // The HMAC key is going to be the concatenation of the session key and any - // additional key material (like the authValue). The size of both of these - // is the size of the buffer which can contain a TPMT_HA. - TPM2B_TYPE(HMAC_KEY, (sizeof(extraKey->t.buffer) - + sizeof(session->sessionKey.t.buffer))); - TPM2B_HMAC_KEY key; // decryption key - UINT32 cipherSize = 0; // size of cipher text -// - // Retrieve encrypted data size. - if(leadingSizeInByte == 2) - { - // The first two bytes of the buffer are the size of the - // data to be decrypted - cipherSize = (UINT32)BYTE_ARRAY_TO_UINT16(buffer); - buffer = &buffer[2]; // advance the buffer - } -#ifdef TPM4B - else if(leadingSizeInByte == 4) - { - // the leading size is four bytes so get the four byte size field - cipherSize = BYTE_ARRAY_TO_UINT32(buffer); - buffer = &buffer[4]; //advance pointer - } -#endif - else - { - FAIL(FATAL_ERROR_INTERNAL); - } - if(cipherSize > bufferSize) - return TPM_RC_SIZE; - - // Compute decryption key by concatenating sessionAuth with extra input key - MemoryCopy2B(&key.b, &session->sessionKey.b, sizeof(key.t.buffer)); - MemoryConcat2B(&key.b, &extraKey->b, sizeof(key.t.buffer)); - - if(session->symmetric.algorithm == ALG_XOR_VALUE) - // XOR parameter decryption formulation: - // XOR(parameter, hash, sessionAuth, nonceNewer, nonceOlder) - // Call XOR obfuscation function - CryptXORObfuscation(session->authHashAlg, &key.b, nonceCaller, - &(session->nonceTPM.b), cipherSize, buffer); - else - // Assume that it is one of the symmetric block ciphers. - ParmDecryptSym(session->symmetric.algorithm, session->authHashAlg, - session->symmetric.keyBits.sym, - &key.b, nonceCaller, &session->nonceTPM.b, - cipherSize, buffer); - - return TPM_RC_SUCCESS; -} - -//*** CryptComputeSymmetricUnique() -// This function computes the unique field in public area for symmetric objects. -void -CryptComputeSymmetricUnique( - TPMT_PUBLIC *publicArea, // IN: the object's public area - TPMT_SENSITIVE *sensitive, // IN: the associated sensitive area - TPM2B_DIGEST *unique // OUT: unique buffer - ) -{ - // For parents (symmetric and derivation), use an HMAC to compute - // the 'unique' field - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, restricted) - && IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, decrypt)) - { - // Unique field is HMAC(sensitive->seedValue, sensitive->sensitive) - HMAC_STATE hmacState; - unique->b.size = CryptHmacStart2B(&hmacState, publicArea->nameAlg, - &sensitive->seedValue.b); - CryptDigestUpdate2B(&hmacState.hashState, - &sensitive->sensitive.any.b); - CryptHmacEnd2B(&hmacState, &unique->b); - } - else - { - HASH_STATE hashState; - // Unique := Hash(sensitive->seedValue || sensitive->sensitive) - unique->t.size = CryptHashStart(&hashState, publicArea->nameAlg); - CryptDigestUpdate2B(&hashState, &sensitive->seedValue.b); - CryptDigestUpdate2B(&hashState, &sensitive->sensitive.any.b); - CryptHashEnd2B(&hashState, &unique->b); - } - return; -} - -//*** CryptCreateObject() -// This function creates an object. -// For an asymmetric key, it will create a key pair and, for a parent key, a seed -// value for child protections. -// -// For an symmetric object, (TPM_ALG_SYMCIPHER or TPM_ALG_KEYEDHASH), it will -// create a secret key if the caller did not provide one. It will create a random -// secret seed value that is hashed with the secret value to create the public -// unique value. -// -// 'publicArea', 'sensitive', and 'sensitiveCreate' are the only required parameters -// and are the only ones that are used by TPM2_Create(). The other parameters -// are optional and are used when the generated Object needs to be deterministic. -// This is the case for both Primary Objects and Derived Objects. -// -// When a seed value is provided, a RAND_STATE will be populated and used for -// all operations in the object generation that require a random number. In the -// simplest case, TPM2_CreatePrimary() will use 'seed', 'label' and 'context' with -// context being the hash of the template. If the Primary Object is in -// the Endorsement hierarchy, it will also populate 'proof' with ehProof. -// -// For derived keys, 'seed' will be the secret value from the parent, 'label' and -// 'context' will be set according to the parameters of TPM2_CreateLoaded() and -// 'hashAlg' will be set which causes the RAND_STATE to be a KDF generator. -// -// Return Type: TPM_RC -// TPM_RC_KEY a provided key is not an allowed value -// TPM_RC_KEY_SIZE key size in the public area does not match the size -// in the sensitive creation area for a symmetric key -// TPM_RC_NO_RESULT unable to get random values (only in derivation) -// TPM_RC_RANGE for an RSA key, the exponent is not supported -// TPM_RC_SIZE sensitive data size is larger than allowed for the -// scheme for a keyed hash object -// TPM_RC_VALUE exponent is not prime or could not find a prime using -// the provided parameters for an RSA key; -// unsupported name algorithm for an ECC key -TPM_RC -CryptCreateObject( - OBJECT *object, // IN: new object structure pointer - TPMS_SENSITIVE_CREATE *sensitiveCreate, // IN: sensitive creation - RAND_STATE *rand // IN: the random number generator - // to use - ) -{ - TPMT_PUBLIC *publicArea = &object->publicArea; - TPMT_SENSITIVE *sensitive = &object->sensitive; - TPM_RC result = TPM_RC_SUCCESS; -// - // Set the sensitive type for the object - sensitive->sensitiveType = publicArea->type; - - // For all objects, copy the initial authorization data - sensitive->authValue = sensitiveCreate->userAuth; - - // If the TPM is the source of the data, set the size of the provided data to - // zero so that there's no confusion about what to do. - if(IS_ATTRIBUTE(publicArea->objectAttributes, - TPMA_OBJECT, sensitiveDataOrigin)) - sensitiveCreate->data.t.size = 0; - - // Generate the key and unique fields for the asymmetric keys and just the - // sensitive value for symmetric object - switch(publicArea->type) - { -#if ALG_RSA - // Create RSA key - case ALG_RSA_VALUE: - // RSA uses full object so that it has a place to put the private - // exponent - result = CryptRsaGenerateKey(publicArea, sensitive, rand); - break; -#endif // ALG_RSA - -#if ALG_ECC - // Create ECC key - case ALG_ECC_VALUE: - result = CryptEccGenerateKey(publicArea, sensitive, rand); - break; -#endif // ALG_ECC - case ALG_SYMCIPHER_VALUE: - result = CryptGenerateKeySymmetric(publicArea, sensitive, - sensitiveCreate, rand); - break; - case ALG_KEYEDHASH_VALUE: - result = CryptGenerateKeyedHash(publicArea, sensitive, - sensitiveCreate, rand); - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - if(result != TPM_RC_SUCCESS) - return result; -// Create the sensitive seed value - // If this is a primary key in the endorsement hierarchy, stir the DRBG state - // This implementation uses both shProof and ehProof to make sure that there - // is no leakage of either. - if(object->attributes.primary && object->attributes.epsHierarchy) - { - DRBG_AdditionalData((DRBG_STATE *)rand, &gp.shProof.b); - DRBG_AdditionalData((DRBG_STATE *)rand, &gp.ehProof.b); - } - // Generate a seedValue that is the size of the digest produced by nameAlg - sensitive->seedValue.t.size = - DRBG_Generate(rand, sensitive->seedValue.t.buffer, - CryptHashGetDigestSize(publicArea->nameAlg)); - if(g_inFailureMode) - return TPM_RC_FAILURE; - else if(sensitive->seedValue.t.size == 0) - return TPM_RC_NO_RESULT; - // For symmetric objects, need to compute the unique value for the public area - if(publicArea->type == ALG_SYMCIPHER_VALUE - || publicArea->type == ALG_KEYEDHASH_VALUE) - { - CryptComputeSymmetricUnique(publicArea, sensitive, &publicArea->unique.sym); - } - else - { - // if this is an asymmetric key and it isn't a parent, then - // get rid of the seed. - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign) - || !IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, restricted)) - memset(&sensitive->seedValue, 0, sizeof(sensitive->seedValue)); - } - // Compute the name - PublicMarshalAndComputeName(publicArea, &object->name); - return result; -} - -//*** CryptGetSignHashAlg() -// Get the hash algorithm of signature from a TPMT_SIGNATURE structure. -// It assumes the signature is not NULL -// This is a function for easy access -TPMI_ALG_HASH -CryptGetSignHashAlg( - TPMT_SIGNATURE *auth // IN: signature - ) -{ - if(auth->sigAlg == ALG_NULL_VALUE) - FAIL(FATAL_ERROR_INTERNAL); - - // Get authHash algorithm based on signing scheme - switch(auth->sigAlg) - { -#if ALG_RSA - // If RSA is supported, both RSASSA and RSAPSS are required -# if !defined ALG_RSASSA_VALUE || !defined ALG_RSAPSS_VALUE -# error "RSASSA and RSAPSS are required for RSA" -# endif - case ALG_RSASSA_VALUE: - return auth->signature.rsassa.hash; - case ALG_RSAPSS_VALUE: - return auth->signature.rsapss.hash; -#endif // ALG_RSA - -#if ALG_ECC - // If ECC is defined, ECDSA is mandatory -# if !ALG_ECDSA -# error "ECDSA is requried for ECC" -# endif - case ALG_ECDSA_VALUE: - // SM2 and ECSCHNORR are optional - -# if ALG_SM2 - case ALG_SM2_VALUE: -# endif -# if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: -# endif - //all ECC signatures look the same - return auth->signature.ecdsa.hash; - -# if ALG_ECDAA - // Don't know how to verify an ECDAA signature - case ALG_ECDAA_VALUE: - break; -# endif - -#endif // ALG_ECC - - case ALG_HMAC_VALUE: - return auth->signature.hmac.hashAlg; - - default: - break; - } - return ALG_NULL_VALUE; -} - -//*** CryptIsSplitSign() -// This function us used to determine if the signing operation is a split -// signing operation that required a TPM2_Commit(). -// -BOOL -CryptIsSplitSign( - TPM_ALG_ID scheme // IN: the algorithm selector - ) -{ - switch(scheme) - { -# if ALG_ECDAA - case ALG_ECDAA_VALUE: - return TRUE; - break; -# endif // ALG_ECDAA - default: - return FALSE; - break; - } -} - -//*** CryptIsAsymSignScheme() -// This function indicates if a scheme algorithm is a sign algorithm. -BOOL -CryptIsAsymSignScheme( - TPMI_ALG_PUBLIC publicType, // IN: Type of the object - TPMI_ALG_ASYM_SCHEME scheme // IN: the scheme - ) -{ - BOOL isSignScheme = TRUE; - - switch(publicType) - { -#if ALG_RSA - case ALG_RSA_VALUE: - switch(scheme) - { -# if !ALG_RSASSA || !ALG_RSAPSS -# error "RSASSA and PSAPSS required if RSA used." -# endif - case ALG_RSASSA_VALUE: - case ALG_RSAPSS_VALUE: - break; - default: - isSignScheme = FALSE; - break; - } - break; -#endif // ALG_RSA - -#if ALG_ECC - // If ECC is implemented ECDSA is required - case ALG_ECC_VALUE: - switch(scheme) - { - // Support for ECDSA is required for ECC - case ALG_ECDSA_VALUE: -#if ALG_ECDAA // ECDAA is optional - case ALG_ECDAA_VALUE: -#endif -#if ALG_ECSCHNORR // Schnorr is also optional - case ALG_ECSCHNORR_VALUE: -#endif -#if ALG_SM2 // SM2 is optional - case ALG_SM2_VALUE: -#endif - break; - default: - isSignScheme = FALSE; - break; - } - break; -#endif // ALG_ECC - default: - isSignScheme = FALSE; - break; - } - return isSignScheme; -} - -//*** CryptIsAsymDecryptScheme() -// This function indicate if a scheme algorithm is a decrypt algorithm. -BOOL -CryptIsAsymDecryptScheme( - TPMI_ALG_PUBLIC publicType, // IN: Type of the object - TPMI_ALG_ASYM_SCHEME scheme // IN: the scheme - ) -{ - BOOL isDecryptScheme = TRUE; - - switch(publicType) - { -#if ALG_RSA - case ALG_RSA_VALUE: - switch(scheme) - { - case ALG_RSAES_VALUE: - case ALG_OAEP_VALUE: - break; - default: - isDecryptScheme = FALSE; - break; - } - break; -#endif // ALG_RSA - -#if ALG_ECC - // If ECC is implemented ECDH is required - case ALG_ECC_VALUE: - switch(scheme) - { -#if !ALG_ECDH -# error "ECDH is required for ECC" -#endif - case ALG_ECDH_VALUE: -#if ALG_SM2 - case ALG_SM2_VALUE: -#endif -#if ALG_ECMQV - case ALG_ECMQV_VALUE: -#endif - break; - default: - isDecryptScheme = FALSE; - break; - } - break; -#endif // ALG_ECC - default: - isDecryptScheme = FALSE; - break; - } - return isDecryptScheme; -} - -//*** CryptSelectSignScheme() -// This function is used by the attestation and signing commands. It implements -// the rules for selecting the signature scheme to use in signing. This function -// requires that the signing key either be TPM_RH_NULL or be loaded. -// -// If a default scheme is defined in object, the default scheme should be chosen, -// otherwise, the input scheme should be chosen. -// In the case that both object and input scheme has a non-NULL scheme -// algorithm, if the schemes are compatible, the input scheme will be chosen. -// -// This function should not be called if 'signObject->publicArea.type' == -// ALG_SYMCIPHER. -// -// Return Type: BOOL -// TRUE(1) scheme selected -// FALSE(0) both 'scheme' and key's default scheme are empty; or -// 'scheme' is empty while key's default scheme requires -// explicit input scheme (split signing); or -// non-empty default key scheme differs from 'scheme' -BOOL -CryptSelectSignScheme( - OBJECT *signObject, // IN: signing key - TPMT_SIG_SCHEME *scheme // IN/OUT: signing scheme - ) -{ - TPMT_SIG_SCHEME *objectScheme; - TPMT_PUBLIC *publicArea; - BOOL OK; - - // If the signHandle is TPM_RH_NULL, then the NULL scheme is used, regardless - // of the setting of scheme - if(signObject == NULL) - { - OK = TRUE; - scheme->scheme = ALG_NULL_VALUE; - scheme->details.any.hashAlg = ALG_NULL_VALUE; - } - else - { - // assignment to save typing. - publicArea = &signObject->publicArea; - - // A symmetric cipher can be used to encrypt and decrypt but it can't - // be used for signing - if(publicArea->type == ALG_SYMCIPHER_VALUE) - return FALSE; - // Point to the scheme object - if(CryptIsAsymAlgorithm(publicArea->type)) - objectScheme = - (TPMT_SIG_SCHEME *)&publicArea->parameters.asymDetail.scheme; - else - objectScheme = - (TPMT_SIG_SCHEME *)&publicArea->parameters.keyedHashDetail.scheme; - - // If the object doesn't have a default scheme, then use the - // input scheme. - if(objectScheme->scheme == ALG_NULL_VALUE) - { - // Input and default can't both be NULL - OK = (scheme->scheme != ALG_NULL_VALUE); - // Assume that the scheme is compatible with the key. If not, - // an error will be generated in the signing operation. - } - else if(scheme->scheme == ALG_NULL_VALUE) - { - // input scheme is NULL so use default - - // First, check to see if the default requires that the caller - // provided scheme data - OK = !CryptIsSplitSign(objectScheme->scheme); - if(OK) - { - // The object has a scheme and the input is TPM_ALG_NULL so copy - // the object scheme as the final scheme. It is better to use a - // structure copy than a copy of the individual fields. - *scheme = *objectScheme; - } - } - else - { - // Both input and object have scheme selectors - // If the scheme and the hash are not the same then... - // NOTE: the reason that there is no copy here is that the input - // might contain extra data for a split signing scheme and that - // data is not in the object so, it has to be preserved. - OK = (objectScheme->scheme == scheme->scheme) - && (objectScheme->details.any.hashAlg - == scheme->details.any.hashAlg); - } - } - return OK; -} - -//*** CryptSign() -// Sign a digest with asymmetric key or HMAC. -// This function is called by attestation commands and the generic TPM2_Sign -// command. -// This function checks the key scheme and digest size. It does not -// check if the sign operation is allowed for restricted key. It should be -// checked before the function is called. -// The function will assert if the key is not a signing key. -// -// Return Type: TPM_RC -// TPM_RC_SCHEME 'signScheme' is not compatible with the signing key type -// TPM_RC_VALUE 'digest' value is greater than the modulus of -// 'signHandle' or size of 'hashData' does not match hash -// algorithm in'signScheme' (for an RSA key); -// invalid commit status or failed to generate "r" value -// (for an ECC key) -TPM_RC -CryptSign( - OBJECT *signKey, // IN: signing key - TPMT_SIG_SCHEME *signScheme, // IN: sign scheme. - TPM2B_DIGEST *digest, // IN: The digest being signed - TPMT_SIGNATURE *signature // OUT: signature - ) -{ - TPM_RC result = TPM_RC_SCHEME; - - // Initialize signature scheme - signature->sigAlg = signScheme->scheme; - - // If the signature algorithm is TPM_ALG_NULL or the signing key is NULL, - // then we are done - if((signature->sigAlg == ALG_NULL_VALUE) || (signKey == NULL)) - return TPM_RC_SUCCESS; - - // Initialize signature hash - // Note: need to do the check for TPM_ALG_NULL first because the null scheme - // doesn't have a hashAlg member. - signature->signature.any.hashAlg = signScheme->details.any.hashAlg; - - // perform sign operation based on different key type - switch(signKey->publicArea.type) - { -#if ALG_RSA - case ALG_RSA_VALUE: - result = CryptRsaSign(signature, signKey, digest, NULL); - break; -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - // The reason that signScheme is passed to CryptEccSign but not to the - // other signing methods is that the signing for ECC may be split and - // need the 'r' value that is in the scheme but not in the signature. - result = CryptEccSign(signature, signKey, digest, - (TPMT_ECC_SCHEME *)signScheme, NULL); - break; -#endif // ALG_ECC - case ALG_KEYEDHASH_VALUE: - result = CryptHmacSign(signature, signKey, digest); - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - return result; -} - -//*** CryptValidateSignature() -// This function is used to verify a signature. It is called by -// TPM2_VerifySignature() and TPM2_PolicySigned. -// -// Since this operation only requires use of a public key, no consistency -// checks are necessary for the key to signature type because a caller can load -// any public key that they like with any scheme that they like. This routine -// simply makes sure that the signature is correct, whatever the type. -// -// Return Type: TPM_RC -// TPM_RC_SIGNATURE the signature is not genuine -// TPM_RC_SCHEME the scheme is not supported -// TPM_RC_HANDLE an HMAC key was selected but the -// private part of the key is not loaded -TPM_RC -CryptValidateSignature( - TPMI_DH_OBJECT keyHandle, // IN: The handle of sign key - TPM2B_DIGEST *digest, // IN: The digest being validated - TPMT_SIGNATURE *signature // IN: signature - ) -{ - // NOTE: HandleToObject will either return a pointer to a loaded object or - // will assert. It will never return a non-valid value. This makes it save - // to initialize 'publicArea' with the return value from HandleToObject() - // without checking it first. - OBJECT *signObject = HandleToObject(keyHandle); - TPMT_PUBLIC *publicArea = &signObject->publicArea; - TPM_RC result = TPM_RC_SCHEME; - - // The input unmarshaling should prevent any input signature from being - // a NULL signature, but just in case - if(signature->sigAlg == ALG_NULL_VALUE) - return TPM_RC_SIGNATURE; - - switch(publicArea->type) - { -#if ALG_RSA - case ALG_RSA_VALUE: - { - // - // Call RSA code to verify signature - result = CryptRsaValidateSignature(signature, signObject, digest); - break; - } -#endif // ALG_RSA - -#if ALG_ECC - case ALG_ECC_VALUE: - result = CryptEccValidateSignature(signature, signObject, digest); - break; -#endif // ALG_ECC - - case ALG_KEYEDHASH_VALUE: - if(signObject->attributes.publicOnly) - result = TPM_RCS_HANDLE; - else - result = CryptHMACVerifySignature(signObject, digest, signature); - break; - default: - break; - } - return result; -} - -//*** CryptGetTestResult -// This function returns the results of a self-test function. -// Note: the behavior in this function is NOT the correct behavior for a real -// TPM implementation. An artificial behavior is placed here due to the -// limitation of a software simulation environment. For the correct behavior, -// consult the part 3 specification for TPM2_GetTestResult(). -TPM_RC -CryptGetTestResult( - TPM2B_MAX_BUFFER *outData // OUT: test result data - ) -{ - outData->t.size = 0; - return TPM_RC_SUCCESS; -} - -//*** CryptValidateKeys() -// This function is used to verify that the key material of and object is valid. -// For a 'publicOnly' object, the key is verified for size and, if it is an ECC -// key, it is verified to be on the specified curve. For a key with a sensitive -// area, the binding between the public and private parts of the key are verified. -// If the nameAlg of the key is TPM_ALG_NULL, then the size of the sensitive area -// is verified but the public portion is not verified, unless the key is an RSA key. -// For an RSA key, the reason for loading the sensitive area is to use it. The -// only way to use a private RSA key is to compute the private exponent. To compute -// the private exponent, the public modulus is used. -// Return Type: TPM_RC -// TPM_RC_BINDING the public and private parts are not cryptographically -// bound -// TPM_RC_HASH cannot have a publicOnly key with nameAlg of TPM_ALG_NULL -// TPM_RC_KEY the public unique is not valid -// TPM_RC_KEY_SIZE the private area key is not valid -// TPM_RC_TYPE the types of the sensitive and private parts do not match -TPM_RC -CryptValidateKeys( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive, - TPM_RC blamePublic, - TPM_RC blameSensitive - ) -{ - TPM_RC result; - UINT16 keySizeInBytes; - UINT16 digestSize = CryptHashGetDigestSize(publicArea->nameAlg); - TPMU_PUBLIC_PARMS *params = &publicArea->parameters; - TPMU_PUBLIC_ID *unique = &publicArea->unique; - - if(sensitive != NULL) - { - // Make sure that the types of the public and sensitive are compatible - if(publicArea->type != sensitive->sensitiveType) - return TPM_RCS_TYPE + blameSensitive; - // Make sure that the authValue is not bigger than allowed - // If there is no name algorithm, then the size just needs to be less than - // the maximum size of the buffer used for authorization. That size check - // was made during unmarshaling of the sensitive area - if((sensitive->authValue.t.size) > digestSize && (digestSize > 0)) - return TPM_RCS_SIZE + blameSensitive; - } - switch(publicArea->type) - { -#if ALG_RSA - case ALG_RSA_VALUE: - keySizeInBytes = BITS_TO_BYTES(params->rsaDetail.keyBits); - - // Regardless of whether there is a sensitive area, the public modulus - // needs to have the correct size. Otherwise, it can't be used for - // any public key operation nor can it be used to compute the private - // exponent. - // NOTE: This implementation only supports key sizes that are multiples - // of 1024 bits which means that the MSb of the 0th byte will always be - // SET in any prime and in the public modulus. - if((unique->rsa.t.size != keySizeInBytes) - || (unique->rsa.t.buffer[0] < 0x80)) - return TPM_RCS_KEY + blamePublic; - if(params->rsaDetail.exponent != 0 - && params->rsaDetail.exponent < 7) - return TPM_RCS_VALUE + blamePublic; - if(sensitive != NULL) - { - // If there is a sensitive area, it has to be the correct size - // including having the correct high order bit SET. - if(((sensitive->sensitive.rsa.t.size * 2) != keySizeInBytes) - || (sensitive->sensitive.rsa.t.buffer[0] < 0x80)) - return TPM_RCS_KEY_SIZE + blameSensitive; - } - break; -#endif -#if ALG_ECC - case ALG_ECC_VALUE: - { - TPMI_ECC_CURVE curveId; - curveId = params->eccDetail.curveID; - keySizeInBytes = BITS_TO_BYTES(CryptEccGetKeySizeForCurve(curveId)); - if(sensitive == NULL) - { - // Validate the public key size - if(unique->ecc.x.t.size != keySizeInBytes - || unique->ecc.y.t.size != keySizeInBytes) - return TPM_RCS_KEY + blamePublic; - if(publicArea->nameAlg != ALG_NULL_VALUE) - { - if(!CryptEccIsPointOnCurve(curveId, &unique->ecc)) - return TPM_RCS_ECC_POINT + blamePublic; - } - } - else - { - // If the nameAlg is TPM_ALG_NULL, then only verify that the - // private part of the key is OK. - if(!CryptEccIsValidPrivateKey(&sensitive->sensitive.ecc, - curveId)) - return TPM_RCS_KEY_SIZE; - if(publicArea->nameAlg != ALG_NULL_VALUE) - { - // Full key load, verify that the public point belongs to the - // private key. - TPMS_ECC_POINT toCompare; - result = CryptEccPointMultiply(&toCompare, curveId, NULL, - &sensitive->sensitive.ecc, - NULL, NULL); - if(result != TPM_RC_SUCCESS) - return TPM_RCS_BINDING; - else - { - // Make sure that the private key generated the public key. - // The input values and the values produced by the point - // multiply may not be the same size so adjust the computed - // value to match the size of the input value by adding or - // removing zeros. - AdjustNumberB(&toCompare.x.b, unique->ecc.x.t.size); - AdjustNumberB(&toCompare.y.b, unique->ecc.y.t.size); - if(!MemoryEqual2B(&unique->ecc.x.b, &toCompare.x.b) - || !MemoryEqual2B(&unique->ecc.y.b, &toCompare.y.b)) - return TPM_RCS_BINDING; - } - } - } - break; - } -#endif - default: - // Checks for SYMCIPHER and KEYEDHASH are largely the same - // If public area has a nameAlg, then validate the public area size - // and if there is also a sensitive area, validate the binding - - // For consistency, if the object is public-only just make sure that - // the unique field is consistent with the name algorithm - if(sensitive == NULL) - { - if(unique->sym.t.size != digestSize) - return TPM_RCS_KEY + blamePublic; - } - else - { - // Make sure that the key size in the sensitive area is consistent. - if(publicArea->type == ALG_SYMCIPHER_VALUE) - { - result = CryptSymKeyValidate(¶ms->symDetail.sym, - &sensitive->sensitive.sym); - if(result != TPM_RC_SUCCESS) - return result + blameSensitive; - } - else - { - // For a keyed hash object, the key has to be less than the - // smaller of the block size of the hash used in the scheme or - // 128 bytes. The worst case value is limited by the - // unmarshaling code so the only thing left to be checked is - // that it does not exceed the block size of the hash. - // by the hash algorithm of the scheme. - TPMT_KEYEDHASH_SCHEME *scheme; - UINT16 maxSize; - scheme = ¶ms->keyedHashDetail.scheme; - if(scheme->scheme == ALG_XOR_VALUE) - { - maxSize = CryptHashGetBlockSize(scheme->details.xor.hashAlg); - } - else if(scheme->scheme == ALG_HMAC_VALUE) - { - maxSize = CryptHashGetBlockSize(scheme->details.hmac.hashAlg); - } - else if(scheme->scheme == ALG_NULL_VALUE) - { - // Not signing or xor so must be a data block - maxSize = 128; - } - else - return TPM_RCS_SCHEME + blamePublic; - if(sensitive->sensitive.bits.t.size > maxSize) - return TPM_RCS_KEY_SIZE + blameSensitive; - } - // If there is a nameAlg, check the binding - if(publicArea->nameAlg != ALG_NULL_VALUE) - { - TPM2B_DIGEST compare; - if(sensitive->seedValue.t.size != digestSize) - return TPM_RCS_KEY_SIZE + blameSensitive; - - CryptComputeSymmetricUnique(publicArea, sensitive, &compare); - if(!MemoryEqual2B(&unique->sym.b, &compare.b)) - return TPM_RC_BINDING; - } - } - break; - } - // For a parent, need to check that the seedValue is the correct size for - // protections. It should be at least half the size of the nameAlg - if(IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, restricted) - && IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, decrypt) - && sensitive != NULL - && publicArea->nameAlg != ALG_NULL_VALUE) - { - if((sensitive->seedValue.t.size < (digestSize / 2)) - || (sensitive->seedValue.t.size > digestSize)) - return TPM_RCS_SIZE + blameSensitive; - } - return TPM_RC_SUCCESS; -} - -//*** CryptSelectMac() -// This function is used to set the MAC scheme based on the key parameters and -// the input scheme. -// Return Type: TPM_RC -// TPM_RC_SCHEME the scheme is not a valid mac scheme -// TPM_RC_TYPE the input key is not a type that supports a mac -// TPM_RC_VALUE the input scheme and the key scheme are not compatible -TPM_RC -CryptSelectMac( - TPMT_PUBLIC *publicArea, - TPMI_ALG_MAC_SCHEME *inMac -) -{ - TPM_ALG_ID macAlg = ALG_NULL_VALUE; - switch(publicArea->type) - { - case ALG_KEYEDHASH_VALUE: - { - // Local value to keep lines from getting too long - TPMT_KEYEDHASH_SCHEME *scheme; - scheme = &publicArea->parameters.keyedHashDetail.scheme; - // Expect that the scheme is either HMAC or NULL - if(scheme->scheme != ALG_NULL_VALUE) - macAlg = scheme->details.hmac.hashAlg; - break; - } - case ALG_SYMCIPHER_VALUE: - { - TPMT_SYM_DEF_OBJECT *scheme; - scheme = &publicArea->parameters.symDetail.sym; - // Expect that the scheme is either valid symmetric cipher or NULL - if(scheme->algorithm != ALG_NULL_VALUE) - macAlg = scheme->mode.sym; - break; - } - default: - return TPM_RCS_TYPE; - } - // If the input value is not TPM_ALG_NULL ... - if(*inMac != ALG_NULL_VALUE) - { - // ... then either the scheme in the key must be TPM_ALG_NULL or the input - // value must match - if((macAlg != ALG_NULL_VALUE) && (*inMac != macAlg)) - return TPM_RCS_VALUE; - } - else - { - // Since the input value is TPM_ALG_NULL, then the key value can't be - // TPM_ALG_NULL - if(macAlg == ALG_NULL_VALUE) - return TPM_RCS_VALUE; - *inMac = macAlg; - } - if(!CryptMacIsValidForKey(publicArea->type, *inMac, FALSE)) - return TPM_RCS_SCHEME; - return TPM_RC_SUCCESS; -} - -//*** CryptMacIsValidForKey() -// Check to see if the key type is compatible with the mac type -BOOL -CryptMacIsValidForKey( - TPM_ALG_ID keyType, - TPM_ALG_ID macAlg, - BOOL flag -) -{ - switch(keyType) - { - case ALG_KEYEDHASH_VALUE: - return CryptHashIsValidAlg(macAlg, flag); - break; - case ALG_SYMCIPHER_VALUE: - return CryptSmacIsValidAlg(macAlg, flag); - break; - default: - break; - } - return FALSE; -} - -//*** CryptSmacIsValidAlg() -// This function is used to test if an algorithm is a supported SMAC algorithm. It -// needs to be updated as new algorithms are added. -BOOL -CryptSmacIsValidAlg( - TPM_ALG_ID alg, - BOOL FLAG // IN: Indicates if TPM_ALG_NULL is valid -) -{ - switch (alg) - { -#if ALG_CMAC - case ALG_CMAC_VALUE: - return TRUE; - break; -#endif - case ALG_NULL_VALUE: - return FLAG; - break; - default: - return FALSE; - } -} - -//*** CryptSymModeIsValid() -// Function checks to see if an algorithm ID is a valid, symmetric block cipher -// mode for the TPM. If 'flag' is SET, them TPM_ALG_NULL is a valid mode. -// not include the modes used for SMAC -BOOL -CryptSymModeIsValid( - TPM_ALG_ID mode, - BOOL flag -) -{ - switch(mode) - { -#if ALG_CTR - case ALG_CTR_VALUE: -#endif // ALG_CTR -#if ALG_OFB - case ALG_OFB_VALUE: -#endif // ALG_OFB -#if ALG_CBC - case ALG_CBC_VALUE: -#endif // ALG_CBC -#if ALG_CFB - case ALG_CFB_VALUE: -#endif // ALG_CFB -#if ALG_ECB - case ALG_ECB_VALUE: -#endif // ALG_ECB - return TRUE; - case ALG_NULL_VALUE: - return flag; - break; - default: - break; - } - return FALSE; -} - - - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/PrimeData.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/PrimeData.c deleted file mode 100644 index 00072188d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/PrimeData.c +++ /dev/null @@ -1,422 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" - -// This table is the product of all of the primes up to 1000. -// Checking to see if there is a GCD between a prime candidate -// and this number will eliminate many prime candidates from -// consideration before running Miller-Rabin on the result. - -const BN_STRUCT(43 * RADIX_BITS) s_CompositeOfSmallPrimes_ = -{44, 44, -{ 0x2ED42696, 0x2BBFA177, 0x4820594F, 0xF73F4841, -0xBFAC313A, 0xCAC3EB81, 0xF6F26BF8, 0x7FAB5061, -0x59746FB7, 0xF71377F6, 0x3B19855B, 0xCBD03132, -0xBB92EF1B, 0x3AC3152C, 0xE87C8273, 0xC0AE0E69, -0x74A9E295, 0x448CCE86, 0x63CA1907, 0x8A0BF944, -0xF8CC3BE0, 0xC26F0AF5, 0xC501C02F, 0x6579441A, -0xD1099CDA, 0x6BC76A00, 0xC81A3228, 0xBFB1AB25, -0x70FA3841, 0x51B3D076, 0xCC2359ED, 0xD9EE0769, -0x75E47AF0, 0xD45FF31E, 0x52CCE4F6, 0x04DBC891, -0x96658ED2, 0x1753EFE5, 0x3AE4A5A6, 0x8FD4A97F, -0x8B15E7EB, 0x0243C3E1, 0xE0F0C31D, 0x0000000B } -}; - -bigConst s_CompositeOfSmallPrimes = (const bigNum)&s_CompositeOfSmallPrimes_; - -// This table contains a bit for each of the odd values between 1 and 2^16 + 1. -// This table allows fast checking of the primes in that range. -// Don't change the size of this table unless you are prepared to do redo -// IsPrimeInt(). - -const uint32_t s_LastPrimeInTable = 65537; -const uint32_t s_PrimeTableSize = 4097; -const uint32_t s_PrimesInTable = 6542; -const unsigned char s_PrimeTable[] = { - 0x6e, 0xcb, 0xb4, 0x64, 0x9a, 0x12, 0x6d, 0x81, 0x32, 0x4c, 0x4a, 0x86, - 0x0d, 0x82, 0x96, 0x21, 0xc9, 0x34, 0x04, 0x5a, 0x20, 0x61, 0x89, 0xa4, - 0x44, 0x11, 0x86, 0x29, 0xd1, 0x82, 0x28, 0x4a, 0x30, 0x40, 0x42, 0x32, - 0x21, 0x99, 0x34, 0x08, 0x4b, 0x06, 0x25, 0x42, 0x84, 0x48, 0x8a, 0x14, - 0x05, 0x42, 0x30, 0x6c, 0x08, 0xb4, 0x40, 0x0b, 0xa0, 0x08, 0x51, 0x12, - 0x28, 0x89, 0x04, 0x65, 0x98, 0x30, 0x4c, 0x80, 0x96, 0x44, 0x12, 0x80, - 0x21, 0x42, 0x12, 0x41, 0xc9, 0x04, 0x21, 0xc0, 0x32, 0x2d, 0x98, 0x00, - 0x00, 0x49, 0x04, 0x08, 0x81, 0x96, 0x68, 0x82, 0xb0, 0x25, 0x08, 0x22, - 0x48, 0x89, 0xa2, 0x40, 0x59, 0x26, 0x04, 0x90, 0x06, 0x40, 0x43, 0x30, - 0x44, 0x92, 0x00, 0x69, 0x10, 0x82, 0x08, 0x08, 0xa4, 0x0d, 0x41, 0x12, - 0x60, 0xc0, 0x00, 0x24, 0xd2, 0x22, 0x61, 0x08, 0x84, 0x04, 0x1b, 0x82, - 0x01, 0xd3, 0x10, 0x01, 0x02, 0xa0, 0x44, 0xc0, 0x22, 0x60, 0x91, 0x14, - 0x0c, 0x40, 0xa6, 0x04, 0xd2, 0x94, 0x20, 0x09, 0x94, 0x20, 0x52, 0x00, - 0x08, 0x10, 0xa2, 0x4c, 0x00, 0x82, 0x01, 0x51, 0x10, 0x08, 0x8b, 0xa4, - 0x25, 0x9a, 0x30, 0x44, 0x81, 0x10, 0x4c, 0x03, 0x02, 0x25, 0x52, 0x80, - 0x08, 0x49, 0x84, 0x20, 0x50, 0x32, 0x00, 0x18, 0xa2, 0x40, 0x11, 0x24, - 0x28, 0x01, 0x84, 0x01, 0x01, 0xa0, 0x41, 0x0a, 0x12, 0x45, 0x00, 0x36, - 0x08, 0x00, 0x26, 0x29, 0x83, 0x82, 0x61, 0xc0, 0x80, 0x04, 0x10, 0x10, - 0x6d, 0x00, 0x22, 0x48, 0x58, 0x26, 0x0c, 0xc2, 0x10, 0x48, 0x89, 0x24, - 0x20, 0x58, 0x20, 0x45, 0x88, 0x24, 0x00, 0x19, 0x02, 0x25, 0xc0, 0x10, - 0x68, 0x08, 0x14, 0x01, 0xca, 0x32, 0x28, 0x80, 0x00, 0x04, 0x4b, 0x26, - 0x00, 0x13, 0x90, 0x60, 0x82, 0x80, 0x25, 0xd0, 0x00, 0x01, 0x10, 0x32, - 0x0c, 0x43, 0x86, 0x21, 0x11, 0x00, 0x08, 0x43, 0x24, 0x04, 0x48, 0x10, - 0x0c, 0x90, 0x92, 0x00, 0x43, 0x20, 0x2d, 0x00, 0x06, 0x09, 0x88, 0x24, - 0x40, 0xc0, 0x32, 0x09, 0x09, 0x82, 0x00, 0x53, 0x80, 0x08, 0x80, 0x96, - 0x41, 0x81, 0x00, 0x40, 0x48, 0x10, 0x48, 0x08, 0x96, 0x48, 0x58, 0x20, - 0x29, 0xc3, 0x80, 0x20, 0x02, 0x94, 0x60, 0x92, 0x00, 0x20, 0x81, 0x22, - 0x44, 0x10, 0xa0, 0x05, 0x40, 0x90, 0x01, 0x49, 0x20, 0x04, 0x0a, 0x00, - 0x24, 0x89, 0x34, 0x48, 0x13, 0x80, 0x2c, 0xc0, 0x82, 0x29, 0x00, 0x24, - 0x45, 0x08, 0x00, 0x08, 0x98, 0x36, 0x04, 0x52, 0x84, 0x04, 0xd0, 0x04, - 0x00, 0x8a, 0x90, 0x44, 0x82, 0x32, 0x65, 0x18, 0x90, 0x00, 0x0a, 0x02, - 0x01, 0x40, 0x02, 0x28, 0x40, 0xa4, 0x04, 0x92, 0x30, 0x04, 0x11, 0x86, - 0x08, 0x42, 0x00, 0x2c, 0x52, 0x04, 0x08, 0xc9, 0x84, 0x60, 0x48, 0x12, - 0x09, 0x99, 0x24, 0x44, 0x00, 0x24, 0x00, 0x03, 0x14, 0x21, 0x00, 0x10, - 0x01, 0x1a, 0x32, 0x05, 0x88, 0x20, 0x40, 0x40, 0x06, 0x09, 0xc3, 0x84, - 0x40, 0x01, 0x30, 0x60, 0x18, 0x02, 0x68, 0x11, 0x90, 0x0c, 0x02, 0xa2, - 0x04, 0x00, 0x86, 0x29, 0x89, 0x14, 0x24, 0x82, 0x02, 0x41, 0x08, 0x80, - 0x04, 0x19, 0x80, 0x08, 0x10, 0x12, 0x68, 0x42, 0xa4, 0x04, 0x00, 0x02, - 0x61, 0x10, 0x06, 0x0c, 0x10, 0x00, 0x01, 0x12, 0x10, 0x20, 0x03, 0x94, - 0x21, 0x42, 0x12, 0x65, 0x18, 0x94, 0x0c, 0x0a, 0x04, 0x28, 0x01, 0x14, - 0x29, 0x0a, 0xa4, 0x40, 0xd0, 0x00, 0x40, 0x01, 0x90, 0x04, 0x41, 0x20, - 0x2d, 0x40, 0x82, 0x48, 0xc1, 0x20, 0x00, 0x10, 0x30, 0x01, 0x08, 0x24, - 0x04, 0x59, 0x84, 0x24, 0x00, 0x02, 0x29, 0x82, 0x00, 0x61, 0x58, 0x02, - 0x48, 0x81, 0x16, 0x48, 0x10, 0x00, 0x21, 0x11, 0x06, 0x00, 0xca, 0xa0, - 0x40, 0x02, 0x00, 0x04, 0x91, 0xb0, 0x00, 0x42, 0x04, 0x0c, 0x81, 0x06, - 0x09, 0x48, 0x14, 0x25, 0x92, 0x20, 0x25, 0x11, 0xa0, 0x00, 0x0a, 0x86, - 0x0c, 0xc1, 0x02, 0x48, 0x00, 0x20, 0x45, 0x08, 0x32, 0x00, 0x98, 0x06, - 0x04, 0x13, 0x22, 0x00, 0x82, 0x04, 0x48, 0x81, 0x14, 0x44, 0x82, 0x12, - 0x24, 0x18, 0x10, 0x40, 0x43, 0x80, 0x28, 0xd0, 0x04, 0x20, 0x81, 0x24, - 0x64, 0xd8, 0x00, 0x2c, 0x09, 0x12, 0x08, 0x41, 0xa2, 0x00, 0x00, 0x02, - 0x41, 0xca, 0x20, 0x41, 0xc0, 0x10, 0x01, 0x18, 0xa4, 0x04, 0x18, 0xa4, - 0x20, 0x12, 0x94, 0x20, 0x83, 0xa0, 0x40, 0x02, 0x32, 0x44, 0x80, 0x04, - 0x00, 0x18, 0x00, 0x0c, 0x40, 0x86, 0x60, 0x8a, 0x00, 0x64, 0x88, 0x12, - 0x05, 0x01, 0x82, 0x00, 0x4a, 0xa2, 0x01, 0xc1, 0x10, 0x61, 0x09, 0x04, - 0x01, 0x88, 0x00, 0x60, 0x01, 0xb4, 0x40, 0x08, 0x06, 0x01, 0x03, 0x80, - 0x08, 0x40, 0x94, 0x04, 0x8a, 0x20, 0x29, 0x80, 0x02, 0x0c, 0x52, 0x02, - 0x01, 0x42, 0x84, 0x00, 0x80, 0x84, 0x64, 0x02, 0x32, 0x48, 0x00, 0x30, - 0x44, 0x40, 0x22, 0x21, 0x00, 0x02, 0x08, 0xc3, 0xa0, 0x04, 0xd0, 0x20, - 0x40, 0x18, 0x16, 0x40, 0x40, 0x00, 0x28, 0x52, 0x90, 0x08, 0x82, 0x14, - 0x01, 0x18, 0x10, 0x08, 0x09, 0x82, 0x40, 0x0a, 0xa0, 0x20, 0x93, 0x80, - 0x08, 0xc0, 0x00, 0x20, 0x52, 0x00, 0x05, 0x01, 0x10, 0x40, 0x11, 0x06, - 0x0c, 0x82, 0x00, 0x00, 0x4b, 0x90, 0x44, 0x9a, 0x00, 0x28, 0x80, 0x90, - 0x04, 0x4a, 0x06, 0x09, 0x43, 0x02, 0x28, 0x00, 0x34, 0x01, 0x18, 0x00, - 0x65, 0x09, 0x80, 0x44, 0x03, 0x00, 0x24, 0x02, 0x82, 0x61, 0x48, 0x14, - 0x41, 0x00, 0x12, 0x28, 0x00, 0x34, 0x08, 0x51, 0x04, 0x05, 0x12, 0x90, - 0x28, 0x89, 0x84, 0x60, 0x12, 0x10, 0x49, 0x10, 0x26, 0x40, 0x49, 0x82, - 0x00, 0x91, 0x10, 0x01, 0x0a, 0x24, 0x40, 0x88, 0x10, 0x4c, 0x10, 0x04, - 0x00, 0x50, 0xa2, 0x2c, 0x40, 0x90, 0x48, 0x0a, 0xb0, 0x01, 0x50, 0x12, - 0x08, 0x00, 0xa4, 0x04, 0x09, 0xa0, 0x28, 0x92, 0x02, 0x00, 0x43, 0x10, - 0x21, 0x02, 0x20, 0x41, 0x81, 0x32, 0x00, 0x08, 0x04, 0x0c, 0x52, 0x00, - 0x21, 0x49, 0x84, 0x20, 0x10, 0x02, 0x01, 0x81, 0x10, 0x48, 0x40, 0x22, - 0x01, 0x01, 0x84, 0x69, 0xc1, 0x30, 0x01, 0xc8, 0x02, 0x44, 0x88, 0x00, - 0x0c, 0x01, 0x02, 0x2d, 0xc0, 0x12, 0x61, 0x00, 0xa0, 0x00, 0xc0, 0x30, - 0x40, 0x01, 0x12, 0x08, 0x0b, 0x20, 0x00, 0x80, 0x94, 0x40, 0x01, 0x84, - 0x40, 0x00, 0x32, 0x00, 0x10, 0x84, 0x00, 0x0b, 0x24, 0x00, 0x01, 0x06, - 0x29, 0x8a, 0x84, 0x41, 0x80, 0x10, 0x08, 0x08, 0x94, 0x4c, 0x03, 0x80, - 0x01, 0x40, 0x96, 0x40, 0x41, 0x20, 0x20, 0x50, 0x22, 0x25, 0x89, 0xa2, - 0x40, 0x40, 0xa4, 0x20, 0x02, 0x86, 0x28, 0x01, 0x20, 0x21, 0x4a, 0x10, - 0x08, 0x00, 0x14, 0x08, 0x40, 0x04, 0x25, 0x42, 0x02, 0x21, 0x43, 0x10, - 0x04, 0x92, 0x00, 0x21, 0x11, 0xa0, 0x4c, 0x18, 0x22, 0x09, 0x03, 0x84, - 0x41, 0x89, 0x10, 0x04, 0x82, 0x22, 0x24, 0x01, 0x14, 0x08, 0x08, 0x84, - 0x08, 0xc1, 0x00, 0x09, 0x42, 0xb0, 0x41, 0x8a, 0x02, 0x00, 0x80, 0x36, - 0x04, 0x49, 0xa0, 0x24, 0x91, 0x00, 0x00, 0x02, 0x94, 0x41, 0x92, 0x02, - 0x01, 0x08, 0x06, 0x08, 0x09, 0x00, 0x01, 0xd0, 0x16, 0x28, 0x89, 0x80, - 0x60, 0x00, 0x00, 0x68, 0x01, 0x90, 0x0c, 0x50, 0x20, 0x01, 0x40, 0x80, - 0x40, 0x42, 0x30, 0x41, 0x00, 0x20, 0x25, 0x81, 0x06, 0x40, 0x49, 0x00, - 0x08, 0x01, 0x12, 0x49, 0x00, 0xa0, 0x20, 0x18, 0x30, 0x05, 0x01, 0xa6, - 0x00, 0x10, 0x24, 0x28, 0x00, 0x02, 0x20, 0xc8, 0x20, 0x00, 0x88, 0x12, - 0x0c, 0x90, 0x92, 0x00, 0x02, 0x26, 0x01, 0x42, 0x16, 0x49, 0x00, 0x04, - 0x24, 0x42, 0x02, 0x01, 0x88, 0x80, 0x0c, 0x1a, 0x80, 0x08, 0x10, 0x00, - 0x60, 0x02, 0x94, 0x44, 0x88, 0x00, 0x69, 0x11, 0x30, 0x08, 0x12, 0xa0, - 0x24, 0x13, 0x84, 0x00, 0x82, 0x00, 0x65, 0xc0, 0x10, 0x28, 0x00, 0x30, - 0x04, 0x03, 0x20, 0x01, 0x11, 0x06, 0x01, 0xc8, 0x80, 0x00, 0xc2, 0x20, - 0x08, 0x10, 0x82, 0x0c, 0x13, 0x02, 0x0c, 0x52, 0x06, 0x40, 0x00, 0xb0, - 0x61, 0x40, 0x10, 0x01, 0x98, 0x86, 0x04, 0x10, 0x84, 0x08, 0x92, 0x14, - 0x60, 0x41, 0x80, 0x41, 0x1a, 0x10, 0x04, 0x81, 0x22, 0x40, 0x41, 0x20, - 0x29, 0x52, 0x00, 0x41, 0x08, 0x34, 0x60, 0x10, 0x00, 0x28, 0x01, 0x10, - 0x40, 0x00, 0x84, 0x08, 0x42, 0x90, 0x20, 0x48, 0x04, 0x04, 0x52, 0x02, - 0x00, 0x08, 0x20, 0x04, 0x00, 0x82, 0x0d, 0x00, 0x82, 0x40, 0x02, 0x10, - 0x05, 0x48, 0x20, 0x40, 0x99, 0x00, 0x00, 0x01, 0x06, 0x24, 0xc0, 0x00, - 0x68, 0x82, 0x04, 0x21, 0x12, 0x10, 0x44, 0x08, 0x04, 0x00, 0x40, 0xa6, - 0x20, 0xd0, 0x16, 0x09, 0xc9, 0x24, 0x41, 0x02, 0x20, 0x0c, 0x09, 0x92, - 0x40, 0x12, 0x00, 0x00, 0x40, 0x00, 0x09, 0x43, 0x84, 0x20, 0x98, 0x02, - 0x01, 0x11, 0x24, 0x00, 0x43, 0x24, 0x00, 0x03, 0x90, 0x08, 0x41, 0x30, - 0x24, 0x58, 0x20, 0x4c, 0x80, 0x82, 0x08, 0x10, 0x24, 0x25, 0x81, 0x06, - 0x41, 0x09, 0x10, 0x20, 0x18, 0x10, 0x44, 0x80, 0x10, 0x00, 0x4a, 0x24, - 0x0d, 0x01, 0x94, 0x28, 0x80, 0x30, 0x00, 0xc0, 0x02, 0x60, 0x10, 0x84, - 0x0c, 0x02, 0x00, 0x09, 0x02, 0x82, 0x01, 0x08, 0x10, 0x04, 0xc2, 0x20, - 0x68, 0x09, 0x06, 0x04, 0x18, 0x00, 0x00, 0x11, 0x90, 0x08, 0x0b, 0x10, - 0x21, 0x82, 0x02, 0x0c, 0x10, 0xb6, 0x08, 0x00, 0x26, 0x00, 0x41, 0x02, - 0x01, 0x4a, 0x24, 0x21, 0x1a, 0x20, 0x24, 0x80, 0x00, 0x44, 0x02, 0x00, - 0x2d, 0x40, 0x02, 0x00, 0x8b, 0x94, 0x20, 0x10, 0x00, 0x20, 0x90, 0xa6, - 0x40, 0x13, 0x00, 0x2c, 0x11, 0x86, 0x61, 0x01, 0x80, 0x41, 0x10, 0x02, - 0x04, 0x81, 0x30, 0x48, 0x48, 0x20, 0x28, 0x50, 0x80, 0x21, 0x8a, 0x10, - 0x04, 0x08, 0x10, 0x09, 0x10, 0x10, 0x48, 0x42, 0xa0, 0x0c, 0x82, 0x92, - 0x60, 0xc0, 0x20, 0x05, 0xd2, 0x20, 0x40, 0x01, 0x00, 0x04, 0x08, 0x82, - 0x2d, 0x82, 0x02, 0x00, 0x48, 0x80, 0x41, 0x48, 0x10, 0x00, 0x91, 0x04, - 0x04, 0x03, 0x84, 0x00, 0xc2, 0x04, 0x68, 0x00, 0x00, 0x64, 0xc0, 0x22, - 0x40, 0x08, 0x32, 0x44, 0x09, 0x86, 0x00, 0x91, 0x02, 0x28, 0x01, 0x00, - 0x64, 0x48, 0x00, 0x24, 0x10, 0x90, 0x00, 0x43, 0x00, 0x21, 0x52, 0x86, - 0x41, 0x8b, 0x90, 0x20, 0x40, 0x20, 0x08, 0x88, 0x04, 0x44, 0x13, 0x20, - 0x00, 0x02, 0x84, 0x60, 0x81, 0x90, 0x24, 0x40, 0x30, 0x00, 0x08, 0x10, - 0x08, 0x08, 0x02, 0x01, 0x10, 0x04, 0x20, 0x43, 0xb4, 0x40, 0x90, 0x12, - 0x68, 0x01, 0x80, 0x4c, 0x18, 0x00, 0x08, 0xc0, 0x12, 0x49, 0x40, 0x10, - 0x24, 0x1a, 0x00, 0x41, 0x89, 0x24, 0x4c, 0x10, 0x00, 0x04, 0x52, 0x10, - 0x09, 0x4a, 0x20, 0x41, 0x48, 0x22, 0x69, 0x11, 0x14, 0x08, 0x10, 0x06, - 0x24, 0x80, 0x84, 0x28, 0x00, 0x10, 0x00, 0x40, 0x10, 0x01, 0x08, 0x26, - 0x08, 0x48, 0x06, 0x28, 0x00, 0x14, 0x01, 0x42, 0x84, 0x04, 0x0a, 0x20, - 0x00, 0x01, 0x82, 0x08, 0x00, 0x82, 0x24, 0x12, 0x04, 0x40, 0x40, 0xa0, - 0x40, 0x90, 0x10, 0x04, 0x90, 0x22, 0x40, 0x10, 0x20, 0x2c, 0x80, 0x10, - 0x28, 0x43, 0x00, 0x04, 0x58, 0x00, 0x01, 0x81, 0x10, 0x48, 0x09, 0x20, - 0x21, 0x83, 0x04, 0x00, 0x42, 0xa4, 0x44, 0x00, 0x00, 0x6c, 0x10, 0xa0, - 0x44, 0x48, 0x80, 0x00, 0x83, 0x80, 0x48, 0xc9, 0x00, 0x00, 0x00, 0x02, - 0x05, 0x10, 0xb0, 0x04, 0x13, 0x04, 0x29, 0x10, 0x92, 0x40, 0x08, 0x04, - 0x44, 0x82, 0x22, 0x00, 0x19, 0x20, 0x00, 0x19, 0x20, 0x01, 0x81, 0x90, - 0x60, 0x8a, 0x00, 0x41, 0xc0, 0x02, 0x45, 0x10, 0x04, 0x00, 0x02, 0xa2, - 0x09, 0x40, 0x10, 0x21, 0x49, 0x20, 0x01, 0x42, 0x30, 0x2c, 0x00, 0x14, - 0x44, 0x01, 0x22, 0x04, 0x02, 0x92, 0x08, 0x89, 0x04, 0x21, 0x80, 0x10, - 0x05, 0x01, 0x20, 0x40, 0x41, 0x80, 0x04, 0x00, 0x12, 0x09, 0x40, 0xb0, - 0x64, 0x58, 0x32, 0x01, 0x08, 0x90, 0x00, 0x41, 0x04, 0x09, 0xc1, 0x80, - 0x61, 0x08, 0x90, 0x00, 0x9a, 0x00, 0x24, 0x01, 0x12, 0x08, 0x02, 0x26, - 0x05, 0x82, 0x06, 0x08, 0x08, 0x00, 0x20, 0x48, 0x20, 0x00, 0x18, 0x24, - 0x48, 0x03, 0x02, 0x00, 0x11, 0x00, 0x09, 0x00, 0x84, 0x01, 0x4a, 0x10, - 0x01, 0x98, 0x00, 0x04, 0x18, 0x86, 0x00, 0xc0, 0x00, 0x20, 0x81, 0x80, - 0x04, 0x10, 0x30, 0x05, 0x00, 0xb4, 0x0c, 0x4a, 0x82, 0x29, 0x91, 0x02, - 0x28, 0x00, 0x20, 0x44, 0xc0, 0x00, 0x2c, 0x91, 0x80, 0x40, 0x01, 0xa2, - 0x00, 0x12, 0x04, 0x09, 0xc3, 0x20, 0x00, 0x08, 0x02, 0x0c, 0x10, 0x22, - 0x04, 0x00, 0x00, 0x2c, 0x11, 0x86, 0x00, 0xc0, 0x00, 0x00, 0x12, 0x32, - 0x40, 0x89, 0x80, 0x40, 0x40, 0x02, 0x05, 0x50, 0x86, 0x60, 0x82, 0xa4, - 0x60, 0x0a, 0x12, 0x4d, 0x80, 0x90, 0x08, 0x12, 0x80, 0x09, 0x02, 0x14, - 0x48, 0x01, 0x24, 0x20, 0x8a, 0x00, 0x44, 0x90, 0x04, 0x04, 0x01, 0x02, - 0x00, 0xd1, 0x12, 0x00, 0x0a, 0x04, 0x40, 0x00, 0x32, 0x21, 0x81, 0x24, - 0x08, 0x19, 0x84, 0x20, 0x02, 0x04, 0x08, 0x89, 0x80, 0x24, 0x02, 0x02, - 0x68, 0x18, 0x82, 0x44, 0x42, 0x00, 0x21, 0x40, 0x00, 0x28, 0x01, 0x80, - 0x45, 0x82, 0x20, 0x40, 0x11, 0x80, 0x0c, 0x02, 0x00, 0x24, 0x40, 0x90, - 0x01, 0x40, 0x20, 0x20, 0x50, 0x20, 0x28, 0x19, 0x00, 0x40, 0x09, 0x20, - 0x08, 0x80, 0x04, 0x60, 0x40, 0x80, 0x20, 0x08, 0x30, 0x49, 0x09, 0x34, - 0x00, 0x11, 0x24, 0x24, 0x82, 0x00, 0x41, 0xc2, 0x00, 0x04, 0x92, 0x02, - 0x24, 0x80, 0x00, 0x0c, 0x02, 0xa0, 0x00, 0x01, 0x06, 0x60, 0x41, 0x04, - 0x21, 0xd0, 0x00, 0x01, 0x01, 0x00, 0x48, 0x12, 0x84, 0x04, 0x91, 0x12, - 0x08, 0x00, 0x24, 0x44, 0x00, 0x12, 0x41, 0x18, 0x26, 0x0c, 0x41, 0x80, - 0x00, 0x52, 0x04, 0x20, 0x09, 0x00, 0x24, 0x90, 0x20, 0x48, 0x18, 0x02, - 0x00, 0x03, 0xa2, 0x09, 0xd0, 0x14, 0x00, 0x8a, 0x84, 0x25, 0x4a, 0x00, - 0x20, 0x98, 0x14, 0x40, 0x00, 0xa2, 0x05, 0x00, 0x00, 0x00, 0x40, 0x14, - 0x01, 0x58, 0x20, 0x2c, 0x80, 0x84, 0x00, 0x09, 0x20, 0x20, 0x91, 0x02, - 0x08, 0x02, 0xb0, 0x41, 0x08, 0x30, 0x00, 0x09, 0x10, 0x00, 0x18, 0x02, - 0x21, 0x02, 0x02, 0x00, 0x00, 0x24, 0x44, 0x08, 0x12, 0x60, 0x00, 0xb2, - 0x44, 0x12, 0x02, 0x0c, 0xc0, 0x80, 0x40, 0xc8, 0x20, 0x04, 0x50, 0x20, - 0x05, 0x00, 0xb0, 0x04, 0x0b, 0x04, 0x29, 0x53, 0x00, 0x61, 0x48, 0x30, - 0x00, 0x82, 0x20, 0x29, 0x00, 0x16, 0x00, 0x53, 0x22, 0x20, 0x43, 0x10, - 0x48, 0x00, 0x80, 0x04, 0xd2, 0x00, 0x40, 0x00, 0xa2, 0x44, 0x03, 0x80, - 0x29, 0x00, 0x04, 0x08, 0xc0, 0x04, 0x64, 0x40, 0x30, 0x28, 0x09, 0x84, - 0x44, 0x50, 0x80, 0x21, 0x02, 0x92, 0x00, 0xc0, 0x10, 0x60, 0x88, 0x22, - 0x08, 0x80, 0x00, 0x00, 0x18, 0x84, 0x04, 0x83, 0x96, 0x00, 0x81, 0x20, - 0x05, 0x02, 0x00, 0x45, 0x88, 0x84, 0x00, 0x51, 0x20, 0x20, 0x51, 0x86, - 0x41, 0x4b, 0x94, 0x00, 0x80, 0x00, 0x08, 0x11, 0x20, 0x4c, 0x58, 0x80, - 0x04, 0x03, 0x06, 0x20, 0x89, 0x00, 0x05, 0x08, 0x22, 0x05, 0x90, 0x00, - 0x40, 0x00, 0x82, 0x09, 0x50, 0x00, 0x00, 0x00, 0xa0, 0x41, 0xc2, 0x20, - 0x08, 0x00, 0x16, 0x08, 0x40, 0x26, 0x21, 0xd0, 0x90, 0x08, 0x81, 0x90, - 0x41, 0x00, 0x02, 0x44, 0x08, 0x10, 0x0c, 0x0a, 0x86, 0x09, 0x90, 0x04, - 0x00, 0xc8, 0xa0, 0x04, 0x08, 0x30, 0x20, 0x89, 0x84, 0x00, 0x11, 0x22, - 0x2c, 0x40, 0x00, 0x08, 0x02, 0xb0, 0x01, 0x48, 0x02, 0x01, 0x09, 0x20, - 0x04, 0x03, 0x04, 0x00, 0x80, 0x02, 0x60, 0x42, 0x30, 0x21, 0x4a, 0x10, - 0x44, 0x09, 0x02, 0x00, 0x01, 0x24, 0x00, 0x12, 0x82, 0x21, 0x80, 0xa4, - 0x20, 0x10, 0x02, 0x04, 0x91, 0xa0, 0x40, 0x18, 0x04, 0x00, 0x02, 0x06, - 0x69, 0x09, 0x00, 0x05, 0x58, 0x02, 0x01, 0x00, 0x00, 0x48, 0x00, 0x00, - 0x00, 0x03, 0x92, 0x20, 0x00, 0x34, 0x01, 0xc8, 0x20, 0x48, 0x08, 0x30, - 0x08, 0x42, 0x80, 0x20, 0x91, 0x90, 0x68, 0x01, 0x04, 0x40, 0x12, 0x02, - 0x61, 0x00, 0x12, 0x08, 0x01, 0xa0, 0x00, 0x11, 0x04, 0x21, 0x48, 0x04, - 0x24, 0x92, 0x00, 0x0c, 0x01, 0x84, 0x04, 0x00, 0x00, 0x01, 0x12, 0x96, - 0x40, 0x01, 0xa0, 0x41, 0x88, 0x22, 0x28, 0x88, 0x00, 0x44, 0x42, 0x80, - 0x24, 0x12, 0x14, 0x01, 0x42, 0x90, 0x60, 0x1a, 0x10, 0x04, 0x81, 0x10, - 0x48, 0x08, 0x06, 0x29, 0x83, 0x02, 0x40, 0x02, 0x24, 0x64, 0x80, 0x10, - 0x05, 0x80, 0x10, 0x40, 0x02, 0x02, 0x08, 0x42, 0x84, 0x01, 0x09, 0x20, - 0x04, 0x50, 0x00, 0x60, 0x11, 0x30, 0x40, 0x13, 0x02, 0x04, 0x81, 0x00, - 0x09, 0x08, 0x20, 0x45, 0x4a, 0x10, 0x61, 0x90, 0x26, 0x0c, 0x08, 0x02, - 0x21, 0x91, 0x00, 0x60, 0x02, 0x04, 0x00, 0x02, 0x00, 0x0c, 0x08, 0x06, - 0x08, 0x48, 0x84, 0x08, 0x11, 0x02, 0x00, 0x80, 0xa4, 0x00, 0x5a, 0x20, - 0x00, 0x88, 0x04, 0x04, 0x02, 0x00, 0x09, 0x00, 0x14, 0x08, 0x49, 0x14, - 0x20, 0xc8, 0x00, 0x04, 0x91, 0xa0, 0x40, 0x59, 0x80, 0x00, 0x12, 0x10, - 0x00, 0x80, 0x80, 0x65, 0x00, 0x00, 0x04, 0x00, 0x80, 0x40, 0x19, 0x00, - 0x21, 0x03, 0x84, 0x60, 0xc0, 0x04, 0x24, 0x1a, 0x12, 0x61, 0x80, 0x80, - 0x08, 0x02, 0x04, 0x09, 0x42, 0x12, 0x20, 0x08, 0x34, 0x04, 0x90, 0x20, - 0x01, 0x01, 0xa0, 0x00, 0x0b, 0x00, 0x08, 0x91, 0x92, 0x40, 0x02, 0x34, - 0x40, 0x88, 0x10, 0x61, 0x19, 0x02, 0x00, 0x40, 0x04, 0x25, 0xc0, 0x80, - 0x68, 0x08, 0x04, 0x21, 0x80, 0x22, 0x04, 0x00, 0xa0, 0x0c, 0x01, 0x84, - 0x20, 0x41, 0x00, 0x08, 0x8a, 0x00, 0x20, 0x8a, 0x00, 0x48, 0x88, 0x04, - 0x04, 0x11, 0x82, 0x08, 0x40, 0x86, 0x09, 0x49, 0xa4, 0x40, 0x00, 0x10, - 0x01, 0x01, 0xa2, 0x04, 0x50, 0x80, 0x0c, 0x80, 0x00, 0x48, 0x82, 0xa0, - 0x01, 0x18, 0x12, 0x41, 0x01, 0x04, 0x48, 0x41, 0x00, 0x24, 0x01, 0x00, - 0x00, 0x88, 0x14, 0x00, 0x02, 0x00, 0x68, 0x01, 0x20, 0x08, 0x4a, 0x22, - 0x08, 0x83, 0x80, 0x00, 0x89, 0x04, 0x01, 0xc2, 0x00, 0x00, 0x00, 0x34, - 0x04, 0x00, 0x82, 0x28, 0x02, 0x02, 0x41, 0x4a, 0x90, 0x05, 0x82, 0x02, - 0x09, 0x80, 0x24, 0x04, 0x41, 0x00, 0x01, 0x92, 0x80, 0x28, 0x01, 0x14, - 0x00, 0x50, 0x20, 0x4c, 0x10, 0xb0, 0x04, 0x43, 0xa4, 0x21, 0x90, 0x04, - 0x01, 0x02, 0x00, 0x44, 0x48, 0x00, 0x64, 0x08, 0x06, 0x00, 0x42, 0x20, - 0x08, 0x02, 0x92, 0x01, 0x4a, 0x00, 0x20, 0x50, 0x32, 0x25, 0x90, 0x22, - 0x04, 0x09, 0x00, 0x08, 0x11, 0x80, 0x21, 0x01, 0x10, 0x05, 0x00, 0x32, - 0x08, 0x88, 0x94, 0x08, 0x08, 0x24, 0x0d, 0xc1, 0x80, 0x40, 0x0b, 0x20, - 0x40, 0x18, 0x12, 0x04, 0x00, 0x22, 0x40, 0x10, 0x26, 0x05, 0xc1, 0x82, - 0x00, 0x01, 0x30, 0x24, 0x02, 0x22, 0x41, 0x08, 0x24, 0x48, 0x1a, 0x00, - 0x25, 0xd2, 0x12, 0x28, 0x42, 0x00, 0x04, 0x40, 0x30, 0x41, 0x00, 0x02, - 0x00, 0x13, 0x20, 0x24, 0xd1, 0x84, 0x08, 0x89, 0x80, 0x04, 0x52, 0x00, - 0x44, 0x18, 0xa4, 0x00, 0x00, 0x06, 0x20, 0x91, 0x10, 0x09, 0x42, 0x20, - 0x24, 0x40, 0x30, 0x28, 0x00, 0x84, 0x40, 0x40, 0x80, 0x08, 0x10, 0x04, - 0x09, 0x08, 0x04, 0x40, 0x08, 0x22, 0x00, 0x19, 0x02, 0x00, 0x00, 0x80, - 0x2c, 0x02, 0x02, 0x21, 0x01, 0x90, 0x20, 0x40, 0x00, 0x0c, 0x00, 0x34, - 0x48, 0x58, 0x20, 0x01, 0x43, 0x04, 0x20, 0x80, 0x14, 0x00, 0x90, 0x00, - 0x6d, 0x11, 0x00, 0x00, 0x40, 0x20, 0x00, 0x03, 0x10, 0x40, 0x88, 0x30, - 0x05, 0x4a, 0x00, 0x65, 0x10, 0x24, 0x08, 0x18, 0x84, 0x28, 0x03, 0x80, - 0x20, 0x42, 0xb0, 0x40, 0x00, 0x10, 0x69, 0x19, 0x04, 0x00, 0x00, 0x80, - 0x04, 0xc2, 0x04, 0x00, 0x01, 0x00, 0x05, 0x00, 0x22, 0x25, 0x08, 0x96, - 0x04, 0x02, 0x22, 0x00, 0xd0, 0x10, 0x29, 0x01, 0xa0, 0x60, 0x08, 0x10, - 0x04, 0x01, 0x16, 0x44, 0x10, 0x02, 0x28, 0x02, 0x82, 0x48, 0x40, 0x84, - 0x20, 0x90, 0x22, 0x28, 0x80, 0x04, 0x00, 0x40, 0x04, 0x24, 0x00, 0x80, - 0x29, 0x03, 0x10, 0x60, 0x48, 0x00, 0x00, 0x81, 0xa0, 0x00, 0x51, 0x20, - 0x0c, 0xd1, 0x00, 0x01, 0x41, 0x20, 0x04, 0x92, 0x00, 0x00, 0x10, 0x92, - 0x00, 0x42, 0x04, 0x05, 0x01, 0x86, 0x40, 0x80, 0x10, 0x20, 0x52, 0x20, - 0x21, 0x00, 0x10, 0x48, 0x0a, 0x02, 0x00, 0xd0, 0x12, 0x41, 0x48, 0x80, - 0x04, 0x00, 0x00, 0x48, 0x09, 0x22, 0x04, 0x00, 0x24, 0x00, 0x43, 0x10, - 0x60, 0x0a, 0x00, 0x44, 0x12, 0x20, 0x2c, 0x08, 0x20, 0x44, 0x00, 0x84, - 0x09, 0x40, 0x06, 0x08, 0xc1, 0x00, 0x40, 0x80, 0x20, 0x00, 0x98, 0x12, - 0x48, 0x10, 0xa2, 0x20, 0x00, 0x84, 0x48, 0xc0, 0x10, 0x20, 0x90, 0x12, - 0x08, 0x98, 0x82, 0x00, 0x0a, 0xa0, 0x04, 0x03, 0x00, 0x28, 0xc3, 0x00, - 0x44, 0x42, 0x10, 0x04, 0x08, 0x04, 0x40, 0x00, 0x00, 0x05, 0x10, 0x00, - 0x21, 0x03, 0x80, 0x04, 0x88, 0x12, 0x69, 0x10, 0x00, 0x04, 0x08, 0x04, - 0x04, 0x02, 0x84, 0x48, 0x49, 0x04, 0x20, 0x18, 0x02, 0x64, 0x80, 0x30, - 0x08, 0x01, 0x02, 0x00, 0x52, 0x12, 0x49, 0x08, 0x20, 0x41, 0x88, 0x10, - 0x48, 0x08, 0x34, 0x00, 0x01, 0x86, 0x05, 0xd0, 0x00, 0x00, 0x83, 0x84, - 0x21, 0x40, 0x02, 0x41, 0x10, 0x80, 0x48, 0x40, 0xa2, 0x20, 0x51, 0x00, - 0x00, 0x49, 0x00, 0x01, 0x90, 0x20, 0x40, 0x18, 0x02, 0x40, 0x02, 0x22, - 0x05, 0x40, 0x80, 0x08, 0x82, 0x10, 0x20, 0x18, 0x00, 0x05, 0x01, 0x82, - 0x40, 0x58, 0x00, 0x04, 0x81, 0x90, 0x29, 0x01, 0xa0, 0x64, 0x00, 0x22, - 0x40, 0x01, 0xa2, 0x00, 0x18, 0x04, 0x0d, 0x00, 0x00, 0x60, 0x80, 0x94, - 0x60, 0x82, 0x10, 0x0d, 0x80, 0x30, 0x0c, 0x12, 0x20, 0x00, 0x00, 0x12, - 0x40, 0xc0, 0x20, 0x21, 0x58, 0x02, 0x41, 0x10, 0x80, 0x44, 0x03, 0x02, - 0x04, 0x13, 0x90, 0x29, 0x08, 0x00, 0x44, 0xc0, 0x00, 0x21, 0x00, 0x26, - 0x00, 0x1a, 0x80, 0x01, 0x13, 0x14, 0x20, 0x0a, 0x14, 0x20, 0x00, 0x32, - 0x61, 0x08, 0x00, 0x40, 0x42, 0x20, 0x09, 0x80, 0x06, 0x01, 0x81, 0x80, - 0x60, 0x42, 0x00, 0x68, 0x90, 0x82, 0x08, 0x42, 0x80, 0x04, 0x02, 0x80, - 0x09, 0x0b, 0x04, 0x00, 0x98, 0x00, 0x0c, 0x81, 0x06, 0x44, 0x48, 0x84, - 0x28, 0x03, 0x92, 0x00, 0x01, 0x80, 0x40, 0x0a, 0x00, 0x0c, 0x81, 0x02, - 0x08, 0x51, 0x04, 0x28, 0x90, 0x02, 0x20, 0x09, 0x10, 0x60, 0x00, 0x00, - 0x09, 0x81, 0xa0, 0x0c, 0x00, 0xa4, 0x09, 0x00, 0x02, 0x28, 0x80, 0x20, - 0x00, 0x02, 0x02, 0x04, 0x81, 0x14, 0x04, 0x00, 0x04, 0x09, 0x11, 0x12, - 0x60, 0x40, 0x20, 0x01, 0x48, 0x30, 0x40, 0x11, 0x00, 0x08, 0x0a, 0x86, - 0x00, 0x00, 0x04, 0x60, 0x81, 0x04, 0x01, 0xd0, 0x02, 0x41, 0x18, 0x90, - 0x00, 0x0a, 0x20, 0x00, 0xc1, 0x06, 0x01, 0x08, 0x80, 0x64, 0xca, 0x10, - 0x04, 0x99, 0x80, 0x48, 0x01, 0x82, 0x20, 0x50, 0x90, 0x48, 0x80, 0x84, - 0x20, 0x90, 0x22, 0x00, 0x19, 0x00, 0x04, 0x18, 0x20, 0x24, 0x10, 0x86, - 0x40, 0xc2, 0x00, 0x24, 0x12, 0x10, 0x44, 0x00, 0x16, 0x08, 0x10, 0x24, - 0x00, 0x12, 0x06, 0x01, 0x08, 0x90, 0x00, 0x12, 0x02, 0x4d, 0x10, 0x80, - 0x40, 0x50, 0x22, 0x00, 0x43, 0x10, 0x01, 0x00, 0x30, 0x21, 0x0a, 0x00, - 0x00, 0x01, 0x14, 0x00, 0x10, 0x84, 0x04, 0xc1, 0x10, 0x29, 0x0a, 0x00, - 0x01, 0x8a, 0x00, 0x20, 0x01, 0x12, 0x0c, 0x49, 0x20, 0x04, 0x81, 0x00, - 0x48, 0x01, 0x04, 0x60, 0x80, 0x12, 0x0c, 0x08, 0x10, 0x48, 0x4a, 0x04, - 0x28, 0x10, 0x00, 0x28, 0x40, 0x84, 0x45, 0x50, 0x10, 0x60, 0x10, 0x06, - 0x44, 0x01, 0x80, 0x09, 0x00, 0x86, 0x01, 0x42, 0xa0, 0x00, 0x90, 0x00, - 0x05, 0x90, 0x22, 0x40, 0x41, 0x00, 0x08, 0x80, 0x02, 0x08, 0xc0, 0x00, - 0x01, 0x58, 0x30, 0x49, 0x09, 0x14, 0x00, 0x41, 0x02, 0x0c, 0x02, 0x80, - 0x40, 0x89, 0x00, 0x24, 0x08, 0x10, 0x05, 0x90, 0x32, 0x40, 0x0a, 0x82, - 0x08, 0x00, 0x12, 0x61, 0x00, 0x04, 0x21, 0x00, 0x22, 0x04, 0x10, 0x24, - 0x08, 0x0a, 0x04, 0x01, 0x10, 0x00, 0x20, 0x40, 0x84, 0x04, 0x88, 0x22, - 0x20, 0x90, 0x12, 0x00, 0x53, 0x06, 0x24, 0x01, 0x04, 0x40, 0x0b, 0x14, - 0x60, 0x82, 0x02, 0x0d, 0x10, 0x90, 0x0c, 0x08, 0x20, 0x09, 0x00, 0x14, - 0x09, 0x80, 0x80, 0x24, 0x82, 0x00, 0x40, 0x01, 0x02, 0x44, 0x01, 0x20, - 0x0c, 0x40, 0x84, 0x40, 0x0a, 0x10, 0x41, 0x00, 0x30, 0x05, 0x09, 0x80, - 0x44, 0x08, 0x20, 0x20, 0x02, 0x00, 0x49, 0x43, 0x20, 0x21, 0x00, 0x20, - 0x00, 0x01, 0xb6, 0x08, 0x40, 0x04, 0x08, 0x02, 0x80, 0x01, 0x41, 0x80, - 0x40, 0x08, 0x10, 0x24, 0x00, 0x20, 0x04, 0x12, 0x86, 0x09, 0xc0, 0x12, - 0x21, 0x81, 0x14, 0x04, 0x00, 0x02, 0x20, 0x89, 0xb4, 0x44, 0x12, 0x80, - 0x00, 0xd1, 0x00, 0x69, 0x40, 0x80, 0x00, 0x42, 0x12, 0x00, 0x18, 0x04, - 0x00, 0x49, 0x06, 0x21, 0x02, 0x04, 0x28, 0x02, 0x84, 0x01, 0xc0, 0x10, - 0x68, 0x00, 0x20, 0x08, 0x40, 0x00, 0x08, 0x91, 0x10, 0x01, 0x81, 0x24, - 0x04, 0xd2, 0x10, 0x4c, 0x88, 0x86, 0x00, 0x10, 0x80, 0x0c, 0x02, 0x14, - 0x00, 0x8a, 0x90, 0x40, 0x18, 0x20, 0x21, 0x80, 0xa4, 0x00, 0x58, 0x24, - 0x20, 0x10, 0x10, 0x60, 0xc1, 0x30, 0x41, 0x48, 0x02, 0x48, 0x09, 0x00, - 0x40, 0x09, 0x02, 0x05, 0x11, 0x82, 0x20, 0x4a, 0x20, 0x24, 0x18, 0x02, - 0x0c, 0x10, 0x22, 0x0c, 0x0a, 0x04, 0x00, 0x03, 0x06, 0x48, 0x48, 0x04, - 0x04, 0x02, 0x00, 0x21, 0x80, 0x84, 0x00, 0x18, 0x00, 0x0c, 0x02, 0x12, - 0x01, 0x00, 0x14, 0x05, 0x82, 0x10, 0x41, 0x89, 0x12, 0x08, 0x40, 0xa4, - 0x21, 0x01, 0x84, 0x48, 0x02, 0x10, 0x60, 0x40, 0x02, 0x28, 0x00, 0x14, - 0x08, 0x40, 0xa0, 0x20, 0x51, 0x12, 0x00, 0xc2, 0x00, 0x01, 0x1a, 0x30, - 0x40, 0x89, 0x12, 0x4c, 0x02, 0x80, 0x00, 0x00, 0x14, 0x01, 0x01, 0xa0, - 0x21, 0x18, 0x22, 0x21, 0x18, 0x06, 0x40, 0x01, 0x80, 0x00, 0x90, 0x04, - 0x48, 0x02, 0x30, 0x04, 0x08, 0x00, 0x05, 0x88, 0x24, 0x08, 0x48, 0x04, - 0x24, 0x02, 0x06, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x65, 0x11, 0x90, - 0x00, 0x0a, 0x82, 0x04, 0xc3, 0x04, 0x60, 0x48, 0x24, 0x04, 0x92, 0x02, - 0x44, 0x88, 0x80, 0x40, 0x18, 0x06, 0x29, 0x80, 0x10, 0x01, 0x00, 0x00, - 0x44, 0xc8, 0x10, 0x21, 0x89, 0x30, 0x00, 0x4b, 0xa0, 0x01, 0x10, 0x14, - 0x00, 0x02, 0x94, 0x40, 0x00, 0x20, 0x65, 0x00, 0xa2, 0x0c, 0x40, 0x22, - 0x20, 0x81, 0x12, 0x20, 0x82, 0x04, 0x01, 0x10, 0x00, 0x08, 0x88, 0x00, - 0x00, 0x11, 0x80, 0x04, 0x42, 0x80, 0x40, 0x41, 0x14, 0x00, 0x40, 0x32, - 0x2c, 0x80, 0x24, 0x04, 0x19, 0x00, 0x00, 0x91, 0x00, 0x20, 0x83, 0x00, - 0x05, 0x40, 0x20, 0x09, 0x01, 0x84, 0x40, 0x40, 0x20, 0x20, 0x11, 0x00, - 0x40, 0x41, 0x90, 0x20, 0x00, 0x00, 0x40, 0x90, 0x92, 0x48, 0x18, 0x06, - 0x08, 0x81, 0x80, 0x48, 0x01, 0x34, 0x24, 0x10, 0x20, 0x04, 0x00, 0x20, - 0x04, 0x18, 0x06, 0x2d, 0x90, 0x10, 0x01, 0x00, 0x90, 0x00, 0x0a, 0x22, - 0x01, 0x00, 0x22, 0x00, 0x11, 0x84, 0x01, 0x01, 0x00, 0x20, 0x88, 0x00, - 0x44, 0x00, 0x22, 0x01, 0x00, 0xa6, 0x40, 0x02, 0x06, 0x20, 0x11, 0x00, - 0x01, 0xc8, 0xa0, 0x04, 0x8a, 0x00, 0x28, 0x19, 0x80, 0x00, 0x52, 0xa0, - 0x24, 0x12, 0x12, 0x09, 0x08, 0x24, 0x01, 0x48, 0x00, 0x04, 0x00, 0x24, - 0x40, 0x02, 0x84, 0x08, 0x00, 0x04, 0x48, 0x40, 0x90, 0x60, 0x0a, 0x22, - 0x01, 0x88, 0x14, 0x08, 0x01, 0x02, 0x08, 0xd3, 0x00, 0x20, 0xc0, 0x90, - 0x24, 0x10, 0x00, 0x00, 0x01, 0xb0, 0x08, 0x0a, 0xa0, 0x00, 0x80, 0x00, - 0x01, 0x09, 0x00, 0x20, 0x52, 0x02, 0x25, 0x00, 0x24, 0x04, 0x02, 0x84, - 0x24, 0x10, 0x92, 0x40, 0x02, 0xa0, 0x40, 0x00, 0x22, 0x08, 0x11, 0x04, - 0x08, 0x01, 0x22, 0x00, 0x42, 0x14, 0x00, 0x09, 0x90, 0x21, 0x00, 0x30, - 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x22, 0x09, 0x90, 0x10, 0x28, 0x40, 0x00, - 0x20, 0xc0, 0x20, 0x00, 0x90, 0x00, 0x40, 0x01, 0x82, 0x05, 0x12, 0x12, - 0x09, 0xc1, 0x04, 0x61, 0x80, 0x02, 0x28, 0x81, 0x24, 0x00, 0x49, 0x04, - 0x08, 0x10, 0x86, 0x29, 0x41, 0x80, 0x21, 0x0a, 0x30, 0x49, 0x88, 0x90, - 0x00, 0x41, 0x04, 0x29, 0x81, 0x80, 0x41, 0x09, 0x00, 0x40, 0x12, 0x10, - 0x40, 0x00, 0x10, 0x40, 0x48, 0x02, 0x05, 0x80, 0x02, 0x21, 0x40, 0x20, - 0x00, 0x58, 0x20, 0x60, 0x00, 0x90, 0x48, 0x00, 0x80, 0x28, 0xc0, 0x80, - 0x48, 0x00, 0x00, 0x44, 0x80, 0x02, 0x00, 0x09, 0x06, 0x00, 0x12, 0x02, - 0x01, 0x00, 0x10, 0x08, 0x83, 0x10, 0x45, 0x12, 0x00, 0x2c, 0x08, 0x04, - 0x44, 0x00, 0x20, 0x20, 0xc0, 0x10, 0x20, 0x01, 0x00, 0x05, 0xc8, 0x20, - 0x04, 0x98, 0x10, 0x08, 0x10, 0x00, 0x24, 0x02, 0x16, 0x40, 0x88, 0x00, - 0x61, 0x88, 0x12, 0x24, 0x80, 0xa6, 0x00, 0x42, 0x00, 0x08, 0x10, 0x06, - 0x48, 0x40, 0xa0, 0x00, 0x50, 0x20, 0x04, 0x81, 0xa4, 0x40, 0x18, 0x00, - 0x08, 0x10, 0x80, 0x01, 0x01}; - -#if RSA_KEY_SIEVE && SIMULATION && RSA_INSTRUMENT -UINT32 PrimeIndex = 0; -UINT32 failedAtIteration[10] = {0}; -UINT32 PrimeCounts[3] = {0}; -UINT32 MillerRabinTrials[3] = {0}; -UINT32 totalFieldsSieved[3] = {0}; -UINT32 bitsInFieldAfterSieve[3] = {0}; -UINT32 emptyFieldsSieved[3] = {0}; -UINT32 noPrimeFields[3] = {0}; -UINT32 primesChecked[3] = {0}; -UINT16 lastSievePrime = 0; -#endif \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/RsaKeyCache.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/RsaKeyCache.c deleted file mode 100644 index ba8dec83d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/RsaKeyCache.c +++ /dev/null @@ -1,255 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions to implement the RSA key cache that can be used -// to speed up simulation. -// -// Only one key is created for each supported key size and it is returned whenever -// a key of that size is requested. -// -// If desired, the key cache can be populated from a file. This allows multiple -// TPM to run with the same RSA keys. Also, when doing simulation, the DRBG will -// use preset sequences so it is not too hard to repeat sequences for debug or -// profile or stress. -// -// When the key cache is enabled, a call to CryptRsaGenerateKey() will call the -// GetCachedRsaKey(). If the cache is enabled and populated, then the cached key -// of the requested size is returned. If a key of the requested size is not -// available, the no key is loaded and the requested key will need to be generated. -// If the cache is not populated, the TPM will open a file that has the appropriate -// name for the type of keys required (CRT or no-CRT). If the file is the right -// size, it is used. If the file doesn't exist or the file does not have the correct -// size, the TMP will populate the cache with new keys of the required size and -// write the cache data to the file so that they will be available the next time. -// -// Currently, if two simulations are being run with TPM's that have different RSA -// key sizes (e.g,, one with 1024 and 2048 and another with 2048 and 3072, then the -// files will not match for the both of them and they will both try to overwrite -// the other's cache file. I may try to do something about this if necessary. - -//** Includes, Types, Locals, and Defines - -#include "Tpm.h" - -#if USE_RSA_KEY_CACHE - -#include -#include "RsaKeyCache_fp.h" - -#if CRT_FORMAT_RSA == YES -#define CACHE_FILE_NAME "RsaKeyCacheCrt.data" -#else -#define CACHE_FILE_NAME "RsaKeyCacheNoCrt.data" -#endif - -typedef struct _RSA_KEY_CACHE_ -{ - TPM2B_PUBLIC_KEY_RSA publicModulus; - TPM2B_PRIVATE_KEY_RSA privateExponent; -} RSA_KEY_CACHE; - -// Determine the number of RSA key sizes for the cache -TPMI_RSA_KEY_BITS SupportedRsaKeySizes[] = { -#if RSA_1024 - 1024, -#endif -#if RSA_2048 - 2048, -#endif -#if RSA_3072 - 3072, -#endif -#if RSA_4096 - 4096, -#endif - 0 -}; - -#define RSA_KEY_CACHE_ENTRIES (RSA_1024 + RSA_2048 + RSA_3072 + RSA_4096) - -// The key cache holds one entry for each of the supported key sizes -RSA_KEY_CACHE s_rsaKeyCache[RSA_KEY_CACHE_ENTRIES]; -// Indicates if the key cache is loaded. It can be loaded and enabled or disabled. -BOOL s_keyCacheLoaded = 0; - -// Indicates if the key cache is enabled -int s_rsaKeyCacheEnabled = FALSE; - -//*** RsaKeyCacheControl() -// Used to enable and disable the RSA key cache. -LIB_EXPORT void -RsaKeyCacheControl( - int state - ) -{ - s_rsaKeyCacheEnabled = state; -} - -//*** InitializeKeyCache() -// This will initialize the key cache and attempt to write it to a file for later -// use. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure -static BOOL -InitializeKeyCache( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive, - RAND_STATE *rand // IN: if not NULL, the deterministic - // RNG state - ) -{ - int index; - TPM_KEY_BITS keySave = publicArea->parameters.rsaDetail.keyBits; - BOOL OK = TRUE; -// - s_rsaKeyCacheEnabled = FALSE; - for(index = 0; OK && index < RSA_KEY_CACHE_ENTRIES; index++) - { - publicArea->parameters.rsaDetail.keyBits - = SupportedRsaKeySizes[index]; - OK = (CryptRsaGenerateKey(publicArea, sensitive, rand) == TPM_RC_SUCCESS); - if(OK) - { - s_rsaKeyCache[index].publicModulus = publicArea->unique.rsa; - s_rsaKeyCache[index].privateExponent = sensitive->sensitive.rsa; - } - } - publicArea->parameters.rsaDetail.keyBits = keySave; - s_keyCacheLoaded = OK; -#if SIMULATION && USE_RSA_KEY_CACHE && USE_KEY_CACHE_FILE - if(OK) - { - FILE *cacheFile; - const char *fn = CACHE_FILE_NAME; - -#if defined _MSC_VER - if(fopen_s(&cacheFile, fn, "w+b") != 0) -#else - cacheFile = fopen(fn, "w+b"); - if(NULL == cacheFile) -#endif - { - printf("Can't open %s for write.\n", fn); - } - else - { - fseek(cacheFile, 0, SEEK_SET); - if(fwrite(s_rsaKeyCache, 1, sizeof(s_rsaKeyCache), cacheFile) - != sizeof(s_rsaKeyCache)) - { - printf("Error writing cache to %s.", fn); - } - } - if(cacheFile) - fclose(cacheFile); - } -#endif - return s_keyCacheLoaded; -} - -//*** KeyCacheLoaded() -// Checks that key cache is loaded. -// Return Type: BOOL -// TRUE(1) cache loaded -// FALSE(0) cache not loaded -static BOOL -KeyCacheLoaded( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive, - RAND_STATE *rand // IN: if not NULL, the deterministic - // RNG state - ) -{ -#if SIMULATION && USE_RSA_KEY_CACHE && USE_KEY_CACHE_FILE - if(!s_keyCacheLoaded) - { - FILE *cacheFile; - const char * fn = CACHE_FILE_NAME; -#if defined _MSC_VER && 1 - if(fopen_s(&cacheFile, fn, "r+b") == 0) -#else - cacheFile = fopen(fn, "r+b"); - if(NULL != cacheFile) -#endif - { - fseek(cacheFile, 0L, SEEK_END); - if(ftell(cacheFile) == sizeof(s_rsaKeyCache)) - { - fseek(cacheFile, 0L, SEEK_SET); - s_keyCacheLoaded = ( - fread(&s_rsaKeyCache, 1, sizeof(s_rsaKeyCache), cacheFile) - == sizeof(s_rsaKeyCache)); - } - fclose(cacheFile); - } - } -#endif - if(!s_keyCacheLoaded) - s_rsaKeyCacheEnabled = InitializeKeyCache(publicArea, sensitive, rand); - return s_keyCacheLoaded; -} - -//*** GetCachedRsaKey() -// Return Type: BOOL -// TRUE(1) key loaded -// FALSE(0) key not loaded -BOOL -GetCachedRsaKey( - TPMT_PUBLIC *publicArea, - TPMT_SENSITIVE *sensitive, - RAND_STATE *rand // IN: if not NULL, the deterministic - // RNG state - ) -{ - int keyBits = publicArea->parameters.rsaDetail.keyBits; - int index; -// - if(KeyCacheLoaded(publicArea, sensitive, rand)) - { - for(index = 0; index < RSA_KEY_CACHE_ENTRIES; index++) - { - if((s_rsaKeyCache[index].publicModulus.t.size * 8) == keyBits) - { - publicArea->unique.rsa = s_rsaKeyCache[index].publicModulus; - sensitive->sensitive.rsa = s_rsaKeyCache[index].privateExponent; - return TRUE; - } - } - return FALSE; - } - return s_keyCacheLoaded; -} -#endif // defined SIMULATION && defined USE_RSA_KEY_CACHE diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/Ticket.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/Ticket.c deleted file mode 100644 index bd65948a6..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/Ticket.c +++ /dev/null @@ -1,277 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -/* - This clause contains the functions used for ticket computations. -*/ - -//** Includes -#include "Tpm.h" - -//** Functions - -//*** TicketIsSafe() -// This function indicates if producing a ticket is safe. -// It checks if the leading bytes of an input buffer is TPM_GENERATED_VALUE -// or its substring of canonical form. If so, it is not safe to produce ticket -// for an input buffer claiming to be TPM generated buffer -// Return Type: BOOL -// TRUE(1) safe to produce ticket -// FALSE(0) not safe to produce ticket -BOOL -TicketIsSafe( - TPM2B *buffer - ) -{ - TPM_GENERATED valueToCompare = TPM_GENERATED_VALUE; - BYTE bufferToCompare[sizeof(valueToCompare)]; - BYTE *marshalBuffer; -// - // If the buffer size is less than the size of TPM_GENERATED_VALUE, assume - // it is not safe to generate a ticket - if(buffer->size < sizeof(valueToCompare)) - return FALSE; - marshalBuffer = bufferToCompare; - TPM_GENERATED_Marshal(&valueToCompare, &marshalBuffer, NULL); - if(MemoryEqual(buffer->buffer, bufferToCompare, sizeof(valueToCompare))) - return FALSE; - else - return TRUE; -} - -//*** TicketComputeVerified() -// This function creates a TPMT_TK_VERIFIED ticket. -/*(See part 2 specification) -// The ticket is computed as: -// HMAC(proof, (TPM_ST_VERIFIED | digest | keyName)) -// Where: -// HMAC() an HMAC using the hash of proof -// proof a TPM secret value associated with the hierarchy -// associated with keyName -// TPM_ST_VERIFIED a value to differentiate the tickets -// digest the signed digest -// keyName the Name of the key that signed digest -*/ -void -TicketComputeVerified( - TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy constant for ticket - TPM2B_DIGEST *digest, // IN: digest - TPM2B_NAME *keyName, // IN: name of key that signed the values - TPMT_TK_VERIFIED *ticket // OUT: verified ticket - ) -{ - TPM2B_PROOF *proof; - HMAC_STATE hmacState; -// - // Fill in ticket fields - ticket->tag = TPM_ST_VERIFIED; - ticket->hierarchy = hierarchy; - proof = HierarchyGetProof(hierarchy); - - // Start HMAC using the proof value of the hierarchy as the HMAC key - ticket->digest.t.size = CryptHmacStart2B(&hmacState, CONTEXT_INTEGRITY_HASH_ALG, - &proof->b); - // TPM_ST_VERIFIED - CryptDigestUpdateInt(&hmacState, sizeof(TPM_ST), ticket->tag); - // digest - CryptDigestUpdate2B(&hmacState.hashState, &digest->b); - // key name - CryptDigestUpdate2B(&hmacState.hashState, &keyName->b); - // done - CryptHmacEnd2B(&hmacState, &ticket->digest.b); - - return; -} - -//*** TicketComputeAuth() -// This function creates a TPMT_TK_AUTH ticket. -/*(See part 2 specification) -// The ticket is computed as: -// HMAC(proof, (type || timeout || timeEpoch || cpHash -// || policyRef || keyName)) -// where: -// HMAC() an HMAC using the hash of proof -// proof a TPM secret value associated with the hierarchy of the key -// associated with keyName. -// type a value to differentiate the tickets. It could be either -// TPM_ST_AUTH_SECRET or TPM_ST_AUTH_SIGNED -// timeout TPM-specific value indicating when the authorization expires -// timeEpoch TPM-specific value indicating the epoch for the timeout -// cpHash optional hash (digest only) of the authorized command -// policyRef optional reference to a policy value -// keyName name of the key that signed the authorization -*/ -void -TicketComputeAuth( - TPM_ST type, // IN: the type of ticket. - TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy constant for ticket - UINT64 timeout, // IN: timeout - BOOL expiresOnReset,// IN: flag to indicate if ticket expires on - // TPM Reset - TPM2B_DIGEST *cpHashA, // IN: input cpHashA - TPM2B_NONCE *policyRef, // IN: input policyRef - TPM2B_NAME *entityName, // IN: name of entity - TPMT_TK_AUTH *ticket // OUT: Created ticket - ) -{ - TPM2B_PROOF *proof; - HMAC_STATE hmacState; -// - // Get proper proof - proof = HierarchyGetProof(hierarchy); - - // Fill in ticket fields - ticket->tag = type; - ticket->hierarchy = hierarchy; - - // Start HMAC with hierarchy proof as the HMAC key - ticket->digest.t.size = CryptHmacStart2B(&hmacState, CONTEXT_INTEGRITY_HASH_ALG, - &proof->b); - // TPM_ST_AUTH_SECRET or TPM_ST_AUTH_SIGNED, - CryptDigestUpdateInt(&hmacState, sizeof(UINT16), ticket->tag); - // cpHash - CryptDigestUpdate2B(&hmacState.hashState, &cpHashA->b); - // policyRef - CryptDigestUpdate2B(&hmacState.hashState, &policyRef->b); - // keyName - CryptDigestUpdate2B(&hmacState.hashState, &entityName->b); - // timeout - CryptDigestUpdateInt(&hmacState, sizeof(timeout), timeout); - if(timeout != 0) - { - // epoch - CryptDigestUpdateInt(&hmacState.hashState, sizeof(CLOCK_NONCE), - g_timeEpoch); - // reset count - if(expiresOnReset) - CryptDigestUpdateInt(&hmacState.hashState, sizeof(gp.totalResetCount), - gp.totalResetCount); - } - // done - CryptHmacEnd2B(&hmacState, &ticket->digest.b); - - return; -} - -//*** TicketComputeHashCheck() -// This function creates a TPMT_TK_HASHCHECK ticket. -/*(See part 2 specification) -// The ticket is computed as: -// HMAC(proof, (TPM_ST_HASHCHECK || digest )) -// where: -// HMAC() an HMAC using the hash of proof -// proof a TPM secret value associated with the hierarchy -// TPM_ST_HASHCHECK -// a value to differentiate the tickets -// digest the digest of the data -*/ -void -TicketComputeHashCheck( - TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy constant for ticket - TPM_ALG_ID hashAlg, // IN: the hash algorithm for 'digest' - TPM2B_DIGEST *digest, // IN: input digest - TPMT_TK_HASHCHECK *ticket // OUT: Created ticket - ) -{ - TPM2B_PROOF *proof; - HMAC_STATE hmacState; -// - // Get proper proof - proof = HierarchyGetProof(hierarchy); - - // Fill in ticket fields - ticket->tag = TPM_ST_HASHCHECK; - ticket->hierarchy = hierarchy; - - // Start HMAC using hierarchy proof as HMAC key - ticket->digest.t.size = CryptHmacStart2B(&hmacState, CONTEXT_INTEGRITY_HASH_ALG, - &proof->b); - // TPM_ST_HASHCHECK - CryptDigestUpdateInt(&hmacState, sizeof(TPM_ST), ticket->tag); - // hash algorithm - CryptDigestUpdateInt(&hmacState, sizeof(hashAlg), hashAlg); - // digest - CryptDigestUpdate2B(&hmacState.hashState, &digest->b); - // done - CryptHmacEnd2B(&hmacState, &ticket->digest.b); - - return; -} - -//*** TicketComputeCreation() -// This function creates a TPMT_TK_CREATION ticket. -/*(See part 2 specification) -// The ticket is computed as: -// HMAC(proof, (TPM_ST_CREATION || Name || hash(TPMS_CREATION_DATA))) -// Where: -// HMAC() an HMAC using the hash of proof -// proof a TPM secret value associated with the hierarchy associated with Name -// TPM_ST_VERIFIED a value to differentiate the tickets -// Name the Name of the object to which the creation data is to be associated -// TPMS_CREATION_DATA the creation data structure associated with Name -*/ -void -TicketComputeCreation( - TPMI_RH_HIERARCHY hierarchy, // IN: hierarchy for ticket - TPM2B_NAME *name, // IN: object name - TPM2B_DIGEST *creation, // IN: creation hash - TPMT_TK_CREATION *ticket // OUT: created ticket - ) -{ - TPM2B_PROOF *proof; - HMAC_STATE hmacState; - - // Get proper proof - proof = HierarchyGetProof(hierarchy); - - // Fill in ticket fields - ticket->tag = TPM_ST_CREATION; - ticket->hierarchy = hierarchy; - - // Start HMAC using hierarchy proof as HMAC key - ticket->digest.t.size = CryptHmacStart2B(&hmacState, CONTEXT_INTEGRITY_HASH_ALG, - &proof->b); - // TPM_ST_CREATION - CryptDigestUpdateInt(&hmacState, sizeof(TPM_ST), ticket->tag); - // name if provided - if(name != NULL) - CryptDigestUpdate2B(&hmacState.hashState, &name->b); - // creation hash - CryptDigestUpdate2B(&hmacState.hashState, &creation->b); - // Done - CryptHmacEnd2B(&hmacState, &ticket->digest.b); - - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcDesSupport.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcDesSupport.c deleted file mode 100644 index 69a0b01a1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcDesSupport.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// The functions in this file are used for initialization of the interface to the -// LibTomCrypt and MpaLib libraries. This is not used if only the LTC hash and -// symmetric functions are used. - -//** Defines and Includes - -#include "Tpm.h" - -#if (defined SYM_LIB_LTC) && ALG_TDES - -//** TDES_setup -// This function calls the LTC function to generate a TDES key schedule. If the -// key is one DES key (8 bytes), then it is replicated two more times to create a -// 24-byte TDES key. If the key is two key (16 bytes), then the first DES key is -// replicated to the third key position. -void TDES_setup( - const BYTE *key, - UINT32 keyBits, - symmetric_key *skey - ) -{ - BYTE k[24]; - BYTE *kp; - - // If this is two-key, make it three key by replicating K1 - if(keyBits == 128) - { - memcpy(k, key, 16); - memcpy(&k[16], key, 8); - kp = k; - } - else - kp = (BYTE *)key; - - des3_setup(kp, 24, 0, skey); -} - -#endif // MATH_LIB_LTC && ALG_TDES diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcMath.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcMath.c deleted file mode 100644 index bb1a0e62a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcMath.c +++ /dev/null @@ -1,286 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// This file contains the math functions that are not implemented in the BnMath -// library (yet). These math functions will call the ST MPA library or the -// LibTomCrypt library to execute the operations. Since the TPM internal big number -// format is identical to the MPA format, no reformatting is required. - -//** Includes -#include "Tpm.h" - -#ifdef MATH_LIB_LTC - -#if defined ECC_NIST_P256 && ECC_NIST_P256 == YES && ECC_CURVE_COUNT > 1 -#error "LibTomCrypt only supports P256" -#endif - -//** Functions - -//*** BnModMult() -// Does multiply and divide returning the remainder of the divide. -LIB_EXPORT BOOL -BnModMult( - bigNum result, - bigConst op1, - bigConst op2, - bigConst modulus - ) -{ - BN_VAR(temp, LARGEST_NUMBER_BITS * 2); - // mpa_mul does not allocate from the pool if the result is not the same as - // op1 or op2. since this is assured by the stack allocation of 'temp', the - // pool pointer can be NULL - pAssert(BnGetAllocated(result) >= BnGetSize(modulus)); - mpa_mul((mpanum)temp, (const mpanum)op1, (const mpanum)op2, - NULL); - return BnDiv(NULL, result, temp, modulus); -} - -//*** BnMult() -// Multiplies two numbers -LIB_EXPORT BOOL -BnMult( - bigNum result, - bigConst multiplicand, - bigConst multiplier - ) -{ - // Make sure that the mpa_mul function does not allocate anything - // from the POOL by eliminating the reason for doing it. - BN_VAR(tempResult, LARGEST_NUMBER_BITS * 2); - if(result != multiplicand && result != multiplier) - tempResult = result; - mpa_mul((mpanum)tempResult, (const mpanum)multiplicand, - (const mpanum)multiplier, - NULL); - BnCopy(result, tempResult); - return TRUE; -} - -//*** BnDiv() -// This function divides two BIGNUM values. The function always returns TRUE. -LIB_EXPORT BOOL -BnDiv( - bigNum quotient, - bigNum remainder, - bigConst dividend, - bigConst divisor - ) -{ - MPA_ENTER(10, LARGEST_NUMBER_BITS); - pAssert(!BnEqualZero(divisor)); - if(BnGetSize(dividend) < BnGetSize(divisor)) - { - if(quotient) - BnSetWord(quotient, 0); - if(remainder) - BnCopy(remainder, dividend); - } - else - { - pAssert((quotient == NULL) - || (quotient->allocated >= - (unsigned)(dividend->size - divisor->size))); - pAssert((remainder == NULL) - || (remainder->allocated >= divisor->size)); - mpa_div((mpanum)quotient, (mpanum)remainder, - (const mpanum)dividend, (const mpanum)divisor, POOL); - } - MPA_LEAVE(); - return TRUE; -} - -#ifdef TPM_ALG_RSA -//*** BnGcd() -// Get the greatest common divisor of two numbers -LIB_EXPORT BOOL -BnGcd( - bigNum gcd, // OUT: the common divisor - bigConst number1, // IN: - bigConst number2 // IN: - ) -{ - MPA_ENTER(20, LARGEST_NUMBER_BITS); -// - mpa_gcd((mpanum)gcd, (mpanum)number1, (mpanum)number2, POOL); - MPA_LEAVE(); - return TRUE; -} - -//***BnModExp() -// Do modular exponentiation using BIGNUM values. The conversion from a bignum_t -// to a BIGNUM is trivial as they are based on the same structure -LIB_EXPORT BOOL -BnModExp( - bigNum result, // OUT: the result - bigConst number, // IN: number to exponentiate - bigConst exponent, // IN: - bigConst modulus // IN: - ) -{ - MPA_ENTER(20, LARGEST_NUMBER_BITS); - BN_VAR(bnR, MAX_RSA_KEY_BITS); - BN_VAR(bnR2, MAX_RSA_KEY_BITS); - mpa_word_t n_inv; - mpa_word_t ffmCtx[mpa_fmm_context_size_in_U32(MAX_RSA_KEY_BITS)]; -// - mpa_init_static_fmm_context((mpa_fmm_context_base *)ffmCtx, - BYTES_TO_CRYPT_WORDS(sizeof(ffmCtx))); - // Generate modular form - if(mpa_compute_fmm_context((const mpanum)modulus, (mpanum)bnR, - (mpanum)bnR2, &n_inv, POOL) != 0) - FAIL(FATAL_ERROR_INTERNAL); - // Do exponentiation - mpa_exp_mod((mpanum)result, (const mpanum)number, (const mpanum)exponent, - (const mpanum)modulus, (const mpanum)bnR, (const mpanum)bnR2, - n_inv, POOL); - MPA_LEAVE(); - return TRUE; -} - -//*** BnModInverse() -// Modular multiplicative inverse -LIB_EXPORT BOOL -BnModInverse( - bigNum result, - bigConst number, - bigConst modulus - ) -{ - BOOL retVal; - MPA_ENTER(10, LARGEST_NUMBER_BITS); - retVal = (mpa_inv_mod((mpanum)result, (const mpanum)number, - (const mpanum)modulus, POOL) == 0); - MPA_LEAVE(); - return retVal; -} -#endif // TPM_ALG_RSA - -#ifdef TPM_ALG_ECC - - -//*** BnEccModMult() -// This function does a point multiply of the form R = [d]S -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' - bigConst d, // IN: scalar for [d]S - bigCurve E - ) -{ - MPA_ENTER(30, MAX_ECC_KEY_BITS * 2); - // The point multiply in LTC seems to need a large reciprocal for - // intermediate results - POINT_VAR(result, MAX_ECC_KEY_BITS * 4); - BOOL OK; -// - (POOL); // Avoid compiler warning - if(S == NULL) - S = CurveGetG(AccessCurveData(E)); - OK = (ltc_ecc_mulmod((mpanum)d, (ecc_point *)S, - (ecc_point *)result, (void *)CurveGetPrime(E), 1) - == CRYPT_OK); - OK = OK && !BnEqualZero(result->z); - if(OK) - BnPointCopy(R, result); - - MPA_LEAVE(); - return OK ? TPM_RC_SUCCESS : TPM_RC_NO_RESULT; -} - -//*** BnEccModMult2() -// This function does a point multiply of the form R = [d]S + [u]Q -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult2( - bigPoint R, // OUT: computed point - pointConst S, // IN: first point (optional) - bigConst d, // IN: scalar for [d]S or [d]G - pointConst Q, // IN: second point - bigConst u, // IN: second scalar - bigCurve E // IN: curve - ) -{ - MPA_ENTER(80, MAX_ECC_KEY_BITS); - BOOL OK; - // The point multiply in LTC seems to need a large reciprocal for - // intermediate results - POINT_VAR(result, MAX_ECC_KEY_BITS * 4); -// - (POOL); // Avoid compiler warning - if(S == NULL) - S = CurveGetG(AccessCurveData(E)); - - OK = (ltc_ecc_mul2add((ecc_point *)S, (mpanum)d, (ecc_point *)Q, (mpanum)u, - (ecc_point *)result, (mpanum)CurveGetPrime(E)) - == CRYPT_OK); - OK = OK && !BnEqualZero(result->z); - - if(OK) - BnPointCopy(R, result); - - MPA_LEAVE(); - return OK ? TPM_RC_SUCCESS : TPM_RC_NO_RESULT; -} - -//*** BnEccAdd() -// This function does addition of two points. Since this is not implemented -// in LibTomCrypt() will try to trick it by doing multiply with scalar of 1. -// I have no idea if this will work and it's not needed unless MQV or the SM2 -// variant is enabled. -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccAdd( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' - pointConst Q, // IN: second point - bigCurve E // IN: curve - ) -{ - BN_WORD_INITIALIZED(one, 1); - return BnEccModMult2(R, S, one, Q, one, E); -} - -#endif // TPM_ALG_ECC - -#endif // MATH_LIB_LTC diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcSupport.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcSupport.c deleted file mode 100644 index 0dcb79ebe..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ltc/TpmToLtcSupport.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// The functions in this file are used for initialization of the interface to the -// LibTomCrypt and MpsLib libraries. This is not used if only the LTC hash and -// symmetric functions are used. - -//** Defines and Includes - -#include "Tpm.h" - -#if defined(HASH_LIB_LTC) || defined(MATH_LIB_LTC) || defined(SYM_LIB_LTC) - -// This state is used because there is no way to pass the random number state -// to LibTomCrypt. I do not think that this is currently an issue because... -// Heck, just put in an assert and see what happens. -static void *s_randState; - -//*** LtcRand() -// This is a stub function that is called from the LibTomCrypt or libmpa code -// to get a random number. In turn, this will call the random RandGenerate -// function that was passed in LibraryInit(). This function will pass the pointer -// to the current rand state along with the random byte request. -uint32_t LtcRand( - void *buf, - size_t blen - ) -{ - pAssert(1); - DRBG_Generate(s_randState, buf, (uint16_t)blen); - return 0; -} - -//*** SupportLibInit() -// This does any initialization required by the support library. -LIB_EXPORT int -SupportLibInit( - void - ) -{ - mpa_set_random_generator(LtcRand); - s_randState = NULL; - external_mem_pool = NULL; - return 1; -} - -//*** LtcPoolInit() -// Function to initialize a pool. **** -LIB_EXPORT mpa_scratch_mem -LtcPoolInit( - mpa_word_t *poolAddress, - int vars, - int bits - ) -{ - mpa_scratch_mem pool = (mpa_scratch_mem)poolAddress; - mpa_init_scratch_mem(pool, vars, bits); - init_mpa_tomcrypt(pool); - return pool; -} - -#endif // HASH_LIB_LTC || MATH_LIB_LTC || SYM_LIB_LTC diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslDesSupport.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslDesSupport.c deleted file mode 100644 index 68c28ab96..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslDesSupport.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// The functions in this file are used for initialization of the interface to the -// OpenSSL library. - -//** Defines and Includes - -#include "Tpm.h" - -#if (defined SYM_LIB_OSSL) && ALG_TDES - -//**Functions -//*** TDES_set_encyrpt_key() -// This function makes creation of a TDES key look like the creation of a key for -// any of the other OpenSSL block ciphers. It will create three key schedules, -// one for each of the DES keys. If there are only two keys, then the third schedule -// is a copy of the first. -void -TDES_set_encrypt_key( - const BYTE *key, - UINT16 keySizeInBits, - tpmKeyScheduleTDES *keySchedule - ) -{ - DES_set_key_unchecked((const_DES_cblock *)key, &keySchedule[0]); - DES_set_key_unchecked((const_DES_cblock *)&key[8], &keySchedule[1]); - // If is two-key, copy the schedule for K1 into K3, otherwise, compute the - // the schedule for K3 - if(keySizeInBits == 128) - keySchedule[2] = keySchedule[0]; - else - DES_set_key_unchecked((const_DES_cblock *)&key[16], - &keySchedule[2]); -} - - -//*** TDES_encyrpt() -// The TPM code uses one key schedule. For TDES, the schedule contains three -// schedules. OpenSSL wants the schedules referenced separately. This function -// does that. -void TDES_encrypt( - const BYTE *in, - BYTE *out, - tpmKeyScheduleTDES *ks - ) -{ - DES_ecb3_encrypt((const_DES_cblock *)in, (DES_cblock *)out, - &ks[0], &ks[1], &ks[2], - DES_ENCRYPT); -} - -//*** TDES_decrypt() -// As with TDES_encypt() this function bridges between the TPM single schedule -// model and the OpenSSL three schedule model. -void TDES_decrypt( - const BYTE *in, - BYTE *out, - tpmKeyScheduleTDES *ks - ) -{ - DES_ecb3_encrypt((const_DES_cblock *)in, (DES_cblock *)out, - &ks[0], &ks[1], &ks[2], - DES_DECRYPT); -} - -#endif // SYM_LIB_OSSL diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c deleted file mode 100644 index 042709ec2..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslMath.c +++ /dev/null @@ -1,638 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// The functions in this file provide the low-level interface between the TPM code -// and the big number and elliptic curve math routines in OpenSSL. -// -// Most math on big numbers require a context. The context contains the memory in -// which OpenSSL creates and manages the big number values. When a OpenSSL math -// function will be called that modifies a BIGNUM value, that value must be created in -// an OpenSSL context. The first line of code in such a function must be: -// OSSL_ENTER(); and the last operation before returning must be OSSL_LEAVE(). -// OpenSSL variables can then be created with BnNewVariable(). Constant values to be -// used by OpenSSL are created from the bigNum values passed to the functions in this -// file. Space for the BIGNUM control block is allocated in the stack of the -// function and then it is initialized by calling BigInitialized(). That function -// sets up the values in the BIGNUM structure and sets the data pointer to point to -// the data in the bignum_t. This is only used when the value is known to be a -// constant in the called function. -// -// Because the allocations of constants is on the local stack and the -// OSSL_ENTER()/OSSL_LEAVE() pair flushes everything created in OpenSSL memory, there -// should be no chance of a memory leak. - -//** Includes and Defines -#include "Tpm.h" - -#ifdef MATH_LIB_OSSL -#include "TpmToOsslMath_fp.h" - -//** Functions - -//*** OsslToTpmBn() -// This function converts an OpenSSL BIGNUM to a TPM bignum. In this implementation -// it is assumed that OpenSSL uses a different control structure but the same data -// layout -- an array of native-endian words in little-endian order. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure because value will not fit or OpenSSL variable doesn't -// exist -BOOL -OsslToTpmBn( - bigNum bn, - BIGNUM *osslBn - ) -{ - VERIFY(osslBn != NULL); - // If the bn is NULL, it means that an output value pointer was NULL meaning that - // the results is simply to be discarded. - if(bn != NULL) - { - int i; - // - VERIFY((unsigned)osslBn->top <= BnGetAllocated(bn)); - for(i = 0; i < osslBn->top; i++) - bn->d[i] = osslBn->d[i]; - BnSetTop(bn, osslBn->top); - } - return TRUE; -Error: - return FALSE; -} - -//*** BigInitialized() -// This function initializes an OSSL BIGNUM from a TPM bigConst. Do not use this for -// values that are passed to OpenSLL when they are not declared as const in the -// function prototype. Instead, use BnNewVariable(). -BIGNUM * -BigInitialized( - BIGNUM *toInit, - bigConst initializer - ) -{ - if(initializer == NULL) - FAIL(FATAL_ERROR_PARAMETER); - if(toInit == NULL || initializer == NULL) - return NULL; - toInit->d = (BN_ULONG *)&initializer->d[0]; - toInit->dmax = (int)initializer->allocated; - toInit->top = (int)initializer->size; - toInit->neg = 0; - toInit->flags = 0; - return toInit; -} - -#ifndef OSSL_DEBUG -# define BIGNUM_PRINT(label, bn, eol) -# define DEBUG_PRINT(x) -#else -# define DEBUG_PRINT(x) printf("%s", x) -# define BIGNUM_PRINT(label, bn, eol) BIGNUM_print((label), (bn), (eol)) - -//*** BIGNUM_print() -static void -BIGNUM_print( - const char *label, - const BIGNUM *a, - BOOL eol - ) -{ - BN_ULONG *d; - int i; - int notZero = FALSE; - - if(label != NULL) - printf("%s", label); - if(a == NULL) - { - printf("NULL"); - goto done; - } - if (a->neg) - printf("-"); - for(i = a->top, d = &a->d[i - 1]; i > 0; i--) - { - int j; - BN_ULONG l = *d--; - for(j = BN_BITS2 - 8; j >= 0; j -= 8) - { - BYTE b = (BYTE)((l >> j) & 0xFF); - notZero = notZero || (b != 0); - if(notZero) - printf("%02x", b); - } - if(!notZero) - printf("0"); - } -done: - if(eol) - printf("\n"); - return; -} -#endif - -//*** BnNewVariable() -// This function allocates a new variable in the provided context. If the context -// does not exist or the allocation fails, it is a catastrophic failure. -static BIGNUM * -BnNewVariable( - BN_CTX *CTX -) -{ - BIGNUM *new; -// - // This check is intended to protect against calling this function without - // having initialized the CTX. - if((CTX == NULL) || ((new = BN_CTX_get(CTX)) == NULL)) - FAIL(FATAL_ERROR_ALLOCATION); - return new; -} - -#if LIBRARY_COMPATIBILITY_CHECK - -//*** MathLibraryCompatibilityCheck() -void -MathLibraryCompatibilityCheck( - void - ) -{ - OSSL_ENTER(); - BIGNUM *osslTemp = BnNewVariable(CTX); - crypt_uword_t i; - BYTE test[] = {0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, - 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, - 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, - 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00}; - BN_VAR(tpmTemp, sizeof(test) * 8); // allocate some space for a test value -// - // Convert the test data to a bigNum - BnFromBytes(tpmTemp, test, sizeof(test)); - // Convert the test data to an OpenSSL BIGNUM - BN_bin2bn(test, sizeof(test), osslTemp); - // Make sure the values are consistent - VERIFY(osslTemp->top == (int)tpmTemp->size); - for(i = 0; i < tpmTemp->size; i++) - VERIFY(osslTemp->d[i] == tpmTemp->d[i]); - OSSL_LEAVE(); - return; -Error: - FAIL(FATAL_ERROR_MATHLIBRARY); -} -#endif - -//*** BnModMult() -// This function does a modular multiply. It first does a multiply and then a divide -// and returns the remainder of the divide. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnModMult( - bigNum result, - bigConst op1, - bigConst op2, - bigConst modulus - ) -{ - OSSL_ENTER(); - BOOL OK = TRUE; - BIGNUM *bnResult = BN_NEW(); - BIGNUM *bnTemp = BN_NEW(); - BIG_INITIALIZED(bnOp1, op1); - BIG_INITIALIZED(bnOp2, op2); - BIG_INITIALIZED(bnMod, modulus); -// - VERIFY(BN_mul(bnTemp, bnOp1, bnOp2, CTX)); - VERIFY(BN_div(NULL, bnResult, bnTemp, bnMod, CTX)); - VERIFY(OsslToTpmBn(result, bnResult)); - goto Exit; -Error: - OK = FALSE; -Exit: - OSSL_LEAVE(); - return OK; -} - -//*** BnMult() -// Multiplies two numbers -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnMult( - bigNum result, - bigConst multiplicand, - bigConst multiplier - ) -{ - OSSL_ENTER(); - BIGNUM *bnTemp = BN_NEW(); - BOOL OK = TRUE; - BIG_INITIALIZED(bnA, multiplicand); - BIG_INITIALIZED(bnB, multiplier); -// - VERIFY(BN_mul(bnTemp, bnA, bnB, CTX)); - VERIFY(OsslToTpmBn(result, bnTemp)); - goto Exit; -Error: - OK = FALSE; -Exit: - OSSL_LEAVE(); - return OK; -} - -//*** BnDiv() -// This function divides two bigNum values. The function returns FALSE if -// there is an error in the operation. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnDiv( - bigNum quotient, - bigNum remainder, - bigConst dividend, - bigConst divisor - ) -{ - OSSL_ENTER(); - BIGNUM *bnQ = BN_NEW(); - BIGNUM *bnR = BN_NEW(); - BOOL OK = TRUE; - BIG_INITIALIZED(bnDend, dividend); - BIG_INITIALIZED(bnSor, divisor); -// - if(BnEqualZero(divisor)) - FAIL(FATAL_ERROR_DIVIDE_ZERO); - VERIFY(BN_div(bnQ, bnR, bnDend, bnSor, CTX)); - VERIFY(OsslToTpmBn(quotient, bnQ)); - VERIFY(OsslToTpmBn(remainder, bnR)); - DEBUG_PRINT("In BnDiv:\n"); - BIGNUM_PRINT(" bnDividend: ", bnDend, TRUE); - BIGNUM_PRINT(" bnDivisor: ", bnSor, TRUE); - BIGNUM_PRINT(" bnQuotient: ", bnQ, TRUE); - BIGNUM_PRINT(" bnRemainder: ", bnR, TRUE); - goto Exit; -Error: - OK = FALSE; -Exit: - OSSL_LEAVE(); - return OK; -} - -#if ALG_RSA -//*** BnGcd() -// Get the greatest common divisor of two numbers -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnGcd( - bigNum gcd, // OUT: the common divisor - bigConst number1, // IN: - bigConst number2 // IN: - ) -{ - OSSL_ENTER(); - BIGNUM *bnGcd = BN_NEW(); - BOOL OK = TRUE; - BIG_INITIALIZED(bn1, number1); - BIG_INITIALIZED(bn2, number2); -// - VERIFY(BN_gcd(bnGcd, bn1, bn2, CTX)); - VERIFY(OsslToTpmBn(gcd, bnGcd)); - goto Exit; -Error: - OK = FALSE; -Exit: - OSSL_LEAVE(); - return OK; -} - -//***BnModExp() -// Do modular exponentiation using bigNum values. The conversion from a bignum_t to -// a bigNum is trivial as they are based on the same structure -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnModExp( - bigNum result, // OUT: the result - bigConst number, // IN: number to exponentiate - bigConst exponent, // IN: - bigConst modulus // IN: - ) -{ - OSSL_ENTER(); - BIGNUM *bnResult = BN_NEW(); - BOOL OK = TRUE; - BIG_INITIALIZED(bnN, number); - BIG_INITIALIZED(bnE, exponent); - BIG_INITIALIZED(bnM, modulus); -// - VERIFY(BN_mod_exp(bnResult, bnN, bnE, bnM, CTX)); - VERIFY(OsslToTpmBn(result, bnResult)); - goto Exit; -Error: - OK = FALSE; -Exit: - OSSL_LEAVE(); - return OK; -} - -//*** BnModInverse() -// Modular multiplicative inverse -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -LIB_EXPORT BOOL -BnModInverse( - bigNum result, - bigConst number, - bigConst modulus - ) -{ - OSSL_ENTER(); - BIGNUM *bnResult = BN_NEW(); - BOOL OK = TRUE; - BIG_INITIALIZED(bnN, number); - BIG_INITIALIZED(bnM, modulus); -// - VERIFY(BN_mod_inverse(bnResult, bnN, bnM, CTX) != NULL); - VERIFY(OsslToTpmBn(result, bnResult)); - goto Exit; -Error: - OK = FALSE; -Exit: - OSSL_LEAVE(); - return OK; -} -#endif // ALG_RSA - -#if ALG_ECC - -//*** PointFromOssl() -// Function to copy the point result from an OSSL function to a bigNum -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation -static BOOL -PointFromOssl( - bigPoint pOut, // OUT: resulting point - EC_POINT *pIn, // IN: the point to return - bigCurve E // IN: the curve - ) -{ - BIGNUM *x = NULL; - BIGNUM *y = NULL; - BOOL OK; - BN_CTX_start(E->CTX); -// - x = BN_CTX_get(E->CTX); - y = BN_CTX_get(E->CTX); - - if(y == NULL) - FAIL(FATAL_ERROR_ALLOCATION); - // If this returns false, then the point is at infinity - OK = EC_POINT_get_affine_coordinates_GFp(E->G, pIn, x, y, E->CTX); - if(OK) - { - OsslToTpmBn(pOut->x, x); - OsslToTpmBn(pOut->y, y); - BnSetWord(pOut->z, 1); - } - else - BnSetWord(pOut->z, 0); - BN_CTX_end(E->CTX); - return OK; -} - -//*** EcPointInitialized() -// Allocate and initialize a point. -static EC_POINT * -EcPointInitialized( - pointConst initializer, - bigCurve E - ) -{ - EC_POINT *P = NULL; - - if(initializer != NULL) - { - BIG_INITIALIZED(bnX, initializer->x); - BIG_INITIALIZED(bnY, initializer->y); - P = EC_POINT_new(E->G); - if(E == NULL) - FAIL(FATAL_ERROR_ALLOCATION); - if(!EC_POINT_set_affine_coordinates_GFp(E->G, P, bnX, bnY, E->CTX)) - P = NULL; - } - return P; -} - -//*** BnCurveInitialize() -// This function initializes the OpenSSL curve information structure. This -// structure points to the TPM-defined values for the curve, to the context for the -// number values in the frame, and to the OpenSSL-defined group values. -// Return Type: bigCurve * -// NULL the TPM_ECC_CURVE is not valid or there was a problem in -// in initializing the curve data -// non-NULL points to 'E' -LIB_EXPORT bigCurve -BnCurveInitialize( - bigCurve E, // IN: curve structure to initialize - TPM_ECC_CURVE curveId // IN: curve identifier -) -{ - const ECC_CURVE_DATA *C = GetCurveData(curveId); - if(C == NULL) - E = NULL; - if(E != NULL) - { - // This creates the OpenSSL memory context that stays in effect as long as the - // curve (E) is defined. - OSSL_ENTER(); // if the allocation fails, the TPM fails - EC_POINT *P = NULL; - BIG_INITIALIZED(bnP, C->prime); - BIG_INITIALIZED(bnA, C->a); - BIG_INITIALIZED(bnB, C->b); - BIG_INITIALIZED(bnX, C->base.x); - BIG_INITIALIZED(bnY, C->base.y); - BIG_INITIALIZED(bnN, C->order); - BIG_INITIALIZED(bnH, C->h); - // - E->C = C; - E->CTX = CTX; - - // initialize EC group, associate a generator point and initialize the point - // from the parameter data - // Create a group structure - E->G = EC_GROUP_new_curve_GFp(bnP, bnA, bnB, CTX); - VERIFY(E->G != NULL); - - // Allocate a point in the group that will be used in setting the - // generator. This is not needed after the generator is set. - P = EC_POINT_new(E->G); - VERIFY(P != NULL); - - // Need to use this in case Montgomery method is being used - VERIFY(EC_POINT_set_affine_coordinates_GFp(E->G, P, bnX, bnY, CTX)); - // Now set the generator - VERIFY(EC_GROUP_set_generator(E->G, P, bnN, bnH)); - - EC_POINT_free(P); - goto Exit; -Error: - EC_POINT_free(P); - BnCurveFree(E); - E = NULL; - } -Exit: - return E; -} - -//*** BnCurveFree() -// This function will free the allocated components of the curve and end the -// frame in which the curve data exists -LIB_EXPORT void -BnCurveFree( - bigCurve E -) -{ - if(E) - { - EC_GROUP_free(E->G); - OsslContextLeave(E->CTX); - } -} - - -//*** BnEccModMult() -// This function does a point multiply of the form R = [d]S -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' (optional) - bigConst d, // IN: scalar for [d]S - bigCurve E - ) -{ - EC_POINT *pR = EC_POINT_new(E->G); - EC_POINT *pS = EcPointInitialized(S, E); - BIG_INITIALIZED(bnD, d); - - if(S == NULL) - EC_POINT_mul(E->G, pR, bnD, NULL, NULL, E->CTX); - else - EC_POINT_mul(E->G, pR, NULL, pS, bnD, E->CTX); - PointFromOssl(R, pR, E); - EC_POINT_free(pR); - EC_POINT_free(pS); - return !BnEqualZero(R->z); -} - -//*** BnEccModMult2() -// This function does a point multiply of the form R = [d]G + [u]Q -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult2( - bigPoint R, // OUT: computed point - pointConst S, // IN: optional point - bigConst d, // IN: scalar for [d]S or [d]G - pointConst Q, // IN: second point - bigConst u, // IN: second scalar - bigCurve E // IN: curve - ) -{ - EC_POINT *pR = EC_POINT_new(E->G); - EC_POINT *pS = EcPointInitialized(S, E); - BIG_INITIALIZED(bnD, d); - EC_POINT *pQ = EcPointInitialized(Q, E); - BIG_INITIALIZED(bnU, u); - - if(S == NULL || S == (pointConst)&(AccessCurveData(E)->base)) - EC_POINT_mul(E->G, pR, bnD, pQ, bnU, E->CTX); - else - { - const EC_POINT *points[2]; - const BIGNUM *scalars[2]; - points[0] = pS; - points[1] = pQ; - scalars[0] = bnD; - scalars[1] = bnU; - EC_POINTs_mul(E->G, pR, NULL, 2, points, scalars, E->CTX); - } - PointFromOssl(R, pR, E); - EC_POINT_free(pR); - EC_POINT_free(pS); - EC_POINT_free(pQ); - return !BnEqualZero(R->z); -} - -//** BnEccAdd() -// This function does addition of two points. -// Return Type: BOOL -// TRUE(1) success -// FALSE(0) failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccAdd( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' - pointConst Q, // IN: second point - bigCurve E // IN: curve - ) -{ - EC_POINT *pR = EC_POINT_new(E->G); - EC_POINT *pS = EcPointInitialized(S, E); - EC_POINT *pQ = EcPointInitialized(Q, E); -// - EC_POINT_add(E->G, pR, pS, pQ, E->CTX); - - PointFromOssl(R, pR, E); - EC_POINT_free(pR); - EC_POINT_free(pS); - EC_POINT_free(pQ); - return !BnEqualZero(R->z); -} - -#endif // ALG_ECC - - -#endif // MATHLIB OSSL \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslSupport.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslSupport.c deleted file mode 100644 index de7d939e1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/ossl/TpmToOsslSupport.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// The functions in this file are used for initialization of the interface to the -// OpenSSL library. - -//** Defines and Includes - -#include "Tpm.h" - -#if defined(HASH_LIB_OSSL) || defined(MATH_LIB_OSSL) || defined(SYM_LIB_OSSL) -// Used to pass the pointers to the correct sub-keys -typedef const BYTE *desKeyPointers[3]; - -//*** SupportLibInit() -// This does any initialization required by the support library. -LIB_EXPORT int -SupportLibInit( - void - ) -{ -#if LIBRARY_COMPATIBILITY_CHECK - MathLibraryCompatibilityCheck(); -#endif - return TRUE; -} - -//*** OsslContextEnter() -// This function is used to initialize an OpenSSL context at the start of a function -// that will call to an OpenSSL math function. -BN_CTX * -OsslContextEnter( - void - ) -{ - BN_CTX *CTX = BN_CTX_new(); -// - return OsslPushContext(CTX); -} - -//*** OsslContextLeave() -// This is the companion function to OsslContextEnter(). -void -OsslContextLeave( - BN_CTX *CTX - ) -{ - OsslPopContext(CTX); - BN_CTX_free(CTX); -} - -//*** OsslPushContext() -// This function is used to create a frame in a context. All values allocated within -// this context after the frame is started will be automatically freed when the -// context (OsslPopContext() -BN_CTX * -OsslPushContext( - BN_CTX *CTX - ) -{ - if(CTX == NULL) - FAIL(FATAL_ERROR_ALLOCATION); - BN_CTX_start(CTX); - return CTX; -} - -//*** OsslPopContext() -// This is the companion function to OsslPushContext(). -void -OsslPopContext( - BN_CTX *CTX - ) -{ - // BN_CTX_end can't be called with NULL. It will blow up. - if(CTX != NULL) - BN_CTX_end(CTX); -} - -#endif // HASH_LIB_OSSL || MATH_LIB_OSSL || SYM_LIB_OSSL diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfDesSupport.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfDesSupport.c deleted file mode 100644 index b42b32b1c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfDesSupport.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// The functions in this file are used for initialization of the interface to the -// wolfcrypt library. - -//** Defines and Includes - -#include "Tpm.h" - -#if (defined SYM_LIB_WOLF) && ALG_TDES - -//**Functions -//** TDES_setup -// This function calls the wolfcrypt function to generate a TDES key schedule. If the -// If the key is two key (16 bytes), then the first DES key is replicated to the third -// key position. -int TDES_setup( - const BYTE *key, - UINT32 keyBits, - tpmKeyScheduleTDES *skey, - int dir - ) -{ - BYTE k[24]; - BYTE *kp; - - // If this is two-key, make it three key by replicating K1 - if(keyBits == 128) - { - memcpy(k, key, 16); - memcpy(&k[16], key, 8); - kp = k; - } - else - kp = (BYTE *)key; - - return wc_Des3_SetKey( skey, kp, 0, dir ); -} - -//** TDES_setup_encrypt_key -// This function calls into TDES_setup(), specifically for an encryption key. -int TDES_setup_encrypt_key( - const BYTE *key, - UINT32 keyBits, - tpmKeyScheduleTDES *skey -) -{ - return TDES_setup( key, keyBits, skey, DES_ENCRYPTION ); -} - -//** TDES_setup_decrypt_key -// This function calls into TDES_setup(), specifically for an decryption key. -int TDES_setup_decrypt_key( - const BYTE *key, - UINT32 keyBits, - tpmKeyScheduleTDES *skey -) -{ - return TDES_setup( key, keyBits, skey, DES_DECRYPTION ); -} - -//*** TDES_encyrpt() -void TDES_encrypt( - const BYTE *in, - BYTE *out, - tpmKeyScheduleTDES *ks - ) -{ - wc_Des3_EcbEncrypt( ks, out, in, DES_BLOCK_SIZE ); -} - -//*** TDES_decrypt() -void TDES_decrypt( - const BYTE *in, - BYTE *out, - tpmKeyScheduleTDES *ks - ) -{ - wc_Des3_EcbDecrypt( ks, out, in, DES_BLOCK_SIZE ); -} - -#endif // MATH_LIB_WOLF && ALG_TDES diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c deleted file mode 100644 index 7169ee299..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfMath.c +++ /dev/null @@ -1,521 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// This file contains the math functions that are not implemented in the BnMath -// library (yet). These math functions will call the wolfcrypt library to execute -// the operations. There is a difference between the internal format and the -// wolfcrypt format. To call the wolfcrypt function, a mp_int structure is created -// for each passed variable. We define USE_FAST_MATH wolfcrypt option, which allocates -// mp_int on the stack. We must copy each word to the new structure, and set the used -// size. -// -// Not using USE_FAST_MATH would allow for a simple pointer swap for the big integer -// buffer 'd', however wolfcrypt expects to manage this memory, and will swap out -// the pointer to and from temporary variables and free the reference underneath us. -// Using USE_FAST_MATH also instructs wolfcrypt to use the stack for all these -// intermediate variables - - -//** Includes and Defines -#include "Tpm.h" - -#ifdef MATH_LIB_WOLF -#include "BnConvert_fp.h" -#include "TpmToWolfMath_fp.h" - -#define WOLF_HALF_RADIX (RADIX_BITS == 64 && !defined(FP_64BIT)) - -//** Functions - -//*** BnFromWolf() -// This function converts a wolfcrypt mp_int to a TPM bignum. In this implementation -// it is assumed that wolfcrypt used the same format for a big number as does the -// TPM -- an array of native-endian words in little-endian order. -void -BnFromWolf( - bigNum bn, - mp_int *wolfBn - ) -{ - if(bn != NULL) - { - int i; -#if WOLF_HALF_RADIX - pAssert((unsigned)wolfBn->used <= 2 * BnGetAllocated(bn)); -#else - pAssert((unsigned)wolfBn->used <= BnGetAllocated(bn)); -#endif - for (i = 0; i < wolfBn->used; i++) - { -#if WOLF_HALF_RADIX - if (i & 1) - bn->d[i/2] |= (crypt_uword_t)wolfBn->dp[i] << 32; - else - bn->d[i/2] = wolfBn->dp[i]; -#else - bn->d[i] = wolfBn->dp[i]; -#endif - } - -#if WOLF_HALF_RADIX - BnSetTop(bn, (wolfBn->used + 1)/2); -#else - BnSetTop(bn, wolfBn->used); -#endif - } -} - -//*** BnToWolf() -// This function converts a TPM bignum to a wolfcrypt mp_init, and has the same -// assumptions as made by BnFromWolf() -void -BnToWolf( - mp_int *toInit, - bigConst initializer - ) -{ - uint32_t i; - if (toInit != NULL && initializer != NULL) - { - for (i = 0; i < initializer->size; i++) - { -#if WOLF_HALF_RADIX - toInit->dp[2 * i] = (fp_digit)initializer->d[i]; - toInit->dp[2 * i + 1] = (fp_digit)(initializer->d[i] >> 32); -#else - toInit->dp[i] = initializer->d[i]; -#endif - } - -#if WOLF_HALF_RADIX - toInit->used = (int)initializer->size * 2; - if (toInit->dp[toInit->used - 1] == 0 && toInit->dp[toInit->used - 2] != 0) - --toInit->used; -#else - toInit->used = (int)initializer->size; -#endif - toInit->sign = 0; - } -} - -//*** MpInitialize() -// This function initializes an wolfcrypt mp_int. -mp_int * -MpInitialize( - mp_int *toInit -) -{ - mp_init( toInit ); - return toInit; -} - -#if LIBRARY_COMPATIBILITY_CHECK -//** MathLibraryCompatibililtyCheck() -// This function is only used during development to make sure that the library -// that is being referenced is using the same size of data structures as the TPM. -void -MathLibraryCompatibilityCheck( - void - ) -{ - BN_VAR(tpmTemp, 64 * 8); // allocate some space for a test value - crypt_uword_t i; - TPM2B_TYPE(TEST, 16); - TPM2B_TEST test = {{16, {0x0F, 0x0E, 0x0D, 0x0C, - 0x0B, 0x0A, 0x09, 0x08, - 0x07, 0x06, 0x05, 0x04, - 0x03, 0x02, 0x01, 0x00}}}; - // Convert the test TPM2B to a bigNum - BnFrom2B(tpmTemp, &test.b); - MP_INITIALIZED(wolfTemp, tpmTemp); - (wolfTemp); // compiler warning - // Make sure the values are consistent - cAssert(wolfTemp->used == (int)tpmTemp->size); - for(i = 0; i < tpmTemp->size; i++) - cAssert(wolfTemp->dp[i] == tpmTemp->d[i]); -} -#endif - -//*** BnModMult() -// Does multiply and divide returning the remainder of the divide. -LIB_EXPORT BOOL -BnModMult( - bigNum result, - bigConst op1, - bigConst op2, - bigConst modulus - ) -{ - WOLF_ENTER(); - BOOL OK; - MP_INITIALIZED(bnOp1, op1); - MP_INITIALIZED(bnOp2, op2); - MP_INITIALIZED(bnTemp, NULL); - BN_VAR(temp, LARGEST_NUMBER_BITS * 2); - - pAssert(BnGetAllocated(result) >= BnGetSize(modulus)); - - OK = (mp_mul( bnOp1, bnOp2, bnTemp ) == MP_OKAY); - if(OK) - { - BnFromWolf(temp, bnTemp); - OK = BnDiv(NULL, result, temp, modulus); - } - - WOLF_LEAVE(); - return OK; -} - -//*** BnMult() -// Multiplies two numbers -LIB_EXPORT BOOL -BnMult( - bigNum result, - bigConst multiplicand, - bigConst multiplier - ) -{ - WOLF_ENTER(); - BOOL OK; - MP_INITIALIZED(bnTemp, NULL); - MP_INITIALIZED(bnA, multiplicand); - MP_INITIALIZED(bnB, multiplier); - - pAssert(result->allocated >= - (BITS_TO_CRYPT_WORDS(BnSizeInBits(multiplicand) - + BnSizeInBits(multiplier)))); - - OK = (mp_mul( bnA, bnB, bnTemp ) == MP_OKAY); - if(OK) - { - BnFromWolf(result, bnTemp); - } - - WOLF_LEAVE(); - return OK; -} - -//*** BnDiv() -// This function divides two bigNum values. The function returns FALSE if -// there is an error in the operation. -LIB_EXPORT BOOL -BnDiv( - bigNum quotient, - bigNum remainder, - bigConst dividend, - bigConst divisor - ) -{ - WOLF_ENTER(); - BOOL OK; - MP_INITIALIZED(bnQ, quotient); - MP_INITIALIZED(bnR, remainder); - MP_INITIALIZED(bnDend, dividend); - MP_INITIALIZED(bnSor, divisor); - pAssert(!BnEqualZero(divisor)); - if(BnGetSize(dividend) < BnGetSize(divisor)) - { - if(quotient) - BnSetWord(quotient, 0); - if(remainder) - BnCopy(remainder, dividend); - OK = TRUE; - } - else - { - pAssert((quotient == NULL) - || (quotient->allocated >= (unsigned)(dividend->size - - divisor->size))); - pAssert((remainder == NULL) - || (remainder->allocated >= divisor->size)); - OK = (mp_div(bnDend , bnSor, bnQ, bnR) == MP_OKAY); - if(OK) - { - BnFromWolf(quotient, bnQ); - BnFromWolf(remainder, bnR); - } - } - - WOLF_LEAVE(); - return OK; -} - -#if ALG_RSA -//*** BnGcd() -// Get the greatest common divisor of two numbers -LIB_EXPORT BOOL -BnGcd( - bigNum gcd, // OUT: the common divisor - bigConst number1, // IN: - bigConst number2 // IN: - ) -{ - WOLF_ENTER(); - BOOL OK; - MP_INITIALIZED(bnGcd, gcd); - MP_INITIALIZED(bn1, number1); - MP_INITIALIZED(bn2, number2); - pAssert(gcd != NULL); - OK = (mp_gcd( bn1, bn2, bnGcd ) == MP_OKAY); - if(OK) - { - BnFromWolf(gcd, bnGcd); - } - WOLF_LEAVE(); - return OK; -} - -//***BnModExp() -// Do modular exponentiation using bigNum values. The conversion from a mp_int to -// a bigNum is trivial as they are based on the same structure -LIB_EXPORT BOOL -BnModExp( - bigNum result, // OUT: the result - bigConst number, // IN: number to exponentiate - bigConst exponent, // IN: - bigConst modulus // IN: - ) -{ - WOLF_ENTER(); - BOOL OK; - MP_INITIALIZED(bnResult, result); - MP_INITIALIZED(bnN, number); - MP_INITIALIZED(bnE, exponent); - MP_INITIALIZED(bnM, modulus); - OK = (mp_exptmod( bnN, bnE, bnM, bnResult ) == MP_OKAY); - if(OK) - { - BnFromWolf(result, bnResult); - } - - WOLF_LEAVE(); - return OK; -} - -//*** BnModInverse() -// Modular multiplicative inverse -LIB_EXPORT BOOL -BnModInverse( - bigNum result, - bigConst number, - bigConst modulus - ) -{ - WOLF_ENTER(); - BOOL OK; - MP_INITIALIZED(bnResult, result); - MP_INITIALIZED(bnN, number); - MP_INITIALIZED(bnM, modulus); - - OK = (mp_invmod(bnN, bnM, bnResult) == MP_OKAY); - if(OK) - { - BnFromWolf(result, bnResult); - } - - WOLF_LEAVE(); - return OK; -} -#endif // TPM_ALG_RSA - -#if ALG_ECC - -//*** PointFromWolf() -// Function to copy the point result from a wolf ecc_point to a bigNum -void -PointFromWolf( - bigPoint pOut, // OUT: resulting point - ecc_point *pIn // IN: the point to return - ) -{ - BnFromWolf(pOut->x, pIn->x); - BnFromWolf(pOut->y, pIn->y); - BnFromWolf(pOut->z, pIn->z); -} - -//*** PointToWolf() -// Function to copy the point result from a bigNum to a wolf ecc_point -void -PointToWolf( - ecc_point *pOut, // OUT: resulting point - pointConst pIn // IN: the point to return - ) -{ - BnToWolf(pOut->x, pIn->x); - BnToWolf(pOut->y, pIn->y); - BnToWolf(pOut->z, pIn->z); -} - -//*** EcPointInitialized() -// Allocate and initialize a point. -static ecc_point * -EcPointInitialized( - pointConst initializer - ) -{ - ecc_point *P; - - P = wc_ecc_new_point(); - pAssert(P != NULL); - // mp_int x,y,z are stack allocated. - // initializer is not required - if (P != NULL && initializer != NULL) - { - PointToWolf( P, initializer ); - } - - return P; -} - -//*** BnEccModMult() -// This function does a point multiply of the form R = [d]S -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' (optional) - bigConst d, // IN: scalar for [d]S - bigCurve E - ) -{ - WOLF_ENTER(); - BOOL OK; - MP_INITIALIZED(bnD, d); - MP_INITIALIZED(bnPrime, CurveGetPrime(E)); - POINT_CREATE(pS, NULL); - POINT_CREATE(pR, NULL); - - if(S == NULL) - S = CurveGetG(AccessCurveData(E)); - - PointToWolf(pS, S); - - OK = (wc_ecc_mulmod(bnD, pS, pR, NULL, bnPrime, 1 ) == MP_OKAY); - if(OK) - { - PointFromWolf(R, pR); - } - - POINT_DELETE(pR); - POINT_DELETE(pS); - - WOLF_LEAVE(); - return !BnEqualZero(R->z); -} - -//*** BnEccModMult2() -// This function does a point multiply of the form R = [d]G + [u]Q -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccModMult2( - bigPoint R, // OUT: computed point - pointConst S, // IN: optional point - bigConst d, // IN: scalar for [d]S or [d]G - pointConst Q, // IN: second point - bigConst u, // IN: second scalar - bigCurve E // IN: curve - ) -{ - WOLF_ENTER(); - BOOL OK; - POINT_CREATE(pR, NULL); - POINT_CREATE(pS, NULL); - POINT_CREATE(pQ, Q); - MP_INITIALIZED(bnD, d); - MP_INITIALIZED(bnU, u); - MP_INITIALIZED(bnPrime, CurveGetPrime(E)); - MP_INITIALIZED(bnA, CurveGet_a(E)); - - if(S == NULL) - S = CurveGetG(AccessCurveData(E)); - PointToWolf( pS, S ); - - OK = (ecc_mul2add(pS, bnD, pQ, bnU, pR, bnA, bnPrime, NULL) == MP_OKAY); - if(OK) - { - PointFromWolf(R, pR); - } - - POINT_DELETE(pS); - POINT_DELETE(pQ); - POINT_DELETE(pR); - - WOLF_LEAVE(); - return !BnEqualZero(R->z); -} - -//** BnEccAdd() -// This function does addition of two points. -// return type: BOOL -// FALSE failure in operation; treat as result being point at infinity -LIB_EXPORT BOOL -BnEccAdd( - bigPoint R, // OUT: computed point - pointConst S, // IN: point to multiply by 'd' - pointConst Q, // IN: second point - bigCurve E // IN: curve - ) -{ - WOLF_ENTER(); - BOOL OK; - mp_digit mp; - POINT_CREATE(pR, NULL); - POINT_CREATE(pS, S); - POINT_CREATE(pQ, Q); - MP_INITIALIZED(bnA, CurveGet_a(E)); - MP_INITIALIZED(bnMod, CurveGetPrime(E)); -// - OK = (mp_montgomery_setup(bnMod, &mp) == MP_OKAY); - OK = OK && (ecc_projective_add_point(pS, pQ, pR, bnA, bnMod, mp ) == MP_OKAY); - if(OK) - { - PointFromWolf(R, pR); - } - - POINT_DELETE(pS); - POINT_DELETE(pQ); - POINT_DELETE(pR); - - WOLF_LEAVE(); - return !BnEqualZero(R->z); -} - -#endif // TPM_ALG_ECC - -#endif // MATH_LIB_WOLF \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfSupport.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfSupport.c deleted file mode 100644 index 5492e350e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/TpmToWolfSupport.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Introduction -// -// The functions in this file are used for initialization of the interface to the -// wolfSSL library. - -//** Defines and Includes - -#include "Tpm.h" - -#if defined(HASH_LIB_WOLF) || defined(MATH_LIB_WOLF) || defined(SYM_LIB_WOLF) - -//*** SupportLibInit() -// This does any initialization required by the support library. -LIB_EXPORT int -SupportLibInit( - void - ) -{ -#if LIBRARY_COMPATIBILITY_CHECK - MathLibraryCompatibilityCheck(); -#endif - return TRUE; -} - -#endif // HASH_LIB_WOLF || MATH_LIB_WOLF || SYM_LIB_WOLF diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/wolfssl.vcxproj b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/wolfssl.vcxproj deleted file mode 100644 index d36991af2..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/wolf/wolfssl.vcxproj +++ /dev/null @@ -1,194 +0,0 @@ - - - - - Coverage - Win32 - - - Coverage - x64 - - - WolfDebug - Win32 - - - WolfDebug - x64 - - - WolfRelease - Win32 - - - WolfRelease - x64 - - - - {73973223-5EE8-41CA-8E88-1D60E89A237B} - wolfssl - Win32Proj - 10.0.17763.0 - $(SolutionDir)..\external\wolfssl\ - - - - StaticLibrary - v141 - Unicode - true - - - StaticLibrary - v141 - Unicode - true - - - StaticLibrary - v141 - Unicode - - - StaticLibrary - v141 - Unicode - - - StaticLibrary - v141 - Unicode - - - StaticLibrary - v141 - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)\bin\$(PlatformTarget)\$(Configuration)\ - $(SolutionDir)\bin\$(ProjectName)\$(PlatformTarget)\$(Configuration)\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(WolfRootDir) - - - - WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;CYASSL_USER_SETTINGS;%(PreprocessorDefinitions) - - - - - Disabled - true - EnableFastChecks - MultiThreadedDebugDLL - - Level4 - EditAndContinue - 4206;4214;4706;%(DisableSpecificWarnings) - $(SolutionDir)\tpm\include;$(SolutionDir)\tpm\include\wolf;%(AdditionalIncludeDirectories) - - - - - Disabled - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - EditAndContinue - 4206;4214;4706;%(DisableSpecificWarnings) - $(SolutionDir)\tpm\include;$(SolutionDir)\tpm\include\wolf;%(AdditionalIncludeDirectories) - - - - - Disabled - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - ProgramDatabase - 4206;4214;4706;%(DisableSpecificWarnings) - $(SolutionDir)\tpm\include;$(SolutionDir)\tpm\include\wolf;%(AdditionalIncludeDirectories) - - - - - Disabled - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - ProgramDatabase - 4206;4214;4706;%(DisableSpecificWarnings) - - - - - MaxSpeed - true - MultiThreadedDLL - true - - Level3 - ProgramDatabase - $(SolutionDir)\tpm\include;$(SolutionDir)\tpm\include\wolf;%(AdditionalIncludeDirectories) - - - - - MaxSpeed - true - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - $(SolutionDir)\tpm\include;$(SolutionDir)\tpm\include\wolf;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_Data.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_Data.c deleted file mode 100644 index 52d5ecbb2..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_Data.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" - -// This function is called to process a _TPM_Hash_Data indication. -LIB_EXPORT void -_TPM_Hash_Data( - uint32_t dataSize, // IN: size of data to be extend - unsigned char *data // IN: data buffer - ) -{ - UINT32 i; - HASH_OBJECT *hashObject; - TPMI_DH_PCR pcrHandle = TPMIsStarted() - ? PCR_FIRST + DRTM_PCR : PCR_FIRST + HCRTM_PCR; - -// If there is no DRTM sequence object, then _TPM_Hash_Start -// was not called so this function returns without doing -// anything. - if(g_DRTMHandle == TPM_RH_UNASSIGNED) - return; - - hashObject = (HASH_OBJECT *)HandleToObject(g_DRTMHandle); - pAssert(hashObject->attributes.eventSeq); - - // For each of the implemented hash algorithms, update the digest with the - // data provided. - for(i = 0; i < HASH_COUNT; i++) - { - // make sure that the PCR is implemented for this algorithm - if(PcrIsAllocated(pcrHandle, - hashObject->state.hashState[i].hashAlg)) - // Update sequence object - CryptDigestUpdate(&hashObject->state.hashState[i], dataSize, data); - } - - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_End.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_End.c deleted file mode 100644 index 72d0519b1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_End.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" - -// This function is called to process a _TPM_Hash_End indication. -LIB_EXPORT void -_TPM_Hash_End( - void - ) -{ - UINT32 i; - TPM2B_DIGEST digest; - HASH_OBJECT *hashObject; - TPMI_DH_PCR pcrHandle; - - // If the DRTM handle is not being used, then either _TPM_Hash_Start has not - // been called, _TPM_Hash_End was previously called, or some other command - // was executed and the sequence was aborted. - if(g_DRTMHandle == TPM_RH_UNASSIGNED) - return; - - // Get DRTM sequence object - hashObject = (HASH_OBJECT *)HandleToObject(g_DRTMHandle); - - // Is this _TPM_Hash_End after Startup or before - if(TPMIsStarted()) - { - // After - - // Reset the DRTM PCR - PCRResetDynamics(); - - // Extend the DRTM_PCR. - pcrHandle = PCR_FIRST + DRTM_PCR; - - // DRTM sequence increments restartCount - gr.restartCount++; - } - else - { - pcrHandle = PCR_FIRST + HCRTM_PCR; - g_DrtmPreStartup = TRUE; - } - - // Complete hash and extend PCR, or if this is an HCRTM, complete - // the hash, reset the H-CRTM register (PCR[0]) to 0...04, and then - // extend the H-CRTM data - for(i = 0; i < HASH_COUNT; i++) - { - TPMI_ALG_HASH hash = CryptHashGetAlgByIndex(i); - // make sure that the PCR is implemented for this algorithm - if(PcrIsAllocated(pcrHandle, - hashObject->state.hashState[i].hashAlg)) - { - // Complete hash - digest.t.size = CryptHashGetDigestSize(hash); - CryptHashEnd2B(&hashObject->state.hashState[i], &digest.b); - - PcrDrtm(pcrHandle, hash, &digest); - } - } - - // Flush sequence object. - FlushObject(g_DRTMHandle); - - g_DRTMHandle = TPM_RH_UNASSIGNED; - - - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_Start.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_Start.c deleted file mode 100644 index 9d108fef1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Hash_Start.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" - -// This function is called to process a _TPM_Hash_Start indication. -LIB_EXPORT void -_TPM_Hash_Start( - void - ) -{ - TPM_RC result; - TPMI_DH_OBJECT handle; - - // If a DRTM sequence object exists, free it up - if(g_DRTMHandle != TPM_RH_UNASSIGNED) - { - FlushObject(g_DRTMHandle); - g_DRTMHandle = TPM_RH_UNASSIGNED; - } - - // Create an event sequence object and store the handle in global - // g_DRTMHandle. A TPM_RC_OBJECT_MEMORY error may be returned at this point - // The NULL value for the first parameter will cause the sequence structure to - // be allocated without being set as present. This keeps the sequence from - // being left behind if the sequence is terminated early. - result = ObjectCreateEventSequence(NULL, &g_DRTMHandle); - - // If a free slot was not available, then free up a slot. - if(result != TPM_RC_SUCCESS) - { - // An implementation does not need to have a fixed relationship between - // slot numbers and handle numbers. To handle the general case, scan for - // a handle that is assigned and free it for the DRTM sequence. - // In the reference implementation, the relationship between handles and - // slots is fixed. So, if the call to ObjectCreateEvenSequence() - // failed indicating that all slots are occupied, then the first handle we - // are going to check (TRANSIENT_FIRST) will be occupied. It will be freed - // so that it can be assigned for use as the DRTM sequence object. - for(handle = TRANSIENT_FIRST; handle < TRANSIENT_LAST; handle++) - { - // try to flush the first object - if(IsObjectPresent(handle)) - break; - } - // If the first call to find a slot fails but none of the slots is occupied - // then there's a big problem - pAssert(handle < TRANSIENT_LAST); - - // Free the slot - FlushObject(handle); - - // Try to create an event sequence object again. This time, we must - // succeed. - result = ObjectCreateEventSequence(NULL, &g_DRTMHandle); - if(result != TPM_RC_SUCCESS) - FAIL(FATAL_ERROR_INTERNAL); - } - - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Init.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Init.c deleted file mode 100644 index 0adc0a41a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/events/_TPM_Init.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "Tpm.h" -#include "_TPM_Init_fp.h" - - // This function is used to process a _TPM_Init indication. -LIB_EXPORT void -_TPM_Init( - void - ) -{ - g_powerWasLost = g_powerWasLost | _plat__WasPowerLost(); - -#if SIMULATION && DEBUG - // If power was lost and this was a simulation, put canary in RAM used by NV - // so that uninitialized memory can be detected more easily - if(g_powerWasLost) - { - memset(&gc, 0xbb, sizeof(gc)); - memset(&gr, 0xbb, sizeof(gr)); - memset(&gp, 0xbb, sizeof(gp)); - memset(&go, 0xbb, sizeof(go)); - } -#endif - -#if SIMULATION - // Clear the flag that forces failure on self-test - g_forceFailureMode = FALSE; -#endif - - // Set initialization state - TPMInit(); - - // Set g_DRTMHandle as unassigned - g_DRTMHandle = TPM_RH_UNASSIGNED; - - // No H-CRTM, yet. - g_DrtmPreStartup = FALSE; - - // Initialize the NvEnvironment. - g_nvOk = NvPowerOn(); - - // Initialize cryptographic functions - g_inFailureMode = (CryptInit() == FALSE); - if(!g_inFailureMode) - { - // Load the persistent data - NvReadPersistent(); - - // Load the orderly data (clock and DRBG state). - // If this is not done here, things break - NvRead(&go, NV_ORDERLY_DATA, sizeof(go)); - - // Start clock. Need to do this after NV has been restored. - TimePowerOn(); - } - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/CommandDispatcher.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/CommandDispatcher.c deleted file mode 100644 index bc55a3b0e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/CommandDispatcher.c +++ /dev/null @@ -1,430 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes and Typedefs -#include "Tpm.h" - -#if TABLE_DRIVEN_DISPATCH - -typedef TPM_RC(NoFlagFunction)(void *target, BYTE **buffer, INT32 *size); -typedef TPM_RC(FlagFunction)(void *target, BYTE **buffer, INT32 *size, BOOL flag); - -typedef FlagFunction *UNMARSHAL_t; - -typedef INT16(MarshalFunction)(void *source, BYTE **buffer, INT32 *size); -typedef MarshalFunction *MARSHAL_t; - -typedef TPM_RC(COMMAND_NO_ARGS)(void); -typedef TPM_RC(COMMAND_IN_ARG)(void *in); -typedef TPM_RC(COMMAND_OUT_ARG)(void *out); -typedef TPM_RC(COMMAND_INOUT_ARG)(void *in, void *out); - -typedef union COMMAND_t -{ - COMMAND_NO_ARGS *noArgs; - COMMAND_IN_ARG *inArg; - COMMAND_OUT_ARG *outArg; - COMMAND_INOUT_ARG *inOutArg; -} COMMAND_t; - -// This structure is used by ParseHandleBuffer() and CommandDispatcher(). The -// parameters in this structure are unique for each command. The parameters are: -// command holds the address of the command processing function that is called -// by Command Dispatcher. -// inSize this is the size of the command-dependent input structure. The -// input structure holds the unmarshaled handles and command -// parameters. If the command takes no arguments (handles or -// parameters) then inSize will have a value of 0. -// outSize this is the size of the command-dependent output structure. The -// output structure holds the results of the command in an unmarshaled -// form. When command processing is completed, these values are -// marshaled into the output buffer. It is always the case that the -// unmarshaled version of an output structure is larger then the -// marshaled version. This is because the marshaled version contains -// the exact same number of significant bytes but with padding removed. -// typesOffsets this parameter points to the list of data types that are to be -// marshaled or unmarshaled. The list of types follows the 'offsets' -// array. The offsets array is variable sized so the typesOffset filed -// is necessary for the handle and command processing to be able to -// find the types that are being handled. The 'offsets' array may be -// empty. The types structure is described below. -// offsets this is an array of offsets of each of the parameters in the -// command or response. When processing the command parameters (not -// handles) the list contains the offset of the next parameter. For -// example, if the first command parameter has a size of 4 and there is -// a second command parameter, then the offset would be 4, indicating -// that the second parameter starts at 4. If the second parameter has -// a size of 8, and there is a third parameter, then the second entry -// in offsets is 12 (4 for the first parameter and 8 for the second). -// An offset value of 0 in the list indicates the start of the response -// parameter list. When CommandDispatcher hits this value, it will stop -// unmarshaling the parameters and call 'command'. If a command has no -// response parameters and only one command parameter, then offsets can -// be an empty list. - -typedef struct COMMAND_DESCRIPTOR_t -{ - COMMAND_t command; // Address of the command - UINT16 inSize; // Maximum size of the input structure - UINT16 outSize; // Maximum size of the output structure - UINT16 typesOffset; // address of the types field - UINT16 offsets[1]; -} COMMAND_DESCRIPTOR_t; - -// The 'types' list is an encoded byte array. The byte value has two parts. The most -// significant bit is used when a parameter takes a flag and indicates if the flag -// should be SET or not. The remaining 7 bits are an index into an array of -// addresses of marshaling and unmarshaling functions. -// The array of functions is divided into 6 sections with a value assigned -// to denote the start of that section (and the end of the previous section). The -// defined offset values for each section are: -// 0 unmarshaling for handles that do not take flags -// HANDLE_FIRST_FLAG_TYPE unmarshaling for handles that take flags -// PARAMETER_FIRST_TYPE unmarshaling for parameters that do not take flags -// PARAMETER_FIRST_FLAG_TYPE unmarshaling for parameters that take flags -// PARAMETER_LAST_TYPE + 1 marshaling for handles -// RESPONSE_PARAMETER_FIRST_TYPE marshaling for parameters -// RESPONSE_PARAMETER_LAST_TYPE is the last value in the list of marshaling and -// unmarshaling functions. -// -// The types list is constructed with a byte of 0xff at the end of the command -// parameters and with an 0xff at the end of the response parameters. - -#if COMPRESSED_LISTS -# define PAD_LIST 0 -#else -# define PAD_LIST 1 -#endif -#define _COMMAND_TABLE_DISPATCH_ -#include "CommandDispatchData.h" - -#define TEST_COMMAND TPM_CC_Startup - -#define NEW_CC - -#else - -#include "Commands.h" - -#endif - -//** Marshal/Unmarshal Functions - -//*** ParseHandleBuffer() -// This is the table-driven version of the handle buffer unmarshaling code -TPM_RC -ParseHandleBuffer( - COMMAND *command - ) -{ - TPM_RC result; -#if TABLE_DRIVEN_DISPATCH - COMMAND_DESCRIPTOR_t *desc; - BYTE *types; - BYTE type; - BYTE dType; - - // Make sure that nothing strange has happened - pAssert(command->index - < sizeof(s_CommandDataArray) / sizeof(COMMAND_DESCRIPTOR_t *)); - // Get the address of the descriptor for this command - desc = s_CommandDataArray[command->index]; - - pAssert(desc != NULL); - // Get the associated list of unmarshaling data types. - types = &((BYTE *)desc)[desc->typesOffset]; - -// if(s_ccAttr[commandIndex].commandIndex == TEST_COMMAND) -// commandIndex = commandIndex; - // No handles yet - command->handleNum = 0; - - // Get the first type value - for(type = *types++; - // check each byte to make sure that we have not hit the start - // of the parameters - (dType = (type & 0x7F)) < PARAMETER_FIRST_TYPE; - // get the next type - type = *types++) - { - // See if unmarshaling of this handle type requires a flag - if(dType < HANDLE_FIRST_FLAG_TYPE) - { - // Look up the function to do the unmarshaling - NoFlagFunction *f = (NoFlagFunction *)UnmarshalArray[dType]; - // call it - result = f(&(command->handles[command->handleNum]), - &command->parameterBuffer, - &command->parameterSize); - } - else - { - // Look up the function - FlagFunction *f = UnmarshalArray[dType]; - - // Call it setting the flag to the appropriate value - result = f(&(command->handles[command->handleNum]), - &command->parameterBuffer, - &command->parameterSize, (type & 0x80) != 0); - } - // Got a handle - // We do this first so that the match for the handle offset of the - // response code works correctly. - command->handleNum += 1; - if(result != TPM_RC_SUCCESS) - // if the unmarshaling failed, return the response code with the - // handle indication set - return result + TPM_RC_H + (command->handleNum * TPM_RC_1); - } -#else - BYTE **handleBufferStart = &command->parameterBuffer; - INT32 *bufferRemainingSize = &command->parameterSize; - TPM_HANDLE *handles = &command->handles[0]; - UINT32 *handleCount = &command->handleNum; - *handleCount = 0; - switch(command->code) - { -#include "HandleProcess.h" -#undef handles - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } -#endif - return TPM_RC_SUCCESS; -} - -//*** CommandDispatcher() -// Function to unmarshal the command parameters, call the selected action code, and -// marshal the response parameters. -TPM_RC -CommandDispatcher( - COMMAND *command - ) -{ -#if !TABLE_DRIVEN_DISPATCH - TPM_RC result; - BYTE **paramBuffer = &command->parameterBuffer; - INT32 *paramBufferSize = &command->parameterSize; - BYTE **responseBuffer = &command->responseBuffer; - INT32 *respParmSize = &command->parameterSize; - INT32 rSize; - TPM_HANDLE *handles = &command->handles[0]; -// - command->handleNum = 0; // The command-specific code knows how - // many handles there are. This is for - // cataloging the number of response - // handles - MemoryIoBufferAllocationReset(); // Initialize so that allocation will - // work properly - switch(GetCommandCode(command->index)) - { -#include "CommandDispatcher.h" - - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } -Exit: - MemoryIoBufferZero(); - return result; -#else - COMMAND_DESCRIPTOR_t *desc; - BYTE *types; - BYTE type; - UINT16 *offsets; - UINT16 offset = 0; - UINT32 maxInSize; - BYTE *commandIn; - INT32 maxOutSize; - BYTE *commandOut; - COMMAND_t cmd; - TPM_HANDLE *handles; - UINT32 hasInParameters = 0; - BOOL hasOutParameters = FALSE; - UINT32 pNum = 0; - BYTE dType; // dispatch type - TPM_RC result; -// - // Get the address of the descriptor for this command - pAssert(command->index - < sizeof(s_CommandDataArray) / sizeof(COMMAND_DESCRIPTOR_t *)); - desc = s_CommandDataArray[command->index]; - - // Get the list of parameter types for this command - pAssert(desc != NULL); - types = &((BYTE *)desc)[desc->typesOffset]; - - // Get a pointer to the list of parameter offsets - offsets = &desc->offsets[0]; - // pointer to handles - handles = command->handles; - - // Get the size required to hold all the unmarshaled parameters for this command - maxInSize = desc->inSize; - // and the size of the output parameter structure returned by this command - maxOutSize = desc->outSize; - - MemoryIoBufferAllocationReset(); - // Get a buffer for the input parameters - commandIn = MemoryGetInBuffer(maxInSize); - // And the output parameters - commandOut = (BYTE *)MemoryGetOutBuffer((UINT32)maxOutSize); - - // Get the address of the action code dispatch - cmd = desc->command; - - // Copy any handles into the input buffer - for(type = *types++; (type & 0x7F) < PARAMETER_FIRST_TYPE; type = *types++) - { - // 'offset' was initialized to zero so the first unmarshaling will always - // be to the start of the data structure - *(TPM_HANDLE *)&(commandIn[offset]) = *handles++; - // This check is used so that we don't have to add an additional offset - // value to the offsets list to correspond to the stop value in the - // command parameter list. - if(*types != 0xFF) - offset = *offsets++; -// maxInSize -= sizeof(TPM_HANDLE); - hasInParameters++; - } - // Exit loop with type containing the last value read from types - // maxInSize has the amount of space remaining in the command action input - // buffer. Make sure that we don't have more data to unmarshal than is going to - // fit. - - // type contains the last value read from types so it is not necessary to - // reload it, which is good because *types now points to the next value - for(; (dType = (type & 0x7F)) <= PARAMETER_LAST_TYPE; type = *types++) - { - pNum++; - if(dType < PARAMETER_FIRST_FLAG_TYPE) - { - NoFlagFunction *f = (NoFlagFunction *)UnmarshalArray[dType]; - result = f(&commandIn[offset], &command->parameterBuffer, - &command->parameterSize); - } - else - { - FlagFunction *f = UnmarshalArray[dType]; - result = f(&commandIn[offset], &command->parameterBuffer, - &command->parameterSize, - (type & 0x80) != 0); - } - if(result != TPM_RC_SUCCESS) - { - result += TPM_RC_P + (TPM_RC_1 * pNum); - goto Exit; - } - - // This check is used so that we don't have to add an additional offset - // value to the offsets list to correspond to the stop value in the - // command parameter list. - if(*types != 0xFF) - offset = *offsets++; - hasInParameters++; - } - // Should have used all the bytes in the input - if(command->parameterSize != 0) - { - result = TPM_RC_SIZE; - goto Exit; - } - - // The command parameter unmarshaling stopped when it hit a value that was out - // of range for unmarshaling values and left *types pointing to the first - // marshaling type. If that type happens to be the STOP value, then there - // are no response parameters. So, set the flag to indicate if there are - // output parameters. - hasOutParameters = *types != 0xFF; - - // There are four cases for calling, with and without input parameters and with - // and without output parameters. - if(hasInParameters > 0) - { - if(hasOutParameters) - result = cmd.inOutArg(commandIn, commandOut); - else - result = cmd.inArg(commandIn); - } - else - { - if(hasOutParameters) - result = cmd.outArg(commandOut); - else - result = cmd.noArgs(); - } - if(result != TPM_RC_SUCCESS) - goto Exit; - - // Offset in the marshaled output structure - offset = 0; - - // Process the return handles, if any - command->handleNum = 0; - - // Could make this a loop to process output handles but there is only ever - // one handle in the outputs (for now). - type = *types++; - if((dType = (type & 0x7F)) < RESPONSE_PARAMETER_FIRST_TYPE) - { - // The out->handle value was referenced as TPM_HANDLE in the - // action code so it has to be properly aligned. - command->handles[command->handleNum++] = - *((TPM_HANDLE *)&(commandOut[offset])); - maxOutSize -= sizeof(UINT32); - type = *types++; - offset = *offsets++; - } - // Use the size of the command action output buffer as the maximum for the - // number of bytes that can get marshaled. Since the marshaling code has - // no pointers to data, all of the data being returned has to be in the - // command action output buffer. If we try to marshal more bytes than - // could fit into the output buffer, we need to fail. - for(;(dType = (type & 0x7F)) <= RESPONSE_PARAMETER_LAST_TYPE - && !g_inFailureMode; type = *types++) - { - const MARSHAL_t f = MarshalArray[dType]; - - command->parameterSize += f(&commandOut[offset], - &command->responseBuffer, - &maxOutSize); - offset = *offsets++; - } - result = (maxOutSize < 0) ? TPM_RC_FAILURE : TPM_RC_SUCCESS; -Exit: - MemoryIoBufferZero(); - return result; -#endif -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/ExecCommand.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/ExecCommand.c deleted file mode 100644 index d7673c5d0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/ExecCommand.c +++ /dev/null @@ -1,317 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This file contains the entry function ExecuteCommand() which provides the main -// control flow for TPM command execution. - -//** Includes - -#include "Tpm.h" -#include "ExecCommand_fp.h" - -// Uncomment this next #include if doing static command/response buffer sizing -// #include "CommandResponseSizes_fp.h" - -//** ExecuteCommand() -// -// The function performs the following steps. -// -// a) Parses the command header from input buffer. -// b) Calls ParseHandleBuffer() to parse the handle area of the command. -// c) Validates that each of the handles references a loaded entity. -// d) Calls ParseSessionBuffer () to: -// 1) unmarshal and parse the session area; -// 2) check the authorizations; and -// 3) when necessary, decrypt a parameter. -// e) Calls CommandDispatcher() to: -// 1) unmarshal the command parameters from the command buffer; -// 2) call the routine that performs the command actions; and -// 3) marshal the responses into the response buffer. -// f) If any error occurs in any of the steps above create the error response -// and return. -// g) Calls BuildResponseSessions() to: -// 1) when necessary, encrypt a parameter -// 2) build the response authorization sessions -// 3) update the audit sessions and nonces -// h) Calls BuildResponseHeader() to complete the construction of the response. -// -// 'responseSize' is set by the caller to the maximum number of bytes available in -// the output buffer. ExecuteCommand will adjust the value and return the number -// of bytes placed in the buffer. -// -// 'response' is also set by the caller to indicate the buffer into which -// ExecuteCommand is to place the response. -// -// 'request' and 'response' may point to the same buffer -// -// Note: As of February, 2016, the failure processing has been moved to the -// platform-specific code. When the TPM code encounters an unrecoverable failure, it -// will SET g_inFailureMode and call _plat__Fail(). That function should not return -// but may call ExecuteCommand(). -// -LIB_EXPORT void -ExecuteCommand( - uint32_t requestSize, // IN: command buffer size - unsigned char *request, // IN: command buffer - uint32_t *responseSize, // IN/OUT: response buffer size - unsigned char **response // IN/OUT: response buffer - ) -{ - // Command local variables - UINT32 commandSize; - COMMAND command; - - // Response local variables - UINT32 maxResponse = *responseSize; - TPM_RC result; // return code for the command - -// This next function call is used in development to size the command and response -// buffers. The values printed are the sizes of the internal structures and -// not the sizes of the canonical forms of the command response structures. Also, -// the sizes do not include the tag, command.code, requestSize, or the authorization -// fields. -//CommandResponseSizes(); - // Set flags for NV access state. This should happen before any other - // operation that may require a NV write. Note, that this needs to be done - // even when in failure mode. Otherwise, g_updateNV would stay SET while in - // Failure mode and the NV would be written on each call. - g_updateNV = UT_NONE; - g_clearOrderly = FALSE; - if(g_inFailureMode) - { - // Do failure mode processing - TpmFailureMode(requestSize, request, responseSize, response); - return; - } - // Query platform to get the NV state. The result state is saved internally - // and will be reported by NvIsAvailable(). The reference code requires that - // accessibility of NV does not change during the execution of a command. - // Specifically, if NV is available when the command execution starts and then - // is not available later when it is necessary to write to NV, then the TPM - // will go into failure mode. - NvCheckState(); - - // Due to the limitations of the simulation, TPM clock must be explicitly - // synchronized with the system clock whenever a command is received. - // This function call is not necessary in a hardware TPM. However, taking - // a snapshot of the hardware timer at the beginning of the command allows - // the time value to be consistent for the duration of the command execution. - TimeUpdateToCurrent(); - - // Any command through this function will unceremoniously end the - // _TPM_Hash_Data/_TPM_Hash_End sequence. - if(g_DRTMHandle != TPM_RH_UNASSIGNED) - ObjectTerminateEvent(); - - // Get command buffer size and command buffer. - command.parameterBuffer = request; - command.parameterSize = requestSize; - - // Parse command header: tag, commandSize and command.code. - // First parse the tag. The unmarshaling routine will validate - // that it is either TPM_ST_SESSIONS or TPM_ST_NO_SESSIONS. - result = TPMI_ST_COMMAND_TAG_Unmarshal(&command.tag, - &command.parameterBuffer, - &command.parameterSize); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - // Unmarshal the commandSize indicator. - result = UINT32_Unmarshal(&commandSize, - &command.parameterBuffer, - &command.parameterSize); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - // On a TPM that receives bytes on a port, the number of bytes that were - // received on that port is requestSize it must be identical to commandSize. - // In addition, commandSize must not be larger than MAX_COMMAND_SIZE allowed - // by the implementation. The check against MAX_COMMAND_SIZE may be redundant - // as the input processing (the function that receives the command bytes and - // places them in the input buffer) would likely have the input truncated when - // it reaches MAX_COMMAND_SIZE, and requestSize would not equal commandSize. - if(commandSize != requestSize || commandSize > MAX_COMMAND_SIZE) - { - result = TPM_RC_COMMAND_SIZE; - goto Cleanup; - } - // Unmarshal the command code. - result = TPM_CC_Unmarshal(&command.code, &command.parameterBuffer, - &command.parameterSize); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - // Check to see if the command is implemented. - command.index = CommandCodeToCommandIndex(command.code); - if(UNIMPLEMENTED_COMMAND_INDEX == command.index) - { - result = TPM_RC_COMMAND_CODE; - goto Cleanup; - } -#if FIELD_UPGRADE_IMPLEMENTED == YES - // If the TPM is in FUM, then the only allowed command is - // TPM_CC_FieldUpgradeData. - if(IsFieldUgradeMode() && (command.code != TPM_CC_FieldUpgradeData)) - { - result = TPM_RC_UPGRADE; - goto Cleanup; - } - else -#endif - // Excepting FUM, the TPM only accepts TPM2_Startup() after - // _TPM_Init. After getting a TPM2_Startup(), TPM2_Startup() - // is no longer allowed. - if((!TPMIsStarted() && command.code != TPM_CC_Startup) - || (TPMIsStarted() && command.code == TPM_CC_Startup)) - { - result = TPM_RC_INITIALIZE; - goto Cleanup; - } -// Start regular command process. - NvIndexCacheInit(); - // Parse Handle buffer. - result = ParseHandleBuffer(&command); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - // All handles in the handle area are required to reference TPM-resident - // entities. - result = EntityGetLoadStatus(&command); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - // Authorization session handling for the command. - ClearCpRpHashes(&command); - if(command.tag == TPM_ST_SESSIONS) - { - // Find out session buffer size. - result = UINT32_Unmarshal((UINT32 *)&command.authSize, - &command.parameterBuffer, - &command.parameterSize); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - // Perform sanity check on the unmarshaled value. If it is smaller than - // the smallest possible session or larger than the remaining size of - // the command, then it is an error. NOTE: This check could pass but the - // session size could still be wrong. That will be determined after the - // sessions are unmarshaled. - if(command.authSize < 9 - || command.authSize > command.parameterSize) - { - result = TPM_RC_SIZE; - goto Cleanup; - } - command.parameterSize -= command.authSize; - - // The actions of ParseSessionBuffer() are described in the introduction. - // As the sessions are parsed command.parameterBuffer is advanced so, on a - // successful return, command.parameterBuffer should be pointing at the - // first byte of the parameters. - result = ParseSessionBuffer(&command); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - } - else - { - command.authSize = 0; - // The command has no authorization sessions. - // If the command requires authorizations, then CheckAuthNoSession() will - // return an error. - result = CheckAuthNoSession(&command); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - } - // Set up the response buffer pointers. CommandDispatch will marshal the - // response parameters starting at the address in command.responseBuffer. -//*response = MemoryGetResponseBuffer(command.index); - // leave space for the command header - command.responseBuffer = *response + STD_RESPONSE_HEADER; - - // leave space for the parameter size field if needed - if(command.tag == TPM_ST_SESSIONS) - command.responseBuffer += sizeof(UINT32); - if(IsHandleInResponse(command.index)) - command.responseBuffer += sizeof(TPM_HANDLE); - - // CommandDispatcher returns a response handle buffer and a response parameter - // buffer if it succeeds. It will also set the parameterSize field in the - // buffer if the tag is TPM_RC_SESSIONS. - result = CommandDispatcher(&command); - if(result != TPM_RC_SUCCESS) - goto Cleanup; - - // Build the session area at the end of the parameter area. - BuildResponseSession(&command); - -Cleanup: - if(g_clearOrderly == TRUE - && NV_IS_ORDERLY) - { -#if USE_DA_USED - gp.orderlyState = g_daUsed ? SU_DA_USED_VALUE : SU_NONE_VALUE; -#else - gp.orderlyState = SU_NONE_VALUE; -#endif - NV_SYNC_PERSISTENT(orderlyState); - } - // This implementation loads an "evict" object to a transient object slot in - // RAM whenever an "evict" object handle is used in a command so that the - // access to any object is the same. These temporary objects need to be - // cleared from RAM whether the command succeeds or fails. - ObjectCleanupEvict(); - - // The parameters and sessions have been marshaled. Now tack on the header and - // set the sizes - BuildResponseHeader(&command, *response, result); - - // Try to commit all the writes to NV if any NV write happened during this - // command execution. This check should be made for both succeeded and failed - // commands, because a failed one may trigger a NV write in DA logic as well. - // This is the only place in the command execution path that may call the NV - // commit. If the NV commit fails, the TPM should be put in failure mode. - if((g_updateNV != UT_NONE) && !g_inFailureMode) - { - if(g_updateNV == UT_ORDERLY) - NvUpdateIndexOrderlyData(); - if(!NvCommit()) - FAIL(FATAL_ERROR_INTERNAL); - g_updateNV = UT_NONE; - } - pAssert((UINT32)command.parameterSize <= maxResponse); - - // Clear unused bits in response buffer. - MemorySet(*response + *responseSize, 0, maxResponse - *responseSize); - - // as a final act, and not before, update the response size. - *responseSize = (UINT32)command.parameterSize; - - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/SessionProcess.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/SessionProcess.c deleted file mode 100644 index bd7f89f1e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/SessionProcess.c +++ /dev/null @@ -1,2242 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the subsystem that process the authorization sessions -// including implementation of the Dictionary Attack logic. ExecCommand() uses -// ParseSessionBuffer() to process the authorization session area of a command and -// BuildResponseSession() to create the authorization session area of a response. - -//** Includes and Data Definitions - -#define SESSION_PROCESS_C - -#include "Tpm.h" - -// -//** Authorization Support Functions -// - -//*** IsDAExempted() -// This function indicates if a handle is exempted from DA logic. -// A handle is exempted if it is -// 1. a primary seed handle, -// 2. an object with noDA bit SET, -// 3. an NV Index with TPMA_NV_NO_DA bit SET, or -// 4. a PCR handle. -// -// Return Type: BOOL -// TRUE(1) handle is exempted from DA logic -// FALSE(0) handle is not exempted from DA logic -BOOL -IsDAExempted( - TPM_HANDLE handle // IN: entity handle - ) -{ - BOOL result = FALSE; -// - switch(HandleGetType(handle)) - { - case TPM_HT_PERMANENT: - // All permanent handles, other than TPM_RH_LOCKOUT, are exempt from - // DA protection. - result = (handle != TPM_RH_LOCKOUT); - break; - // When this function is called, a persistent object will have been loaded - // into an object slot and assigned a transient handle. - case TPM_HT_TRANSIENT: - { - TPMA_OBJECT attributes = ObjectGetPublicAttributes(handle); - result = IS_ATTRIBUTE(attributes, TPMA_OBJECT, noDA); - break; - } - case TPM_HT_NV_INDEX: - { - NV_INDEX *nvIndex = NvGetIndexInfo(handle, NULL); - result = IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, NO_DA); - break; - } - case TPM_HT_PCR: - // PCRs are always exempted from DA. - result = TRUE; - break; - default: - break; - } - return result; -} - -//*** IncrementLockout() -// This function is called after an authorization failure that involves use of -// an authValue. If the entity referenced by the handle is not exempt from DA -// protection, then the failedTries counter will be incremented. -// -// Return Type: TPM_RC -// TPM_RC_AUTH_FAIL authorization failure that caused DA lockout to increment -// TPM_RC_BAD_AUTH authorization failure did not cause DA lockout to -// increment -static TPM_RC -IncrementLockout( - UINT32 sessionIndex - ) -{ - TPM_HANDLE handle = s_associatedHandles[sessionIndex]; - TPM_HANDLE sessionHandle = s_sessionHandles[sessionIndex]; - SESSION *session = NULL; -// - // Don't increment lockout unless the handle associated with the session - // is DA protected or the session is bound to a DA protected entity. - if(sessionHandle == TPM_RS_PW) - { - if(IsDAExempted(handle)) - return TPM_RC_BAD_AUTH; - } - else - { - session = SessionGet(sessionHandle); - // If the session is bound to lockout, then use that as the relevant - // handle. This means that an authorization failure with a bound session - // bound to lockoutAuth will take precedence over any other - // lockout check - if(session->attributes.isLockoutBound == SET) - handle = TPM_RH_LOCKOUT; - if(session->attributes.isDaBound == CLEAR - && (IsDAExempted(handle) || session->attributes.includeAuth == CLEAR)) - // If the handle was changed to TPM_RH_LOCKOUT, this will not return - // TPM_RC_BAD_AUTH - return TPM_RC_BAD_AUTH; - } - if(handle == TPM_RH_LOCKOUT) - { - pAssert(gp.lockOutAuthEnabled == TRUE); - - // lockout is no longer enabled - gp.lockOutAuthEnabled = FALSE; - - // For TPM_RH_LOCKOUT, if lockoutRecovery is 0, no need to update NV since - // the lockout authorization will be reset at startup. - if(gp.lockoutRecovery != 0) - { - if(NV_IS_AVAILABLE) - // Update NV. - NV_SYNC_PERSISTENT(lockOutAuthEnabled); - else - // No NV access for now. Put the TPM in pending mode. - s_DAPendingOnNV = TRUE; - } - } - else - { - if(gp.recoveryTime != 0) - { - gp.failedTries++; - if(NV_IS_AVAILABLE) - // Record changes to NV. NvWrite will SET g_updateNV - NV_SYNC_PERSISTENT(failedTries); - else - // No NV access for now. Put the TPM in pending mode. - s_DAPendingOnNV = TRUE; - } - } - // Register a DA failure and reset the timers. - DARegisterFailure(handle); - - return TPM_RC_AUTH_FAIL; -} - -//*** IsSessionBindEntity() -// This function indicates if the entity associated with the handle is the entity, -// to which this session is bound. The binding would occur by making the "bind" -// parameter in TPM2_StartAuthSession() not equal to TPM_RH_NULL. The binding only -// occurs if the session is an HMAC session. The bind value is a combination of -// the Name and the authValue of the entity. -// -// Return Type: BOOL -// TRUE(1) handle points to the session start entity -// FALSE(0) handle does not point to the session start entity -static BOOL -IsSessionBindEntity( - TPM_HANDLE associatedHandle, // IN: handle to be authorized - SESSION *session // IN: associated session - ) -{ - TPM2B_NAME entity; // The bind value for the entity -// - // If the session is not bound, return FALSE. - if(session->attributes.isBound) - { - // Compute the bind value for the entity. - SessionComputeBoundEntity(associatedHandle, &entity); - - // Compare to the bind value in the session. - return MemoryEqual2B(&entity.b, &session->u1.boundEntity.b); - } - return FALSE; -} - -//*** IsPolicySessionRequired() -// Checks if a policy session is required for a command. If a command requires -// DUP or ADMIN role authorization, then the handle that requires that role is the -// first handle in the command. This simplifies this checking. If a new command -// is created that requires multiple ADMIN role authorizations, then it will -// have to be special-cased in this function. -// A policy session is required if: -// 1. the command requires the DUP role, -// 2. the command requires the ADMIN role and the authorized entity -// is an object and its adminWithPolicy bit is SET, or -// 3. the command requires the ADMIN role and the authorized entity -// is a permanent handle or an NV Index. -// 4. The authorized entity is a PCR belonging to a policy group, and -// has its policy initialized -// Return Type: BOOL -// TRUE(1) policy session is required -// FALSE(0) policy session is not required -static BOOL -IsPolicySessionRequired( - COMMAND_INDEX commandIndex, // IN: command index - UINT32 sessionIndex // IN: session index - ) -{ - AUTH_ROLE role = CommandAuthRole(commandIndex, sessionIndex); - TPM_HT type = HandleGetType(s_associatedHandles[sessionIndex]); -// - if(role == AUTH_DUP) - return TRUE; - if(role == AUTH_ADMIN) - { - // We allow an exception for ADMIN role in a transient object. If the object - // allows ADMIN role actions with authorization, then policy is not - // required. For all other cases, there is no way to override the command - // requirement that a policy be used - if(type == TPM_HT_TRANSIENT) - { - OBJECT *object = HandleToObject(s_associatedHandles[sessionIndex]); - - if(!IS_ATTRIBUTE(object->publicArea.objectAttributes, TPMA_OBJECT, - adminWithPolicy)) - return FALSE; - } - return TRUE; - } - - if(type == TPM_HT_PCR) - { - if(PCRPolicyIsAvailable(s_associatedHandles[sessionIndex])) - { - TPM2B_DIGEST policy; - TPMI_ALG_HASH policyAlg; - policyAlg = PCRGetAuthPolicy(s_associatedHandles[sessionIndex], - &policy); - if(policyAlg != TPM_ALG_NULL) - return TRUE; - } - } - return FALSE; -} - -//*** IsAuthValueAvailable() -// This function indicates if authValue is available and allowed for USER role -// authorization of an entity. -// -// This function is similar to IsAuthPolicyAvailable() except that it does not -// check the size of the authValue as IsAuthPolicyAvailable() does (a null -// authValue is a valid authorization, but a null policy is not a valid policy). -// -// This function does not check that the handle reference is valid or if the entity -// is in an enabled hierarchy. Those checks are assumed to have been performed -// during the handle unmarshaling. -// -// Return Type: BOOL -// TRUE(1) authValue is available -// FALSE(0) authValue is not available -static BOOL -IsAuthValueAvailable( - TPM_HANDLE handle, // IN: handle of entity - COMMAND_INDEX commandIndex, // IN: command index - UINT32 sessionIndex // IN: session index - ) -{ - BOOL result = FALSE; -// - switch(HandleGetType(handle)) - { - case TPM_HT_PERMANENT: - switch(handle) - { - // At this point hierarchy availability has already been - // checked so primary seed handles are always available here - case TPM_RH_OWNER: - case TPM_RH_ENDORSEMENT: - case TPM_RH_PLATFORM: -#ifdef VENDOR_PERMANENT - // This vendor defined handle associated with the - // manufacturer's shared secret - case VENDOR_PERMANENT: -#endif - // The DA checking has been performed on LockoutAuth but we - // bypass the DA logic if we are using lockout policy. The - // policy would allow execution to continue an lockoutAuth - // could be used, even if direct use of lockoutAuth is disabled - case TPM_RH_LOCKOUT: - // NullAuth is always available. - case TPM_RH_NULL: - result = TRUE; - break; - default: - // Otherwise authValue is not available. - break; - } - break; - case TPM_HT_TRANSIENT: - // A persistent object has already been loaded and the internal - // handle changed. - { - OBJECT *object; - TPMA_OBJECT attributes; -// - object = HandleToObject(handle); - attributes = object->publicArea.objectAttributes; - - // authValue is always available for a sequence object. - // An alternative for this is to - // SET_ATTRIBUTE(object->publicArea, TPMA_OBJECT, userWithAuth) when the - // sequence is started. - if(ObjectIsSequence(object)) - { - result = TRUE; - break; - } - // authValue is available for an object if it has its sensitive - // portion loaded and - // 1. userWithAuth bit is SET, or - // 2. ADMIN role is required - if(object->attributes.publicOnly == CLEAR - && (IS_ATTRIBUTE(attributes, TPMA_OBJECT, userWithAuth) - || (CommandAuthRole(commandIndex, sessionIndex) == AUTH_ADMIN - && !IS_ATTRIBUTE(attributes, TPMA_OBJECT, adminWithPolicy)))) - result = TRUE; - } - break; - case TPM_HT_NV_INDEX: - // NV Index. - { - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(handle, &locator); - TPMA_NV nvAttributes; -// - pAssert(nvIndex != 0); - - nvAttributes = nvIndex->publicArea.attributes; - - if(IsWriteOperation(commandIndex)) - { - // AuthWrite can't be set for a PIN index - if(IS_ATTRIBUTE(nvAttributes, TPMA_NV, AUTHWRITE)) - result = TRUE; - } - else - { - // A "read" operation - // For a PIN Index, the authValue is available as long as the - // Index has been written and the pinCount is less than pinLimit - if(IsNvPinFailIndex(nvAttributes) - || IsNvPinPassIndex(nvAttributes)) - { - NV_PIN pin; - if(!IS_ATTRIBUTE(nvAttributes, TPMA_NV, WRITTEN)) - break; // return false - // get the index values - pin.intVal = NvGetUINT64Data(nvIndex, locator); - if(pin.pin.pinCount < pin.pin.pinLimit) - result = TRUE; - } - // For non-PIN Indexes, need to allow use of the authValue - else if(IS_ATTRIBUTE(nvAttributes, TPMA_NV, AUTHREAD)) - result = TRUE; - } - } - break; - case TPM_HT_PCR: - // PCR handle. - // authValue is always allowed for PCR - result = TRUE; - break; - default: - // Otherwise, authValue is not available - break; - } - return result; -} - -//*** IsAuthPolicyAvailable() -// This function indicates if an authPolicy is available and allowed. -// -// This function does not check that the handle reference is valid or if the entity -// is in an enabled hierarchy. Those checks are assumed to have been performed -// during the handle unmarshaling. -// -// Return Type: BOOL -// TRUE(1) authPolicy is available -// FALSE(0) authPolicy is not available -static BOOL -IsAuthPolicyAvailable( - TPM_HANDLE handle, // IN: handle of entity - COMMAND_INDEX commandIndex, // IN: command index - UINT32 sessionIndex // IN: session index - ) -{ - BOOL result = FALSE; -// - switch(HandleGetType(handle)) - { - case TPM_HT_PERMANENT: - switch(handle) - { - // At this point hierarchy availability has already been checked. - case TPM_RH_OWNER: - if(gp.ownerPolicy.t.size != 0) - result = TRUE; - break; - case TPM_RH_ENDORSEMENT: - if(gp.endorsementPolicy.t.size != 0) - result = TRUE; - break; - case TPM_RH_PLATFORM: - if(gc.platformPolicy.t.size != 0) - result = TRUE; - break; - case TPM_RH_LOCKOUT: - if(gp.lockoutPolicy.t.size != 0) - result = TRUE; - break; - default: - break; - } - break; - case TPM_HT_TRANSIENT: - { - // Object handle. - // An evict object would already have been loaded and given a - // transient object handle by this point. - OBJECT *object = HandleToObject(handle); - // Policy authorization is not available for an object with only - // public portion loaded. - if(object->attributes.publicOnly == CLEAR) - { - // Policy authorization is always available for an object but - // is never available for a sequence. - if(!ObjectIsSequence(object)) - result = TRUE; - } - break; - } - case TPM_HT_NV_INDEX: - // An NV Index. - { - NV_INDEX *nvIndex = NvGetIndexInfo(handle, NULL); - TPMA_NV nvAttributes = nvIndex->publicArea.attributes; -// - // If the policy size is not zero, check if policy can be used. - if(nvIndex->publicArea.authPolicy.t.size != 0) - { - // If policy session is required for this handle, always - // uses policy regardless of the attributes bit setting - if(IsPolicySessionRequired(commandIndex, sessionIndex)) - result = TRUE; - // Otherwise, the presence of the policy depends on the NV - // attributes. - else if(IsWriteOperation(commandIndex)) - { - if(IS_ATTRIBUTE(nvAttributes, TPMA_NV, POLICYWRITE)) - result = TRUE; - } - else - { - if(IS_ATTRIBUTE(nvAttributes, TPMA_NV, POLICYREAD)) - result = TRUE; - } - } - } - break; - case TPM_HT_PCR: - // PCR handle. - if(PCRPolicyIsAvailable(handle)) - result = TRUE; - break; - default: - break; - } - return result; -} - -//** Session Parsing Functions - -//*** ClearCpRpHashes() -void -ClearCpRpHashes( - COMMAND *command - ) -{ -#if ALG_SHA1 - command->sha1CpHash.t.size = 0; - command->sha1RpHash.t.size = 0; -#endif -#if ALG_SHA256 - command->sha256CpHash.t.size = 0; - command->sha256RpHash.t.size = 0; -#endif -#if ALG_SHA384 - command->sha384CpHash.t.size = 0; - command->sha384RpHash.t.size = 0; -#endif -#if ALG_SHA512 - command->sha512CpHash.t.size = 0; - command->sha512RpHash.t.size = 0; -#endif -#if ALG_SM3_256 - command->sm3_256CpHash.t.size = 0; - command->sm3_256RpHash.t.size = 0; -#endif -} - - -//*** GetCpHashPointer() -// Function to get a pointer to the cpHash of the command -static TPM2B_DIGEST * -GetCpHashPointer( - COMMAND *command, - TPMI_ALG_HASH hashAlg - ) -{ - TPM2B_DIGEST *retVal; -// - switch(hashAlg) - { -#if ALG_SHA1 - case ALG_SHA1_VALUE: - retVal = (TPM2B_DIGEST *)&command->sha1CpHash; - break; -#endif -#if ALG_SHA256 - case ALG_SHA256_VALUE: - retVal = (TPM2B_DIGEST *)&command->sha256CpHash; - break; -#endif -#if ALG_SHA384 - case ALG_SHA384_VALUE: - retVal = (TPM2B_DIGEST *)&command->sha384CpHash; - break; -#endif -#if ALG_SHA512 - case ALG_SHA512_VALUE: - retVal = (TPM2B_DIGEST *)&command->sha512CpHash; - break; -#endif -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: - retVal = (TPM2B_DIGEST *)&command->sm3_256CpHash; - break; -#endif - default: - retVal = NULL; - break; - } - return retVal; -} - -//*** GetRpHashPointer() -// Function to get a pointer to the RpHash of the command -static TPM2B_DIGEST * -GetRpHashPointer( - COMMAND *command, - TPMI_ALG_HASH hashAlg - ) -{ - TPM2B_DIGEST *retVal; -// - switch(hashAlg) - { -#if ALG_SHA1 - case ALG_SHA1_VALUE: - retVal = (TPM2B_DIGEST *)&command->sha1RpHash; - break; -#endif -#if ALG_SHA256 - case ALG_SHA256_VALUE: - retVal = (TPM2B_DIGEST *)&command->sha256RpHash; - break; -#endif -#if ALG_SHA384 - case ALG_SHA384_VALUE: - retVal = (TPM2B_DIGEST *)&command->sha384RpHash; - break; -#endif -#if ALG_SHA512 - case ALG_SHA512_VALUE: - retVal = (TPM2B_DIGEST *)&command->sha512RpHash; - break; -#endif -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: - retVal = (TPM2B_DIGEST *)&command->sm3_256RpHash; - break; -#endif - default: - retVal = NULL; - break; - } - return retVal; -} - - -//*** ComputeCpHash() -// This function computes the cpHash as defined in Part 2 and described in Part 1. -static TPM2B_DIGEST * -ComputeCpHash( - COMMAND *command, // IN: command parsing structure - TPMI_ALG_HASH hashAlg // IN: hash algorithm - ) -{ - UINT32 i; - HASH_STATE hashState; - TPM2B_NAME name; - TPM2B_DIGEST *cpHash; -// - // cpHash = hash(commandCode [ || authName1 - // [ || authName2 - // [ || authName 3 ]]] - // [ || parameters]) - // A cpHash can contain just a commandCode only if the lone session is - // an audit session. - // Get pointer to the hash value - cpHash = GetCpHashPointer(command, hashAlg); - if(cpHash->t.size == 0) - { - cpHash->t.size = CryptHashStart(&hashState, hashAlg); - // Add commandCode. - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), command->code); - // Add authNames for each of the handles. - for(i = 0; i < command->handleNum; i++) - CryptDigestUpdate2B(&hashState, &EntityGetName(command->handles[i], - &name)->b); - // Add the parameters. - CryptDigestUpdate(&hashState, command->parameterSize, - command->parameterBuffer); - // Complete the hash. - CryptHashEnd2B(&hashState, &cpHash->b); - } - return cpHash; -} - -//*** GetCpHash() -// This function is used to access a precomputed cpHash. -static TPM2B_DIGEST * -GetCpHash( - COMMAND *command, - TPMI_ALG_HASH hashAlg - ) -{ - TPM2B_DIGEST *cpHash = GetCpHashPointer(command, hashAlg); - // - pAssert(cpHash->t.size != 0); - return cpHash; -} - -//*** CompareTemplateHash() -// This function computes the template hash and compares it to the session -// templateHash. It is the hash of the second parameter -// assuming that the command is TPM2_Create(), TPM2_CreatePrimary(), or -// TPM2_CreateLoaded() -// Return Type: BOOL -// TRUE(1) template hash equal to session->templateHash -// FALSE(0) template hash not equal to session->templateHash -static BOOL -CompareTemplateHash( - COMMAND *command, // IN: parsing structure - SESSION *session // IN: session data - ) -{ - BYTE *pBuffer = command->parameterBuffer; - INT32 pSize = command->parameterSize; - TPM2B_DIGEST tHash; - UINT16 size; -// - // Only try this for the three commands for which it is intended - if(command->code != TPM_CC_Create - && command->code != TPM_CC_CreatePrimary -#if CC_CreateLoaded - && command->code != TPM_CC_CreateLoaded -#endif - ) - return FALSE; - // Assume that the first parameter is a TPM2B and unmarshal the size field - // Note: this will not affect the parameter buffer and size in the calling - // function. - if(UINT16_Unmarshal(&size, &pBuffer, &pSize) != TPM_RC_SUCCESS) - return FALSE; - // reduce the space in the buffer. - // NOTE: this could make pSize go negative if the parameters are not correct but - // the unmarshaling code does not try to unmarshal if the remaining size is - // negative. - pSize -= size; - - // Advance the pointer - pBuffer += size; - - // Get the size of what should be the template - if(UINT16_Unmarshal(&size, &pBuffer, &pSize) != TPM_RC_SUCCESS) - return FALSE; - // See if this is reasonable - if(size > pSize) - return FALSE; - // Hash the template data - tHash.t.size = CryptHashBlock(session->authHashAlg, size, pBuffer, - sizeof(tHash.t.buffer), tHash.t.buffer); - return(MemoryEqual2B(&session->u1.templateHash.b, &tHash.b)); -} - -//*** CompareNameHash() -// This function computes the name hash and compares it to the nameHash in the -// session data. -BOOL -CompareNameHash( - COMMAND *command, // IN: main parsing structure - SESSION *session // IN: session structure with nameHash - ) -{ - HASH_STATE hashState; - TPM2B_DIGEST nameHash; - UINT32 i; - TPM2B_NAME name; -// - nameHash.t.size = CryptHashStart(&hashState, session->authHashAlg); - // Add names. - for(i = 0; i < command->handleNum; i++) - CryptDigestUpdate2B(&hashState, &EntityGetName(command->handles[i], - &name)->b); - // Complete hash. - CryptHashEnd2B(&hashState, &nameHash.b); - // and compare - return MemoryEqual(session->u1.nameHash.t.buffer, nameHash.t.buffer, - nameHash.t.size); -} - -//*** CheckPWAuthSession() -// This function validates the authorization provided in a PWAP session. It -// compares the input value to authValue of the authorized entity. Argument -// sessionIndex is used to get handles handle of the referenced entities from -// s_inputAuthValues[] and s_associatedHandles[]. -// -// Return Type: TPM_RC -// TPM_RC_AUTH_FAIL authorization fails and increments DA failure -// count -// TPM_RC_BAD_AUTH authorization fails but DA does not apply -// -static TPM_RC -CheckPWAuthSession( - UINT32 sessionIndex // IN: index of session to be processed - ) -{ - TPM2B_AUTH authValue; - TPM_HANDLE associatedHandle = s_associatedHandles[sessionIndex]; -// - // Strip trailing zeros from the password. - MemoryRemoveTrailingZeros(&s_inputAuthValues[sessionIndex]); - - // Get the authValue with trailing zeros removed - EntityGetAuthValue(associatedHandle, &authValue); - - // Success if the values are identical. - if(MemoryEqual2B(&s_inputAuthValues[sessionIndex].b, &authValue.b)) - { - return TPM_RC_SUCCESS; - } - else // if the digests are not identical - { - // Invoke DA protection if applicable. - return IncrementLockout(sessionIndex); - } -} - -//*** ComputeCommandHMAC() -// This function computes the HMAC for an authorization session in a command. -/*(See part 1 specification -- this tag keeps this comment from showing up in -// merged document which is probably good because this comment doesn't look right. -// The sessionAuth value -// authHMAC := HMACsHash((sessionKey | authValue), -// (pHash | nonceNewer | nonceOlder | nonceTPMencrypt-only -// | nonceTPMaudit | sessionAttributes)) -// Where: -// HMACsHash() The HMAC algorithm using the hash algorithm specified -// when the session was started. -// -// sessionKey A value that is computed in a protocol-dependent way, -// using KDFa. When used in an HMAC or KDF, the size field -// for this value is not included. -// -// authValue A value that is found in the sensitive area of an entity. -// When used in an HMAC or KDF, the size field for this -// value is not included. -// -// pHash Hash of the command (cpHash) using the session hash. -// When using a pHash in an HMAC computation, only the -// digest is used. -// -// nonceNewer A value that is generated by the entity using the -// session. A new nonce is generated on each use of the -// session. For a command, this will be nonceCaller. -// When used in an HMAC or KDF, the size field is not used. -// -// nonceOlder A TPM2B_NONCE that was received the previous time the -// session was used. For a command, this is nonceTPM. -// When used in an HMAC or KDF, the size field is not used. -// -// nonceTPMdecrypt The nonceTPM of the decrypt session is included in -// the HMAC, but only in the command. -// -// nonceTPMencrypt The nonceTPM of the encrypt session is included in -// the HMAC but only in the command. -// -// sessionAttributes A byte indicating the attributes associated with the -// particular use of the session. -*/ -static TPM2B_DIGEST * -ComputeCommandHMAC( - COMMAND *command, // IN: primary control structure - UINT32 sessionIndex, // IN: index of session to be processed - TPM2B_DIGEST *hmac // OUT: authorization HMAC - ) -{ - TPM2B_TYPE(KEY, (sizeof(AUTH_VALUE) * 2)); - TPM2B_KEY key; - BYTE marshalBuffer[sizeof(TPMA_SESSION)]; - BYTE *buffer; - UINT32 marshalSize; - HMAC_STATE hmacState; - TPM2B_NONCE *nonceDecrypt; - TPM2B_NONCE *nonceEncrypt; - SESSION *session; -// - nonceDecrypt = NULL; - nonceEncrypt = NULL; - - // Determine if extra nonceTPM values are going to be required. - // If this is the first session (sessionIndex = 0) and it is an authorization - // session that uses an HMAC, then check if additional session nonces are to be - // included. - if(sessionIndex == 0 - && s_associatedHandles[sessionIndex] != TPM_RH_UNASSIGNED) - { - // If there is a decrypt session and if this is not the decrypt session, - // then an extra nonce may be needed. - if(s_decryptSessionIndex != UNDEFINED_INDEX - && s_decryptSessionIndex != sessionIndex) - { - // Will add the nonce for the decrypt session. - SESSION *decryptSession - = SessionGet(s_sessionHandles[s_decryptSessionIndex]); - nonceDecrypt = &decryptSession->nonceTPM; - } - // Now repeat for the encrypt session. - if(s_encryptSessionIndex != UNDEFINED_INDEX - && s_encryptSessionIndex != sessionIndex - && s_encryptSessionIndex != s_decryptSessionIndex) - { - // Have to have the nonce for the encrypt session. - SESSION *encryptSession - = SessionGet(s_sessionHandles[s_encryptSessionIndex]); - nonceEncrypt = &encryptSession->nonceTPM; - } - } - - // Continue with the HMAC processing. - session = SessionGet(s_sessionHandles[sessionIndex]); - - // Generate HMAC key. - MemoryCopy2B(&key.b, &session->sessionKey.b, sizeof(key.t.buffer)); - - // Check if the session has an associated handle and if the associated entity - // is the one to which the session is bound. If not, add the authValue of - // this entity to the HMAC key. - // If the session is bound to the object or the session is a policy session - // with no authValue required, do not include the authValue in the HMAC key. - // Note: For a policy session, its isBound attribute is CLEARED. - // - // Include the entity authValue if it is needed - if(session->attributes.includeAuth == SET) - { - TPM2B_AUTH authValue; - // Get the entity authValue with trailing zeros removed - EntityGetAuthValue(s_associatedHandles[sessionIndex], &authValue); - // add the authValue to the HMAC key - MemoryConcat2B(&key.b, &authValue.b, sizeof(key.t.buffer)); - } - // if the HMAC key size is 0, a NULL string HMAC is allowed - if(key.t.size == 0 - && s_inputAuthValues[sessionIndex].t.size == 0) - { - hmac->t.size = 0; - return hmac; - } - // Start HMAC - hmac->t.size = CryptHmacStart2B(&hmacState, session->authHashAlg, &key.b); - - // Add cpHash - CryptDigestUpdate2B(&hmacState.hashState, - &ComputeCpHash(command, session->authHashAlg)->b); - // Add nonces as required - CryptDigestUpdate2B(&hmacState.hashState, &s_nonceCaller[sessionIndex].b); - CryptDigestUpdate2B(&hmacState.hashState, &session->nonceTPM.b); - if(nonceDecrypt != NULL) - CryptDigestUpdate2B(&hmacState.hashState, &nonceDecrypt->b); - if(nonceEncrypt != NULL) - CryptDigestUpdate2B(&hmacState.hashState, &nonceEncrypt->b); - // Add sessionAttributes - buffer = marshalBuffer; - marshalSize = TPMA_SESSION_Marshal(&(s_attributes[sessionIndex]), - &buffer, NULL); - CryptDigestUpdate(&hmacState.hashState, marshalSize, marshalBuffer); - // Complete the HMAC computation - CryptHmacEnd2B(&hmacState, &hmac->b); - - return hmac; -} - -//*** CheckSessionHMAC() -// This function checks the HMAC of in a session. It uses ComputeCommandHMAC() -// to compute the expected HMAC value and then compares the result with the -// HMAC in the authorization session. The authorization is successful if they -// are the same. -// -// If the authorizations are not the same, IncrementLockout() is called. It will -// return TPM_RC_AUTH_FAIL if the failure caused the failureCount to increment. -// Otherwise, it will return TPM_RC_BAD_AUTH. -// -// Return Type: TPM_RC -// TPM_RC_AUTH_FAIL authorization failure caused failureCount increment -// TPM_RC_BAD_AUTH authorization failure did not cause failureCount -// increment -// -static TPM_RC -CheckSessionHMAC( - COMMAND *command, // IN: primary control structure - UINT32 sessionIndex // IN: index of session to be processed - ) -{ - TPM2B_DIGEST hmac; // authHMAC for comparing -// - // Compute authHMAC - ComputeCommandHMAC(command, sessionIndex, &hmac); - - // Compare the input HMAC with the authHMAC computed above. - if(!MemoryEqual2B(&s_inputAuthValues[sessionIndex].b, &hmac.b)) - { - // If an HMAC session has a failure, invoke the anti-hammering - // if it applies to the authorized entity or the session. - // Otherwise, just indicate that the authorization is bad. - return IncrementLockout(sessionIndex); - } - return TPM_RC_SUCCESS; -} - -//*** CheckPolicyAuthSession() -// This function is used to validate the authorization in a policy session. -// This function performs the following comparisons to see if a policy -// authorization is properly provided. The check are: -// 1. compare policyDigest in session with authPolicy associated with -// the entity to be authorized; -// 2. compare timeout if applicable; -// 3. compare commandCode if applicable; -// 4. compare cpHash if applicable; and -// 5. see if PCR values have changed since computed. -// -// If all the above checks succeed, the handle is authorized. -// The order of these comparisons is not important because any failure will -// result in the same error code. -// -// Return Type: TPM_RC -// TPM_RC_PCR_CHANGED PCR value is not current -// TPM_RC_POLICY_FAIL policy session fails -// TPM_RC_LOCALITY command locality is not allowed -// TPM_RC_POLICY_CC CC doesn't match -// TPM_RC_EXPIRED policy session has expired -// TPM_RC_PP PP is required but not asserted -// TPM_RC_NV_UNAVAILABLE NV is not available for write -// TPM_RC_NV_RATE NV is rate limiting -static TPM_RC -CheckPolicyAuthSession( - COMMAND *command, // IN: primary parsing structure - UINT32 sessionIndex // IN: index of session to be processed - ) -{ - SESSION *session; - TPM2B_DIGEST authPolicy; - TPMI_ALG_HASH policyAlg; - UINT8 locality; -// - // Initialize pointer to the authorization session. - session = SessionGet(s_sessionHandles[sessionIndex]); - - // If the command is TPM2_PolicySecret(), make sure that - // either password or authValue is required - if(command->code == TPM_CC_PolicySecret - && session->attributes.isPasswordNeeded == CLEAR - && session->attributes.isAuthValueNeeded == CLEAR) - return TPM_RC_MODE; - // See if the PCR counter for the session is still valid. - if(!SessionPCRValueIsCurrent(session)) - return TPM_RC_PCR_CHANGED; - // Get authPolicy. - policyAlg = EntityGetAuthPolicy(s_associatedHandles[sessionIndex], - &authPolicy); - // Compare authPolicy. - if(!MemoryEqual2B(&session->u2.policyDigest.b, &authPolicy.b)) - return TPM_RC_POLICY_FAIL; - // Policy is OK so check if the other factors are correct - - // Compare policy hash algorithm. - if(policyAlg != session->authHashAlg) - return TPM_RC_POLICY_FAIL; - - // Compare timeout. - if(session->timeout != 0) - { - // Cannot compare time if clock stop advancing. An TPM_RC_NV_UNAVAILABLE - // or TPM_RC_NV_RATE error may be returned here. This doesn't mean that - // a new nonce will be created just that, because TPM time can't advance - // we can't do time-based operations. - RETURN_IF_NV_IS_NOT_AVAILABLE; - - if((session->timeout < g_time) - || (session->epoch != g_timeEpoch)) - return TPM_RC_EXPIRED; - } - // If command code is provided it must match - if(session->commandCode != 0) - { - if(session->commandCode != command->code) - return TPM_RC_POLICY_CC; - } - else - { - // If command requires a DUP or ADMIN authorization, the session must have - // command code set. - AUTH_ROLE role = CommandAuthRole(command->index, sessionIndex); - if(role == AUTH_ADMIN || role == AUTH_DUP) - return TPM_RC_POLICY_FAIL; - } - // Check command locality. - { - BYTE sessionLocality[sizeof(TPMA_LOCALITY)]; - BYTE *buffer = sessionLocality; - - // Get existing locality setting in canonical form - sessionLocality[0] = 0; - TPMA_LOCALITY_Marshal(&session->commandLocality, &buffer, NULL); - - // See if the locality has been set - if(sessionLocality[0] != 0) - { - // If so, get the current locality - locality = _plat__LocalityGet(); - if(locality < 5) - { - if(((sessionLocality[0] & (1 << locality)) == 0) - || sessionLocality[0] > 31) - return TPM_RC_LOCALITY; - } - else if(locality > 31) - { - if(sessionLocality[0] != locality) - return TPM_RC_LOCALITY; - } - else - { - // Could throw an assert here but a locality error is just - // as good. It just means that, whatever the locality is, it isn't - // the locality requested so... - return TPM_RC_LOCALITY; - } - } - } // end of locality check - // Check physical presence. - if(session->attributes.isPPRequired == SET - && !_plat__PhysicalPresenceAsserted()) - return TPM_RC_PP; - // Compare cpHash/nameHash if defined, or if the command requires an ADMIN or - // DUP role for this handle. - if(session->u1.cpHash.b.size != 0) - { - BOOL OK; - if(session->attributes.isCpHashDefined) - // Compare cpHash. - OK = MemoryEqual2B(&session->u1.cpHash.b, - &ComputeCpHash(command, session->authHashAlg)->b); - else if(session->attributes.isTemplateSet) - OK = CompareTemplateHash(command, session); - else - OK = CompareNameHash(command, session); - if(!OK) - return TPM_RCS_POLICY_FAIL; - } - if(session->attributes.checkNvWritten) - { - NV_REF locator; - NV_INDEX *nvIndex; -// - // If this is not an NV index, the policy makes no sense so fail it. - if(HandleGetType(s_associatedHandles[sessionIndex]) != TPM_HT_NV_INDEX) - return TPM_RC_POLICY_FAIL; - // Get the index data - nvIndex = NvGetIndexInfo(s_associatedHandles[sessionIndex], &locator); - - // Make sure that the TPMA_WRITTEN_ATTRIBUTE has the desired state - if((IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, WRITTEN)) - != (session->attributes.nvWrittenState == SET)) - return TPM_RC_POLICY_FAIL; - } - return TPM_RC_SUCCESS; -} - -//*** RetrieveSessionData() -// This function will unmarshal the sessions in the session area of a command. The -// values are placed in the arrays that are defined at the beginning of this file. -// The normal unmarshaling errors are possible. -// -// Return Type: TPM_RC -// TPM_RC_SUCCSS unmarshaled without error -// TPM_RC_SIZE the number of bytes unmarshaled is not the same -// as the value for authorizationSize in the command -// -static TPM_RC -RetrieveSessionData( - COMMAND *command // IN: main parsing structure for command - ) -{ - int i; - TPM_RC result; - SESSION *session; - TPMA_SESSION sessionAttributes; - TPM_HT sessionType; - INT32 sessionIndex; - TPM_RC errorIndex; -// - s_decryptSessionIndex = UNDEFINED_INDEX; - s_encryptSessionIndex = UNDEFINED_INDEX; - s_auditSessionIndex = UNDEFINED_INDEX; - - for(sessionIndex = 0; command->authSize > 0; sessionIndex++) - { - errorIndex = TPM_RC_S + g_rcIndex[sessionIndex]; - - // If maximum allowed number of sessions has been parsed, return a size - // error with a session number that is larger than the number of allowed - // sessions - if(sessionIndex == MAX_SESSION_NUM) - return TPM_RCS_SIZE + errorIndex; - // make sure that the associated handle for each session starts out - // unassigned - s_associatedHandles[sessionIndex] = TPM_RH_UNASSIGNED; - - // First parameter: Session handle. - result = TPMI_SH_AUTH_SESSION_Unmarshal( - &s_sessionHandles[sessionIndex], - &command->parameterBuffer, - &command->authSize, TRUE); - if(result != TPM_RC_SUCCESS) - return result + TPM_RC_S + g_rcIndex[sessionIndex]; - // Second parameter: Nonce. - result = TPM2B_NONCE_Unmarshal(&s_nonceCaller[sessionIndex], - &command->parameterBuffer, - &command->authSize); - if(result != TPM_RC_SUCCESS) - return result + TPM_RC_S + g_rcIndex[sessionIndex]; - // Third parameter: sessionAttributes. - result = TPMA_SESSION_Unmarshal(&s_attributes[sessionIndex], - &command->parameterBuffer, - &command->authSize); - if(result != TPM_RC_SUCCESS) - return result + TPM_RC_S + g_rcIndex[sessionIndex]; - // Fourth parameter: authValue (PW or HMAC). - result = TPM2B_AUTH_Unmarshal(&s_inputAuthValues[sessionIndex], - &command->parameterBuffer, - &command->authSize); - if(result != TPM_RC_SUCCESS) - return result + errorIndex; - - sessionAttributes = s_attributes[sessionIndex]; - if(s_sessionHandles[sessionIndex] == TPM_RS_PW) - { - // A PWAP session needs additional processing. - // Can't have any attributes set other than continueSession bit - if(IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, encrypt) - || IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, decrypt) - || IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, audit) - || IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, auditExclusive) - || IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, auditReset)) - return TPM_RCS_ATTRIBUTES + errorIndex; - // The nonce size must be zero. - if(s_nonceCaller[sessionIndex].t.size != 0) - return TPM_RCS_NONCE + errorIndex; - continue; - } - // For not password sessions... - // Find out if the session is loaded. - if(!SessionIsLoaded(s_sessionHandles[sessionIndex])) - return TPM_RC_REFERENCE_S0 + sessionIndex; - sessionType = HandleGetType(s_sessionHandles[sessionIndex]); - session = SessionGet(s_sessionHandles[sessionIndex]); - - // Check if the session is an HMAC/policy session. - if((session->attributes.isPolicy == SET - && sessionType == TPM_HT_HMAC_SESSION) - || (session->attributes.isPolicy == CLEAR - && sessionType == TPM_HT_POLICY_SESSION)) - return TPM_RCS_HANDLE + errorIndex; - // Check that this handle has not previously been used. - for(i = 0; i < sessionIndex; i++) - { - if(s_sessionHandles[i] == s_sessionHandles[sessionIndex]) - return TPM_RCS_HANDLE + errorIndex; - } - // If the session is used for parameter encryption or audit as well, set - // the corresponding Indexes. - - // First process decrypt. - if(IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, decrypt)) - { - // Check if the commandCode allows command parameter encryption. - if(DecryptSize(command->index) == 0) - return TPM_RCS_ATTRIBUTES + errorIndex; - // Encrypt attribute can only appear in one session - if(s_decryptSessionIndex != UNDEFINED_INDEX) - return TPM_RCS_ATTRIBUTES + errorIndex; - // Can't decrypt if the session's symmetric algorithm is TPM_ALG_NULL - if(session->symmetric.algorithm == TPM_ALG_NULL) - return TPM_RCS_SYMMETRIC + errorIndex; - // All checks passed, so set the index for the session used to decrypt - // a command parameter. - s_decryptSessionIndex = sessionIndex; - } - // Now process encrypt. - if(IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, encrypt)) - { - // Check if the commandCode allows response parameter encryption. - if(EncryptSize(command->index) == 0) - return TPM_RCS_ATTRIBUTES + errorIndex; - // Encrypt attribute can only appear in one session. - if(s_encryptSessionIndex != UNDEFINED_INDEX) - return TPM_RCS_ATTRIBUTES + errorIndex; - // Can't encrypt if the session's symmetric algorithm is TPM_ALG_NULL - if(session->symmetric.algorithm == TPM_ALG_NULL) - return TPM_RCS_SYMMETRIC + errorIndex; - // All checks passed, so set the index for the session used to encrypt - // a response parameter. - s_encryptSessionIndex = sessionIndex; - } - // At last process audit. - if(IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, audit)) - { - // Audit attribute can only appear in one session. - if(s_auditSessionIndex != UNDEFINED_INDEX) - return TPM_RCS_ATTRIBUTES + errorIndex; - // An audit session can not be policy session. - if(HandleGetType(s_sessionHandles[sessionIndex]) - == TPM_HT_POLICY_SESSION) - return TPM_RCS_ATTRIBUTES + errorIndex; - // If this is a reset of the audit session, or the first use - // of the session as an audit session, it doesn't matter what - // the exclusive state is. The session will become exclusive. - if(!IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, auditReset) - && session->attributes.isAudit == SET) - { - // Not first use or reset. If auditExlusive is SET, then this - // session must be the current exclusive session. - if(IS_ATTRIBUTE(sessionAttributes, TPMA_SESSION, auditExclusive) - && g_exclusiveAuditSession != s_sessionHandles[sessionIndex]) - return TPM_RC_EXCLUSIVE; - } - s_auditSessionIndex = sessionIndex; - } - // Initialize associated handle as undefined. This will be changed when - // the handles are processed. - s_associatedHandles[sessionIndex] = TPM_RH_UNASSIGNED; - } - command->sessionNum = sessionIndex; - return TPM_RC_SUCCESS; -} - -//*** CheckLockedOut() -// This function checks to see if the TPM is in lockout. This function should only -// be called if the entity being checked is subject to DA protection. The TPM -// is in lockout if the NV is not available and a DA write is pending. Otherwise -// the TPM is locked out if checking for lockoutAuth ('lockoutAuthCheck' == TRUE) -// and use of lockoutAuth is disabled, or 'failedTries' >= 'maxTries' -// Return Type: TPM_RC -// TPM_RC_NV_RATE NV is rate limiting -// TPM_RC_NV_UNAVAILABLE NV is not available at this time -// TPM_RC_LOCKOUT TPM is in lockout -static TPM_RC -CheckLockedOut( - BOOL lockoutAuthCheck // IN: TRUE if checking is for lockoutAuth - ) -{ - // If NV is unavailable, and current cycle state recorded in NV is not - // SU_NONE_VALUE, refuse to check any authorization because we would - // not be able to handle a DA failure. - if(!NV_IS_AVAILABLE && NV_IS_ORDERLY) - return g_NvStatus; - // Check if DA info needs to be updated in NV. - if(s_DAPendingOnNV) - { - // If NV is accessible, - RETURN_IF_NV_IS_NOT_AVAILABLE; - - // ... write the pending DA data and proceed. - NV_SYNC_PERSISTENT(lockOutAuthEnabled); - NV_SYNC_PERSISTENT(failedTries); - s_DAPendingOnNV = FALSE; - } - // Lockout is in effect if checking for lockoutAuth and use of lockoutAuth - // is disabled... - if(lockoutAuthCheck) - { - if(gp.lockOutAuthEnabled == FALSE) - return TPM_RC_LOCKOUT; - } - else - { - // ... or if the number of failed tries has been maxed out. - if(gp.failedTries >= gp.maxTries) - return TPM_RC_LOCKOUT; -#if USE_DA_USED - // If the daUsed flag is not SET, then no DA validation until the - // daUsed state is written to NV - if(!g_daUsed) - { - RETURN_IF_NV_IS_NOT_AVAILABLE; - g_daUsed = TRUE; - gp.orderlyState = SU_DA_USED_VALUE; - NV_SYNC_PERSISTENT(orderlyState); - return TPM_RC_RETRY; - } -#endif - } - return TPM_RC_SUCCESS; -} - -//*** CheckAuthSession() -// This function checks that the authorization session properly authorizes the -// use of the associated handle. -// -// Return Type: TPM_RC -// TPM_RC_LOCKOUT entity is protected by DA and TPM is in -// lockout, or TPM is locked out on NV update -// pending on DA parameters -// -// TPM_RC_PP Physical Presence is required but not provided -// TPM_RC_AUTH_FAIL HMAC or PW authorization failed -// with DA side-effects (can be a policy session) -// -// TPM_RC_BAD_AUTH HMAC or PW authorization failed without DA -// side-effects (can be a policy session) -// -// TPM_RC_POLICY_FAIL if policy session fails -// TPM_RC_POLICY_CC command code of policy was wrong -// TPM_RC_EXPIRED the policy session has expired -// TPM_RC_PCR -// TPM_RC_AUTH_UNAVAILABLE authValue or authPolicy unavailable -static TPM_RC -CheckAuthSession( - COMMAND *command, // IN: primary parsing structure - UINT32 sessionIndex // IN: index of session to be processed - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - SESSION *session = NULL; - TPM_HANDLE sessionHandle = s_sessionHandles[sessionIndex]; - TPM_HANDLE associatedHandle = s_associatedHandles[sessionIndex]; - TPM_HT sessionHandleType = HandleGetType(sessionHandle); -// - pAssert(sessionHandle != TPM_RH_UNASSIGNED); - - // Take care of physical presence - if(associatedHandle == TPM_RH_PLATFORM) - { - // If the physical presence is required for this command, check for PP - // assertion. If it isn't asserted, no point going any further. - if(PhysicalPresenceIsRequired(command->index) - && !_plat__PhysicalPresenceAsserted()) - return TPM_RC_PP; - } - if(sessionHandle != TPM_RS_PW) - { - session = SessionGet(sessionHandle); - - // Set includeAuth to indicate if DA checking will be required and if the - // authValue will be included in any HMAC. - if(sessionHandleType == TPM_HT_POLICY_SESSION) - { - // For a policy session, will check the DA status of the entity if either - // isAuthValueNeeded or isPasswordNeeded is SET. - session->attributes.includeAuth = - session->attributes.isAuthValueNeeded - || session->attributes.isPasswordNeeded; - } - else - { - // For an HMAC session, need to check unless the session - // is bound. - session->attributes.includeAuth = - !IsSessionBindEntity(s_associatedHandles[sessionIndex], session); - } - } - // If the authorization session is going to use an authValue, then make sure - // that access to that authValue isn't locked out. - // Note: session == NULL for a PW session. - if(session == NULL || session->attributes.includeAuth) - { - // See if entity is subject to lockout. - if(!IsDAExempted(associatedHandle)) - { - // See if in lockout - result = CheckLockedOut(associatedHandle == TPM_RH_LOCKOUT); - if(result != TPM_RC_SUCCESS) - return result; - } - } - // Policy or HMAC+PW? - if(sessionHandleType != TPM_HT_POLICY_SESSION) - { - // for non-policy session make sure that a policy session is not required - if(IsPolicySessionRequired(command->index, sessionIndex)) - return TPM_RC_AUTH_TYPE; - // The authValue must be available. - // Note: The authValue is going to be "used" even if it is an EmptyAuth. - // and the session is bound. - if(!IsAuthValueAvailable(associatedHandle, command->index, sessionIndex)) - return TPM_RC_AUTH_UNAVAILABLE; - } - else - { - // ... see if the entity has a policy, ... - // Note: IsAuthPolicyAvalable will return FALSE if the sensitive area of the - // object is not loaded - if(!IsAuthPolicyAvailable(associatedHandle, command->index, sessionIndex)) - return TPM_RC_AUTH_UNAVAILABLE; - // ... and check the policy session. - result = CheckPolicyAuthSession(command, sessionIndex); - if(result != TPM_RC_SUCCESS) - return result; - } - // Check authorization according to the type - if(session == NULL || session->attributes.isPasswordNeeded == SET) - result = CheckPWAuthSession(sessionIndex); - else - result = CheckSessionHMAC(command, sessionIndex); - // Do processing for PIN Indexes are only three possibilities for 'result' at - // this point: TPM_RC_SUCCESS, TPM_RC_AUTH_FAIL, and TPM_RC_BAD_AUTH. - // For all these cases, we would have to process a PIN index if the - // authValue of the index was used for authorization. - // See if we need to do anything to a PIN index - if(TPM_HT_NV_INDEX == HandleGetType(associatedHandle)) - { - NV_REF locator; - NV_INDEX *nvIndex = NvGetIndexInfo(associatedHandle, &locator); - NV_PIN pinData; - TPMA_NV nvAttributes; -// - pAssert(nvIndex != NULL); - nvAttributes = nvIndex->publicArea.attributes; - // If this is a PIN FAIL index and the value has been written - // then we can update the counter (increment or clear) - if(IsNvPinFailIndex(nvAttributes) - && IS_ATTRIBUTE(nvAttributes, TPMA_NV, WRITTEN)) - { - pinData.intVal = NvGetUINT64Data(nvIndex, locator); - if(result != TPM_RC_SUCCESS) - pinData.pin.pinCount++; - else - pinData.pin.pinCount = 0; - NvWriteUINT64Data(nvIndex, pinData.intVal); - } - // If this is a PIN PASS Index, increment if we have used the - // authorization value for anything other than NV_Read. - // NOTE: If the counter has already hit the limit, then we - // would not get here because the authorization value would not - // be available and the TPM would have returned before it gets here - else if(IsNvPinPassIndex(nvAttributes) - && IS_ATTRIBUTE(nvAttributes, TPMA_NV, WRITTEN) - && result == TPM_RC_SUCCESS) - { - // If the access is valid, then increment the use counter - pinData.intVal = NvGetUINT64Data(nvIndex, locator); - pinData.pin.pinCount++; - NvWriteUINT64Data(nvIndex, pinData.intVal); - } - } - return result; -} - -#ifdef TPM_CC_GetCommandAuditDigest -//*** CheckCommandAudit() -// This function is called before the command is processed if audit is enabled -// for the command. It will check to see if the audit can be performed and -// will ensure that the cpHash is available for the audit. -// Return Type: TPM_RC -// TPM_RC_NV_UNAVAILABLE NV is not available for write -// TPM_RC_NV_RATE NV is rate limiting -static TPM_RC -CheckCommandAudit( - COMMAND *command - ) -{ - // If the audit digest is clear and command audit is required, NV must be - // available so that TPM2_GetCommandAuditDigest() is able to increment - // audit counter. If NV is not available, the function bails out to prevent - // the TPM from attempting an operation that would fail anyway. - if(gr.commandAuditDigest.t.size == 0 - || GetCommandCode(command->index) == TPM_CC_GetCommandAuditDigest) - { - RETURN_IF_NV_IS_NOT_AVAILABLE; - } - // Make sure that the cpHash is computed for the algorithm - ComputeCpHash(command, gp.auditHashAlg); - return TPM_RC_SUCCESS; -} -#endif - -//*** ParseSessionBuffer() -// This function is the entry function for command session processing. -// It iterates sessions in session area and reports if the required authorization -// has been properly provided. It also processes audit session and passes the -// information of encryption sessions to parameter encryption module. -// -// Return Type: TPM_RC -// various parsing failure or authorization failure -// -TPM_RC -ParseSessionBuffer( - COMMAND *command // IN: the structure that contains - ) -{ - TPM_RC result; - UINT32 i; - INT32 size = 0; - TPM2B_AUTH extraKey; - UINT32 sessionIndex; - TPM_RC errorIndex; - SESSION *session = NULL; -// - // Check if a command allows any session in its session area. - if(!IsSessionAllowed(command->index)) - return TPM_RC_AUTH_CONTEXT; - // Default-initialization. - command->sessionNum = 0; - - result = RetrieveSessionData(command); - if(result != TPM_RC_SUCCESS) - return result; - // There is no command in the TPM spec that has more handles than - // MAX_SESSION_NUM. - pAssert(command->handleNum <= MAX_SESSION_NUM); - - // Associate the session with an authorization handle. - for(i = 0; i < command->handleNum; i++) - { - if(CommandAuthRole(command->index, i) != AUTH_NONE) - { - // If the received session number is less than the number of handles - // that requires authorization, an error should be returned. - // Note: for all the TPM 2.0 commands, handles requiring - // authorization come first in a command input and there are only ever - // two values requiring authorization - if(i > (command->sessionNum - 1)) - return TPM_RC_AUTH_MISSING; - // Record the handle associated with the authorization session - s_associatedHandles[i] = command->handles[i]; - } - } - // Consistency checks are done first to avoid authorization failure when the - // command will not be executed anyway. - for(sessionIndex = 0; sessionIndex < command->sessionNum; sessionIndex++) - { - errorIndex = TPM_RC_S + g_rcIndex[sessionIndex]; - // PW session must be an authorization session - if(s_sessionHandles[sessionIndex] == TPM_RS_PW) - { - if(s_associatedHandles[sessionIndex] == TPM_RH_UNASSIGNED) - return TPM_RCS_HANDLE + errorIndex; - // a password session can't be audit, encrypt or decrypt - if(IS_ATTRIBUTE(s_attributes[sessionIndex], TPMA_SESSION, audit) - || IS_ATTRIBUTE(s_attributes[sessionIndex], TPMA_SESSION, encrypt) - || IS_ATTRIBUTE(s_attributes[sessionIndex], TPMA_SESSION, decrypt)) - return TPM_RCS_ATTRIBUTES + errorIndex; - session = NULL; - } - else - { - session = SessionGet(s_sessionHandles[sessionIndex]); - - // A trial session can not appear in session area, because it cannot - // be used for authorization, audit or encrypt/decrypt. - if(session->attributes.isTrialPolicy == SET) - return TPM_RCS_ATTRIBUTES + errorIndex; - - // See if the session is bound to a DA protected entity - // NOTE: Since a policy session is never bound, a policy is still - // usable even if the object is DA protected and the TPM is in - // lockout. - if(session->attributes.isDaBound == SET) - { - result = CheckLockedOut(session->attributes.isLockoutBound == SET); - if(result != TPM_RC_SUCCESS) - return result; - } - // If this session is for auditing, make sure the cpHash is computed. - if(IS_ATTRIBUTE(s_attributes[sessionIndex], TPMA_SESSION, audit)) - ComputeCpHash(command, session->authHashAlg); - } - - // if the session has an associated handle, check the authorization - if(s_associatedHandles[sessionIndex] != TPM_RH_UNASSIGNED) - { - result = CheckAuthSession(command, sessionIndex); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, errorIndex); - } - else - { - // a session that is not for authorization must either be encrypt, - // decrypt, or audit - if(!IS_ATTRIBUTE(s_attributes[sessionIndex], TPMA_SESSION, audit) - && !IS_ATTRIBUTE(s_attributes[sessionIndex], TPMA_SESSION, encrypt) - && !IS_ATTRIBUTE(s_attributes[sessionIndex], TPMA_SESSION, decrypt)) - return TPM_RCS_ATTRIBUTES + errorIndex; - - // no authValue included in any of the HMAC computations - pAssert(session != NULL); - session->attributes.includeAuth = CLEAR; - - // check HMAC for encrypt/decrypt/audit only sessions - result = CheckSessionHMAC(command, sessionIndex); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, errorIndex); - } - } -#ifdef TPM_CC_GetCommandAuditDigest - // Check if the command should be audited. Need to do this before any parameter - // encryption so that the cpHash for the audit is correct - if(CommandAuditIsRequired(command->index)) - { - result = CheckCommandAudit(command); - if(result != TPM_RC_SUCCESS) - return result; // No session number to reference - } -#endif - // Decrypt the first parameter if applicable. This should be the last operation - // in session processing. - // If the encrypt session is associated with a handle and the handle's - // authValue is available, then authValue is concatenated with sessionKey to - // generate encryption key, no matter if the handle is the session bound entity - // or not. - if(s_decryptSessionIndex != UNDEFINED_INDEX) - { - // If this is an authorization session, include the authValue in the - // generation of the decryption key - if(s_associatedHandles[s_decryptSessionIndex] != TPM_RH_UNASSIGNED) - { - EntityGetAuthValue(s_associatedHandles[s_decryptSessionIndex], - &extraKey); - } - else - { - extraKey.b.size = 0; - } - size = DecryptSize(command->index); - result = CryptParameterDecryption(s_sessionHandles[s_decryptSessionIndex], - &s_nonceCaller[s_decryptSessionIndex].b, - command->parameterSize, (UINT16)size, - &extraKey, - command->parameterBuffer); - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, - TPM_RC_S + g_rcIndex[s_decryptSessionIndex]); - } - - return TPM_RC_SUCCESS; -} - -//*** CheckAuthNoSession() -// Function to process a command with no session associated. -// The function makes sure all the handles in the command require no authorization. -// -// Return Type: TPM_RC -// TPM_RC_AUTH_MISSING failure - one or more handles require -// authorization -TPM_RC -CheckAuthNoSession( - COMMAND *command // IN: command parsing structure - ) -{ - UINT32 i; - TPM_RC result = TPM_RC_SUCCESS; -// - // Check if the command requires authorization - for(i = 0; i < command->handleNum; i++) - { - if(CommandAuthRole(command->index, i) != AUTH_NONE) - return TPM_RC_AUTH_MISSING; - } -#ifdef TPM_CC_GetCommandAuditDigest - // Check if the command should be audited. - if(CommandAuditIsRequired(command->index)) - { - result = CheckCommandAudit(command); - if(result != TPM_RC_SUCCESS) - return result; - } -#endif - // Initialize number of sessions to be 0 - command->sessionNum = 0; - - return TPM_RC_SUCCESS; -} - -//** Response Session Processing -//*** Introduction -// -// The following functions build the session area in a response and handle -// the audit sessions (if present). -// - -//*** ComputeRpHash() -// Function to compute rpHash (Response Parameter Hash). The rpHash is only -// computed if there is an HMAC authorization session and the return code is -// TPM_RC_SUCCESS. -static TPM2B_DIGEST * -ComputeRpHash( - COMMAND *command, // IN: command structure - TPM_ALG_ID hashAlg // IN: hash algorithm to compute rpHash - ) -{ - TPM2B_DIGEST *rpHash = GetRpHashPointer(command, hashAlg); - HASH_STATE hashState; -// - if(rpHash->t.size == 0) - { - // rpHash := hash(responseCode || commandCode || parameters) - - // Initiate hash creation. - rpHash->t.size = CryptHashStart(&hashState, hashAlg); - - // Add hash constituents. - CryptDigestUpdateInt(&hashState, sizeof(TPM_RC), TPM_RC_SUCCESS); - CryptDigestUpdateInt(&hashState, sizeof(TPM_CC), command->code); - CryptDigestUpdate(&hashState, command->parameterSize, - command->parameterBuffer); - // Complete hash computation. - CryptHashEnd2B(&hashState, &rpHash->b); - } - return rpHash; -} - -//*** InitAuditSession() -// This function initializes the audit data in an audit session. -static void -InitAuditSession( - SESSION *session // session to be initialized - ) -{ - // Mark session as an audit session. - session->attributes.isAudit = SET; - - // Audit session can not be bound. - session->attributes.isBound = CLEAR; - - // Size of the audit log is the size of session hash algorithm digest. - session->u2.auditDigest.t.size = CryptHashGetDigestSize(session->authHashAlg); - - // Set the original digest value to be 0. - MemorySet(&session->u2.auditDigest.t.buffer, - 0, - session->u2.auditDigest.t.size); - return; -} - -//*** UpdateAuditDigest -// Function to update an audit digest -static void -UpdateAuditDigest( - COMMAND *command, - TPMI_ALG_HASH hashAlg, - TPM2B_DIGEST *digest - ) -{ - HASH_STATE hashState; - TPM2B_DIGEST *cpHash = GetCpHash(command, hashAlg); - TPM2B_DIGEST *rpHash = ComputeRpHash(command, hashAlg); -// - pAssert(cpHash != NULL); - - // digestNew := hash (digestOld || cpHash || rpHash) - // Start hash computation. - digest->t.size = CryptHashStart(&hashState, hashAlg); - // Add old digest. - CryptDigestUpdate2B(&hashState, &digest->b); - // Add cpHash - CryptDigestUpdate2B(&hashState, &cpHash->b); - // Add rpHash - CryptDigestUpdate2B(&hashState, &rpHash->b); - // Finalize the hash. - CryptHashEnd2B(&hashState, &digest->b); -} - - -//*** Audit() -//This function updates the audit digest in an audit session. -static void -Audit( - COMMAND *command, // IN: primary control structure - SESSION *auditSession // IN: loaded audit session - ) -{ - UpdateAuditDigest(command, auditSession->authHashAlg, - &auditSession->u2.auditDigest); - return; -} - -#ifdef TPM_CC_GetCommandAuditDigest -//*** CommandAudit() -// This function updates the command audit digest. -static void -CommandAudit( - COMMAND *command // IN: - ) -{ - // If the digest.size is one, it indicates the special case of changing - // the audit hash algorithm. For this case, no audit is done on exit. - // NOTE: When the hash algorithm is changed, g_updateNV is set in order to - // force an update to the NV on exit so that the change in digest will - // be recorded. So, it is safe to exit here without setting any flags - // because the digest change will be written to NV when this code exits. - if(gr.commandAuditDigest.t.size == 1) - { - gr.commandAuditDigest.t.size = 0; - return; - } - // If the digest size is zero, need to start a new digest and increment - // the audit counter. - if(gr.commandAuditDigest.t.size == 0) - { - gr.commandAuditDigest.t.size = CryptHashGetDigestSize(gp.auditHashAlg); - MemorySet(gr.commandAuditDigest.t.buffer, - 0, - gr.commandAuditDigest.t.size); - - // Bump the counter and save its value to NV. - gp.auditCounter++; - NV_SYNC_PERSISTENT(auditCounter); - } - UpdateAuditDigest(command, gp.auditHashAlg, &gr.commandAuditDigest); - return; -} -#endif - -//*** UpdateAuditSessionStatus() -// Function to update the internal audit related states of a session. It -// 1. initializes the session as audit session and sets it to be exclusive if this -// is the first time it is used for audit or audit reset was requested; -// 2. reports exclusive audit session; -// 3. extends audit log; and -// 4. clears exclusive audit session if no audit session found in the command. -static void -UpdateAuditSessionStatus( - COMMAND *command // IN: primary control structure - ) -{ - UINT32 i; - TPM_HANDLE auditSession = TPM_RH_UNASSIGNED; -// - // Iterate through sessions - for(i = 0; i < command->sessionNum; i++) - { - SESSION *session; -// - // PW session do not have a loaded session and can not be an audit - // session either. Skip it. - if(s_sessionHandles[i] == TPM_RS_PW) - continue; - session = SessionGet(s_sessionHandles[i]); - - // If a session is used for audit - if(IS_ATTRIBUTE(s_attributes[i], TPMA_SESSION, audit)) - { - // An audit session has been found - auditSession = s_sessionHandles[i]; - - // If the session has not been an audit session yet, or - // the auditSetting bits indicate a reset, initialize it and set - // it to be the exclusive session - if(session->attributes.isAudit == CLEAR - || IS_ATTRIBUTE(s_attributes[i], TPMA_SESSION, auditReset)) - { - InitAuditSession(session); - g_exclusiveAuditSession = auditSession; - } - else - { - // Check if the audit session is the current exclusive audit - // session and, if not, clear previous exclusive audit session. - if(g_exclusiveAuditSession != auditSession) - g_exclusiveAuditSession = TPM_RH_UNASSIGNED; - } - // Report audit session exclusivity. - if(g_exclusiveAuditSession == auditSession) - { - SET_ATTRIBUTE(s_attributes[i], TPMA_SESSION, auditExclusive); - } - else - { - CLEAR_ATTRIBUTE(s_attributes[i], TPMA_SESSION, auditExclusive); - } - // Extend audit log. - Audit(command, session); - } - } - // If no audit session is found in the command, and the command allows - // a session then, clear the current exclusive - // audit session. - if(auditSession == TPM_RH_UNASSIGNED && IsSessionAllowed(command->index)) - { - g_exclusiveAuditSession = TPM_RH_UNASSIGNED; - } - return; -} - -//*** ComputeResponseHMAC() -// Function to compute HMAC for authorization session in a response. -/*(See part 1 specification) -// Function: Compute HMAC for response sessions -// The sessionAuth value -// authHMAC := HMACsHASH((sessionAuth | authValue), -// (pHash | nonceTPM | nonceCaller | sessionAttributes)) -// Where: -// HMACsHASH() The HMAC algorithm using the hash algorithm specified when -// the session was started. -// -// sessionAuth A TPMB_MEDIUM computed in a protocol-dependent way, using -// KDFa. In an HMAC or KDF, only sessionAuth.buffer is used. -// -// authValue A TPM2B_AUTH that is found in the sensitive area of an -// object. In an HMAC or KDF, only authValue.buffer is used -// and all trailing zeros are removed. -// -// pHash Response parameters (rpHash) using the session hash. When -// using a pHash in an HMAC computation, both the algorithm ID -// and the digest are included. -// -// nonceTPM A TPM2B_NONCE that is generated by the entity using the -// session. In an HMAC or KDF, only nonceTPM.buffer is used. -// -// nonceCaller a TPM2B_NONCE that was received the previous time the -// session was used. In an HMAC or KDF, only -// nonceCaller.buffer is used. -// -// sessionAttributes A TPMA_SESSION that indicates the attributes associated -// with a particular use of the session. -*/ -static void -ComputeResponseHMAC( - COMMAND *command, // IN: command structure - UINT32 sessionIndex, // IN: session index to be processed - SESSION *session, // IN: loaded session - TPM2B_DIGEST *hmac // OUT: authHMAC - ) -{ - TPM2B_TYPE(KEY, (sizeof(AUTH_VALUE) * 2)); - TPM2B_KEY key; // HMAC key - BYTE marshalBuffer[sizeof(TPMA_SESSION)]; - BYTE *buffer; - UINT32 marshalSize; - HMAC_STATE hmacState; - TPM2B_DIGEST *rpHash = ComputeRpHash(command, session->authHashAlg); -// - // Generate HMAC key - MemoryCopy2B(&key.b, &session->sessionKey.b, sizeof(key.t.buffer)); - - // Add the object authValue if required - if(session->attributes.includeAuth == SET) - { - // Note: includeAuth may be SET for a policy that is used in - // UndefineSpaceSpecial(). At this point, the Index has been deleted - // so the includeAuth will have no meaning. However, the - // s_associatedHandles[] value for the session is now set to TPM_RH_NULL so - // this will return the authValue associated with TPM_RH_NULL and that is - // and empty buffer. - TPM2B_AUTH authValue; -// - // Get the authValue with trailing zeros removed - EntityGetAuthValue(s_associatedHandles[sessionIndex], &authValue); - - // Add it to the key - MemoryConcat2B(&key.b, &authValue.b, sizeof(key.t.buffer)); - } - - // if the HMAC key size is 0, the response HMAC is computed according to the - // input HMAC - if(key.t.size == 0 - && s_inputAuthValues[sessionIndex].t.size == 0) - { - hmac->t.size = 0; - return; - } - // Start HMAC computation. - hmac->t.size = CryptHmacStart2B(&hmacState, session->authHashAlg, &key.b); - - // Add hash components. - CryptDigestUpdate2B(&hmacState.hashState, &rpHash->b); - CryptDigestUpdate2B(&hmacState.hashState, &session->nonceTPM.b); - CryptDigestUpdate2B(&hmacState.hashState, &s_nonceCaller[sessionIndex].b); - - // Add session attributes. - buffer = marshalBuffer; - marshalSize = TPMA_SESSION_Marshal(&s_attributes[sessionIndex], &buffer, NULL); - CryptDigestUpdate(&hmacState.hashState, marshalSize, marshalBuffer); - - // Finalize HMAC. - CryptHmacEnd2B(&hmacState, &hmac->b); - - return; -} - -//*** UpdateInternalSession() -// Updates internal sessions: -// 1. Restarts session time. -// 2. Clears a policy session since nonce is rolling. -static void -UpdateInternalSession( - SESSION *session, // IN: the session structure - UINT32 i // IN: session number - ) -{ - // If nonce is rolling in a policy session, the policy related data - // will be re-initialized. - if(HandleGetType(s_sessionHandles[i]) == TPM_HT_POLICY_SESSION - && IS_ATTRIBUTE(s_attributes[i], TPMA_SESSION, continueSession)) - { - // When the nonce rolls it starts a new timing interval for the - // policy session. - SessionResetPolicyData(session); - SessionSetStartTime(session); - } - return; -} - -//*** BuildSingleResponseAuth() -// Function to compute response HMAC value for a policy or HMAC session. -static TPM2B_NONCE * -BuildSingleResponseAuth( - COMMAND *command, // IN: command structure - UINT32 sessionIndex, // IN: session index to be processed - TPM2B_AUTH *auth // OUT: authHMAC - ) -{ - // Fill in policy/HMAC based session response. - SESSION *session = SessionGet(s_sessionHandles[sessionIndex]); -// - // If the session is a policy session with isPasswordNeeded SET, the - // authorization field is empty. - if(HandleGetType(s_sessionHandles[sessionIndex]) == TPM_HT_POLICY_SESSION - && session->attributes.isPasswordNeeded == SET) - auth->t.size = 0; - else - // Compute response HMAC. - ComputeResponseHMAC(command, sessionIndex, session, auth); - - UpdateInternalSession(session, sessionIndex); - return &session->nonceTPM; -} - -//*** UpdateAllNonceTPM() -// Updates TPM nonce for all sessions in command. -static void -UpdateAllNonceTPM( - COMMAND *command // IN: controlling structure - ) -{ - UINT32 i; - SESSION *session; -// - for(i = 0; i < command->sessionNum; i++) - { - // If not a PW session, compute the new nonceTPM. - if(s_sessionHandles[i] != TPM_RS_PW) - { - session = SessionGet(s_sessionHandles[i]); - // Update nonceTPM in both internal session and response. - CryptRandomGenerate(session->nonceTPM.t.size, - session->nonceTPM.t.buffer); - } - } - return; -} - - - -//*** BuildResponseSession() -// Function to build Session buffer in a response. The authorization data is added -// to the end of command->responseBuffer. The size of the authorization area is -// accumulated in command->authSize. -// When this is called, command->responseBuffer is pointing at the next location -// in the response buffer to be filled. This is where the authorization sessions -// will go, if any. command->parameterSize is the number of bytes that have been -// marshaled as parameters in the output buffer. -void -BuildResponseSession( - COMMAND *command // IN: structure that has relevant command - // information - ) -{ - pAssert(command->authSize == 0); - - // Reset the parameter buffer to point to the start of the parameters so that - // there is a starting point for any rpHash that might be generated and so there - // is a place where parameter encryption would start - command->parameterBuffer = command->responseBuffer - command->parameterSize; - - // Session nonces should be updated before parameter encryption - if(command->tag == TPM_ST_SESSIONS) - { - UpdateAllNonceTPM(command); - - // Encrypt first parameter if applicable. Parameter encryption should - // happen after nonce update and before any rpHash is computed. - // If the encrypt session is associated with a handle, the authValue of - // this handle will be concatenated with sessionKey to generate - // encryption key, no matter if the handle is the session bound entity - // or not. The authValue is added to sessionKey only when the authValue - // is available. - if(s_encryptSessionIndex != UNDEFINED_INDEX) - { - UINT32 size; - TPM2B_AUTH extraKey; -// - extraKey.b.size = 0; - // If this is an authorization session, include the authValue in the - // generation of the encryption key - if(s_associatedHandles[s_encryptSessionIndex] != TPM_RH_UNASSIGNED) - { - EntityGetAuthValue(s_associatedHandles[s_encryptSessionIndex], - &extraKey); - } - size = EncryptSize(command->index); - CryptParameterEncryption(s_sessionHandles[s_encryptSessionIndex], - &s_nonceCaller[s_encryptSessionIndex].b, - (UINT16)size, - &extraKey, - command->parameterBuffer); - } - } - // Audit sessions should be processed regardless of the tag because - // a command with no session may cause a change of the exclusivity state. - UpdateAuditSessionStatus(command); -#if CC_GetCommandAuditDigest - // Command Audit - if(CommandAuditIsRequired(command->index)) - CommandAudit(command); -#endif - // Process command with sessions. - if(command->tag == TPM_ST_SESSIONS) - { - UINT32 i; -// - pAssert(command->sessionNum > 0); - - // Iterate over each session in the command session area, and create - // corresponding sessions for response. - for(i = 0; i < command->sessionNum; i++) - { - TPM2B_NONCE *nonceTPM; - TPM2B_DIGEST responseAuth; - // Make sure that continueSession is SET on any Password session. - // This makes it marginally easier for the management software - // to keep track of the closed sessions. - if(s_sessionHandles[i] == TPM_RS_PW) - { - SET_ATTRIBUTE(s_attributes[i], TPMA_SESSION, continueSession); - responseAuth.t.size = 0; - nonceTPM = (TPM2B_NONCE *)&responseAuth; - } - else - { - // Compute the response HMAC and get a pointer to the nonce used. - // This function will also update the values if needed. Note, the - nonceTPM = BuildSingleResponseAuth(command, i, &responseAuth); - } - command->authSize += TPM2B_NONCE_Marshal(nonceTPM, - &command->responseBuffer, - NULL); - command->authSize += TPMA_SESSION_Marshal(&s_attributes[i], - &command->responseBuffer, - NULL); - command->authSize += TPM2B_DIGEST_Marshal(&responseAuth, - &command->responseBuffer, - NULL); - if(!IS_ATTRIBUTE(s_attributes[i], TPMA_SESSION, continueSession)) - SessionFlush(s_sessionHandles[i]); - } - } - return; -} - -//*** SessionRemoveAssociationToHandle() -// This function deals with the case where an entity associated with an authorization -// is deleted during command processing. The primary use of this is to support -// UndefineSpaceSpecial(). -void -SessionRemoveAssociationToHandle( - TPM_HANDLE handle - ) -{ - UINT32 i; -// - for(i = 0; i < MAX_SESSION_NUM; i++) - { - if(s_associatedHandles[i] == handle) - { - s_associatedHandles[i] = TPM_RH_NULL; - } - } -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/CommandAudit.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/CommandAudit.c deleted file mode 100644 index 306b39b92..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/CommandAudit.c +++ /dev/null @@ -1,268 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions that support command audit. - -//** Includes -#include "Tpm.h" - -//** Functions - -//*** CommandAuditPreInstall_Init() -// This function initializes the command audit list. This function simulates -// the behavior of manufacturing. A function is used instead of a structure -// definition because this is easier than figuring out the initialization value -// for a bit array. -// -// This function would not be implemented outside of a manufacturing or -// simulation environment. -void -CommandAuditPreInstall_Init( - void - ) -{ - // Clear all the audit commands - MemorySet(gp.auditCommands, 0x00, sizeof(gp.auditCommands)); - - // TPM_CC_SetCommandCodeAuditStatus always being audited - CommandAuditSet(TPM_CC_SetCommandCodeAuditStatus); - - // Set initial command audit hash algorithm to be context integrity hash - // algorithm - gp.auditHashAlg = CONTEXT_INTEGRITY_HASH_ALG; - - // Set up audit counter to be 0 - gp.auditCounter = 0; - - // Write command audit persistent data to NV - NV_SYNC_PERSISTENT(auditCommands); - NV_SYNC_PERSISTENT(auditHashAlg); - NV_SYNC_PERSISTENT(auditCounter); - - return; -} - -//*** CommandAuditStartup() -// This function clears the command audit digest on a TPM Reset. -BOOL -CommandAuditStartup( - STARTUP_TYPE type // IN: start up type - ) -{ - if((type != SU_RESTART) && (type != SU_RESUME)) - { - // Reset the digest size to initialize the digest - gr.commandAuditDigest.t.size = 0; - } - return TRUE; -} - -//*** CommandAuditSet() -// This function will SET the audit flag for a command. This function -// will not SET the audit flag for a command that is not implemented. This -// ensures that the audit status is not SET when TPM2_GetCapability() is -// used to read the list of audited commands. -// -// This function is only used by TPM2_SetCommandCodeAuditStatus(). -// -// The actions in TPM2_SetCommandCodeAuditStatus() are expected to cause the -// changes to be saved to NV after it is setting and clearing bits. -// Return Type: BOOL -// TRUE(1) command code audit status was changed -// FALSE(0) command code audit status was not changed -BOOL -CommandAuditSet( - TPM_CC commandCode // IN: command code - ) -{ - COMMAND_INDEX commandIndex = CommandCodeToCommandIndex(commandCode); - - // Only SET a bit if the corresponding command is implemented - if(commandIndex != UNIMPLEMENTED_COMMAND_INDEX) - { - // Can't audit shutdown - if(commandCode != TPM_CC_Shutdown) - { - if(!TEST_BIT(commandIndex, gp.auditCommands)) - { - // Set bit - SET_BIT(commandIndex, gp.auditCommands); - return TRUE; - } - } - } - // No change - return FALSE; -} - -//*** CommandAuditClear() -// This function will CLEAR the audit flag for a command. It will not CLEAR the -// audit flag for TPM_CC_SetCommandCodeAuditStatus(). -// -// This function is only used by TPM2_SetCommandCodeAuditStatus(). -// -// The actions in TPM2_SetCommandCodeAuditStatus() are expected to cause the -// changes to be saved to NV after it is setting and clearing bits. -// Return Type: BOOL -// TRUE(1) command code audit status was changed -// FALSE(0) command code audit status was not changed -BOOL -CommandAuditClear( - TPM_CC commandCode // IN: command code - ) -{ - COMMAND_INDEX commandIndex = CommandCodeToCommandIndex(commandCode); - - // Do nothing if the command is not implemented - if(commandIndex != UNIMPLEMENTED_COMMAND_INDEX) - { - // The bit associated with TPM_CC_SetCommandCodeAuditStatus() cannot be - // cleared - if(commandCode != TPM_CC_SetCommandCodeAuditStatus) - { - if(TEST_BIT(commandIndex, gp.auditCommands)) - { - // Clear bit - CLEAR_BIT(commandIndex, gp.auditCommands); - return TRUE; - } - } - } - // No change - return FALSE; -} - -//*** CommandAuditIsRequired() -// This function indicates if the audit flag is SET for a command. -// Return Type: BOOL -// TRUE(1) command is audited -// FALSE(0) command is not audited -BOOL -CommandAuditIsRequired( - COMMAND_INDEX commandIndex // IN: command index - ) -{ - // Check the bit map. If the bit is SET, command audit is required - return(TEST_BIT(commandIndex, gp.auditCommands)); -} - -//*** CommandAuditCapGetCCList() -// This function returns a list of commands that have their audit bit SET. -// -// The list starts at the input commandCode. -// Return Type: TPMI_YES_NO -// YES if there are more command code available -// NO all the available command code has been returned -TPMI_YES_NO -CommandAuditCapGetCCList( - TPM_CC commandCode, // IN: start command code - UINT32 count, // IN: count of returned TPM_CC - TPML_CC *commandList // OUT: list of TPM_CC - ) -{ - TPMI_YES_NO more = NO; - COMMAND_INDEX commandIndex; - - // Initialize output handle list - commandList->count = 0; - - // The maximum count of command we may return is MAX_CAP_CC - if(count > MAX_CAP_CC) count = MAX_CAP_CC; - - // Find the implemented command that has a command code that is the same or - // higher than the input - // Collect audit commands - for(commandIndex = GetClosestCommandIndex(commandCode); - commandIndex != UNIMPLEMENTED_COMMAND_INDEX; - commandIndex = GetNextCommandIndex(commandIndex)) - { - if(CommandAuditIsRequired(commandIndex)) - { - if(commandList->count < count) - { - // If we have not filled up the return list, add this command - // code to its - TPM_CC cc = GET_ATTRIBUTE(s_ccAttr[commandIndex], - TPMA_CC, commandIndex); - if(IS_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, V)) - cc += (1 << 29); - commandList->commandCodes[commandList->count] = cc; - commandList->count++; - } - else - { - // If the return list is full but we still have command - // available, report this and stop iterating - more = YES; - break; - } - } - } - - return more; -} - -//*** CommandAuditGetDigest -// This command is used to create a digest of the commands being audited. The -// commands are processed in ascending numeric order with a list of TPM_CC being -// added to a hash. This operates as if all the audited command codes were -// concatenated and then hashed. -void -CommandAuditGetDigest( - TPM2B_DIGEST *digest // OUT: command digest - ) -{ - TPM_CC commandCode; - COMMAND_INDEX commandIndex; - HASH_STATE hashState; - - // Start hash - digest->t.size = CryptHashStart(&hashState, gp.auditHashAlg); - - // Add command code - for(commandIndex = 0; commandIndex < COMMAND_COUNT; commandIndex++) - { - if(CommandAuditIsRequired(commandIndex)) - { - commandCode = GetCommandCode(commandIndex); - CryptDigestUpdateInt(&hashState, sizeof(commandCode), commandCode); - } - } - - // Complete hash - CryptHashEnd2B(&hashState, &digest->b); - - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/DA.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/DA.c deleted file mode 100644 index a537c719e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/DA.c +++ /dev/null @@ -1,235 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions and data definitions relating to the -// dictionary attack logic. - -//** Includes and Data Definitions -#define DA_C -#include "Tpm.h" - -//** Functions - -//*** DAPreInstall_Init() -// This function initializes the DA parameters to their manufacturer-default -// values. The default values are determined by a platform-specific specification. -// -// This function should not be called outside of a manufacturing or simulation -// environment. -// -// The DA parameters will be restored to these initial values by TPM2_Clear(). -void -DAPreInstall_Init( - void - ) -{ - gp.failedTries = 0; - gp.maxTries = 3; - gp.recoveryTime = 1000; // in seconds (~16.67 minutes) - gp.lockoutRecovery = 1000; // in seconds - gp.lockOutAuthEnabled = TRUE; // Use of lockoutAuth is enabled - - // Record persistent DA parameter changes to NV - NV_SYNC_PERSISTENT(failedTries); - NV_SYNC_PERSISTENT(maxTries); - NV_SYNC_PERSISTENT(recoveryTime); - NV_SYNC_PERSISTENT(lockoutRecovery); - NV_SYNC_PERSISTENT(lockOutAuthEnabled); - - return; -} - - -//*** DAStartup() -// This function is called by TPM2_Startup() to initialize the DA parameters. -// In the case of Startup(CLEAR), use of lockoutAuth will be enabled if the -// lockout recovery time is 0. Otherwise, lockoutAuth will not be enabled until -// the TPM has been continuously powered for the lockoutRecovery time. -// -// This function requires that NV be available and not rate limiting. -BOOL -DAStartup( - STARTUP_TYPE type // IN: startup type - ) -{ - NOT_REFERENCED(type); -#if !ACCUMULATE_SELF_HEAL_TIMER - _plat__TimerWasReset(); - s_selfHealTimer = 0; - s_lockoutTimer = 0; -#else - if(_plat__TimerWasReset()) - { - if(!NV_IS_ORDERLY) - { - // If shutdown was not orderly, then don't really know if go.time has - // any useful value so reset the timer to 0. This is what the tick - // was reset to - s_selfHealTimer = 0; - s_lockoutTimer = 0; - } - else - { - // If we know how much time was accumulated at the last orderly shutdown - // subtract that from the saved timer values so that they effectively - // have the accumulated values - s_selfHealTimer -= go.time; - s_lockoutTimer -= go.time; - } - } -#endif - - // For any Startup(), if lockoutRecovery is 0, enable use of lockoutAuth. - if(gp.lockoutRecovery == 0) - { - gp.lockOutAuthEnabled = TRUE; - // Record the changes to NV - NV_SYNC_PERSISTENT(lockOutAuthEnabled); - } - - // If DA has not been disabled and the previous shutdown is not orderly - // failedTries is not already at its maximum then increment 'failedTries' - if(gp.recoveryTime != 0 - && gp.failedTries < gp.maxTries - && !IS_ORDERLY(g_prevOrderlyState)) - { -#if USE_DA_USED - gp.failedTries += g_daUsed; - g_daUsed = FALSE; -#else - gp.failedTries++; -#endif - // Record the change to NV - NV_SYNC_PERSISTENT(failedTries); - } - // Before Startup, the TPM will not do clock updates. At startup, need to - // do a time update which will do the DA update. - TimeUpdate(); - - return TRUE; -} - -//*** DARegisterFailure() -// This function is called when a authorization failure occurs on an entity -// that is subject to dictionary-attack protection. When a DA failure is -// triggered, register the failure by resetting the relevant self-healing -// timer to the current time. -void -DARegisterFailure( - TPM_HANDLE handle // IN: handle for failure - ) -{ - // Reset the timer associated with lockout if the handle is the lockoutAuth. - if(handle == TPM_RH_LOCKOUT) - s_lockoutTimer = g_time; - else - s_selfHealTimer = g_time; - return; -} - -//*** DASelfHeal() -// This function is called to check if sufficient time has passed to allow -// decrement of failedTries or to re-enable use of lockoutAuth. -// -// This function should be called when the time interval is updated. -void -DASelfHeal( - void - ) -{ - // Regular authorization self healing logic - // If no failed authorization tries, do nothing. Otherwise, try to - // decrease failedTries - if(gp.failedTries != 0) - { - // if recovery time is 0, DA logic has been disabled. Clear failed tries - // immediately - if(gp.recoveryTime == 0) - { - gp.failedTries = 0; - // Update NV record - NV_SYNC_PERSISTENT(failedTries); - } - else - { - UINT64 decreaseCount; -#if 0 // Errata eliminates this code - // In the unlikely event that failedTries should become larger than - // maxTries - if(gp.failedTries > gp.maxTries) - gp.failedTries = gp.maxTries; -#endif - // How much can failedTries be decreased - - // Cast s_selfHealTimer to an int in case it became negative at - // startup - decreaseCount = ((g_time - (INT64)s_selfHealTimer) / 1000) - / gp.recoveryTime; - - if(gp.failedTries <= (UINT32)decreaseCount) - // should not set failedTries below zero - gp.failedTries = 0; - else - gp.failedTries -= (UINT32)decreaseCount; - - // the cast prevents overflow of the product - s_selfHealTimer += (decreaseCount * (UINT64)gp.recoveryTime) * 1000; - if(decreaseCount != 0) - // If there was a change to the failedTries, record the changes - // to NV - NV_SYNC_PERSISTENT(failedTries); - } - } - - // LockoutAuth self healing logic - // If lockoutAuth is enabled, do nothing. Otherwise, try to see if we - // may enable it - if(!gp.lockOutAuthEnabled) - { - // if lockout authorization recovery time is 0, a reboot is required to - // re-enable use of lockout authorization. Self-healing would not - // apply in this case. - if(gp.lockoutRecovery != 0) - { - if(((g_time - (INT64)s_lockoutTimer) / 1000) >= gp.lockoutRecovery) - { - gp.lockOutAuthEnabled = TRUE; - // Record the changes to NV - NV_SYNC_PERSISTENT(lockOutAuthEnabled); - } - } - } - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Hierarchy.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Hierarchy.c deleted file mode 100644 index bec54378d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Hierarchy.c +++ /dev/null @@ -1,237 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions used for managing and accessing the -// hierarchy-related values. - -//** Includes - -#include "Tpm.h" - -//** Functions - -//*** HierarchyPreInstall() -// This function performs the initialization functions for the hierarchy -// when the TPM is simulated. This function should not be called if the -// TPM is not in a manufacturing mode at the manufacturer, or in a simulated -// environment. -void -HierarchyPreInstall_Init( - void - ) -{ - // Allow lockout clear command - gp.disableClear = FALSE; - - // Initialize Primary Seeds - gp.EPSeed.t.size = sizeof(gp.EPSeed.t.buffer); - gp.SPSeed.t.size = sizeof(gp.SPSeed.t.buffer); - gp.PPSeed.t.size = sizeof(gp.PPSeed.t.buffer); -#if (defined USE_PLATFORM_EPS) && (USE_PLATFORM_EPS != NO) - _plat__GetEPS(gp.EPSeed.t.size, gp.EPSeed.t.buffer); -#else - CryptRandomGenerate(gp.EPSeed.t.size, gp.EPSeed.t.buffer); -#endif - CryptRandomGenerate(gp.SPSeed.t.size, gp.SPSeed.t.buffer); - CryptRandomGenerate(gp.PPSeed.t.size, gp.PPSeed.t.buffer); - - // Initialize owner, endorsement and lockout authorization - gp.ownerAuth.t.size = 0; - gp.endorsementAuth.t.size = 0; - gp.lockoutAuth.t.size = 0; - - // Initialize owner, endorsement, and lockout policy - gp.ownerAlg = TPM_ALG_NULL; - gp.ownerPolicy.t.size = 0; - gp.endorsementAlg = TPM_ALG_NULL; - gp.endorsementPolicy.t.size = 0; - gp.lockoutAlg = TPM_ALG_NULL; - gp.lockoutPolicy.t.size = 0; - - // Initialize ehProof, shProof and phProof - gp.phProof.t.size = sizeof(gp.phProof.t.buffer); - gp.shProof.t.size = sizeof(gp.shProof.t.buffer); - gp.ehProof.t.size = sizeof(gp.ehProof.t.buffer); - CryptRandomGenerate(gp.phProof.t.size, gp.phProof.t.buffer); - CryptRandomGenerate(gp.shProof.t.size, gp.shProof.t.buffer); - CryptRandomGenerate(gp.ehProof.t.size, gp.ehProof.t.buffer); - - // Write hierarchy data to NV - NV_SYNC_PERSISTENT(disableClear); - NV_SYNC_PERSISTENT(EPSeed); - NV_SYNC_PERSISTENT(SPSeed); - NV_SYNC_PERSISTENT(PPSeed); - NV_SYNC_PERSISTENT(ownerAuth); - NV_SYNC_PERSISTENT(endorsementAuth); - NV_SYNC_PERSISTENT(lockoutAuth); - NV_SYNC_PERSISTENT(ownerAlg); - NV_SYNC_PERSISTENT(ownerPolicy); - NV_SYNC_PERSISTENT(endorsementAlg); - NV_SYNC_PERSISTENT(endorsementPolicy); - NV_SYNC_PERSISTENT(lockoutAlg); - NV_SYNC_PERSISTENT(lockoutPolicy); - NV_SYNC_PERSISTENT(phProof); - NV_SYNC_PERSISTENT(shProof); - NV_SYNC_PERSISTENT(ehProof); - - return; -} - -//*** HierarchyStartup() -// This function is called at TPM2_Startup() to initialize the hierarchy -// related values. -BOOL -HierarchyStartup( - STARTUP_TYPE type // IN: start up type - ) -{ - // phEnable is SET on any startup - g_phEnable = TRUE; - - // Reset platformAuth, platformPolicy; enable SH and EH at TPM_RESET and - // TPM_RESTART - if(type != SU_RESUME) - { - gc.platformAuth.t.size = 0; - gc.platformPolicy.t.size = 0; - gc.platformAlg = TPM_ALG_NULL; - - // enable the storage and endorsement hierarchies and the platformNV - gc.shEnable = gc.ehEnable = gc.phEnableNV = TRUE; - } - - // nullProof and nullSeed are updated at every TPM_RESET - if((type != SU_RESTART) && (type != SU_RESUME)) - { - gr.nullProof.t.size = sizeof(gr.nullProof.t.buffer); - CryptRandomGenerate(gr.nullProof.t.size, gr.nullProof.t.buffer); - gr.nullSeed.t.size = sizeof(gr.nullSeed.t.buffer); - CryptRandomGenerate(gr.nullSeed.t.size, gr.nullSeed.t.buffer); - } - - return TRUE; -} - -//*** HierarchyGetProof() -// This function finds the proof value associated with a hierarchy.It returns a -// pointer to the proof value. -TPM2B_PROOF * -HierarchyGetProof( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy constant - ) -{ - TPM2B_PROOF *proof = NULL; - - switch(hierarchy) - { - case TPM_RH_PLATFORM: - // phProof for TPM_RH_PLATFORM - proof = &gp.phProof; - break; - case TPM_RH_ENDORSEMENT: - // ehProof for TPM_RH_ENDORSEMENT - proof = &gp.ehProof; - break; - case TPM_RH_OWNER: - // shProof for TPM_RH_OWNER - proof = &gp.shProof; - break; - default: - // nullProof for TPM_RH_NULL or anything else - proof = &gr.nullProof; - break; - } - return proof; -} - -//*** HierarchyGetPrimarySeed() -// This function returns the primary seed of a hierarchy. -TPM2B_SEED * -HierarchyGetPrimarySeed( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy - ) -{ - TPM2B_SEED *seed = NULL; - switch(hierarchy) - { - case TPM_RH_PLATFORM: - seed = &gp.PPSeed; - break; - case TPM_RH_OWNER: - seed = &gp.SPSeed; - break; - case TPM_RH_ENDORSEMENT: - seed = &gp.EPSeed; - break; - default: - seed = &gr.nullSeed; - break; - } - return seed; -} - -//*** HierarchyIsEnabled() -// This function checks to see if a hierarchy is enabled. -// NOTE: The TPM_RH_NULL hierarchy is always enabled. -// Return Type: BOOL -// TRUE(1) hierarchy is enabled -// FALSE(0) hierarchy is disabled -BOOL -HierarchyIsEnabled( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy - ) -{ - BOOL enabled = FALSE; - - switch(hierarchy) - { - case TPM_RH_PLATFORM: - enabled = g_phEnable; - break; - case TPM_RH_OWNER: - enabled = gc.shEnable; - break; - case TPM_RH_ENDORSEMENT: - enabled = gc.ehEnable; - break; - case TPM_RH_NULL: - enabled = TRUE; - break; - default: - enabled = FALSE; - break; - } - return enabled; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/NvDynamic.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/NvDynamic.c deleted file mode 100644 index d73d4bf8d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/NvDynamic.c +++ /dev/null @@ -1,1932 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction - -// The NV memory is divided into two area: dynamic space for user defined NV -// indexes and evict objects, and reserved space for TPM persistent and state save -// data. -// -// The entries in dynamic space are a linked list of entries. Each entry has, as its -// first field, a size. If the size field is zero, it marks the end of the -// list. -// -// An Index allocation will contain an NV_INDEX structure. If the Index does not -// have the orderly attribute, the NV_INDEX is followed immediately by the NV data. -// -// An evict object entry contains a handle followed by an OBJECT structure. This -// results in both the Index and Evict Object having an identifying handle as the -// first field following the size field. -// -// When an Index has the orderly attribute, the data is kept in RAM. This RAM is -// saved to backing store in NV memory on any orderly shutdown. The entries in -// orderly memory are also a linked list using a size field as the first entry. -// -// The attributes of an orderly index are maintained in RAM memory in order to -// reduce the number of NV writes needed for orderly data. When an orderly index -// is created, an entry is made in the dynamic NV memory space that holds the Index -// authorizations (authPolicy and authValue) and the size of the data. This entry is -// only modified if the authValue of the index is changed. The more volatile data -// of the index is kept in RAM. When an orderly Index is created or deleted, the -// RAM data is copied to NV backing store so that the image in the backing store -// matches the layout of RAM. In normal operation. The RAM data is also copied on -// any orderly shutdown. In normal operation, the only other reason for writing -// to the backing store for RAM is when a counter is first written (TPMA_NV_WRITTEN -// changes from CLEAR to SET) or when a counter "rolls over." -// -// Static space contains items that are individually modifiable. The values are in -// the 'gp' PERSISTEND_DATA structure in RAM and mapped to locations in NV. -// - -//** Includes, Defines and Data Definitions -#define NV_C -#include "Tpm.h" -#include "PlatformData.h" - -//** Local Functions - - -//*** NvNext() -// This function provides a method to traverse every data entry in NV dynamic -// area. -// -// To begin with, parameter 'iter' should be initialized to NV_REF_INIT -// indicating the first element. Every time this function is called, the -// value in 'iter' would be adjusted pointing to the next element in -// traversal. If there is no next element, 'iter' value would be 0. -// This function returns the address of the 'data entry' pointed by the -// 'iter'. If there is no more element in the set, a 0 value is returned -// indicating the end of traversal. -// -static NV_REF -NvNext( - NV_REF *iter, // IN/OUT: the list iterator - TPM_HANDLE *handle // OUT: the handle of the next item. - ) -{ - NV_REF currentAddr; - NV_ENTRY_HEADER header; -// - // If iterator is at the beginning of list - if(*iter == NV_REF_INIT) - { - // Initialize iterator - *iter = NV_USER_DYNAMIC; - } - // Step over the size field and point to the handle - currentAddr = *iter + sizeof(UINT32); - - // read the header of the next entry - NvRead(&header, *iter, sizeof(NV_ENTRY_HEADER)); - - // if the size field is zero, then we have hit the end of the list - if(header.size == 0) - // leave the *iter pointing at the end of the list - return 0; - // advance the header by the size of the entry - *iter += header.size; - - if(handle != NULL) - *handle = header.handle; - return currentAddr; -} - - -//*** NvNextByType() -// This function returns a reference to the next NV entry of the desired type -// Return Type: NV_REF -// 0 end of list -// != 0 the next entry of the indicated type -static NV_REF -NvNextByType( - TPM_HANDLE *handle, // OUT: the handle of the found type - NV_REF *iter, // IN: the iterator - TPM_HT type // IN: the handle type to look for - ) -{ - NV_REF addr; - TPM_HANDLE nvHandle; -// - while((addr = NvNext(iter, &nvHandle)) != 0) - { - // addr: the address of the location containing the handle of the value - // iter: the next location. - if(HandleGetType(nvHandle) == type) - break; - } - if(handle != NULL) - *handle = nvHandle; - return addr; -} - -//*** NvNextIndex() -// This function returns the reference to the next NV Index entry. A value -// of 0 indicates the end of the list. -// Return Type: NV_REF -// 0 end of list -// != 0 the next reference -#define NvNextIndex(handle, iter) \ - NvNextByType(handle, iter, TPM_HT_NV_INDEX) - -//*** NvNextEvict() -// This function returns the offset in NV of the next evict object entry. A value -// of 0 indicates the end of the list. -#define NvNextEvict(handle, iter) \ - NvNextByType(handle, iter, TPM_HT_PERSISTENT) - -//*** NvGetEnd() -// Function to find the end of the NV dynamic data list -static NV_REF -NvGetEnd( - void - ) -{ - NV_REF iter = NV_REF_INIT; - NV_REF currentAddr; -// - // Scan until the next address is 0 - while((currentAddr = NvNext(&iter, NULL)) != 0); - return iter; -} - -//*** NvGetFreeBytes -// This function returns the number of free octets in NV space. -static UINT32 -NvGetFreeBytes( - void - ) -{ - // This does not have an overflow issue because NvGetEnd() cannot return a value - // that is larger than s_evictNvEnd. This is because there is always a 'stop' - // word in the NV memory that terminates the search for the end before the - // value can go past s_evictNvEnd. - return s_evictNvEnd - NvGetEnd(); -} - -//*** NvTestSpace() -// This function will test if there is enough space to add a new entity. -// Return Type: BOOL -// TRUE(1) space available -// FALSE(0) no enough space -static BOOL -NvTestSpace( - UINT32 size, // IN: size of the entity to be added - BOOL isIndex, // IN: TRUE if the entity is an index - BOOL isCounter // IN: TRUE if the index is a counter - ) -{ - UINT32 remainBytes = NvGetFreeBytes(); - UINT32 reserved = sizeof(UINT32) // size of the forward pointer - + sizeof(NV_LIST_TERMINATOR); -// - // Do a compile time sanity check on the setting for NV_MEMORY_SIZE -#if NV_MEMORY_SIZE < 1024 -#error "NV_MEMORY_SIZE probably isn't large enough" -#endif - - // For NV Index, need to make sure that we do not allocate an Index if this - // would mean that the TPM cannot allocate the minimum number of evict - // objects. - if(isIndex) - { - // Get the number of persistent objects allocated - UINT32 persistentNum = NvCapGetPersistentNumber(); - - // If we have not allocated the requisite number of evict objects, then we - // need to reserve space for them. - // NOTE: some of this is not written as simply as it might seem because - // the values are all unsigned and subtracting needs to be done carefully - // so that an underflow doesn't cause problems. - if(persistentNum < MIN_EVICT_OBJECTS) - reserved += (MIN_EVICT_OBJECTS - persistentNum) * NV_EVICT_OBJECT_SIZE; - } - // If this is not an index or is not a counter, reserve space for the - // required number of counter indexes - if(!isIndex || !isCounter) - { - // Get the number of counters - UINT32 counterNum = NvCapGetCounterNumber(); - - // If the required number of counters have not been allocated, reserved - // space for the extra needed counters - if(counterNum < MIN_COUNTER_INDICES) - reserved += (MIN_COUNTER_INDICES - counterNum) * NV_INDEX_COUNTER_SIZE; - } - // Check that the requested allocation will fit after making sure that there - // will be no chance of overflow - return ((reserved < remainBytes) - && (size <= remainBytes) - && (size + reserved <= remainBytes)); -} - -//*** NvWriteNvListEnd() -// Function to write the list terminator. -NV_REF -NvWriteNvListEnd( - NV_REF end - ) -{ - // Marker is initialized with zeros - BYTE listEndMarker[sizeof(NV_LIST_TERMINATOR)] = {0}; - UINT64 maxCount = NvReadMaxCount(); -// - // This is a constant check that can be resolved at compile time. - cAssert(sizeof(UINT64) <= sizeof(NV_LIST_TERMINATOR) - sizeof(UINT32)); - - // Copy the maxCount value to the marker buffer - MemoryCopy(&listEndMarker[sizeof(UINT32)], &maxCount, sizeof(UINT64)); - pAssert(end + sizeof(NV_LIST_TERMINATOR) <= s_evictNvEnd); - - // Write it to memory - NvWrite(end, sizeof(NV_LIST_TERMINATOR), &listEndMarker); - return end + sizeof(NV_LIST_TERMINATOR); -} - - -//*** NvAdd() -// This function adds a new entity to NV. -// -// This function requires that there is enough space to add a new entity (i.e., -// that NvTestSpace() has been called and the available space is at least as -// large as the required space). -// -// The 'totalSize' will be the size of 'entity'. If a handle is added, this -// function will increase the size accordingly. -static TPM_RC -NvAdd( - UINT32 totalSize, // IN: total size needed for this entity For - // evict object, totalSize is the same as - // bufferSize. For NV Index, totalSize is - // bufferSize plus index data size - UINT32 bufferSize, // IN: size of initial buffer - TPM_HANDLE handle, // IN: optional handle - BYTE *entity // IN: initial buffer - ) -{ - NV_REF newAddr; // IN: where the new entity will start - NV_REF nextAddr; -// - RETURN_IF_NV_IS_NOT_AVAILABLE; - - // Get the end of data list - newAddr = NvGetEnd(); - - // Step over the forward pointer - nextAddr = newAddr + sizeof(UINT32); - - // Optionally write the handle. For indexes, the handle is TPM_RH_UNASSIGNED - // so that the handle in the nvIndex is used instead of writing this value - if(handle != TPM_RH_UNASSIGNED) - { - NvWrite((UINT32)nextAddr, sizeof(TPM_HANDLE), &handle); - nextAddr += sizeof(TPM_HANDLE); - } - // Write entity data - NvWrite((UINT32)nextAddr, bufferSize, entity); - - // Advance the pointer by the amount of the total - nextAddr += totalSize; - - // Finish by writing the link value - - // Write the next offset (relative addressing) - totalSize = nextAddr - newAddr; - - // Write link value - NvWrite((UINT32)newAddr, sizeof(UINT32), &totalSize); - - // Write the list terminator - NvWriteNvListEnd(nextAddr); - - return TPM_RC_SUCCESS; -} - -//*** NvDelete() -// This function is used to delete an NV Index or persistent object from NV memory. -static TPM_RC -NvDelete( - NV_REF entityRef // IN: reference to entity to be deleted - ) -{ - UINT32 entrySize; - // adjust entityAddr to back up and point to the forward pointer - NV_REF entryRef = entityRef - sizeof(UINT32); - NV_REF endRef = NvGetEnd(); - NV_REF nextAddr; // address of the next entry -// - RETURN_IF_NV_IS_NOT_AVAILABLE; - - // Get the offset of the next entry. That is, back up and point to the size - // field of the entry - NvRead(&entrySize, entryRef, sizeof(UINT32)); - - // The next entry after the one being deleted is at a relative offset - // from the current entry - nextAddr = entryRef + entrySize; - - // If this is not the last entry, move everything up - if(nextAddr < endRef) - { - pAssert(nextAddr > entryRef); - _plat__NvMemoryMove(nextAddr, - entryRef, - (endRef - nextAddr)); - } - // The end of the used space is now moved up by the amount of space we just - // reclaimed - endRef -= entrySize; - - // Write the end marker, and make the new end equal to the first byte after - // the just added end value. This will automatically update the NV value for - // maxCounter. - // NOTE: This is the call that sets flag to cause NV to be updated - endRef = NvWriteNvListEnd(endRef); - - // Clear the reclaimed memory - _plat__NvMemoryClear(endRef, entrySize); - - return TPM_RC_SUCCESS; -} - -//************************************************ -//** RAM-based NV Index Data Access Functions -//************************************************ -//*** Introduction -// The data layout in ram buffer is {size of(NV_handle + attributes + data -// NV_handle, attributes, data} -// for each NV Index data stored in RAM. -// -// NV storage associated with orderly data is updated when a NV Index is added -// but NOT when the data or attributes are changed. Orderly data is only updated -// to NV on an orderly shutdown (TPM2_Shutdown()) - -//*** NvRamNext() -// This function is used to iterate trough the list of Ram Index values. *iter needs -// to be initialized by calling -static NV_RAM_REF -NvRamNext( - NV_RAM_REF *iter, // IN/OUT: the list iterator - TPM_HANDLE *handle // OUT: the handle of the next item. - ) -{ - NV_RAM_REF currentAddr; - NV_RAM_HEADER header; -// - // If iterator is at the beginning of list - if(*iter == NV_RAM_REF_INIT) - { - // Initialize iterator - *iter = &s_indexOrderlyRam[0]; - } - // if we are going to return what the iter is currently pointing to... - currentAddr = *iter; - - // If iterator reaches the end of NV space, then don't advance and return - // that we are at the end of the list. The end of the list occurs when - // we don't have space for a size and a handle - if(currentAddr + sizeof(NV_RAM_HEADER) > RAM_ORDERLY_END) - return NULL; - // read the header of the next entry - MemoryCopy(&header, currentAddr, sizeof(NV_RAM_HEADER)); - - // if the size field is zero, then we have hit the end of the list - if(header.size == 0) - // leave the *iter pointing at the end of the list - return NULL; - // advance the header by the size of the entry - *iter = currentAddr + header.size; - -// pAssert(*iter <= RAM_ORDERLY_END); - if(handle != NULL) - *handle = header.handle; - return currentAddr; -} - -//*** NvRamGetEnd() -// This routine performs the same function as NvGetEnd() but for the RAM data. -static NV_RAM_REF -NvRamGetEnd( - void - ) -{ - NV_RAM_REF iter = NV_RAM_REF_INIT; - NV_RAM_REF currentAddr; -// - // Scan until the next address is 0 - while((currentAddr = NvRamNext(&iter, NULL)) != 0); - return iter; -} - -//*** NvRamTestSpaceIndex() -// This function indicates if there is enough RAM space to add a data for a -// new NV Index. -// Return Type: BOOL -// TRUE(1) space available -// FALSE(0) no enough space -static BOOL -NvRamTestSpaceIndex( - UINT32 size // IN: size of the data to be added to RAM - ) -{ - UINT32 remaining = (UINT32)(RAM_ORDERLY_END - NvRamGetEnd()); - UINT32 needed = sizeof(NV_RAM_HEADER) + size; -// - // NvRamGetEnd points to the next available byte. - return remaining >= needed; -} - -//*** NvRamGetIndex() -// This function returns the offset of NV data in the RAM buffer -// -// This function requires that NV Index is in RAM. That is, the -// index must be known to exist. -static NV_RAM_REF -NvRamGetIndex( - TPMI_RH_NV_INDEX handle // IN: NV handle - ) -{ - NV_RAM_REF iter = NV_RAM_REF_INIT; - NV_RAM_REF currentAddr; - TPM_HANDLE foundHandle; -// - while((currentAddr = NvRamNext(&iter, &foundHandle)) != 0) - { - if(handle == foundHandle) - break; - } - return currentAddr; -} - -//*** NvUpdateIndexOrderlyData() -// This function is used to cause an update of the orderly data to the NV backing -// store. -void -NvUpdateIndexOrderlyData( - void - ) -{ - // Write reserved RAM space to NV - NvWrite(NV_INDEX_RAM_DATA, sizeof(s_indexOrderlyRam), s_indexOrderlyRam); -} - -//*** NvAddRAM() -// This function adds a new data area to RAM. -// -// This function requires that enough free RAM space is available to add -// the new data. -// -// This function should be called after the NV Index space has been updated -// and the index removed. This insures that NV is available so that checking -// for NV availability is not required during this function. -static void -NvAddRAM( - TPMS_NV_PUBLIC *index // IN: the index descriptor - ) -{ - NV_RAM_HEADER header; - NV_RAM_REF end = NvRamGetEnd(); -// - header.size = sizeof(NV_RAM_HEADER) + index->dataSize; - header.handle = index->nvIndex; - MemoryCopy(&header.attributes, &index->attributes, sizeof(TPMA_NV)); - - pAssert(ORDERLY_RAM_ADDRESS_OK(end, header.size)); - - // Copy the header to the memory - MemoryCopy(end, &header, sizeof(NV_RAM_HEADER)); - - // Clear the data area (just in case) - MemorySet(end + sizeof(NV_RAM_HEADER), 0, index->dataSize); - - // Step over this new entry - end += header.size; - - // If the end marker will fit, add it - if(end + sizeof(UINT32) < RAM_ORDERLY_END) - MemorySet(end, 0, sizeof(UINT32)); - // Write reserved RAM space to NV to reflect the newly added NV Index - SET_NV_UPDATE(UT_ORDERLY); - - return; -} - -//*** NvDeleteRAM() -// This function is used to delete a RAM-backed NV Index data area. -// The space used by the entry are overwritten by the contents of the -// Index data that comes after (the data is moved up to fill the hole left -// by removing this index. The reclaimed space is cleared to zeros. -// This function assumes the data of NV Index exists in RAM. -// -// This function should be called after the NV Index space has been updated -// and the index removed. This insures that NV is available so that checking -// for NV availability is not required during this function. -static void -NvDeleteRAM( - TPMI_RH_NV_INDEX handle // IN: NV handle - ) -{ - NV_RAM_REF nodeAddress; - NV_RAM_REF nextNode; - UINT32 size; - NV_RAM_REF lastUsed = NvRamGetEnd(); -// - nodeAddress = NvRamGetIndex(handle); - - pAssert(nodeAddress != 0); - - // Get node size - MemoryCopy(&size, nodeAddress, sizeof(size)); - - // Get the offset of next node - nextNode = nodeAddress + size; - - // Copy the data - MemoryCopy(nodeAddress, nextNode, (int)(lastUsed - nextNode)); - - // Clear out the reclaimed space - MemorySet(lastUsed - size, 0, size); - - // Write reserved RAM space to NV to reflect the newly delete NV Index - SET_NV_UPDATE(UT_ORDERLY); - - return; -} - -//*** NvReadIndex() -// This function is used to read the NV Index NV_INDEX. This is used so that the -// index information can be compressed and only this function would be needed -// to decompress it. Mostly, compression would only be able to save the space -// needed by the policy. -void -NvReadNvIndexInfo( - NV_REF ref, // IN: points to NV where index is located - NV_INDEX *nvIndex // OUT: place to receive index data - ) -{ - pAssert(nvIndex != NULL); - NvRead(nvIndex, ref, sizeof(NV_INDEX)); - return; -} - -//*** NvReadObject() -// This function is used to read a persistent object. This is used so that the -// object information can be compressed and only this function would be needed -// to uncompress it. -void -NvReadObject( - NV_REF ref, // IN: points to NV where index is located - OBJECT *object // OUT: place to receive the object data - ) -{ - NvRead(object, (ref + sizeof(TPM_HANDLE)), sizeof(OBJECT)); - return; -} - -//*** NvFindEvict() -// This function will return the NV offset of an evict object -// Return Type: UINT32 -// 0 evict object not found -// != 0 offset of evict object -static NV_REF -NvFindEvict( - TPM_HANDLE nvHandle, - OBJECT *object - ) -{ - NV_REF found = NvFindHandle(nvHandle); -// - // If we found the handle and the request included an object pointer, fill it in - if(found != 0 && object != NULL) - NvReadObject(found, object); - return found; -} - -//*** NvIndexIsDefined() -// See if an index is already defined -BOOL -NvIndexIsDefined( - TPM_HANDLE nvHandle // IN: Index to look for - ) -{ - return (NvFindHandle(nvHandle) != 0); -} - -//*** NvConditionallyWrite() -// Function to check if the data to be written has changed -// and write it if it has -// Return Type: TPM_RC -// TPM_RC_NV_RATE NV is unavailable because of rate limit -// TPM_RC_NV_UNAVAILABLE NV is inaccessible -static TPM_RC -NvConditionallyWrite( - NV_REF entryAddr, // IN: stating address - UINT32 size, // IN: size of the data to write - void *data // IN: the data to write - ) -{ - // If the index data is actually changed, then a write to NV is required - if(_plat__NvIsDifferent(entryAddr, size, data)) - { - // Write the data if NV is available - if(g_NvStatus == TPM_RC_SUCCESS) - { - NvWrite(entryAddr, size, data); - } - return g_NvStatus; - } - return TPM_RC_SUCCESS; -} - -//*** NvReadNvIndexAttributes() -// This function returns the attributes of an NV Index. -static TPMA_NV -NvReadNvIndexAttributes( - NV_REF locator // IN: reference to an NV index - ) -{ - TPMA_NV attributes; -// - NvRead(&attributes, - locator + offsetof(NV_INDEX, publicArea.attributes), - sizeof(TPMA_NV)); - return attributes; -} - -//*** NvReadRamIndexAttributes() -// This function returns the attributes from the RAM header structure. This function -// is used to deal with the fact that the header structure is only byte aligned. -static TPMA_NV -NvReadRamIndexAttributes( - NV_RAM_REF ref // IN: pointer to a NV_RAM_HEADER - ) -{ - TPMA_NV attributes; -// - MemoryCopy(&attributes, ref + offsetof(NV_RAM_HEADER, attributes), - sizeof(TPMA_NV)); - return attributes; -} - -//*** NvWriteNvIndexAttributes() -// This function is used to write just the attributes of an index to NV. -// Return type: TPM_RC -// TPM_RC_NV_RATE NV is rate limiting so retry -// TPM_RC_NV_UNAVAILABLE NV is not available -static TPM_RC -NvWriteNvIndexAttributes( - NV_REF locator, // IN: location of the index - TPMA_NV attributes // IN: attributes to write - ) -{ - return NvConditionallyWrite( - locator + offsetof(NV_INDEX, publicArea.attributes), - sizeof(TPMA_NV), - &attributes); -} - -//*** NvWriteRamIndexAttributes() -// This function is used to write the index attributes into an unaligned structure -static void -NvWriteRamIndexAttributes( - NV_RAM_REF ref, // IN: address of the header - TPMA_NV attributes // IN: the attributes to write - ) -{ - MemoryCopy(ref + offsetof(NV_RAM_HEADER, attributes), &attributes, - sizeof(TPMA_NV)); - return; -} - -//************************************************ -//** Externally Accessible Functions -//************************************************ - -//*** NvIsPlatformPersistentHandle() -// This function indicates if a handle references a persistent object in the -// range belonging to the platform. -// Return Type: BOOL -// TRUE(1) handle references a platform persistent object -// and may reference an owner persistent object either -// FALSE(0) handle does not reference platform persistent object -BOOL -NvIsPlatformPersistentHandle( - TPM_HANDLE handle // IN: handle - ) -{ - return (handle >= PLATFORM_PERSISTENT && handle <= PERSISTENT_LAST); -} - -//*** NvIsOwnerPersistentHandle() -// This function indicates if a handle references a persistent object in the -// range belonging to the owner. -// Return Type: BOOL -// TRUE(1) handle is owner persistent handle -// FALSE(0) handle is not owner persistent handle and may not be -// a persistent handle at all -BOOL -NvIsOwnerPersistentHandle( - TPM_HANDLE handle // IN: handle - ) -{ - return (handle >= PERSISTENT_FIRST && handle < PLATFORM_PERSISTENT); -} - -//*** NvIndexIsAccessible() -// -// This function validates that a handle references a defined NV Index and -// that the Index is currently accessible. -// Return Type: TPM_RC -// TPM_RC_HANDLE the handle points to an undefined NV Index -// If shEnable is CLEAR, this would include an index -// created using ownerAuth. If phEnableNV is CLEAR, -// this would include and index created using -// platformAuth -// TPM_RC_NV_READLOCKED Index is present but locked for reading and command -// does not write to the index -// TPM_RC_NV_WRITELOCKED Index is present but locked for writing and command -// writes to the index -TPM_RC -NvIndexIsAccessible( - TPMI_RH_NV_INDEX handle // IN: handle - ) -{ - NV_INDEX *nvIndex = NvGetIndexInfo(handle, NULL); -// - if(nvIndex == NULL) - // If index is not found, return TPM_RC_HANDLE - return TPM_RC_HANDLE; - if(gc.shEnable == FALSE || gc.phEnableNV == FALSE) - { - // if shEnable is CLEAR, an ownerCreate NV Index should not be - // indicated as present - if(!IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, PLATFORMCREATE)) - { - if(gc.shEnable == FALSE) - return TPM_RC_HANDLE; - } - // if phEnableNV is CLEAR, a platform created Index should not - // be visible - else if(gc.phEnableNV == FALSE) - return TPM_RC_HANDLE; - } -#if 0 // Writelock test for debug - // If the Index is write locked and this is an NV Write operation... - if(IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, WRITELOCKED) - && IsWriteOperation(commandIndex)) - { - // then return a locked indication unless the command is TPM2_NV_WriteLock - if(GetCommandCode(commandIndex) != TPM_CC_NV_WriteLock) - return TPM_RC_NV_LOCKED; - return TPM_RC_SUCCESS; - } -#endif -#if 0 // Readlock Test for debug - // If the Index is read locked and this is an NV Read operation... - if(IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, READLOCKED) - && IsReadOperation(commandIndex)) - { - // then return a locked indication unless the command is TPM2_NV_ReadLock - if(GetCommandCode(commandIndex) != TPM_CC_NV_ReadLock) - return TPM_RC_NV_LOCKED; - } -#endif - // NV Index is accessible - return TPM_RC_SUCCESS; -} - -//*** NvGetEvictObject() -// This function is used to dereference an evict object handle and get a pointer -// to the object. -// Return Type: TPM_RC -// TPM_RC_HANDLE the handle does not point to an existing -// persistent object -TPM_RC -NvGetEvictObject( - TPM_HANDLE handle, // IN: handle - OBJECT *object // OUT: object data - ) -{ - NV_REF entityAddr; // offset points to the entity -// - // Find the address of evict object and copy to object - entityAddr = NvFindEvict(handle, object); - - // whether there is an error or not, make sure that the evict - // status of the object is set so that the slot will get freed on exit - // Must do this after NvFindEvict loads the object - object->attributes.evict = SET; - - // If handle is not found, return an error - if(entityAddr == 0) - return TPM_RC_HANDLE; - return TPM_RC_SUCCESS; -} - -//*** NvIndexCacheInit() -// Function to initialize the Index cache -void -NvIndexCacheInit( - void - ) -{ - s_cachedNvRef = NV_REF_INIT; - s_cachedNvRamRef = NV_RAM_REF_INIT; - s_cachedNvIndex.publicArea.nvIndex = TPM_RH_UNASSIGNED; - return; -} - - -//*** NvGetIndexData() -// This function is used to access the data in an NV Index. The data is returned -// as a byte sequence. -// -// This function requires that the NV Index be defined, and that the -// required data is within the data range. It also requires that TPMA_NV_WRITTEN -// of the Index is SET. -void -NvGetIndexData( - NV_INDEX *nvIndex, // IN: the in RAM index descriptor - NV_REF locator, // IN: where the data is located - UINT32 offset, // IN: offset of NV data - UINT16 size, // IN: number of octets of NV data to read - void *data // OUT: data buffer - ) -{ - TPMA_NV nvAttributes; -// - pAssert(nvIndex != NULL); - - nvAttributes = nvIndex->publicArea.attributes; - - pAssert(IS_ATTRIBUTE(nvAttributes, TPMA_NV, WRITTEN)); - - if(IS_ATTRIBUTE(nvAttributes, TPMA_NV, ORDERLY)) - { - // Get data from RAM buffer - NV_RAM_REF ramAddr = NvRamGetIndex(nvIndex->publicArea.nvIndex); - pAssert(ramAddr != 0 && (size <= - ((NV_RAM_HEADER *)ramAddr)->size - sizeof(NV_RAM_HEADER) - offset)); - MemoryCopy(data, ramAddr + sizeof(NV_RAM_HEADER) + offset, size); - } - else - { - // Validate that read falls within range of the index - pAssert(offset <= nvIndex->publicArea.dataSize - && size <= (nvIndex->publicArea.dataSize - offset)); - NvRead(data, locator + sizeof(NV_INDEX) + offset, size); - } - return; -} - -//*** NvHashIndexData() -// This function adds Index data to a hash. It does this in parts to avoid large stack -// buffers. -void -NvHashIndexData( - HASH_STATE *hashState, // IN: Initialized hash state - NV_INDEX *nvIndex, // IN: Index - NV_REF locator, // IN: where the data is located - UINT32 offset, // IN: starting offset - UINT16 size // IN: amount to hash -) -{ -#define BUFFER_SIZE 64 - BYTE buffer[BUFFER_SIZE]; - if (offset > nvIndex->publicArea.dataSize) - return; - // Make sure that we don't try to read off the end. - if ((offset + size) > nvIndex->publicArea.dataSize) - size = nvIndex->publicArea.dataSize - (UINT16)offset; -#if BUFFER_SIZE >= MAX_NV_INDEX_SIZE - NvGetIndexData(nvIndex, locator, offset, size, buffer); - CryptDigestUpdate(hashState, size, buffer); -#else - { - INT16 i; - UINT16 readSize; - // - for (i = size; i > 0; offset += readSize, i -= readSize) - { - readSize = (i < BUFFER_SIZE) ? i : BUFFER_SIZE; - NvGetIndexData(nvIndex, locator, offset, readSize, buffer); - CryptDigestUpdate(hashState, readSize, buffer); - } - } -#endif // BUFFER_SIZE >= MAX_NV_INDEX_SIZE -#undef BUFFER_SIZE -} - - -//*** NvGetUINT64Data() -// Get data in integer format of a bit or counter NV Index. -// -// This function requires that the NV Index is defined and that the NV Index -// previously has been written. -UINT64 -NvGetUINT64Data( - NV_INDEX *nvIndex, // IN: the in RAM index descriptor - NV_REF locator // IN: where index exists in NV - ) -{ - UINT64 intVal; -// - // Read the value and convert it to internal format - NvGetIndexData(nvIndex, locator, 0, 8, &intVal); - return BYTE_ARRAY_TO_UINT64(((BYTE *)&intVal)); -} - -//*** NvWriteIndexAttributes() -// This function is used to write just the attributes of an index. -// Return type: TPM_RC -// TPM_RC_NV_RATE NV is rate limiting so retry -// TPM_RC_NV_UNAVAILABLE NV is not available -TPM_RC -NvWriteIndexAttributes( - TPM_HANDLE handle, - NV_REF locator, // IN: location of the index - TPMA_NV attributes // IN: attributes to write - ) -{ - TPM_RC result; -// - if(IS_ATTRIBUTE(attributes, TPMA_NV, ORDERLY)) - { - NV_RAM_REF ram = NvRamGetIndex(handle); - NvWriteRamIndexAttributes(ram, attributes); - result = TPM_RC_SUCCESS; - } - else - { - result = NvWriteNvIndexAttributes(locator, attributes); - } - return result; -} - -//*** NvWriteIndexAuth() -// This function is used to write the authValue of an index. It is used by -// TPM2_NV_ChangeAuth() -// Return type: TPM_RC -// TPM_RC_NV_RATE NV is rate limiting so retry -// TPM_RC_NV_UNAVAILABLE NV is not available -TPM_RC -NvWriteIndexAuth( - NV_REF locator, // IN: location of the index - TPM2B_AUTH *authValue // IN: the authValue to write - ) -{ - TPM_RC result; -// - // If the locator is pointing to the cached index value... - if(locator == s_cachedNvRef) - { - // copy the authValue to the cached index so it will be there if we - // look for it. This is a safety thing. - MemoryCopy2B(&s_cachedNvIndex.authValue.b, &authValue->b, - sizeof(s_cachedNvIndex.authValue.t.buffer)); - } - result = NvConditionallyWrite( - locator + offsetof(NV_INDEX, authValue), - sizeof(UINT16) + authValue->t.size, - authValue); - return result; -} - -//*** NvGetIndexInfo() -// This function loads the nvIndex Info into the NV cache and returns a pointer -// to the NV_INDEX. If the returned value is zero, the index was not found. -// The 'locator' parameter, if not NULL, will be set to the offset in NV of the -// Index (the location of the handle of the Index). -// -// This function will set the index cache. If the index is orderly, the attributes -// from RAM are substituted for the attributes in the cached index -NV_INDEX * -NvGetIndexInfo( - TPM_HANDLE nvHandle, // IN: the index handle - NV_REF *locator // OUT: location of the index - ) -{ - if(s_cachedNvIndex.publicArea.nvIndex != nvHandle) - { - s_cachedNvIndex.publicArea.nvIndex = TPM_RH_UNASSIGNED; - s_cachedNvRamRef = 0; - s_cachedNvRef = NvFindHandle(nvHandle); - if(s_cachedNvRef == 0) - return NULL; - NvReadNvIndexInfo(s_cachedNvRef, &s_cachedNvIndex); - if(IS_ATTRIBUTE(s_cachedNvIndex.publicArea.attributes, TPMA_NV, ORDERLY)) - { - s_cachedNvRamRef = NvRamGetIndex(nvHandle); - s_cachedNvIndex.publicArea.attributes = - NvReadRamIndexAttributes(s_cachedNvRamRef); - } - } - if(locator != NULL) - *locator = s_cachedNvRef; - return &s_cachedNvIndex; -} - -//*** NvWriteIndexData() -// This function is used to write NV index data. It is intended to be used to -// update the data associated with the default index. -// -// This function requires that the NV Index is defined, and the data is -// within the defined data range for the index. -// -// Index data is only written due to a command that modifies the data in a single -// index. There is no case where changes are made to multiple indexes data at the -// same time. Multiple attributes may be change but not multiple index data. This -// is important because we will normally be handling the index for which we have -// the cached pointer values. -// Return type: TPM_RC -// TPM_RC_NV_RATE NV is rate limiting so retry -// TPM_RC_NV_UNAVAILABLE NV is not available -TPM_RC -NvWriteIndexData( - NV_INDEX *nvIndex, // IN: the description of the index - UINT32 offset, // IN: offset of NV data - UINT32 size, // IN: size of NV data - void *data // IN: data buffer - ) -{ - TPM_RC result = TPM_RC_SUCCESS; -// - pAssert(nvIndex != NULL); - // Make sure that this is dealing with the 'default' index. - // Note: it is tempting to change the calling sequence so that the 'default' is - // presumed. - pAssert(nvIndex->publicArea.nvIndex == s_cachedNvIndex.publicArea.nvIndex); - - // Validate that write falls within range of the index - pAssert(offset <= nvIndex->publicArea.dataSize - && size <= (nvIndex->publicArea.dataSize - offset)); - - // Update TPMA_NV_WRITTEN bit if necessary - if(!IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, WRITTEN)) - { - // Update the in memory version of the attributes - SET_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, WRITTEN); - - // If this is not orderly, then update the NV version of - // the attributes - if(!IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, ORDERLY)) - { - result = NvWriteNvIndexAttributes(s_cachedNvRef, - nvIndex->publicArea.attributes); - if(result != TPM_RC_SUCCESS) - return result; - // If this is a partial write of an ordinary index, clear the whole - // index. - if(IsNvOrdinaryIndex(nvIndex->publicArea.attributes) - && (nvIndex->publicArea.dataSize > size)) - _plat__NvMemoryClear(s_cachedNvRef + sizeof(NV_INDEX), - nvIndex->publicArea.dataSize); - } - else - { - // This is orderly so update the RAM version - MemoryCopy(s_cachedNvRamRef + offsetof(NV_RAM_HEADER, attributes), - &nvIndex->publicArea.attributes, sizeof(TPMA_NV)); - // If setting WRITTEN for an orderly counter, make sure that the - // state saved version of the counter is saved - if(IsNvCounterIndex(nvIndex->publicArea.attributes)) - SET_NV_UPDATE(UT_ORDERLY); - // If setting the written attribute on an ordinary index, make sure that - // the data is all cleared out in case there is a partial write. This - // is only necessary for ordinary indexes because all of the other types - // are always written in total. - else if(IsNvOrdinaryIndex(nvIndex->publicArea.attributes)) - MemorySet(s_cachedNvRamRef + sizeof(NV_RAM_HEADER), - 0, nvIndex->publicArea.dataSize); - } - } - // If this is orderly data, write it to RAM - if(IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, ORDERLY)) - { - // Note: if this is the first write to a counter, the code above will queue - // the write to NV of the RAM data in order to update TPMA_NV_WRITTEN. In - // process of doing that write, it will also write the initial counter value - - // Update RAM - MemoryCopy(s_cachedNvRamRef + sizeof(NV_RAM_HEADER) + offset, data, size); - - // And indicate that the TPM is no longer orderly - g_clearOrderly = TRUE; - } - else - { - // Offset into the index to the first byte of the data to be written to NV - result = NvConditionallyWrite(s_cachedNvRef + sizeof(NV_INDEX) + offset, - size, data); - } - return result; -} - -//*** NvWriteUINT64Data() -// This function to write back a UINT64 value. The various UINT64 values (bits, -// counters, and PINs) are kept in canonical format but manipulate in native -// format. This takes a native format value converts it and saves it back as -// in canonical format. -// -// This function will return the value from NV or RAM depending on the type of the -// index (orderly or not) -// -TPM_RC -NvWriteUINT64Data( - NV_INDEX *nvIndex, // IN: the description of the index - UINT64 intValue // IN: the value to write - ) -{ - BYTE bytes[8]; - UINT64_TO_BYTE_ARRAY(intValue, bytes); -// - return NvWriteIndexData(nvIndex, 0, 8, &bytes); -} - -//*** NvGetIndexName() -// This function computes the Name of an index -// The 'name' buffer receives the bytes of the Name and the return value -// is the number of octets in the Name. -// -// This function requires that the NV Index is defined. -TPM2B_NAME * -NvGetIndexName( - NV_INDEX *nvIndex, // IN: the index over which the name is to be - // computed - TPM2B_NAME *name // OUT: name of the index - ) -{ - UINT16 dataSize, digestSize; - BYTE marshalBuffer[sizeof(TPMS_NV_PUBLIC)]; - BYTE *buffer; - HASH_STATE hashState; -// - // Marshal public area - buffer = marshalBuffer; - dataSize = TPMS_NV_PUBLIC_Marshal(&nvIndex->publicArea, &buffer, NULL); - - // hash public area - digestSize = CryptHashStart(&hashState, nvIndex->publicArea.nameAlg); - CryptDigestUpdate(&hashState, dataSize, marshalBuffer); - - // Complete digest leaving room for the nameAlg - CryptHashEnd(&hashState, digestSize, &name->b.buffer[2]); - - // Include the nameAlg - UINT16_TO_BYTE_ARRAY(nvIndex->publicArea.nameAlg, name->b.buffer); - name->t.size = digestSize + 2; - return name; -} - -//*** NvGetNameByIndexHandle() -// This function is used to compute the Name of an NV Index referenced by handle. -// -// The 'name' buffer receives the bytes of the Name and the return value -// is the number of octets in the Name. -// -// This function requires that the NV Index is defined. -TPM2B_NAME * -NvGetNameByIndexHandle( - TPMI_RH_NV_INDEX handle, // IN: handle of the index - TPM2B_NAME *name // OUT: name of the index - ) -{ - NV_INDEX *nvIndex = NvGetIndexInfo(handle, NULL); -// - return NvGetIndexName(nvIndex, name); -} - -//*** NvDefineIndex() -// This function is used to assign NV memory to an NV Index. -// -// Return Type: TPM_RC -// TPM_RC_NV_SPACE insufficient NV space -TPM_RC -NvDefineIndex( - TPMS_NV_PUBLIC *publicArea, // IN: A template for an area to create. - TPM2B_AUTH *authValue // IN: The initial authorization value - ) -{ - // The buffer to be written to NV memory - NV_INDEX nvIndex; // the index data - UINT16 entrySize; // size of entry - TPM_RC result; -// - entrySize = sizeof(NV_INDEX); - - // only allocate data space for indexes that are going to be written to NV. - // Orderly indexes don't need space. - if(!IS_ATTRIBUTE(publicArea->attributes, TPMA_NV, ORDERLY)) - entrySize += publicArea->dataSize; - // Check if we have enough space to create the NV Index - // In this implementation, the only resource limitation is the available NV - // space (and possibly RAM space.) Other implementation may have other - // limitation on counter or on NV slots - if(!NvTestSpace(entrySize, TRUE, IsNvCounterIndex(publicArea->attributes))) - return TPM_RC_NV_SPACE; - - // if the index to be defined is RAM backed, check RAM space availability - // as well - if(IS_ATTRIBUTE(publicArea->attributes, TPMA_NV, ORDERLY) - && !NvRamTestSpaceIndex(publicArea->dataSize)) - return TPM_RC_NV_SPACE; - // Copy input value to nvBuffer - nvIndex.publicArea = *publicArea; - - // Copy the authValue - nvIndex.authValue = *authValue; - - // Add index to NV memory - result = NvAdd(entrySize, sizeof(NV_INDEX), TPM_RH_UNASSIGNED, - (BYTE *)&nvIndex); - if(result == TPM_RC_SUCCESS) - { - // If the data of NV Index is RAM backed, add the data area in RAM as well - if(IS_ATTRIBUTE(publicArea->attributes, TPMA_NV, ORDERLY)) - NvAddRAM(publicArea); - } - return result; -} - -//*** NvAddEvictObject() -// This function is used to assign NV memory to a persistent object. -// Return Type: TPM_RC -// TPM_RC_NV_HANDLE the requested handle is already in use -// TPM_RC_NV_SPACE insufficient NV space -TPM_RC -NvAddEvictObject( - TPMI_DH_OBJECT evictHandle, // IN: new evict handle - OBJECT *object // IN: object to be added - ) -{ - TPM_HANDLE temp = object->evictHandle; - TPM_RC result; -// - // Check if we have enough space to add the evict object - // An evict object needs 8 bytes in index table + sizeof OBJECT - // In this implementation, the only resource limitation is the available NV - // space. Other implementation may have other limitation on evict object - // handle space - if(!NvTestSpace(sizeof(OBJECT) + sizeof(TPM_HANDLE), FALSE, FALSE)) - return TPM_RC_NV_SPACE; - - // Set evict attribute and handle - object->attributes.evict = SET; - object->evictHandle = evictHandle; - - // Now put this in NV - result = NvAdd(sizeof(OBJECT), sizeof(OBJECT), evictHandle, (BYTE *)object); - - // Put things back the way they were - object->attributes.evict = CLEAR; - object->evictHandle = temp; - - return result; -} - -//*** NvDeleteIndex() -// This function is used to delete an NV Index. -// Return Type: TPM_RC -// TPM_RC_NV_UNAVAILABLE NV is not accessible -// TPM_RC_NV_RATE NV is rate limiting -TPM_RC -NvDeleteIndex( - NV_INDEX *nvIndex, // IN: an in RAM index descriptor - NV_REF entityAddr // IN: location in NV - ) -{ - TPM_RC result; -// - if(nvIndex != NULL) - { - // Whenever a counter is deleted, make sure that the MaxCounter value is - // updated to reflect the value - if(IsNvCounterIndex(nvIndex->publicArea.attributes) - && IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, WRITTEN)) - NvUpdateMaxCount(NvGetUINT64Data(nvIndex, entityAddr)); - result = NvDelete(entityAddr); - if(result != TPM_RC_SUCCESS) - return result; - // If the NV Index is RAM backed, delete the RAM data as well - if(IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, ORDERLY)) - NvDeleteRAM(nvIndex->publicArea.nvIndex); - NvIndexCacheInit(); - } - return TPM_RC_SUCCESS; -} - -//*** NvDeleteEvict() -// This function will delete a NV evict object. -// Will return success if object deleted or if it does not exist - -TPM_RC -NvDeleteEvict( - TPM_HANDLE handle // IN: handle of entity to be deleted - ) -{ - NV_REF entityAddr = NvFindEvict(handle, NULL); // pointer to entity - TPM_RC result = TPM_RC_SUCCESS; -// - if(entityAddr != 0) - result = NvDelete(entityAddr); - return result; -} - -//*** NvFlushHierarchy() -// This function will delete persistent objects belonging to the indicated hierarchy. -// If the storage hierarchy is selected, the function will also delete any -// NV Index defined using ownerAuth. -// Return Type: TPM_RC -// TPM_RC_NV_RATE NV is unavailable because of rate limit -// TPM_RC_NV_UNAVAILABLE NV is inaccessible -TPM_RC -NvFlushHierarchy( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy to be flushed. - ) -{ - NV_REF iter = NV_REF_INIT; - NV_REF currentAddr; - TPM_HANDLE entityHandle; - TPM_RC result = TPM_RC_SUCCESS; -// - while((currentAddr = NvNext(&iter, &entityHandle)) != 0) - { - if(HandleGetType(entityHandle) == TPM_HT_NV_INDEX) - { - NV_INDEX nvIndex; -// - // If flush endorsement or platform hierarchy, no NV Index would be - // flushed - if(hierarchy == TPM_RH_ENDORSEMENT || hierarchy == TPM_RH_PLATFORM) - continue; - // Get the index information - NvReadNvIndexInfo(currentAddr, &nvIndex); - - // For storage hierarchy, flush OwnerCreated index - if(!IS_ATTRIBUTE(nvIndex.publicArea.attributes, TPMA_NV, - PLATFORMCREATE)) - { - // Delete the index (including RAM for orderly) - result = NvDeleteIndex(&nvIndex, currentAddr); - if(result != TPM_RC_SUCCESS) - break; - // Re-iterate from beginning after a delete - iter = NV_REF_INIT; - } - } - else if(HandleGetType(entityHandle) == TPM_HT_PERSISTENT) - { - OBJECT_ATTRIBUTES attributes; -// - NvRead(&attributes, - (UINT32)(currentAddr - + sizeof(TPM_HANDLE) - + offsetof(OBJECT, attributes)), - sizeof(OBJECT_ATTRIBUTES)); - // If the evict object belongs to the hierarchy to be flushed... - if((hierarchy == TPM_RH_PLATFORM && attributes.ppsHierarchy == SET) - || (hierarchy == TPM_RH_OWNER && attributes.spsHierarchy == SET) - || (hierarchy == TPM_RH_ENDORSEMENT - && attributes.epsHierarchy == SET)) - { - // ...then delete the evict object - result = NvDelete(currentAddr); - if(result != TPM_RC_SUCCESS) - break; - // Re-iterate from beginning after a delete - iter = NV_REF_INIT; - } - } - else - { - FAIL(FATAL_ERROR_INTERNAL); - } - } - return result; -} - -//*** NvSetGlobalLock() -// This function is used to SET the TPMA_NV_WRITELOCKED attribute for all -// NV indexes that have TPMA_NV_GLOBALLOCK SET. This function is use by -// TPM2_NV_GlobalWriteLock(). -// Return Type: TPM_RC -// TPM_RC_NV_RATE NV is unavailable because of rate limit -// TPM_RC_NV_UNAVAILABLE NV is inaccessible -TPM_RC -NvSetGlobalLock( - void - ) -{ - NV_REF iter = NV_REF_INIT; - NV_RAM_REF ramIter = NV_RAM_REF_INIT; - NV_REF currentAddr; - NV_RAM_REF currentRamAddr; - TPM_RC result = TPM_RC_SUCCESS; -// - // Check all normal indexes - while((currentAddr = NvNextIndex(NULL, &iter)) != 0) - { - TPMA_NV attributes = NvReadNvIndexAttributes(currentAddr); -// - // See if it should be locked - if(!IS_ATTRIBUTE(attributes, TPMA_NV, ORDERLY) - && IS_ATTRIBUTE(attributes, TPMA_NV, GLOBALLOCK)) - { - SET_ATTRIBUTE(attributes, TPMA_NV, WRITELOCKED); - result = NvWriteNvIndexAttributes(currentAddr, attributes); - if(result != TPM_RC_SUCCESS) - return result; - } - } - // Now search all the orderly attributes - while((currentRamAddr = NvRamNext(&ramIter, NULL)) != 0) - { - // See if it should be locked - TPMA_NV attributes = NvReadRamIndexAttributes(currentRamAddr); - if(IS_ATTRIBUTE(attributes, TPMA_NV, GLOBALLOCK)) - { - SET_ATTRIBUTE(attributes, TPMA_NV, WRITELOCKED); - NvWriteRamIndexAttributes(currentRamAddr, attributes); - } - } - return result; -} - -//***InsertSort() -// Sort a handle into handle list in ascending order. The total handle number in -// the list should not exceed MAX_CAP_HANDLES -static void -InsertSort( - TPML_HANDLE *handleList, // IN/OUT: sorted handle list - UINT32 count, // IN: maximum count in the handle list - TPM_HANDLE entityHandle // IN: handle to be inserted - ) -{ - UINT32 i, j; - UINT32 originalCount; -// - // For a corner case that the maximum count is 0, do nothing - if(count == 0) - return; - // For empty list, add the handle at the beginning and return - if(handleList->count == 0) - { - handleList->handle[0] = entityHandle; - handleList->count++; - return; - } - // Check if the maximum of the list has been reached - originalCount = handleList->count; - if(originalCount < count) - handleList->count++; - // Insert the handle to the list - for(i = 0; i < originalCount; i++) - { - if(handleList->handle[i] > entityHandle) - { - for(j = handleList->count - 1; j > i; j--) - { - handleList->handle[j] = handleList->handle[j - 1]; - } - break; - } - } - // If a slot was found, insert the handle in this position - if(i < originalCount || handleList->count > originalCount) - handleList->handle[i] = entityHandle; - return; -} - -//*** NvCapGetPersistent() -// This function is used to get a list of handles of the persistent objects, -// starting at 'handle'. -// -// 'Handle' must be in valid persistent object handle range, but does not -// have to reference an existing persistent object. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -NvCapGetPersistent( - TPMI_DH_OBJECT handle, // IN: start handle - UINT32 count, // IN: maximum number of returned handles - TPML_HANDLE *handleList // OUT: list of handle - ) -{ - TPMI_YES_NO more = NO; - NV_REF iter = NV_REF_INIT; - NV_REF currentAddr; - TPM_HANDLE entityHandle; -// - pAssert(HandleGetType(handle) == TPM_HT_PERSISTENT); - - // Initialize output handle list - handleList->count = 0; - - // The maximum count of handles we may return is MAX_CAP_HANDLES - if(count > MAX_CAP_HANDLES) count = MAX_CAP_HANDLES; - - while((currentAddr = NvNextEvict(&entityHandle, &iter)) != 0) - { - // Ignore persistent handles that have values less than the input handle - if(entityHandle < handle) - continue; - // if the handles in the list have reached the requested count, and there - // are still handles need to be inserted, indicate that there are more. - if(handleList->count == count) - more = YES; - // A handle with a value larger than start handle is a candidate - // for return. Insert sort it to the return list. Insert sort algorithm - // is chosen here for simplicity based on the assumption that the total - // number of NV indexes is small. For an implementation that may allow - // large number of NV indexes, a more efficient sorting algorithm may be - // used here. - InsertSort(handleList, count, entityHandle); - } - return more; -} - -//*** NvCapGetIndex() -// This function returns a list of handles of NV indexes, starting from 'handle'. -// 'Handle' must be in the range of NV indexes, but does not have to reference -// an existing NV Index. -// Return Type: TPMI_YES_NO -// YES if there are more handles to report -// NO all the available handles has been reported -TPMI_YES_NO -NvCapGetIndex( - TPMI_DH_OBJECT handle, // IN: start handle - UINT32 count, // IN: max number of returned handles - TPML_HANDLE *handleList // OUT: list of handle - ) -{ - TPMI_YES_NO more = NO; - NV_REF iter = NV_REF_INIT; - NV_REF currentAddr; - TPM_HANDLE nvHandle; -// - pAssert(HandleGetType(handle) == TPM_HT_NV_INDEX); - - // Initialize output handle list - handleList->count = 0; - - // The maximum count of handles we may return is MAX_CAP_HANDLES - if(count > MAX_CAP_HANDLES) count = MAX_CAP_HANDLES; - - while((currentAddr = NvNextIndex(&nvHandle, &iter)) != 0) - { - // Ignore index handles that have values less than the 'handle' - if(nvHandle < handle) - continue; - // if the count of handles in the list has reached the requested count, - // and there are still handles to report, set more. - if(handleList->count == count) - more = YES; - // A handle with a value larger than start handle is a candidate - // for return. Insert sort it to the return list. Insert sort algorithm - // is chosen here for simplicity based on the assumption that the total - // number of NV indexes is small. For an implementation that may allow - // large number of NV indexes, a more efficient sorting algorithm may be - // used here. - InsertSort(handleList, count, nvHandle); - } - return more; -} - -//*** NvCapGetIndexNumber() -// This function returns the count of NV Indexes currently defined. -UINT32 -NvCapGetIndexNumber( - void - ) -{ - UINT32 num = 0; - NV_REF iter = NV_REF_INIT; -// - while(NvNextIndex(NULL, &iter) != 0) - num++; - return num; -} - -//*** NvCapGetPersistentNumber() -// Function returns the count of persistent objects currently in NV memory. -UINT32 -NvCapGetPersistentNumber( - void - ) -{ - UINT32 num = 0; - NV_REF iter = NV_REF_INIT; - TPM_HANDLE handle; -// - while(NvNextEvict(&handle, &iter) != 0) - num++; - return num; -} - -//*** NvCapGetPersistentAvail() -// This function returns an estimate of the number of additional persistent -// objects that could be loaded into NV memory. -UINT32 -NvCapGetPersistentAvail( - void - ) -{ - UINT32 availNVSpace; - UINT32 counterNum = NvCapGetCounterNumber(); - UINT32 reserved = sizeof(NV_LIST_TERMINATOR); -// - // Get the available space in NV storage - availNVSpace = NvGetFreeBytes(); - - if(counterNum < MIN_COUNTER_INDICES) - { - // Some space has to be reserved for counter objects. - reserved += (MIN_COUNTER_INDICES - counterNum) * NV_INDEX_COUNTER_SIZE; - if(reserved > availNVSpace) - availNVSpace = 0; - else - availNVSpace -= reserved; - } - return availNVSpace / NV_EVICT_OBJECT_SIZE; -} - -//*** NvCapGetCounterNumber() -// Get the number of defined NV Indexes that are counter indexes. -UINT32 -NvCapGetCounterNumber( - void - ) -{ - NV_REF iter = NV_REF_INIT; - NV_REF currentAddr; - UINT32 num = 0; -// - while((currentAddr = NvNextIndex(NULL, &iter)) != 0) - { - TPMA_NV attributes = NvReadNvIndexAttributes(currentAddr); - if(IsNvCounterIndex(attributes)) - num++; - } - return num; -} - -//*** NvSetStartupAttributes() -// Local function to set the attributes of an Index at TPM Reset and TPM Restart. -static TPMA_NV -NvSetStartupAttributes( - TPMA_NV attributes, // IN: attributes to change - STARTUP_TYPE type // IN: start up type - ) -{ - // Clear read lock - CLEAR_ATTRIBUTE(attributes, TPMA_NV, READLOCKED); - - // Will change a non counter index to the unwritten state if: - // a) TPMA_NV_CLEAR_STCLEAR is SET - // b) orderly and TPM Reset - if(!IsNvCounterIndex(attributes)) - { - if(IS_ATTRIBUTE(attributes, TPMA_NV, CLEAR_STCLEAR) - || (IS_ATTRIBUTE(attributes, TPMA_NV, ORDERLY) - && (type == SU_RESET))) - CLEAR_ATTRIBUTE(attributes, TPMA_NV, WRITTEN); - } - // Unlock any index that is not written or that does not have - // TPMA_NV_WRITEDEFINE SET. - if(!IS_ATTRIBUTE(attributes, TPMA_NV, WRITTEN) - || !IS_ATTRIBUTE(attributes, TPMA_NV, WRITEDEFINE)) - CLEAR_ATTRIBUTE(attributes, TPMA_NV, WRITELOCKED); - return attributes; -} - -//*** NvEntityStartup() -// This function is called at TPM_Startup(). If the startup completes -// a TPM Resume cycle, no action is taken. If the startup is a TPM Reset -// or a TPM Restart, then this function will: -// 1. clear read/write lock; -// 2. reset NV Index data that has TPMA_NV_CLEAR_STCLEAR SET; and -// 3. set the lower bits in orderly counters to 1 for a non-orderly startup -// -// It is a prerequisite that NV be available for writing before this -// function is called. -BOOL -NvEntityStartup( - STARTUP_TYPE type // IN: start up type - ) -{ - NV_REF iter = NV_REF_INIT; - NV_RAM_REF ramIter = NV_RAM_REF_INIT; - NV_REF currentAddr; // offset points to the current entity - NV_RAM_REF currentRamAddr; - TPM_HANDLE nvHandle; - TPMA_NV attributes; -// - // Restore RAM index data - NvRead(s_indexOrderlyRam, NV_INDEX_RAM_DATA, sizeof(s_indexOrderlyRam)); - - // Initialize the max NV counter value - NvSetMaxCount(NvGetMaxCount()); - - // If recovering from state save, do nothing else - if(type == SU_RESUME) - return TRUE; - // Iterate all the NV Index to clear the locks - while((currentAddr = NvNextIndex(&nvHandle, &iter)) != 0) - { - attributes = NvReadNvIndexAttributes(currentAddr); - - // If this is an orderly index, defer processing until loop below - if(IS_ATTRIBUTE(attributes, TPMA_NV, ORDERLY)) - continue; - // Set the attributes appropriate for this startup type - attributes = NvSetStartupAttributes(attributes, type); - NvWriteNvIndexAttributes(currentAddr, attributes); - } - // Iterate all the orderly indexes to clear the locks and initialize counters - while((currentRamAddr = NvRamNext(&ramIter, NULL)) != 0) - { - attributes = NvReadRamIndexAttributes(currentRamAddr); - - attributes = NvSetStartupAttributes(attributes, type); - - // update attributes in RAM - NvWriteRamIndexAttributes(currentRamAddr, attributes); - - // Set the lower bits in an orderly counter to 1 for a non-orderly startup - if(IsNvCounterIndex(attributes) - && (g_prevOrderlyState == SU_NONE_VALUE)) - { - UINT64 counter; -// - // Read the counter value last saved to NV. - counter = BYTE_ARRAY_TO_UINT64(currentRamAddr + sizeof(NV_RAM_HEADER)); - - // Set the lower bits of counter to 1's - counter |= MAX_ORDERLY_COUNT; - - // Write back to RAM - // NOTE: Do not want to force a write to NV here. The counter value will - // stay in RAM until the next shutdown or rollover. - UINT64_TO_BYTE_ARRAY(counter, currentRamAddr + sizeof(NV_RAM_HEADER)); - } - } - return TRUE; -} - -//*** NvCapGetCounterAvail() -// This function returns an estimate of the number of additional counter type -// NV indexes that can be defined. -UINT32 -NvCapGetCounterAvail( - void - ) -{ - UINT32 availNVSpace; - UINT32 availRAMSpace; - UINT32 persistentNum = NvCapGetPersistentNumber(); - UINT32 reserved = sizeof(NV_LIST_TERMINATOR); -// - // Get the available space in NV storage - availNVSpace = NvGetFreeBytes(); - - if(persistentNum < MIN_EVICT_OBJECTS) - { - // Some space has to be reserved for evict object. Adjust availNVSpace. - reserved += (MIN_EVICT_OBJECTS - persistentNum) * NV_EVICT_OBJECT_SIZE; - if(reserved > availNVSpace) - availNVSpace = 0; - else - availNVSpace -= reserved; - } - // Compute the available space in RAM - availRAMSpace = (int)(RAM_ORDERLY_END - NvRamGetEnd()); - - // Return the min of counter number in NV and in RAM - if(availNVSpace / NV_INDEX_COUNTER_SIZE - > availRAMSpace / NV_RAM_INDEX_COUNTER_SIZE) - return availRAMSpace / NV_RAM_INDEX_COUNTER_SIZE; - else - return availNVSpace / NV_INDEX_COUNTER_SIZE; -} - -//*** NvFindHandle() -// this function returns the offset in NV memory of the entity associated -// with the input handle. A value of zero indicates that handle does not -// exist reference an existing persistent object or defined NV Index. -NV_REF -NvFindHandle( - TPM_HANDLE handle - ) -{ - NV_REF addr; - NV_REF iter = NV_REF_INIT; - TPM_HANDLE nextHandle; -// - while((addr = NvNext(&iter, &nextHandle)) != 0) - { - if(nextHandle == handle) - break; - } - return addr; -} - -//** NV Max Counter -//*** Introduction -// The TPM keeps track of the highest value of a deleted counter index. When an -// index is deleted, this value is updated if the deleted counter index is greater -// than the previous value. When a new index is created and first incremented, it -// will get a value that is at least one greater than any other index than any -// previously deleted index. This insures that it is not possible to roll back an -// index. -// -// The highest counter value is keep in NV in a special end-of-list marker. This -// marker is only updated when an index is deleted. Otherwise it just moves. -// -// When the TPM starts up, it searches NV for the end of list marker and initializes -// an in memory value (s_maxCounter). - -//*** NvReadMaxCount() -// This function returns the max NV counter value. -// -UINT64 -NvReadMaxCount( - void - ) -{ - return s_maxCounter; -} - -//*** NvUpdateMaxCount() -// This function updates the max counter value to NV memory. This is just staging -// for the actual write that will occur when the NV index memory is modified. -// -void -NvUpdateMaxCount( - UINT64 count - ) -{ - if(count > s_maxCounter) - s_maxCounter = count; -} - -//*** NvSetMaxCount() -// This function is used at NV initialization time to set the initial value of -// the maximum counter. -void -NvSetMaxCount( - UINT64 value - ) -{ - s_maxCounter = value; -} - -//*** NvGetMaxCount() -// Function to get the NV max counter value from the end-of-list marker -UINT64 -NvGetMaxCount( - void - ) -{ - NV_REF iter = NV_REF_INIT; - NV_REF currentAddr; - UINT64 maxCount; -// - // Find the end of list marker and initialize the NV Max Counter value. - while((currentAddr = NvNext(&iter, NULL )) != 0); - // 'iter' should be pointing at the end of list marker so read in the current - // value of the s_maxCounter. - NvRead(&maxCount, iter + sizeof(UINT32), sizeof(maxCount)); - - return maxCount; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/NvReserved.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/NvReserved.c deleted file mode 100644 index 41a789512..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/NvReserved.c +++ /dev/null @@ -1,263 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction - -// The NV memory is divided into two areas: dynamic space for user defined NV -// Indices and evict objects, and reserved space for TPM persistent and state save -// data. -// -// The entries in dynamic space are a linked list of entries. Each entry has, as its -// first field, a size. If the size field is zero, it marks the end of the -// list. -// -// An allocation of an Index or evict object may use almost all of the remaining -// NV space such that the size field will not fit. The functions that search the -// list are aware of this and will terminate the search if they either find a zero -// size or recognize that there is insufficient space for the size field. -// -// An Index allocation will contain an NV_INDEX structure. If the Index does not -// have the orderly attribute, the NV_INDEX is followed immediately by the NV data. -// -// An evict object entry contains a handle followed by an OBJECT structure. This -// results in both the Index and Evict Object having an identifying handle as the -// first field following the size field. -// -// When an Index has the orderly attribute, the data is kept in RAM. This RAM is -// saved to backing store in NV memory on any orderly shutdown. The entries in -// orderly memory are also a linked list using a size field as the first entry. As -// with the NV memory, the list is terminated by a zero size field or when the last -// entry leaves insufficient space for the terminating size field. -// -// The attributes of an orderly index are maintained in RAM memory in order to -// reduce the number of NV writes needed for orderly data. When an orderly index -// is created, an entry is made in the dynamic NV memory space that holds the Index -// authorizations (authPolicy and authValue) and the size of the data. This entry is -// only modified if the authValue of the index is changed. The more volatile data -// of the index is kept in RAM. When an orderly Index is created or deleted, the -// RAM data is copied to NV backing store so that the image in the backing store -// matches the layout of RAM. In normal operation. The RAM data is also copied on -// any orderly shutdown. In normal operation, the only other reason for writing -// to the backing store for RAM is when a counter is first written (TPMA_NV_WRITTEN -// changes from CLEAR to SET) or when a counter "rolls over." -// -// Static space contains items that are individually modifiable. The values are in -// the 'gp' PERSISTEND_DATA structure in RAM and mapped to locations in NV. -// - -//** Includes, Defines -#define NV_C -#include "Tpm.h" - -//************************************************ -//** Functions -//************************************************ - - -//*** NvInitStatic() -// This function initializes the static variables used in the NV subsystem. -static void -NvInitStatic( - void - ) -{ - // In some implementations, the end of NV is variable and is set at boot time. - // This value will be the same for each boot, but is not necessarily known - // at compile time. - s_evictNvEnd = (NV_REF)NV_MEMORY_SIZE; - return; -} - -//*** NvCheckState() -// Function to check the NV state by accessing the platform-specific function -// to get the NV state. The result state is registered in s_NvIsAvailable -// that will be reported by NvIsAvailable. -// -// This function is called at the beginning of ExecuteCommand before any potential -// check of g_NvStatus. -void -NvCheckState( - void - ) -{ - int func_return; -// - func_return = _plat__IsNvAvailable(); - if(func_return == 0) - g_NvStatus = TPM_RC_SUCCESS; - else if(func_return == 1) - g_NvStatus = TPM_RC_NV_UNAVAILABLE; - else - g_NvStatus = TPM_RC_NV_RATE; - return; -} - -//*** NvCommit -// This is a wrapper for the platform function to commit pending NV writes. -BOOL -NvCommit( - void - ) -{ - return (_plat__NvCommit() == 0); -} - -//*** NvPowerOn() -// This function is called at _TPM_Init to initialize the NV environment. -// Return Type: BOOL -// TRUE(1) all NV was initialized -// FALSE(0) the NV containing saved state had an error and -// TPM2_Startup(CLEAR) is required -BOOL -NvPowerOn( - void - ) -{ - int nvError = 0; - // If power was lost, need to re-establish the RAM data that is loaded from - // NV and initialize the static variables - if(g_powerWasLost) - { - if((nvError = _plat__NVEnable(0)) < 0) - FAIL(FATAL_ERROR_NV_UNRECOVERABLE); - NvInitStatic(); - } - return nvError == 0; -} - -//*** NvManufacture() -// This function initializes the NV system at pre-install time. -// -// This function should only be called in a manufacturing environment or in a -// simulation. -// -// The layout of NV memory space is an implementation choice. -void -NvManufacture( - void - ) -{ -#if SIMULATION - // Simulate the NV memory being in the erased state. - _plat__NvMemoryClear(0, NV_MEMORY_SIZE); -#endif - // Initialize static variables - NvInitStatic(); - // Clear the RAM used for Orderly Index data - MemorySet(s_indexOrderlyRam, 0, RAM_INDEX_SPACE); - // Write that Orderly Index data to NV - NvUpdateIndexOrderlyData(); - // Initialize the next offset of the first entry in evict/index list to 0 (the - // end of list marker) and the initial s_maxCounterValue; - NvSetMaxCount(0); - // Put the end of list marker at the end of memory. This contains the MaxCount - // value as well as the end marker. - NvWriteNvListEnd(NV_USER_DYNAMIC); - return; -} - -//*** NvRead() -// This function is used to move reserved data from NV memory to RAM. -void -NvRead( - void *outBuffer, // OUT: buffer to receive data - UINT32 nvOffset, // IN: offset in NV of value - UINT32 size // IN: size of the value to read - ) -{ - // Input type should be valid - pAssert(nvOffset + size < NV_MEMORY_SIZE); - _plat__NvMemoryRead(nvOffset, size, outBuffer); - return; -} - -//*** NvWrite() -// This function is used to post reserved data for writing to NV memory. Before -// the TPM completes the operation, the value will be written. -BOOL -NvWrite( - UINT32 nvOffset, // IN: location in NV to receive data - UINT32 size, // IN: size of the data to move - void *inBuffer // IN: location containing data to write - ) -{ - // Input type should be valid - if(nvOffset + size <= NV_MEMORY_SIZE) - { - // Set the flag that a NV write happened - SET_NV_UPDATE(UT_NV); - return _plat__NvMemoryWrite(nvOffset, size, inBuffer); - } - return FALSE; -} - -//*** NvUpdatePersistent() -// This function is used to update a value in the PERSISTENT_DATA structure and -// commits the value to NV. -void -NvUpdatePersistent( - UINT32 offset, // IN: location in PERMANENT_DATA to be updated - UINT32 size, // IN: size of the value - void *buffer // IN: the new data - ) -{ - pAssert(offset + size <= sizeof(gp)); - MemoryCopy(&gp + offset, buffer, size); - NvWrite(offset, size, buffer); -} - -//*** NvClearPersistent() -// This function is used to clear a persistent data entry and commit it to NV -void -NvClearPersistent( - UINT32 offset, // IN: the offset in the PERMANENT_DATA - // structure to be cleared (zeroed) - UINT32 size // IN: number of bytes to clear - ) -{ - pAssert(offset + size <= sizeof(gp)); - MemorySet((&gp) + offset, 0, size); - NvWrite(offset, size, (&gp) + offset); -} - -//*** NvReadPersistent() -// This function reads persistent data to the RAM copy of the 'gp' structure. -void -NvReadPersistent( - void - ) -{ - NvRead(&gp, NV_PERSISTENT_DATA, sizeof(gp)); - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Object.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Object.c deleted file mode 100644 index 6fd037087..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Object.c +++ /dev/null @@ -1,989 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions that manage the object store of the TPM. - -//** Includes and Data Definitions -#define OBJECT_C - -#include "Tpm.h" - -//** Functions - -//*** ObjectFlush() -// This function marks an object slot as available. -// Since there is no checking of the input parameters, it should be used -// judiciously. -// Note: This could be converted to a macro. -void -ObjectFlush( - OBJECT *object - ) -{ - object->attributes.occupied = CLEAR; -} - -//*** ObjectSetInUse() -// This access function sets the occupied attribute of an object slot. -void -ObjectSetInUse( - OBJECT *object - ) -{ - object->attributes.occupied = SET; -} - -//*** ObjectStartup() -// This function is called at TPM2_Startup() to initialize the object subsystem. -BOOL -ObjectStartup( - void - ) -{ - UINT32 i; -// - // object slots initialization - for(i = 0; i < MAX_LOADED_OBJECTS; i++) - { - //Set the slot to not occupied - ObjectFlush(&s_objects[i]); - } - return TRUE; -} - -//*** ObjectCleanupEvict() -// -// In this implementation, a persistent object is moved from NV into an object slot -// for processing. It is flushed after command execution. This function is called -// from ExecuteCommand(). -void -ObjectCleanupEvict( - void - ) -{ - UINT32 i; -// - // This has to be iterated because a command may have two handles - // and they may both be persistent. - // This could be made to be more efficient so that a search is not needed. - for(i = 0; i < MAX_LOADED_OBJECTS; i++) - { - // If an object is a temporary evict object, flush it from slot - OBJECT *object = &s_objects[i]; - if(object->attributes.evict == SET) - ObjectFlush(object); - } - return; -} - -//*** IsObjectPresent() -// This function checks to see if a transient handle references a loaded -// object. This routine should not be called if the handle is not a -// transient handle. The function validates that the handle is in the -// implementation-dependent allowed in range for loaded transient objects. -// Return Type: BOOL -// TRUE(1) handle references a loaded object -// FALSE(0) handle is not an object handle, or it does not -// reference to a loaded object -BOOL -IsObjectPresent( - TPMI_DH_OBJECT handle // IN: handle to be checked - ) -{ - UINT32 slotIndex = handle - TRANSIENT_FIRST; - // Since the handle is just an index into the array that is zero based, any - // handle value outsize of the range of: - // TRANSIENT_FIRST -- (TRANSIENT_FIRST + MAX_LOADED_OBJECT - 1) - // will now be greater than or equal to MAX_LOADED_OBJECTS - if(slotIndex >= MAX_LOADED_OBJECTS) - return FALSE; - // Indicate if the slot is occupied - return (s_objects[slotIndex].attributes.occupied == TRUE); -} - -//*** ObjectIsSequence() -// This function is used to check if the object is a sequence object. This function -// should not be called if the handle does not reference a loaded object. -// Return Type: BOOL -// TRUE(1) object is an HMAC, hash, or event sequence object -// FALSE(0) object is not an HMAC, hash, or event sequence object -BOOL -ObjectIsSequence( - OBJECT *object // IN: handle to be checked - ) -{ - pAssert(object != NULL); - return (object->attributes.hmacSeq == SET - || object->attributes.hashSeq == SET - || object->attributes.eventSeq == SET); -} - -//*** HandleToObject() -// This function is used to find the object structure associated with a handle. -// -// This function requires that 'handle' references a loaded object or a permanent -// handle. -OBJECT* -HandleToObject( - TPMI_DH_OBJECT handle // IN: handle of the object - ) -{ - UINT32 index; -// - // Return NULL if the handle references a permanent handle because there is no - // associated OBJECT. - if(HandleGetType(handle) == TPM_HT_PERMANENT) - return NULL; - // In this implementation, the handle is determined by the slot occupied by the - // object. - index = handle - TRANSIENT_FIRST; - pAssert(index < MAX_LOADED_OBJECTS); - pAssert(s_objects[index].attributes.occupied); - return &s_objects[index]; -} - - -//*** GetQualifiedName() -// This function returns the Qualified Name of the object. In this implementation, -// the Qualified Name is computed when the object is loaded and is saved in the -// internal representation of the object. The alternative would be to retain the -// Name of the parent and compute the QN when needed. This would take the same -// amount of space so it is not recommended that the alternate be used. -// -// This function requires that 'handle' references a loaded object. -void -GetQualifiedName( - TPMI_DH_OBJECT handle, // IN: handle of the object - TPM2B_NAME *qualifiedName // OUT: qualified name of the object - ) -{ - OBJECT *object; -// - switch(HandleGetType(handle)) - { - case TPM_HT_PERMANENT: - qualifiedName->t.size = sizeof(TPM_HANDLE); - UINT32_TO_BYTE_ARRAY(handle, qualifiedName->t.name); - break; - case TPM_HT_TRANSIENT: - object = HandleToObject(handle); - if(object == NULL || object->publicArea.nameAlg == TPM_ALG_NULL) - qualifiedName->t.size = 0; - else - // Copy the name - *qualifiedName = object->qualifiedName; - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - } - return; -} - -//*** ObjectGetHierarchy() -// This function returns the handle for the hierarchy of an object. -TPMI_RH_HIERARCHY -ObjectGetHierarchy( - OBJECT *object // IN :object - ) -{ - if(object->attributes.spsHierarchy) - { - return TPM_RH_OWNER; - } - else if(object->attributes.epsHierarchy) - { - return TPM_RH_ENDORSEMENT; - } - else if(object->attributes.ppsHierarchy) - { - return TPM_RH_PLATFORM; - } - else - { - return TPM_RH_NULL; - } -} - -//*** GetHeriarchy() -// This function returns the handle of the hierarchy to which a handle belongs. -// This function is similar to ObjectGetHierarchy() but this routine takes -// a handle but ObjectGetHierarchy() takes an pointer to an object. -// -// This function requires that 'handle' references a loaded object. -TPMI_RH_HIERARCHY -GetHeriarchy( - TPMI_DH_OBJECT handle // IN :object handle - ) -{ - OBJECT *object = HandleToObject(handle); -// - return ObjectGetHierarchy(object); -} - -//*** FindEmptyObjectSlot() -// This function finds an open object slot, if any. It will clear the attributes -// but will not set the occupied attribute. This is so that a slot may be used -// and discarded if everything does not go as planned. -// Return Type: OBJECT * -// NULL no open slot found -// != NULL pointer to available slot -OBJECT * -FindEmptyObjectSlot( - TPMI_DH_OBJECT *handle // OUT: (optional) - ) -{ - UINT32 i; - OBJECT *object; -// - for(i = 0; i < MAX_LOADED_OBJECTS; i++) - { - object = &s_objects[i]; - if(object->attributes.occupied == CLEAR) - { - if(handle) - *handle = i + TRANSIENT_FIRST; - // Initialize the object attributes - MemorySet(&object->attributes, 0, sizeof(OBJECT_ATTRIBUTES)); - return object; - } - } - return NULL; -} - -//*** ObjectAllocateSlot() -// This function is used to allocate a slot in internal object array. -OBJECT * -ObjectAllocateSlot( - TPMI_DH_OBJECT *handle // OUT: handle of allocated object - ) -{ - OBJECT *object = FindEmptyObjectSlot(handle); -// - if(object != NULL) - { - // if found, mark as occupied - ObjectSetInUse(object); - } - return object; -} - -//*** ObjectSetLoadedAttributes() -// This function sets the internal attributes for a loaded object. It is called to -// finalize the OBJECT attributes (not the TPMA_OBJECT attributes) for a loaded -// object. -void -ObjectSetLoadedAttributes( - OBJECT *object, // IN: object attributes to finalize - TPM_HANDLE parentHandle // IN: the parent handle - ) -{ - OBJECT *parent = HandleToObject(parentHandle); - TPMA_OBJECT objectAttributes = object->publicArea.objectAttributes; -// - // Copy the stClear attribute from the public area. This could be overwritten - // if the parent has stClear SET - object->attributes.stClear = - IS_ATTRIBUTE(objectAttributes, TPMA_OBJECT, stClear); - // If parent handle is a permanent handle, it is a primary (unless it is NULL - if(parent == NULL) - { - object->attributes.primary = SET; - switch(parentHandle) - { - case TPM_RH_ENDORSEMENT: - object->attributes.epsHierarchy = SET; - break; - case TPM_RH_OWNER: - object->attributes.spsHierarchy = SET; - break; - case TPM_RH_PLATFORM: - object->attributes.ppsHierarchy = SET; - break; - default: - // Treat the temporary attribute as a hierarchy - object->attributes.temporary = SET; - object->attributes.primary = CLEAR; - break; - } - } - else - { - // is this a stClear object - object->attributes.stClear = - (IS_ATTRIBUTE(objectAttributes, TPMA_OBJECT, stClear) - || (parent->attributes.stClear == SET)); - object->attributes.epsHierarchy = parent->attributes.epsHierarchy; - object->attributes.spsHierarchy = parent->attributes.spsHierarchy; - object->attributes.ppsHierarchy = parent->attributes.ppsHierarchy; - // An object is temporary if its parent is temporary or if the object - // is external - object->attributes.temporary = parent->attributes.temporary - || object->attributes.external; - } - // If this is an external object, set the QN == name but don't SET other - // key properties ('parent' or 'derived') - if(object->attributes.external) - object->qualifiedName = object->name; - else - { - // check attributes for different types of parents - if(IS_ATTRIBUTE(objectAttributes, TPMA_OBJECT, restricted) - && !object->attributes.publicOnly - && IS_ATTRIBUTE(objectAttributes, TPMA_OBJECT, decrypt) - && object->publicArea.nameAlg != TPM_ALG_NULL) - { - // This is a parent. If it is not a KEYEDHASH, it is an ordinary parent. - // Otherwise, it is a derivation parent. - if(object->publicArea.type == TPM_ALG_KEYEDHASH) - object->attributes.derivation = SET; - else - object->attributes.isParent = SET; - } - ComputeQualifiedName(parentHandle, object->publicArea.nameAlg, - &object->name, &object->qualifiedName); - } - // Set slot occupied - ObjectSetInUse(object); - return; -} - -//*** ObjectLoad() -// Common function to load an object. A loaded object has its public area validated -// (unless its 'nameAlg' is TPM_ALG_NULL). If a sensitive part is loaded, it is -// verified to be correct and if both public and sensitive parts are loaded, then -// the cryptographic binding between the objects is validated. This function does -// not cause the allocated slot to be marked as in use. -TPM_RC -ObjectLoad( - OBJECT *object, // IN: pointer to object slot - // object - OBJECT *parent, // IN: (optional) the parent object - TPMT_PUBLIC *publicArea, // IN: public area to be installed in the object - TPMT_SENSITIVE *sensitive, // IN: (optional) sensitive area to be - // installed in the object - TPM_RC blamePublic, // IN: parameter number to associate with the - // publicArea errors - TPM_RC blameSensitive,// IN: parameter number to associate with the - // sensitive area errors - TPM2B_NAME *name // IN: (optional) -) -{ - TPM_RC result = TPM_RC_SUCCESS; -// -// Do validations of public area object descriptions - pAssert(publicArea != NULL); - - // Is this public only or a no-name object? - if(sensitive == NULL || publicArea->nameAlg == TPM_ALG_NULL) - { - // Need to have schemes checked so that we do the right thing with the - // public key. - result = SchemeChecks(NULL, publicArea); - } - else - { - // For any sensitive area, make sure that the seedSize is no larger than the - // digest size of nameAlg - if(sensitive->seedValue.t.size > CryptHashGetDigestSize(publicArea->nameAlg)) - return TPM_RCS_KEY_SIZE + blameSensitive; - // Check attributes and schemes for consistency - result = PublicAttributesValidation(parent, publicArea); - } - if(result != TPM_RC_SUCCESS) - return RcSafeAddToResult(result, blamePublic); - -// Sensitive area and binding checks - - // On load, check nothing if the parent is fixedTPM. For all other cases, validate - // the keys. - if((parent == NULL) - || ((parent != NULL) && !IS_ATTRIBUTE(parent->publicArea.objectAttributes, - TPMA_OBJECT, fixedTPM))) - { - // Do the cryptographic key validation - result = CryptValidateKeys(publicArea, sensitive, blamePublic, - blameSensitive); - if(result != TPM_RC_SUCCESS) - return result; - } -#if ALG_RSA - // If this is an RSA key, then expand the private exponent. - // Note: ObjectLoad() is only called by TPM2_Import() if the parent is fixedTPM. - // For any key that does not have a fixedTPM parent, the exponent is computed - // whenever it is loaded - if((publicArea->type == TPM_ALG_RSA) && (sensitive != NULL)) - { - result = CryptRsaLoadPrivateExponent(publicArea, sensitive); - if(result != TPM_RC_SUCCESS) - return result; - } -#endif // ALG_RSA - // See if there is an object to populate - if((result == TPM_RC_SUCCESS) && (object != NULL)) - { - // Initialize public - object->publicArea = *publicArea; - // Copy sensitive if there is one - if(sensitive == NULL) - object->attributes.publicOnly = SET; - else - object->sensitive = *sensitive; - // Set the name, if one was provided - if(name != NULL) - object->name = *name; - else - object->name.t.size = 0; - } - return result; -} - -//*** AllocateSequenceSlot() -// This function allocates a sequence slot and initializes the parts that -// are used by the normal objects so that a sequence object is not inadvertently -// used for an operation that is not appropriate for a sequence. -// -static HASH_OBJECT * -AllocateSequenceSlot( - TPM_HANDLE *newHandle, // OUT: receives the allocated handle - TPM2B_AUTH *auth // IN: the authValue for the slot - ) -{ - HASH_OBJECT *object = (HASH_OBJECT *)ObjectAllocateSlot(newHandle); -// - // Validate that the proper location of the hash state data relative to the - // object state data. It would be good if this could have been done at compile - // time but it can't so do it in something that can be removed after debug. - cAssert(offsetof(HASH_OBJECT, auth) == offsetof(OBJECT, publicArea.authPolicy)); - - if(object != NULL) - { - - // Set the common values that a sequence object shares with an ordinary object - // First, clear all attributes - MemorySet(&object->objectAttributes, 0, sizeof(TPMA_OBJECT)); - - // The type is TPM_ALG_NULL - object->type = TPM_ALG_NULL; - - // This has no name algorithm and the name is the Empty Buffer - object->nameAlg = TPM_ALG_NULL; - - // A sequence object is considered to be in the NULL hierarchy so it should - // be marked as temporary so that it can't be persisted - object->attributes.temporary = SET; - - // A sequence object is DA exempt. - SET_ATTRIBUTE(object->objectAttributes, TPMA_OBJECT, noDA); - - // Copy the authorization value - if(auth != NULL) - object->auth = *auth; - else - object->auth.t.size = 0; - } - return object; -} - - -#if CC_HMAC_Start || CC_MAC_Start -//*** ObjectCreateHMACSequence() -// This function creates an internal HMAC sequence object. -// Return Type: TPM_RC -// TPM_RC_OBJECT_MEMORY if there is no free slot for an object -TPM_RC -ObjectCreateHMACSequence( - TPMI_ALG_HASH hashAlg, // IN: hash algorithm - OBJECT *keyObject, // IN: the object containing the HMAC key - TPM2B_AUTH *auth, // IN: authValue - TPMI_DH_OBJECT *newHandle // OUT: HMAC sequence object handle - ) -{ - HASH_OBJECT *hmacObject; -// - // Try to allocate a slot for new object - hmacObject = AllocateSequenceSlot(newHandle, auth); - - if(hmacObject == NULL) - return TPM_RC_OBJECT_MEMORY; - // Set HMAC sequence bit - hmacObject->attributes.hmacSeq = SET; - -#if !SMAC_IMPLEMENTED - if(CryptHmacStart(&hmacObject->state.hmacState, hashAlg, - keyObject->sensitive.sensitive.bits.b.size, - keyObject->sensitive.sensitive.bits.b.buffer) == 0) -#else - if(CryptMacStart(&hmacObject->state.hmacState, - &keyObject->publicArea.parameters, - hashAlg, &keyObject->sensitive.sensitive.any.b) == 0) -#endif // SMAC_IMPLEMENTED - return TPM_RC_FAILURE; - return TPM_RC_SUCCESS; -} -#endif - -//*** ObjectCreateHashSequence() -// This function creates a hash sequence object. -// Return Type: TPM_RC -// TPM_RC_OBJECT_MEMORY if there is no free slot for an object -TPM_RC -ObjectCreateHashSequence( - TPMI_ALG_HASH hashAlg, // IN: hash algorithm - TPM2B_AUTH *auth, // IN: authValue - TPMI_DH_OBJECT *newHandle // OUT: sequence object handle - ) -{ - HASH_OBJECT *hashObject = AllocateSequenceSlot(newHandle, auth); -// - // See if slot allocated - if(hashObject == NULL) - return TPM_RC_OBJECT_MEMORY; - // Set hash sequence bit - hashObject->attributes.hashSeq = SET; - - // Start hash for hash sequence - CryptHashStart(&hashObject->state.hashState[0], hashAlg); - - return TPM_RC_SUCCESS; -} - -//*** ObjectCreateEventSequence() -// This function creates an event sequence object. -// Return Type: TPM_RC -// TPM_RC_OBJECT_MEMORY if there is no free slot for an object -TPM_RC -ObjectCreateEventSequence( - TPM2B_AUTH *auth, // IN: authValue - TPMI_DH_OBJECT *newHandle // OUT: sequence object handle - ) -{ - HASH_OBJECT *hashObject = AllocateSequenceSlot(newHandle, auth); - UINT32 count; - TPM_ALG_ID hash; -// - // See if slot allocated - if(hashObject == NULL) - return TPM_RC_OBJECT_MEMORY; - // Set the event sequence attribute - hashObject->attributes.eventSeq = SET; - - // Initialize hash states for each implemented PCR algorithms - for(count = 0; (hash = CryptHashGetAlgByIndex(count)) != TPM_ALG_NULL; count++) - CryptHashStart(&hashObject->state.hashState[count], hash); - return TPM_RC_SUCCESS; -} - -//*** ObjectTerminateEvent() -// This function is called to close out the event sequence and clean up the hash -// context states. -void -ObjectTerminateEvent( - void - ) -{ - HASH_OBJECT *hashObject; - int count; - BYTE buffer[MAX_DIGEST_SIZE]; -// - hashObject = (HASH_OBJECT *)HandleToObject(g_DRTMHandle); - - // Don't assume that this is a proper sequence object - if(hashObject->attributes.eventSeq) - { - // If it is, close any open hash contexts. This is done in case - // the cryptographic implementation has some context values that need to be - // cleaned up (hygiene). - // - for(count = 0; CryptHashGetAlgByIndex(count) != TPM_ALG_NULL; count++) - { - CryptHashEnd(&hashObject->state.hashState[count], 0, buffer); - } - // Flush sequence object - FlushObject(g_DRTMHandle); - } - g_DRTMHandle = TPM_RH_UNASSIGNED; -} - -//*** ObjectContextLoad() -// This function loads an object from a saved object context. -// Return Type: OBJECT * -// NULL if there is no free slot for an object -// != NULL points to the loaded object -OBJECT * -ObjectContextLoad( - ANY_OBJECT_BUFFER *object, // IN: pointer to object structure in saved - // context - TPMI_DH_OBJECT *handle // OUT: object handle - ) -{ - OBJECT *newObject = ObjectAllocateSlot(handle); -// - // Try to allocate a slot for new object - if(newObject != NULL) - { - // Copy the first part of the object - MemoryCopy(newObject, object, offsetof(HASH_OBJECT, state)); - // See if this is a sequence object - if(ObjectIsSequence(newObject)) - { - // If this is a sequence object, import the data - SequenceDataImport((HASH_OBJECT *)newObject, - (HASH_OBJECT_BUFFER *)object); - } - else - { - // Copy input object data to internal structure - MemoryCopy(newObject, object, sizeof(OBJECT)); - } - } - return newObject; -} - -//*** FlushObject() -// This function frees an object slot. -// -// This function requires that the object is loaded. -void -FlushObject( - TPMI_DH_OBJECT handle // IN: handle to be freed - ) -{ - UINT32 index = handle - TRANSIENT_FIRST; -// - pAssert(index < MAX_LOADED_OBJECTS); - // Clear all the object attributes - MemorySet((BYTE*)&(s_objects[index].attributes), - 0, sizeof(OBJECT_ATTRIBUTES)); - return; -} - -//*** ObjectFlushHierarchy() -// This function is called to flush all the loaded transient objects associated -// with a hierarchy when the hierarchy is disabled. -void -ObjectFlushHierarchy( - TPMI_RH_HIERARCHY hierarchy // IN: hierarchy to be flush - ) -{ - UINT16 i; -// - // iterate object slots - for(i = 0; i < MAX_LOADED_OBJECTS; i++) - { - if(s_objects[i].attributes.occupied) // If found an occupied slot - { - switch(hierarchy) - { - case TPM_RH_PLATFORM: - if(s_objects[i].attributes.ppsHierarchy == SET) - s_objects[i].attributes.occupied = FALSE; - break; - case TPM_RH_OWNER: - if(s_objects[i].attributes.spsHierarchy == SET) - s_objects[i].attributes.occupied = FALSE; - break; - case TPM_RH_ENDORSEMENT: - if(s_objects[i].attributes.epsHierarchy == SET) - s_objects[i].attributes.occupied = FALSE; - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - } - } - - return; -} - -//*** ObjectLoadEvict() -// This function loads a persistent object into a transient object slot. -// -// This function requires that 'handle' is associated with a persistent object. -// Return Type: TPM_RC -// TPM_RC_HANDLE the persistent object does not exist -// or the associated hierarchy is disabled. -// TPM_RC_OBJECT_MEMORY no object slot -TPM_RC -ObjectLoadEvict( - TPM_HANDLE *handle, // IN:OUT: evict object handle. If success, it - // will be replace by the loaded object handle - COMMAND_INDEX commandIndex // IN: the command being processed - ) -{ - TPM_RC result; - TPM_HANDLE evictHandle = *handle; // Save the evict handle - OBJECT *object; -// - // If this is an index that references a persistent object created by - // the platform, then return TPM_RH_HANDLE if the phEnable is FALSE - if(*handle >= PLATFORM_PERSISTENT) - { - // belongs to platform - if(g_phEnable == CLEAR) - return TPM_RC_HANDLE; - } - // belongs to owner - else if(gc.shEnable == CLEAR) - return TPM_RC_HANDLE; - // Try to allocate a slot for an object - object = ObjectAllocateSlot(handle); - if(object == NULL) - return TPM_RC_OBJECT_MEMORY; - // Copy persistent object to transient object slot. A TPM_RC_HANDLE - // may be returned at this point. This will mark the slot as containing - // a transient object so that it will be flushed at the end of the - // command - result = NvGetEvictObject(evictHandle, object); - - // Bail out if this failed - if(result != TPM_RC_SUCCESS) - return result; - // check the object to see if it is in the endorsement hierarchy - // if it is and this is not a TPM2_EvictControl() command, indicate - // that the hierarchy is disabled. - // If the associated hierarchy is disabled, make it look like the - // handle is not defined - if(ObjectGetHierarchy(object) == TPM_RH_ENDORSEMENT - && gc.ehEnable == CLEAR - && GetCommandCode(commandIndex) != TPM_CC_EvictControl) - return TPM_RC_HANDLE; - - return result; -} - -//*** ObjectComputeName() -// This does the name computation from a public area (can be marshaled or not). -TPM2B_NAME * -ObjectComputeName( - UINT32 size, // IN: the size of the area to digest - BYTE *publicArea, // IN: the public area to digest - TPM_ALG_ID nameAlg, // IN: the hash algorithm to use - TPM2B_NAME *name // OUT: Computed name - ) -{ - // Hash the publicArea into the name buffer leaving room for the nameAlg - name->t.size = CryptHashBlock(nameAlg, size, publicArea, - sizeof(name->t.name) - 2, - &name->t.name[2]); - // set the nameAlg - UINT16_TO_BYTE_ARRAY(nameAlg, name->t.name); - name->t.size += 2; - return name; -} - -//*** PublicMarshalAndComputeName() -// This function computes the Name of an object from its public area. -TPM2B_NAME * -PublicMarshalAndComputeName( - TPMT_PUBLIC *publicArea, // IN: public area of an object - TPM2B_NAME *name // OUT: name of the object - ) -{ - // Will marshal a public area into a template. This is because the internal - // format for a TPM2B_PUBLIC is a structure and not a simple BYTE buffer. - TPM2B_TEMPLATE marshaled; // this is big enough to hold a - // marshaled TPMT_PUBLIC - BYTE *buffer = (BYTE *)&marshaled.t.buffer; -// - // if the nameAlg is NULL then there is no name. - if(publicArea->nameAlg == TPM_ALG_NULL) - name->t.size = 0; - else - { - // Marshal the public area into its canonical form - marshaled.t.size = TPMT_PUBLIC_Marshal(publicArea, &buffer, NULL); - // and compute the name - ObjectComputeName(marshaled.t.size, marshaled.t.buffer, - publicArea->nameAlg, name); - } - return name; -} - -//*** ComputeQualifiedName() -// This function computes the qualified name of an object. -void -ComputeQualifiedName( - TPM_HANDLE parentHandle, // IN: parent's handle - TPM_ALG_ID nameAlg, // IN: name hash - TPM2B_NAME *name, // IN: name of the object - TPM2B_NAME *qualifiedName // OUT: qualified name of the object - ) -{ - HASH_STATE hashState; // hash state - TPM2B_NAME parentName; -// - if(parentHandle == TPM_RH_UNASSIGNED) - { - MemoryCopy2B(&qualifiedName->b, &name->b, sizeof(qualifiedName->t.name)); - *qualifiedName = *name; - } - else - { - GetQualifiedName(parentHandle, &parentName); - - // QN_A = hash_A (QN of parent || NAME_A) - - // Start hash - qualifiedName->t.size = CryptHashStart(&hashState, nameAlg); - - // Add parent's qualified name - CryptDigestUpdate2B(&hashState, &parentName.b); - - // Add self name - CryptDigestUpdate2B(&hashState, &name->b); - - // Complete hash leaving room for the name algorithm - CryptHashEnd(&hashState, qualifiedName->t.size, - &qualifiedName->t.name[2]); - UINT16_TO_BYTE_ARRAY(nameAlg, qualifiedName->t.name); - qualifiedName->t.size += 2; - } - return; -} - -//*** ObjectIsStorage() -// This function determines if an object has the attributes associated -// with a parent. A parent is an asymmetric or symmetric block cipher key -// that has its 'restricted' and 'decrypt' attributes SET, and 'sign' CLEAR. -// Return Type: BOOL -// TRUE(1) object is a storage key -// FALSE(0) object is not a storage key -BOOL -ObjectIsStorage( - TPMI_DH_OBJECT handle // IN: object handle - ) -{ - OBJECT *object = HandleToObject(handle); - TPMT_PUBLIC *publicArea = ((object != NULL) ? &object->publicArea : NULL); -// - return (publicArea != NULL - && IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, restricted) - && IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, decrypt) - && !IS_ATTRIBUTE(publicArea->objectAttributes, TPMA_OBJECT, sign) - && (object->publicArea.type == ALG_RSA_VALUE - || object->publicArea.type == ALG_ECC_VALUE)); -} - -//*** ObjectCapGetLoaded() -// This function returns a a list of handles of loaded object, starting from -// 'handle'. 'Handle' must be in the range of valid transient object handles, -// but does not have to be the handle of a loaded transient object. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -ObjectCapGetLoaded( - TPMI_DH_OBJECT handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle - ) -{ - TPMI_YES_NO more = NO; - UINT32 i; -// - pAssert(HandleGetType(handle) == TPM_HT_TRANSIENT); - - // Initialize output handle list - handleList->count = 0; - - // The maximum count of handles we may return is MAX_CAP_HANDLES - if(count > MAX_CAP_HANDLES) count = MAX_CAP_HANDLES; - - // Iterate object slots to get loaded object handles - for(i = handle - TRANSIENT_FIRST; i < MAX_LOADED_OBJECTS; i++) - { - if(s_objects[i].attributes.occupied == TRUE) - { - // A valid transient object can not be the copy of a persistent object - pAssert(s_objects[i].attributes.evict == CLEAR); - - if(handleList->count < count) - { - // If we have not filled up the return list, add this object - // handle to it - handleList->handle[handleList->count] = i + TRANSIENT_FIRST; - handleList->count++; - } - else - { - // If the return list is full but we still have loaded object - // available, report this and stop iterating - more = YES; - break; - } - } - } - - return more; -} - -//*** ObjectCapGetTransientAvail() -// This function returns an estimate of the number of additional transient -// objects that could be loaded into the TPM. -UINT32 -ObjectCapGetTransientAvail( - void - ) -{ - UINT32 i; - UINT32 num = 0; -// - // Iterate object slot to get the number of unoccupied slots - for(i = 0; i < MAX_LOADED_OBJECTS; i++) - { - if(s_objects[i].attributes.occupied == FALSE) num++; - } - - return num; -} - -//*** ObjectGetPublicAttributes() -// Returns the attributes associated with an object handles. -TPMA_OBJECT -ObjectGetPublicAttributes( - TPM_HANDLE handle - ) -{ - return HandleToObject(handle)->publicArea.objectAttributes; -} - -OBJECT_ATTRIBUTES -ObjectGetProperties( - TPM_HANDLE handle - ) -{ - return HandleToObject(handle)->attributes; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/PCR.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/PCR.c deleted file mode 100644 index 10a096878..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/PCR.c +++ /dev/null @@ -1,1314 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This function contains the functions needed for PCR access and manipulation. -// -// This implementation uses a static allocation for the PCR. The amount of -// memory is allocated based on the number of PCR in the implementation and -// the number of implemented hash algorithms. This is not the expected -// implementation. PCR SPACE DEFINITIONS. -// -// In the definitions below, the g_hashPcrMap is a bit array that indicates -// which of the PCR are implemented. The g_hashPcr array is an array of digests. -// In this implementation, the space is allocated whether the PCR is implemented -// or not. - -//** Includes, Defines, and Data Definitions -#define PCR_C -#include "Tpm.h" - -// The initial value of PCR attributes. The value of these fields should be -// consistent with PC Client specification -// In this implementation, we assume the total number of implemented PCR is 24. -static const PCR_Attributes s_initAttributes[] = -{ - // PCR 0 - 15, static RTM - {1, 0, 0x1F}, {1, 0, 0x1F}, {1, 0, 0x1F}, {1, 0, 0x1F}, - {1, 0, 0x1F}, {1, 0, 0x1F}, {1, 0, 0x1F}, {1, 0, 0x1F}, - {1, 0, 0x1F}, {1, 0, 0x1F}, {1, 0, 0x1F}, {1, 0, 0x1F}, - {1, 0, 0x1F}, {1, 0, 0x1F}, {1, 0, 0x1F}, {1, 0, 0x1F}, - - {0, 0x0F, 0x1F}, // PCR 16, Debug - {0, 0x10, 0x1C}, // PCR 17, Locality 4 - {0, 0x10, 0x1C}, // PCR 18, Locality 3 - {0, 0x10, 0x0C}, // PCR 19, Locality 2 - {0, 0x14, 0x0E}, // PCR 20, Locality 1 - {0, 0x14, 0x04}, // PCR 21, Dynamic OS - {0, 0x14, 0x04}, // PCR 22, Dynamic OS - {0, 0x0F, 0x1F}, // PCR 23, Application specific - {0, 0x0F, 0x1F} // PCR 24, testing policy -}; - -//** Functions - -//*** PCRBelongsAuthGroup() -// This function indicates if a PCR belongs to a group that requires an authValue -// in order to modify the PCR. If it does, 'groupIndex' is set to value of -// the group index. This feature of PCR is decided by the platform specification. -// Return Type: BOOL -// TRUE(1) PCR belongs an authorization group -// FALSE(0) PCR does not belong an authorization group -BOOL -PCRBelongsAuthGroup( - TPMI_DH_PCR handle, // IN: handle of PCR - UINT32 *groupIndex // OUT: group index if PCR belongs a - // group that allows authValue. If PCR - // does not belong to an authorization - // group, the value in this parameter is - // invalid - ) -{ -#if defined NUM_AUTHVALUE_PCR_GROUP && NUM_AUTHVALUE_PCR_GROUP > 0 - // Platform specification determines to which authorization group a PCR belongs - // (if any). In this implementation, we assume there is only - // one authorization group which contains PCR[20-22]. If the platform - // specification requires differently, the implementation should be changed - // accordingly - if(handle >= 20 && handle <= 22) - { - *groupIndex = 0; - return TRUE; - } - -#endif - return FALSE; -} - -//*** PCRBelongsPolicyGroup() -// This function indicates if a PCR belongs to a group that requires a policy -// authorization in order to modify the PCR. If it does, 'groupIndex' is set -// to value of the group index. This feature of PCR is decided by the platform -// specification. -// Return Type: BOOL -// TRUE(1) PCR belongs a policy group -// FALSE(0) PCR does not belong a policy group -BOOL -PCRBelongsPolicyGroup( - TPMI_DH_PCR handle, // IN: handle of PCR - UINT32 *groupIndex // OUT: group index if PCR belongs a group that - // allows policy. If PCR does not belong to - // a policy group, the value in this - // parameter is invalid - ) -{ -#if defined NUM_POLICY_PCR_GROUP && NUM_POLICY_PCR_GROUP > 0 - // Platform specification decides if a PCR belongs to a policy group and - // belongs to which group. In this implementation, we assume there is only - // one policy group which contains PCR20-22. If the platform specification - // requires differently, the implementation should be changed accordingly - if(handle >= 20 && handle <= 22) - { - *groupIndex = 0; - return TRUE; - } -#endif - return FALSE; -} - -//*** PCRBelongsTCBGroup() -// This function indicates if a PCR belongs to the TCB group. -// Return Type: BOOL -// TRUE(1) PCR belongs to TCB group -// FALSE(0) PCR does not belong to TCB group -static BOOL -PCRBelongsTCBGroup( - TPMI_DH_PCR handle // IN: handle of PCR - ) -{ -#if ENABLE_PCR_NO_INCREMENT == YES - // Platform specification decides if a PCR belongs to a TCB group. In this - // implementation, we assume PCR[20-22] belong to TCB group. If the platform - // specification requires differently, the implementation should be - // changed accordingly - if(handle >= 20 && handle <= 22) - return TRUE; - -#endif - return FALSE; -} - -//*** PCRPolicyIsAvailable() -// This function indicates if a policy is available for a PCR. -// Return Type: BOOL -// TRUE(1) the PCR should be authorized by policy -// FALSE(0) the PCR does not allow policy -BOOL -PCRPolicyIsAvailable( - TPMI_DH_PCR handle // IN: PCR handle - ) -{ - UINT32 groupIndex; - - return PCRBelongsPolicyGroup(handle, &groupIndex); -} - -//*** PCRGetAuthValue() -// This function is used to access the authValue of a PCR. If PCR does not -// belong to an authValue group, an EmptyAuth will be returned. -TPM2B_AUTH * -PCRGetAuthValue( - TPMI_DH_PCR handle // IN: PCR handle - ) -{ - UINT32 groupIndex; - - if(PCRBelongsAuthGroup(handle, &groupIndex)) - { - return &gc.pcrAuthValues.auth[groupIndex]; - } - else - { - return NULL; - } -} - -//*** PCRGetAuthPolicy() -// This function is used to access the authorization policy of a PCR. It sets -// 'policy' to the authorization policy and returns the hash algorithm for policy -// If the PCR does not allow a policy, TPM_ALG_NULL is returned. -TPMI_ALG_HASH -PCRGetAuthPolicy( - TPMI_DH_PCR handle, // IN: PCR handle - TPM2B_DIGEST *policy // OUT: policy of PCR - ) -{ - UINT32 groupIndex; - - if(PCRBelongsPolicyGroup(handle, &groupIndex)) - { - *policy = gp.pcrPolicies.policy[groupIndex]; - return gp.pcrPolicies.hashAlg[groupIndex]; - } - else - { - policy->t.size = 0; - return TPM_ALG_NULL; - } -} - -//*** PCRSimStart() -// This function is used to initialize the policies when a TPM is manufactured. -// This function would only be called in a manufacturing environment or in -// a TPM simulator. -void -PCRSimStart( - void - ) -{ - UINT32 i; -#if defined NUM_POLICY_PCR_GROUP && NUM_POLICY_PCR_GROUP > 0 - for(i = 0; i < NUM_POLICY_PCR_GROUP; i++) - { - gp.pcrPolicies.hashAlg[i] = TPM_ALG_NULL; - gp.pcrPolicies.policy[i].t.size = 0; - } -#endif -#if defined NUM_AUTHVALUE_PCR_GROUP && NUM_AUTHVALUE_PCR_GROUP > 0 - for(i = 0; i < NUM_AUTHVALUE_PCR_GROUP; i++) - { - gc.pcrAuthValues.auth[i].t.size = 0; - } -#endif - // We need to give an initial configuration on allocated PCR before - // receiving any TPM2_PCR_Allocate command to change this configuration - // When the simulation environment starts, we allocate all the PCRs - for(gp.pcrAllocated.count = 0; gp.pcrAllocated.count < HASH_COUNT; - gp.pcrAllocated.count++) - { - gp.pcrAllocated.pcrSelections[gp.pcrAllocated.count].hash - = CryptHashGetAlgByIndex(gp.pcrAllocated.count); - - gp.pcrAllocated.pcrSelections[gp.pcrAllocated.count].sizeofSelect - = PCR_SELECT_MAX; - for(i = 0; i < PCR_SELECT_MAX; i++) - gp.pcrAllocated.pcrSelections[gp.pcrAllocated.count].pcrSelect[i] - = 0xFF; - } - - // Store the initial configuration to NV - NV_SYNC_PERSISTENT(pcrPolicies); - NV_SYNC_PERSISTENT(pcrAllocated); - - return; -} - -//*** GetSavedPcrPointer() -// This function returns the address of an array of state saved PCR based -// on the hash algorithm. -// Return Type: BYTE * -// NULL no such algorithm -// != NULL pointer to the 0th byte of the 0th PCR -static BYTE * -GetSavedPcrPointer( - TPM_ALG_ID alg, // IN: algorithm for bank - UINT32 pcrIndex // IN: PCR index in PCR_SAVE - ) -{ - BYTE *retVal; - switch(alg) - { -#if ALG_SHA1 - case ALG_SHA1_VALUE: - retVal = gc.pcrSave.sha1[pcrIndex]; - break; -#endif -#if ALG_SHA256 - case ALG_SHA256_VALUE: - retVal = gc.pcrSave.sha256[pcrIndex]; - break; -#endif -#if ALG_SHA384 - case ALG_SHA384_VALUE: - retVal = gc.pcrSave.sha384[pcrIndex]; - break; -#endif - -#if ALG_SHA512 - case ALG_SHA512_VALUE: - retVal = gc.pcrSave.sha512[pcrIndex]; - break; -#endif -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: - retVal = gc.pcrSave.sm3_256[pcrIndex]; - break; -#endif - default: - FAIL(FATAL_ERROR_INTERNAL); - } - return retVal; -} - -//*** PcrIsAllocated() -// This function indicates if a PCR number for the particular hash algorithm -// is allocated. -// Return Type: BOOL -// TRUE(1) PCR is allocated -// FALSE(0) PCR is not allocated -BOOL -PcrIsAllocated( - UINT32 pcr, // IN: The number of the PCR - TPMI_ALG_HASH hashAlg // IN: The PCR algorithm - ) -{ - UINT32 i; - BOOL allocated = FALSE; - - if(pcr < IMPLEMENTATION_PCR) - { - for(i = 0; i < gp.pcrAllocated.count; i++) - { - if(gp.pcrAllocated.pcrSelections[i].hash == hashAlg) - { - if(((gp.pcrAllocated.pcrSelections[i].pcrSelect[pcr / 8]) - & (1 << (pcr % 8))) != 0) - allocated = TRUE; - else - allocated = FALSE; - break; - } - } - } - return allocated; -} - -//*** GetPcrPointer() -// This function returns the address of an array of PCR based on the -// hash algorithm. -// Return Type: BYTE * -// NULL no such algorithm -// != NULL pointer to the 0th byte of the 0th PCR -static BYTE * -GetPcrPointer( - TPM_ALG_ID alg, // IN: algorithm for bank - UINT32 pcrNumber // IN: PCR number - ) -{ - static BYTE *pcr = NULL; - - if(!PcrIsAllocated(pcrNumber, alg)) - return NULL; - - switch(alg) - { -#if ALG_SHA1 - case ALG_SHA1_VALUE: - pcr = s_pcrs[pcrNumber].sha1Pcr; - break; -#endif -#if ALG_SHA256 - case ALG_SHA256_VALUE: - pcr = s_pcrs[pcrNumber].sha256Pcr; - break; -#endif -#if ALG_SHA384 - case ALG_SHA384_VALUE: - pcr = s_pcrs[pcrNumber].sha384Pcr; - break; -#endif -#if ALG_SHA512 - case ALG_SHA512_VALUE: - pcr = s_pcrs[pcrNumber].sha512Pcr; - break; -#endif -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: - pcr = s_pcrs[pcrNumber].sm3_256Pcr; - break; -#endif - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - return pcr; -} - -//*** IsPcrSelected() -// This function indicates if an indicated PCR number is selected by the bit map in -// 'selection'. -// Return Type: BOOL -// TRUE(1) PCR is selected -// FALSE(0) PCR is not selected -static BOOL -IsPcrSelected( - UINT32 pcr, // IN: The number of the PCR - TPMS_PCR_SELECTION *selection // IN: The selection structure - ) -{ - BOOL selected; - selected = (pcr < IMPLEMENTATION_PCR - && ((selection->pcrSelect[pcr / 8]) & (1 << (pcr % 8))) != 0); - return selected; -} - -//*** FilterPcr() -// This function modifies a PCR selection array based on the implemented -// PCR. -static void -FilterPcr( - TPMS_PCR_SELECTION *selection // IN: input PCR selection - ) -{ - UINT32 i; - TPMS_PCR_SELECTION *allocated = NULL; - - // If size of select is less than PCR_SELECT_MAX, zero the unspecified PCR - for(i = selection->sizeofSelect; i < PCR_SELECT_MAX; i++) - selection->pcrSelect[i] = 0; - - // Find the internal configuration for the bank - for(i = 0; i < gp.pcrAllocated.count; i++) - { - if(gp.pcrAllocated.pcrSelections[i].hash == selection->hash) - { - allocated = &gp.pcrAllocated.pcrSelections[i]; - break; - } - } - - for(i = 0; i < selection->sizeofSelect; i++) - { - if(allocated == NULL) - { - // If the required bank does not exist, clear input selection - selection->pcrSelect[i] = 0; - } - else - selection->pcrSelect[i] &= allocated->pcrSelect[i]; - } - - return; -} - -//*** PcrDrtm() -// This function does the DRTM and H-CRTM processing it is called from -// _TPM_Hash_End. -void -PcrDrtm( - const TPMI_DH_PCR pcrHandle, // IN: the index of the PCR to be - // modified - const TPMI_ALG_HASH hash, // IN: the bank identifier - const TPM2B_DIGEST *digest // IN: the digest to modify the PCR - ) -{ - BYTE *pcrData = GetPcrPointer(hash, pcrHandle); - - if(pcrData != NULL) - { - // Rest the PCR to zeros - MemorySet(pcrData, 0, digest->t.size); - - // if the TPM has not started, then set the PCR to 0...04 and then extend - if(!TPMIsStarted()) - { - pcrData[digest->t.size - 1] = 4; - } - // Now, extend the value - PCRExtend(pcrHandle, hash, digest->t.size, (BYTE *)digest->t.buffer); - } -} - -//*** PCR_ClearAuth() -// This function is used to reset the PCR authorization values. It is called -// on TPM2_Startup(CLEAR) and TPM2_Clear(). -void -PCR_ClearAuth( - void - ) -{ -#if defined NUM_AUTHVALUE_PCR_GROUP && NUM_AUTHVALUE_PCR_GROUP > 0 - int j; - for(j = 0; j < NUM_AUTHVALUE_PCR_GROUP; j++) - { - gc.pcrAuthValues.auth[j].t.size = 0; - } -#endif -} - -//*** PCRStartup() -// This function initializes the PCR subsystem at TPM2_Startup(). -BOOL -PCRStartup( - STARTUP_TYPE type, // IN: startup type - BYTE locality // IN: startup locality - ) -{ - UINT32 pcr, j; - UINT32 saveIndex = 0; - - g_pcrReConfig = FALSE; - - // Don't test for SU_RESET because that should be the default when nothing - // else is selected - if(type != SU_RESUME && type != SU_RESTART) - { - // PCR generation counter is cleared at TPM_RESET - gr.pcrCounter = 0; - } - - // Initialize/Restore PCR values - for(pcr = 0; pcr < IMPLEMENTATION_PCR; pcr++) - { - // On resume, need to know if this PCR had its state saved or not - UINT32 stateSaved; - - if(type == SU_RESUME - && s_initAttributes[pcr].stateSave == SET) - { - stateSaved = 1; - } - else - { - stateSaved = 0; - PCRChanged(pcr); - } - - // If this is the H-CRTM PCR and we are not doing a resume and we - // had an H-CRTM event, then we don't change this PCR - if(pcr == HCRTM_PCR && type != SU_RESUME && g_DrtmPreStartup == TRUE) - continue; - - // Iterate each hash algorithm bank - for(j = 0; j < gp.pcrAllocated.count; j++) - { - TPMI_ALG_HASH hash = gp.pcrAllocated.pcrSelections[j].hash; - BYTE *pcrData = GetPcrPointer(hash, pcr); - UINT16 pcrSize = CryptHashGetDigestSize(hash); - - if(pcrData != NULL) - { - // if state was saved - if(stateSaved == 1) - { - // Restore saved PCR value - BYTE *pcrSavedData; - pcrSavedData = GetSavedPcrPointer( - gp.pcrAllocated.pcrSelections[j].hash, - saveIndex); - if(pcrSavedData == NULL) - return FALSE; - MemoryCopy(pcrData, pcrSavedData, pcrSize); - } - else - // PCR was not restored by state save - { - // If the reset locality of the PCR is 4, then - // the reset value is all one's, otherwise it is - // all zero. - if((s_initAttributes[pcr].resetLocality & 0x10) != 0) - MemorySet(pcrData, 0xFF, pcrSize); - else - { - MemorySet(pcrData, 0, pcrSize); - if(pcr == HCRTM_PCR) - pcrData[pcrSize - 1] = locality; - } - } - } - } - saveIndex += stateSaved; - } - // Reset authValues on TPM2_Startup(CLEAR) - if(type != SU_RESUME) - PCR_ClearAuth(); - return TRUE; -} - -//*** PCRStateSave() -// This function is used to save the PCR values that will be restored on TPM Resume. -void -PCRStateSave( - TPM_SU type // IN: startup type - ) -{ - UINT32 pcr, j; - UINT32 saveIndex = 0; - - // if state save CLEAR, nothing to be done. Return here - if(type == TPM_SU_CLEAR) - return; - - // Copy PCR values to the structure that should be saved to NV - for(pcr = 0; pcr < IMPLEMENTATION_PCR; pcr++) - { - UINT32 stateSaved = (s_initAttributes[pcr].stateSave == SET) ? 1 : 0; - - // Iterate each hash algorithm bank - for(j = 0; j < gp.pcrAllocated.count; j++) - { - BYTE *pcrData; - UINT32 pcrSize; - - pcrData = GetPcrPointer(gp.pcrAllocated.pcrSelections[j].hash, pcr); - - if(pcrData != NULL) - { - pcrSize - = CryptHashGetDigestSize(gp.pcrAllocated.pcrSelections[j].hash); - - if(stateSaved == 1) - { - // Restore saved PCR value - BYTE *pcrSavedData; - pcrSavedData - = GetSavedPcrPointer(gp.pcrAllocated.pcrSelections[j].hash, - saveIndex); - MemoryCopy(pcrSavedData, pcrData, pcrSize); - } - } - } - saveIndex += stateSaved; - } - - return; -} - -//*** PCRIsStateSaved() -// This function indicates if the selected PCR is a PCR that is state saved -// on TPM2_Shutdown(STATE). The return value is based on PCR attributes. -// Return Type: BOOL -// TRUE(1) PCR is state saved -// FALSE(0) PCR is not state saved -BOOL -PCRIsStateSaved( - TPMI_DH_PCR handle // IN: PCR handle to be extended - ) -{ - UINT32 pcr = handle - PCR_FIRST; - - if(s_initAttributes[pcr].stateSave == SET) - return TRUE; - else - return FALSE; -} - -//*** PCRIsResetAllowed() -// This function indicates if a PCR may be reset by the current command locality. -// The return value is based on PCR attributes, and not the PCR allocation. -// Return Type: BOOL -// TRUE(1) TPM2_PCR_Reset is allowed -// FALSE(0) TPM2_PCR_Reset is not allowed -BOOL -PCRIsResetAllowed( - TPMI_DH_PCR handle // IN: PCR handle to be extended - ) -{ - UINT8 commandLocality; - UINT8 localityBits = 1; - UINT32 pcr = handle - PCR_FIRST; - - // Check for the locality - commandLocality = _plat__LocalityGet(); - -#ifdef DRTM_PCR - // For a TPM that does DRTM, Reset is not allowed at locality 4 - if(commandLocality == 4) - return FALSE; -#endif - - localityBits = localityBits << commandLocality; - if((localityBits & s_initAttributes[pcr].resetLocality) == 0) - return FALSE; - else - return TRUE; -} - -//*** PCRChanged() -// This function checks a PCR handle to see if the attributes for the PCR are set -// so that any change to the PCR causes an increment of the pcrCounter. If it does, -// then the function increments the counter. Will also bump the counter if the -// handle is zero which means that PCR 0 can not be in the TCB group. Bump on zero -// is used by TPM2_Clear(). -void -PCRChanged( - TPM_HANDLE pcrHandle // IN: the handle of the PCR that changed. - ) -{ - // For the reference implementation, the only change that does not cause - // increment is a change to a PCR in the TCB group. - if((pcrHandle == 0) || !PCRBelongsTCBGroup(pcrHandle)) - { - gr.pcrCounter++; - if(gr.pcrCounter == 0) - FAIL(FATAL_ERROR_COUNTER_OVERFLOW); - } -} - -//*** PCRIsExtendAllowed() -// This function indicates a PCR may be extended at the current command locality. -// The return value is based on PCR attributes, and not the PCR allocation. -// Return Type: BOOL -// TRUE(1) extend is allowed -// FALSE(0) extend is not allowed -BOOL -PCRIsExtendAllowed( - TPMI_DH_PCR handle // IN: PCR handle to be extended - ) -{ - UINT8 commandLocality; - UINT8 localityBits = 1; - UINT32 pcr = handle - PCR_FIRST; - - // Check for the locality - commandLocality = _plat__LocalityGet(); - localityBits = localityBits << commandLocality; - if((localityBits & s_initAttributes[pcr].extendLocality) == 0) - return FALSE; - else - return TRUE; -} - -//*** PCRExtend() -// This function is used to extend a PCR in a specific bank. -void -PCRExtend( - TPMI_DH_PCR handle, // IN: PCR handle to be extended - TPMI_ALG_HASH hash, // IN: hash algorithm of PCR - UINT32 size, // IN: size of data to be extended - BYTE *data // IN: data to be extended - ) -{ - BYTE *pcrData; - HASH_STATE hashState; - UINT16 pcrSize; - - pcrData = GetPcrPointer(hash, handle - PCR_FIRST); - - // Extend PCR if it is allocated - if(pcrData != NULL) - { - pcrSize = CryptHashGetDigestSize(hash); - CryptHashStart(&hashState, hash); - CryptDigestUpdate(&hashState, pcrSize, pcrData); - CryptDigestUpdate(&hashState, size, data); - CryptHashEnd(&hashState, pcrSize, pcrData); - - // PCR has changed so update the pcrCounter if necessary - PCRChanged(handle); - } - - return; -} - -//*** PCRComputeCurrentDigest() -// This function computes the digest of the selected PCR. -// -// As a side-effect, 'selection' is modified so that only the implemented PCR -// will have their bits still set. -void -PCRComputeCurrentDigest( - TPMI_ALG_HASH hashAlg, // IN: hash algorithm to compute digest - TPML_PCR_SELECTION *selection, // IN/OUT: PCR selection (filtered on - // output) - TPM2B_DIGEST *digest // OUT: digest - ) -{ - HASH_STATE hashState; - TPMS_PCR_SELECTION *select; - BYTE *pcrData; // will point to a digest - UINT32 pcrSize; - UINT32 pcr; - UINT32 i; - - // Initialize the hash - digest->t.size = CryptHashStart(&hashState, hashAlg); - pAssert(digest->t.size > 0 && digest->t.size < UINT16_MAX); - - // Iterate through the list of PCR selection structures - for(i = 0; i < selection->count; i++) - { - // Point to the current selection - select = &selection->pcrSelections[i]; // Point to the current selection - FilterPcr(select); // Clear out the bits for unimplemented PCR - - // Need the size of each digest - pcrSize = CryptHashGetDigestSize(selection->pcrSelections[i].hash); - - // Iterate through the selection - for(pcr = 0; pcr < IMPLEMENTATION_PCR; pcr++) - { - if(IsPcrSelected(pcr, select)) // Is this PCR selected - { - // Get pointer to the digest data for the bank - pcrData = GetPcrPointer(selection->pcrSelections[i].hash, pcr); - pAssert(pcrData != NULL); - CryptDigestUpdate(&hashState, pcrSize, pcrData); // add to digest - } - } - } - // Complete hash stack - CryptHashEnd2B(&hashState, &digest->b); - - return; -} - -//*** PCRRead() -// This function is used to read a list of selected PCR. If the requested PCR -// number exceeds the maximum number that can be output, the 'selection' is -// adjusted to reflect the actual output PCR. -void -PCRRead( - TPML_PCR_SELECTION *selection, // IN/OUT: PCR selection (filtered on - // output) - TPML_DIGEST *digest, // OUT: digest - UINT32 *pcrCounter // OUT: the current value of PCR generation - // number - ) -{ - TPMS_PCR_SELECTION *select; - BYTE *pcrData; // will point to a digest - UINT32 pcr; - UINT32 i; - - digest->count = 0; - - // Iterate through the list of PCR selection structures - for(i = 0; i < selection->count; i++) - { - // Point to the current selection - select = &selection->pcrSelections[i]; // Point to the current selection - FilterPcr(select); // Clear out the bits for unimplemented PCR - - // Iterate through the selection - for(pcr = 0; pcr < IMPLEMENTATION_PCR; pcr++) - { - if(IsPcrSelected(pcr, select)) // Is this PCR selected - { - // Check if number of digest exceed upper bound - if(digest->count > 7) - { - // Clear rest of the current select bitmap - while(pcr < IMPLEMENTATION_PCR - // do not round up! - && (pcr / 8) < select->sizeofSelect) - { - // do not round up! - select->pcrSelect[pcr / 8] &= (BYTE)~(1 << (pcr % 8)); - pcr++; - } - // Exit inner loop - break; - } - // Need the size of each digest - digest->digests[digest->count].t.size = - CryptHashGetDigestSize(selection->pcrSelections[i].hash); - - // Get pointer to the digest data for the bank - pcrData = GetPcrPointer(selection->pcrSelections[i].hash, pcr); - pAssert(pcrData != NULL); - // Add to the data to digest - MemoryCopy(digest->digests[digest->count].t.buffer, - pcrData, - digest->digests[digest->count].t.size); - digest->count++; - } - } - // If we exit inner loop because we have exceed the output upper bound - if(digest->count > 7 && pcr < IMPLEMENTATION_PCR) - { - // Clear rest of the selection - while(i < selection->count) - { - MemorySet(selection->pcrSelections[i].pcrSelect, 0, - selection->pcrSelections[i].sizeofSelect); - i++; - } - // exit outer loop - break; - } - } - - *pcrCounter = gr.pcrCounter; - - return; -} - -//*** PCRAllocate() -// This function is used to change the PCR allocation. -// Return Type: TPM_RC -// TPM_RC_NO_RESULT allocate failed -// TPM_RC_PCR improper allocation -TPM_RC -PCRAllocate( - TPML_PCR_SELECTION *allocate, // IN: required allocation - UINT32 *maxPCR, // OUT: Maximum number of PCR - UINT32 *sizeNeeded, // OUT: required space - UINT32 *sizeAvailable // OUT: available space - ) -{ - UINT32 i, j, k; - TPML_PCR_SELECTION newAllocate; - // Initialize the flags to indicate if HCRTM PCR and DRTM PCR are allocated. - BOOL pcrHcrtm = FALSE; - BOOL pcrDrtm = FALSE; - - // Create the expected new PCR allocation based on the existing allocation - // and the new input: - // 1. if a PCR bank does not appear in the new allocation, the existing - // allocation of this PCR bank will be preserved. - // 2. if a PCR bank appears multiple times in the new allocation, only the - // last one will be in effect. - newAllocate = gp.pcrAllocated; - for(i = 0; i < allocate->count; i++) - { - for(j = 0; j < newAllocate.count; j++) - { - // If hash matches, the new allocation covers the old allocation - // for this particular bank. - // The assumption is the initial PCR allocation (from manufacture) - // has all the supported hash algorithms with an assigned bank - // (possibly empty). So there must be a match for any new bank - // allocation from the input. - if(newAllocate.pcrSelections[j].hash == - allocate->pcrSelections[i].hash) - { - newAllocate.pcrSelections[j] = allocate->pcrSelections[i]; - break; - } - } - // The j loop must exit with a match. - pAssert(j < newAllocate.count); - } - - // Max PCR in a bank is MIN(implemented PCR, PCR with attributes defined) - *maxPCR = sizeof(s_initAttributes) / sizeof(PCR_Attributes); - if(*maxPCR > IMPLEMENTATION_PCR) - *maxPCR = IMPLEMENTATION_PCR; - - // Compute required size for allocation - *sizeNeeded = 0; - for(i = 0; i < newAllocate.count; i++) - { - UINT32 digestSize - = CryptHashGetDigestSize(newAllocate.pcrSelections[i].hash); -#if defined(DRTM_PCR) - // Make sure that we end up with at least one DRTM PCR - pcrDrtm = pcrDrtm || TestBit(DRTM_PCR, - newAllocate.pcrSelections[i].pcrSelect, - newAllocate.pcrSelections[i].sizeofSelect); - -#else // if DRTM PCR is not required, indicate that the allocation is OK - pcrDrtm = TRUE; -#endif - -#if defined(HCRTM_PCR) - // and one HCRTM PCR (since this is usually PCR 0...) - pcrHcrtm = pcrHcrtm || TestBit(HCRTM_PCR, - newAllocate.pcrSelections[i].pcrSelect, - newAllocate.pcrSelections[i].sizeofSelect); -#else - pcrHcrtm = TRUE; -#endif - for(j = 0; j < newAllocate.pcrSelections[i].sizeofSelect; j++) - { - BYTE mask = 1; - for(k = 0; k < 8; k++) - { - if((newAllocate.pcrSelections[i].pcrSelect[j] & mask) != 0) - *sizeNeeded += digestSize; - mask = mask << 1; - } - } - } - - if(!pcrDrtm || !pcrHcrtm) - return TPM_RC_PCR; - - // In this particular implementation, we always have enough space to - // allocate PCR. Different implementation may return a sizeAvailable less - // than the sizeNeed. - *sizeAvailable = sizeof(s_pcrs); - - // Save the required allocation to NV. Note that after NV is written, the - // PCR allocation in NV is no longer consistent with the RAM data - // gp.pcrAllocated. The NV version reflect the allocate after next - // TPM_RESET, while the RAM version reflects the current allocation - NV_WRITE_PERSISTENT(pcrAllocated, newAllocate); - - return TPM_RC_SUCCESS; -} - -//*** PCRSetValue() -// This function is used to set the designated PCR in all banks to an initial value. -// The initial value is signed and will be sign extended into the entire PCR. -// -void -PCRSetValue( - TPM_HANDLE handle, // IN: the handle of the PCR to set - INT8 initialValue // IN: the value to set - ) -{ - int i; - UINT32 pcr = handle - PCR_FIRST; - TPMI_ALG_HASH hash; - UINT16 digestSize; - BYTE *pcrData; - - // Iterate supported PCR bank algorithms to reset - for(i = 0; i < HASH_COUNT; i++) - { - hash = CryptHashGetAlgByIndex(i); - // Prevent runaway - if(hash == TPM_ALG_NULL) - break; - - // Get a pointer to the data - pcrData = GetPcrPointer(gp.pcrAllocated.pcrSelections[i].hash, pcr); - - // If the PCR is allocated - if(pcrData != NULL) - { - // And the size of the digest - digestSize = CryptHashGetDigestSize(hash); - - // Set the LSO to the input value - pcrData[digestSize - 1] = initialValue; - - // Sign extend - if(initialValue >= 0) - MemorySet(pcrData, 0, digestSize - 1); - else - MemorySet(pcrData, -1, digestSize - 1); - } - } -} - -//*** PCRResetDynamics -// This function is used to reset a dynamic PCR to 0. This function is used in -// DRTM sequence. -void -PCRResetDynamics( - void - ) -{ - UINT32 pcr, i; - - // Initialize PCR values - for(pcr = 0; pcr < IMPLEMENTATION_PCR; pcr++) - { - // Iterate each hash algorithm bank - for(i = 0; i < gp.pcrAllocated.count; i++) - { - BYTE *pcrData; - UINT32 pcrSize; - - pcrData = GetPcrPointer(gp.pcrAllocated.pcrSelections[i].hash, pcr); - - if(pcrData != NULL) - { - pcrSize = - CryptHashGetDigestSize(gp.pcrAllocated.pcrSelections[i].hash); - - // Reset PCR - // Any PCR can be reset by locality 4 should be reset to 0 - if((s_initAttributes[pcr].resetLocality & 0x10) != 0) - MemorySet(pcrData, 0, pcrSize); - } - } - } - return; -} - -//*** PCRCapGetAllocation() -// This function is used to get the current allocation of PCR banks. -// Return Type: TPMI_YES_NO -// YES if the return count is 0 -// NO if the return count is not 0 -TPMI_YES_NO -PCRCapGetAllocation( - UINT32 count, // IN: count of return - TPML_PCR_SELECTION *pcrSelection // OUT: PCR allocation list - ) -{ - if(count == 0) - { - pcrSelection->count = 0; - return YES; - } - else - { - *pcrSelection = gp.pcrAllocated; - return NO; - } -} - -//*** PCRSetSelectBit() -// This function sets a bit in a bitmap array. -static void -PCRSetSelectBit( - UINT32 pcr, // IN: PCR number - BYTE *bitmap // OUT: bit map to be set - ) -{ - bitmap[pcr / 8] |= (1 << (pcr % 8)); - return; -} - -//*** PCRGetProperty() -// This function returns the selected PCR property. -// Return Type: BOOL -// TRUE(1) the property type is implemented -// FALSE(0) the property type is not implemented -static BOOL -PCRGetProperty( - TPM_PT_PCR property, - TPMS_TAGGED_PCR_SELECT *select - ) -{ - UINT32 pcr; - UINT32 groupIndex; - - select->tag = property; - // Always set the bitmap to be the size of all PCR - select->sizeofSelect = (IMPLEMENTATION_PCR + 7) / 8; - - // Initialize bitmap - MemorySet(select->pcrSelect, 0, select->sizeofSelect); - - // Collecting properties - for(pcr = 0; pcr < IMPLEMENTATION_PCR; pcr++) - { - switch(property) - { - case TPM_PT_PCR_SAVE: - if(s_initAttributes[pcr].stateSave == SET) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_EXTEND_L0: - if((s_initAttributes[pcr].extendLocality & 0x01) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_RESET_L0: - if((s_initAttributes[pcr].resetLocality & 0x01) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_EXTEND_L1: - if((s_initAttributes[pcr].extendLocality & 0x02) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_RESET_L1: - if((s_initAttributes[pcr].resetLocality & 0x02) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_EXTEND_L2: - if((s_initAttributes[pcr].extendLocality & 0x04) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_RESET_L2: - if((s_initAttributes[pcr].resetLocality & 0x04) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_EXTEND_L3: - if((s_initAttributes[pcr].extendLocality & 0x08) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_RESET_L3: - if((s_initAttributes[pcr].resetLocality & 0x08) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_EXTEND_L4: - if((s_initAttributes[pcr].extendLocality & 0x10) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_RESET_L4: - if((s_initAttributes[pcr].resetLocality & 0x10) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; - case TPM_PT_PCR_DRTM_RESET: - // DRTM reset PCRs are the PCR reset by locality 4 - if((s_initAttributes[pcr].resetLocality & 0x10) != 0) - PCRSetSelectBit(pcr, select->pcrSelect); - break; -#if defined NUM_POLICY_PCR_GROUP && NUM_POLICY_PCR_GROUP > 0 - case TPM_PT_PCR_POLICY: - if(PCRBelongsPolicyGroup(pcr + PCR_FIRST, &groupIndex)) - PCRSetSelectBit(pcr, select->pcrSelect); - break; -#endif -#if defined NUM_AUTHVALUE_PCR_GROUP && NUM_AUTHVALUE_PCR_GROUP > 0 - case TPM_PT_PCR_AUTH: - if(PCRBelongsAuthGroup(pcr + PCR_FIRST, &groupIndex)) - PCRSetSelectBit(pcr, select->pcrSelect); - break; -#endif -#if ENABLE_PCR_NO_INCREMENT == YES - case TPM_PT_PCR_NO_INCREMENT: - if(PCRBelongsTCBGroup(pcr + PCR_FIRST)) - PCRSetSelectBit(pcr, select->pcrSelect); - break; -#endif - default: - // If property is not supported, stop scanning PCR attributes - // and return. - return FALSE; - break; - } - } - return TRUE; -} - -//*** PCRCapGetProperties() -// This function returns a list of PCR properties starting at 'property'. -// Return Type: TPMI_YES_NO -// YES if no more property is available -// NO if there are more properties not reported -TPMI_YES_NO -PCRCapGetProperties( - TPM_PT_PCR property, // IN: the starting PCR property - UINT32 count, // IN: count of returned properties - TPML_TAGGED_PCR_PROPERTY *select // OUT: PCR select - ) -{ - TPMI_YES_NO more = NO; - UINT32 i; - - // Initialize output property list - select->count = 0; - - // The maximum count of properties we may return is MAX_PCR_PROPERTIES - if(count > MAX_PCR_PROPERTIES) count = MAX_PCR_PROPERTIES; - - // TPM_PT_PCR_FIRST is defined as 0 in spec. It ensures that property - // value would never be less than TPM_PT_PCR_FIRST - cAssert(TPM_PT_PCR_FIRST == 0); - - // Iterate PCR properties. TPM_PT_PCR_LAST is the index of the last property - // implemented on the TPM. - for(i = property; i <= TPM_PT_PCR_LAST; i++) - { - if(select->count < count) - { - // If we have not filled up the return list, add more properties to it - if(PCRGetProperty(i, &select->pcrProperty[select->count])) - // only increment if the property is implemented - select->count++; - } - else - { - // If the return list is full but we still have properties - // available, report this and stop iterating. - more = YES; - break; - } - } - return more; -} - -//*** PCRCapGetHandles() -// This function is used to get a list of handles of PCR, started from 'handle'. -// If 'handle' exceeds the maximum PCR handle range, an empty list will be -// returned and the return value will be NO. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -PCRCapGetHandles( - TPMI_DH_PCR handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle - ) -{ - TPMI_YES_NO more = NO; - UINT32 i; - - pAssert(HandleGetType(handle) == TPM_HT_PCR); - - // Initialize output handle list - handleList->count = 0; - - // The maximum count of handles we may return is MAX_CAP_HANDLES - if(count > MAX_CAP_HANDLES) count = MAX_CAP_HANDLES; - - // Iterate PCR handle range - for(i = handle & HR_HANDLE_MASK; i <= PCR_LAST; i++) - { - if(handleList->count < count) - { - // If we have not filled up the return list, add this PCR - // handle to it - handleList->handle[handleList->count] = i + PCR_FIRST; - handleList->count++; - } - else - { - // If the return list is full but we still have PCR handle - // available, report this and stop iterating - more = YES; - break; - } - } - return more; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/PP.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/PP.c deleted file mode 100644 index 5d17d2014..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/PP.c +++ /dev/null @@ -1,179 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions that support the physical presence operations -// of the TPM. - -//** Includes - -#include "Tpm.h" - -//** Functions - -//*** PhysicalPresencePreInstall_Init() -// This function is used to initialize the array of commands that always require -// confirmation with physical presence. The array is an array of bits that -// has a correspondence with the command code. -// -// This command should only ever be executable in a manufacturing setting or in -// a simulation. -// -// When set, these cannot be cleared. -// -void -PhysicalPresencePreInstall_Init( - void - ) -{ - COMMAND_INDEX commandIndex; - // Clear all the PP commands - MemorySet(&gp.ppList, 0, sizeof(gp.ppList)); - - // Any command that is PP_REQUIRED should be SET - for(commandIndex = 0; commandIndex < COMMAND_COUNT; commandIndex++) - { - if(s_commandAttributes[commandIndex] & IS_IMPLEMENTED - && s_commandAttributes[commandIndex] & PP_REQUIRED) - SET_BIT(commandIndex, gp.ppList); - } - // Write PP list to NV - NV_SYNC_PERSISTENT(ppList); - return; -} - -//*** PhysicalPresenceCommandSet() -// This function is used to set the indicator that a command requires -// PP confirmation. -void -PhysicalPresenceCommandSet( - TPM_CC commandCode // IN: command code - ) -{ - COMMAND_INDEX commandIndex = CommandCodeToCommandIndex(commandCode); - - // if the command isn't implemented, the do nothing - if(commandIndex == UNIMPLEMENTED_COMMAND_INDEX) - return; - - // only set the bit if this is a command for which PP is allowed - if(s_commandAttributes[commandIndex] & PP_COMMAND) - SET_BIT(commandIndex, gp.ppList); - return; -} - -//*** PhysicalPresenceCommandClear() -// This function is used to clear the indicator that a command requires PP -// confirmation. -void -PhysicalPresenceCommandClear( - TPM_CC commandCode // IN: command code - ) -{ - COMMAND_INDEX commandIndex = CommandCodeToCommandIndex(commandCode); - - // If the command isn't implemented, then don't do anything - if(commandIndex == UNIMPLEMENTED_COMMAND_INDEX) - return; - - // Only clear the bit if the command does not require PP - if((s_commandAttributes[commandIndex] & PP_REQUIRED) == 0) - CLEAR_BIT(commandIndex, gp.ppList); - - return; -} - -//*** PhysicalPresenceIsRequired() -// This function indicates if PP confirmation is required for a command. -// Return Type: BOOL -// TRUE(1) physical presence is required -// FALSE(0) physical presence is not required -BOOL -PhysicalPresenceIsRequired( - COMMAND_INDEX commandIndex // IN: command index - ) -{ - // Check the bit map. If the bit is SET, PP authorization is required - return (TEST_BIT(commandIndex, gp.ppList)); -} - -//*** PhysicalPresenceCapGetCCList() -// This function returns a list of commands that require PP confirmation. The -// list starts from the first implemented command that has a command code that -// the same or greater than 'commandCode'. -// Return Type: TPMI_YES_NO -// YES if there are more command codes available -// NO all the available command codes have been returned -TPMI_YES_NO -PhysicalPresenceCapGetCCList( - TPM_CC commandCode, // IN: start command code - UINT32 count, // IN: count of returned TPM_CC - TPML_CC *commandList // OUT: list of TPM_CC - ) -{ - TPMI_YES_NO more = NO; - COMMAND_INDEX commandIndex; - - // Initialize output handle list - commandList->count = 0; - - // The maximum count of command we may return is MAX_CAP_CC - if(count > MAX_CAP_CC) count = MAX_CAP_CC; - - // Collect PP commands - for(commandIndex = GetClosestCommandIndex(commandCode); - commandIndex != UNIMPLEMENTED_COMMAND_INDEX; - commandIndex = GetNextCommandIndex(commandIndex)) - { - if(PhysicalPresenceIsRequired(commandIndex)) - { - if(commandList->count < count) - { - // If we have not filled up the return list, add this command - // code to it - commandList->commandCodes[commandList->count] - = GetCommandCode(commandIndex); - commandList->count++; - } - else - { - // If the return list is full but we still have PP command - // available, report this and stop iterating - more = YES; - break; - } - } - } - return more; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Session.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Session.c deleted file mode 100644 index f0a1b13ce..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Session.c +++ /dev/null @@ -1,1068 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//**Introduction -/* - The code in this file is used to manage the session context counter. - The scheme implemented here is a "truncated counter". - This scheme allows the TPM to not need TPM_SU_CLEAR for a - very long period of time and still not have the context - count for a session repeated. - - The counter (contextCounter)in this implementation is a UINT64 but - can be smaller. The "tracking array" (contextArray) only - has 16-bits per context. The tracking array is the data - that needs to be saved and restored across TPM_SU_STATE so that - sessions are not lost when the system enters the sleep state. - Also, when the TPM is active, the tracking array is kept in - RAM making it important that the number of bytes for each - entry be kept as small as possible. - - The TPM prevents "collisions" of these truncated values by - not allowing a contextID to be assigned if it would be the - same as an existing value. Since the array holds 16 bits, - after a context has been saved, an additional 2^16-1 contexts - may be saved before the count would again match. The normal - expectation is that the context will be flushed before its count - value is needed again but it is always possible to have long-lived - sessions. - - The contextID is assigned when the context is saved (TPM2_ContextSave()). - At that time, the TPM will compare the low-order 16 bits of - contextCounter to the existing values in contextArray and if one - matches, the TPM will return TPM_RC_CONTEXT_GAP (by construction, - the entry that contains the matching value is the oldest - context). - - The expected remediation by the TRM is to load the oldest saved - session context (the one found by the TPM), and save it. Since loading - the oldest session also eliminates its contextID value from - contextArray, there TPM will always be able to load and save the oldest - existing context. - - In the worst case, software may have to load and save several contexts - in order to save an additional one. This should happen very infrequently. - - When the TPM searches contextArray and finds that none of the contextIDs - match the low-order 16-bits of contextCount, the TPM can copy the low bits - to the contextArray associated with the session, and increment contextCount. - - There is one entry in contextArray for each of the active sessions - allowed by the TPM implementation. This array contains either a - context count, an index, or a value indicating the slot is available (0). - - The index into the contextArray is the handle for the session with the region - selector byte of the session set to zero. If an entry in contextArray contains - 0, then the corresponding handle may be assigned to a session. If the entry - contains a value that is less than or equal to the number of loaded sessions - for the TPM, then the array entry is the slot in which the context is loaded. - - EXAMPLE: If the TPM allows 8 loaded sessions, then the slot numbers would - be 1-8 and a contextArrary value in that range would represent the loaded - session. - - NOTE: When the TPM firmware determines that the array entry is for a loaded - session, it will subtract 1 to create the zero-based slot number. - - There is one significant corner case in this scheme. When the contextCount - is equal to a value in the contextArray, the oldest session needs to be - recycled or flushed. In order to recycle the session, it must be loaded. - To be loaded, there must be an available slot. Rather than require that a - spare slot be available all the time, the TPM will check to see if the - contextCount is equal to some value in the contextArray when a session is - created. This prevents the last session slot from being used when it - is likely that a session will need to be recycled. - - If a TPM with both 1.2 and 2.0 functionality uses this scheme for both - 1.2 and 2.0 sessions, and the list of active contexts is read with - TPM_GetCapabiltiy(), the TPM will create 32-bit representations of the - list that contains 16-bit values (the TPM2_GetCapability() returns a list - of handles for active sessions rather than a list of contextID). The full - contextID has high-order bits that are either the same as the current - contextCount or one less. It is one less if the 16-bits - of the contextArray has a value that is larger than the low-order 16 bits - of contextCount. -*/ - -//** Includes, Defines, and Local Variables -#define SESSION_C -#include "Tpm.h" - -//** File Scope Function -- ContextIdSetOldest() -/* - This function is called when the oldest contextID is being loaded or deleted. - Once a saved context becomes the oldest, it stays the oldest until it is - deleted. - - Finding the oldest is a bit tricky. It is not just the numeric comparison of - values but is dependent on the value of contextCounter. - - Assume we have a small contextArray with 8, 4-bit values with values 1 and 2 - used to indicate the loaded context slot number. Also assume that the array - contains hex values of (0 0 1 0 3 0 9 F) and that the contextCounter is an - 8-bit counter with a value of 0x37. Since the low nibble is 7, that means - that values above 7 are older than values below it and, in this example, - 9 is the oldest value. - - Note if we subtract the counter value, from each slot that contains a saved - contextID we get (- - - - B - 2 - 8) and the oldest entry is now easy to find. -*/ -static void -ContextIdSetOldest( - void - ) -{ - CONTEXT_SLOT lowBits; - CONTEXT_SLOT entry; - CONTEXT_SLOT smallest = ((CONTEXT_SLOT)~0); - UINT32 i; - - // Set oldestSaveContext to a value indicating none assigned - s_oldestSavedSession = MAX_ACTIVE_SESSIONS + 1; - - lowBits = (CONTEXT_SLOT)gr.contextCounter; - for(i = 0; i < MAX_ACTIVE_SESSIONS; i++) - { - entry = gr.contextArray[i]; - - // only look at entries that are saved contexts - if(entry > MAX_LOADED_SESSIONS) - { - // Use a less than or equal in case the oldest - // is brand new (= lowBits-1) and equal to our initial - // value for smallest. - if(((CONTEXT_SLOT)(entry - lowBits)) <= smallest) - { - smallest = (entry - lowBits); - s_oldestSavedSession = i; - } - } - } - // When we finish, either the s_oldestSavedSession still has its initial - // value, or it has the index of the oldest saved context. -} - -//** Startup Function -- SessionStartup() -// This function initializes the session subsystem on TPM2_Startup(). -BOOL -SessionStartup( - STARTUP_TYPE type - ) -{ - UINT32 i; - - // Initialize session slots. At startup, all the in-memory session slots - // are cleared and marked as not occupied - for(i = 0; i < MAX_LOADED_SESSIONS; i++) - s_sessions[i].occupied = FALSE; // session slot is not occupied - - // The free session slots the number of maximum allowed loaded sessions - s_freeSessionSlots = MAX_LOADED_SESSIONS; - - // Initialize context ID data. On a ST_SAVE or hibernate sequence, it will - // scan the saved array of session context counts, and clear any entry that - // references a session that was in memory during the state save since that - // memory was not preserved over the ST_SAVE. - if(type == SU_RESUME || type == SU_RESTART) - { - // On ST_SAVE we preserve the contexts that were saved but not the ones - // in memory - for(i = 0; i < MAX_ACTIVE_SESSIONS; i++) - { - // If the array value is unused or references a loaded session then - // that loaded session context is lost and the array entry is - // reclaimed. - if(gr.contextArray[i] <= MAX_LOADED_SESSIONS) - gr.contextArray[i] = 0; - } - // Find the oldest session in context ID data and set it in - // s_oldestSavedSession - ContextIdSetOldest(); - } - else - { - // For STARTUP_CLEAR, clear out the contextArray - for(i = 0; i < MAX_ACTIVE_SESSIONS; i++) - gr.contextArray[i] = 0; - - // reset the context counter - gr.contextCounter = MAX_LOADED_SESSIONS + 1; - - // Initialize oldest saved session - s_oldestSavedSession = MAX_ACTIVE_SESSIONS + 1; - } - return TRUE; -} - -//************************************************ -//** Access Functions -//************************************************ - -//*** SessionIsLoaded() -// This function test a session handle references a loaded session. The handle -// must have previously been checked to make sure that it is a valid handle for -// an authorization session. -// NOTE: A PWAP authorization does not have a session. -// -// Return Type: BOOL -// TRUE(1) session is loaded -// FALSE(0) session is not loaded -// -BOOL -SessionIsLoaded( - TPM_HANDLE handle // IN: session handle - ) -{ - pAssert(HandleGetType(handle) == TPM_HT_POLICY_SESSION - || HandleGetType(handle) == TPM_HT_HMAC_SESSION); - - handle = handle & HR_HANDLE_MASK; - - // if out of range of possible active session, or not assigned to a loaded - // session return false - if(handle >= MAX_ACTIVE_SESSIONS - || gr.contextArray[handle] == 0 - || gr.contextArray[handle] > MAX_LOADED_SESSIONS) - return FALSE; - - return TRUE; -} - -//*** SessionIsSaved() -// This function test a session handle references a saved session. The handle -// must have previously been checked to make sure that it is a valid handle for -// an authorization session. -// NOTE: An password authorization does not have a session. -// -// This function requires that the handle be a valid session handle. -// -// Return Type: BOOL -// TRUE(1) session is saved -// FALSE(0) session is not saved -// -BOOL -SessionIsSaved( - TPM_HANDLE handle // IN: session handle - ) -{ - pAssert(HandleGetType(handle) == TPM_HT_POLICY_SESSION - || HandleGetType(handle) == TPM_HT_HMAC_SESSION); - - handle = handle & HR_HANDLE_MASK; - // if out of range of possible active session, or not assigned, or - // assigned to a loaded session, return false - if(handle >= MAX_ACTIVE_SESSIONS - || gr.contextArray[handle] == 0 - || gr.contextArray[handle] <= MAX_LOADED_SESSIONS - ) - return FALSE; - - return TRUE; -} - -//*** SequenceNumberForSavedContextIsValid() -// This function validates that the sequence number and handle value within a -// saved context are valid. -BOOL -SequenceNumberForSavedContextIsValid( - TPMS_CONTEXT *context // IN: pointer to a context structure to be - // validated - ) -{ -#define MAX_CONTEXT_GAP ((UINT64)((CONTEXT_SLOT) ~0) + 1) - - TPM_HANDLE handle = context->savedHandle & HR_HANDLE_MASK; - - if(// Handle must be with the range of active sessions - handle >= MAX_ACTIVE_SESSIONS - // the array entry must be for a saved context - || gr.contextArray[handle] <= MAX_LOADED_SESSIONS - // the array entry must agree with the sequence number - || gr.contextArray[handle] != (CONTEXT_SLOT)context->sequence - // the provided sequence number has to be less than the current counter - || context->sequence > gr.contextCounter - // but not so much that it could not be a valid sequence number - || gr.contextCounter - context->sequence > MAX_CONTEXT_GAP) - return FALSE; - - return TRUE; -} - -//*** SessionPCRValueIsCurrent() -// -// This function is used to check if PCR values have been updated since the -// last time they were checked in a policy session. -// -// This function requires the session is loaded. -// Return Type: BOOL -// TRUE(1) PCR value is current -// FALSE(0) PCR value is not current -BOOL -SessionPCRValueIsCurrent( - SESSION *session // IN: session structure - ) -{ - if(session->pcrCounter != 0 - && session->pcrCounter != gr.pcrCounter - ) - return FALSE; - else - return TRUE; -} - -//*** SessionGet() -// This function returns a pointer to the session object associated with a -// session handle. -// -// The function requires that the session is loaded. -SESSION * -SessionGet( - TPM_HANDLE handle // IN: session handle - ) -{ - size_t slotIndex; - CONTEXT_SLOT sessionIndex; - - pAssert(HandleGetType(handle) == TPM_HT_POLICY_SESSION - || HandleGetType(handle) == TPM_HT_HMAC_SESSION - ); - - slotIndex = handle & HR_HANDLE_MASK; - - pAssert(slotIndex < MAX_ACTIVE_SESSIONS); - - // get the contents of the session array. Because session is loaded, we - // should always get a valid sessionIndex - sessionIndex = gr.contextArray[slotIndex] - 1; - - pAssert(sessionIndex < MAX_LOADED_SESSIONS); - - return &s_sessions[sessionIndex].session; -} - -//************************************************ -//** Utility Functions -//************************************************ - -//*** ContextIdSessionCreate() -// -// This function is called when a session is created. It will check -// to see if the current gap would prevent a context from being saved. If -// so it will return TPM_RC_CONTEXT_GAP. Otherwise, it will try to find -// an open slot in contextArray, set contextArray to the slot. -// -// This routine requires that the caller has determined the session array -// index for the session. -// -// Return Type: TPM_RC -// TPM_RC_CONTEXT_GAP can't assign a new contextID until the oldest -// saved session context is recycled -// TPM_RC_SESSION_HANDLE there is no slot available in the context array -// for tracking of this session context -static TPM_RC -ContextIdSessionCreate( - TPM_HANDLE *handle, // OUT: receives the assigned handle. This will - // be an index that must be adjusted by the - // caller according to the type of the - // session created - UINT32 sessionIndex // IN: The session context array entry that will - // be occupied by the created session - ) -{ - pAssert(sessionIndex < MAX_LOADED_SESSIONS); - - // check to see if creating the context is safe - // Is this going to be an assignment for the last session context - // array entry? If so, then there will be no room to recycle the - // oldest context if needed. If the gap is not at maximum, then - // it will be possible to save a context if it becomes necessary. - if(s_oldestSavedSession < MAX_ACTIVE_SESSIONS - && s_freeSessionSlots == 1) - { - // See if the gap is at maximum - // The current value of the contextCounter will be assigned to the next - // saved context. If the value to be assigned would make the same as an - // existing context, then we can't use it because of the ambiguity it would - // create. - if((CONTEXT_SLOT)gr.contextCounter - == gr.contextArray[s_oldestSavedSession]) - return TPM_RC_CONTEXT_GAP; - } - - // Find an unoccupied entry in the contextArray - for(*handle = 0; *handle < MAX_ACTIVE_SESSIONS; (*handle)++) - { - if(gr.contextArray[*handle] == 0) - { - // indicate that the session associated with this handle - // references a loaded session - gr.contextArray[*handle] = (CONTEXT_SLOT)(sessionIndex + 1); - return TPM_RC_SUCCESS; - } - } - return TPM_RC_SESSION_HANDLES; -} - -//*** SessionCreate() -// -// This function does the detailed work for starting an authorization session. -// This is done in a support routine rather than in the action code because -// the session management may differ in implementations. This implementation -// uses a fixed memory allocation to hold sessions and a fixed allocation -// to hold the contextID for the saved contexts. -// -// Return Type: TPM_RC -// TPM_RC_CONTEXT_GAP need to recycle sessions -// TPM_RC_SESSION_HANDLE active session space is full -// TPM_RC_SESSION_MEMORY loaded session space is full -TPM_RC -SessionCreate( - TPM_SE sessionType, // IN: the session type - TPMI_ALG_HASH authHash, // IN: the hash algorithm - TPM2B_NONCE *nonceCaller, // IN: initial nonceCaller - TPMT_SYM_DEF *symmetric, // IN: the symmetric algorithm - TPMI_DH_ENTITY bind, // IN: the bind object - TPM2B_DATA *seed, // IN: seed data - TPM_HANDLE *sessionHandle, // OUT: the session handle - TPM2B_NONCE *nonceTpm // OUT: the session nonce - ) -{ - TPM_RC result = TPM_RC_SUCCESS; - CONTEXT_SLOT slotIndex; - SESSION *session = NULL; - - pAssert(sessionType == TPM_SE_HMAC - || sessionType == TPM_SE_POLICY - || sessionType == TPM_SE_TRIAL); - - // If there are no open spots in the session array, then no point in searching - if(s_freeSessionSlots == 0) - return TPM_RC_SESSION_MEMORY; - - // Find a space for loading a session - for(slotIndex = 0; slotIndex < MAX_LOADED_SESSIONS; slotIndex++) - { - // Is this available? - if(s_sessions[slotIndex].occupied == FALSE) - { - session = &s_sessions[slotIndex].session; - break; - } - } - // if no spot found, then this is an internal error - if(slotIndex >= MAX_LOADED_SESSIONS) - FAIL(FATAL_ERROR_INTERNAL); - - // Call context ID function to get a handle. TPM_RC_SESSION_HANDLE may be - // returned from ContextIdHandelAssign() - result = ContextIdSessionCreate(sessionHandle, slotIndex); - if(result != TPM_RC_SUCCESS) - return result; - - //*** Only return from this point on is TPM_RC_SUCCESS - - // Can now indicate that the session array entry is occupied. - s_freeSessionSlots--; - s_sessions[slotIndex].occupied = TRUE; - - // Initialize the session data - MemorySet(session, 0, sizeof(SESSION)); - - // Initialize internal session data - session->authHashAlg = authHash; - // Initialize session type - if(sessionType == TPM_SE_HMAC) - { - *sessionHandle += HMAC_SESSION_FIRST; - } - else - { - *sessionHandle += POLICY_SESSION_FIRST; - - // For TPM_SE_POLICY or TPM_SE_TRIAL - session->attributes.isPolicy = SET; - if(sessionType == TPM_SE_TRIAL) - session->attributes.isTrialPolicy = SET; - - SessionSetStartTime(session); - - // Initialize policyDigest. policyDigest is initialized with a string of 0 - // of session algorithm digest size. Since the session is already clear. - // Just need to set the size - session->u2.policyDigest.t.size = - CryptHashGetDigestSize(session->authHashAlg); - } - // Create initial session nonce - session->nonceTPM.t.size = nonceCaller->t.size; - CryptRandomGenerate(session->nonceTPM.t.size, session->nonceTPM.t.buffer); - MemoryCopy2B(&nonceTpm->b, &session->nonceTPM.b, - sizeof(nonceTpm->t.buffer)); - - // Set up session parameter encryption algorithm - session->symmetric = *symmetric; - - // If there is a bind object or a session secret, then need to compute - // a sessionKey. - if(bind != TPM_RH_NULL || seed->t.size != 0) - { - // sessionKey = KDFa(hash, (authValue || seed), "ATH", nonceTPM, - // nonceCaller, bits) - // The HMAC key for generating the sessionSecret can be the concatenation - // of an authorization value and a seed value - TPM2B_TYPE(KEY, (sizeof(TPMT_HA) + sizeof(seed->t.buffer))); - TPM2B_KEY key; - - // Get hash size, which is also the length of sessionKey - session->sessionKey.t.size = CryptHashGetDigestSize(session->authHashAlg); - - // Get authValue of associated entity - EntityGetAuthValue(bind, (TPM2B_AUTH *)&key); - pAssert(key.t.size + seed->t.size <= sizeof(key.t.buffer)); - - // Concatenate authValue and seed - MemoryConcat2B(&key.b, &seed->b, sizeof(key.t.buffer)); - - // Compute the session key - CryptKDFa(session->authHashAlg, &key.b, SESSION_KEY, &session->nonceTPM.b, - &nonceCaller->b, - session->sessionKey.t.size * 8, session->sessionKey.t.buffer, - NULL, FALSE); - } - - // Copy the name of the entity that the HMAC session is bound to - // Policy session is not bound to an entity - if(bind != TPM_RH_NULL && sessionType == TPM_SE_HMAC) - { - session->attributes.isBound = SET; - SessionComputeBoundEntity(bind, &session->u1.boundEntity); - } - // If there is a bind object and it is subject to DA, then use of this session - // is subject to DA regardless of how it is used. - session->attributes.isDaBound = (bind != TPM_RH_NULL) - && (IsDAExempted(bind) == FALSE); - -// If the session is bound, then check to see if it is bound to lockoutAuth - session->attributes.isLockoutBound = (session->attributes.isDaBound == SET) - && (bind == TPM_RH_LOCKOUT); - return TPM_RC_SUCCESS; -} - -//*** SessionContextSave() -// This function is called when a session context is to be saved. The -// contextID of the saved session is returned. If no contextID can be -// assigned, then the routine returns TPM_RC_CONTEXT_GAP. -// If the function completes normally, the session slot will be freed. -// -// This function requires that 'handle' references a loaded session. -// Otherwise, it should not be called at the first place. -// -// Return Type: TPM_RC -// TPM_RC_CONTEXT_GAP a contextID could not be assigned -// TPM_RC_TOO_MANY_CONTEXTS the counter maxed out -// -TPM_RC -SessionContextSave( - TPM_HANDLE handle, // IN: session handle - CONTEXT_COUNTER *contextID // OUT: assigned contextID - ) -{ - UINT32 contextIndex; - CONTEXT_SLOT slotIndex; - - pAssert(SessionIsLoaded(handle)); - - // check to see if the gap is already maxed out - // Need to have a saved session - if(s_oldestSavedSession < MAX_ACTIVE_SESSIONS - // if the oldest saved session has the same value as the low bits - // of the contextCounter, then the GAP is maxed out. - && gr.contextArray[s_oldestSavedSession] == (CONTEXT_SLOT)gr.contextCounter) - return TPM_RC_CONTEXT_GAP; - - // if the caller wants the context counter, set it - if(contextID != NULL) - *contextID = gr.contextCounter; - - contextIndex = handle & HR_HANDLE_MASK; - pAssert(contextIndex < MAX_ACTIVE_SESSIONS); - - // Extract the session slot number referenced by the contextArray - // because we are going to overwrite this with the low order - // contextID value. - slotIndex = gr.contextArray[contextIndex] - 1; - - // Set the contextID for the contextArray - gr.contextArray[contextIndex] = (CONTEXT_SLOT)gr.contextCounter; - - // Increment the counter - gr.contextCounter++; - - // In the unlikely event that the 64-bit context counter rolls over... - if(gr.contextCounter == 0) - { - // back it up - gr.contextCounter--; - // return an error - return TPM_RC_TOO_MANY_CONTEXTS; - } - // if the low-order bits wrapped, need to advance the value to skip over - // the values used to indicate that a session is loaded - if(((CONTEXT_SLOT)gr.contextCounter) == 0) - gr.contextCounter += MAX_LOADED_SESSIONS + 1; - - // If no other sessions are saved, this is now the oldest. - if(s_oldestSavedSession >= MAX_ACTIVE_SESSIONS) - s_oldestSavedSession = contextIndex; - - // Mark the session slot as unoccupied - s_sessions[slotIndex].occupied = FALSE; - - // and indicate that there is an additional open slot - s_freeSessionSlots++; - - return TPM_RC_SUCCESS; -} - -//*** SessionContextLoad() -// This function is used to load a session from saved context. The session -// handle must be for a saved context. -// -// If the gap is at a maximum, then the only session that can be loaded is -// the oldest session, otherwise TPM_RC_CONTEXT_GAP is returned. -/// -// This function requires that 'handle' references a valid saved session. -// -// Return Type: TPM_RC -// TPM_RC_SESSION_MEMORY no free session slots -// TPM_RC_CONTEXT_GAP the gap count is maximum and this -// is not the oldest saved context -// -TPM_RC -SessionContextLoad( - SESSION_BUF *session, // IN: session structure from saved context - TPM_HANDLE *handle // IN/OUT: session handle - ) -{ - UINT32 contextIndex; - CONTEXT_SLOT slotIndex; - - pAssert(HandleGetType(*handle) == TPM_HT_POLICY_SESSION - || HandleGetType(*handle) == TPM_HT_HMAC_SESSION); - - // Don't bother looking if no openings - if(s_freeSessionSlots == 0) - return TPM_RC_SESSION_MEMORY; - - // Find a free session slot to load the session - for(slotIndex = 0; slotIndex < MAX_LOADED_SESSIONS; slotIndex++) - if(s_sessions[slotIndex].occupied == FALSE) break; - - // if no spot found, then this is an internal error - pAssert(slotIndex < MAX_LOADED_SESSIONS); - - contextIndex = *handle & HR_HANDLE_MASK; // extract the index - - // If there is only one slot left, and the gap is at maximum, the only session - // context that we can safely load is the oldest one. - if(s_oldestSavedSession < MAX_ACTIVE_SESSIONS - && s_freeSessionSlots == 1 - && (CONTEXT_SLOT)gr.contextCounter == gr.contextArray[s_oldestSavedSession] - && contextIndex != s_oldestSavedSession) - return TPM_RC_CONTEXT_GAP; - - pAssert(contextIndex < MAX_ACTIVE_SESSIONS); - - // set the contextArray value to point to the session slot where - // the context is loaded - gr.contextArray[contextIndex] = slotIndex + 1; - - // if this was the oldest context, find the new oldest - if(contextIndex == s_oldestSavedSession) - ContextIdSetOldest(); - - // Copy session data to session slot - MemoryCopy(&s_sessions[slotIndex].session, session, sizeof(SESSION)); - - // Set session slot as occupied - s_sessions[slotIndex].occupied = TRUE; - - // Reduce the number of open spots - s_freeSessionSlots--; - - return TPM_RC_SUCCESS; -} - -//*** SessionFlush() -// This function is used to flush a session referenced by its handle. If the -// session associated with 'handle' is loaded, the session array entry is -// marked as available. -// -// This function requires that 'handle' be a valid active session. -// -void -SessionFlush( - TPM_HANDLE handle // IN: loaded or saved session handle - ) -{ - CONTEXT_SLOT slotIndex; - UINT32 contextIndex; // Index into contextArray - - pAssert((HandleGetType(handle) == TPM_HT_POLICY_SESSION - || HandleGetType(handle) == TPM_HT_HMAC_SESSION - ) - && (SessionIsLoaded(handle) || SessionIsSaved(handle)) - ); - - // Flush context ID of this session - // Convert handle to an index into the contextArray - contextIndex = handle & HR_HANDLE_MASK; - - pAssert(contextIndex < sizeof(gr.contextArray) / sizeof(gr.contextArray[0])); - - // Get the current contents of the array - slotIndex = gr.contextArray[contextIndex]; - - // Mark context array entry as available - gr.contextArray[contextIndex] = 0; - - // Is this a saved session being flushed - if(slotIndex > MAX_LOADED_SESSIONS) - { - // Flushing the oldest session? - if(contextIndex == s_oldestSavedSession) - // If so, find a new value for oldest. - ContextIdSetOldest(); - } - else - { - // Adjust slot index to point to session array index - slotIndex -= 1; - - // Free session array index - s_sessions[slotIndex].occupied = FALSE; - s_freeSessionSlots++; - } - - return; -} - -//*** SessionComputeBoundEntity() -// This function computes the binding value for a session. The binding value -// for a reserved handle is the handle itself. For all the other entities, -// the authValue at the time of binding is included to prevent squatting. -// For those values, the Name and the authValue are concatenated -// into the bind buffer. If they will not both fit, the will be overlapped -// by XORing bytes. If XOR is required, the bind value will be full. -void -SessionComputeBoundEntity( - TPMI_DH_ENTITY entityHandle, // IN: handle of entity - TPM2B_NAME *bind // OUT: binding value - ) -{ - TPM2B_AUTH auth; - BYTE *pAuth = auth.t.buffer; - UINT16 i; - - // Get name - EntityGetName(entityHandle, bind); - -// // The bound value of a reserved handle is the handle itself -// if(bind->t.size == sizeof(TPM_HANDLE)) return; - - // For all the other entities, concatenate the authorization value to the name. - // Get a local copy of the authorization value because some overlapping - // may be necessary. - EntityGetAuthValue(entityHandle, &auth); - - // Make sure that the extra space is zeroed - MemorySet(&bind->t.name[bind->t.size], 0, sizeof(bind->t.name) - bind->t.size); - // XOR the authValue at the end of the name - for(i = sizeof(bind->t.name) - auth.t.size; i < sizeof(bind->t.name); i++) - bind->t.name[i] ^= *pAuth++; - - // Set the bind value to the maximum size - bind->t.size = sizeof(bind->t.name); - - return; -} - - -//*** SessionSetStartTime() -// This function is used to initialize the session timing -void -SessionSetStartTime( - SESSION *session // IN: the session to update - ) -{ - session->startTime = g_time; - session->epoch = g_timeEpoch; - session->timeout = 0; -} - -//*** SessionResetPolicyData() -// This function is used to reset the policy data without changing the nonce -// or the start time of the session. -void -SessionResetPolicyData( - SESSION *session // IN: the session to reset - ) -{ - SESSION_ATTRIBUTES oldAttributes; - pAssert(session != NULL); - - // Will need later - oldAttributes = session->attributes; - - // No command - session->commandCode = 0; - - // No locality selected - MemorySet(&session->commandLocality, 0, sizeof(session->commandLocality)); - - // The cpHash size to zero - session->u1.cpHash.b.size = 0; - - // No timeout - session->timeout = 0; - - // Reset the pcrCounter - session->pcrCounter = 0; - - // Reset the policy hash - MemorySet(&session->u2.policyDigest.t.buffer, 0, - session->u2.policyDigest.t.size); - - // Reset the session attributes - MemorySet(&session->attributes, 0, sizeof(SESSION_ATTRIBUTES)); - - // Restore the policy attributes - session->attributes.isPolicy = SET; - session->attributes.isTrialPolicy = oldAttributes.isTrialPolicy; - - // Restore the bind attributes - session->attributes.isDaBound = oldAttributes.isDaBound; - session->attributes.isLockoutBound = oldAttributes.isLockoutBound; -} - -//*** SessionCapGetLoaded() -// This function returns a list of handles of loaded session, started -// from input 'handle' -// -// 'Handle' must be in valid loaded session handle range, but does not -// have to point to a loaded session. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -SessionCapGetLoaded( - TPMI_SH_POLICY handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle - ) -{ - TPMI_YES_NO more = NO; - UINT32 i; - - pAssert(HandleGetType(handle) == TPM_HT_LOADED_SESSION); - - // Initialize output handle list - handleList->count = 0; - - // The maximum count of handles we may return is MAX_CAP_HANDLES - if(count > MAX_CAP_HANDLES) count = MAX_CAP_HANDLES; - - // Iterate session context ID slots to get loaded session handles - for(i = handle & HR_HANDLE_MASK; i < MAX_ACTIVE_SESSIONS; i++) - { - // If session is active - if(gr.contextArray[i] != 0) - { - // If session is loaded - if(gr.contextArray[i] <= MAX_LOADED_SESSIONS) - { - if(handleList->count < count) - { - SESSION *session; - - // If we have not filled up the return list, add this - // session handle to it - // assume that this is going to be an HMAC session - handle = i + HMAC_SESSION_FIRST; - session = SessionGet(handle); - if(session->attributes.isPolicy) - handle = i + POLICY_SESSION_FIRST; - handleList->handle[handleList->count] = handle; - handleList->count++; - } - else - { - // If the return list is full but we still have loaded object - // available, report this and stop iterating - more = YES; - break; - } - } - } - } - - return more; -} - -//*** SessionCapGetSaved() -// This function returns a list of handles for saved session, starting at -// 'handle'. -// -// 'Handle' must be in a valid handle range, but does not have to point to a -// saved session -// -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -SessionCapGetSaved( - TPMI_SH_HMAC handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle - ) -{ - TPMI_YES_NO more = NO; - UINT32 i; - -#ifdef TPM_HT_SAVED_SESSION - pAssert(HandleGetType(handle) == TPM_HT_SAVED_SESSION); -#else - pAssert(HandleGetType(handle) == TPM_HT_ACTIVE_SESSION); -#endif - - // Initialize output handle list - handleList->count = 0; - - // The maximum count of handles we may return is MAX_CAP_HANDLES - if(count > MAX_CAP_HANDLES) count = MAX_CAP_HANDLES; - - // Iterate session context ID slots to get loaded session handles - for(i = handle & HR_HANDLE_MASK; i < MAX_ACTIVE_SESSIONS; i++) - { - // If session is active - if(gr.contextArray[i] != 0) - { - // If session is saved - if(gr.contextArray[i] > MAX_LOADED_SESSIONS) - { - if(handleList->count < count) - { - // If we have not filled up the return list, add this - // session handle to it - handleList->handle[handleList->count] = i + HMAC_SESSION_FIRST; - handleList->count++; - } - else - { - // If the return list is full but we still have loaded object - // available, report this and stop iterating - more = YES; - break; - } - } - } - } - - return more; -} - -//*** SessionCapGetLoadedNumber() -// This function return the number of authorization sessions currently -// loaded into TPM RAM. -UINT32 -SessionCapGetLoadedNumber( - void - ) -{ - return MAX_LOADED_SESSIONS - s_freeSessionSlots; -} - -//*** SessionCapGetLoadedAvail() -// This function returns the number of additional authorization sessions, of -// any type, that could be loaded into TPM RAM. -// NOTE: In other implementations, this number may just be an estimate. The only -// requirement for the estimate is, if it is one or more, then at least one -// session must be loadable. -UINT32 -SessionCapGetLoadedAvail( - void - ) -{ - return s_freeSessionSlots; -} - -//*** SessionCapGetActiveNumber() -// This function returns the number of active authorization sessions currently -// being tracked by the TPM. -UINT32 -SessionCapGetActiveNumber( - void - ) -{ - UINT32 i; - UINT32 num = 0; - - // Iterate the context array to find the number of non-zero slots - for(i = 0; i < MAX_ACTIVE_SESSIONS; i++) - { - if(gr.contextArray[i] != 0) num++; - } - - return num; -} - -//*** SessionCapGetActiveAvail() -// This function returns the number of additional authorization sessions, of any -// type, that could be created. This not the number of slots for sessions, but -// the number of additional sessions that the TPM is capable of tracking. -UINT32 -SessionCapGetActiveAvail( - void - ) -{ - UINT32 i; - UINT32 num = 0; - - // Iterate the context array to find the number of zero slots - for(i = 0; i < MAX_ACTIVE_SESSIONS; i++) - { - if(gr.contextArray[i] == 0) num++; - } - - return num; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Time.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Time.c deleted file mode 100644 index 41d50076e..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/subsystem/Time.c +++ /dev/null @@ -1,276 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions relating to the TPM's time functions including -// the interface to the implementation-specific time functions. -// -//** Includes -#include "Tpm.h" -#include "PlatformData.h" - -//** Functions - -//*** TimePowerOn() -// This function initialize time info at _TPM_Init(). -// -// This function is called at _TPM_Init() so that the TPM time can start counting -// as soon as the TPM comes out of reset and doesn't have to wait until -// TPM2_Startup() in order to begin the new time epoch. This could be significant -// for systems that could get powered up but not run any TPM commands for some -// period of time. -// -void -TimePowerOn( - void - ) -{ - g_time = _plat__TimerRead(); -} - -//*** TimeNewEpoch() -// This function does the processing to generate a new time epoch nonce and -// set NV for update. This function is only called when NV is known to be available -// and the clock is running. The epoch is updated to persistent data. -static void -TimeNewEpoch( - void - ) -{ -#if CLOCK_STOPS - CryptRandomGenerate(sizeof(CLOCK_NONCE), (BYTE *)&g_timeEpoch); -#else - // if the epoch is kept in NV, update it. - gp.timeEpoch++; - NV_SYNC_PERSISTENT(timeEpoch); -#endif - // Clean out any lingering state - _plat__TimerWasStopped(); -} - -//*** TimeStartup() -// This function updates the resetCount and restartCount components of -// TPMS_CLOCK_INFO structure at TPM2_Startup(). -// -// This function will deal with the deferred creation of a new epoch. -// TimeUpdateToCurrent() will not start a new epoch even if one is due when -// TPM_Startup() has not been run. This is because the state of NV is not known -// until startup completes. When Startup is done, then it will create the epoch -// nonce to complete the initializations by calling this function. -BOOL -TimeStartup( - STARTUP_TYPE type // IN: start up type - ) -{ - NOT_REFERENCED(type); - // If the previous cycle is orderly shut down, the value of the safe bit - // the same as previously saved. Otherwise, it is not safe. - if(!NV_IS_ORDERLY) - go.clockSafe = NO; - return TRUE; -} - -//*** TimeClockUpdate() -// This function updates go.clock. If 'newTime' requires an update of NV, then -// NV is checked for availability. If it is not available or is rate limiting, then -// go.clock is not updated and the function returns an error. If 'newTime' would -// not cause an NV write, then go.clock is updated. If an NV write occurs, then -// go.safe is SET. -void -TimeClockUpdate( - UINT64 newTime // IN: New time value in mS. - ) -{ -#define CLOCK_UPDATE_MASK ((1ULL << NV_CLOCK_UPDATE_INTERVAL)- 1) - - // Check to see if the update will cause a need for an nvClock update - if((newTime | CLOCK_UPDATE_MASK) > (go.clock | CLOCK_UPDATE_MASK)) - { - pAssert(g_NvStatus == TPM_RC_SUCCESS); - - // Going to update the NV time state so SET the safe flag - go.clockSafe = YES; - - // update the time - go.clock = newTime; - - NvWrite(NV_ORDERLY_DATA, sizeof(go), &go); - } - else - // No NV update needed so just update - go.clock = newTime; - -} - -//*** TimeUpdate() -// This function is used to update the time and clock values. If the TPM -// has run TPM2_Startup(), this function is called at the start of each command. -// If the TPM has not run TPM2_Startup(), this is called from TPM2_Startup() to -// get the clock values initialized. It is not called on command entry because, in -// this implementation, the go structure is not read from NV until TPM2_Startup(). -// The reason for this is that the initialization code (_TPM_Init()) may run before -// NV is accessible. -void -TimeUpdate( - void - ) -{ - UINT64 elapsed; -// - // Make sure that we consume the current _plat__TimerWasStopped() state. - if(_plat__TimerWasStopped()) - { - TimeNewEpoch(); - } - // Get the difference between this call and the last time we updated the tick - // timer. - elapsed = _plat__TimerRead() - g_time; - // Don't read + - g_time += elapsed; - - // Don't need to check the result because it has to be success because have - // already checked that NV is available. - TimeClockUpdate(go.clock + elapsed); - - // Call self healing logic for dictionary attack parameters - DASelfHeal(); -} - -//*** TimeUpdateToCurrent() -// This function updates the 'Time' and 'Clock' in the global -// TPMS_TIME_INFO structure. -// -// In this implementation, 'Time' and 'Clock' are updated at the beginning -// of each command and the values are unchanged for the duration of the -// command. -// -// Because 'Clock' updates may require a write to NV memory, 'Time' and 'Clock' -// are not allowed to advance if NV is not available. When clock is not advancing, -// any function that uses 'Clock' will fail and return TPM_RC_NV_UNAVAILABLE or -// TPM_RC_NV_RATE. -// -// This implementation does not do rate limiting. If the implementation does do -// rate limiting, then the 'Clock' update should not be inhibited even when doing -// rate limiting. -void -TimeUpdateToCurrent( - void -) -{ - // Can't update time during the dark interval or when rate limiting so don't - // make any modifications to the internal clock value. Also, defer any clock - // processing until TPM has run TPM2_Startup() - if(!NV_IS_AVAILABLE || !TPMIsStarted()) - return; - - TimeUpdate(); -} - - -//*** TimeSetAdjustRate() -// This function is used to perform rate adjustment on 'Time' and 'Clock'. -void -TimeSetAdjustRate( - TPM_CLOCK_ADJUST adjust // IN: adjust constant - ) -{ - switch(adjust) - { - case TPM_CLOCK_COARSE_SLOWER: - _plat__ClockAdjustRate(CLOCK_ADJUST_COARSE); - break; - case TPM_CLOCK_COARSE_FASTER: - _plat__ClockAdjustRate(-CLOCK_ADJUST_COARSE); - break; - case TPM_CLOCK_MEDIUM_SLOWER: - _plat__ClockAdjustRate(CLOCK_ADJUST_MEDIUM); - break; - case TPM_CLOCK_MEDIUM_FASTER: - _plat__ClockAdjustRate(-CLOCK_ADJUST_MEDIUM); - break; - case TPM_CLOCK_FINE_SLOWER: - _plat__ClockAdjustRate(CLOCK_ADJUST_FINE); - break; - case TPM_CLOCK_FINE_FASTER: - _plat__ClockAdjustRate(-CLOCK_ADJUST_FINE); - break; - case TPM_CLOCK_NO_CHANGE: - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - - return; -} - -//*** TimeGetMarshaled() -// This function is used to access TPMS_TIME_INFO in canonical form. -// The function collects the time information and marshals it into 'dataBuffer' -// and returns the marshaled size -UINT16 -TimeGetMarshaled( - TIME_INFO *dataBuffer // OUT: result buffer - ) -{ - TPMS_TIME_INFO timeInfo; - - // Fill TPMS_TIME_INFO structure - timeInfo.time = g_time; - TimeFillInfo(&timeInfo.clockInfo); - - // Marshal TPMS_TIME_INFO to canonical form - return TPMS_TIME_INFO_Marshal(&timeInfo, (BYTE **)&dataBuffer, NULL); -} - -//*** TimeFillInfo -// This function gathers information to fill in a TPMS_CLOCK_INFO structure. -void -TimeFillInfo( - TPMS_CLOCK_INFO *clockInfo - ) -{ - clockInfo->clock = go.clock; - clockInfo->resetCount = gp.resetCount; - clockInfo->restartCount = gr.restartCount; - - // If NV is not available, clock stopped advancing and the value reported is - // not "safe". - if(NV_IS_AVAILABLE) - clockInfo->safe = go.clockSafe; - else - clockInfo->safe = NO; - - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/AlgorithmCap.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/AlgorithmCap.c deleted file mode 100644 index f46648abe..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/AlgorithmCap.c +++ /dev/null @@ -1,234 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// This file contains the algorithm property definitions for the algorithms and the -// code for the TPM2_GetCapability() to return the algorithm properties. - -//** Includes and Defines - -#include "Tpm.h" - -typedef struct -{ - TPM_ALG_ID algID; - TPMA_ALGORITHM attributes; -} ALGORITHM; - -static const ALGORITHM s_algorithms[] = -{ -// The entries in this table need to be in ascending order but the table doesn't -// need to be full (gaps are allowed). One day, a tool might exist to fill in the -// table from the TPM_ALG description -#if ALG_RSA - {TPM_ALG_RSA, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 1, 0, 0, 0, 0, 0)}, -#endif -#if ALG_TDES - {TPM_ALG_TDES, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 0, 0, 0)}, -#endif -#if ALG_SHA1 - {TPM_ALG_SHA1, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 0, 0)}, -#endif - - {TPM_ALG_HMAC, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 1, 0, 0, 0)}, - -#if ALG_AES - {TPM_ALG_AES, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 0, 0, 0)}, -#endif -#if ALG_MGF1 - {TPM_ALG_MGF1, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 1, 0)}, -#endif - - {TPM_ALG_KEYEDHASH, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 1, 0, 1, 1, 0, 0)}, - -#if ALG_XOR - {TPM_ALG_XOR, TPMA_ALGORITHM_INITIALIZER(0, 1, 1, 0, 0, 0, 0, 0, 0)}, -#endif - -#if ALG_SHA256 - {TPM_ALG_SHA256, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 0, 0)}, -#endif -#if ALG_SHA384 - {TPM_ALG_SHA384, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 0, 0)}, -#endif -#if ALG_SHA512 - {TPM_ALG_SHA512, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 0, 0)}, -#endif -#if ALG_SM3_256 - {TPM_ALG_SM3_256, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 0, 0)}, -#endif -#if ALG_SM4 - {TPM_ALG_SM4, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 0, 0, 0)}, -#endif -#if ALG_RSASSA - {TPM_ALG_RSASSA, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 1, 0, 0, 0)}, -#endif -#if ALG_RSAES - {TPM_ALG_RSAES, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 0, 1, 0, 0)}, -#endif -#if ALG_RSAPSS - {TPM_ALG_RSAPSS, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 1, 0, 0, 0)}, -#endif -#if ALG_OAEP - {TPM_ALG_OAEP, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 0, 1, 0, 0)}, -#endif -#if ALG_ECDSA - {TPM_ALG_ECDSA, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 1, 0, 1, 0)}, -#endif -#if ALG_ECDH - {TPM_ALG_ECDH, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 0, 0, 1, 0)}, -#endif -#if ALG_ECDAA - {TPM_ALG_ECDAA, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 1, 0, 0, 0)}, -#endif -#if ALG_SM2 - {TPM_ALG_SM2, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 1, 0, 1, 0)}, -#endif -#if ALG_ECSCHNORR - {TPM_ALG_ECSCHNORR, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 1, 0, 0, 0)}, -#endif -#if ALG_ECMQV - {TPM_ALG_ECMQV, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 0, 0, 0, 0, 1, 0)}, -#endif -#if ALG_KDF1_SP800_56A - {TPM_ALG_KDF1_SP800_56A, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 1, 0)}, -#endif -#if ALG_KDF2 - {TPM_ALG_KDF2, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 1, 0)}, -#endif -#if ALG_KDF1_SP800_108 - {TPM_ALG_KDF1_SP800_108, TPMA_ALGORITHM_INITIALIZER(0, 0, 1, 0, 0, 0, 0, 1, 0)}, -#endif -#if ALG_ECC - {TPM_ALG_ECC, TPMA_ALGORITHM_INITIALIZER(1, 0, 0, 1, 0, 0, 0, 0, 0)}, -#endif - - {TPM_ALG_SYMCIPHER, TPMA_ALGORITHM_INITIALIZER(0, 0, 0, 1, 0, 0, 0, 0, 0)}, - -#if ALG_CAMELLIA - {TPM_ALG_CAMELLIA, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 0, 0, 0)}, -#endif -#if ALG_CMAC - {TPM_ALG_CMAC, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 1, 0, 0, 0)}, -#endif -#if ALG_CTR - {TPM_ALG_CTR, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 1, 0, 0)}, -#endif -#if ALG_OFB - {TPM_ALG_OFB, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 1, 0, 0)}, -#endif -#if ALG_CBC - {TPM_ALG_CBC, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 1, 0, 0)}, -#endif -#if ALG_CFB - {TPM_ALG_CFB, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 1, 0, 0)}, -#endif -#if ALG_ECB - {TPM_ALG_ECB, TPMA_ALGORITHM_INITIALIZER(0, 1, 0, 0, 0, 0, 1, 0, 0)}, -#endif -}; - -//** AlgorithmCapGetImplemented() -// This function is used by TPM2_GetCapability() to return a list of the -// implemented algorithms. -// Return Type: TPMI_YES_NO -// YES more algorithms to report -// NO no more algorithms to report -TPMI_YES_NO -AlgorithmCapGetImplemented( - TPM_ALG_ID algID, // IN: the starting algorithm ID - UINT32 count, // IN: count of returned algorithms - TPML_ALG_PROPERTY *algList // OUT: algorithm list - ) -{ - TPMI_YES_NO more = NO; - UINT32 i; - UINT32 algNum; - - // initialize output algorithm list - algList->count = 0; - - // The maximum count of algorithms we may return is MAX_CAP_ALGS. - if(count > MAX_CAP_ALGS) - count = MAX_CAP_ALGS; - - // Compute how many algorithms are defined in s_algorithms array. - algNum = sizeof(s_algorithms) / sizeof(s_algorithms[0]); - - // Scan the implemented algorithm list to see if there is a match to 'algID'. - for(i = 0; i < algNum; i++) - { - // If algID is less than the starting algorithm ID, skip it - if(s_algorithms[i].algID < algID) - continue; - if(algList->count < count) - { - // If we have not filled up the return list, add more algorithms - // to it - algList->algProperties[algList->count].alg = s_algorithms[i].algID; - algList->algProperties[algList->count].algProperties = - s_algorithms[i].attributes; - algList->count++; - } - else - { - // If the return list is full but we still have algorithms - // available, report this and stop scanning. - more = YES; - break; - } - } - - return more; -} - -//** AlgorithmGetImplementedVector() -// This function returns the bit vector of the implemented algorithms. -LIB_EXPORT -void -AlgorithmGetImplementedVector( - ALGORITHM_VECTOR *implemented // OUT: the implemented bits are SET - ) -{ - int index; - - // Nothing implemented until we say it is - MemorySet(implemented, 0, sizeof(ALGORITHM_VECTOR)); - - for(index = (sizeof(s_algorithms) / sizeof(s_algorithms[0])) - 1; - index >= 0; - index--) - SET_BIT(s_algorithms[index].algID, *implemented); - return; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Bits.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Bits.c deleted file mode 100644 index 4670cc524..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Bits.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains bit manipulation routines. They operate on bit arrays. -// -// The 0th bit in the array is the right-most bit in the 0th octet in -// the array. -// -// NOTE: If pAssert() is defined, the functions will assert if the indicated bit -// number is outside of the range of 'bArray'. How the assert is handled is -// implementation dependent. - -//** Includes - -#include "Tpm.h" - -//** Functions - -//*** TestBit() -// This function is used to check the setting of a bit in an array of bits. -// Return Type: BOOL -// TRUE(1) bit is set -// FALSE(0) bit is not set -BOOL -TestBit( - unsigned int bitNum, // IN: number of the bit in 'bArray' - BYTE *bArray, // IN: array containing the bits - unsigned int bytesInArray // IN: size in bytes of 'bArray' - ) -{ - pAssert(bytesInArray > (bitNum >> 3)); - return((bArray[bitNum >> 3] & (1 << (bitNum & 7))) != 0); -} - -//*** SetBit() -// This function will set the indicated bit in 'bArray'. -void -SetBit( - unsigned int bitNum, // IN: number of the bit in 'bArray' - BYTE *bArray, // IN: array containing the bits - unsigned int bytesInArray // IN: size in bytes of 'bArray' - ) -{ - pAssert(bytesInArray > (bitNum >> 3)); - bArray[bitNum >> 3] |= (1 << (bitNum & 7)); -} - -//*** ClearBit() -// This function will clear the indicated bit in 'bArray'. -void -ClearBit( - unsigned int bitNum, // IN: number of the bit in 'bArray'. - BYTE *bArray, // IN: array containing the bits - unsigned int bytesInArray // IN: size in bytes of 'bArray' - ) -{ - pAssert(bytesInArray > (bitNum >> 3)); - bArray[bitNum >> 3] &= ~(1 << (bitNum & 7)); -} - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/CommandCodeAttributes.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/CommandCodeAttributes.c deleted file mode 100644 index 81284428a..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/CommandCodeAttributes.c +++ /dev/null @@ -1,553 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// This file contains the functions for testing various command properties. - -//** Includes and Defines - -#include "Tpm.h" -#include "CommandCodeAttributes_fp.h" - -// Set the default value for CC_VEND if not already set -#ifndef CC_VEND -#define CC_VEND (TPM_CC)(0x20000000) -#endif - -typedef UINT16 ATTRIBUTE_TYPE; - -// The following file is produced from the command tables in part 3 of the -// specification. It defines the attributes for each of the commands. -// NOTE: This file is currently produced by an automated process. Files -// produced from Part 2 or Part 3 tables through automated processes are not -// included in the specification so that their is no ambiguity about the -// table containing the information being the normative definition. -#define _COMMAND_CODE_ATTRIBUTES_ -#include "CommandAttributeData.h" - -//** Command Attribute Functions - -//*** NextImplementedIndex() -// This function is used when the lists are not compressed. In a compressed list, -// only the implemented commands are present. So, a search might find a value -// but that value may not be implemented. This function checks to see if the input -// commandIndex points to an implemented command and, if not, it searches upwards -// until it finds one. When the list is compressed, this function gets defined -// as a no-op. -// Return Type: COMMAND_INDEX -// UNIMPLEMENTED_COMMAND_INDEX command is not implemented -// other index of the command -#if !COMPRESSED_LISTS -static COMMAND_INDEX -NextImplementedIndex( - COMMAND_INDEX commandIndex - ) -{ - for(;commandIndex < COMMAND_COUNT; commandIndex++) - { - if(s_commandAttributes[commandIndex] & IS_IMPLEMENTED) - return commandIndex; - } - return UNIMPLEMENTED_COMMAND_INDEX; -} -#else -#define NextImplementedIndex(x) (x) -#endif - -//*** GetClosestCommandIndex() -// This function returns the command index for the command with a value that is -// equal to or greater than the input value -// Return Type: COMMAND_INDEX -// UNIMPLEMENTED_COMMAND_INDEX command is not implemented -// other index of a command -COMMAND_INDEX -GetClosestCommandIndex( - TPM_CC commandCode // IN: the command code to start at - ) -{ - BOOL vendor = (commandCode & CC_VEND) != 0; - COMMAND_INDEX searchIndex = (COMMAND_INDEX)commandCode; - - // The commandCode is a UINT32 and the search index is UINT16. We are going to - // search for a match but need to make sure that the commandCode value is not - // out of range. To do this, need to clear the vendor bit of the commandCode - // (if set) and compare the result to the 16-bit searchIndex value. If it is - // out of range, indicate that the command is not implemented - if((commandCode & ~CC_VEND) != searchIndex) - return UNIMPLEMENTED_COMMAND_INDEX; - - // if there is at least one vendor command, the last entry in the array will - // have the v bit set. If the input commandCode is larger than the last - // vendor-command, then it is out of range. - if(vendor) - { -#if VENDOR_COMMAND_ARRAY_SIZE > 0 - COMMAND_INDEX commandIndex; - COMMAND_INDEX min; - COMMAND_INDEX max; - int diff; -#if LIBRARY_COMMAND_ARRAY_SIZE == COMMAND_COUNT -#error "Constants are not consistent." -#endif - // Check to see if the value is equal to or below the minimum - // entry. - // Note: Put this check first so that the typical case of only one vendor- - // specific command doesn't waste any more time. - if(GET_ATTRIBUTE(s_ccAttr[LIBRARY_COMMAND_ARRAY_SIZE], TPMA_CC, - commandIndex) >= searchIndex) - { - // the vendor array is always assumed to be packed so there is - // no need to check to see if the command is implemented - return LIBRARY_COMMAND_ARRAY_SIZE; - } - // See if this is out of range on the top - if(GET_ATTRIBUTE(s_ccAttr[COMMAND_COUNT - 1], TPMA_CC, commandIndex) - < searchIndex) - { - return UNIMPLEMENTED_COMMAND_INDEX; - } - commandIndex = UNIMPLEMENTED_COMMAND_INDEX; // Needs initialization to keep - // compiler happy - min = LIBRARY_COMMAND_ARRAY_SIZE; // first vendor command - max = COMMAND_COUNT - 1; // last vendor command - diff = 1; // needs initialization to keep - // compiler happy - while(min <= max) - { - commandIndex = (min + max + 1) / 2; - diff = GET_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, commandIndex) - - searchIndex; - if(diff == 0) - return commandIndex; - if(diff > 0) - max = commandIndex - 1; - else - min = commandIndex + 1; - } - // didn't find and exact match. commandIndex will be pointing at the last - // item tested. If 'diff' is positive, then the last item tested was - // larger index of the command code so it is the smallest value - // larger than the requested value. - if(diff > 0) - return commandIndex; - // if 'diff' is negative, then the value tested was smaller than - // the commandCode index and the next higher value is the correct one. - // Note: this will necessarily be in range because of the earlier check - // that the index was within range. - return commandIndex + 1; -#else - // If there are no vendor commands so anything with the vendor bit set is out - // of range - return UNIMPLEMENTED_COMMAND_INDEX; -#endif - } - // Get here if the V-Bit was not set in 'commandCode' - - if(GET_ATTRIBUTE(s_ccAttr[LIBRARY_COMMAND_ARRAY_SIZE - 1], TPMA_CC, - commandIndex) < searchIndex) - { - // requested index is out of the range to the top -#if VENDOR_COMMAND_ARRAY_SIZE > 0 - // If there are vendor commands, then the first vendor command - // is the next value greater than the commandCode. - // NOTE: we got here if the starting index did not have the V bit but we - // reached the end of the array of library commands (non-vendor). Since - // there is at least one vendor command, and vendor commands are always - // in a compressed list that starts after the library list, the next - // index value contains a valid vendor command. - return LIBRARY_COMMAND_ARRAY_SIZE; -#else - // if there are no vendor commands, then this is out of range - return UNIMPLEMENTED_COMMAND_INDEX; -#endif - } - // If the request is lower than any value in the array, then return - // the lowest value (needs to be an index for an implemented command - if(GET_ATTRIBUTE(s_ccAttr[0], TPMA_CC, commandIndex) >= searchIndex) - { - return NextImplementedIndex(0); - } - else - { -#if COMPRESSED_LISTS - COMMAND_INDEX commandIndex = UNIMPLEMENTED_COMMAND_INDEX; - COMMAND_INDEX min = 0; - COMMAND_INDEX max = LIBRARY_COMMAND_ARRAY_SIZE - 1; - int diff = 1; -#if LIBRARY_COMMAND_ARRAY_SIZE == 0 -#error "Something is terribly wrong" -#endif - // The s_ccAttr array contains an extra entry at the end (a zero value). - // Don't count this as an array entry. This means that max should start - // out pointing to the last valid entry in the array which is - 2 - pAssert(max == (sizeof(s_ccAttr) / sizeof(TPMA_CC) - - VENDOR_COMMAND_ARRAY_SIZE - 2)); - while(min <= max) - { - commandIndex = (min + max + 1) / 2; - diff = GET_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, - commandIndex) - searchIndex; - if(diff == 0) - return commandIndex; - if(diff > 0) - max = commandIndex - 1; - else - min = commandIndex + 1; - } - // didn't find and exact match. commandIndex will be pointing at the - // last item tested. If diff is positive, then the last item tested was - // larger index of the command code so it is the smallest value - // larger than the requested value. - if(diff > 0) - return commandIndex; - // if diff is negative, then the value tested was smaller than - // the commandCode index and the next higher value is the correct one. - // Note: this will necessarily be in range because of the earlier check - // that the index was within range. - return commandIndex + 1; -#else - // The list is not compressed so offset into the array by the command - // code value of the first entry in the list. Then go find the first - // implemented command. - return NextImplementedIndex(searchIndex - - (COMMAND_INDEX)s_ccAttr[0].commandIndex); -#endif - } -} - -//*** CommandCodeToComandIndex() -// This function returns the index in the various attributes arrays of the -// command. -// Return Type: COMMAND_INDEX -// UNIMPLEMENTED_COMMAND_INDEX command is not implemented -// other index of the command -COMMAND_INDEX -CommandCodeToCommandIndex( - TPM_CC commandCode // IN: the command code to look up - ) -{ - // Extract the low 16-bits of the command code to get the starting search index - COMMAND_INDEX searchIndex = (COMMAND_INDEX)commandCode; - BOOL vendor = (commandCode & CC_VEND) != 0; - COMMAND_INDEX commandIndex; -#if !COMPRESSED_LISTS - if(!vendor) - { - commandIndex = searchIndex - (COMMAND_INDEX)s_ccAttr[0].commandIndex; - // Check for out of range or unimplemented. - // Note, since a COMMAND_INDEX is unsigned, if searchIndex is smaller than - // the lowest value of command, it will become a 'negative' number making - // it look like a large unsigned number, this will cause it to fail - // the unsigned check below. - if(commandIndex >= LIBRARY_COMMAND_ARRAY_SIZE - || (s_commandAttributes[commandIndex] & IS_IMPLEMENTED) == 0) - return UNIMPLEMENTED_COMMAND_INDEX; - return commandIndex; - } -#endif - // Need this code for any vendor code lookup or for compressed lists - commandIndex = GetClosestCommandIndex(commandCode); - - // Look at the returned value from get closest. If it isn't the one that was - // requested, then the command is not implemented. - if(commandIndex != UNIMPLEMENTED_COMMAND_INDEX) - { - if((GET_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, commandIndex) - != searchIndex) - || (IS_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, V)) != vendor) - commandIndex = UNIMPLEMENTED_COMMAND_INDEX; - } - return commandIndex; -} - -//*** GetNextCommandIndex() -// This function returns the index of the next implemented command. -// Return Type: COMMAND_INDEX -// UNIMPLEMENTED_COMMAND_INDEX no more implemented commands -// other the index of the next implemented command -COMMAND_INDEX -GetNextCommandIndex( - COMMAND_INDEX commandIndex // IN: the starting index - ) -{ - while(++commandIndex < COMMAND_COUNT) - { -#if !COMPRESSED_LISTS - if(s_commandAttributes[commandIndex] & IS_IMPLEMENTED) -#endif - return commandIndex; - } - return UNIMPLEMENTED_COMMAND_INDEX; -} - -//*** GetCommandCode() -// This function returns the commandCode associated with the command index -TPM_CC -GetCommandCode( - COMMAND_INDEX commandIndex // IN: the command index - ) -{ - TPM_CC commandCode = GET_ATTRIBUTE(s_ccAttr[commandIndex], - TPMA_CC, commandIndex); - if(IS_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, V)) - commandCode += CC_VEND; - return commandCode; -} - -//*** CommandAuthRole() -// -// This function returns the authorization role required of a handle. -// -// Return Type: AUTH_ROLE -// AUTH_NONE no authorization is required -// AUTH_USER user role authorization is required -// AUTH_ADMIN admin role authorization is required -// AUTH_DUP duplication role authorization is required -AUTH_ROLE -CommandAuthRole( - COMMAND_INDEX commandIndex, // IN: command index - UINT32 handleIndex // IN: handle index (zero based) - ) -{ - if(0 == handleIndex) - { - // Any authorization role set? - COMMAND_ATTRIBUTES properties = s_commandAttributes[commandIndex]; - - if(properties & HANDLE_1_USER) - return AUTH_USER; - if(properties & HANDLE_1_ADMIN) - return AUTH_ADMIN; - if(properties & HANDLE_1_DUP) - return AUTH_DUP; - } - else if(1 == handleIndex) - { - if(s_commandAttributes[commandIndex] & HANDLE_2_USER) - return AUTH_USER; - } - return AUTH_NONE; -} - -//*** EncryptSize() -// This function returns the size of the decrypt size field. This function returns -// 0 if encryption is not allowed -// Return Type: int -// 0 encryption not allowed -// 2 size field is two bytes -// 4 size field is four bytes -int -EncryptSize( - COMMAND_INDEX commandIndex // IN: command index - ) -{ - return ((s_commandAttributes[commandIndex] & ENCRYPT_2) ? 2 : - (s_commandAttributes[commandIndex] & ENCRYPT_4) ? 4 : 0); -} - -//*** DecryptSize() -// This function returns the size of the decrypt size field. This function returns -// 0 if decryption is not allowed -// Return Type: int -// 0 encryption not allowed -// 2 size field is two bytes -// 4 size field is four bytes -int -DecryptSize( - COMMAND_INDEX commandIndex // IN: command index - ) -{ - return ((s_commandAttributes[commandIndex] & DECRYPT_2) ? 2 : - (s_commandAttributes[commandIndex] & DECRYPT_4) ? 4 : 0); -} - -//*** IsSessionAllowed() -// -// This function indicates if the command is allowed to have sessions. -// -// This function must not be called if the command is not known to be implemented. -// -// Return Type: BOOL -// TRUE(1) session is allowed with this command -// FALSE(0) session is not allowed with this command -BOOL -IsSessionAllowed( - COMMAND_INDEX commandIndex // IN: the command to be checked - ) -{ - return ((s_commandAttributes[commandIndex] & NO_SESSIONS) == 0); -} - -//*** IsHandleInResponse() -// This function determines if a command has a handle in the response -BOOL -IsHandleInResponse( - COMMAND_INDEX commandIndex - ) -{ - return ((s_commandAttributes[commandIndex] & R_HANDLE) != 0); -} - -//*** IsWriteOperation() -// Checks to see if an operation will write to an NV Index and is subject to being -// blocked by read-lock -BOOL -IsWriteOperation( - COMMAND_INDEX commandIndex // IN: Command to check - ) -{ -#ifdef WRITE_LOCK - return ((s_commandAttributes[commandIndex] & WRITE_LOCK) != 0); -#else - if(!IS_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, V)) - { - switch(GET_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, commandIndex)) - { - case TPM_CC_NV_Write: -#if CC_NV_Increment - case TPM_CC_NV_Increment: -#endif -#if CC_NV_SetBits - case TPM_CC_NV_SetBits: -#endif -#if CC_NV_Extend - case TPM_CC_NV_Extend: -#endif -#if CC_AC_Send - case TPM_CC_AC_Send: -#endif - // NV write lock counts as a write operation for authorization purposes. - // We check to see if the NV is write locked before we do the - // authorization. If it is locked, we fail the command early. - case TPM_CC_NV_WriteLock: - return TRUE; - default: - break; - } - } - return FALSE; -#endif -} - -//*** IsReadOperation() -// Checks to see if an operation will write to an NV Index and is -// subject to being blocked by write-lock. -BOOL -IsReadOperation( - COMMAND_INDEX commandIndex // IN: Command to check - ) -{ -#ifdef READ_LOCK - return ((s_commandAttributes[commandIndex] & READ_LOCK) != 0); -#else - - if(!IS_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, V)) - { - switch(GET_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, commandIndex)) - { - case TPM_CC_NV_Read: - case TPM_CC_PolicyNV: - case TPM_CC_NV_Certify: - // NV read lock counts as a read operation for authorization purposes. - // We check to see if the NV is read locked before we do the - // authorization. If it is locked, we fail the command early. - case TPM_CC_NV_ReadLock: - return TRUE; - default: - break; - } - } - return FALSE; -#endif -} - -//*** CommandCapGetCCList() -// This function returns a list of implemented commands and command attributes -// starting from the command in 'commandCode'. -// Return Type: TPMI_YES_NO -// YES more command attributes are available -// NO no more command attributes are available -TPMI_YES_NO -CommandCapGetCCList( - TPM_CC commandCode, // IN: start command code - UINT32 count, // IN: maximum count for number of entries in - // 'commandList' - TPML_CCA *commandList // OUT: list of TPMA_CC - ) -{ - TPMI_YES_NO more = NO; - COMMAND_INDEX commandIndex; - - // initialize output handle list count - commandList->count = 0; - - for(commandIndex = GetClosestCommandIndex(commandCode); - commandIndex != UNIMPLEMENTED_COMMAND_INDEX; - commandIndex = GetNextCommandIndex(commandIndex)) - { -#if !COMPRESSED_LISTS - // this check isn't needed for compressed lists. - if(!(s_commandAttributes[commandIndex] & IS_IMPLEMENTED)) - continue; -#endif - if(commandList->count < count) - { - // If the list is not full, add the attributes for this command. - commandList->commandAttributes[commandList->count] - = s_ccAttr[commandIndex]; - commandList->count++; - } - else - { - // If the list is full but there are more commands to report, - // indicate this and return. - more = YES; - break; - } - } - return more; -} - -//*** IsVendorCommand() -// Function indicates if a command index references a vendor command. -// Return Type: BOOL -// TRUE(1) command is a vendor command -// FALSE(0) command is not a vendor command -BOOL -IsVendorCommand( - COMMAND_INDEX commandIndex // IN: command index to check - ) -{ - return (IS_ATTRIBUTE(s_ccAttr[commandIndex], TPMA_CC, V)); -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Entity.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Entity.c deleted file mode 100644 index 246a3a784..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Entity.c +++ /dev/null @@ -1,478 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// The functions in this file are used for accessing properties for handles of -// various types. Functions in other files require handles of a specific -// type but the functions in this file allow use of any handle type. - -//** Includes - -#include "Tpm.h" - -//** Functions -//*** EntityGetLoadStatus() -// This function will check that all the handles access loaded entities. -// Return Type: TPM_RC -// TPM_RC_HANDLE handle type does not match -// TPM_RC_REFERENCE_Hx entity is not present -// TPM_RC_HIERARCHY entity belongs to a disabled hierarchy -// TPM_RC_OBJECT_MEMORY handle is an evict object but there is no -// space to load it to RAM -TPM_RC -EntityGetLoadStatus( - COMMAND *command // IN/OUT: command parsing structure - ) -{ - UINT32 i; - TPM_RC result = TPM_RC_SUCCESS; -// - for(i = 0; i < command->handleNum; i++) - { - TPM_HANDLE handle = command->handles[i]; - switch(HandleGetType(handle)) - { - // For handles associated with hierarchies, the entity is present - // only if the associated enable is SET. - case TPM_HT_PERMANENT: - switch(handle) - { - case TPM_RH_OWNER: - if(!gc.shEnable) - result = TPM_RC_HIERARCHY; - break; - -#ifdef VENDOR_PERMANENT - case VENDOR_PERMANENT: -#endif - case TPM_RH_ENDORSEMENT: - if(!gc.ehEnable) - result = TPM_RC_HIERARCHY; - break; - case TPM_RH_PLATFORM: - if(!g_phEnable) - result = TPM_RC_HIERARCHY; - break; - // null handle, PW session handle and lockout - // handle are always available - case TPM_RH_NULL: - case TPM_RS_PW: - // Need to be careful for lockout. Lockout is always available - // for policy checks but not always available when authValue - // is being checked. - case TPM_RH_LOCKOUT: - break; - default: - // handling of the manufacture_specific handles - if(((TPM_RH)handle >= TPM_RH_AUTH_00) - && ((TPM_RH)handle <= TPM_RH_AUTH_FF)) - // use the value that would have been returned from - // unmarshaling if it did the handle filtering - result = TPM_RC_VALUE; - else - FAIL(FATAL_ERROR_INTERNAL); - break; - } - break; - case TPM_HT_TRANSIENT: - // For a transient object, check if the handle is associated - // with a loaded object. - if(!IsObjectPresent(handle)) - result = TPM_RC_REFERENCE_H0; - break; - case TPM_HT_PERSISTENT: - // Persistent object - // Copy the persistent object to RAM and replace the handle with the - // handle of the assigned slot. A TPM_RC_OBJECT_MEMORY, - // TPM_RC_HIERARCHY or TPM_RC_REFERENCE_H0 error may be returned by - // ObjectLoadEvict() - result = ObjectLoadEvict(&command->handles[i], command->index); - break; - case TPM_HT_HMAC_SESSION: - // For an HMAC session, see if the session is loaded - // and if the session in the session slot is actually - // an HMAC session. - if(SessionIsLoaded(handle)) - { - SESSION *session; - session = SessionGet(handle); - // Check if the session is a HMAC session - if(session->attributes.isPolicy == SET) - result = TPM_RC_HANDLE; - } - else - result = TPM_RC_REFERENCE_H0; - break; - case TPM_HT_POLICY_SESSION: - // For a policy session, see if the session is loaded - // and if the session in the session slot is actually - // a policy session. - if(SessionIsLoaded(handle)) - { - SESSION *session; - session = SessionGet(handle); - // Check if the session is a policy session - if(session->attributes.isPolicy == CLEAR) - result = TPM_RC_HANDLE; - } - else - result = TPM_RC_REFERENCE_H0; - break; - case TPM_HT_NV_INDEX: - // For an NV Index, use the TPM-specific routine - // to search the IN Index space. - result = NvIndexIsAccessible(handle); - break; - case TPM_HT_PCR: - // Any PCR handle that is unmarshaled successfully referenced - // a PCR that is defined. - break; -#if CC_AC_Send - case TPM_HT_AC: - // Use the TPM-specific routine to search for the AC - result = AcIsAccessible(handle); - break; -#endif - default: - // Any other handle type is a defect in the unmarshaling code. - FAIL(FATAL_ERROR_INTERNAL); - break; - } - if(result != TPM_RC_SUCCESS) - { - if(result == TPM_RC_REFERENCE_H0) - result = result + i; - else - result = RcSafeAddToResult(result, TPM_RC_H + g_rcIndex[i]); - break; - } - } - return result; -} - -//*** EntityGetAuthValue() -// This function is used to access the 'authValue' associated with a handle. -// This function assumes that the handle references an entity that is accessible -// and the handle is not for a persistent objects. That is EntityGetLoadStatus() -// should have been called. Also, the accessibility of the authValue should have -// been verified by IsAuthValueAvailable(). -// -// This function copies the authorization value of the entity to 'auth'. -// Return Type: UINT16 -// count number of bytes in the authValue with 0's stripped -UINT16 -EntityGetAuthValue( - TPMI_DH_ENTITY handle, // IN: handle of entity - TPM2B_AUTH *auth // OUT: authValue of the entity - ) -{ - TPM2B_AUTH *pAuth = NULL; - - auth->t.size = 0; - - switch(HandleGetType(handle)) - { - case TPM_HT_PERMANENT: - { - switch(handle) - { - case TPM_RH_OWNER: - // ownerAuth for TPM_RH_OWNER - pAuth = &gp.ownerAuth; - break; - case TPM_RH_ENDORSEMENT: - // endorsementAuth for TPM_RH_ENDORSEMENT - pAuth = &gp.endorsementAuth; - break; - case TPM_RH_PLATFORM: - // platformAuth for TPM_RH_PLATFORM - pAuth = &gc.platformAuth; - break; - case TPM_RH_LOCKOUT: - // lockoutAuth for TPM_RH_LOCKOUT - pAuth = &gp.lockoutAuth; - break; - case TPM_RH_NULL: - // nullAuth for TPM_RH_NULL. Return 0 directly here - return 0; - break; -#ifdef VENDOR_PERMANENT - case VENDOR_PERMANENT: - // vendor authorization value - pAauth = &g_platformUniqueDetails; -#endif - default: - // If any other permanent handle is present it is - // a code defect. - FAIL(FATAL_ERROR_INTERNAL); - break; - } - break; - } - case TPM_HT_TRANSIENT: - // authValue for an object - // A persistent object would have been copied into RAM - // and would have an transient object handle here. - { - OBJECT *object; - - object = HandleToObject(handle); - // special handling if this is a sequence object - if(ObjectIsSequence(object)) - { - pAuth = &((HASH_OBJECT *)object)->auth; - } - else - { - // Authorization is available only when the private portion of - // the object is loaded. The check should be made before - // this function is called - pAssert(object->attributes.publicOnly == CLEAR); - pAuth = &object->sensitive.authValue; - } - } - break; - case TPM_HT_NV_INDEX: - // authValue for an NV index - { - NV_INDEX *nvIndex = NvGetIndexInfo(handle, NULL); - pAssert(nvIndex != NULL); - pAuth = &nvIndex->authValue; - } - break; - case TPM_HT_PCR: - // authValue for PCR - pAuth = PCRGetAuthValue(handle); - break; - default: - // If any other handle type is present here, then there is a defect - // in the unmarshaling code. - FAIL(FATAL_ERROR_INTERNAL); - break; - } - // Copy the authValue - MemoryCopy2B(&auth->b, &pAuth->b, sizeof(auth->t.buffer)); - MemoryRemoveTrailingZeros(auth); - return auth->t.size; -} - -//*** EntityGetAuthPolicy() -// This function is used to access the 'authPolicy' associated with a handle. -// This function assumes that the handle references an entity that is accessible -// and the handle is not for a persistent objects. That is EntityGetLoadStatus() -// should have been called. Also, the accessibility of the authPolicy should have -// been verified by IsAuthPolicyAvailable(). -// -// This function copies the authorization policy of the entity to 'authPolicy'. -// -// The return value is the hash algorithm for the policy. -TPMI_ALG_HASH -EntityGetAuthPolicy( - TPMI_DH_ENTITY handle, // IN: handle of entity - TPM2B_DIGEST *authPolicy // OUT: authPolicy of the entity - ) -{ - TPMI_ALG_HASH hashAlg = TPM_ALG_NULL; - authPolicy->t.size = 0; - - switch(HandleGetType(handle)) - { - case TPM_HT_PERMANENT: - switch(handle) - { - case TPM_RH_OWNER: - // ownerPolicy for TPM_RH_OWNER - *authPolicy = gp.ownerPolicy; - hashAlg = gp.ownerAlg; - break; - case TPM_RH_ENDORSEMENT: - // endorsementPolicy for TPM_RH_ENDORSEMENT - *authPolicy = gp.endorsementPolicy; - hashAlg = gp.endorsementAlg; - break; - case TPM_RH_PLATFORM: - // platformPolicy for TPM_RH_PLATFORM - *authPolicy = gc.platformPolicy; - hashAlg = gc.platformAlg; - break; - case TPM_RH_LOCKOUT: - // lockoutPolicy for TPM_RH_LOCKOUT - *authPolicy = gp.lockoutPolicy; - hashAlg = gp.lockoutAlg; - break; - default: - return TPM_ALG_ERROR; - break; - } - break; - case TPM_HT_TRANSIENT: - // authPolicy for an object - { - OBJECT *object = HandleToObject(handle); - *authPolicy = object->publicArea.authPolicy; - hashAlg = object->publicArea.nameAlg; - } - break; - case TPM_HT_NV_INDEX: - // authPolicy for a NV index - { - NV_INDEX *nvIndex = NvGetIndexInfo(handle, NULL); - pAssert(nvIndex != 0); - *authPolicy = nvIndex->publicArea.authPolicy; - hashAlg = nvIndex->publicArea.nameAlg; - } - break; - case TPM_HT_PCR: - // authPolicy for a PCR - hashAlg = PCRGetAuthPolicy(handle, authPolicy); - break; - default: - // If any other handle type is present it is a code defect. - FAIL(FATAL_ERROR_INTERNAL); - break; - } - return hashAlg; -} - -//*** EntityGetName() -// This function returns the Name associated with a handle. -TPM2B_NAME * -EntityGetName( - TPMI_DH_ENTITY handle, // IN: handle of entity - TPM2B_NAME *name // OUT: name of entity - ) -{ - switch(HandleGetType(handle)) - { - case TPM_HT_TRANSIENT: - { - // Name for an object - OBJECT *object = HandleToObject(handle); - // an object with no nameAlg has no name - if(object->publicArea.nameAlg == TPM_ALG_NULL) - name->b.size = 0; - else - *name = object->name; - break; - } - case TPM_HT_NV_INDEX: - // Name for a NV index - NvGetNameByIndexHandle(handle, name); - break; - default: - // For all other types, the handle is the Name - name->t.size = sizeof(TPM_HANDLE); - UINT32_TO_BYTE_ARRAY(handle, name->t.name); - break; - } - return name; -} - -//*** EntityGetHierarchy() -// This function returns the hierarchy handle associated with an entity. -// 1. A handle that is a hierarchy handle is associated with itself. -// 2. An NV index belongs to TPM_RH_PLATFORM if TPMA_NV_PLATFORMCREATE, -// is SET, otherwise it belongs to TPM_RH_OWNER -// 3. An object handle belongs to its hierarchy. -TPMI_RH_HIERARCHY -EntityGetHierarchy( - TPMI_DH_ENTITY handle // IN :handle of entity - ) -{ - TPMI_RH_HIERARCHY hierarchy = TPM_RH_NULL; - - switch(HandleGetType(handle)) - { - case TPM_HT_PERMANENT: - // hierarchy for a permanent handle - switch(handle) - { - case TPM_RH_PLATFORM: - case TPM_RH_ENDORSEMENT: - case TPM_RH_NULL: - hierarchy = handle; - break; - // all other permanent handles are associated with the owner - // hierarchy. (should only be TPM_RH_OWNER and TPM_RH_LOCKOUT) - default: - hierarchy = TPM_RH_OWNER; - break; - } - break; - case TPM_HT_NV_INDEX: - // hierarchy for NV index - { - NV_INDEX *nvIndex = NvGetIndexInfo(handle, NULL); - pAssert(nvIndex != NULL); - - // If only the platform can delete the index, then it is - // considered to be in the platform hierarchy, otherwise it - // is in the owner hierarchy. - if(IS_ATTRIBUTE(nvIndex->publicArea.attributes, TPMA_NV, - PLATFORMCREATE)) - hierarchy = TPM_RH_PLATFORM; - else - hierarchy = TPM_RH_OWNER; - } - break; - case TPM_HT_TRANSIENT: - // hierarchy for an object - { - OBJECT *object; - object = HandleToObject(handle); - if(object->attributes.ppsHierarchy) - { - hierarchy = TPM_RH_PLATFORM; - } - else if(object->attributes.epsHierarchy) - { - hierarchy = TPM_RH_ENDORSEMENT; - } - else if(object->attributes.spsHierarchy) - { - hierarchy = TPM_RH_OWNER; - } - } - break; - case TPM_HT_PCR: - hierarchy = TPM_RH_OWNER; - break; - default: - FAIL(FATAL_ERROR_INTERNAL); - break; - } - // this is unreachable but it provides a return value for the default - // case which makes the complier happy - return hierarchy; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Global.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Global.c deleted file mode 100644 index 4caa4a598..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Global.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// This file will instance the TPM variables that are not stack allocated. - -// Descriptions of global variables are in Global.h. There macro macro definitions -// that allows a variable to be instanced or simply defined as an external variable. -// When global.h is included from this .c file, GLOBAL_C is defined and values are -// instanced (and possibly initialized), but when global.h is included by any other -// file, they are simply defined as external values. DO NOT DEFINE GLOBAL_C IN ANY -// OTHER FILE. -// -// NOTE: This is a change from previous implementations where Global.h just contained -// the extern declaration and values were instanced in this file. This change keeps -// the definition and instance in one file making maintenance easier. The instanced -// data will still be in the global.obj file. -// -// The OIDs.h file works in a way that is similar to the Global.h with the definition -// of the values in OIDs.h such that they are instanced in global.obj. The macros -// that are defined in Global.h are used in OIDs.h in the same way as they are in -// Global.h. - -//** Defines and Includes -#define GLOBAL_C -#include "Tpm.h" -#include "OIDs.h" - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Handle.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Handle.c deleted file mode 100644 index 3ef3b532b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Handle.c +++ /dev/null @@ -1,195 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// This file contains the functions that return the type of a handle. - -//** Includes -#include "Tpm.h" - -//** Functions - -//*** HandleGetType() -// This function returns the type of a handle which is the MSO of the handle. -TPM_HT -HandleGetType( - TPM_HANDLE handle // IN: a handle to be checked - ) -{ - // return the upper bytes of input data - return (TPM_HT)((handle & HR_RANGE_MASK) >> HR_SHIFT); -} - -//*** NextPermanentHandle() -// This function returns the permanent handle that is equal to the input value or -// is the next higher value. If there is no handle with the input value and there -// is no next higher value, it returns 0: -TPM_HANDLE -NextPermanentHandle( - TPM_HANDLE inHandle // IN: the handle to check - ) -{ - // If inHandle is below the start of the range of permanent handles - // set it to the start and scan from there - if(inHandle < TPM_RH_FIRST) - inHandle = TPM_RH_FIRST; - // scan from input value until we find an implemented permanent handle - // or go out of range - for(; inHandle <= TPM_RH_LAST; inHandle++) - { - switch(inHandle) - { - case TPM_RH_OWNER: - case TPM_RH_NULL: - case TPM_RS_PW: - case TPM_RH_LOCKOUT: - case TPM_RH_ENDORSEMENT: - case TPM_RH_PLATFORM: - case TPM_RH_PLATFORM_NV: -#ifdef VENDOR_PERMANENT - case VENDOR_PERMANENT: -#endif - return inHandle; - break; - default: - break; - } - } - // Out of range on the top - return 0; -} - -//*** PermanentCapGetHandles() -// This function returns a list of the permanent handles of PCR, started from -// 'handle'. If 'handle' is larger than the largest permanent handle, an empty list -// will be returned with 'more' set to NO. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -PermanentCapGetHandles( - TPM_HANDLE handle, // IN: start handle - UINT32 count, // IN: count of returned handles - TPML_HANDLE *handleList // OUT: list of handle - ) -{ - TPMI_YES_NO more = NO; - UINT32 i; - - pAssert(HandleGetType(handle) == TPM_HT_PERMANENT); - - // Initialize output handle list - handleList->count = 0; - - // The maximum count of handles we may return is MAX_CAP_HANDLES - if(count > MAX_CAP_HANDLES) count = MAX_CAP_HANDLES; - - // Iterate permanent handle range - for(i = NextPermanentHandle(handle); - i != 0; i = NextPermanentHandle(i + 1)) - { - if(handleList->count < count) - { - // If we have not filled up the return list, add this permanent - // handle to it - handleList->handle[handleList->count] = i; - handleList->count++; - } - else - { - // If the return list is full but we still have permanent handle - // available, report this and stop iterating - more = YES; - break; - } - } - return more; -} - -//*** PermanentHandleGetPolicy() -// This function returns a list of the permanent handles of PCR, started from -// 'handle'. If 'handle' is larger than the largest permanent handle, an empty list -// will be returned with 'more' set to NO. -// Return Type: TPMI_YES_NO -// YES if there are more handles available -// NO all the available handles has been returned -TPMI_YES_NO -PermanentHandleGetPolicy( - TPM_HANDLE handle, // IN: start handle - UINT32 count, // IN: max count of returned handles - TPML_TAGGED_POLICY *policyList // OUT: list of handle - ) -{ - TPMI_YES_NO more = NO; - - pAssert(HandleGetType(handle) == TPM_HT_PERMANENT); - - // Initialize output handle list - policyList->count = 0; - - // The maximum count of policies we may return is MAX_TAGGED_POLICIES - if(count > MAX_TAGGED_POLICIES) - count = MAX_TAGGED_POLICIES; - - // Iterate permanent handle range - for(handle = NextPermanentHandle(handle); - handle != 0; - handle = NextPermanentHandle(handle + 1)) - { - TPM2B_DIGEST policyDigest; - TPM_ALG_ID policyAlg; - // Check to see if this permanent handle has a policy - policyAlg = EntityGetAuthPolicy(handle, &policyDigest); - if(policyAlg == TPM_ALG_ERROR) - continue; - if(policyList->count < count) - { - // If we have not filled up the return list, add this - // policy to the list; - policyList->policies[policyList->count].handle = handle; - policyList->policies[policyList->count].policyHash.hashAlg = policyAlg; - MemoryCopy(&policyList->policies[policyList->count].policyHash.digest, - policyDigest.t.buffer, policyDigest.t.size); - policyList->count++; - } - else - { - // If the return list is full but we still have permanent handle - // available, report this and stop iterating - more = YES; - break; - } - } - return more; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/IoBuffers.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/IoBuffers.c deleted file mode 100644 index 49d0561c3..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/IoBuffers.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//** Includes and Data Definitions - -// This definition allows this module to "see" the values that are private -// to this module but kept in Global.c for ease of state migration. -#define IO_BUFFER_C -#include "Tpm.h" -#include "IoBuffers_fp.h" - -//** Buffers and Functions - -// These buffers are set aside to hold command and response values. In this -// implementation, it is not guaranteed that the code will stop accessing -// the s_actionInputBuffer before starting to put values in the -// s_actionOutputBuffer so different buffers are required. -// - -//*** MemoryIoBufferAllocationReset() -// This function is used to reset the allocation of buffers. -void -MemoryIoBufferAllocationReset( - void -) -{ - s_actionIoAllocation = 0; -} - -//*** MemoryIoBufferZero() -// Function zeros the action I/O buffer at the end of a command. Calling this is -// not mandatory for proper functionality. -void -MemoryIoBufferZero( - void -) -{ - memset(s_actionIoBuffer, 0, s_actionIoAllocation); -} - -//*** MemoryGetInBuffer() -// This function returns the address of the buffer into which the -// command parameters will be unmarshaled in preparation for calling -// the command actions. -BYTE * -MemoryGetInBuffer( - UINT32 size // Size, in bytes, required for the input - // unmarshaling - ) -{ - pAssert(size <= sizeof(s_actionIoBuffer)); - // In this implementation, a static buffer is set aside for the command action - // buffers. The buffer is shared between input and output. This is because - // there is no need to allocate for the worst case input and worst case output - // at the same time. - // Round size up - #define UoM (sizeof(s_actionIoBuffer[0])) - size = (size + (UoM - 1)) & (UINT32_MAX - (UoM - 1)); - memset(s_actionIoBuffer, 0, size); - s_actionIoAllocation = size; - return (BYTE *)&s_actionIoBuffer[0]; -} - -//*** MemoryGetOutBuffer() -// This function returns the address of the buffer into which the command -// action code places its output values. -BYTE * -MemoryGetOutBuffer( - UINT32 size // required size of the buffer - ) -{ - BYTE *retVal = (BYTE *)(&s_actionIoBuffer[s_actionIoAllocation / UoM]); - pAssert((size + s_actionIoAllocation) < (sizeof(s_actionIoBuffer))); - // In this implementation, a static buffer is set aside for the command action - // output buffer. - memset(retVal, 0, size); - s_actionIoAllocation += size; - return retVal; -} - -//*** IsLabelProperlyFormatted() -// This function checks that a label is a null-terminated string. -// NOTE: this function is here because there was no better place for it. -// Return Type: BOOL -// TRUE(1) string is null terminated -// FALSE(0) string is not null terminated -BOOL -IsLabelProperlyFormatted( - TPM2B *x - ) -{ - return (((x)->size == 0) || ((x)->buffer[(x)->size - 1] == 0)); -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Locality.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Locality.c deleted file mode 100644 index e2d1bfd94..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Locality.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes -#include "Tpm.h" - -//** LocalityGetAttributes() -// This function will convert a locality expressed as an integer into -// TPMA_LOCALITY form. -// -// The function returns the locality attribute. -TPMA_LOCALITY -LocalityGetAttributes( - UINT8 locality // IN: locality value - ) -{ - TPMA_LOCALITY locality_attributes; - BYTE *localityAsByte = (BYTE *)&locality_attributes; - - MemorySet(&locality_attributes, 0, sizeof(TPMA_LOCALITY)); - switch(locality) - { - case 0: - SET_ATTRIBUTE(locality_attributes, TPMA_LOCALITY, TPM_LOC_ZERO); - break; - case 1: - SET_ATTRIBUTE(locality_attributes, TPMA_LOCALITY, TPM_LOC_ONE); - break; - case 2: - SET_ATTRIBUTE(locality_attributes, TPMA_LOCALITY, TPM_LOC_TWO); - break; - case 3: - SET_ATTRIBUTE(locality_attributes, TPMA_LOCALITY, TPM_LOC_THREE); - break; - case 4: - SET_ATTRIBUTE(locality_attributes, TPMA_LOCALITY, TPM_LOC_FOUR); - break; - default: - pAssert(locality > 31); - *localityAsByte = locality; - break; - } - return locality_attributes; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Manufacture.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Manufacture.c deleted file mode 100644 index 19361a96b..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Manufacture.c +++ /dev/null @@ -1,177 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// This file contains the function that performs the "manufacturing" of the TPM -// in a simulated environment. These functions should not be used outside of -// a manufacturing or simulation environment. - -//** Includes and Data Definitions -#define MANUFACTURE_C -#include "Tpm.h" -#include "TpmSizeChecks_fp.h" - -//** Functions - -//*** TPM_Manufacture() -// This function initializes the TPM values in preparation for the TPM's first -// use. This function will fail if previously called. The TPM can be re-manufactured -// by calling TPM_Teardown() first and then calling this function again. -// Return Type: int -// 0 success -// 1 manufacturing process previously performed -LIB_EXPORT int -TPM_Manufacture( - int firstTime // IN: indicates if this is the first call from - // main() - ) -{ - TPM_SU orderlyShutdown; - -#if RUNTIME_SIZE_CHECKS - // Call the function to verify the sizes of values that result from different - // compile options. - TpmSizeChecks(); -#endif - - // If TPM has been manufactured, return indication. - if(!firstTime && g_manufactured) - return 1; - - // Do power on initializations of the cryptographic libraries. - CryptInit(); - - s_DAPendingOnNV = FALSE; - - // initialize NV - NvManufacture(); - - // Clear the magic value in the DRBG state - go.drbgState.magic = 0; - - CryptStartup(SU_RESET); - - // default configuration for PCR - PCRSimStart(); - - // initialize pre-installed hierarchy data - // This should happen after NV is initialized because hierarchy data is - // stored in NV. - HierarchyPreInstall_Init(); - - // initialize dictionary attack parameters - DAPreInstall_Init(); - - // initialize PP list - PhysicalPresencePreInstall_Init(); - - // initialize command audit list - CommandAuditPreInstall_Init(); - - // first start up is required to be Startup(CLEAR) - orderlyShutdown = TPM_SU_CLEAR; - NV_WRITE_PERSISTENT(orderlyState, orderlyShutdown); - - // initialize the firmware version - gp.firmwareV1 = FIRMWARE_V1; -#ifdef FIRMWARE_V2 - gp.firmwareV2 = FIRMWARE_V2; -#else - gp.firmwareV2 = 0; -#endif - NV_SYNC_PERSISTENT(firmwareV1); - NV_SYNC_PERSISTENT(firmwareV2); - - // initialize the total reset counter to 0 - gp.totalResetCount = 0; - NV_SYNC_PERSISTENT(totalResetCount); - - // initialize the clock stuff - go.clock = 0; - go.clockSafe = YES; - - NvWrite(NV_ORDERLY_DATA, sizeof(ORDERLY_DATA), &go); - - // Commit NV writes. Manufacture process is an artificial process existing - // only in simulator environment and it is not defined in the specification - // that what should be the expected behavior if the NV write fails at this - // point. Therefore, it is assumed the NV write here is always success and - // no return code of this function is checked. - NvCommit(); - - g_manufactured = TRUE; - - return 0; -} - -//*** TPM_TearDown() -// This function prepares the TPM for re-manufacture. It should not be implemented -// in anything other than a simulated TPM. -// -// In this implementation, all that is needs is to stop the cryptographic units -// and set a flag to indicate that the TPM can be re-manufactured. This should -// be all that is necessary to start the manufacturing process again. -// Return Type: int -// 0 success -// 1 TPM not previously manufactured -LIB_EXPORT int -TPM_TearDown( - void - ) -{ - g_manufactured = FALSE; - return 0; -} - - -//*** TpmEndSimulation() -// This function is called at the end of the simulation run. It is used to provoke -// printing of any statistics that might be needed. -LIB_EXPORT void -TpmEndSimulation( - void - ) -{ -#if SIMULATION - HashLibSimulationEnd(); - SymLibSimulationEnd(); - MathLibSimulationEnd(); -#if ALG_RSA - RsaSimulationEnd(); -#endif -#if ALG_ECC - EccSimulationEnd(); -#endif -#endif // SIMULATION -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Marshal.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Marshal.c deleted file mode 100644 index ba96696db..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Marshal.c +++ /dev/null @@ -1,5811 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*(Auto-generated) - * Created by TpmMarshal; Version 4.1 Dec 10, 2018 - * Date: Apr 2, 2019 Time: 11:00:48AM - */ - -#include "Tpm.h" -#include "Marshal_fp.h" - -// Table 2:3 - Definition of Base Types -// UINT8 definition from table 2:3 -TPM_RC -UINT8_Unmarshal(UINT8 *target, BYTE **buffer, INT32 *size) -{ - if((*size -= 1) < 0) - return TPM_RC_INSUFFICIENT; - *target = BYTE_ARRAY_TO_UINT8(*buffer); - *buffer += 1; - return TPM_RC_SUCCESS; -} -UINT16 -UINT8_Marshal(UINT8 *source, BYTE **buffer, INT32 *size) -{ - if (buffer != 0) - { - if ((size == 0) || ((*size -= 1) >= 0)) - { - UINT8_TO_BYTE_ARRAY(*source, *buffer); - *buffer += 1; - } - pAssert(size == 0 || (*size >= 0)); - } - return (1); -} - -// BYTE definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -BYTE_Unmarshal(BYTE *target, BYTE **buffer, INT32 *size) -{ - return UINT8_Unmarshal((UINT8 *)target, buffer, size); -} -UINT16 -BYTE_Marshal(BYTE *source, BYTE **buffer, INT32 *size) -{ - return UINT8_Marshal((UINT8 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// INT8 definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -INT8_Unmarshal(INT8 *target, BYTE **buffer, INT32 *size) -{ - return UINT8_Unmarshal((UINT8 *)target, buffer, size); -} -UINT16 -INT8_Marshal(INT8 *source, BYTE **buffer, INT32 *size) -{ - return UINT8_Marshal((UINT8 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// UINT16 definition from table 2:3 -TPM_RC -UINT16_Unmarshal(UINT16 *target, BYTE **buffer, INT32 *size) -{ - if((*size -= 2) < 0) - return TPM_RC_INSUFFICIENT; - *target = BYTE_ARRAY_TO_UINT16(*buffer); - *buffer += 2; - return TPM_RC_SUCCESS; -} -UINT16 -UINT16_Marshal(UINT16 *source, BYTE **buffer, INT32 *size) -{ - if (buffer != 0) - { - if ((size == 0) || ((*size -= 2) >= 0)) - { - UINT16_TO_BYTE_ARRAY(*source, *buffer); - *buffer += 2; - } - pAssert(size == 0 || (*size >= 0)); - } - return (2); -} - -// INT16 definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -INT16_Unmarshal(INT16 *target, BYTE **buffer, INT32 *size) -{ - return UINT16_Unmarshal((UINT16 *)target, buffer, size); -} -UINT16 -INT16_Marshal(INT16 *source, BYTE **buffer, INT32 *size) -{ - return UINT16_Marshal((UINT16 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// UINT32 definition from table 2:3 -TPM_RC -UINT32_Unmarshal(UINT32 *target, BYTE **buffer, INT32 *size) -{ - if((*size -= 4) < 0) - return TPM_RC_INSUFFICIENT; - *target = BYTE_ARRAY_TO_UINT32(*buffer); - *buffer += 4; - return TPM_RC_SUCCESS; -} -UINT16 -UINT32_Marshal(UINT32 *source, BYTE **buffer, INT32 *size) -{ - if (buffer != 0) - { - if ((size == 0) || ((*size -= 4) >= 0)) - { - UINT32_TO_BYTE_ARRAY(*source, *buffer); - *buffer += 4; - } - pAssert(size == 0 || (*size >= 0)); - } - return (4); -} - -// INT32 definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -INT32_Unmarshal(INT32 *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -INT32_Marshal(INT32 *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// UINT64 definition from table 2:3 -TPM_RC -UINT64_Unmarshal(UINT64 *target, BYTE **buffer, INT32 *size) -{ - if((*size -= 8) < 0) - return TPM_RC_INSUFFICIENT; - *target = BYTE_ARRAY_TO_UINT64(*buffer); - *buffer += 8; - return TPM_RC_SUCCESS; -} -UINT16 -UINT64_Marshal(UINT64 *source, BYTE **buffer, INT32 *size) -{ - if (buffer != 0) - { - if ((size == 0) || ((*size -= 8) >= 0)) - { - UINT64_TO_BYTE_ARRAY(*source, *buffer); - *buffer += 8; - } - pAssert(size == 0 || (*size >= 0)); - } - return (8); -} - -// INT64 definition from table 2:3 -#if !USE_MARSHALING_DEFINES -TPM_RC -INT64_Unmarshal(INT64 *target, BYTE **buffer, INT32 *size) -{ - return UINT64_Unmarshal((UINT64 *)target, buffer, size); -} -UINT16 -INT64_Marshal(INT64 *source, BYTE **buffer, INT32 *size) -{ - return UINT64_Marshal((UINT64 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:4 - Defines for Logic Values -// Table 2:5 - Definition of Types for Documentation Clarity -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_ALGORITHM_ID_Unmarshal(TPM_ALGORITHM_ID *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -TPM_ALGORITHM_ID_Marshal(TPM_ALGORITHM_ID *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -TPM_RC -TPM_MODIFIER_INDICATOR_Unmarshal(TPM_MODIFIER_INDICATOR *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -TPM_MODIFIER_INDICATOR_Marshal(TPM_MODIFIER_INDICATOR *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -TPM_RC -TPM_AUTHORIZATION_SIZE_Unmarshal(TPM_AUTHORIZATION_SIZE *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -TPM_AUTHORIZATION_SIZE_Marshal(TPM_AUTHORIZATION_SIZE *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -TPM_RC -TPM_PARAMETER_SIZE_Unmarshal(TPM_PARAMETER_SIZE *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -TPM_PARAMETER_SIZE_Marshal(TPM_PARAMETER_SIZE *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -TPM_RC -TPM_KEY_SIZE_Unmarshal(TPM_KEY_SIZE *target, BYTE **buffer, INT32 *size) -{ - return UINT16_Unmarshal((UINT16 *)target, buffer, size); -} -UINT16 -TPM_KEY_SIZE_Marshal(TPM_KEY_SIZE *source, BYTE **buffer, INT32 *size) -{ - return UINT16_Marshal((UINT16 *)source, buffer, size); -} -TPM_RC -TPM_KEY_BITS_Unmarshal(TPM_KEY_BITS *target, BYTE **buffer, INT32 *size) -{ - return UINT16_Unmarshal((UINT16 *)target, buffer, size); -} -UINT16 -TPM_KEY_BITS_Marshal(TPM_KEY_BITS *source, BYTE **buffer, INT32 *size) -{ - return UINT16_Marshal((UINT16 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:6 - Definition of TPM_SPEC Constants -// Table 2:7 - Definition of TPM_GENERATED Constants -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_GENERATED_Marshal(TPM_GENERATED *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:9 - Definition of TPM_ALG_ID Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_ALG_ID_Unmarshal(TPM_ALG_ID *target, BYTE **buffer, INT32 *size) -{ - return UINT16_Unmarshal((UINT16 *)target, buffer, size); -} -UINT16 -TPM_ALG_ID_Marshal(TPM_ALG_ID *source, BYTE **buffer, INT32 *size) -{ - return UINT16_Marshal((UINT16 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:10 - Definition of TPM_ECC_CURVE Constants -#if ALG_ECC -TPM_RC -TPM_ECC_CURVE_Unmarshal(TPM_ECC_CURVE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch(*target) - { - case TPM_ECC_NIST_P192 : - case TPM_ECC_NIST_P224 : - case TPM_ECC_NIST_P256 : - case TPM_ECC_NIST_P384 : - case TPM_ECC_NIST_P521 : - case TPM_ECC_BN_P256 : - case TPM_ECC_BN_P638 : - case TPM_ECC_SM2_P256 : - break; - default : - result = TPM_RC_CURVE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_ECC_CURVE_Marshal(TPM_ECC_CURVE *source, BYTE **buffer, INT32 *size) -{ - return UINT16_Marshal((UINT16 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:12 - Definition of TPM_CC Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_CC_Unmarshal(TPM_CC *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -TPM_CC_Marshal(TPM_CC *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:16 - Definition of TPM_RC Constants -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_RC_Marshal(TPM_RC *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:17 - Definition of TPM_CLOCK_ADJUST Constants -TPM_RC -TPM_CLOCK_ADJUST_Unmarshal(TPM_CLOCK_ADJUST *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = INT8_Unmarshal((INT8 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch(*target) - { - case TPM_CLOCK_COARSE_SLOWER : - case TPM_CLOCK_MEDIUM_SLOWER : - case TPM_CLOCK_FINE_SLOWER : - case TPM_CLOCK_NO_CHANGE : - case TPM_CLOCK_FINE_FASTER : - case TPM_CLOCK_MEDIUM_FASTER : - case TPM_CLOCK_COARSE_FASTER : - break; - default : - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:18 - Definition of TPM_EO Constants -TPM_RC -TPM_EO_Unmarshal(TPM_EO *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch(*target) - { - case TPM_EO_EQ : - case TPM_EO_NEQ : - case TPM_EO_SIGNED_GT : - case TPM_EO_UNSIGNED_GT : - case TPM_EO_SIGNED_LT : - case TPM_EO_UNSIGNED_LT : - case TPM_EO_SIGNED_GE : - case TPM_EO_UNSIGNED_GE : - case TPM_EO_SIGNED_LE : - case TPM_EO_UNSIGNED_LE : - case TPM_EO_BITSET : - case TPM_EO_BITCLEAR : - break; - default : - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_EO_Marshal(TPM_EO *source, BYTE **buffer, INT32 *size) -{ - return UINT16_Marshal((UINT16 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:19 - Definition of TPM_ST Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_ST_Unmarshal(TPM_ST *target, BYTE **buffer, INT32 *size) -{ - return UINT16_Unmarshal((UINT16 *)target, buffer, size); -} -UINT16 -TPM_ST_Marshal(TPM_ST *source, BYTE **buffer, INT32 *size) -{ - return UINT16_Marshal((UINT16 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:20 - Definition of TPM_SU Constants -TPM_RC -TPM_SU_Unmarshal(TPM_SU *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch(*target) - { - case TPM_SU_CLEAR : - case TPM_SU_STATE : - break; - default : - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:21 - Definition of TPM_SE Constants -TPM_RC -TPM_SE_Unmarshal(TPM_SE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT8_Unmarshal((UINT8 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch(*target) - { - case TPM_SE_HMAC : - case TPM_SE_POLICY : - case TPM_SE_TRIAL : - break; - default : - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:22 - Definition of TPM_CAP Constants -TPM_RC -TPM_CAP_Unmarshal(TPM_CAP *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch(*target) - { - case TPM_CAP_ALGS : - case TPM_CAP_HANDLES : - case TPM_CAP_COMMANDS : - case TPM_CAP_PP_COMMANDS : - case TPM_CAP_AUDIT_COMMANDS : - case TPM_CAP_PCRS : - case TPM_CAP_TPM_PROPERTIES : - case TPM_CAP_PCR_PROPERTIES : - case TPM_CAP_ECC_CURVES : - case TPM_CAP_AUTH_POLICIES : - case TPM_CAP_VENDOR_PROPERTY : - break; - default : - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_CAP_Marshal(TPM_CAP *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:23 - Definition of TPM_PT Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_PT_Unmarshal(TPM_PT *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -TPM_PT_Marshal(TPM_PT *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:24 - Definition of TPM_PT_PCR Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_PT_PCR_Unmarshal(TPM_PT_PCR *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -TPM_PT_PCR_Marshal(TPM_PT_PCR *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:25 - Definition of TPM_PS Constants -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_PS_Marshal(TPM_PS *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:26 - Definition of Types for Handles -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_HANDLE_Unmarshal(TPM_HANDLE *target, BYTE **buffer, INT32 *size) -{ - return UINT32_Unmarshal((UINT32 *)target, buffer, size); -} -UINT16 -TPM_HANDLE_Marshal(TPM_HANDLE *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:27 - Definition of TPM_HT Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_HT_Unmarshal(TPM_HT *target, BYTE **buffer, INT32 *size) -{ - return UINT8_Unmarshal((UINT8 *)target, buffer, size); -} -UINT16 -TPM_HT_Marshal(TPM_HT *source, BYTE **buffer, INT32 *size) -{ - return UINT8_Marshal((UINT8 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:28 - Definition of TPM_RH Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_RH_Unmarshal(TPM_RH *target, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); -} -UINT16 -TPM_RH_Marshal(TPM_RH *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:29 - Definition of TPM_HC Constants -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM_HC_Unmarshal(TPM_HC *target, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); -} -UINT16 -TPM_HC_Marshal(TPM_HC *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:30 - Definition of TPMA_ALGORITHM Bits -TPM_RC -TPMA_ALGORITHM_Unmarshal(TPMA_ALGORITHM *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if(*((UINT32 *)target) & (UINT32)0xfffff8f0) - result = TPM_RC_RESERVED_BITS; - } - return result; -} - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_ALGORITHM_Marshal(TPMA_ALGORITHM *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:31 - Definition of TPMA_OBJECT Bits -TPM_RC -TPMA_OBJECT_Unmarshal(TPMA_OBJECT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if(*((UINT32 *)target) & (UINT32)0xfff0f309) - result = TPM_RC_RESERVED_BITS; - } - return result; -} - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_OBJECT_Marshal(TPMA_OBJECT *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:32 - Definition of TPMA_SESSION Bits -TPM_RC -TPMA_SESSION_Unmarshal(TPMA_SESSION *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT8_Unmarshal((UINT8 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if(*((UINT8 *)target) & (UINT8)0x18) - result = TPM_RC_RESERVED_BITS; - } - return result; -} - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_SESSION_Marshal(TPMA_SESSION *source, BYTE **buffer, INT32 *size) -{ - return UINT8_Marshal((UINT8 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:33 - Definition of TPMA_LOCALITY Bits -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMA_LOCALITY_Unmarshal(TPMA_LOCALITY *target, BYTE **buffer, INT32 *size) -{ - return UINT8_Unmarshal((UINT8 *)target, buffer, size); -} -UINT16 -TPMA_LOCALITY_Marshal(TPMA_LOCALITY *source, BYTE **buffer, INT32 *size) -{ - return UINT8_Marshal((UINT8 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:34 - Definition of TPMA_PERMANENT Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_PERMANENT_Marshal(TPMA_PERMANENT *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:35 - Definition of TPMA_STARTUP_CLEAR Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_STARTUP_CLEAR_Marshal(TPMA_STARTUP_CLEAR *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:36 - Definition of TPMA_MEMORY Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_MEMORY_Marshal(TPMA_MEMORY *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:37 - Definition of TPMA_CC Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_CC_Marshal(TPMA_CC *source, BYTE **buffer, INT32 *size) -{ - return TPM_CC_Marshal((TPM_CC *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:38 - Definition of TPMA_MODES Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_MODES_Marshal(TPMA_MODES *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:39 - Definition of TPMA_X509_KEY_USAGE Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_X509_KEY_USAGE_Marshal(TPMA_X509_KEY_USAGE *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:40 - Definition of TPMI_YES_NO Type -TPM_RC -TPMI_YES_NO_Unmarshal(TPMI_YES_NO *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = BYTE_Unmarshal((BYTE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case NO: - case YES: - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_YES_NO_Marshal(TPMI_YES_NO *source, BYTE **buffer, INT32 *size) -{ - return BYTE_Marshal((BYTE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:41 - Definition of TPMI_DH_OBJECT Type -TPM_RC -TPMI_DH_OBJECT_Unmarshal(TPMI_DH_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if(*target == TPM_RH_NULL) - { - if(!flag) - result = TPM_RC_VALUE; - } - else if( ((*target < TRANSIENT_FIRST) || (*target > TRANSIENT_LAST)) - && ((*target < PERSISTENT_FIRST) || (*target > PERSISTENT_LAST))) - result = TPM_RC_VALUE; - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_OBJECT_Marshal(TPMI_DH_OBJECT *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:42 - Definition of TPMI_DH_PARENT Type -TPM_RC -TPMI_DH_PARENT_Unmarshal(TPMI_DH_PARENT *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_OWNER: - case TPM_RH_PLATFORM: - case TPM_RH_ENDORSEMENT: - break; - case TPM_RH_NULL: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - if( ((*target < TRANSIENT_FIRST) || (*target > TRANSIENT_LAST)) - && ((*target < PERSISTENT_FIRST) || (*target > PERSISTENT_LAST))) - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_PARENT_Marshal(TPMI_DH_PARENT *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:43 - Definition of TPMI_DH_PERSISTENT Type -TPM_RC -TPMI_DH_PERSISTENT_Unmarshal(TPMI_DH_PERSISTENT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((*target < PERSISTENT_FIRST) || (*target > PERSISTENT_LAST)) - result = TPM_RC_VALUE; - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_PERSISTENT_Marshal(TPMI_DH_PERSISTENT *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:44 - Definition of TPMI_DH_ENTITY Type -TPM_RC -TPMI_DH_ENTITY_Unmarshal(TPMI_DH_ENTITY *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_OWNER: - case TPM_RH_ENDORSEMENT: - case TPM_RH_PLATFORM: - case TPM_RH_LOCKOUT: - break; - case TPM_RH_NULL: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - if( ((*target < TRANSIENT_FIRST) || (*target > TRANSIENT_LAST)) - && ((*target < PERSISTENT_FIRST) || (*target > PERSISTENT_LAST)) - && ((*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST)) - && (*target > PCR_LAST) - && ((*target < TPM_RH_AUTH_00) || (*target > TPM_RH_AUTH_FF))) - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:45 - Definition of TPMI_DH_PCR Type -TPM_RC -TPMI_DH_PCR_Unmarshal(TPMI_DH_PCR *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if(*target == TPM_RH_NULL) - { - if(!flag) - result = TPM_RC_VALUE; - } - else if(*target > PCR_LAST) - result = TPM_RC_VALUE; - } - return result; -} - -// Table 2:46 - Definition of TPMI_SH_AUTH_SESSION Type -TPM_RC -TPMI_SH_AUTH_SESSION_Unmarshal(TPMI_SH_AUTH_SESSION *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if(*target == TPM_RS_PW) - { - if(!flag) - result = TPM_RC_VALUE; - } - else if( ((*target < HMAC_SESSION_FIRST) || (*target > HMAC_SESSION_LAST)) - && ((*target < POLICY_SESSION_FIRST) || (*target > POLICY_SESSION_LAST))) - result = TPM_RC_VALUE; - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_SH_AUTH_SESSION_Marshal(TPMI_SH_AUTH_SESSION *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:47 - Definition of TPMI_SH_HMAC Type -TPM_RC -TPMI_SH_HMAC_Unmarshal(TPMI_SH_HMAC *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((*target < HMAC_SESSION_FIRST) || (*target > HMAC_SESSION_LAST)) - result = TPM_RC_VALUE; - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_SH_HMAC_Marshal(TPMI_SH_HMAC *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:48 - Definition of TPMI_SH_POLICY Type -TPM_RC -TPMI_SH_POLICY_Unmarshal(TPMI_SH_POLICY *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((*target < POLICY_SESSION_FIRST) || (*target > POLICY_SESSION_LAST)) - result = TPM_RC_VALUE; - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_SH_POLICY_Marshal(TPMI_SH_POLICY *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:49 - Definition of TPMI_DH_CONTEXT Type -TPM_RC -TPMI_DH_CONTEXT_Unmarshal(TPMI_DH_CONTEXT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if( ((*target < HMAC_SESSION_FIRST) || (*target > HMAC_SESSION_LAST)) - && ((*target < POLICY_SESSION_FIRST) || (*target > POLICY_SESSION_LAST)) - && ((*target < TRANSIENT_FIRST) || (*target > TRANSIENT_LAST))) - result = TPM_RC_VALUE; - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_CONTEXT_Marshal(TPMI_DH_CONTEXT *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:50 - Definition of TPMI_DH_SAVED Type -TPM_RC -TPMI_DH_SAVED_Unmarshal(TPMI_DH_SAVED *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case 0x80000000: - case 0x80000001: - case 0x80000002: - break; - default: - if( ((*target < HMAC_SESSION_FIRST) || (*target > HMAC_SESSION_LAST)) - && ((*target < POLICY_SESSION_FIRST) || (*target > POLICY_SESSION_LAST))) - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_DH_SAVED_Marshal(TPMI_DH_SAVED *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:51 - Definition of TPMI_RH_HIERARCHY Type -TPM_RC -TPMI_RH_HIERARCHY_Unmarshal(TPMI_RH_HIERARCHY *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_OWNER: - case TPM_RH_PLATFORM: - case TPM_RH_ENDORSEMENT: - break; - case TPM_RH_NULL: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_RH_HIERARCHY_Marshal(TPMI_RH_HIERARCHY *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:52 - Definition of TPMI_RH_ENABLES Type -TPM_RC -TPMI_RH_ENABLES_Unmarshal(TPMI_RH_ENABLES *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_OWNER: - case TPM_RH_PLATFORM: - case TPM_RH_ENDORSEMENT: - case TPM_RH_PLATFORM_NV: - break; - case TPM_RH_NULL: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_RH_ENABLES_Marshal(TPMI_RH_ENABLES *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:53 - Definition of TPMI_RH_HIERARCHY_AUTH Type -TPM_RC -TPMI_RH_HIERARCHY_AUTH_Unmarshal(TPMI_RH_HIERARCHY_AUTH *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_OWNER: - case TPM_RH_PLATFORM: - case TPM_RH_ENDORSEMENT: - case TPM_RH_LOCKOUT: - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:54 - Definition of TPMI_RH_PLATFORM Type -TPM_RC -TPMI_RH_PLATFORM_Unmarshal(TPMI_RH_PLATFORM *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_PLATFORM: - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:55 - Definition of TPMI_RH_OWNER Type -TPM_RC -TPMI_RH_OWNER_Unmarshal(TPMI_RH_OWNER *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_OWNER: - break; - case TPM_RH_NULL: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:56 - Definition of TPMI_RH_ENDORSEMENT Type -TPM_RC -TPMI_RH_ENDORSEMENT_Unmarshal(TPMI_RH_ENDORSEMENT *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_ENDORSEMENT: - break; - case TPM_RH_NULL: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:57 - Definition of TPMI_RH_PROVISION Type -TPM_RC -TPMI_RH_PROVISION_Unmarshal(TPMI_RH_PROVISION *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_OWNER: - case TPM_RH_PLATFORM: - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:58 - Definition of TPMI_RH_CLEAR Type -TPM_RC -TPMI_RH_CLEAR_Unmarshal(TPMI_RH_CLEAR *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_LOCKOUT: - case TPM_RH_PLATFORM: - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:59 - Definition of TPMI_RH_NV_AUTH Type -TPM_RC -TPMI_RH_NV_AUTH_Unmarshal(TPMI_RH_NV_AUTH *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_PLATFORM: - case TPM_RH_OWNER: - break; - default: - if((*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST)) - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:60 - Definition of TPMI_RH_LOCKOUT Type -TPM_RC -TPMI_RH_LOCKOUT_Unmarshal(TPMI_RH_LOCKOUT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_RH_LOCKOUT: - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} - -// Table 2:61 - Definition of TPMI_RH_NV_INDEX Type -TPM_RC -TPMI_RH_NV_INDEX_Unmarshal(TPMI_RH_NV_INDEX *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST)) - result = TPM_RC_VALUE; - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_RH_NV_INDEX_Marshal(TPMI_RH_NV_INDEX *source, BYTE **buffer, INT32 *size) -{ - return TPM_HANDLE_Marshal((TPM_HANDLE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:62 - Definition of TPMI_RH_AC Type -TPM_RC -TPMI_RH_AC_Unmarshal(TPMI_RH_AC *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_HANDLE_Unmarshal((TPM_HANDLE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((*target < AC_FIRST) || (*target > AC_LAST)) - result = TPM_RC_VALUE; - } - return result; -} - -// Table 2:63 - Definition of TPMI_ALG_HASH Type -TPM_RC -TPMI_ALG_HASH_Unmarshal(TPMI_ALG_HASH *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_SHA1 - case ALG_SHA1_VALUE: -#endif // ALG_SHA1 -#if ALG_SHA256 - case ALG_SHA256_VALUE: -#endif // ALG_SHA256 -#if ALG_SHA384 - case ALG_SHA384_VALUE: -#endif // ALG_SHA384 -#if ALG_SHA512 - case ALG_SHA512_VALUE: -#endif // ALG_SHA512 -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: -#endif // ALG_SM3_256 -#if ALG_SHA3_256 - case ALG_SHA3_256_VALUE: -#endif // ALG_SHA3_256 -#if ALG_SHA3_384 - case ALG_SHA3_384_VALUE: -#endif // ALG_SHA3_384 -#if ALG_SHA3_512 - case ALG_SHA3_512_VALUE: -#endif // ALG_SHA3_512 - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_HASH; - break; - default: - result = TPM_RC_HASH; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_HASH_Marshal(TPMI_ALG_HASH *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:64 - Definition of TPMI_ALG_ASYM Type -TPM_RC -TPMI_ALG_ASYM_Unmarshal(TPMI_ALG_ASYM *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_RSA - case ALG_RSA_VALUE: -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: -#endif // ALG_ECC - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_ASYMMETRIC; - break; - default: - result = TPM_RC_ASYMMETRIC; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_ASYM_Marshal(TPMI_ALG_ASYM *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:65 - Definition of TPMI_ALG_SYM Type -TPM_RC -TPMI_ALG_SYM_Unmarshal(TPMI_ALG_SYM *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_TDES - case ALG_TDES_VALUE: -#endif // ALG_TDES -#if ALG_AES - case ALG_AES_VALUE: -#endif // ALG_AES -#if ALG_SM4 - case ALG_SM4_VALUE: -#endif // ALG_SM4 -#if ALG_CAMELLIA - case ALG_CAMELLIA_VALUE: -#endif // ALG_CAMELLIA -#if ALG_XOR - case ALG_XOR_VALUE: -#endif // ALG_XOR - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_SYMMETRIC; - break; - default: - result = TPM_RC_SYMMETRIC; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_SYM_Marshal(TPMI_ALG_SYM *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:66 - Definition of TPMI_ALG_SYM_OBJECT Type -TPM_RC -TPMI_ALG_SYM_OBJECT_Unmarshal(TPMI_ALG_SYM_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_TDES - case ALG_TDES_VALUE: -#endif // ALG_TDES -#if ALG_AES - case ALG_AES_VALUE: -#endif // ALG_AES -#if ALG_SM4 - case ALG_SM4_VALUE: -#endif // ALG_SM4 -#if ALG_CAMELLIA - case ALG_CAMELLIA_VALUE: -#endif // ALG_CAMELLIA - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_SYMMETRIC; - break; - default: - result = TPM_RC_SYMMETRIC; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_SYM_OBJECT_Marshal(TPMI_ALG_SYM_OBJECT *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:67 - Definition of TPMI_ALG_SYM_MODE Type -TPM_RC -TPMI_ALG_SYM_MODE_Unmarshal(TPMI_ALG_SYM_MODE *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_CTR - case ALG_CTR_VALUE: -#endif // ALG_CTR -#if ALG_OFB - case ALG_OFB_VALUE: -#endif // ALG_OFB -#if ALG_CBC - case ALG_CBC_VALUE: -#endif // ALG_CBC -#if ALG_CFB - case ALG_CFB_VALUE: -#endif // ALG_CFB -#if ALG_ECB - case ALG_ECB_VALUE: -#endif // ALG_ECB -#if ALG_CMAC - case ALG_CMAC_VALUE: -#endif // ALG_CMAC - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_MODE; - break; - default: - result = TPM_RC_MODE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_SYM_MODE_Marshal(TPMI_ALG_SYM_MODE *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:68 - Definition of TPMI_ALG_KDF Type -TPM_RC -TPMI_ALG_KDF_Unmarshal(TPMI_ALG_KDF *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_MGF1 - case ALG_MGF1_VALUE: -#endif // ALG_MGF1 -#if ALG_KDF1_SP800_56A - case ALG_KDF1_SP800_56A_VALUE: -#endif // ALG_KDF1_SP800_56A -#if ALG_KDF2 - case ALG_KDF2_VALUE: -#endif // ALG_KDF2 -#if ALG_KDF1_SP800_108 - case ALG_KDF1_SP800_108_VALUE: -#endif // ALG_KDF1_SP800_108 - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_KDF; - break; - default: - result = TPM_RC_KDF; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_KDF_Marshal(TPMI_ALG_KDF *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:69 - Definition of TPMI_ALG_SIG_SCHEME Type -TPM_RC -TPMI_ALG_SIG_SCHEME_Unmarshal(TPMI_ALG_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_ECDAA - case ALG_ECDAA_VALUE: -#endif // ALG_ECDAA -#if ALG_RSASSA - case ALG_RSASSA_VALUE: -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: -#endif // ALG_RSAPSS -#if ALG_ECDSA - case ALG_ECDSA_VALUE: -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: -#endif // ALG_ECSCHNORR -#if ALG_HMAC - case ALG_HMAC_VALUE: -#endif // ALG_HMAC - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_SCHEME; - break; - default: - result = TPM_RC_SCHEME; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_SIG_SCHEME_Marshal(TPMI_ALG_SIG_SCHEME *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:70 - Definition of TPMI_ECC_KEY_EXCHANGE Type -#if ALG_ECC -TPM_RC -TPMI_ECC_KEY_EXCHANGE_Unmarshal(TPMI_ECC_KEY_EXCHANGE *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_ECDH - case ALG_ECDH_VALUE: -#endif // ALG_ECDH -#if ALG_ECMQV - case ALG_ECMQV_VALUE: -#endif // ALG_ECMQV -#if ALG_SM2 - case ALG_SM2_VALUE: -#endif // ALG_SM2 - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_SCHEME; - break; - default: - result = TPM_RC_SCHEME; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ECC_KEY_EXCHANGE_Marshal(TPMI_ECC_KEY_EXCHANGE *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:71 - Definition of TPMI_ST_COMMAND_TAG Type -TPM_RC -TPMI_ST_COMMAND_TAG_Unmarshal(TPMI_ST_COMMAND_TAG *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_ST_Unmarshal((TPM_ST *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { - case TPM_ST_NO_SESSIONS: - case TPM_ST_SESSIONS: - break; - default: - result = TPM_RC_BAD_TAG; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ST_COMMAND_TAG_Marshal(TPMI_ST_COMMAND_TAG *source, BYTE **buffer, INT32 *size) -{ - return TPM_ST_Marshal((TPM_ST *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:72 - Definition of TPMI_ALG_MAC_SCHEME Type -TPM_RC -TPMI_ALG_MAC_SCHEME_Unmarshal(TPMI_ALG_MAC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_CMAC - case ALG_CMAC_VALUE: -#endif // ALG_CMAC -#if ALG_SHA1 - case ALG_SHA1_VALUE: -#endif // ALG_SHA1 -#if ALG_SHA256 - case ALG_SHA256_VALUE: -#endif // ALG_SHA256 -#if ALG_SHA384 - case ALG_SHA384_VALUE: -#endif // ALG_SHA384 -#if ALG_SHA512 - case ALG_SHA512_VALUE: -#endif // ALG_SHA512 -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: -#endif // ALG_SM3_256 -#if ALG_SHA3_256 - case ALG_SHA3_256_VALUE: -#endif // ALG_SHA3_256 -#if ALG_SHA3_384 - case ALG_SHA3_384_VALUE: -#endif // ALG_SHA3_384 -#if ALG_SHA3_512 - case ALG_SHA3_512_VALUE: -#endif // ALG_SHA3_512 - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_SYMMETRIC; - break; - default: - result = TPM_RC_SYMMETRIC; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_MAC_SCHEME_Marshal(TPMI_ALG_MAC_SCHEME *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:73 - Definition of TPMI_ALG_CIPHER_MODE Type -TPM_RC -TPMI_ALG_CIPHER_MODE_Unmarshal(TPMI_ALG_CIPHER_MODE *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_CTR - case ALG_CTR_VALUE: -#endif // ALG_CTR -#if ALG_OFB - case ALG_OFB_VALUE: -#endif // ALG_OFB -#if ALG_CBC - case ALG_CBC_VALUE: -#endif // ALG_CBC -#if ALG_CFB - case ALG_CFB_VALUE: -#endif // ALG_CFB -#if ALG_ECB - case ALG_ECB_VALUE: -#endif // ALG_ECB - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_MODE; - break; - default: - result = TPM_RC_MODE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_CIPHER_MODE_Marshal(TPMI_ALG_CIPHER_MODE *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:74 - Definition of TPMS_EMPTY Structure -TPM_RC -TPMS_EMPTY_Unmarshal(TPMS_EMPTY *target, BYTE **buffer, INT32 *size) -{ - // to prevent the compiler from complaining - NOT_REFERENCED(target); - NOT_REFERENCED(buffer); - NOT_REFERENCED(size); - return TPM_RC_SUCCESS; -} -UINT16 -TPMS_EMPTY_Marshal(TPMS_EMPTY *source, BYTE **buffer, INT32 *size) -{ - // to prevent the compiler from complaining - NOT_REFERENCED(source); - NOT_REFERENCED(buffer); - NOT_REFERENCED(size); - return 0; -} - -// Table 2:75 - Definition of TPMS_ALGORITHM_DESCRIPTION Structure -UINT16 -TPMS_ALGORITHM_DESCRIPTION_Marshal(TPMS_ALGORITHM_DESCRIPTION *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_ALG_ID_Marshal((TPM_ALG_ID *)&(source->alg), buffer, size)); - result = (UINT16)(result + TPMA_ALGORITHM_Marshal((TPMA_ALGORITHM *)&(source->attributes), buffer, size)); - return result; -} - -// Table 2:76 - Definition of TPMU_HA Union -TPM_RC -TPMU_HA_Unmarshal(TPMU_HA *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_SHA1 - case ALG_SHA1_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->sha1), buffer, size, (INT32)SHA1_DIGEST_SIZE); -#endif // ALG_SHA1 -#if ALG_SHA256 - case ALG_SHA256_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->sha256), buffer, size, (INT32)SHA256_DIGEST_SIZE); -#endif // ALG_SHA256 -#if ALG_SHA384 - case ALG_SHA384_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->sha384), buffer, size, (INT32)SHA384_DIGEST_SIZE); -#endif // ALG_SHA384 -#if ALG_SHA512 - case ALG_SHA512_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->sha512), buffer, size, (INT32)SHA512_DIGEST_SIZE); -#endif // ALG_SHA512 -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->sm3_256), buffer, size, (INT32)SM3_256_DIGEST_SIZE); -#endif // ALG_SM3_256 -#if ALG_SHA3_256 - case ALG_SHA3_256_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->sha3_256), buffer, size, (INT32)SHA3_256_DIGEST_SIZE); -#endif // ALG_SHA3_256 -#if ALG_SHA3_384 - case ALG_SHA3_384_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->sha3_384), buffer, size, (INT32)SHA3_384_DIGEST_SIZE); -#endif // ALG_SHA3_384 -#if ALG_SHA3_512 - case ALG_SHA3_512_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->sha3_512), buffer, size, (INT32)SHA3_512_DIGEST_SIZE); -#endif // ALG_SHA3_512 - case ALG_NULL_VALUE: - return TPM_RC_SUCCESS; - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_HA_Marshal(TPMU_HA *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_SHA1 - case ALG_SHA1_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->sha1), buffer, size, (INT32)SHA1_DIGEST_SIZE); -#endif // ALG_SHA1 -#if ALG_SHA256 - case ALG_SHA256_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->sha256), buffer, size, (INT32)SHA256_DIGEST_SIZE); -#endif // ALG_SHA256 -#if ALG_SHA384 - case ALG_SHA384_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->sha384), buffer, size, (INT32)SHA384_DIGEST_SIZE); -#endif // ALG_SHA384 -#if ALG_SHA512 - case ALG_SHA512_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->sha512), buffer, size, (INT32)SHA512_DIGEST_SIZE); -#endif // ALG_SHA512 -#if ALG_SM3_256 - case ALG_SM3_256_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->sm3_256), buffer, size, (INT32)SM3_256_DIGEST_SIZE); -#endif // ALG_SM3_256 -#if ALG_SHA3_256 - case ALG_SHA3_256_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->sha3_256), buffer, size, (INT32)SHA3_256_DIGEST_SIZE); -#endif // ALG_SHA3_256 -#if ALG_SHA3_384 - case ALG_SHA3_384_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->sha3_384), buffer, size, (INT32)SHA3_384_DIGEST_SIZE); -#endif // ALG_SHA3_384 -#if ALG_SHA3_512 - case ALG_SHA3_512_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->sha3_512), buffer, size, (INT32)SHA3_512_DIGEST_SIZE); -#endif // ALG_SHA3_512 - case ALG_NULL_VALUE: - return 0; - } - return 0; -} - -// Table 2:77 - Definition of TPMT_HA Structure -TPM_RC -TPMT_HA_Unmarshal(TPMT_HA *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hashAlg), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_HA_Unmarshal((TPMU_HA *)&(target->digest), buffer, size, (UINT32)target->hashAlg); - return result; -} -UINT16 -TPMT_HA_Marshal(TPMT_HA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->hashAlg), buffer, size)); - result = (UINT16)(result + TPMU_HA_Marshal((TPMU_HA *)&(source->digest), buffer, size, (UINT32)source->hashAlg)); - return result; -} - -// Table 2:78 - Definition of TPM2B_DIGEST Structure -TPM_RC -TPM2B_DIGEST_Unmarshal(TPM2B_DIGEST *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMU_HA)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_DIGEST_Marshal(TPM2B_DIGEST *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:79 - Definition of TPM2B_DATA Structure -TPM_RC -TPM2B_DATA_Unmarshal(TPM2B_DATA *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMT_HA)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_DATA_Marshal(TPM2B_DATA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:80 - Definition of Types for TPM2B_NONCE -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM2B_NONCE_Unmarshal(TPM2B_NONCE *target, BYTE **buffer, INT32 *size) -{ - return TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)target, buffer, size); -} -UINT16 -TPM2B_NONCE_Marshal(TPM2B_NONCE *source, BYTE **buffer, INT32 *size) -{ - return TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:81 - Definition of Types for TPM2B_AUTH -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM2B_AUTH_Unmarshal(TPM2B_AUTH *target, BYTE **buffer, INT32 *size) -{ - return TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)target, buffer, size); -} -UINT16 -TPM2B_AUTH_Marshal(TPM2B_AUTH *source, BYTE **buffer, INT32 *size) -{ - return TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:82 - Definition of Types for TPM2B_OPERAND -#if !USE_MARSHALING_DEFINES -TPM_RC -TPM2B_OPERAND_Unmarshal(TPM2B_OPERAND *target, BYTE **buffer, INT32 *size) -{ - return TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)target, buffer, size); -} -UINT16 -TPM2B_OPERAND_Marshal(TPM2B_OPERAND *source, BYTE **buffer, INT32 *size) -{ - return TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:83 - Definition of TPM2B_EVENT Structure -TPM_RC -TPM2B_EVENT_Unmarshal(TPM2B_EVENT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > 1024) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_EVENT_Marshal(TPM2B_EVENT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:84 - Definition of TPM2B_MAX_BUFFER Structure -TPM_RC -TPM2B_MAX_BUFFER_Unmarshal(TPM2B_MAX_BUFFER *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > MAX_DIGEST_BUFFER) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_MAX_BUFFER_Marshal(TPM2B_MAX_BUFFER *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:85 - Definition of TPM2B_MAX_NV_BUFFER Structure -TPM_RC -TPM2B_MAX_NV_BUFFER_Unmarshal(TPM2B_MAX_NV_BUFFER *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > MAX_NV_BUFFER_SIZE) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_MAX_NV_BUFFER_Marshal(TPM2B_MAX_NV_BUFFER *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:86 - Definition of TPM2B_TIMEOUT Structure -TPM_RC -TPM2B_TIMEOUT_Unmarshal(TPM2B_TIMEOUT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(UINT64)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_TIMEOUT_Marshal(TPM2B_TIMEOUT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:87 - Definition of TPM2B_IV Structure -TPM_RC -TPM2B_IV_Unmarshal(TPM2B_IV *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > MAX_SYM_BLOCK_SIZE) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_IV_Marshal(TPM2B_IV *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:88 - Definition of TPMU_NAME Union -// Table 2:89 - Definition of TPM2B_NAME Structure -TPM_RC -TPM2B_NAME_Unmarshal(TPM2B_NAME *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMU_NAME)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.name), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_NAME_Marshal(TPM2B_NAME *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.name), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:90 - Definition of TPMS_PCR_SELECT Structure -TPM_RC -TPMS_PCR_SELECT_Unmarshal(TPMS_PCR_SELECT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT8_Unmarshal((UINT8 *)&(target->sizeofSelect), buffer, size); - if( (result == TPM_RC_SUCCESS) - && (target->sizeofSelect < PCR_SELECT_MIN)) - result = TPM_RC_VALUE; - if(result == TPM_RC_SUCCESS) - { - if((target->sizeofSelect) > PCR_SELECT_MAX) - result = TPM_RC_VALUE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->pcrSelect), buffer, size, (INT32)(target->sizeofSelect)); - } - return result; -} -UINT16 -TPMS_PCR_SELECT_Marshal(TPMS_PCR_SELECT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT8_Marshal((UINT8 *)&(source->sizeofSelect), buffer, size)); - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->pcrSelect), buffer, size, (INT32)(source->sizeofSelect))); - return result; -} - -// Table 2:91 - Definition of TPMS_PCR_SELECTION Structure -TPM_RC -TPMS_PCR_SELECTION_Unmarshal(TPMS_PCR_SELECTION *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hash), buffer, size, 0); - if(result == TPM_RC_SUCCESS) - result = UINT8_Unmarshal((UINT8 *)&(target->sizeofSelect), buffer, size); - if( (result == TPM_RC_SUCCESS) - && (target->sizeofSelect < PCR_SELECT_MIN)) - result = TPM_RC_VALUE; - if(result == TPM_RC_SUCCESS) - { - if((target->sizeofSelect) > PCR_SELECT_MAX) - result = TPM_RC_VALUE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->pcrSelect), buffer, size, (INT32)(target->sizeofSelect)); - } - return result; -} -UINT16 -TPMS_PCR_SELECTION_Marshal(TPMS_PCR_SELECTION *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->hash), buffer, size)); - result = (UINT16)(result + UINT8_Marshal((UINT8 *)&(source->sizeofSelect), buffer, size)); - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->pcrSelect), buffer, size, (INT32)(source->sizeofSelect))); - return result; -} - -// Table 2:94 - Definition of TPMT_TK_CREATION Structure -TPM_RC -TPMT_TK_CREATION_Unmarshal(TPMT_TK_CREATION *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_ST_Unmarshal((TPM_ST *)&(target->tag), buffer, size); - if( (result == TPM_RC_SUCCESS) - && (target->tag != TPM_ST_CREATION)) - result = TPM_RC_TAG; - if(result == TPM_RC_SUCCESS) - result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->digest), buffer, size); - return result; -} -UINT16 -TPMT_TK_CREATION_Marshal(TPMT_TK_CREATION *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_ST_Marshal((TPM_ST *)&(source->tag), buffer, size)); - result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->digest), buffer, size)); - return result; -} - -// Table 2:95 - Definition of TPMT_TK_VERIFIED Structure -TPM_RC -TPMT_TK_VERIFIED_Unmarshal(TPMT_TK_VERIFIED *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_ST_Unmarshal((TPM_ST *)&(target->tag), buffer, size); - if( (result == TPM_RC_SUCCESS) - && (target->tag != TPM_ST_VERIFIED)) - result = TPM_RC_TAG; - if(result == TPM_RC_SUCCESS) - result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->digest), buffer, size); - return result; -} -UINT16 -TPMT_TK_VERIFIED_Marshal(TPMT_TK_VERIFIED *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_ST_Marshal((TPM_ST *)&(source->tag), buffer, size)); - result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->digest), buffer, size)); - return result; -} - -// Table 2:96 - Definition of TPMT_TK_AUTH Structure -TPM_RC -TPMT_TK_AUTH_Unmarshal(TPMT_TK_AUTH *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_ST_Unmarshal((TPM_ST *)&(target->tag), buffer, size); - if( (result == TPM_RC_SUCCESS) - && (target->tag != TPM_ST_AUTH_SIGNED) - && (target->tag != TPM_ST_AUTH_SECRET)) - result = TPM_RC_TAG; - if(result == TPM_RC_SUCCESS) - result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->digest), buffer, size); - return result; -} -UINT16 -TPMT_TK_AUTH_Marshal(TPMT_TK_AUTH *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_ST_Marshal((TPM_ST *)&(source->tag), buffer, size)); - result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->digest), buffer, size)); - return result; -} - -// Table 2:97 - Definition of TPMT_TK_HASHCHECK Structure -TPM_RC -TPMT_TK_HASHCHECK_Unmarshal(TPMT_TK_HASHCHECK *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_ST_Unmarshal((TPM_ST *)&(target->tag), buffer, size); - if( (result == TPM_RC_SUCCESS) - && (target->tag != TPM_ST_HASHCHECK)) - result = TPM_RC_TAG; - if(result == TPM_RC_SUCCESS) - result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->digest), buffer, size); - return result; -} -UINT16 -TPMT_TK_HASHCHECK_Marshal(TPMT_TK_HASHCHECK *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_ST_Marshal((TPM_ST *)&(source->tag), buffer, size)); - result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->digest), buffer, size)); - return result; -} - -// Table 2:98 - Definition of TPMS_ALG_PROPERTY Structure -UINT16 -TPMS_ALG_PROPERTY_Marshal(TPMS_ALG_PROPERTY *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_ALG_ID_Marshal((TPM_ALG_ID *)&(source->alg), buffer, size)); - result = (UINT16)(result + TPMA_ALGORITHM_Marshal((TPMA_ALGORITHM *)&(source->algProperties), buffer, size)); - return result; -} - -// Table 2:99 - Definition of TPMS_TAGGED_PROPERTY Structure -UINT16 -TPMS_TAGGED_PROPERTY_Marshal(TPMS_TAGGED_PROPERTY *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_PT_Marshal((TPM_PT *)&(source->property), buffer, size)); - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->value), buffer, size)); - return result; -} - -// Table 2:100 - Definition of TPMS_TAGGED_PCR_SELECT Structure -UINT16 -TPMS_TAGGED_PCR_SELECT_Marshal(TPMS_TAGGED_PCR_SELECT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_PT_PCR_Marshal((TPM_PT_PCR *)&(source->tag), buffer, size)); - result = (UINT16)(result + UINT8_Marshal((UINT8 *)&(source->sizeofSelect), buffer, size)); - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->pcrSelect), buffer, size, (INT32)(source->sizeofSelect))); - return result; -} - -// Table 2:101 - Definition of TPMS_TAGGED_POLICY Structure -UINT16 -TPMS_TAGGED_POLICY_Marshal(TPMS_TAGGED_POLICY *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_HANDLE_Marshal((TPM_HANDLE *)&(source->handle), buffer, size)); - result = (UINT16)(result + TPMT_HA_Marshal((TPMT_HA *)&(source->policyHash), buffer, size)); - return result; -} - -// Table 2:102 - Definition of TPML_CC Structure -TPM_RC -TPML_CC_Unmarshal(TPML_CC *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->count) > MAX_CAP_CC) - result = TPM_RC_SIZE; - else - result = TPM_CC_Array_Unmarshal((TPM_CC *)(target->commandCodes), buffer, size, (INT32)(target->count)); - } - return result; -} -UINT16 -TPML_CC_Marshal(TPML_CC *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPM_CC_Array_Marshal((TPM_CC *)(source->commandCodes), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:103 - Definition of TPML_CCA Structure -UINT16 -TPML_CCA_Marshal(TPML_CCA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPMA_CC_Array_Marshal((TPMA_CC *)(source->commandAttributes), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:104 - Definition of TPML_ALG Structure -TPM_RC -TPML_ALG_Unmarshal(TPML_ALG *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->count) > MAX_ALG_LIST_SIZE) - result = TPM_RC_SIZE; - else - result = TPM_ALG_ID_Array_Unmarshal((TPM_ALG_ID *)(target->algorithms), buffer, size, (INT32)(target->count)); - } - return result; -} -UINT16 -TPML_ALG_Marshal(TPML_ALG *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPM_ALG_ID_Array_Marshal((TPM_ALG_ID *)(source->algorithms), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:105 - Definition of TPML_HANDLE Structure -UINT16 -TPML_HANDLE_Marshal(TPML_HANDLE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPM_HANDLE_Array_Marshal((TPM_HANDLE *)(source->handle), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:106 - Definition of TPML_DIGEST Structure -TPM_RC -TPML_DIGEST_Unmarshal(TPML_DIGEST *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size); - if( (result == TPM_RC_SUCCESS) - && (target->count < 2)) - result = TPM_RC_SIZE; - if(result == TPM_RC_SUCCESS) - { - if((target->count) > 8) - result = TPM_RC_SIZE; - else - result = TPM2B_DIGEST_Array_Unmarshal((TPM2B_DIGEST *)(target->digests), buffer, size, (INT32)(target->count)); - } - return result; -} -UINT16 -TPML_DIGEST_Marshal(TPML_DIGEST *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Array_Marshal((TPM2B_DIGEST *)(source->digests), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:107 - Definition of TPML_DIGEST_VALUES Structure -TPM_RC -TPML_DIGEST_VALUES_Unmarshal(TPML_DIGEST_VALUES *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->count) > HASH_COUNT) - result = TPM_RC_SIZE; - else - result = TPMT_HA_Array_Unmarshal((TPMT_HA *)(target->digests), buffer, size, 0, (INT32)(target->count)); - } - return result; -} -UINT16 -TPML_DIGEST_VALUES_Marshal(TPML_DIGEST_VALUES *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPMT_HA_Array_Marshal((TPMT_HA *)(source->digests), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:108 - Definition of TPML_PCR_SELECTION Structure -TPM_RC -TPML_PCR_SELECTION_Unmarshal(TPML_PCR_SELECTION *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)&(target->count), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->count) > HASH_COUNT) - result = TPM_RC_SIZE; - else - result = TPMS_PCR_SELECTION_Array_Unmarshal((TPMS_PCR_SELECTION *)(target->pcrSelections), buffer, size, (INT32)(target->count)); - } - return result; -} -UINT16 -TPML_PCR_SELECTION_Marshal(TPML_PCR_SELECTION *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPMS_PCR_SELECTION_Array_Marshal((TPMS_PCR_SELECTION *)(source->pcrSelections), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:109 - Definition of TPML_ALG_PROPERTY Structure -UINT16 -TPML_ALG_PROPERTY_Marshal(TPML_ALG_PROPERTY *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPMS_ALG_PROPERTY_Array_Marshal((TPMS_ALG_PROPERTY *)(source->algProperties), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:110 - Definition of TPML_TAGGED_TPM_PROPERTY Structure -UINT16 -TPML_TAGGED_TPM_PROPERTY_Marshal(TPML_TAGGED_TPM_PROPERTY *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPMS_TAGGED_PROPERTY_Array_Marshal((TPMS_TAGGED_PROPERTY *)(source->tpmProperty), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:111 - Definition of TPML_TAGGED_PCR_PROPERTY Structure -UINT16 -TPML_TAGGED_PCR_PROPERTY_Marshal(TPML_TAGGED_PCR_PROPERTY *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPMS_TAGGED_PCR_SELECT_Array_Marshal((TPMS_TAGGED_PCR_SELECT *)(source->pcrProperty), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:112 - Definition of TPML_ECC_CURVE Structure -#if ALG_ECC -UINT16 -TPML_ECC_CURVE_Marshal(TPML_ECC_CURVE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPM_ECC_CURVE_Array_Marshal((TPM_ECC_CURVE *)(source->eccCurves), buffer, size, (INT32)(source->count))); - return result; -} -#endif // ALG_ECC - -// Table 2:113 - Definition of TPML_TAGGED_POLICY Structure -UINT16 -TPML_TAGGED_POLICY_Marshal(TPML_TAGGED_POLICY *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPMS_TAGGED_POLICY_Array_Marshal((TPMS_TAGGED_POLICY *)(source->policies), buffer, size, (INT32)(source->count))); - return result; -} - -// Table 2:114 - Definition of TPMU_CAPABILITIES Union -UINT16 -TPMU_CAPABILITIES_Marshal(TPMU_CAPABILITIES *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { - case TPM_CAP_ALGS: - return TPML_ALG_PROPERTY_Marshal((TPML_ALG_PROPERTY *)&(source->algorithms), buffer, size); - case TPM_CAP_HANDLES: - return TPML_HANDLE_Marshal((TPML_HANDLE *)&(source->handles), buffer, size); - case TPM_CAP_COMMANDS: - return TPML_CCA_Marshal((TPML_CCA *)&(source->command), buffer, size); - case TPM_CAP_PP_COMMANDS: - return TPML_CC_Marshal((TPML_CC *)&(source->ppCommands), buffer, size); - case TPM_CAP_AUDIT_COMMANDS: - return TPML_CC_Marshal((TPML_CC *)&(source->auditCommands), buffer, size); - case TPM_CAP_PCRS: - return TPML_PCR_SELECTION_Marshal((TPML_PCR_SELECTION *)&(source->assignedPCR), buffer, size); - case TPM_CAP_TPM_PROPERTIES: - return TPML_TAGGED_TPM_PROPERTY_Marshal((TPML_TAGGED_TPM_PROPERTY *)&(source->tpmProperties), buffer, size); - case TPM_CAP_PCR_PROPERTIES: - return TPML_TAGGED_PCR_PROPERTY_Marshal((TPML_TAGGED_PCR_PROPERTY *)&(source->pcrProperties), buffer, size); -#if ALG_ECC - case TPM_CAP_ECC_CURVES: - return TPML_ECC_CURVE_Marshal((TPML_ECC_CURVE *)&(source->eccCurves), buffer, size); -#endif // ALG_ECC - case TPM_CAP_AUTH_POLICIES: - return TPML_TAGGED_POLICY_Marshal((TPML_TAGGED_POLICY *)&(source->authPolicies), buffer, size); - } - return 0; -} - -// Table 2:115 - Definition of TPMS_CAPABILITY_DATA Structure -UINT16 -TPMS_CAPABILITY_DATA_Marshal(TPMS_CAPABILITY_DATA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_CAP_Marshal((TPM_CAP *)&(source->capability), buffer, size)); - result = (UINT16)(result + TPMU_CAPABILITIES_Marshal((TPMU_CAPABILITIES *)&(source->data), buffer, size, (UINT32)source->capability)); - return result; -} - -// Table 2:116 - Definition of TPMS_CLOCK_INFO Structure -TPM_RC -TPMS_CLOCK_INFO_Unmarshal(TPMS_CLOCK_INFO *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT64_Unmarshal((UINT64 *)&(target->clock), buffer, size); - if(result == TPM_RC_SUCCESS) - result = UINT32_Unmarshal((UINT32 *)&(target->resetCount), buffer, size); - if(result == TPM_RC_SUCCESS) - result = UINT32_Unmarshal((UINT32 *)&(target->restartCount), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMI_YES_NO_Unmarshal((TPMI_YES_NO *)&(target->safe), buffer, size); - return result; -} -UINT16 -TPMS_CLOCK_INFO_Marshal(TPMS_CLOCK_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT64_Marshal((UINT64 *)&(source->clock), buffer, size)); - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->resetCount), buffer, size)); - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->restartCount), buffer, size)); - result = (UINT16)(result + TPMI_YES_NO_Marshal((TPMI_YES_NO *)&(source->safe), buffer, size)); - return result; -} - -// Table 2:117 - Definition of TPMS_TIME_INFO Structure -TPM_RC -TPMS_TIME_INFO_Unmarshal(TPMS_TIME_INFO *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT64_Unmarshal((UINT64 *)&(target->time), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMS_CLOCK_INFO_Unmarshal((TPMS_CLOCK_INFO *)&(target->clockInfo), buffer, size); - return result; -} -UINT16 -TPMS_TIME_INFO_Marshal(TPMS_TIME_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT64_Marshal((UINT64 *)&(source->time), buffer, size)); - result = (UINT16)(result + TPMS_CLOCK_INFO_Marshal((TPMS_CLOCK_INFO *)&(source->clockInfo), buffer, size)); - return result; -} - -// Table 2:118 - Definition of TPMS_TIME_ATTEST_INFO Structure -UINT16 -TPMS_TIME_ATTEST_INFO_Marshal(TPMS_TIME_ATTEST_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMS_TIME_INFO_Marshal((TPMS_TIME_INFO *)&(source->time), buffer, size)); - result = (UINT16)(result + UINT64_Marshal((UINT64 *)&(source->firmwareVersion), buffer, size)); - return result; -} - -// Table 2:119 - Definition of TPMS_CERTIFY_INFO Structure -UINT16 -TPMS_CERTIFY_INFO_Marshal(TPMS_CERTIFY_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->name), buffer, size)); - result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->qualifiedName), buffer, size)); - return result; -} - -// Table 2:120 - Definition of TPMS_QUOTE_INFO Structure -UINT16 -TPMS_QUOTE_INFO_Marshal(TPMS_QUOTE_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPML_PCR_SELECTION_Marshal((TPML_PCR_SELECTION *)&(source->pcrSelect), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->pcrDigest), buffer, size)); - return result; -} - -// Table 2:121 - Definition of TPMS_COMMAND_AUDIT_INFO Structure -UINT16 -TPMS_COMMAND_AUDIT_INFO_Marshal(TPMS_COMMAND_AUDIT_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT64_Marshal((UINT64 *)&(source->auditCounter), buffer, size)); - result = (UINT16)(result + TPM_ALG_ID_Marshal((TPM_ALG_ID *)&(source->digestAlg), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->auditDigest), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->commandDigest), buffer, size)); - return result; -} - -// Table 2:122 - Definition of TPMS_SESSION_AUDIT_INFO Structure -UINT16 -TPMS_SESSION_AUDIT_INFO_Marshal(TPMS_SESSION_AUDIT_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_YES_NO_Marshal((TPMI_YES_NO *)&(source->exclusiveSession), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->sessionDigest), buffer, size)); - return result; -} - -// Table 2:123 - Definition of TPMS_CREATION_INFO Structure -UINT16 -TPMS_CREATION_INFO_Marshal(TPMS_CREATION_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->objectName), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->creationHash), buffer, size)); - return result; -} - -// Table 2:124 - Definition of TPMS_NV_CERTIFY_INFO Structure -UINT16 -TPMS_NV_CERTIFY_INFO_Marshal(TPMS_NV_CERTIFY_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->indexName), buffer, size)); - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->offset), buffer, size)); - result = (UINT16)(result + TPM2B_MAX_NV_BUFFER_Marshal((TPM2B_MAX_NV_BUFFER *)&(source->nvContents), buffer, size)); - return result; -} - -// Table 2:125 - Definition of TPMS_NV_DIGEST_CERTIFY_INFO Structure -UINT16 -TPMS_NV_DIGEST_CERTIFY_INFO_Marshal(TPMS_NV_DIGEST_CERTIFY_INFO *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->indexName), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->nvDigest), buffer, size)); - return result; -} - -// Table 2:126 - Definition of TPMI_ST_ATTEST Type -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ST_ATTEST_Marshal(TPMI_ST_ATTEST *source, BYTE **buffer, INT32 *size) -{ - return TPM_ST_Marshal((TPM_ST *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:127 - Definition of TPMU_ATTEST Union -UINT16 -TPMU_ATTEST_Marshal(TPMU_ATTEST *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { - case TPM_ST_ATTEST_CERTIFY: - return TPMS_CERTIFY_INFO_Marshal((TPMS_CERTIFY_INFO *)&(source->certify), buffer, size); - case TPM_ST_ATTEST_CREATION: - return TPMS_CREATION_INFO_Marshal((TPMS_CREATION_INFO *)&(source->creation), buffer, size); - case TPM_ST_ATTEST_QUOTE: - return TPMS_QUOTE_INFO_Marshal((TPMS_QUOTE_INFO *)&(source->quote), buffer, size); - case TPM_ST_ATTEST_COMMAND_AUDIT: - return TPMS_COMMAND_AUDIT_INFO_Marshal((TPMS_COMMAND_AUDIT_INFO *)&(source->commandAudit), buffer, size); - case TPM_ST_ATTEST_SESSION_AUDIT: - return TPMS_SESSION_AUDIT_INFO_Marshal((TPMS_SESSION_AUDIT_INFO *)&(source->sessionAudit), buffer, size); - case TPM_ST_ATTEST_TIME: - return TPMS_TIME_ATTEST_INFO_Marshal((TPMS_TIME_ATTEST_INFO *)&(source->time), buffer, size); - case TPM_ST_ATTEST_NV: - return TPMS_NV_CERTIFY_INFO_Marshal((TPMS_NV_CERTIFY_INFO *)&(source->nv), buffer, size); - case TPM_ST_ATTEST_NV_DIGEST: - return TPMS_NV_DIGEST_CERTIFY_INFO_Marshal((TPMS_NV_DIGEST_CERTIFY_INFO *)&(source->nvDigest), buffer, size); - } - return 0; -} - -// Table 2:128 - Definition of TPMS_ATTEST Structure -UINT16 -TPMS_ATTEST_Marshal(TPMS_ATTEST *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_GENERATED_Marshal((TPM_GENERATED *)&(source->magic), buffer, size)); - result = (UINT16)(result + TPMI_ST_ATTEST_Marshal((TPMI_ST_ATTEST *)&(source->type), buffer, size)); - result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->qualifiedSigner), buffer, size)); - result = (UINT16)(result + TPM2B_DATA_Marshal((TPM2B_DATA *)&(source->extraData), buffer, size)); - result = (UINT16)(result + TPMS_CLOCK_INFO_Marshal((TPMS_CLOCK_INFO *)&(source->clockInfo), buffer, size)); - result = (UINT16)(result + UINT64_Marshal((UINT64 *)&(source->firmwareVersion), buffer, size)); - result = (UINT16)(result + TPMU_ATTEST_Marshal((TPMU_ATTEST *)&(source->attested), buffer, size, (UINT32)source->type)); - return result; -} - -// Table 2:129 - Definition of TPM2B_ATTEST Structure -UINT16 -TPM2B_ATTEST_Marshal(TPM2B_ATTEST *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.attestationData), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:130 - Definition of TPMS_AUTH_COMMAND Structure -TPM_RC -TPMS_AUTH_COMMAND_Unmarshal(TPMS_AUTH_COMMAND *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_SH_AUTH_SESSION_Unmarshal((TPMI_SH_AUTH_SESSION *)&(target->sessionHandle), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPM2B_NONCE_Unmarshal((TPM2B_NONCE *)&(target->nonce), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMA_SESSION_Unmarshal((TPMA_SESSION *)&(target->sessionAttributes), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_AUTH_Unmarshal((TPM2B_AUTH *)&(target->hmac), buffer, size); - return result; -} - -// Table 2:131 - Definition of TPMS_AUTH_RESPONSE Structure -UINT16 -TPMS_AUTH_RESPONSE_Marshal(TPMS_AUTH_RESPONSE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM2B_NONCE_Marshal((TPM2B_NONCE *)&(source->nonce), buffer, size)); - result = (UINT16)(result + TPMA_SESSION_Marshal((TPMA_SESSION *)&(source->sessionAttributes), buffer, size)); - result = (UINT16)(result + TPM2B_AUTH_Marshal((TPM2B_AUTH *)&(source->hmac), buffer, size)); - return result; -} - -// Table 2:132 - Definition of TPMI_TDES_KEY_BITS Type -#if ALG_TDES -TPM_RC -TPMI_TDES_KEY_BITS_Unmarshal(TPMI_TDES_KEY_BITS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if TDES_128 - case 128: -#endif // TDES_128 -#if TDES_192 - case 192: -#endif // TDES_192 - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_TDES_KEY_BITS_Marshal(TPMI_TDES_KEY_BITS *source, BYTE **buffer, INT32 *size) -{ - return TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_TDES - -// Table 2:132 - Definition of TPMI_AES_KEY_BITS Type -#if ALG_AES -TPM_RC -TPMI_AES_KEY_BITS_Unmarshal(TPMI_AES_KEY_BITS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if AES_128 - case 128: -#endif // AES_128 -#if AES_192 - case 192: -#endif // AES_192 -#if AES_256 - case 256: -#endif // AES_256 - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_AES_KEY_BITS_Marshal(TPMI_AES_KEY_BITS *source, BYTE **buffer, INT32 *size) -{ - return TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_AES - -// Table 2:132 - Definition of TPMI_SM4_KEY_BITS Type -#if ALG_SM4 -TPM_RC -TPMI_SM4_KEY_BITS_Unmarshal(TPMI_SM4_KEY_BITS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if SM4_128 - case 128: -#endif // SM4_128 - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_SM4_KEY_BITS_Marshal(TPMI_SM4_KEY_BITS *source, BYTE **buffer, INT32 *size) -{ - return TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_SM4 - -// Table 2:132 - Definition of TPMI_CAMELLIA_KEY_BITS Type -#if ALG_CAMELLIA -TPM_RC -TPMI_CAMELLIA_KEY_BITS_Unmarshal(TPMI_CAMELLIA_KEY_BITS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if CAMELLIA_128 - case 128: -#endif // CAMELLIA_128 -#if CAMELLIA_192 - case 192: -#endif // CAMELLIA_192 -#if CAMELLIA_256 - case 256: -#endif // CAMELLIA_256 - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_CAMELLIA_KEY_BITS_Marshal(TPMI_CAMELLIA_KEY_BITS *source, BYTE **buffer, INT32 *size) -{ - return TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_CAMELLIA - -// Table 2:133 - Definition of TPMU_SYM_KEY_BITS Union -TPM_RC -TPMU_SYM_KEY_BITS_Unmarshal(TPMU_SYM_KEY_BITS *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_TDES - case ALG_TDES_VALUE: - return TPMI_TDES_KEY_BITS_Unmarshal((TPMI_TDES_KEY_BITS *)&(target->tdes), buffer, size); -#endif // ALG_TDES -#if ALG_AES - case ALG_AES_VALUE: - return TPMI_AES_KEY_BITS_Unmarshal((TPMI_AES_KEY_BITS *)&(target->aes), buffer, size); -#endif // ALG_AES -#if ALG_SM4 - case ALG_SM4_VALUE: - return TPMI_SM4_KEY_BITS_Unmarshal((TPMI_SM4_KEY_BITS *)&(target->sm4), buffer, size); -#endif // ALG_SM4 -#if ALG_CAMELLIA - case ALG_CAMELLIA_VALUE: - return TPMI_CAMELLIA_KEY_BITS_Unmarshal((TPMI_CAMELLIA_KEY_BITS *)&(target->camellia), buffer, size); -#endif // ALG_CAMELLIA -#if ALG_XOR - case ALG_XOR_VALUE: - return TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->xor), buffer, size, 0); -#endif // ALG_XOR - case ALG_NULL_VALUE: - return TPM_RC_SUCCESS; - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_SYM_KEY_BITS_Marshal(TPMU_SYM_KEY_BITS *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_TDES - case ALG_TDES_VALUE: - return TPMI_TDES_KEY_BITS_Marshal((TPMI_TDES_KEY_BITS *)&(source->tdes), buffer, size); -#endif // ALG_TDES -#if ALG_AES - case ALG_AES_VALUE: - return TPMI_AES_KEY_BITS_Marshal((TPMI_AES_KEY_BITS *)&(source->aes), buffer, size); -#endif // ALG_AES -#if ALG_SM4 - case ALG_SM4_VALUE: - return TPMI_SM4_KEY_BITS_Marshal((TPMI_SM4_KEY_BITS *)&(source->sm4), buffer, size); -#endif // ALG_SM4 -#if ALG_CAMELLIA - case ALG_CAMELLIA_VALUE: - return TPMI_CAMELLIA_KEY_BITS_Marshal((TPMI_CAMELLIA_KEY_BITS *)&(source->camellia), buffer, size); -#endif // ALG_CAMELLIA -#if ALG_XOR - case ALG_XOR_VALUE: - return TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->xor), buffer, size); -#endif // ALG_XOR - case ALG_NULL_VALUE: - return 0; - } - return 0; -} - -// Table 2:134 - Definition of TPMU_SYM_MODE Union -TPM_RC -TPMU_SYM_MODE_Unmarshal(TPMU_SYM_MODE *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_TDES - case ALG_TDES_VALUE: - return TPMI_ALG_SYM_MODE_Unmarshal((TPMI_ALG_SYM_MODE *)&(target->tdes), buffer, size, 1); -#endif // ALG_TDES -#if ALG_AES - case ALG_AES_VALUE: - return TPMI_ALG_SYM_MODE_Unmarshal((TPMI_ALG_SYM_MODE *)&(target->aes), buffer, size, 1); -#endif // ALG_AES -#if ALG_SM4 - case ALG_SM4_VALUE: - return TPMI_ALG_SYM_MODE_Unmarshal((TPMI_ALG_SYM_MODE *)&(target->sm4), buffer, size, 1); -#endif // ALG_SM4 -#if ALG_CAMELLIA - case ALG_CAMELLIA_VALUE: - return TPMI_ALG_SYM_MODE_Unmarshal((TPMI_ALG_SYM_MODE *)&(target->camellia), buffer, size, 1); -#endif // ALG_CAMELLIA -#if ALG_XOR - case ALG_XOR_VALUE: - return TPM_RC_SUCCESS; -#endif // ALG_XOR - case ALG_NULL_VALUE: - return TPM_RC_SUCCESS; - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_SYM_MODE_Marshal(TPMU_SYM_MODE *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_TDES - case ALG_TDES_VALUE: - return TPMI_ALG_SYM_MODE_Marshal((TPMI_ALG_SYM_MODE *)&(source->tdes), buffer, size); -#endif // ALG_TDES -#if ALG_AES - case ALG_AES_VALUE: - return TPMI_ALG_SYM_MODE_Marshal((TPMI_ALG_SYM_MODE *)&(source->aes), buffer, size); -#endif // ALG_AES -#if ALG_SM4 - case ALG_SM4_VALUE: - return TPMI_ALG_SYM_MODE_Marshal((TPMI_ALG_SYM_MODE *)&(source->sm4), buffer, size); -#endif // ALG_SM4 -#if ALG_CAMELLIA - case ALG_CAMELLIA_VALUE: - return TPMI_ALG_SYM_MODE_Marshal((TPMI_ALG_SYM_MODE *)&(source->camellia), buffer, size); -#endif // ALG_CAMELLIA -#if ALG_XOR - case ALG_XOR_VALUE: - return 0; -#endif // ALG_XOR - case ALG_NULL_VALUE: - return 0; - } - return 0; -} - -// Table 2:136 - Definition of TPMT_SYM_DEF Structure -TPM_RC -TPMT_SYM_DEF_Unmarshal(TPMT_SYM_DEF *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_SYM_Unmarshal((TPMI_ALG_SYM *)&(target->algorithm), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_SYM_KEY_BITS_Unmarshal((TPMU_SYM_KEY_BITS *)&(target->keyBits), buffer, size, (UINT32)target->algorithm); - if(result == TPM_RC_SUCCESS) - result = TPMU_SYM_MODE_Unmarshal((TPMU_SYM_MODE *)&(target->mode), buffer, size, (UINT32)target->algorithm); - return result; -} -UINT16 -TPMT_SYM_DEF_Marshal(TPMT_SYM_DEF *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_SYM_Marshal((TPMI_ALG_SYM *)&(source->algorithm), buffer, size)); - result = (UINT16)(result + TPMU_SYM_KEY_BITS_Marshal((TPMU_SYM_KEY_BITS *)&(source->keyBits), buffer, size, (UINT32)source->algorithm)); - result = (UINT16)(result + TPMU_SYM_MODE_Marshal((TPMU_SYM_MODE *)&(source->mode), buffer, size, (UINT32)source->algorithm)); - return result; -} - -// Table 2:137 - Definition of TPMT_SYM_DEF_OBJECT Structure -TPM_RC -TPMT_SYM_DEF_OBJECT_Unmarshal(TPMT_SYM_DEF_OBJECT *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_SYM_OBJECT_Unmarshal((TPMI_ALG_SYM_OBJECT *)&(target->algorithm), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_SYM_KEY_BITS_Unmarshal((TPMU_SYM_KEY_BITS *)&(target->keyBits), buffer, size, (UINT32)target->algorithm); - if(result == TPM_RC_SUCCESS) - result = TPMU_SYM_MODE_Unmarshal((TPMU_SYM_MODE *)&(target->mode), buffer, size, (UINT32)target->algorithm); - return result; -} -UINT16 -TPMT_SYM_DEF_OBJECT_Marshal(TPMT_SYM_DEF_OBJECT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_SYM_OBJECT_Marshal((TPMI_ALG_SYM_OBJECT *)&(source->algorithm), buffer, size)); - result = (UINT16)(result + TPMU_SYM_KEY_BITS_Marshal((TPMU_SYM_KEY_BITS *)&(source->keyBits), buffer, size, (UINT32)source->algorithm)); - result = (UINT16)(result + TPMU_SYM_MODE_Marshal((TPMU_SYM_MODE *)&(source->mode), buffer, size, (UINT32)source->algorithm)); - return result; -} - -// Table 2:138 - Definition of TPM2B_SYM_KEY Structure -TPM_RC -TPM2B_SYM_KEY_Unmarshal(TPM2B_SYM_KEY *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > MAX_SYM_KEY_BYTES) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_SYM_KEY_Marshal(TPM2B_SYM_KEY *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:139 - Definition of TPMS_SYMCIPHER_PARMS Structure -TPM_RC -TPMS_SYMCIPHER_PARMS_Unmarshal(TPMS_SYMCIPHER_PARMS *target, BYTE **buffer, INT32 *size) -{ - return TPMT_SYM_DEF_OBJECT_Unmarshal((TPMT_SYM_DEF_OBJECT *)&(target->sym), buffer, size, 0); -} -UINT16 -TPMS_SYMCIPHER_PARMS_Marshal(TPMS_SYMCIPHER_PARMS *source, BYTE **buffer, INT32 *size) -{ - return TPMT_SYM_DEF_OBJECT_Marshal((TPMT_SYM_DEF_OBJECT *)&(source->sym), buffer, size); -} - -// Table 2:140 - Definition of TPM2B_LABEL Structure -TPM_RC -TPM2B_LABEL_Unmarshal(TPM2B_LABEL *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > LABEL_MAX_BUFFER) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_LABEL_Marshal(TPM2B_LABEL *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:141 - Definition of TPMS_DERIVE Structure -TPM_RC -TPMS_DERIVE_Unmarshal(TPMS_DERIVE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM2B_LABEL_Unmarshal((TPM2B_LABEL *)&(target->label), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_LABEL_Unmarshal((TPM2B_LABEL *)&(target->context), buffer, size); - return result; -} -UINT16 -TPMS_DERIVE_Marshal(TPMS_DERIVE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM2B_LABEL_Marshal((TPM2B_LABEL *)&(source->label), buffer, size)); - result = (UINT16)(result + TPM2B_LABEL_Marshal((TPM2B_LABEL *)&(source->context), buffer, size)); - return result; -} - -// Table 2:142 - Definition of TPM2B_DERIVE Structure -TPM_RC -TPM2B_DERIVE_Unmarshal(TPM2B_DERIVE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMS_DERIVE)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_DERIVE_Marshal(TPM2B_DERIVE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:143 - Definition of TPMU_SENSITIVE_CREATE Union -// Table 2:144 - Definition of TPM2B_SENSITIVE_DATA Structure -TPM_RC -TPM2B_SENSITIVE_DATA_Unmarshal(TPM2B_SENSITIVE_DATA *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMU_SENSITIVE_CREATE)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_SENSITIVE_DATA_Marshal(TPM2B_SENSITIVE_DATA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:145 - Definition of TPMS_SENSITIVE_CREATE Structure -TPM_RC -TPMS_SENSITIVE_CREATE_Unmarshal(TPMS_SENSITIVE_CREATE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM2B_AUTH_Unmarshal((TPM2B_AUTH *)&(target->userAuth), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_SENSITIVE_DATA_Unmarshal((TPM2B_SENSITIVE_DATA *)&(target->data), buffer, size); - return result; -} - -// Table 2:146 - Definition of TPM2B_SENSITIVE_CREATE Structure -TPM_RC -TPM2B_SENSITIVE_CREATE_Unmarshal(TPM2B_SENSITIVE_CREATE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size); // =a - if(result == TPM_RC_SUCCESS) - { - // if size is zero, then the required structure is missing - if(target->size == 0) - result = TPM_RC_SIZE; - else - { - INT32 startSize = *size; - result = TPMS_SENSITIVE_CREATE_Unmarshal((TPMS_SENSITIVE_CREATE *)&(target->sensitive), buffer, size); // =b - if(result == TPM_RC_SUCCESS) - { - if(target->size != (startSize - *size)) - result = TPM_RC_SIZE; - } - } - } - return result; -} - -// Table 2:147 - Definition of TPMS_SCHEME_HASH Structure -TPM_RC -TPMS_SCHEME_HASH_Unmarshal(TPMS_SCHEME_HASH *target, BYTE **buffer, INT32 *size) -{ - return TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hashAlg), buffer, size, 0); -} -UINT16 -TPMS_SCHEME_HASH_Marshal(TPMS_SCHEME_HASH *source, BYTE **buffer, INT32 *size) -{ - return TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->hashAlg), buffer, size); -} - -// Table 2:148 - Definition of TPMS_SCHEME_ECDAA Structure -#if ALG_ECC -TPM_RC -TPMS_SCHEME_ECDAA_Unmarshal(TPMS_SCHEME_ECDAA *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hashAlg), buffer, size, 0); - if(result == TPM_RC_SUCCESS) - result = UINT16_Unmarshal((UINT16 *)&(target->count), buffer, size); - return result; -} -UINT16 -TPMS_SCHEME_ECDAA_Marshal(TPMS_SCHEME_ECDAA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->hashAlg), buffer, size)); - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->count), buffer, size)); - return result; -} -#endif // ALG_ECC - -// Table 2:149 - Definition of TPMI_ALG_KEYEDHASH_SCHEME Type -TPM_RC -TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_HMAC - case ALG_HMAC_VALUE: -#endif // ALG_HMAC -#if ALG_XOR - case ALG_XOR_VALUE: -#endif // ALG_XOR - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_KEYEDHASH_SCHEME_Marshal(TPMI_ALG_KEYEDHASH_SCHEME *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:150 - Definition of Types for HMAC_SIG_SCHEME -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SCHEME_HMAC_Unmarshal(TPMS_SCHEME_HMAC *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SCHEME_HMAC_Marshal(TPMS_SCHEME_HMAC *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:151 - Definition of TPMS_SCHEME_XOR Structure -TPM_RC -TPMS_SCHEME_XOR_Unmarshal(TPMS_SCHEME_XOR *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hashAlg), buffer, size, 0); - if(result == TPM_RC_SUCCESS) - result = TPMI_ALG_KDF_Unmarshal((TPMI_ALG_KDF *)&(target->kdf), buffer, size, 1); - return result; -} -UINT16 -TPMS_SCHEME_XOR_Marshal(TPMS_SCHEME_XOR *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->hashAlg), buffer, size)); - result = (UINT16)(result + TPMI_ALG_KDF_Marshal((TPMI_ALG_KDF *)&(source->kdf), buffer, size)); - return result; -} - -// Table 2:152 - Definition of TPMU_SCHEME_KEYEDHASH Union -TPM_RC -TPMU_SCHEME_KEYEDHASH_Unmarshal(TPMU_SCHEME_KEYEDHASH *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_HMAC - case ALG_HMAC_VALUE: - return TPMS_SCHEME_HMAC_Unmarshal((TPMS_SCHEME_HMAC *)&(target->hmac), buffer, size); -#endif // ALG_HMAC -#if ALG_XOR - case ALG_XOR_VALUE: - return TPMS_SCHEME_XOR_Unmarshal((TPMS_SCHEME_XOR *)&(target->xor), buffer, size); -#endif // ALG_XOR - case ALG_NULL_VALUE: - return TPM_RC_SUCCESS; - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_SCHEME_KEYEDHASH_Marshal(TPMU_SCHEME_KEYEDHASH *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_HMAC - case ALG_HMAC_VALUE: - return TPMS_SCHEME_HMAC_Marshal((TPMS_SCHEME_HMAC *)&(source->hmac), buffer, size); -#endif // ALG_HMAC -#if ALG_XOR - case ALG_XOR_VALUE: - return TPMS_SCHEME_XOR_Marshal((TPMS_SCHEME_XOR *)&(source->xor), buffer, size); -#endif // ALG_XOR - case ALG_NULL_VALUE: - return 0; - } - return 0; -} - -// Table 2:153 - Definition of TPMT_KEYEDHASH_SCHEME Structure -TPM_RC -TPMT_KEYEDHASH_SCHEME_Unmarshal(TPMT_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal((TPMI_ALG_KEYEDHASH_SCHEME *)&(target->scheme), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_SCHEME_KEYEDHASH_Unmarshal((TPMU_SCHEME_KEYEDHASH *)&(target->details), buffer, size, (UINT32)target->scheme); - return result; -} -UINT16 -TPMT_KEYEDHASH_SCHEME_Marshal(TPMT_KEYEDHASH_SCHEME *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_KEYEDHASH_SCHEME_Marshal((TPMI_ALG_KEYEDHASH_SCHEME *)&(source->scheme), buffer, size)); - result = (UINT16)(result + TPMU_SCHEME_KEYEDHASH_Marshal((TPMU_SCHEME_KEYEDHASH *)&(source->details), buffer, size, (UINT32)source->scheme)); - return result; -} - -// Table 2:154 - Definition of Types for RSA Signature Schemes -#if ALG_RSA -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIG_SCHEME_RSASSA_Unmarshal(TPMS_SIG_SCHEME_RSASSA *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SIG_SCHEME_RSASSA_Marshal(TPMS_SIG_SCHEME_RSASSA *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_SIG_SCHEME_RSAPSS_Unmarshal(TPMS_SIG_SCHEME_RSAPSS *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SIG_SCHEME_RSAPSS_Marshal(TPMS_SIG_SCHEME_RSAPSS *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:155 - Definition of Types for ECC Signature Schemes -#if ALG_ECC -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIG_SCHEME_ECDSA_Unmarshal(TPMS_SIG_SCHEME_ECDSA *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SIG_SCHEME_ECDSA_Marshal(TPMS_SIG_SCHEME_ECDSA *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_SIG_SCHEME_SM2_Unmarshal(TPMS_SIG_SCHEME_SM2 *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SIG_SCHEME_SM2_Marshal(TPMS_SIG_SCHEME_SM2 *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal(TPMS_SIG_SCHEME_ECSCHNORR *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SIG_SCHEME_ECSCHNORR_Marshal(TPMS_SIG_SCHEME_ECSCHNORR *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_SIG_SCHEME_ECDAA_Unmarshal(TPMS_SIG_SCHEME_ECDAA *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_ECDAA_Unmarshal((TPMS_SCHEME_ECDAA *)target, buffer, size); -} -UINT16 -TPMS_SIG_SCHEME_ECDAA_Marshal(TPMS_SIG_SCHEME_ECDAA *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_ECDAA_Marshal((TPMS_SCHEME_ECDAA *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:156 - Definition of TPMU_SIG_SCHEME Union -TPM_RC -TPMU_SIG_SCHEME_Unmarshal(TPMU_SIG_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_ECDAA - case ALG_ECDAA_VALUE: - return TPMS_SIG_SCHEME_ECDAA_Unmarshal((TPMS_SIG_SCHEME_ECDAA *)&(target->ecdaa), buffer, size); -#endif // ALG_ECDAA -#if ALG_RSASSA - case ALG_RSASSA_VALUE: - return TPMS_SIG_SCHEME_RSASSA_Unmarshal((TPMS_SIG_SCHEME_RSASSA *)&(target->rsassa), buffer, size); -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: - return TPMS_SIG_SCHEME_RSAPSS_Unmarshal((TPMS_SIG_SCHEME_RSAPSS *)&(target->rsapss), buffer, size); -#endif // ALG_RSAPSS -#if ALG_ECDSA - case ALG_ECDSA_VALUE: - return TPMS_SIG_SCHEME_ECDSA_Unmarshal((TPMS_SIG_SCHEME_ECDSA *)&(target->ecdsa), buffer, size); -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: - return TPMS_SIG_SCHEME_SM2_Unmarshal((TPMS_SIG_SCHEME_SM2 *)&(target->sm2), buffer, size); -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: - return TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal((TPMS_SIG_SCHEME_ECSCHNORR *)&(target->ecschnorr), buffer, size); -#endif // ALG_ECSCHNORR -#if ALG_HMAC - case ALG_HMAC_VALUE: - return TPMS_SCHEME_HMAC_Unmarshal((TPMS_SCHEME_HMAC *)&(target->hmac), buffer, size); -#endif // ALG_HMAC - case ALG_NULL_VALUE: - return TPM_RC_SUCCESS; - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_SIG_SCHEME_Marshal(TPMU_SIG_SCHEME *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_ECDAA - case ALG_ECDAA_VALUE: - return TPMS_SIG_SCHEME_ECDAA_Marshal((TPMS_SIG_SCHEME_ECDAA *)&(source->ecdaa), buffer, size); -#endif // ALG_ECDAA -#if ALG_RSASSA - case ALG_RSASSA_VALUE: - return TPMS_SIG_SCHEME_RSASSA_Marshal((TPMS_SIG_SCHEME_RSASSA *)&(source->rsassa), buffer, size); -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: - return TPMS_SIG_SCHEME_RSAPSS_Marshal((TPMS_SIG_SCHEME_RSAPSS *)&(source->rsapss), buffer, size); -#endif // ALG_RSAPSS -#if ALG_ECDSA - case ALG_ECDSA_VALUE: - return TPMS_SIG_SCHEME_ECDSA_Marshal((TPMS_SIG_SCHEME_ECDSA *)&(source->ecdsa), buffer, size); -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: - return TPMS_SIG_SCHEME_SM2_Marshal((TPMS_SIG_SCHEME_SM2 *)&(source->sm2), buffer, size); -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: - return TPMS_SIG_SCHEME_ECSCHNORR_Marshal((TPMS_SIG_SCHEME_ECSCHNORR *)&(source->ecschnorr), buffer, size); -#endif // ALG_ECSCHNORR -#if ALG_HMAC - case ALG_HMAC_VALUE: - return TPMS_SCHEME_HMAC_Marshal((TPMS_SCHEME_HMAC *)&(source->hmac), buffer, size); -#endif // ALG_HMAC - case ALG_NULL_VALUE: - return 0; - } - return 0; -} - -// Table 2:157 - Definition of TPMT_SIG_SCHEME Structure -TPM_RC -TPMT_SIG_SCHEME_Unmarshal(TPMT_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_SIG_SCHEME_Unmarshal((TPMI_ALG_SIG_SCHEME *)&(target->scheme), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_SIG_SCHEME_Unmarshal((TPMU_SIG_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme); - return result; -} -UINT16 -TPMT_SIG_SCHEME_Marshal(TPMT_SIG_SCHEME *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_SIG_SCHEME_Marshal((TPMI_ALG_SIG_SCHEME *)&(source->scheme), buffer, size)); - result = (UINT16)(result + TPMU_SIG_SCHEME_Marshal((TPMU_SIG_SCHEME *)&(source->details), buffer, size, (UINT32)source->scheme)); - return result; -} - -// Table 2:158 - Definition of Types for Encryption Schemes -#if ALG_RSA -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_ENC_SCHEME_OAEP_Unmarshal(TPMS_ENC_SCHEME_OAEP *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_ENC_SCHEME_OAEP_Marshal(TPMS_ENC_SCHEME_OAEP *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_ENC_SCHEME_RSAES_Unmarshal(TPMS_ENC_SCHEME_RSAES *target, BYTE **buffer, INT32 *size) -{ - return TPMS_EMPTY_Unmarshal((TPMS_EMPTY *)target, buffer, size); -} -UINT16 -TPMS_ENC_SCHEME_RSAES_Marshal(TPMS_ENC_SCHEME_RSAES *source, BYTE **buffer, INT32 *size) -{ - return TPMS_EMPTY_Marshal((TPMS_EMPTY *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:159 - Definition of Types for ECC Key Exchange -#if ALG_ECC -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_KEY_SCHEME_ECDH_Unmarshal(TPMS_KEY_SCHEME_ECDH *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_KEY_SCHEME_ECDH_Marshal(TPMS_KEY_SCHEME_ECDH *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_KEY_SCHEME_ECMQV_Unmarshal(TPMS_KEY_SCHEME_ECMQV *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_KEY_SCHEME_ECMQV_Marshal(TPMS_KEY_SCHEME_ECMQV *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:160 - Definition of Types for KDF Schemes -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SCHEME_MGF1_Unmarshal(TPMS_SCHEME_MGF1 *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SCHEME_MGF1_Marshal(TPMS_SCHEME_MGF1 *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_SCHEME_KDF1_SP800_56A_Unmarshal(TPMS_SCHEME_KDF1_SP800_56A *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SCHEME_KDF1_SP800_56A_Marshal(TPMS_SCHEME_KDF1_SP800_56A *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_SCHEME_KDF2_Unmarshal(TPMS_SCHEME_KDF2 *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SCHEME_KDF2_Marshal(TPMS_SCHEME_KDF2 *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -TPM_RC -TPMS_SCHEME_KDF1_SP800_108_Unmarshal(TPMS_SCHEME_KDF1_SP800_108 *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Unmarshal((TPMS_SCHEME_HASH *)target, buffer, size); -} -UINT16 -TPMS_SCHEME_KDF1_SP800_108_Marshal(TPMS_SCHEME_KDF1_SP800_108 *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SCHEME_HASH_Marshal((TPMS_SCHEME_HASH *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:161 - Definition of TPMU_KDF_SCHEME Union -TPM_RC -TPMU_KDF_SCHEME_Unmarshal(TPMU_KDF_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_MGF1 - case ALG_MGF1_VALUE: - return TPMS_SCHEME_MGF1_Unmarshal((TPMS_SCHEME_MGF1 *)&(target->mgf1), buffer, size); -#endif // ALG_MGF1 -#if ALG_KDF1_SP800_56A - case ALG_KDF1_SP800_56A_VALUE: - return TPMS_SCHEME_KDF1_SP800_56A_Unmarshal((TPMS_SCHEME_KDF1_SP800_56A *)&(target->kdf1_sp800_56a), buffer, size); -#endif // ALG_KDF1_SP800_56A -#if ALG_KDF2 - case ALG_KDF2_VALUE: - return TPMS_SCHEME_KDF2_Unmarshal((TPMS_SCHEME_KDF2 *)&(target->kdf2), buffer, size); -#endif // ALG_KDF2 -#if ALG_KDF1_SP800_108 - case ALG_KDF1_SP800_108_VALUE: - return TPMS_SCHEME_KDF1_SP800_108_Unmarshal((TPMS_SCHEME_KDF1_SP800_108 *)&(target->kdf1_sp800_108), buffer, size); -#endif // ALG_KDF1_SP800_108 - case ALG_NULL_VALUE: - return TPM_RC_SUCCESS; - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_KDF_SCHEME_Marshal(TPMU_KDF_SCHEME *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_MGF1 - case ALG_MGF1_VALUE: - return TPMS_SCHEME_MGF1_Marshal((TPMS_SCHEME_MGF1 *)&(source->mgf1), buffer, size); -#endif // ALG_MGF1 -#if ALG_KDF1_SP800_56A - case ALG_KDF1_SP800_56A_VALUE: - return TPMS_SCHEME_KDF1_SP800_56A_Marshal((TPMS_SCHEME_KDF1_SP800_56A *)&(source->kdf1_sp800_56a), buffer, size); -#endif // ALG_KDF1_SP800_56A -#if ALG_KDF2 - case ALG_KDF2_VALUE: - return TPMS_SCHEME_KDF2_Marshal((TPMS_SCHEME_KDF2 *)&(source->kdf2), buffer, size); -#endif // ALG_KDF2 -#if ALG_KDF1_SP800_108 - case ALG_KDF1_SP800_108_VALUE: - return TPMS_SCHEME_KDF1_SP800_108_Marshal((TPMS_SCHEME_KDF1_SP800_108 *)&(source->kdf1_sp800_108), buffer, size); -#endif // ALG_KDF1_SP800_108 - case ALG_NULL_VALUE: - return 0; - } - return 0; -} - -// Table 2:162 - Definition of TPMT_KDF_SCHEME Structure -TPM_RC -TPMT_KDF_SCHEME_Unmarshal(TPMT_KDF_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_KDF_Unmarshal((TPMI_ALG_KDF *)&(target->scheme), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_KDF_SCHEME_Unmarshal((TPMU_KDF_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme); - return result; -} -UINT16 -TPMT_KDF_SCHEME_Marshal(TPMT_KDF_SCHEME *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_KDF_Marshal((TPMI_ALG_KDF *)&(source->scheme), buffer, size)); - result = (UINT16)(result + TPMU_KDF_SCHEME_Marshal((TPMU_KDF_SCHEME *)&(source->details), buffer, size, (UINT32)source->scheme)); - return result; -} - -// Table 2:163 - Definition of TPMI_ALG_ASYM_SCHEME Type -TPM_RC -TPMI_ALG_ASYM_SCHEME_Unmarshal(TPMI_ALG_ASYM_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_ECDH - case ALG_ECDH_VALUE: -#endif // ALG_ECDH -#if ALG_ECMQV - case ALG_ECMQV_VALUE: -#endif // ALG_ECMQV -#if ALG_ECDAA - case ALG_ECDAA_VALUE: -#endif // ALG_ECDAA -#if ALG_RSASSA - case ALG_RSASSA_VALUE: -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: -#endif // ALG_RSAPSS -#if ALG_ECDSA - case ALG_ECDSA_VALUE: -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: -#endif // ALG_ECSCHNORR -#if ALG_RSAES - case ALG_RSAES_VALUE: -#endif // ALG_RSAES -#if ALG_OAEP - case ALG_OAEP_VALUE: -#endif // ALG_OAEP - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_ASYM_SCHEME_Marshal(TPMI_ALG_ASYM_SCHEME *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:164 - Definition of TPMU_ASYM_SCHEME Union -TPM_RC -TPMU_ASYM_SCHEME_Unmarshal(TPMU_ASYM_SCHEME *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_ECDH - case ALG_ECDH_VALUE: - return TPMS_KEY_SCHEME_ECDH_Unmarshal((TPMS_KEY_SCHEME_ECDH *)&(target->ecdh), buffer, size); -#endif // ALG_ECDH -#if ALG_ECMQV - case ALG_ECMQV_VALUE: - return TPMS_KEY_SCHEME_ECMQV_Unmarshal((TPMS_KEY_SCHEME_ECMQV *)&(target->ecmqv), buffer, size); -#endif // ALG_ECMQV -#if ALG_ECDAA - case ALG_ECDAA_VALUE: - return TPMS_SIG_SCHEME_ECDAA_Unmarshal((TPMS_SIG_SCHEME_ECDAA *)&(target->ecdaa), buffer, size); -#endif // ALG_ECDAA -#if ALG_RSASSA - case ALG_RSASSA_VALUE: - return TPMS_SIG_SCHEME_RSASSA_Unmarshal((TPMS_SIG_SCHEME_RSASSA *)&(target->rsassa), buffer, size); -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: - return TPMS_SIG_SCHEME_RSAPSS_Unmarshal((TPMS_SIG_SCHEME_RSAPSS *)&(target->rsapss), buffer, size); -#endif // ALG_RSAPSS -#if ALG_ECDSA - case ALG_ECDSA_VALUE: - return TPMS_SIG_SCHEME_ECDSA_Unmarshal((TPMS_SIG_SCHEME_ECDSA *)&(target->ecdsa), buffer, size); -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: - return TPMS_SIG_SCHEME_SM2_Unmarshal((TPMS_SIG_SCHEME_SM2 *)&(target->sm2), buffer, size); -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: - return TPMS_SIG_SCHEME_ECSCHNORR_Unmarshal((TPMS_SIG_SCHEME_ECSCHNORR *)&(target->ecschnorr), buffer, size); -#endif // ALG_ECSCHNORR -#if ALG_RSAES - case ALG_RSAES_VALUE: - return TPMS_ENC_SCHEME_RSAES_Unmarshal((TPMS_ENC_SCHEME_RSAES *)&(target->rsaes), buffer, size); -#endif // ALG_RSAES -#if ALG_OAEP - case ALG_OAEP_VALUE: - return TPMS_ENC_SCHEME_OAEP_Unmarshal((TPMS_ENC_SCHEME_OAEP *)&(target->oaep), buffer, size); -#endif // ALG_OAEP - case ALG_NULL_VALUE: - return TPM_RC_SUCCESS; - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_ASYM_SCHEME_Marshal(TPMU_ASYM_SCHEME *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_ECDH - case ALG_ECDH_VALUE: - return TPMS_KEY_SCHEME_ECDH_Marshal((TPMS_KEY_SCHEME_ECDH *)&(source->ecdh), buffer, size); -#endif // ALG_ECDH -#if ALG_ECMQV - case ALG_ECMQV_VALUE: - return TPMS_KEY_SCHEME_ECMQV_Marshal((TPMS_KEY_SCHEME_ECMQV *)&(source->ecmqv), buffer, size); -#endif // ALG_ECMQV -#if ALG_ECDAA - case ALG_ECDAA_VALUE: - return TPMS_SIG_SCHEME_ECDAA_Marshal((TPMS_SIG_SCHEME_ECDAA *)&(source->ecdaa), buffer, size); -#endif // ALG_ECDAA -#if ALG_RSASSA - case ALG_RSASSA_VALUE: - return TPMS_SIG_SCHEME_RSASSA_Marshal((TPMS_SIG_SCHEME_RSASSA *)&(source->rsassa), buffer, size); -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: - return TPMS_SIG_SCHEME_RSAPSS_Marshal((TPMS_SIG_SCHEME_RSAPSS *)&(source->rsapss), buffer, size); -#endif // ALG_RSAPSS -#if ALG_ECDSA - case ALG_ECDSA_VALUE: - return TPMS_SIG_SCHEME_ECDSA_Marshal((TPMS_SIG_SCHEME_ECDSA *)&(source->ecdsa), buffer, size); -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: - return TPMS_SIG_SCHEME_SM2_Marshal((TPMS_SIG_SCHEME_SM2 *)&(source->sm2), buffer, size); -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: - return TPMS_SIG_SCHEME_ECSCHNORR_Marshal((TPMS_SIG_SCHEME_ECSCHNORR *)&(source->ecschnorr), buffer, size); -#endif // ALG_ECSCHNORR -#if ALG_RSAES - case ALG_RSAES_VALUE: - return TPMS_ENC_SCHEME_RSAES_Marshal((TPMS_ENC_SCHEME_RSAES *)&(source->rsaes), buffer, size); -#endif // ALG_RSAES -#if ALG_OAEP - case ALG_OAEP_VALUE: - return TPMS_ENC_SCHEME_OAEP_Marshal((TPMS_ENC_SCHEME_OAEP *)&(source->oaep), buffer, size); -#endif // ALG_OAEP - case ALG_NULL_VALUE: - return 0; - } - return 0; -} - -// Table 2:165 - Definition of TPMT_ASYM_SCHEME Structure -// Table 2:166 - Definition of TPMI_ALG_RSA_SCHEME Type -#if ALG_RSA -TPM_RC -TPMI_ALG_RSA_SCHEME_Unmarshal(TPMI_ALG_RSA_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_RSAES - case ALG_RSAES_VALUE: -#endif // ALG_RSAES -#if ALG_OAEP - case ALG_OAEP_VALUE: -#endif // ALG_OAEP -#if ALG_RSASSA - case ALG_RSASSA_VALUE: -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: -#endif // ALG_RSAPSS - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_RSA_SCHEME_Marshal(TPMI_ALG_RSA_SCHEME *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:167 - Definition of TPMT_RSA_SCHEME Structure -#if ALG_RSA -TPM_RC -TPMT_RSA_SCHEME_Unmarshal(TPMT_RSA_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_RSA_SCHEME_Unmarshal((TPMI_ALG_RSA_SCHEME *)&(target->scheme), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_ASYM_SCHEME_Unmarshal((TPMU_ASYM_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme); - return result; -} -UINT16 -TPMT_RSA_SCHEME_Marshal(TPMT_RSA_SCHEME *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_RSA_SCHEME_Marshal((TPMI_ALG_RSA_SCHEME *)&(source->scheme), buffer, size)); - result = (UINT16)(result + TPMU_ASYM_SCHEME_Marshal((TPMU_ASYM_SCHEME *)&(source->details), buffer, size, (UINT32)source->scheme)); - return result; -} -#endif // ALG_RSA - -// Table 2:168 - Definition of TPMI_ALG_RSA_DECRYPT Type -#if ALG_RSA -TPM_RC -TPMI_ALG_RSA_DECRYPT_Unmarshal(TPMI_ALG_RSA_DECRYPT *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_RSAES - case ALG_RSAES_VALUE: -#endif // ALG_RSAES -#if ALG_OAEP - case ALG_OAEP_VALUE: -#endif // ALG_OAEP - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_VALUE; - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_RSA_DECRYPT_Marshal(TPMI_ALG_RSA_DECRYPT *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:169 - Definition of TPMT_RSA_DECRYPT Structure -#if ALG_RSA -TPM_RC -TPMT_RSA_DECRYPT_Unmarshal(TPMT_RSA_DECRYPT *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_RSA_DECRYPT_Unmarshal((TPMI_ALG_RSA_DECRYPT *)&(target->scheme), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_ASYM_SCHEME_Unmarshal((TPMU_ASYM_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme); - return result; -} -UINT16 -TPMT_RSA_DECRYPT_Marshal(TPMT_RSA_DECRYPT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_RSA_DECRYPT_Marshal((TPMI_ALG_RSA_DECRYPT *)&(source->scheme), buffer, size)); - result = (UINT16)(result + TPMU_ASYM_SCHEME_Marshal((TPMU_ASYM_SCHEME *)&(source->details), buffer, size, (UINT32)source->scheme)); - return result; -} -#endif // ALG_RSA - -// Table 2:170 - Definition of TPM2B_PUBLIC_KEY_RSA Structure -#if ALG_RSA -TPM_RC -TPM2B_PUBLIC_KEY_RSA_Unmarshal(TPM2B_PUBLIC_KEY_RSA *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > MAX_RSA_KEY_BYTES) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_PUBLIC_KEY_RSA_Marshal(TPM2B_PUBLIC_KEY_RSA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} -#endif // ALG_RSA - -// Table 2:171 - Definition of TPMI_RSA_KEY_BITS Type -#if ALG_RSA -TPM_RC -TPMI_RSA_KEY_BITS_Unmarshal(TPMI_RSA_KEY_BITS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_KEY_BITS_Unmarshal((TPM_KEY_BITS *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if RSA_1024 - case 1024: -#endif // RSA_1024 -#if RSA_2048 - case 2048: -#endif // RSA_2048 -#if RSA_3072 - case 3072: -#endif // RSA_3072 -#if RSA_4096 - case 4096: -#endif // RSA_4096 - break; - default: - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_RSA_KEY_BITS_Marshal(TPMI_RSA_KEY_BITS *source, BYTE **buffer, INT32 *size) -{ - return TPM_KEY_BITS_Marshal((TPM_KEY_BITS *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:172 - Definition of TPM2B_PRIVATE_KEY_RSA Structure -#if ALG_RSA -TPM_RC -TPM2B_PRIVATE_KEY_RSA_Unmarshal(TPM2B_PRIVATE_KEY_RSA *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > RSA_PRIVATE_SIZE) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_PRIVATE_KEY_RSA_Marshal(TPM2B_PRIVATE_KEY_RSA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} -#endif // ALG_RSA - -// Table 2:173 - Definition of TPM2B_ECC_PARAMETER Structure -TPM_RC -TPM2B_ECC_PARAMETER_Unmarshal(TPM2B_ECC_PARAMETER *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > MAX_ECC_KEY_BYTES) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_ECC_PARAMETER_Marshal(TPM2B_ECC_PARAMETER *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:174 - Definition of TPMS_ECC_POINT Structure -#if ALG_ECC -TPM_RC -TPMS_ECC_POINT_Unmarshal(TPMS_ECC_POINT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->x), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->y), buffer, size); - return result; -} -UINT16 -TPMS_ECC_POINT_Marshal(TPMS_ECC_POINT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->x), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->y), buffer, size)); - return result; -} -#endif // ALG_ECC - -// Table 2:175 - Definition of TPM2B_ECC_POINT Structure -#if ALG_ECC -TPM_RC -TPM2B_ECC_POINT_Unmarshal(TPM2B_ECC_POINT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size); // =a - if(result == TPM_RC_SUCCESS) - { - // if size is zero, then the required structure is missing - if(target->size == 0) - result = TPM_RC_SIZE; - else - { - INT32 startSize = *size; - result = TPMS_ECC_POINT_Unmarshal((TPMS_ECC_POINT *)&(target->point), buffer, size); // =b - if(result == TPM_RC_SUCCESS) - { - if(target->size != (startSize - *size)) - result = TPM_RC_SIZE; - } - } - } - return result; -} -UINT16 -TPM2B_ECC_POINT_Marshal(TPM2B_ECC_POINT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - // Marshal a dummy value of the 2B size. This makes sure that 'buffer' - // and 'size' are advanced as necessary (i.e., if they are present) - result = UINT16_Marshal(&result, buffer, size); - // Marshal the structure - result = (UINT16)(result + TPMS_ECC_POINT_Marshal((TPMS_ECC_POINT *)&(source->point), buffer, size)); - // if a buffer was provided, go back and fill in the actual size - if(buffer != NULL) - UINT16_TO_BYTE_ARRAY((result - 2), (*buffer - result)); - return result; -} -#endif // ALG_ECC - -// Table 2:176 - Definition of TPMI_ALG_ECC_SCHEME Type -#if ALG_ECC -TPM_RC -TPMI_ALG_ECC_SCHEME_Unmarshal(TPMI_ALG_ECC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_ECDAA - case ALG_ECDAA_VALUE: -#endif // ALG_ECDAA -#if ALG_ECDSA - case ALG_ECDSA_VALUE: -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: -#endif // ALG_ECSCHNORR -#if ALG_ECDH - case ALG_ECDH_VALUE: -#endif // ALG_ECDH -#if ALG_ECMQV - case ALG_ECMQV_VALUE: -#endif // ALG_ECMQV - break; - case ALG_NULL_VALUE: - if(!flag) - result = TPM_RC_SCHEME; - break; - default: - result = TPM_RC_SCHEME; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_ECC_SCHEME_Marshal(TPMI_ALG_ECC_SCHEME *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:177 - Definition of TPMI_ECC_CURVE Type -#if ALG_ECC -TPM_RC -TPMI_ECC_CURVE_Unmarshal(TPMI_ECC_CURVE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_ECC_CURVE_Unmarshal((TPM_ECC_CURVE *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ECC_BN_P256 - case TPM_ECC_BN_P256: -#endif // ECC_BN_P256 -#if ECC_BN_P638 - case TPM_ECC_BN_P638: -#endif // ECC_BN_P638 -#if ECC_NIST_P192 - case TPM_ECC_NIST_P192: -#endif // ECC_NIST_P192 -#if ECC_NIST_P224 - case TPM_ECC_NIST_P224: -#endif // ECC_NIST_P224 -#if ECC_NIST_P256 - case TPM_ECC_NIST_P256: -#endif // ECC_NIST_P256 -#if ECC_NIST_P384 - case TPM_ECC_NIST_P384: -#endif // ECC_NIST_P384 -#if ECC_NIST_P521 - case TPM_ECC_NIST_P521: -#endif // ECC_NIST_P521 -#if ECC_SM2_P256 - case TPM_ECC_SM2_P256: -#endif // ECC_SM2_P256 - break; - default: - result = TPM_RC_CURVE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ECC_CURVE_Marshal(TPMI_ECC_CURVE *source, BYTE **buffer, INT32 *size) -{ - return TPM_ECC_CURVE_Marshal((TPM_ECC_CURVE *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:178 - Definition of TPMT_ECC_SCHEME Structure -#if ALG_ECC -TPM_RC -TPMT_ECC_SCHEME_Unmarshal(TPMT_ECC_SCHEME *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_ECC_SCHEME_Unmarshal((TPMI_ALG_ECC_SCHEME *)&(target->scheme), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_ASYM_SCHEME_Unmarshal((TPMU_ASYM_SCHEME *)&(target->details), buffer, size, (UINT32)target->scheme); - return result; -} -UINT16 -TPMT_ECC_SCHEME_Marshal(TPMT_ECC_SCHEME *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_ECC_SCHEME_Marshal((TPMI_ALG_ECC_SCHEME *)&(source->scheme), buffer, size)); - result = (UINT16)(result + TPMU_ASYM_SCHEME_Marshal((TPMU_ASYM_SCHEME *)&(source->details), buffer, size, (UINT32)source->scheme)); - return result; -} -#endif // ALG_ECC - -// Table 2:179 - Definition of TPMS_ALGORITHM_DETAIL_ECC Structure -#if ALG_ECC -UINT16 -TPMS_ALGORITHM_DETAIL_ECC_Marshal(TPMS_ALGORITHM_DETAIL_ECC *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_ECC_CURVE_Marshal((TPM_ECC_CURVE *)&(source->curveID), buffer, size)); - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->keySize), buffer, size)); - result = (UINT16)(result + TPMT_KDF_SCHEME_Marshal((TPMT_KDF_SCHEME *)&(source->kdf), buffer, size)); - result = (UINT16)(result + TPMT_ECC_SCHEME_Marshal((TPMT_ECC_SCHEME *)&(source->sign), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->p), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->a), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->b), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->gX), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->gY), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->n), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->h), buffer, size)); - return result; -} -#endif // ALG_ECC - -// Table 2:180 - Definition of TPMS_SIGNATURE_RSA Structure -#if ALG_RSA -TPM_RC -TPMS_SIGNATURE_RSA_Unmarshal(TPMS_SIGNATURE_RSA *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hash), buffer, size, 0); - if(result == TPM_RC_SUCCESS) - result = TPM2B_PUBLIC_KEY_RSA_Unmarshal((TPM2B_PUBLIC_KEY_RSA *)&(target->sig), buffer, size); - return result; -} -UINT16 -TPMS_SIGNATURE_RSA_Marshal(TPMS_SIGNATURE_RSA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->hash), buffer, size)); - result = (UINT16)(result + TPM2B_PUBLIC_KEY_RSA_Marshal((TPM2B_PUBLIC_KEY_RSA *)&(source->sig), buffer, size)); - return result; -} -#endif // ALG_RSA - -// Table 2:181 - Definition of Types for Signature -#if ALG_RSA -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIGNATURE_RSASSA_Unmarshal(TPMS_SIGNATURE_RSASSA *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_RSA_Unmarshal((TPMS_SIGNATURE_RSA *)target, buffer, size); -} -UINT16 -TPMS_SIGNATURE_RSASSA_Marshal(TPMS_SIGNATURE_RSASSA *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_RSA_Marshal((TPMS_SIGNATURE_RSA *)source, buffer, size); -} -TPM_RC -TPMS_SIGNATURE_RSAPSS_Unmarshal(TPMS_SIGNATURE_RSAPSS *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_RSA_Unmarshal((TPMS_SIGNATURE_RSA *)target, buffer, size); -} -UINT16 -TPMS_SIGNATURE_RSAPSS_Marshal(TPMS_SIGNATURE_RSAPSS *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_RSA_Marshal((TPMS_SIGNATURE_RSA *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_RSA - -// Table 2:182 - Definition of TPMS_SIGNATURE_ECC Structure -#if ALG_ECC -TPM_RC -TPMS_SIGNATURE_ECC_Unmarshal(TPMS_SIGNATURE_ECC *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->hash), buffer, size, 0); - if(result == TPM_RC_SUCCESS) - result = TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->signatureR), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->signatureS), buffer, size); - return result; -} -UINT16 -TPMS_SIGNATURE_ECC_Marshal(TPMS_SIGNATURE_ECC *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->hash), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->signatureR), buffer, size)); - result = (UINT16)(result + TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->signatureS), buffer, size)); - return result; -} -#endif // ALG_ECC - -// Table 2:183 - Definition of Types for TPMS_SIGNATURE_ECC -#if ALG_ECC -#if !USE_MARSHALING_DEFINES -TPM_RC -TPMS_SIGNATURE_ECDAA_Unmarshal(TPMS_SIGNATURE_ECDAA *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)target, buffer, size); -} -UINT16 -TPMS_SIGNATURE_ECDAA_Marshal(TPMS_SIGNATURE_ECDAA *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)source, buffer, size); -} -TPM_RC -TPMS_SIGNATURE_ECDSA_Unmarshal(TPMS_SIGNATURE_ECDSA *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)target, buffer, size); -} -UINT16 -TPMS_SIGNATURE_ECDSA_Marshal(TPMS_SIGNATURE_ECDSA *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)source, buffer, size); -} -TPM_RC -TPMS_SIGNATURE_SM2_Unmarshal(TPMS_SIGNATURE_SM2 *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)target, buffer, size); -} -UINT16 -TPMS_SIGNATURE_SM2_Marshal(TPMS_SIGNATURE_SM2 *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)source, buffer, size); -} -TPM_RC -TPMS_SIGNATURE_ECSCHNORR_Unmarshal(TPMS_SIGNATURE_ECSCHNORR *target, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_ECC_Unmarshal((TPMS_SIGNATURE_ECC *)target, buffer, size); -} -UINT16 -TPMS_SIGNATURE_ECSCHNORR_Marshal(TPMS_SIGNATURE_ECSCHNORR *source, BYTE **buffer, INT32 *size) -{ - return TPMS_SIGNATURE_ECC_Marshal((TPMS_SIGNATURE_ECC *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES -#endif // ALG_ECC - -// Table 2:184 - Definition of TPMU_SIGNATURE Union -TPM_RC -TPMU_SIGNATURE_Unmarshal(TPMU_SIGNATURE *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_ECDAA - case ALG_ECDAA_VALUE: - return TPMS_SIGNATURE_ECDAA_Unmarshal((TPMS_SIGNATURE_ECDAA *)&(target->ecdaa), buffer, size); -#endif // ALG_ECDAA -#if ALG_RSASSA - case ALG_RSASSA_VALUE: - return TPMS_SIGNATURE_RSASSA_Unmarshal((TPMS_SIGNATURE_RSASSA *)&(target->rsassa), buffer, size); -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: - return TPMS_SIGNATURE_RSAPSS_Unmarshal((TPMS_SIGNATURE_RSAPSS *)&(target->rsapss), buffer, size); -#endif // ALG_RSAPSS -#if ALG_ECDSA - case ALG_ECDSA_VALUE: - return TPMS_SIGNATURE_ECDSA_Unmarshal((TPMS_SIGNATURE_ECDSA *)&(target->ecdsa), buffer, size); -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: - return TPMS_SIGNATURE_SM2_Unmarshal((TPMS_SIGNATURE_SM2 *)&(target->sm2), buffer, size); -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: - return TPMS_SIGNATURE_ECSCHNORR_Unmarshal((TPMS_SIGNATURE_ECSCHNORR *)&(target->ecschnorr), buffer, size); -#endif // ALG_ECSCHNORR -#if ALG_HMAC - case ALG_HMAC_VALUE: - return TPMT_HA_Unmarshal((TPMT_HA *)&(target->hmac), buffer, size, 0); -#endif // ALG_HMAC - case ALG_NULL_VALUE: - return TPM_RC_SUCCESS; - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_SIGNATURE_Marshal(TPMU_SIGNATURE *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_ECDAA - case ALG_ECDAA_VALUE: - return TPMS_SIGNATURE_ECDAA_Marshal((TPMS_SIGNATURE_ECDAA *)&(source->ecdaa), buffer, size); -#endif // ALG_ECDAA -#if ALG_RSASSA - case ALG_RSASSA_VALUE: - return TPMS_SIGNATURE_RSASSA_Marshal((TPMS_SIGNATURE_RSASSA *)&(source->rsassa), buffer, size); -#endif // ALG_RSASSA -#if ALG_RSAPSS - case ALG_RSAPSS_VALUE: - return TPMS_SIGNATURE_RSAPSS_Marshal((TPMS_SIGNATURE_RSAPSS *)&(source->rsapss), buffer, size); -#endif // ALG_RSAPSS -#if ALG_ECDSA - case ALG_ECDSA_VALUE: - return TPMS_SIGNATURE_ECDSA_Marshal((TPMS_SIGNATURE_ECDSA *)&(source->ecdsa), buffer, size); -#endif // ALG_ECDSA -#if ALG_SM2 - case ALG_SM2_VALUE: - return TPMS_SIGNATURE_SM2_Marshal((TPMS_SIGNATURE_SM2 *)&(source->sm2), buffer, size); -#endif // ALG_SM2 -#if ALG_ECSCHNORR - case ALG_ECSCHNORR_VALUE: - return TPMS_SIGNATURE_ECSCHNORR_Marshal((TPMS_SIGNATURE_ECSCHNORR *)&(source->ecschnorr), buffer, size); -#endif // ALG_ECSCHNORR -#if ALG_HMAC - case ALG_HMAC_VALUE: - return TPMT_HA_Marshal((TPMT_HA *)&(source->hmac), buffer, size); -#endif // ALG_HMAC - case ALG_NULL_VALUE: - return 0; - } - return 0; -} - -// Table 2:185 - Definition of TPMT_SIGNATURE Structure -TPM_RC -TPMT_SIGNATURE_Unmarshal(TPMT_SIGNATURE *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_SIG_SCHEME_Unmarshal((TPMI_ALG_SIG_SCHEME *)&(target->sigAlg), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMU_SIGNATURE_Unmarshal((TPMU_SIGNATURE *)&(target->signature), buffer, size, (UINT32)target->sigAlg); - return result; -} -UINT16 -TPMT_SIGNATURE_Marshal(TPMT_SIGNATURE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_SIG_SCHEME_Marshal((TPMI_ALG_SIG_SCHEME *)&(source->sigAlg), buffer, size)); - result = (UINT16)(result + TPMU_SIGNATURE_Marshal((TPMU_SIGNATURE *)&(source->signature), buffer, size, (UINT32)source->sigAlg)); - return result; -} - -// Table 2:186 - Definition of TPMU_ENCRYPTED_SECRET Union -TPM_RC -TPMU_ENCRYPTED_SECRET_Unmarshal(TPMU_ENCRYPTED_SECRET *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_ECC - case ALG_ECC_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->ecc), buffer, size, (INT32)sizeof(TPMS_ECC_POINT)); -#endif // ALG_ECC -#if ALG_RSA - case ALG_RSA_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->rsa), buffer, size, (INT32)MAX_RSA_KEY_BYTES); -#endif // ALG_RSA -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->symmetric), buffer, size, (INT32)sizeof(TPM2B_DIGEST)); -#endif // ALG_SYMCIPHER -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: - return BYTE_Array_Unmarshal((BYTE *)(target->keyedHash), buffer, size, (INT32)sizeof(TPM2B_DIGEST)); -#endif // ALG_KEYEDHASH - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_ENCRYPTED_SECRET_Marshal(TPMU_ENCRYPTED_SECRET *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_ECC - case ALG_ECC_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->ecc), buffer, size, (INT32)sizeof(TPMS_ECC_POINT)); -#endif // ALG_ECC -#if ALG_RSA - case ALG_RSA_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->rsa), buffer, size, (INT32)MAX_RSA_KEY_BYTES); -#endif // ALG_RSA -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->symmetric), buffer, size, (INT32)sizeof(TPM2B_DIGEST)); -#endif // ALG_SYMCIPHER -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: - return BYTE_Array_Marshal((BYTE *)(source->keyedHash), buffer, size, (INT32)sizeof(TPM2B_DIGEST)); -#endif // ALG_KEYEDHASH - } - return 0; -} - -// Table 2:187 - Definition of TPM2B_ENCRYPTED_SECRET Structure -TPM_RC -TPM2B_ENCRYPTED_SECRET_Unmarshal(TPM2B_ENCRYPTED_SECRET *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMU_ENCRYPTED_SECRET)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.secret), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_ENCRYPTED_SECRET_Marshal(TPM2B_ENCRYPTED_SECRET *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.secret), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:188 - Definition of TPMI_ALG_PUBLIC Type -TPM_RC -TPMI_ALG_PUBLIC_Unmarshal(TPMI_ALG_PUBLIC *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM_ALG_ID_Unmarshal((TPM_ALG_ID *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch (*target) - { -#if ALG_RSA - case ALG_RSA_VALUE: -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: -#endif // ALG_ECC -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: -#endif // ALG_KEYEDHASH -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: -#endif // ALG_SYMCIPHER - break; - default: - result = TPM_RC_TYPE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPMI_ALG_PUBLIC_Marshal(TPMI_ALG_PUBLIC *source, BYTE **buffer, INT32 *size) -{ - return TPM_ALG_ID_Marshal((TPM_ALG_ID *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:189 - Definition of TPMU_PUBLIC_ID Union -TPM_RC -TPMU_PUBLIC_ID_Unmarshal(TPMU_PUBLIC_ID *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: - return TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->keyedHash), buffer, size); -#endif // ALG_KEYEDHASH -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: - return TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->sym), buffer, size); -#endif // ALG_SYMCIPHER -#if ALG_RSA - case ALG_RSA_VALUE: - return TPM2B_PUBLIC_KEY_RSA_Unmarshal((TPM2B_PUBLIC_KEY_RSA *)&(target->rsa), buffer, size); -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - return TPMS_ECC_POINT_Unmarshal((TPMS_ECC_POINT *)&(target->ecc), buffer, size); -#endif // ALG_ECC - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_PUBLIC_ID_Marshal(TPMU_PUBLIC_ID *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: - return TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->keyedHash), buffer, size); -#endif // ALG_KEYEDHASH -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: - return TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->sym), buffer, size); -#endif // ALG_SYMCIPHER -#if ALG_RSA - case ALG_RSA_VALUE: - return TPM2B_PUBLIC_KEY_RSA_Marshal((TPM2B_PUBLIC_KEY_RSA *)&(source->rsa), buffer, size); -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - return TPMS_ECC_POINT_Marshal((TPMS_ECC_POINT *)&(source->ecc), buffer, size); -#endif // ALG_ECC - } - return 0; -} - -// Table 2:190 - Definition of TPMS_KEYEDHASH_PARMS Structure -TPM_RC -TPMS_KEYEDHASH_PARMS_Unmarshal(TPMS_KEYEDHASH_PARMS *target, BYTE **buffer, INT32 *size) -{ - return TPMT_KEYEDHASH_SCHEME_Unmarshal((TPMT_KEYEDHASH_SCHEME *)&(target->scheme), buffer, size, 1); -} -UINT16 -TPMS_KEYEDHASH_PARMS_Marshal(TPMS_KEYEDHASH_PARMS *source, BYTE **buffer, INT32 *size) -{ - return TPMT_KEYEDHASH_SCHEME_Marshal((TPMT_KEYEDHASH_SCHEME *)&(source->scheme), buffer, size); -} - -// Table 2:191 - Definition of TPMS_ASYM_PARMS Structure -// Table 2:192 - Definition of TPMS_RSA_PARMS Structure -#if ALG_RSA -TPM_RC -TPMS_RSA_PARMS_Unmarshal(TPMS_RSA_PARMS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMT_SYM_DEF_OBJECT_Unmarshal((TPMT_SYM_DEF_OBJECT *)&(target->symmetric), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPMT_RSA_SCHEME_Unmarshal((TPMT_RSA_SCHEME *)&(target->scheme), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPMI_RSA_KEY_BITS_Unmarshal((TPMI_RSA_KEY_BITS *)&(target->keyBits), buffer, size); - if(result == TPM_RC_SUCCESS) - result = UINT32_Unmarshal((UINT32 *)&(target->exponent), buffer, size); - return result; -} -UINT16 -TPMS_RSA_PARMS_Marshal(TPMS_RSA_PARMS *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMT_SYM_DEF_OBJECT_Marshal((TPMT_SYM_DEF_OBJECT *)&(source->symmetric), buffer, size)); - result = (UINT16)(result + TPMT_RSA_SCHEME_Marshal((TPMT_RSA_SCHEME *)&(source->scheme), buffer, size)); - result = (UINT16)(result + TPMI_RSA_KEY_BITS_Marshal((TPMI_RSA_KEY_BITS *)&(source->keyBits), buffer, size)); - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->exponent), buffer, size)); - return result; -} -#endif // ALG_RSA - -// Table 2:193 - Definition of TPMS_ECC_PARMS Structure -#if ALG_ECC -TPM_RC -TPMS_ECC_PARMS_Unmarshal(TPMS_ECC_PARMS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMT_SYM_DEF_OBJECT_Unmarshal((TPMT_SYM_DEF_OBJECT *)&(target->symmetric), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPMT_ECC_SCHEME_Unmarshal((TPMT_ECC_SCHEME *)&(target->scheme), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPMI_ECC_CURVE_Unmarshal((TPMI_ECC_CURVE *)&(target->curveID), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMT_KDF_SCHEME_Unmarshal((TPMT_KDF_SCHEME *)&(target->kdf), buffer, size, 1); - return result; -} -UINT16 -TPMS_ECC_PARMS_Marshal(TPMS_ECC_PARMS *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMT_SYM_DEF_OBJECT_Marshal((TPMT_SYM_DEF_OBJECT *)&(source->symmetric), buffer, size)); - result = (UINT16)(result + TPMT_ECC_SCHEME_Marshal((TPMT_ECC_SCHEME *)&(source->scheme), buffer, size)); - result = (UINT16)(result + TPMI_ECC_CURVE_Marshal((TPMI_ECC_CURVE *)&(source->curveID), buffer, size)); - result = (UINT16)(result + TPMT_KDF_SCHEME_Marshal((TPMT_KDF_SCHEME *)&(source->kdf), buffer, size)); - return result; -} -#endif // ALG_ECC - -// Table 2:194 - Definition of TPMU_PUBLIC_PARMS Union -TPM_RC -TPMU_PUBLIC_PARMS_Unmarshal(TPMU_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: - return TPMS_KEYEDHASH_PARMS_Unmarshal((TPMS_KEYEDHASH_PARMS *)&(target->keyedHashDetail), buffer, size); -#endif // ALG_KEYEDHASH -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: - return TPMS_SYMCIPHER_PARMS_Unmarshal((TPMS_SYMCIPHER_PARMS *)&(target->symDetail), buffer, size); -#endif // ALG_SYMCIPHER -#if ALG_RSA - case ALG_RSA_VALUE: - return TPMS_RSA_PARMS_Unmarshal((TPMS_RSA_PARMS *)&(target->rsaDetail), buffer, size); -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - return TPMS_ECC_PARMS_Unmarshal((TPMS_ECC_PARMS *)&(target->eccDetail), buffer, size); -#endif // ALG_ECC - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_PUBLIC_PARMS_Marshal(TPMU_PUBLIC_PARMS *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: - return TPMS_KEYEDHASH_PARMS_Marshal((TPMS_KEYEDHASH_PARMS *)&(source->keyedHashDetail), buffer, size); -#endif // ALG_KEYEDHASH -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: - return TPMS_SYMCIPHER_PARMS_Marshal((TPMS_SYMCIPHER_PARMS *)&(source->symDetail), buffer, size); -#endif // ALG_SYMCIPHER -#if ALG_RSA - case ALG_RSA_VALUE: - return TPMS_RSA_PARMS_Marshal((TPMS_RSA_PARMS *)&(source->rsaDetail), buffer, size); -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - return TPMS_ECC_PARMS_Marshal((TPMS_ECC_PARMS *)&(source->eccDetail), buffer, size); -#endif // ALG_ECC - } - return 0; -} - -// Table 2:195 - Definition of TPMT_PUBLIC_PARMS Structure -TPM_RC -TPMT_PUBLIC_PARMS_Unmarshal(TPMT_PUBLIC_PARMS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_ALG_PUBLIC_Unmarshal((TPMI_ALG_PUBLIC *)&(target->type), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMU_PUBLIC_PARMS_Unmarshal((TPMU_PUBLIC_PARMS *)&(target->parameters), buffer, size, (UINT32)target->type); - return result; -} -UINT16 -TPMT_PUBLIC_PARMS_Marshal(TPMT_PUBLIC_PARMS *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_PUBLIC_Marshal((TPMI_ALG_PUBLIC *)&(source->type), buffer, size)); - result = (UINT16)(result + TPMU_PUBLIC_PARMS_Marshal((TPMU_PUBLIC_PARMS *)&(source->parameters), buffer, size, (UINT32)source->type)); - return result; -} - -// Table 2:196 - Definition of TPMT_PUBLIC Structure -TPM_RC -TPMT_PUBLIC_Unmarshal(TPMT_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = TPMI_ALG_PUBLIC_Unmarshal((TPMI_ALG_PUBLIC *)&(target->type), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->nameAlg), buffer, size, flag); - if(result == TPM_RC_SUCCESS) - result = TPMA_OBJECT_Unmarshal((TPMA_OBJECT *)&(target->objectAttributes), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->authPolicy), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMU_PUBLIC_PARMS_Unmarshal((TPMU_PUBLIC_PARMS *)&(target->parameters), buffer, size, (UINT32)target->type); - if(result == TPM_RC_SUCCESS) - result = TPMU_PUBLIC_ID_Unmarshal((TPMU_PUBLIC_ID *)&(target->unique), buffer, size, (UINT32)target->type); - return result; -} -UINT16 -TPMT_PUBLIC_Marshal(TPMT_PUBLIC *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_PUBLIC_Marshal((TPMI_ALG_PUBLIC *)&(source->type), buffer, size)); - result = (UINT16)(result + TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->nameAlg), buffer, size)); - result = (UINT16)(result + TPMA_OBJECT_Marshal((TPMA_OBJECT *)&(source->objectAttributes), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->authPolicy), buffer, size)); - result = (UINT16)(result + TPMU_PUBLIC_PARMS_Marshal((TPMU_PUBLIC_PARMS *)&(source->parameters), buffer, size, (UINT32)source->type)); - result = (UINT16)(result + TPMU_PUBLIC_ID_Marshal((TPMU_PUBLIC_ID *)&(source->unique), buffer, size, (UINT32)source->type)); - return result; -} - -// Table 2:197 - Definition of TPM2B_PUBLIC Structure -TPM_RC -TPM2B_PUBLIC_Unmarshal(TPM2B_PUBLIC *target, BYTE **buffer, INT32 *size, BOOL flag) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size); // =a - if(result == TPM_RC_SUCCESS) - { - // if size is zero, then the required structure is missing - if(target->size == 0) - result = TPM_RC_SIZE; - else - { - INT32 startSize = *size; - result = TPMT_PUBLIC_Unmarshal((TPMT_PUBLIC *)&(target->publicArea), buffer, size, flag); // =b - if(result == TPM_RC_SUCCESS) - { - if(target->size != (startSize - *size)) - result = TPM_RC_SIZE; - } - } - } - return result; -} -UINT16 -TPM2B_PUBLIC_Marshal(TPM2B_PUBLIC *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - // Marshal a dummy value of the 2B size. This makes sure that 'buffer' - // and 'size' are advanced as necessary (i.e., if they are present) - result = UINT16_Marshal(&result, buffer, size); - // Marshal the structure - result = (UINT16)(result + TPMT_PUBLIC_Marshal((TPMT_PUBLIC *)&(source->publicArea), buffer, size)); - // if a buffer was provided, go back and fill in the actual size - if(buffer != NULL) - UINT16_TO_BYTE_ARRAY((result - 2), (*buffer - result)); - return result; -} - -// Table 2:198 - Definition of TPM2B_TEMPLATE Structure -TPM_RC -TPM2B_TEMPLATE_Unmarshal(TPM2B_TEMPLATE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMT_PUBLIC)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_TEMPLATE_Marshal(TPM2B_TEMPLATE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:199 - Definition of TPM2B_PRIVATE_VENDOR_SPECIFIC Structure -TPM_RC -TPM2B_PRIVATE_VENDOR_SPECIFIC_Unmarshal(TPM2B_PRIVATE_VENDOR_SPECIFIC *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > PRIVATE_VENDOR_SPECIFIC_BYTES) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_PRIVATE_VENDOR_SPECIFIC_Marshal(TPM2B_PRIVATE_VENDOR_SPECIFIC *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:200 - Definition of TPMU_SENSITIVE_COMPOSITE Union -TPM_RC -TPMU_SENSITIVE_COMPOSITE_Unmarshal(TPMU_SENSITIVE_COMPOSITE *target, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_RSA - case ALG_RSA_VALUE: - return TPM2B_PRIVATE_KEY_RSA_Unmarshal((TPM2B_PRIVATE_KEY_RSA *)&(target->rsa), buffer, size); -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - return TPM2B_ECC_PARAMETER_Unmarshal((TPM2B_ECC_PARAMETER *)&(target->ecc), buffer, size); -#endif // ALG_ECC -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: - return TPM2B_SENSITIVE_DATA_Unmarshal((TPM2B_SENSITIVE_DATA *)&(target->bits), buffer, size); -#endif // ALG_KEYEDHASH -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: - return TPM2B_SYM_KEY_Unmarshal((TPM2B_SYM_KEY *)&(target->sym), buffer, size); -#endif // ALG_SYMCIPHER - } - return TPM_RC_SELECTOR; -} -UINT16 -TPMU_SENSITIVE_COMPOSITE_Marshal(TPMU_SENSITIVE_COMPOSITE *source, BYTE **buffer, INT32 *size, UINT32 selector) -{ - switch(selector) { -#if ALG_RSA - case ALG_RSA_VALUE: - return TPM2B_PRIVATE_KEY_RSA_Marshal((TPM2B_PRIVATE_KEY_RSA *)&(source->rsa), buffer, size); -#endif // ALG_RSA -#if ALG_ECC - case ALG_ECC_VALUE: - return TPM2B_ECC_PARAMETER_Marshal((TPM2B_ECC_PARAMETER *)&(source->ecc), buffer, size); -#endif // ALG_ECC -#if ALG_KEYEDHASH - case ALG_KEYEDHASH_VALUE: - return TPM2B_SENSITIVE_DATA_Marshal((TPM2B_SENSITIVE_DATA *)&(source->bits), buffer, size); -#endif // ALG_KEYEDHASH -#if ALG_SYMCIPHER - case ALG_SYMCIPHER_VALUE: - return TPM2B_SYM_KEY_Marshal((TPM2B_SYM_KEY *)&(source->sym), buffer, size); -#endif // ALG_SYMCIPHER - } - return 0; -} - -// Table 2:201 - Definition of TPMT_SENSITIVE Structure -TPM_RC -TPMT_SENSITIVE_Unmarshal(TPMT_SENSITIVE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_ALG_PUBLIC_Unmarshal((TPMI_ALG_PUBLIC *)&(target->sensitiveType), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_AUTH_Unmarshal((TPM2B_AUTH *)&(target->authValue), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->seedValue), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMU_SENSITIVE_COMPOSITE_Unmarshal((TPMU_SENSITIVE_COMPOSITE *)&(target->sensitive), buffer, size, (UINT32)target->sensitiveType); - return result; -} -UINT16 -TPMT_SENSITIVE_Marshal(TPMT_SENSITIVE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_ALG_PUBLIC_Marshal((TPMI_ALG_PUBLIC *)&(source->sensitiveType), buffer, size)); - result = (UINT16)(result + TPM2B_AUTH_Marshal((TPM2B_AUTH *)&(source->authValue), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->seedValue), buffer, size)); - result = (UINT16)(result + TPMU_SENSITIVE_COMPOSITE_Marshal((TPMU_SENSITIVE_COMPOSITE *)&(source->sensitive), buffer, size, (UINT32)source->sensitiveType)); - return result; -} - -// Table 2:202 - Definition of TPM2B_SENSITIVE Structure -TPM_RC -TPM2B_SENSITIVE_Unmarshal(TPM2B_SENSITIVE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size); // =a - // if there was an error or if target->size equal to 0, - // skip unmarshaling of the structure - if((result == TPM_RC_SUCCESS) && (target->size != 0)) - { - INT32 startSize = *size; - result = TPMT_SENSITIVE_Unmarshal((TPMT_SENSITIVE *)&(target->sensitiveArea), buffer, size); // =b - if(result == TPM_RC_SUCCESS) - { - if(target->size != (startSize - *size)) - result = TPM_RC_SIZE; - } - } - return result; -} -UINT16 -TPM2B_SENSITIVE_Marshal(TPM2B_SENSITIVE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - // Marshal a dummy value of the 2B size. This makes sure that 'buffer' - // and 'size' are advanced as necessary (i.e., if they are present) - result = UINT16_Marshal(&result, buffer, size); - // Marshal the structure - result = (UINT16)(result + TPMT_SENSITIVE_Marshal((TPMT_SENSITIVE *)&(source->sensitiveArea), buffer, size)); - // if a buffer was provided, go back and fill in the actual size - if(buffer != NULL) - UINT16_TO_BYTE_ARRAY((result - 2), (*buffer - result)); - return result; -} - -// Table 2:203 - Definition of _PRIVATE Structure -// Table 2:204 - Definition of TPM2B_PRIVATE Structure -TPM_RC -TPM2B_PRIVATE_Unmarshal(TPM2B_PRIVATE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(_PRIVATE)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_PRIVATE_Marshal(TPM2B_PRIVATE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:205 - Definition of TPMS_ID_OBJECT Structure -// Table 2:206 - Definition of TPM2B_ID_OBJECT Structure -TPM_RC -TPM2B_ID_OBJECT_Unmarshal(TPM2B_ID_OBJECT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMS_ID_OBJECT)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.credential), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_ID_OBJECT_Marshal(TPM2B_ID_OBJECT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.credential), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:207 - Definition of TPM_NV_INDEX Bits -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_NV_INDEX_Marshal(TPM_NV_INDEX *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:208 - Definition of TPM_NT Constants -// Table 2:209 - Definition of TPMS_NV_PIN_COUNTER_PARAMETERS Structure -TPM_RC -TPMS_NV_PIN_COUNTER_PARAMETERS_Unmarshal(TPMS_NV_PIN_COUNTER_PARAMETERS *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)&(target->pinCount), buffer, size); - if(result == TPM_RC_SUCCESS) - result = UINT32_Unmarshal((UINT32 *)&(target->pinLimit), buffer, size); - return result; -} -UINT16 -TPMS_NV_PIN_COUNTER_PARAMETERS_Marshal(TPMS_NV_PIN_COUNTER_PARAMETERS *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->pinCount), buffer, size)); - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->pinLimit), buffer, size)); - return result; -} - -// Table 2:210 - Definition of TPMA_NV Bits -TPM_RC -TPMA_NV_Unmarshal(TPMA_NV *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - if(*((UINT32 *)target) & (UINT32)0x01f00300) - result = TPM_RC_RESERVED_BITS; - } - return result; -} - -#if !USE_MARSHALING_DEFINES -UINT16 -TPMA_NV_Marshal(TPMA_NV *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:211 - Definition of TPMS_NV_PUBLIC Structure -TPM_RC -TPMS_NV_PUBLIC_Unmarshal(TPMS_NV_PUBLIC *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPMI_RH_NV_INDEX_Unmarshal((TPMI_RH_NV_INDEX *)&(target->nvIndex), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMI_ALG_HASH_Unmarshal((TPMI_ALG_HASH *)&(target->nameAlg), buffer, size, 0); - if(result == TPM_RC_SUCCESS) - result = TPMA_NV_Unmarshal((TPMA_NV *)&(target->attributes), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->authPolicy), buffer, size); - if(result == TPM_RC_SUCCESS) - result = UINT16_Unmarshal((UINT16 *)&(target->dataSize), buffer, size); - if( (result == TPM_RC_SUCCESS) - && (target->dataSize > MAX_NV_INDEX_SIZE)) - result = TPM_RC_SIZE; - return result; -} -UINT16 -TPMS_NV_PUBLIC_Marshal(TPMS_NV_PUBLIC *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPMI_RH_NV_INDEX_Marshal((TPMI_RH_NV_INDEX *)&(source->nvIndex), buffer, size)); - result = (UINT16)(result + TPMI_ALG_HASH_Marshal((TPMI_ALG_HASH *)&(source->nameAlg), buffer, size)); - result = (UINT16)(result + TPMA_NV_Marshal((TPMA_NV *)&(source->attributes), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->authPolicy), buffer, size)); - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->dataSize), buffer, size)); - return result; -} - -// Table 2:212 - Definition of TPM2B_NV_PUBLIC Structure -TPM_RC -TPM2B_NV_PUBLIC_Unmarshal(TPM2B_NV_PUBLIC *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->size), buffer, size); // =a - if(result == TPM_RC_SUCCESS) - { - // if size is zero, then the required structure is missing - if(target->size == 0) - result = TPM_RC_SIZE; - else - { - INT32 startSize = *size; - result = TPMS_NV_PUBLIC_Unmarshal((TPMS_NV_PUBLIC *)&(target->nvPublic), buffer, size); // =b - if(result == TPM_RC_SUCCESS) - { - if(target->size != (startSize - *size)) - result = TPM_RC_SIZE; - } - } - } - return result; -} -UINT16 -TPM2B_NV_PUBLIC_Marshal(TPM2B_NV_PUBLIC *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - // Marshal a dummy value of the 2B size. This makes sure that 'buffer' - // and 'size' are advanced as necessary (i.e., if they are present) - result = UINT16_Marshal(&result, buffer, size); - // Marshal the structure - result = (UINT16)(result + TPMS_NV_PUBLIC_Marshal((TPMS_NV_PUBLIC *)&(source->nvPublic), buffer, size)); - // if a buffer was provided, go back and fill in the actual size - if(buffer != NULL) - UINT16_TO_BYTE_ARRAY((result - 2), (*buffer - result)); - return result; -} - -// Table 2:213 - Definition of TPM2B_CONTEXT_SENSITIVE Structure -TPM_RC -TPM2B_CONTEXT_SENSITIVE_Unmarshal(TPM2B_CONTEXT_SENSITIVE *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > MAX_CONTEXT_SIZE) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_CONTEXT_SENSITIVE_Marshal(TPM2B_CONTEXT_SENSITIVE *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:214 - Definition of TPMS_CONTEXT_DATA Structure -TPM_RC -TPMS_CONTEXT_DATA_Unmarshal(TPMS_CONTEXT_DATA *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = TPM2B_DIGEST_Unmarshal((TPM2B_DIGEST *)&(target->integrity), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPM2B_CONTEXT_SENSITIVE_Unmarshal((TPM2B_CONTEXT_SENSITIVE *)&(target->encrypted), buffer, size); - return result; -} -UINT16 -TPMS_CONTEXT_DATA_Marshal(TPMS_CONTEXT_DATA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->integrity), buffer, size)); - result = (UINT16)(result + TPM2B_CONTEXT_SENSITIVE_Marshal((TPM2B_CONTEXT_SENSITIVE *)&(source->encrypted), buffer, size)); - return result; -} - -// Table 2:215 - Definition of TPM2B_CONTEXT_DATA Structure -TPM_RC -TPM2B_CONTEXT_DATA_Unmarshal(TPM2B_CONTEXT_DATA *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT16_Unmarshal((UINT16 *)&(target->t.size), buffer, size); - if(result == TPM_RC_SUCCESS) - { - if((target->t.size) > sizeof(TPMS_CONTEXT_DATA)) - result = TPM_RC_SIZE; - else - result = BYTE_Array_Unmarshal((BYTE *)(target->t.buffer), buffer, size, (INT32)(target->t.size)); - } - return result; -} -UINT16 -TPM2B_CONTEXT_DATA_Marshal(TPM2B_CONTEXT_DATA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT16_Marshal((UINT16 *)&(source->t.size), buffer, size)); - // if size equal to 0, the rest of the structure is a zero buffer. Stop processing - if(source->t.size == 0) - return result; - result = (UINT16)(result + BYTE_Array_Marshal((BYTE *)(source->t.buffer), buffer, size, (INT32)(source->t.size))); - return result; -} - -// Table 2:216 - Definition of TPMS_CONTEXT Structure -TPM_RC -TPMS_CONTEXT_Unmarshal(TPMS_CONTEXT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT64_Unmarshal((UINT64 *)&(target->sequence), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMI_DH_SAVED_Unmarshal((TPMI_DH_SAVED *)&(target->savedHandle), buffer, size); - if(result == TPM_RC_SUCCESS) - result = TPMI_RH_HIERARCHY_Unmarshal((TPMI_RH_HIERARCHY *)&(target->hierarchy), buffer, size, 1); - if(result == TPM_RC_SUCCESS) - result = TPM2B_CONTEXT_DATA_Unmarshal((TPM2B_CONTEXT_DATA *)&(target->contextBlob), buffer, size); - return result; -} -UINT16 -TPMS_CONTEXT_Marshal(TPMS_CONTEXT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT64_Marshal((UINT64 *)&(source->sequence), buffer, size)); - result = (UINT16)(result + TPMI_DH_SAVED_Marshal((TPMI_DH_SAVED *)&(source->savedHandle), buffer, size)); - result = (UINT16)(result + TPMI_RH_HIERARCHY_Marshal((TPMI_RH_HIERARCHY *)&(source->hierarchy), buffer, size)); - result = (UINT16)(result + TPM2B_CONTEXT_DATA_Marshal((TPM2B_CONTEXT_DATA *)&(source->contextBlob), buffer, size)); - return result; -} - -// Table 2:218 - Definition of TPMS_CREATION_DATA Structure -UINT16 -TPMS_CREATION_DATA_Marshal(TPMS_CREATION_DATA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPML_PCR_SELECTION_Marshal((TPML_PCR_SELECTION *)&(source->pcrSelect), buffer, size)); - result = (UINT16)(result + TPM2B_DIGEST_Marshal((TPM2B_DIGEST *)&(source->pcrDigest), buffer, size)); - result = (UINT16)(result + TPMA_LOCALITY_Marshal((TPMA_LOCALITY *)&(source->locality), buffer, size)); - result = (UINT16)(result + TPM_ALG_ID_Marshal((TPM_ALG_ID *)&(source->parentNameAlg), buffer, size)); - result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->parentName), buffer, size)); - result = (UINT16)(result + TPM2B_NAME_Marshal((TPM2B_NAME *)&(source->parentQualifiedName), buffer, size)); - result = (UINT16)(result + TPM2B_DATA_Marshal((TPM2B_DATA *)&(source->outsideInfo), buffer, size)); - return result; -} - -// Table 2:219 - Definition of TPM2B_CREATION_DATA Structure -UINT16 -TPM2B_CREATION_DATA_Marshal(TPM2B_CREATION_DATA *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - // Marshal a dummy value of the 2B size. This makes sure that 'buffer' - // and 'size' are advanced as necessary (i.e., if they are present) - result = UINT16_Marshal(&result, buffer, size); - // Marshal the structure - result = (UINT16)(result + TPMS_CREATION_DATA_Marshal((TPMS_CREATION_DATA *)&(source->creationData), buffer, size)); - // if a buffer was provided, go back and fill in the actual size - if(buffer != NULL) - UINT16_TO_BYTE_ARRAY((result - 2), (*buffer - result)); - return result; -} - -// Table 2:220 - Definition of TPM_AT Constants -TPM_RC -TPM_AT_Unmarshal(TPM_AT *target, BYTE **buffer, INT32 *size) -{ - TPM_RC result; - result = UINT32_Unmarshal((UINT32 *)target, buffer, size); - if(result == TPM_RC_SUCCESS) - { - switch(*target) - { - case TPM_AT_ANY : - case TPM_AT_ERROR : - case TPM_AT_PV1 : - case TPM_AT_VEND : - break; - default : - result = TPM_RC_VALUE; - break; - } - } - return result; -} -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_AT_Marshal(TPM_AT *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:221 - Definition of TPM_AE Constants -#if !USE_MARSHALING_DEFINES -UINT16 -TPM_AE_Marshal(TPM_AE *source, BYTE **buffer, INT32 *size) -{ - return UINT32_Marshal((UINT32 *)source, buffer, size); -} -#endif // !USE_MARSHALING_DEFINES - -// Table 2:222 - Definition of TPMS_AC_OUTPUT Structure -UINT16 -TPMS_AC_OUTPUT_Marshal(TPMS_AC_OUTPUT *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + TPM_AT_Marshal((TPM_AT *)&(source->tag), buffer, size)); - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->data), buffer, size)); - return result; -} - -// Table 2:223 - Definition of TPML_AC_CAPABILITIES Structure -UINT16 -TPML_AC_CAPABILITIES_Marshal(TPML_AC_CAPABILITIES *source, BYTE **buffer, INT32 *size) -{ - UINT16 result = 0; - result = (UINT16)(result + UINT32_Marshal((UINT32 *)&(source->count), buffer, size)); - result = (UINT16)(result + TPMS_AC_OUTPUT_Array_Marshal((TPMS_AC_OUTPUT *)(source->acCapabilities), buffer, size, (INT32)(source->count))); - return result; -} - -// Array Marshal/Unmarshal for BYTE -TPM_RC -BYTE_Array_Unmarshal(BYTE *target, BYTE **buffer, INT32 *size, INT32 count) -{ - if(*size < count) - return TPM_RC_INSUFFICIENT; - memcpy(target, *buffer, count); - *size -= count; - *buffer += count; - return TPM_RC_SUCCESS; -} -UINT16 -BYTE_Array_Marshal(BYTE *source, BYTE **buffer, INT32 *size, INT32 count) -{ - if (buffer != 0) - { - if ((size == 0) || ((*size -= count) >= 0)) - { - memcpy(*buffer, source, count); - *buffer += count; - } - pAssert(size == 0 || (*size >= 0)); - } - pAssert(count < INT16_MAX); - return ((UINT16)count); -} - -// Array Marshal/Unmarshal for TPM2B_DIGEST -TPM_RC -TPM2B_DIGEST_Array_Unmarshal(TPM2B_DIGEST *target, BYTE **buffer, INT32 *size, INT32 count) -{ - TPM_RC result; - INT32 i; - for(result = TPM_RC_SUCCESS, i = 0; - ((result == TPM_RC_SUCCESS) && (i < count)); i++) - { - result = TPM2B_DIGEST_Unmarshal(&target[i], buffer, size); - } - return result; -} -UINT16 -TPM2B_DIGEST_Array_Marshal(TPM2B_DIGEST *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPM2B_DIGEST_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal for TPMA_CC -UINT16 -TPMA_CC_Array_Marshal(TPMA_CC *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPMA_CC_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal for TPMS_AC_OUTPUT -UINT16 -TPMS_AC_OUTPUT_Array_Marshal(TPMS_AC_OUTPUT *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPMS_AC_OUTPUT_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal for TPMS_ALG_PROPERTY -UINT16 -TPMS_ALG_PROPERTY_Array_Marshal(TPMS_ALG_PROPERTY *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPMS_ALG_PROPERTY_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal/Unmarshal for TPMS_PCR_SELECTION -TPM_RC -TPMS_PCR_SELECTION_Array_Unmarshal(TPMS_PCR_SELECTION *target, BYTE **buffer, INT32 *size, INT32 count) -{ - TPM_RC result; - INT32 i; - for(result = TPM_RC_SUCCESS, i = 0; - ((result == TPM_RC_SUCCESS) && (i < count)); i++) - { - result = TPMS_PCR_SELECTION_Unmarshal(&target[i], buffer, size); - } - return result; -} -UINT16 -TPMS_PCR_SELECTION_Array_Marshal(TPMS_PCR_SELECTION *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPMS_PCR_SELECTION_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal for TPMS_TAGGED_PCR_SELECT -UINT16 -TPMS_TAGGED_PCR_SELECT_Array_Marshal(TPMS_TAGGED_PCR_SELECT *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPMS_TAGGED_PCR_SELECT_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal for TPMS_TAGGED_POLICY -UINT16 -TPMS_TAGGED_POLICY_Array_Marshal(TPMS_TAGGED_POLICY *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPMS_TAGGED_POLICY_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal for TPMS_TAGGED_PROPERTY -UINT16 -TPMS_TAGGED_PROPERTY_Array_Marshal(TPMS_TAGGED_PROPERTY *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPMS_TAGGED_PROPERTY_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal/Unmarshal for TPMT_HA -TPM_RC -TPMT_HA_Array_Unmarshal(TPMT_HA *target, BYTE **buffer, INT32 *size, BOOL flag, INT32 count) -{ - TPM_RC result; - INT32 i; - for(result = TPM_RC_SUCCESS, i = 0; - ((result == TPM_RC_SUCCESS) && (i < count)); i++) - { - result = TPMT_HA_Unmarshal(&target[i], buffer, size, flag); - } - return result; -} -UINT16 -TPMT_HA_Array_Marshal(TPMT_HA *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPMT_HA_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal/Unmarshal for TPM_ALG_ID -TPM_RC -TPM_ALG_ID_Array_Unmarshal(TPM_ALG_ID *target, BYTE **buffer, INT32 *size, INT32 count) -{ - TPM_RC result; - INT32 i; - for(result = TPM_RC_SUCCESS, i = 0; - ((result == TPM_RC_SUCCESS) && (i < count)); i++) - { - result = TPM_ALG_ID_Unmarshal(&target[i], buffer, size); - } - return result; -} -UINT16 -TPM_ALG_ID_Array_Marshal(TPM_ALG_ID *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPM_ALG_ID_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal/Unmarshal for TPM_CC -TPM_RC -TPM_CC_Array_Unmarshal(TPM_CC *target, BYTE **buffer, INT32 *size, INT32 count) -{ - TPM_RC result; - INT32 i; - for(result = TPM_RC_SUCCESS, i = 0; - ((result == TPM_RC_SUCCESS) && (i < count)); i++) - { - result = TPM_CC_Unmarshal(&target[i], buffer, size); - } - return result; -} -UINT16 -TPM_CC_Array_Marshal(TPM_CC *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPM_CC_Marshal(&source[i], buffer, size)); - } - return result; -} - -// Array Marshal/Unmarshal for TPM_ECC_CURVE -#if ALG_ECC -TPM_RC -TPM_ECC_CURVE_Array_Unmarshal(TPM_ECC_CURVE *target, BYTE **buffer, INT32 *size, INT32 count) -{ - TPM_RC result; - INT32 i; - for(result = TPM_RC_SUCCESS, i = 0; - ((result == TPM_RC_SUCCESS) && (i < count)); i++) - { - result = TPM_ECC_CURVE_Unmarshal(&target[i], buffer, size); - } - return result; -} -UINT16 -TPM_ECC_CURVE_Array_Marshal(TPM_ECC_CURVE *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPM_ECC_CURVE_Marshal(&source[i], buffer, size)); - } - return result; -} -#endif // ALG_ECC - -// Array Marshal/Unmarshal for TPM_HANDLE -TPM_RC -TPM_HANDLE_Array_Unmarshal(TPM_HANDLE *target, BYTE **buffer, INT32 *size, INT32 count) -{ - TPM_RC result; - INT32 i; - for(result = TPM_RC_SUCCESS, i = 0; - ((result == TPM_RC_SUCCESS) && (i < count)); i++) - { - result = TPM_HANDLE_Unmarshal(&target[i], buffer, size); - } - return result; -} -UINT16 -TPM_HANDLE_Array_Marshal(TPM_HANDLE *source, BYTE **buffer, INT32 *size, INT32 count) -{ - UINT16 result = 0; - INT32 i; - for(i = 0; i < count; i++) - { - result = (UINT16)(result + TPM_HANDLE_Marshal(&source[i], buffer, size)); - } - return result; -} - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/MathOnByteBuffers.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/MathOnByteBuffers.c deleted file mode 100644 index 5e68e2376..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/MathOnByteBuffers.c +++ /dev/null @@ -1,265 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Introduction -// -// This file contains implementation of the math functions that are performed -// with canonical integers in byte buffers. The canonical integer is -// big-endian bytes. -// -#include "Tpm.h" - -//** Functions - -//*** UnsignedCmpB -// This function compare two unsigned values. The values are byte-aligned, -// big-endian numbers (e.g, a hash). -// Return Type: int -// 1 if (a > b) -// 0 if (a = b) -// -1 if (a < b) -LIB_EXPORT int -UnsignedCompareB( - UINT32 aSize, // IN: size of a - const BYTE *a, // IN: a - UINT32 bSize, // IN: size of b - const BYTE *b // IN: b - ) -{ - UINT32 i; - if(aSize > bSize) - return 1; - else if(aSize < bSize) - return -1; - else - { - for(i = 0; i < aSize; i++) - { - if(a[i] != b[i]) - return (a[i] > b[i]) ? 1 : -1; - } - } - return 0; -} - -//***SignedCompareB() -// Compare two signed integers: -// Return Type: int -// 1 if a > b -// 0 if a = b -// -1 if a < b -int -SignedCompareB( - const UINT32 aSize, // IN: size of a - const BYTE *a, // IN: a buffer - const UINT32 bSize, // IN: size of b - const BYTE *b // IN: b buffer - ) -{ - int signA, signB; // sign of a and b - - // For positive or 0, sign_a is 1 - // for negative, sign_a is 0 - signA = ((a[0] & 0x80) == 0) ? 1 : 0; - - // For positive or 0, sign_b is 1 - // for negative, sign_b is 0 - signB = ((b[0] & 0x80) == 0) ? 1 : 0; - - if(signA != signB) - { - return signA - signB; - } - if(signA == 1) - // do unsigned compare function - return UnsignedCompareB(aSize, a, bSize, b); - else - // do unsigned compare the other way - return 0 - UnsignedCompareB(aSize, a, bSize, b); -} - -//*** ModExpB -// This function is used to do modular exponentiation in support of RSA. -// The most typical uses are: 'c' = 'm'^'e' mod 'n' (RSA encrypt) and -// 'm' = 'c'^'d' mod 'n' (RSA decrypt). When doing decryption, the 'e' parameter -// of the function will contain the private exponent 'd' instead of the public -// exponent 'e'. -// -// If the results will not fit in the provided buffer, -// an error is returned (CRYPT_ERROR_UNDERFLOW). If the results is smaller -// than the buffer, the results is de-normalized. -// -// This version is intended for use with RSA and requires that 'm' be -// less than 'n'. -// -// Return Type: TPM_RC -// TPM_RC_SIZE number to exponentiate is larger than the modulus -// TPM_RC_NO_RESULT result will not fit into the provided buffer -// -TPM_RC -ModExpB( - UINT32 cSize, // IN: the size of the output buffer. It will - // need to be the same size as the modulus - BYTE *c, // OUT: the buffer to receive the results - // (c->size must be set to the maximum size - // for the returned value) - const UINT32 mSize, - const BYTE *m, // IN: number to exponentiate - const UINT32 eSize, - const BYTE *e, // IN: power - const UINT32 nSize, - const BYTE *n // IN: modulus - ) -{ - BN_MAX(bnC); - BN_MAX(bnM); - BN_MAX(bnE); - BN_MAX(bnN); - NUMBYTES tSize = (NUMBYTES)nSize; - TPM_RC retVal = TPM_RC_SUCCESS; - - // Convert input parameters - BnFromBytes(bnM, m, (NUMBYTES)mSize); - BnFromBytes(bnE, e, (NUMBYTES)eSize); - BnFromBytes(bnN, n, (NUMBYTES)nSize); - - - // Make sure that the output is big enough to hold the result - // and that 'm' is less than 'n' (the modulus) - if(cSize < nSize) - ERROR_RETURN(TPM_RC_NO_RESULT); - if(BnUnsignedCmp(bnM, bnN) >= 0) - ERROR_RETURN(TPM_RC_SIZE); - BnModExp(bnC, bnM, bnE, bnN); - BnToBytes(bnC, c, &tSize); -Exit: - return retVal; -} - -//*** DivideB() -// Divide an integer ('n') by an integer ('d') producing a quotient ('q') and -// a remainder ('r'). If 'q' or 'r' is not needed, then the pointer to them -// may be set to NULL. -// -// Return Type: TPM_RC -// TPM_RC_NO_RESULT 'q' or 'r' is too small to receive the result -// -LIB_EXPORT TPM_RC -DivideB( - const TPM2B *n, // IN: numerator - const TPM2B *d, // IN: denominator - TPM2B *q, // OUT: quotient - TPM2B *r // OUT: remainder - ) -{ - BN_MAX_INITIALIZED(bnN, n); - BN_MAX_INITIALIZED(bnD, d); - BN_MAX(bnQ); - BN_MAX(bnR); -// - // Do divide with converted values - BnDiv(bnQ, bnR, bnN, bnD); - - // Convert the BIGNUM result back to 2B format using the size of the original - // number - if(q != NULL) - if(!BnTo2B(bnQ, q, q->size)) - return TPM_RC_NO_RESULT; - if(r != NULL) - if(!BnTo2B(bnR, r, r->size)) - return TPM_RC_NO_RESULT; - return TPM_RC_SUCCESS; -} - -//*** AdjustNumberB() -// Remove/add leading zeros from a number in a TPM2B. Will try to make the number -// by adding or removing leading zeros. If the number is larger than the requested -// size, it will make the number as small as possible. Setting 'requestedSize' to -// zero is equivalent to requesting that the number be normalized. -UINT16 -AdjustNumberB( - TPM2B *num, - UINT16 requestedSize - ) -{ - BYTE *from; - UINT16 i; - // See if number is already the requested size - if(num->size == requestedSize) - return requestedSize; - from = num->buffer; - if (num->size > requestedSize) - { - // This is a request to shift the number to the left (remove leading zeros) - // Find the first non-zero byte. Don't look past the point where removing - // more zeros would make the number smaller than requested, and don't throw - // away any significant digits. - for(i = num->size; *from == 0 && i > requestedSize; from++, i--); - if(i < num->size) - { - num->size = i; - MemoryCopy(num->buffer, from, i); - } - } - // This is a request to shift the number to the right (add leading zeros) - else - { - MemoryCopy(&num->buffer[requestedSize - num->size], num->buffer, num->size); - MemorySet(num->buffer, 0, requestedSize- num->size); - num->size = requestedSize; - } - return num->size; -} - -//*** ShiftLeft() -// This function shifts a byte buffer (a TPM2B) one byte to the left. That is, -// the most significant bit of the most significant byte is lost. -TPM2B * -ShiftLeft( - TPM2B *value // IN/OUT: value to shift and shifted value out -) -{ - UINT16 count = value->size; - BYTE *buffer = value->buffer; - if(count > 0) - { - for(count -= 1; count > 0; buffer++, count--) - { - buffer[0] = (buffer[0] << 1) + ((buffer[1] & 0x80) ? 1 : 0); - } - *buffer <<= 1; - } - return value; -} - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Memory.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Memory.c deleted file mode 100644 index cbfa41d32..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Memory.c +++ /dev/null @@ -1,269 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// This file contains a set of miscellaneous memory manipulation routines. Many -// of the functions have the same semantics as functions defined in string.h. -// Those functions are not used directly in the TPM because they are not 'safe' -// -// This version uses string.h after adding guards. This is because the math -// libraries invariably use those functions so it is not practical to prevent -// those library functions from being pulled into the build. - -//** Includes and Data Definitions -#include "Tpm.h" -#include "Memory_fp.h" - -//** Functions - -//*** MemoryCopy() -// This is an alias for memmove. This is used in place of memcpy because -// some of the moves may overlap and rather than try to make sure that -// memmove is used when necessary, it is always used. -void -MemoryCopy( - void *dest, - const void *src, - int sSize - ) -{ - if(dest != src) - memmove(dest, src, sSize); -} - - -//*** MemoryEqual() -// This function indicates if two buffers have the same values in the indicated -// number of bytes. -// Return Type: BOOL -// TRUE(1) all octets are the same -// FALSE(0) all octets are not the same -BOOL -MemoryEqual( - const void *buffer1, // IN: compare buffer1 - const void *buffer2, // IN: compare buffer2 - unsigned int size // IN: size of bytes being compared - ) -{ - BYTE equal = 0; - const BYTE *b1 = (BYTE *)buffer1; - const BYTE *b2 = (BYTE *)buffer2; -// - // Compare all bytes so that there is no leakage of information - // due to timing differences. - for(; size > 0; size--) - equal |= (*b1++ ^ *b2++); - return (equal == 0); -} - -//*** MemoryCopy2B() -// This function copies a TPM2B. This can be used when the TPM2B types are -// the same or different. -// -// This function returns the number of octets in the data buffer of the TPM2B. -LIB_EXPORT INT16 -MemoryCopy2B( - TPM2B *dest, // OUT: receiving TPM2B - const TPM2B *source, // IN: source TPM2B - unsigned int dSize // IN: size of the receiving buffer - ) -{ - pAssert(dest != NULL); - if(source == NULL) - dest->size = 0; - else - { - pAssert(source->size <= dSize); - MemoryCopy(dest->buffer, source->buffer, source->size); - dest->size = source->size; - } - return dest->size; -} - -//*** MemoryConcat2B() -// This function will concatenate the buffer contents of a TPM2B to an -// the buffer contents of another TPM2B and adjust the size accordingly -// ('a' := ('a' | 'b')). -void -MemoryConcat2B( - TPM2B *aInOut, // IN/OUT: destination 2B - TPM2B *bIn, // IN: second 2B - unsigned int aMaxSize // IN: The size of aInOut.buffer (max values for - // aInOut.size) - ) -{ - pAssert(bIn->size <= aMaxSize - aInOut->size); - MemoryCopy(&aInOut->buffer[aInOut->size], &bIn->buffer, bIn->size); - aInOut->size = aInOut->size + bIn->size; - return; -} - -//*** MemoryEqual2B() -// This function will compare two TPM2B structures. To be equal, they -// need to be the same size and the buffer contexts need to be the same -// in all octets. -// Return Type: BOOL -// TRUE(1) size and buffer contents are the same -// FALSE(0) size or buffer contents are not the same -BOOL -MemoryEqual2B( - const TPM2B *aIn, // IN: compare value - const TPM2B *bIn // IN: compare value - ) -{ - if(aIn->size != bIn->size) - return FALSE; - return MemoryEqual(aIn->buffer, bIn->buffer, aIn->size); -} - -//*** MemorySet() -// This function will set all the octets in the specified memory range to -// the specified octet value. -// Note: A previous version had an additional parameter (dSize) that was -// intended to make sure that the destination would not be overrun. The -// problem is that, in use, all that was happening was that the value of -// size was used for dSize so there was no benefit in the extra parameter. -void -MemorySet( - void *dest, - int value, - size_t size - ) -{ - memset(dest, value, size); -} - -//*** MemoryPad2B() -// Function to pad a TPM2B with zeros and adjust the size. -void -MemoryPad2B( - TPM2B *b, - UINT16 newSize - ) -{ - MemorySet(&b->buffer[b->size], 0, newSize - b->size); - b->size = newSize; -} - - -//*** Uint16ToByteArray() -// Function to write an integer to a byte array -void -Uint16ToByteArray( - UINT16 i, - BYTE *a - ) -{ - a[1] = (BYTE)(i); i >>= 8; - a[0] = (BYTE)(i); -} - -//*** Uint32ToByteArray() -// Function to write an integer to a byte array -void -Uint32ToByteArray( - UINT32 i, - BYTE *a - ) -{ - a[3] = (BYTE)(i); i >>= 8; - a[2] = (BYTE)(i); i >>= 8; - a[1] = (BYTE)(i); i >>= 8; - a[0] = (BYTE)(i); -} - -//*** Uint64ToByteArray() -// Function to write an integer to a byte array -void -Uint64ToByteArray( - UINT64 i, - BYTE *a - ) -{ - a[7] = (BYTE)(i); i >>= 8; - a[6] = (BYTE)(i); i >>= 8; - a[5] = (BYTE)(i); i >>= 8; - a[4] = (BYTE)(i); i >>= 8; - a[3] = (BYTE)(i); i >>= 8; - a[2] = (BYTE)(i); i >>= 8; - a[1] = (BYTE)(i); i >>= 8; - a[0] = (BYTE)(i); -} - -//*** ByteArrayToUint8() -// Function to write a UINT8 to a byte array. This is included for completeness -// and to allow certain macro expansions -UINT8 -ByteArrayToUint8( - BYTE *a -) -{ - return *a; -} - - -//*** ByteArrayToUint16() -// Function to write an integer to a byte array -UINT16 -ByteArrayToUint16( - BYTE *a -) -{ - return ((UINT16)a[0] << 8) + a[1]; -} - -//*** ByteArrayToUint32() -// Function to write an integer to a byte array -UINT32 -ByteArrayToUint32( - BYTE *a -) -{ - return (UINT32)((((((UINT32)a[0] << 8) + a[1]) << 8) + (UINT32)a[2]) << 8) + a[3]; -} - -//*** ByteArrayToUint64() -// Function to write an integer to a byte array -UINT64 -ByteArrayToUint64( - BYTE *a - ) -{ - return (((UINT64)BYTE_ARRAY_TO_UINT32(a)) << 32) + BYTE_ARRAY_TO_UINT32(&a[4]); -} - - - - - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Power.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Power.c deleted file mode 100644 index 163cd4e7d..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Power.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description - -// This file contains functions that receive the simulated power state -// transitions of the TPM. - -//** Includes and Data Definitions -#define POWER_C -#include "Tpm.h" - -//** Functions - -//*** TPMInit() -// This function is used to process a power on event. -void -TPMInit( - void - ) -{ - // Set state as not initialized. This means that Startup is required - g_initialized = FALSE; - return; -} - -//*** TPMRegisterStartup() -// This function registers the fact that the TPM has been initialized -// (a TPM2_Startup() has completed successfully). -BOOL -TPMRegisterStartup( - void - ) -{ - g_initialized = TRUE; - return TRUE; -} - -//*** TPMIsStarted() -// Indicates if the TPM has been initialized (a TPM2_Startup() has completed -// successfully after a _TPM_Init). -// Return Type: BOOL -// TRUE(1) TPM has been initialized -// FALSE(0) TPM has not been initialized -BOOL -TPMIsStarted( - void - ) -{ - return g_initialized; -} diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/PropertyCap.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/PropertyCap.c deleted file mode 100644 index 11ea8592c..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/PropertyCap.c +++ /dev/null @@ -1,597 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// This file contains the functions that are used for accessing the -// TPM_CAP_TPM_PROPERTY values. - -//** Includes - -#include "Tpm.h" - -//** Functions - -//*** TPMPropertyIsDefined() -// This function accepts a property selection and, if so, sets 'value' -// to the value of the property. -// -// All the fixed values are vendor dependent or determined by a -// platform-specific specification. The values in the table below -// are examples and should be changed by the vendor. -// Return Type: BOOL -// TRUE(1) referenced property exists and 'value' set -// FALSE(0) referenced property does not exist -static BOOL -TPMPropertyIsDefined( - TPM_PT property, // IN: property - UINT32 *value // OUT: property value - ) -{ - switch(property) - { - case TPM_PT_FAMILY_INDICATOR: - // from the title page of the specification - // For this specification, the value is "2.0". - *value = TPM_SPEC_FAMILY; - break; - case TPM_PT_LEVEL: - // from the title page of the specification - *value = TPM_SPEC_LEVEL; - break; - case TPM_PT_REVISION: - // from the title page of the specification - *value = TPM_SPEC_VERSION; - break; - case TPM_PT_DAY_OF_YEAR: - // computed from the date value on the title page of the specification - *value = TPM_SPEC_DAY_OF_YEAR; - break; - case TPM_PT_YEAR: - // from the title page of the specification - *value = TPM_SPEC_YEAR; - break; - case TPM_PT_MANUFACTURER: - // vendor ID unique to each TPM manufacturer - *value = BYTE_ARRAY_TO_UINT32(MANUFACTURER); - break; - case TPM_PT_VENDOR_STRING_1: - // first four characters of the vendor ID string - *value = BYTE_ARRAY_TO_UINT32(VENDOR_STRING_1); - break; - case TPM_PT_VENDOR_STRING_2: - // second four characters of the vendor ID string -#ifdef VENDOR_STRING_2 - *value = BYTE_ARRAY_TO_UINT32(VENDOR_STRING_2); -#else - *value = 0; -#endif - break; - case TPM_PT_VENDOR_STRING_3: - // third four characters of the vendor ID string -#ifdef VENDOR_STRING_3 - *value = BYTE_ARRAY_TO_UINT32(VENDOR_STRING_3); -#else - *value = 0; -#endif - break; - case TPM_PT_VENDOR_STRING_4: - // fourth four characters of the vendor ID string -#ifdef VENDOR_STRING_4 - *value = BYTE_ARRAY_TO_UINT32(VENDOR_STRING_4); -#else - *value = 0; -#endif - break; - case TPM_PT_VENDOR_TPM_TYPE: - // vendor-defined value indicating the TPM model - *value = 1; - break; - case TPM_PT_FIRMWARE_VERSION_1: - // more significant 32-bits of a vendor-specific value - *value = gp.firmwareV1; - break; - case TPM_PT_FIRMWARE_VERSION_2: - // less significant 32-bits of a vendor-specific value - *value = gp.firmwareV2; - break; - case TPM_PT_INPUT_BUFFER: - // maximum size of TPM2B_MAX_BUFFER - *value = MAX_DIGEST_BUFFER; - break; - case TPM_PT_HR_TRANSIENT_MIN: - // minimum number of transient objects that can be held in TPM - // RAM - *value = MAX_LOADED_OBJECTS; - break; - case TPM_PT_HR_PERSISTENT_MIN: - // minimum number of persistent objects that can be held in - // TPM NV memory - // In this implementation, there is no minimum number of - // persistent objects. - *value = MIN_EVICT_OBJECTS; - break; - case TPM_PT_HR_LOADED_MIN: - // minimum number of authorization sessions that can be held in - // TPM RAM - *value = MAX_LOADED_SESSIONS; - break; - case TPM_PT_ACTIVE_SESSIONS_MAX: - // number of authorization sessions that may be active at a time - *value = MAX_ACTIVE_SESSIONS; - break; - case TPM_PT_PCR_COUNT: - // number of PCR implemented - *value = IMPLEMENTATION_PCR; - break; - case TPM_PT_PCR_SELECT_MIN: - // minimum number of bytes in a TPMS_PCR_SELECT.sizeOfSelect - *value = PCR_SELECT_MIN; - break; - case TPM_PT_CONTEXT_GAP_MAX: - // maximum allowed difference (unsigned) between the contextID - // values of two saved session contexts - *value = ((UINT32)1 << (sizeof(CONTEXT_SLOT) * 8)) - 1; - break; - case TPM_PT_NV_COUNTERS_MAX: - // maximum number of NV indexes that are allowed to have the - // TPMA_NV_COUNTER attribute SET - // In this implementation, there is no limitation on the number - // of counters, except for the size of the NV Index memory. - *value = 0; - break; - case TPM_PT_NV_INDEX_MAX: - // maximum size of an NV index data area - *value = MAX_NV_INDEX_SIZE; - break; - case TPM_PT_MEMORY: - // a TPMA_MEMORY indicating the memory management method for the TPM - { - union - { - TPMA_MEMORY att; - UINT32 u32; - } attributes = { TPMA_ZERO_INITIALIZER() }; - SET_ATTRIBUTE(attributes.att, TPMA_MEMORY, sharedNV); - SET_ATTRIBUTE(attributes.att, TPMA_MEMORY, objectCopiedToRam); - - // Note: For a LSb0 machine, the bits in a bit field are in the correct - // order even if the machine is MSB0. For a MSb0 machine, a TPMA will - // be an integer manipulated by masking (USE_BIT_FIELD_STRUCTURES will - // be NO) so the bits are manipulate correctly. - *value = attributes.u32; - break; - } - case TPM_PT_CLOCK_UPDATE: - // interval, in seconds, between updates to the copy of - // TPMS_TIME_INFO .clock in NV - *value = (1 << NV_CLOCK_UPDATE_INTERVAL); - break; - case TPM_PT_CONTEXT_HASH: - // algorithm used for the integrity hash on saved contexts and - // for digesting the fuData of TPM2_FirmwareRead() - *value = CONTEXT_INTEGRITY_HASH_ALG; - break; - case TPM_PT_CONTEXT_SYM: - // algorithm used for encryption of saved contexts - *value = CONTEXT_ENCRYPT_ALG; - break; - case TPM_PT_CONTEXT_SYM_SIZE: - // size of the key used for encryption of saved contexts - *value = CONTEXT_ENCRYPT_KEY_BITS; - break; - case TPM_PT_ORDERLY_COUNT: - // maximum difference between the volatile and non-volatile - // versions of TPMA_NV_COUNTER that have TPMA_NV_ORDERLY SET - *value = MAX_ORDERLY_COUNT; - break; - case TPM_PT_MAX_COMMAND_SIZE: - // maximum value for 'commandSize' - *value = MAX_COMMAND_SIZE; - break; - case TPM_PT_MAX_RESPONSE_SIZE: - // maximum value for 'responseSize' - *value = MAX_RESPONSE_SIZE; - break; - case TPM_PT_MAX_DIGEST: - // maximum size of a digest that can be produced by the TPM - *value = sizeof(TPMU_HA); - break; - case TPM_PT_MAX_OBJECT_CONTEXT: -// Header has 'sequence', 'handle' and 'hierarchy' -#define SIZE_OF_CONTEXT_HEADER \ - sizeof(UINT64) + sizeof(TPMI_DH_CONTEXT) + sizeof(TPMI_RH_HIERARCHY) -#define SIZE_OF_CONTEXT_INTEGRITY (sizeof(UINT16) + CONTEXT_INTEGRITY_HASH_SIZE) -#define SIZE_OF_FINGERPRINT sizeof(UINT64) -#define SIZE_OF_CONTEXT_BLOB_OVERHEAD \ - (sizeof(UINT16) + SIZE_OF_CONTEXT_INTEGRITY + SIZE_OF_FINGERPRINT) -#define SIZE_OF_CONTEXT_OVERHEAD \ - (SIZE_OF_CONTEXT_HEADER + SIZE_OF_CONTEXT_BLOB_OVERHEAD) -#if 0 - // maximum size of a TPMS_CONTEXT that will be returned by - // TPM2_ContextSave for object context - *value = 0; - // adding sequence, saved handle and hierarchy - *value += sizeof(UINT64) + sizeof(TPMI_DH_CONTEXT) + - sizeof(TPMI_RH_HIERARCHY); - // add size field in TPM2B_CONTEXT - *value += sizeof(UINT16); - // add integrity hash size - *value += sizeof(UINT16) + - CryptHashGetDigestSize(CONTEXT_INTEGRITY_HASH_ALG); - // Add fingerprint size, which is the same as sequence size - *value += sizeof(UINT64); - // Add OBJECT structure size - *value += sizeof(OBJECT); -#else - // the maximum size of a TPMS_CONTEXT that will be returned by - // TPM2_ContextSave for object context - *value = SIZE_OF_CONTEXT_OVERHEAD + sizeof(OBJECT); -#endif - break; - case TPM_PT_MAX_SESSION_CONTEXT: -#if 0 - - // the maximum size of a TPMS_CONTEXT that will be returned by - // TPM2_ContextSave for object context - *value = 0; - // adding sequence, saved handle and hierarchy - *value += sizeof(UINT64) + sizeof(TPMI_DH_CONTEXT) + - sizeof(TPMI_RH_HIERARCHY); - // Add size field in TPM2B_CONTEXT - *value += sizeof(UINT16); -// Add integrity hash size - *value += sizeof(UINT16) + - CryptHashGetDigestSize(CONTEXT_INTEGRITY_HASH_ALG); - // Add fingerprint size, which is the same as sequence size - *value += sizeof(UINT64); - // Add SESSION structure size - *value += sizeof(SESSION); -#else - // the maximum size of a TPMS_CONTEXT that will be returned by - // TPM2_ContextSave for object context - *value = SIZE_OF_CONTEXT_OVERHEAD + sizeof(SESSION); -#endif - break; - case TPM_PT_PS_FAMILY_INDICATOR: - // platform specific values for the TPM_PT_PS parameters from - // the relevant platform-specific specification - // In this reference implementation, all of these values are 0. - *value = PLATFORM_FAMILY; - break; - case TPM_PT_PS_LEVEL: - // level of the platform-specific specification - *value = PLATFORM_LEVEL; - break; - case TPM_PT_PS_REVISION: - // specification Revision times 100 for the platform-specific - // specification - *value = PLATFORM_VERSION; - break; - case TPM_PT_PS_DAY_OF_YEAR: - // platform-specific specification day of year using TCG calendar - *value = PLATFORM_DAY_OF_YEAR; - break; - case TPM_PT_PS_YEAR: - // platform-specific specification year using the CE - *value = PLATFORM_YEAR; - break; - case TPM_PT_SPLIT_MAX: - // number of split signing operations supported by the TPM - *value = 0; -#if ALG_ECC - *value = sizeof(gr.commitArray) * 8; -#endif - break; - case TPM_PT_TOTAL_COMMANDS: - // total number of commands implemented in the TPM - // Since the reference implementation does not have any - // vendor-defined commands, this will be the same as the - // number of library commands. - { -#if COMPRESSED_LISTS - (*value) = COMMAND_COUNT; -#else - COMMAND_INDEX commandIndex; - *value = 0; - - // scan all implemented commands - for(commandIndex = GetClosestCommandIndex(0); - commandIndex != UNIMPLEMENTED_COMMAND_INDEX; - commandIndex = GetNextCommandIndex(commandIndex)) - { - (*value)++; // count of all implemented - } -#endif - break; - } - case TPM_PT_LIBRARY_COMMANDS: - // number of commands from the TPM library that are implemented - { -#if COMPRESSED_LISTS - *value = LIBRARY_COMMAND_ARRAY_SIZE; -#else - COMMAND_INDEX commandIndex; - *value = 0; - - // scan all implemented commands - for(commandIndex = GetClosestCommandIndex(0); - commandIndex < LIBRARY_COMMAND_ARRAY_SIZE; - commandIndex = GetNextCommandIndex(commandIndex)) - { - (*value)++; - } -#endif - break; - } - case TPM_PT_VENDOR_COMMANDS: - // number of vendor commands that are implemented - *value = VENDOR_COMMAND_ARRAY_SIZE; - break; - case TPM_PT_NV_BUFFER_MAX: - // Maximum data size in an NV write command - *value = MAX_NV_BUFFER_SIZE; - break; - case TPM_PT_MODES: -#if FIPS_COMPLIANT - *value = 1; -#else - *value = 0; -#endif - break; - case TPM_PT_MAX_CAP_BUFFER: - *value = MAX_CAP_BUFFER; - break; - - // Start of variable commands - case TPM_PT_PERMANENT: - // TPMA_PERMANENT - { - union { - TPMA_PERMANENT attr; - UINT32 u32; - } flags = { TPMA_ZERO_INITIALIZER() }; - if(gp.ownerAuth.t.size != 0) - SET_ATTRIBUTE(flags.attr, TPMA_PERMANENT, ownerAuthSet); - if(gp.endorsementAuth.t.size != 0) - SET_ATTRIBUTE(flags.attr, TPMA_PERMANENT, endorsementAuthSet); - if(gp.lockoutAuth.t.size != 0) - SET_ATTRIBUTE(flags.attr, TPMA_PERMANENT, lockoutAuthSet); - if(gp.disableClear) - SET_ATTRIBUTE(flags.attr, TPMA_PERMANENT, disableClear); - if(gp.failedTries >= gp.maxTries) - SET_ATTRIBUTE(flags.attr, TPMA_PERMANENT, inLockout); - // In this implementation, EPS is always generated by TPM - SET_ATTRIBUTE(flags.attr, TPMA_PERMANENT, tpmGeneratedEPS); - - // Note: For a LSb0 machine, the bits in a bit field are in the correct - // order even if the machine is MSB0. For a MSb0 machine, a TPMA will - // be an integer manipulated by masking (USE_BIT_FIELD_STRUCTURES will - // be NO) so the bits are manipulate correctly. - *value = flags.u32; - break; - } - case TPM_PT_STARTUP_CLEAR: - // TPMA_STARTUP_CLEAR - { - union { - TPMA_STARTUP_CLEAR attr; - UINT32 u32; - } flags = { TPMA_ZERO_INITIALIZER() }; -// - if(g_phEnable) - SET_ATTRIBUTE(flags.attr, TPMA_STARTUP_CLEAR, phEnable); - if(gc.shEnable) - SET_ATTRIBUTE(flags.attr, TPMA_STARTUP_CLEAR, shEnable); - if(gc.ehEnable) - SET_ATTRIBUTE(flags.attr, TPMA_STARTUP_CLEAR, ehEnable); - if(gc.phEnableNV) - SET_ATTRIBUTE(flags.attr, TPMA_STARTUP_CLEAR, phEnableNV); - if(g_prevOrderlyState != SU_NONE_VALUE) - SET_ATTRIBUTE(flags.attr, TPMA_STARTUP_CLEAR, orderly); - - // Note: For a LSb0 machine, the bits in a bit field are in the correct - // order even if the machine is MSB0. For a MSb0 machine, a TPMA will - // be an integer manipulated by masking (USE_BIT_FIELD_STRUCTURES will - // be NO) so the bits are manipulate correctly. - *value = flags.u32; - break; - } - case TPM_PT_HR_NV_INDEX: - // number of NV indexes currently defined - *value = NvCapGetIndexNumber(); - break; - case TPM_PT_HR_LOADED: - // number of authorization sessions currently loaded into TPM - // RAM - *value = SessionCapGetLoadedNumber(); - break; - case TPM_PT_HR_LOADED_AVAIL: - // number of additional authorization sessions, of any type, - // that could be loaded into TPM RAM - *value = SessionCapGetLoadedAvail(); - break; - case TPM_PT_HR_ACTIVE: - // number of active authorization sessions currently being - // tracked by the TPM - *value = SessionCapGetActiveNumber(); - break; - case TPM_PT_HR_ACTIVE_AVAIL: - // number of additional authorization sessions, of any type, - // that could be created - *value = SessionCapGetActiveAvail(); - break; - case TPM_PT_HR_TRANSIENT_AVAIL: - // estimate of the number of additional transient objects that - // could be loaded into TPM RAM - *value = ObjectCapGetTransientAvail(); - break; - case TPM_PT_HR_PERSISTENT: - // number of persistent objects currently loaded into TPM - // NV memory - *value = NvCapGetPersistentNumber(); - break; - case TPM_PT_HR_PERSISTENT_AVAIL: - // number of additional persistent objects that could be loaded - // into NV memory - *value = NvCapGetPersistentAvail(); - break; - case TPM_PT_NV_COUNTERS: - // number of defined NV indexes that have NV TPMA_NV_COUNTER - // attribute SET - *value = NvCapGetCounterNumber(); - break; - case TPM_PT_NV_COUNTERS_AVAIL: - // number of additional NV indexes that can be defined with their - // TPMA_NV_COUNTER attribute SET - *value = NvCapGetCounterAvail(); - break; - case TPM_PT_ALGORITHM_SET: - // region code for the TPM - *value = gp.algorithmSet; - break; - case TPM_PT_LOADED_CURVES: -#if ALG_ECC - // number of loaded ECC curves - *value = ECC_CURVE_COUNT; -#else // ALG_ECC - *value = 0; -#endif // ALG_ECC - break; - case TPM_PT_LOCKOUT_COUNTER: - // current value of the lockout counter - *value = gp.failedTries; - break; - case TPM_PT_MAX_AUTH_FAIL: - // number of authorization failures before DA lockout is invoked - *value = gp.maxTries; - break; - case TPM_PT_LOCKOUT_INTERVAL: - // number of seconds before the value reported by - // TPM_PT_LOCKOUT_COUNTER is decremented - *value = gp.recoveryTime; - break; - case TPM_PT_LOCKOUT_RECOVERY: - // number of seconds after a lockoutAuth failure before use of - // lockoutAuth may be attempted again - *value = gp.lockoutRecovery; - break; - case TPM_PT_NV_WRITE_RECOVERY: - // number of milliseconds before the TPM will accept another command - // that will modify NV. - // This should make a call to the platform code that is doing rate - // limiting of NV. Rate limiting is not implemented in the reference - // code so no call is made. - *value = 0; - break; - case TPM_PT_AUDIT_COUNTER_0: - // high-order 32 bits of the command audit counter - *value = (UINT32)(gp.auditCounter >> 32); - break; - case TPM_PT_AUDIT_COUNTER_1: - // low-order 32 bits of the command audit counter - *value = (UINT32)(gp.auditCounter); - break; - default: - // property is not defined - return FALSE; - break; - } - return TRUE; -} - -//*** TPMCapGetProperties() -// This function is used to get the TPM_PT values. The search of properties will -// start at 'property' and continue until 'propertyList' has as many values as -// will fit, or the last property has been reported, or the list has as many -// values as requested in 'count'. -// Return Type: TPMI_YES_NO -// YES more properties are available -// NO no more properties to be reported -TPMI_YES_NO -TPMCapGetProperties( - TPM_PT property, // IN: the starting TPM property - UINT32 count, // IN: maximum number of returned - // properties - TPML_TAGGED_TPM_PROPERTY *propertyList // OUT: property list - ) -{ - TPMI_YES_NO more = NO; - UINT32 i; - UINT32 nextGroup; - - // initialize output property list - propertyList->count = 0; - - // maximum count of properties we may return is MAX_PCR_PROPERTIES - if(count > MAX_TPM_PROPERTIES) count = MAX_TPM_PROPERTIES; - - // if property is less than PT_FIXED, start from PT_FIXED - if(property < PT_FIXED) - property = PT_FIXED; - // There is only the fixed and variable groups with the variable group coming - // last - if(property >= (PT_VAR + PT_GROUP)) - return more; - - // Don't read past the end of the selected group - nextGroup = ((property / PT_GROUP) * PT_GROUP) + PT_GROUP; - - // Scan through the TPM properties of the requested group. - for(i = property; i < nextGroup; i++) - { - UINT32 value; - // if we have hit the end of the group, quit - if(i != property && ((i % PT_GROUP) == 0)) - break; - if(TPMPropertyIsDefined((TPM_PT)i, &value)) - { - if(propertyList->count < count) - { - // If the list is not full, add this property - propertyList->tpmProperty[propertyList->count].property = - (TPM_PT)i; - propertyList->tpmProperty[propertyList->count].value = value; - propertyList->count++; - } - else - { - // If the return list is full but there are more properties - // available, set the indication and exit the loop. - more = YES; - break; - } - } - } - return more; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Response.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Response.c deleted file mode 100644 index 273182eb1..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/Response.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// This file contains the common code for building a response header, including -// setting the size of the structure. 'command' may be NULL if result is -// not TPM_RC_SUCCESS. - -//** Includes and Defines -#include "Tpm.h" - -//** BuildResponseHeader() -// Adds the response header to the response. It will update command->parameterSize -// to indicate the total size of the response. -void -BuildResponseHeader( - COMMAND *command, // IN: main control structure - BYTE *buffer, // OUT: the output buffer - TPM_RC result // IN: the response code - ) -{ - TPM_ST tag; - UINT32 size; - - if(result != TPM_RC_SUCCESS) - { - tag = TPM_ST_NO_SESSIONS; - size = 10; - } - else - { - tag = command->tag; - // Compute the overall size of the response - size = STD_RESPONSE_HEADER + command->handleNum * sizeof(TPM_HANDLE); - size += command->parameterSize; - size += (command->tag == TPM_ST_SESSIONS) ? - command->authSize + sizeof(UINT32) : 0; - } - TPM_ST_Marshal(&tag, &buffer, NULL); - UINT32_Marshal(&size, &buffer, NULL); - TPM_RC_Marshal(&result, &buffer, NULL); - if(result == TPM_RC_SUCCESS) - { - if(command->handleNum > 0) - TPM_HANDLE_Marshal(&command->handles[0], &buffer, NULL); - if(tag == TPM_ST_SESSIONS) - UINT32_Marshal((UINT32 *)&command->parameterSize, &buffer, NULL); - } - command->parameterSize = size; -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/ResponseCodeProcessing.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/ResponseCodeProcessing.c deleted file mode 100644 index 24ff447a7..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/ResponseCodeProcessing.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Description -// This file contains the miscellaneous functions for processing response codes. -// NOTE: Currently, there is only one. - -//** Includes and Defines -#include "Tpm.h" - -//** RcSafeAddToResult() -// Adds a modifier to a response code as long as the response code allows a modifier -// and no modifier has already been added. -TPM_RC -RcSafeAddToResult( - TPM_RC responseCode, - TPM_RC modifier - ) -{ - if((responseCode & RC_FMT1) && !(responseCode & 0xf40)) - return responseCode + modifier; - else - return responseCode; -} - - diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/TpmFail.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/TpmFail.c deleted file mode 100644 index b4463d3d0..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/TpmFail.c +++ /dev/null @@ -1,454 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes, Defines, and Types -#define TPM_FAIL_C -#include "Tpm.h" -#include - -// On MS C compiler, can save the alignment state and set the alignment to 1 for -// the duration of the TpmTypes.h include. This will avoid a lot of alignment -// warnings from the compiler for the unaligned structures. The alignment of the -// structures is not important as this function does not use any of the structures -// in TpmTypes.h and only include it for the #defines of the capabilities, -// properties, and command code values. -#include "TpmTypes.h" - -//** Typedefs -// These defines are used primarily for sizing of the local response buffer. -typedef struct -{ - TPM_ST tag; - UINT32 size; - TPM_RC code; -} HEADER; - -typedef struct -{ - BYTE tag[sizeof(TPM_ST)]; - BYTE size[sizeof(UINT32)]; - BYTE code[sizeof(TPM_RC)]; -} PACKED_HEADER; - -typedef struct -{ - BYTE size[sizeof(UINT16)]; - struct - { - BYTE function[sizeof(UINT32)]; - BYTE line[sizeof(UINT32)]; - BYTE code[sizeof(UINT32)]; - } values; - BYTE returnCode[sizeof(TPM_RC)]; -} GET_TEST_RESULT_PARAMETERS; - -typedef struct -{ - BYTE moreData[sizeof(TPMI_YES_NO)]; - BYTE capability[sizeof(TPM_CAP)]; // Always TPM_CAP_TPM_PROPERTIES - BYTE tpmProperty[sizeof(TPML_TAGGED_TPM_PROPERTY)]; -} GET_CAPABILITY_PARAMETERS; - -typedef struct -{ - BYTE header[sizeof(PACKED_HEADER)]; - BYTE getTestResult[sizeof(GET_TEST_RESULT_PARAMETERS)]; -} TEST_RESPONSE; - -typedef struct -{ - BYTE header[sizeof(PACKED_HEADER)]; - BYTE getCap[sizeof(GET_CAPABILITY_PARAMETERS)]; -} CAPABILITY_RESPONSE; - -typedef union -{ - BYTE test[sizeof(TEST_RESPONSE)]; - BYTE cap[sizeof(CAPABILITY_RESPONSE)]; -} RESPONSES; - -// Buffer to hold the responses. This may be a little larger than -// required due to padding that a compiler might add. -// Note: This is not in Global.c because of the specialized data definitions above. -// Since the data contained in this structure is not relevant outside of the -// execution of a single command (when the TPM is in failure mode. There is no -// compelling reason to move all the typedefs to Global.h and this structure -// to Global.c. -#ifndef __IGNORE_STATE__ // Don't define this value -static BYTE response[sizeof(RESPONSES)]; -#endif - -//** Local Functions - -//*** MarshalUint16() -// Function to marshal a 16 bit value to the output buffer. -static INT32 -MarshalUint16( - UINT16 integer, - BYTE **buffer - ) -{ - UINT16_TO_BYTE_ARRAY(integer, *buffer); - *buffer += 2; - return 2; -} - -//*** MarshalUint32() -// Function to marshal a 32 bit value to the output buffer. -static INT32 -MarshalUint32( - UINT32 integer, - BYTE **buffer - ) -{ - UINT32_TO_BYTE_ARRAY(integer, *buffer); - *buffer += 4; - return 4; -} - -//***Unmarshal32() -static BOOL Unmarshal32( - UINT32 *target, - BYTE **buffer, - INT32 *size - ) -{ - if((*size -= 4) < 0) - return FALSE; - *target = BYTE_ARRAY_TO_UINT32(*buffer); - *buffer += 4; - return TRUE; -} - -//***Unmarshal16() -static BOOL Unmarshal16( - UINT16 *target, - BYTE **buffer, - INT32 *size -) -{ - if((*size -= 2) < 0) - return FALSE; - *target = BYTE_ARRAY_TO_UINT16(*buffer); - *buffer += 2; - return TRUE; -} - -//** Public Functions - -//*** SetForceFailureMode() -// This function is called by the simulator to enable failure mode testing. -#if SIMULATION -LIB_EXPORT void -SetForceFailureMode( - void - ) -{ - g_forceFailureMode = TRUE; - return; -} -#endif - -//*** TpmLogFailure() -// This function saves the failure values when the code will continue to operate. It -// if similar to TpmFail() but returns to the caller. The assumption is that the -// caller will propagate a failure back up the stack. -void -TpmLogFailure( -#if FAIL_TRACE - const char *function, - int line, -#endif - int code -) -{ - // Save the values that indicate where the error occurred. - // On a 64-bit machine, this may truncate the address of the string - // of the function name where the error occurred. -#if FAIL_TRACE - s_failFunction = (UINT32)(ptrdiff_t)function; - s_failLine = line; -#else - s_failFunction = 0; - s_failLine = 0; -#endif - s_failCode = code; - - // We are in failure mode - g_inFailureMode = TRUE; - - return; -} - -//*** TpmFail() -// This function is called by TPM.lib when a failure occurs. It will set up the -// failure values to be returned on TPM2_GetTestResult(). -NORETURN void -TpmFail( -#if FAIL_TRACE - const char *function, - int line, -#endif - int code - ) -{ - // Save the values that indicate where the error occurred. - // On a 64-bit machine, this may truncate the address of the string - // of the function name where the error occurred. -#if FAIL_TRACE - s_failFunction = (UINT32)(ptrdiff_t)function; - s_failLine = line; -#else - s_failFunction = (UINT32)(ptrdiff_t)NULL; - s_failLine = 0; -#endif - s_failCode = code; - - // We are in failure mode - g_inFailureMode = TRUE; - - // if asserts are enabled, then do an assert unless the failure mode code - // is being tested. -#if SIMULATION -# ifndef NDEBUG - assert(g_forceFailureMode); -# endif - // Clear this flag - g_forceFailureMode = FALSE; -#endif - // Jump to the failure mode code. - // Note: only get here if asserts are off or if we are testing failure mode - _plat__Fail(); -} - -//*** TpmFailureMode( -// This function is called by the interface code when the platform is in failure -// mode. -void -TpmFailureMode( - unsigned int inRequestSize, // IN: command buffer size - unsigned char *inRequest, // IN: command buffer - unsigned int *outResponseSize, // OUT: response buffer size - unsigned char **outResponse // OUT: response buffer - ) -{ - UINT32 marshalSize; - UINT32 capability; - HEADER header; // unmarshaled command header - UINT32 pt; // unmarshaled property type - UINT32 count; // unmarshaled property count - UINT8 *buffer = inRequest; - INT32 size = inRequestSize; - - // If there is no command buffer, then just return TPM_RC_FAILURE - if(inRequestSize == 0 || inRequest == NULL) - goto FailureModeReturn; - // If the header is not correct for TPM2_GetCapability() or - // TPM2_GetTestResult() then just return the in failure mode response; - if(! (Unmarshal16(&header.tag, &buffer, &size) - && Unmarshal32(&header.size, &buffer, &size) - && Unmarshal32(&header.code, &buffer, &size))) - goto FailureModeReturn; - if(header.tag != TPM_ST_NO_SESSIONS - || header.size < 10) - goto FailureModeReturn; - switch(header.code) - { - case TPM_CC_GetTestResult: - // make sure that the command size is correct - if(header.size != 10) - goto FailureModeReturn; - buffer = &response[10]; - marshalSize = MarshalUint16(3 * sizeof(UINT32), &buffer); - marshalSize += MarshalUint32(s_failFunction, &buffer); - marshalSize += MarshalUint32(s_failLine, &buffer); - marshalSize += MarshalUint32(s_failCode, &buffer); - if(s_failCode == FATAL_ERROR_NV_UNRECOVERABLE) - marshalSize += MarshalUint32(TPM_RC_NV_UNINITIALIZED, &buffer); - else - marshalSize += MarshalUint32(TPM_RC_FAILURE, &buffer); - break; - case TPM_CC_GetCapability: - // make sure that the size of the command is exactly the size - // returned for the capability, property, and count - if(header.size != (10 + (3 * sizeof(UINT32))) - // also verify that this is requesting TPM properties - || !Unmarshal32(&capability, &buffer, &size) - || capability != TPM_CAP_TPM_PROPERTIES - || !Unmarshal32(&pt, &buffer, &size) - || !Unmarshal32(&count, &buffer, &size)) - goto FailureModeReturn; - // If in failure mode because of an unrecoverable read error, and the - // property is 0 and the count is 0, then this is an indication to - // re-manufacture the TPM. Do the re-manufacture but stay in failure - // mode until the TPM is reset. - // Note: this behavior is not required by the specification and it is - // OK to leave the TPM permanently bricked due to an unrecoverable NV - // error. - if(count == 0 && pt == 0 && s_failCode == FATAL_ERROR_NV_UNRECOVERABLE) - { - g_manufactured = FALSE; - TPM_Manufacture(0); - } - if(count > 0) - count = 1; - else if(pt > TPM_PT_FIRMWARE_VERSION_2) - count = 0; - if(pt < TPM_PT_MANUFACTURER) - pt = TPM_PT_MANUFACTURER; - // set up for return - buffer = &response[10]; - // if the request was for a PT less than the last one - // then we indicate more, otherwise, not. - if(pt < TPM_PT_FIRMWARE_VERSION_2) - *buffer++ = YES; - else - *buffer++ = NO; - marshalSize = 1; - - // indicate the capability type - marshalSize += MarshalUint32(capability, &buffer); - // indicate the number of values that are being returned (0 or 1) - marshalSize += MarshalUint32(count, &buffer); - // indicate the property - marshalSize += MarshalUint32(pt, &buffer); - - if(count > 0) - switch(pt) - { - case TPM_PT_MANUFACTURER: - // the vendor ID unique to each TPM manufacturer -#ifdef MANUFACTURER - pt = *(UINT32*)MANUFACTURER; -#else - pt = 0; -#endif - break; - case TPM_PT_VENDOR_STRING_1: - // the first four characters of the vendor ID string -#ifdef VENDOR_STRING_1 - pt = *(UINT32*)VENDOR_STRING_1; -#else - pt = 0; -#endif - break; - case TPM_PT_VENDOR_STRING_2: - // the second four characters of the vendor ID string -#ifdef VENDOR_STRING_2 - pt = *(UINT32*)VENDOR_STRING_2; -#else - pt = 0; -#endif - break; - case TPM_PT_VENDOR_STRING_3: - // the third four characters of the vendor ID string -#ifdef VENDOR_STRING_3 - pt = *(UINT32*)VENDOR_STRING_3; -#else - pt = 0; -#endif - break; - case TPM_PT_VENDOR_STRING_4: - // the fourth four characters of the vendor ID string -#ifdef VENDOR_STRING_4 - pt = *(UINT32*)VENDOR_STRING_4; -#else - pt = 0; -#endif - break; - case TPM_PT_VENDOR_TPM_TYPE: - // vendor-defined value indicating the TPM model - // We just make up a number here - pt = 1; - break; - case TPM_PT_FIRMWARE_VERSION_1: - // the more significant 32-bits of a vendor-specific value - // indicating the version of the firmware -#ifdef FIRMWARE_V1 - pt = FIRMWARE_V1; -#else - pt = 0; -#endif - break; - default: // TPM_PT_FIRMWARE_VERSION_2: - // the less significant 32-bits of a vendor-specific value - // indicating the version of the firmware -#ifdef FIRMWARE_V2 - pt = FIRMWARE_V2; -#else - pt = 0; -#endif - break; - } - marshalSize += MarshalUint32(pt, &buffer); - break; - default: // default for switch (cc) - goto FailureModeReturn; - } - // Now do the header - buffer = response; - marshalSize = marshalSize + 10; // Add the header size to the - // stuff already marshaled - MarshalUint16(TPM_ST_NO_SESSIONS, &buffer); // structure tag - MarshalUint32(marshalSize, &buffer); // responseSize - MarshalUint32(TPM_RC_SUCCESS, &buffer); // response code - - *outResponseSize = marshalSize; - *outResponse = (unsigned char *)&response; - return; -FailureModeReturn: - buffer = response; - marshalSize = MarshalUint16(TPM_ST_NO_SESSIONS, &buffer); - marshalSize += MarshalUint32(10, &buffer); - marshalSize += MarshalUint32(TPM_RC_FAILURE, &buffer); - *outResponseSize = marshalSize; - *outResponse = (unsigned char *)response; - return; -} - -//*** UnmarshalFail() -// This is a stub that is used to catch an attempt to unmarshal an entry -// that is not defined. Don't ever expect this to be called but... -void -UnmarshalFail( - void *type, - BYTE **buffer, - INT32 *size - ) -{ - NOT_REFERENCED(type); - NOT_REFERENCED(buffer); - NOT_REFERENCED(size); - FAIL(FATAL_ERROR_INTERNAL); -} \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/TpmSizeChecks.c b/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/TpmSizeChecks.c deleted file mode 100644 index e8a0e76a4..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/ms-tpm-20-ref/TPMCmd/tpm/src/support/TpmSizeChecks.c +++ /dev/null @@ -1,171 +0,0 @@ -/* Microsoft Reference Implementation for TPM 2.0 - * - * The copyright in this software is being made available under the BSD License, - * included below. This software may be subject to other third party and - * contributor rights, including patent rights, and no such rights are granted - * under this license. - * - * Copyright (c) Microsoft Corporation - * - * All rights reserved. - * - * BSD License - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -//** Includes, Defines, and Types -#include "Tpm.h" -#include - -#if RUNTIME_SIZE_CHECKS - -static int once = 0; - -//** TpmSizeChecks() -// This function is used during the development process to make sure that the -// vendor-specific values result in a consistent implementation. When possible, -// the code contains #if to do compile-time checks. However, in some cases, the -// values require the use of "sizeof()" and that can't be used in an #if. -void -TpmSizeChecks( - void - ) -{ -#if DEBUG - if(once++ != 0) return; - { - BOOL PASS = TRUE; - UINT32 maxAsymSecurityStrength = MAX_ASYM_SECURITY_STRENGTH; - UINT32 maxHashSecurityStrength = MAX_HASH_SECURITY_STRENGTH; - UINT32 maxSymSecurityStrength = MAX_SYM_SECURITY_STRENGTH; - UINT32 maxSecurityStrengthBits = MAX_SECURITY_STRENGTH_BITS; - UINT32 proofSize = PROOF_SIZE; - UINT32 compliantProofSize = COMPLIANT_PROOF_SIZE; - UINT32 compliantPrimarySeedSize = COMPLIANT_PRIMARY_SEED_SIZE; - UINT32 primarySeedSize = PRIMARY_SEED_SIZE; - - UINT32 cmacState = sizeof(tpmCmacState_t); - UINT32 hashState = sizeof(HASH_STATE); - UINT32 keyScheduleSize = sizeof(tpmCryptKeySchedule_t); - // - NOT_REFERENCED(cmacState); - NOT_REFERENCED(hashState); - NOT_REFERENCED(keyScheduleSize); - NOT_REFERENCED(maxAsymSecurityStrength); - NOT_REFERENCED(maxHashSecurityStrength); - NOT_REFERENCED(maxSymSecurityStrength); - NOT_REFERENCED(maxSecurityStrengthBits); - NOT_REFERENCED(proofSize); - NOT_REFERENCED(compliantProofSize); - NOT_REFERENCED(compliantPrimarySeedSize); - NOT_REFERENCED(primarySeedSize); - - - { - TPMT_SENSITIVE *p; - // This assignment keeps compiler from complaining about a conditional - // comparison being between two constants - UINT16 max_rsa_key_bytes = MAX_RSA_KEY_BYTES; - if((max_rsa_key_bytes / 2) != (sizeof(p->sensitive.rsa.t.buffer) / 5)) - { - printf("Sensitive part of TPMT_SENSITIVE is undersized. May be caused by" - "use of wrong version of Part 2.\n"); - PASS = FALSE; - } - } - -#if 0 - printf("Size of OBJECT = %d\n", sizeof(OBJECT)); - printf("Size of components in TPMT_SENSITIVE = %d\n", sizeof(TPMT_SENSITIVE)); - printf(" TPMI_ALG_PUBLIC %d\n", sizeof(TPMI_ALG_PUBLIC)); - printf(" TPM2B_AUTH %d\n", sizeof(TPM2B_AUTH)); - printf(" TPM2B_DIGEST %d\n", sizeof(TPM2B_DIGEST)); - printf(" TPMU_SENSITIVE_COMPOSITE %d\n", - sizeof(TPMU_SENSITIVE_COMPOSITE)); -#endif - // Make sure that the size of the context blob is large enough for the largest - // context - // TPMS_CONTEXT_DATA contains two TPM2B values. That is not how this is - // implemented. Rather, the size field of the TPM2B_CONTEXT_DATA is used to - // determine the amount of data in the encrypted data. That part is not - // independently sized. This makes the actual size 2 bytes smaller than - // calculated using Part 2. Since this is opaque to the caller, it is not - // necessary to fix. The actual size is returned by TPM2_GetCapabilties(). - - // Initialize output handle. At the end of command action, the output - // handle of an object will be replaced, while the output handle - // for a session will be the same as input - - // Get the size of fingerprint in context blob. The sequence value in - // TPMS_CONTEXT structure is used as the fingerprint - { - UINT32 fingerprintSize = sizeof(UINT64); - UINT32 integritySize = sizeof(UINT16) - + CryptHashGetDigestSize(CONTEXT_INTEGRITY_HASH_ALG); - UINT32 biggestObject = MAX(MAX(sizeof(HASH_OBJECT), sizeof(OBJECT)), - sizeof(SESSION)); - UINT32 biggestContext = fingerprintSize + integritySize + biggestObject; - - // round required size up to nearest 8 byte boundary. - biggestContext = 8 * ((biggestContext + 7) / 8); - - if(MAX_CONTEXT_SIZE != biggestContext) - { - printf("MAX_CONTEXT_SIZE should be changed to %d (%d)\n", biggestContext, MAX_CONTEXT_SIZE); - PASS = FALSE; - } - } - { - union u - { - TPMA_OBJECT attributes; - UINT32 uint32Value; - } u; - // these are defined so that compiler doesn't complain about conditional - // expressions comparing two constants. - int aSize = sizeof(u.attributes); - int uSize = sizeof(u.uint32Value); - u.uint32Value = 0; - SET_ATTRIBUTE(u.attributes, TPMA_OBJECT, Reserved_bit_at_0); - if(u.uint32Value != 1) - { - printf("The bit allocation in a TPMA_OBJECT is not as expected"); - PASS = FALSE; - } - if(aSize != uSize) // comparison of two sizeof() values annoys compiler - { - printf("A TPMA_OBJECT is not the expected size."); - PASS = FALSE; - } - } - - // Make sure that the size of the Capability buffer can hold the largest - // TPML_PCR_SELECTION. The list length is nominally set by the number of hash - // algorithms implemented on the TPM. A requirement of this implementation is - // that a list of all allowed TPMS_PCR_SELECTIONS fits in MAX_CAP_DATA. - // TBD - pAssert(PASS); - } -#endif // DEBUG -} - -#endif // RUNTIME_SIZE_CHECKS \ No newline at end of file diff --git a/vendor/github.com/google/go-tpm-tools/simulator/simulator_test.go b/vendor/github.com/google/go-tpm-tools/simulator/simulator_test.go deleted file mode 100644 index b5c15fbb8..000000000 --- a/vendor/github.com/google/go-tpm-tools/simulator/simulator_test.go +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package simulator - -import ( - "crypto/rsa" - "io" - "math/big" - "testing" - - "github.com/google/go-tpm-tools/client" - "github.com/google/go-tpm/legacy/tpm2" -) - -func getSimulator(t *testing.T) *Simulator { - t.Helper() - simulator, err := Get() - if err != nil { - t.Fatal(err) - } - return simulator -} - -func getEKModulus(t *testing.T, rwc io.ReadWriteCloser) *big.Int { - t.Helper() - ek, err := client.EndorsementKeyRSA(rwc) - if err != nil { - t.Fatal(err) - } - defer ek.Close() - - return ek.PublicKey().(*rsa.PublicKey).N -} - -func TestResetDoesntChangeEK(t *testing.T) { - s := getSimulator(t) - defer client.CheckedClose(t, s) - - modulus1 := getEKModulus(t, s) - if err := s.Reset(); err != nil { - t.Fatal(err) - } - modulus2 := getEKModulus(t, s) - - if modulus1.Cmp(modulus2) != 0 { - t.Fatal("Reset() should not change the EK") - } -} -func TestManufactureResetChangesEK(t *testing.T) { - s := getSimulator(t) - defer client.CheckedClose(t, s) - - modulus1 := getEKModulus(t, s) - if err := s.ManufactureReset(); err != nil { - t.Fatal(err) - } - modulus2 := getEKModulus(t, s) - - if modulus1.Cmp(modulus2) == 0 { - t.Fatal("ManufactureReset() should change the EK") - } -} - -func TestGetRandom(t *testing.T) { - s := getSimulator(t) - defer client.CheckedClose(t, s) - result, err := tpm2.GetRandom(s, 10) - if err != nil { - t.Fatalf("GetRandom: %v", err) - } - t.Log(result) -} - -// The default EK modulus returned by the simulator when using a seed of 0. -func zeroSeedModulus() *big.Int { - mod := new(big.Int) - mod.SetString("16916951631746795233120676661491589156159944041454533323301360736206690950055927665898258850365255777475324525235640153431219834851979041935421083247812345676551677241639541392158486693550125570954276972465867114995062336740464652481116557477039581976647612151813804384773839359390083864432536639577227083497558006614244043011423717921293964465162166865351126036685960128739613171620392174911624095420039156957292384191548425395162459332733115699189854006301807847331248289929021522087915411000598437989788501679617747304391662751900488011803826205901900186771991702576478232121332699862815915856148442279432061762451", 10) - return mod -} - -func TestFixedSeedExpectedModulus(t *testing.T) { - s, err := GetWithFixedSeedInsecure(0) - if err != nil { - t.Fatal(err) - } - defer client.CheckedClose(t, s) - - modulus := getEKModulus(t, s) - if modulus.Cmp(zeroSeedModulus()) != 0 { - t.Fatalf("getEKModulus() = %v, want %v", modulus, zeroSeedModulus()) - } -} - -func TestDifferentSeedDifferentModulus(t *testing.T) { - s, err := GetWithFixedSeedInsecure(1) - if err != nil { - t.Fatal(err) - } - defer client.CheckedClose(t, s) - - modulus := getEKModulus(t, s) - if modulus.Cmp(zeroSeedModulus()) == 0 { - t.Fatalf("Moduli should not be equal when using different seeds") - } -} diff --git a/vendor/github.com/google/pprof/profile/encode.go b/vendor/github.com/google/pprof/profile/encode.go index 182c926b9..8ce9d3cf3 100644 --- a/vendor/github.com/google/pprof/profile/encode.go +++ b/vendor/github.com/google/pprof/profile/encode.go @@ -122,6 +122,7 @@ func (p *Profile) preEncode() { } p.defaultSampleTypeX = addString(strings, p.DefaultSampleType) + p.docURLX = addString(strings, p.DocURL) p.stringTable = make([]string, len(strings)) for s, i := range strings { @@ -156,6 +157,7 @@ func (p *Profile) encode(b *buffer) { encodeInt64Opt(b, 12, p.Period) encodeInt64s(b, 13, p.commentX) encodeInt64(b, 14, p.defaultSampleTypeX) + encodeInt64Opt(b, 15, p.docURLX) } var profileDecoder = []decoder{ @@ -237,6 +239,8 @@ var profileDecoder = []decoder{ func(b *buffer, m message) error { return decodeInt64s(b, &m.(*Profile).commentX) }, // int64 defaultSampleType = 14 func(b *buffer, m message) error { return decodeInt64(b, &m.(*Profile).defaultSampleTypeX) }, + // string doc_link = 15; + func(b *buffer, m message) error { return decodeInt64(b, &m.(*Profile).docURLX) }, } // postDecode takes the unexported fields populated by decode (with @@ -384,6 +388,7 @@ func (p *Profile) postDecode() error { p.commentX = nil p.DefaultSampleType, err = getString(p.stringTable, &p.defaultSampleTypeX, err) + p.DocURL, err = getString(p.stringTable, &p.docURLX, err) p.stringTable = nil return err } @@ -530,6 +535,7 @@ func (p *Line) decoder() []decoder { func (p *Line) encode(b *buffer) { encodeUint64Opt(b, 1, p.functionIDX) encodeInt64Opt(b, 2, p.Line) + encodeInt64Opt(b, 3, p.Column) } var lineDecoder = []decoder{ @@ -538,6 +544,8 @@ var lineDecoder = []decoder{ func(b *buffer, m message) error { return decodeUint64(b, &m.(*Line).functionIDX) }, // optional int64 line = 2 func(b *buffer, m message) error { return decodeInt64(b, &m.(*Line).Line) }, + // optional int64 column = 3 + func(b *buffer, m message) error { return decodeInt64(b, &m.(*Line).Column) }, } func (p *Function) decoder() []decoder { diff --git a/vendor/github.com/google/pprof/profile/legacy_java_profile.go b/vendor/github.com/google/pprof/profile/legacy_java_profile.go index 91f45e53c..4580bab18 100644 --- a/vendor/github.com/google/pprof/profile/legacy_java_profile.go +++ b/vendor/github.com/google/pprof/profile/legacy_java_profile.go @@ -56,7 +56,7 @@ func javaCPUProfile(b []byte, period int64, parse func(b []byte) (uint64, []byte } // Strip out addresses for better merge. - if err = p.Aggregate(true, true, true, true, false); err != nil { + if err = p.Aggregate(true, true, true, true, false, false); err != nil { return nil, err } @@ -99,7 +99,7 @@ func parseJavaProfile(b []byte) (*Profile, error) { } // Strip out addresses for better merge. - if err = p.Aggregate(true, true, true, true, false); err != nil { + if err = p.Aggregate(true, true, true, true, false, false); err != nil { return nil, err } diff --git a/vendor/github.com/google/pprof/profile/merge.go b/vendor/github.com/google/pprof/profile/merge.go index 4b66282cb..ba4d74640 100644 --- a/vendor/github.com/google/pprof/profile/merge.go +++ b/vendor/github.com/google/pprof/profile/merge.go @@ -326,12 +326,13 @@ func (l *Location) key() locationKey { key.addr -= l.Mapping.Start key.mappingID = l.Mapping.ID } - lines := make([]string, len(l.Line)*2) + lines := make([]string, len(l.Line)*3) for i, line := range l.Line { if line.Function != nil { lines[i*2] = strconv.FormatUint(line.Function.ID, 16) } lines[i*2+1] = strconv.FormatInt(line.Line, 16) + lines[i*2+2] = strconv.FormatInt(line.Column, 16) } key.lines = strings.Join(lines, "|") return key @@ -418,6 +419,7 @@ func (pm *profileMerger) mapLine(src Line) Line { ln := Line{ Function: pm.mapFunction(src.Function), Line: src.Line, + Column: src.Column, } return ln } @@ -474,6 +476,7 @@ func combineHeaders(srcs []*Profile) (*Profile, error) { var timeNanos, durationNanos, period int64 var comments []string seenComments := map[string]bool{} + var docURL string var defaultSampleType string for _, s := range srcs { if timeNanos == 0 || s.TimeNanos < timeNanos { @@ -492,6 +495,9 @@ func combineHeaders(srcs []*Profile) (*Profile, error) { if defaultSampleType == "" { defaultSampleType = s.DefaultSampleType } + if docURL == "" { + docURL = s.DocURL + } } p := &Profile{ @@ -507,6 +513,7 @@ func combineHeaders(srcs []*Profile) (*Profile, error) { Comments: comments, DefaultSampleType: defaultSampleType, + DocURL: docURL, } copy(p.SampleType, srcs[0].SampleType) return p, nil diff --git a/vendor/github.com/google/pprof/profile/profile.go b/vendor/github.com/google/pprof/profile/profile.go index 60ef7e926..f47a24390 100644 --- a/vendor/github.com/google/pprof/profile/profile.go +++ b/vendor/github.com/google/pprof/profile/profile.go @@ -39,6 +39,7 @@ type Profile struct { Location []*Location Function []*Function Comments []string + DocURL string DropFrames string KeepFrames string @@ -53,6 +54,7 @@ type Profile struct { encodeMu sync.Mutex commentX []int64 + docURLX int64 dropFramesX int64 keepFramesX int64 stringTable []string @@ -145,6 +147,7 @@ type Location struct { type Line struct { Function *Function Line int64 + Column int64 functionIDX uint64 } @@ -436,7 +439,7 @@ func (p *Profile) CheckValid() error { // Aggregate merges the locations in the profile into equivalence // classes preserving the request attributes. It also updates the // samples to point to the merged locations. -func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address bool) error { +func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, columnnumber, address bool) error { for _, m := range p.Mapping { m.HasInlineFrames = m.HasInlineFrames && inlineFrame m.HasFunctions = m.HasFunctions && function @@ -458,7 +461,7 @@ func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address } // Aggregate locations - if !inlineFrame || !address || !linenumber { + if !inlineFrame || !address || !linenumber || !columnnumber { for _, l := range p.Location { if !inlineFrame && len(l.Line) > 1 { l.Line = l.Line[len(l.Line)-1:] @@ -466,6 +469,12 @@ func (p *Profile) Aggregate(inlineFrame, function, filename, linenumber, address if !linenumber { for i := range l.Line { l.Line[i].Line = 0 + l.Line[i].Column = 0 + } + } + if !columnnumber { + for i := range l.Line { + l.Line[i].Column = 0 } } if !address { @@ -548,6 +557,9 @@ func (p *Profile) String() string { for _, c := range p.Comments { ss = append(ss, "Comment: "+c) } + if url := p.DocURL; url != "" { + ss = append(ss, fmt.Sprintf("Doc: %s", url)) + } if pt := p.PeriodType; pt != nil { ss = append(ss, fmt.Sprintf("PeriodType: %s %s", pt.Type, pt.Unit)) } @@ -627,10 +639,11 @@ func (l *Location) string() string { for li := range l.Line { lnStr := "??" if fn := l.Line[li].Function; fn != nil { - lnStr = fmt.Sprintf("%s %s:%d s=%d", + lnStr = fmt.Sprintf("%s %s:%d:%d s=%d", fn.Name, fn.Filename, l.Line[li].Line, + l.Line[li].Column, fn.StartLine) if fn.Name != fn.SystemName { lnStr = lnStr + "(" + fn.SystemName + ")" @@ -836,10 +849,10 @@ func (p *Profile) HasFileLines() bool { // Unsymbolizable returns true if a mapping points to a binary for which // locations can't be symbolized in principle, at least now. Examples are -// "[vdso]", [vsyscall]" and some others, see the code. +// "[vdso]", "[vsyscall]" and some others, see the code. func (m *Mapping) Unsymbolizable() bool { name := filepath.Base(m.File) - return strings.HasPrefix(name, "[") || strings.HasPrefix(name, "linux-vdso") || strings.HasPrefix(m.File, "/dev/dri/") + return strings.HasPrefix(name, "[") || strings.HasPrefix(name, "linux-vdso") || strings.HasPrefix(m.File, "/dev/dri/") || m.File == "//anon" } // Copy makes a fully independent copy of a profile. diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/LICENSE.txt b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/LICENSE similarity index 100% rename from vendor/github.com/grpc-ecosystem/grpc-gateway/v2/LICENSE.txt rename to vendor/github.com/grpc-ecosystem/grpc-gateway/v2/LICENSE diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel index f694f3c0d..b8fbb2b77 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel @@ -24,7 +24,7 @@ go_test( embed = [":httprule"], deps = [ "//utilities", - "@com_github_golang_glog//:glog", + "@org_golang_google_grpc//grpclog", ], ) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel index a8789f170..78d7c9f5c 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel @@ -26,7 +26,7 @@ go_library( deps = [ "//internal/httprule", "//utilities", - "@go_googleapis//google/api:httpbody_go_proto", + "@org_golang_google_genproto_googleapis_api//httpbody", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//grpclog", "@org_golang_google_grpc//health/grpc_health_v1", @@ -70,9 +70,9 @@ go_test( "//utilities", "@com_github_google_go_cmp//cmp", "@com_github_google_go_cmp//cmp/cmpopts", - "@go_googleapis//google/api:httpbody_go_proto", - "@go_googleapis//google/rpc:errdetails_go_proto", - "@go_googleapis//google/rpc:status_go_proto", + "@org_golang_google_genproto_googleapis_api//httpbody", + "@org_golang_google_genproto_googleapis_rpc//errdetails", + "@org_golang_google_genproto_googleapis_rpc//status", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//health/grpc_health_v1", diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go index 31553e784..5dd4e4478 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go @@ -148,6 +148,12 @@ func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcM var pairs []string for key, vals := range req.Header { key = textproto.CanonicalMIMEHeaderKey(key) + switch key { + case xForwardedFor, xForwardedHost: + // Handled separately below + continue + } + for _, val := range vals { // For backwards-compatibility, pass through 'authorization' header with no prefix. if key == "Authorization" { @@ -181,18 +187,17 @@ func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcM pairs = append(pairs, strings.ToLower(xForwardedHost), req.Host) } + xff := req.Header.Values(xForwardedFor) if addr := req.RemoteAddr; addr != "" { if remoteIP, _, err := net.SplitHostPort(addr); err == nil { - if fwd := req.Header.Get(xForwardedFor); fwd == "" { - pairs = append(pairs, strings.ToLower(xForwardedFor), remoteIP) - } else { - pairs = append(pairs, strings.ToLower(xForwardedFor), fmt.Sprintf("%s, %s", fwd, remoteIP)) - } + xff = append(xff, remoteIP) } } + if len(xff) > 0 { + pairs = append(pairs, strings.ToLower(xForwardedFor), strings.Join(xff, ", ")) + } if timeout != 0 { - //nolint:govet // The context outlives this function ctx, _ = context.WithTimeout(ctx, timeout) } if len(pairs) == 0 { diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go index d2bcbb7d2..568299869 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go @@ -71,7 +71,7 @@ func HTTPStatusFromCode(code codes.Code) int { case codes.DataLoss: return http.StatusInternalServerError default: - grpclog.Infof("Unknown gRPC error code: %v", code) + grpclog.Warningf("Unknown gRPC error code: %v", code) return http.StatusInternalServerError } } @@ -114,17 +114,17 @@ func DefaultHTTPErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marsh buf, merr := marshaler.Marshal(pb) if merr != nil { - grpclog.Infof("Failed to marshal error message %q: %v", s, merr) + grpclog.Errorf("Failed to marshal error message %q: %v", s, merr) w.WriteHeader(http.StatusInternalServerError) if _, err := io.WriteString(w, fallback); err != nil { - grpclog.Infof("Failed to write response: %v", err) + grpclog.Errorf("Failed to write response: %v", err) } return } md, ok := ServerMetadataFromContext(ctx) if !ok { - grpclog.Infof("Failed to extract ServerMetadata from context") + grpclog.Error("Failed to extract ServerMetadata from context") } handleForwardResponseServerMetadata(w, mux, md) @@ -137,7 +137,7 @@ func DefaultHTTPErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marsh doForwardTrailers := requestAcceptsTrailers(r) if doForwardTrailers { - handleForwardResponseTrailerHeader(w, md) + handleForwardResponseTrailerHeader(w, mux, md) w.Header().Set("Transfer-Encoding", "chunked") } @@ -148,11 +148,11 @@ func DefaultHTTPErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marsh w.WriteHeader(st) if _, err := w.Write(buf); err != nil { - grpclog.Infof("Failed to write response: %v", err) + grpclog.Errorf("Failed to write response: %v", err) } if doForwardTrailers { - handleForwardResponseTrailer(w, md) + handleForwardResponseTrailer(w, mux, md) } } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go index a03dd166b..9005d6a0b 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go @@ -27,7 +27,7 @@ func FieldMaskFromRequestBody(r io.Reader, msg proto.Message) (*field_mask.Field var root interface{} if err := json.NewDecoder(r).Decode(&root); err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { return fm, nil } return nil, err @@ -41,7 +41,7 @@ func FieldMaskFromRequestBody(r io.Reader, msg proto.Message) (*field_mask.Field m, ok := item.node.(map[string]interface{}) switch { - case ok: + case ok && len(m) > 0: // if the item is an object, then enqueue all of its children for k, v := range m { if item.msg == nil { @@ -96,6 +96,8 @@ func FieldMaskFromRequestBody(r io.Reader, msg proto.Message) (*field_mask.Field queue = append(queue, child) } } + case ok && len(m) == 0: + fallthrough case len(item.path) > 0: // otherwise, it's a leaf node so print its path fm.Paths = append(fm.Paths, item.path) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go index 945f3a5eb..de1eef1f4 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go @@ -2,10 +2,11 @@ package runtime import ( "context" - "fmt" + "errors" "io" "net/http" "net/textproto" + "strconv" "strings" "google.golang.org/genproto/googleapis/api/httpbody" @@ -17,16 +18,10 @@ import ( // ForwardResponseStream forwards the stream from gRPC server to REST client. func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { - f, ok := w.(http.Flusher) - if !ok { - grpclog.Infof("Flush not supported in %T", w) - http.Error(w, "unexpected type of web server", http.StatusInternalServerError) - return - } - + rc := http.NewResponseController(w) md, ok := ServerMetadataFromContext(ctx) if !ok { - grpclog.Infof("Failed to extract ServerMetadata from context") + grpclog.Error("Failed to extract ServerMetadata from context") http.Error(w, "unexpected error", http.StatusInternalServerError) return } @@ -48,7 +43,7 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal var wroteHeader bool for { resp, err := recv() - if err == io.EOF { + if errors.Is(err, io.EOF) { return } if err != nil { @@ -81,20 +76,29 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal } if err != nil { - grpclog.Infof("Failed to marshal response chunk: %v", err) + grpclog.Errorf("Failed to marshal response chunk: %v", err) handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err, delimiter) return } if _, err := w.Write(buf); err != nil { - grpclog.Infof("Failed to send response chunk: %v", err) + grpclog.Errorf("Failed to send response chunk: %v", err) return } wroteHeader = true if _, err := w.Write(delimiter); err != nil { - grpclog.Infof("Failed to send delimiter chunk: %v", err) + grpclog.Errorf("Failed to send delimiter chunk: %v", err) + return + } + err = rc.Flush() + if err != nil { + if errors.Is(err, http.ErrNotSupported) { + grpclog.Errorf("Flush not supported in %T", w) + http.Error(w, "unexpected type of web server", http.StatusInternalServerError) + return + } + grpclog.Errorf("Failed to flush response to client: %v", err) return } - f.Flush() } } @@ -108,18 +112,20 @@ func handleForwardResponseServerMetadata(w http.ResponseWriter, mux *ServeMux, m } } -func handleForwardResponseTrailerHeader(w http.ResponseWriter, md ServerMetadata) { +func handleForwardResponseTrailerHeader(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) { for k := range md.TrailerMD { - tKey := textproto.CanonicalMIMEHeaderKey(fmt.Sprintf("%s%s", MetadataTrailerPrefix, k)) - w.Header().Add("Trailer", tKey) + if h, ok := mux.outgoingTrailerMatcher(k); ok { + w.Header().Add("Trailer", textproto.CanonicalMIMEHeaderKey(h)) + } } } -func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { +func handleForwardResponseTrailer(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) { for k, vs := range md.TrailerMD { - tKey := fmt.Sprintf("%s%s", MetadataTrailerPrefix, k) - for _, v := range vs { - w.Header().Add(tKey, v) + if h, ok := mux.outgoingTrailerMatcher(k); ok { + for _, v := range vs { + w.Header().Add(h, v) + } } } } @@ -134,7 +140,7 @@ type responseBody interface { func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { md, ok := ServerMetadataFromContext(ctx) if !ok { - grpclog.Infof("Failed to extract ServerMetadata from context") + grpclog.Error("Failed to extract ServerMetadata from context") } handleForwardResponseServerMetadata(w, mux, md) @@ -147,12 +153,10 @@ func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marsha doForwardTrailers := requestAcceptsTrailers(req) if doForwardTrailers { - handleForwardResponseTrailerHeader(w, md) + handleForwardResponseTrailerHeader(w, mux, md) w.Header().Set("Transfer-Encoding", "chunked") } - handleForwardResponseTrailerHeader(w, md) - contentType := marshaler.ContentType(resp) w.Header().Set("Content-Type", contentType) @@ -168,17 +172,21 @@ func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marsha buf, err = marshaler.Marshal(resp) } if err != nil { - grpclog.Infof("Marshal error: %v", err) + grpclog.Errorf("Marshal error: %v", err) HTTPError(ctx, mux, marshaler, w, req, err) return } + if !doForwardTrailers { + w.Header().Set("Content-Length", strconv.Itoa(len(buf))) + } + if _, err = w.Write(buf); err != nil { - grpclog.Infof("Failed to write response: %v", err) + grpclog.Errorf("Failed to write response: %v", err) } if doForwardTrailers { - handleForwardResponseTrailer(w, md) + handleForwardResponseTrailer(w, mux, md) } } @@ -193,7 +201,7 @@ func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, re } for _, opt := range opts { if err := opt(ctx, w, resp); err != nil { - grpclog.Infof("Error handling ForwardResponseOptions: %v", err) + grpclog.Errorf("Error handling ForwardResponseOptions: %v", err) return err } } @@ -209,15 +217,15 @@ func handleForwardResponseStreamError(ctx context.Context, wroteHeader bool, mar } buf, err := marshaler.Marshal(msg) if err != nil { - grpclog.Infof("Failed to marshal an error: %v", err) + grpclog.Errorf("Failed to marshal an error: %v", err) return } if _, err := w.Write(buf); err != nil { - grpclog.Infof("Failed to notify error to client: %v", err) + grpclog.Errorf("Failed to notify error to client: %v", err) return } if _, err := w.Write(delimiter); err != nil { - grpclog.Infof("Failed to send delimiter chunk: %v", err) + grpclog.Errorf("Failed to send delimiter chunk: %v", err) return } } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_httpbodyproto.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_httpbodyproto.go index b86135c88..6de2e220c 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_httpbodyproto.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_httpbodyproto.go @@ -26,7 +26,7 @@ func (h *HTTPBodyMarshaler) ContentType(v interface{}) string { // google.api.HttpBody message, otherwise it falls back to the default Marshaler. func (h *HTTPBodyMarshaler) Marshal(v interface{}) ([]byte, error) { if httpBody, ok := v.(*httpbody.HttpBody); ok { - return httpBody.Data, nil + return httpBody.GetData(), nil } return h.Marshaler.Marshal(v) } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_json.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_json.go index d6aa82578..fe52081ab 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_json.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_json.go @@ -24,6 +24,11 @@ func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { return json.Marshal(v) } +// MarshalIndent is like Marshal but applies Indent to format the output +func (j *JSONBuiltin) MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { + return json.MarshalIndent(v, prefix, indent) +} + // Unmarshal unmarshals JSON data into "v". func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { return json.Unmarshal(data, v) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go index 51b8247da..8376d1e0e 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go @@ -30,10 +30,6 @@ func (*JSONPb) ContentType(_ interface{}) string { // Marshal marshals "v" into JSON. func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { - if _, ok := v.(proto.Message); !ok { - return j.marshalNonProtoField(v) - } - var buf bytes.Buffer if err := j.marshalTo(&buf, v); err != nil { return nil, err @@ -48,9 +44,17 @@ func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { if err != nil { return err } + if j.Indent != "" { + b := &bytes.Buffer{} + if err := json.Indent(b, buf, "", j.Indent); err != nil { + return err + } + buf = b.Bytes() + } _, err = w.Write(buf) return err } + b, err := j.MarshalOptions.Marshal(p) if err != nil { return err @@ -150,9 +154,6 @@ func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { } m[fmt.Sprintf("%v", k.Interface())] = (*json.RawMessage)(&buf) } - if j.Indent != "" { - return json.MarshalIndent(m, "", j.Indent) - } return json.Marshal(m) } if enum, ok := rv.Interface().(protoEnum); ok && !j.UseEnumNumbers { diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshaler_registry.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshaler_registry.go index a714de024..0b051e6e8 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshaler_registry.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshaler_registry.go @@ -46,7 +46,7 @@ func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, out for _, contentTypeVal := range r.Header[contentTypeHeader] { contentType, _, err := mime.ParseMediaType(contentTypeVal) if err != nil { - grpclog.Infof("Failed to parse Content-Type %s: %v", contentTypeVal, err) + grpclog.Errorf("Failed to parse Content-Type %s: %v", contentTypeVal, err) continue } if m, ok := mux.marshalers.mimeMap[contentType]; ok { diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go index f451cb441..ed9a7e438 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go @@ -57,6 +57,7 @@ type ServeMux struct { marshalers marshalerRegistry incomingHeaderMatcher HeaderMatcherFunc outgoingHeaderMatcher HeaderMatcherFunc + outgoingTrailerMatcher HeaderMatcherFunc metadataAnnotators []func(context.Context, *http.Request) metadata.MD errorHandler ErrorHandlerFunc streamErrorHandler StreamErrorHandlerFunc @@ -114,10 +115,18 @@ func DefaultHeaderMatcher(key string) (string, bool) { return "", false } +func defaultOutgoingHeaderMatcher(key string) (string, bool) { + return fmt.Sprintf("%s%s", MetadataHeaderPrefix, key), true +} + +func defaultOutgoingTrailerMatcher(key string) (string, bool) { + return fmt.Sprintf("%s%s", MetadataTrailerPrefix, key), true +} + // WithIncomingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for incoming request to gateway. // // This matcher will be called with each header in http.Request. If matcher returns true, that header will be -// passed to gRPC context. To transform the header before passing to gRPC context, matcher should return modified header. +// passed to gRPC context. To transform the header before passing to gRPC context, matcher should return the modified header. func WithIncomingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { for _, header := range fn.matchedMalformedHeaders() { grpclog.Warningf("The configured forwarding filter would allow %q to be sent to the gRPC server, which will likely cause errors. See https://github.com/grpc/grpc-go/pull/4803#issuecomment-986093310 for more information.", header) @@ -147,13 +156,24 @@ func (fn HeaderMatcherFunc) matchedMalformedHeaders() []string { // // This matcher will be called with each header in response header metadata. If matcher returns true, that header will be // passed to http response returned from gateway. To transform the header before passing to response, -// matcher should return modified header. +// matcher should return the modified header. func WithOutgoingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { return func(mux *ServeMux) { mux.outgoingHeaderMatcher = fn } } +// WithOutgoingTrailerMatcher returns a ServeMuxOption representing a headerMatcher for outgoing response from gateway. +// +// This matcher will be called with each header in response trailer metadata. If matcher returns true, that header will be +// passed to http response returned from gateway. To transform the header before passing to response, +// matcher should return the modified header. +func WithOutgoingTrailerMatcher(fn HeaderMatcherFunc) ServeMuxOption { + return func(mux *ServeMux) { + mux.outgoingTrailerMatcher = fn + } +} + // WithMetadata returns a ServeMuxOption for passing metadata to a gRPC context. // // This can be used by services that need to read from http.Request and modify gRPC context. A common use case @@ -273,11 +293,11 @@ func NewServeMux(opts ...ServeMuxOption) *ServeMux { if serveMux.incomingHeaderMatcher == nil { serveMux.incomingHeaderMatcher = DefaultHeaderMatcher } - if serveMux.outgoingHeaderMatcher == nil { - serveMux.outgoingHeaderMatcher = func(key string) (string, bool) { - return fmt.Sprintf("%s%s", MetadataHeaderPrefix, key), true - } + serveMux.outgoingHeaderMatcher = defaultOutgoingHeaderMatcher + } + if serveMux.outgoingTrailerMatcher == nil { + serveMux.outgoingTrailerMatcher = defaultOutgoingTrailerMatcher } return serveMux @@ -321,13 +341,13 @@ func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && s.isPathLengthFallback(r) { - r.Method = strings.ToUpper(override) if err := r.ParseForm(); err != nil { _, outboundMarshaler := MarshalerForRequest(s, r) sterr := status.Error(codes.InvalidArgument, err.Error()) s.errorHandler(ctx, s, outboundMarshaler, w, r, sterr) return } + r.Method = strings.ToUpper(override) } var pathComponents []string diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go index 8f90d15a5..e54507145 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go @@ -52,13 +52,13 @@ type Pattern struct { // It returns an error if the given definition is invalid. func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, error) { if version != 1 { - grpclog.Infof("unsupported version: %d", version) + grpclog.Errorf("unsupported version: %d", version) return Pattern{}, ErrInvalidPattern } l := len(ops) if l%2 != 0 { - grpclog.Infof("odd number of ops codes: %d", l) + grpclog.Errorf("odd number of ops codes: %d", l) return Pattern{}, ErrInvalidPattern } @@ -81,14 +81,14 @@ func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, er stack++ case utilities.OpPushM: if pushMSeen { - grpclog.Infof("pushM appears twice") + grpclog.Error("pushM appears twice") return Pattern{}, ErrInvalidPattern } pushMSeen = true stack++ case utilities.OpLitPush: if op.operand < 0 || len(pool) <= op.operand { - grpclog.Infof("negative literal index: %d", op.operand) + grpclog.Errorf("negative literal index: %d", op.operand) return Pattern{}, ErrInvalidPattern } if pushMSeen { @@ -97,18 +97,18 @@ func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, er stack++ case utilities.OpConcatN: if op.operand <= 0 { - grpclog.Infof("negative concat size: %d", op.operand) + grpclog.Errorf("negative concat size: %d", op.operand) return Pattern{}, ErrInvalidPattern } stack -= op.operand if stack < 0 { - grpclog.Info("stack underflow") + grpclog.Error("stack underflow") return Pattern{}, ErrInvalidPattern } stack++ case utilities.OpCapture: if op.operand < 0 || len(pool) <= op.operand { - grpclog.Infof("variable name index out of bound: %d", op.operand) + grpclog.Errorf("variable name index out of bound: %d", op.operand) return Pattern{}, ErrInvalidPattern } v := pool[op.operand] @@ -116,11 +116,11 @@ func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, er vars = append(vars, v) stack-- if stack < 0 { - grpclog.Infof("stack underflow") + grpclog.Error("stack underflow") return Pattern{}, ErrInvalidPattern } default: - grpclog.Infof("invalid opcode: %d", op.code) + grpclog.Errorf("invalid opcode: %d", op.code) return Pattern{}, ErrInvalidPattern } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go index d01933c4f..fe634174b 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go @@ -51,11 +51,13 @@ func (*DefaultQueryParser) Parse(msg proto.Message, values url.Values, filter *u key = match[1] values = append([]string{match[2]}, values...) } - fieldPath := strings.Split(key, ".") + + msgValue := msg.ProtoReflect() + fieldPath := normalizeFieldPath(msgValue, strings.Split(key, ".")) if filter.HasCommonPrefix(fieldPath) { continue } - if err := populateFieldValueFromPath(msg.ProtoReflect(), fieldPath, values); err != nil { + if err := populateFieldValueFromPath(msgValue, fieldPath, values); err != nil { return err } } @@ -68,6 +70,38 @@ func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value stri return populateFieldValueFromPath(msg.ProtoReflect(), fieldPath, []string{value}) } +func normalizeFieldPath(msgValue protoreflect.Message, fieldPath []string) []string { + newFieldPath := make([]string, 0, len(fieldPath)) + for i, fieldName := range fieldPath { + fields := msgValue.Descriptor().Fields() + fieldDesc := fields.ByTextName(fieldName) + if fieldDesc == nil { + fieldDesc = fields.ByJSONName(fieldName) + } + if fieldDesc == nil { + // return initial field path values if no matching message field was found + return fieldPath + } + + newFieldPath = append(newFieldPath, string(fieldDesc.Name())) + + // If this is the last element, we're done + if i == len(fieldPath)-1 { + break + } + + // Only singular message fields are allowed + if fieldDesc.Message() == nil || fieldDesc.Cardinality() == protoreflect.Repeated { + return fieldPath + } + + // Get the nested message + msgValue = msgValue.Get(fieldDesc).Message() + } + + return newFieldPath +} + func populateFieldValueFromPath(msgValue protoreflect.Message, fieldPath []string, values []string) error { if len(fieldPath) < 1 { return errors.New("no field path") diff --git a/vendor/github.com/huandu/xstrings/.gitignore b/vendor/github.com/huandu/xstrings/.gitignore deleted file mode 100644 index daf913b1b..000000000 --- a/vendor/github.com/huandu/xstrings/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/vendor/github.com/huandu/xstrings/CONTRIBUTING.md b/vendor/github.com/huandu/xstrings/CONTRIBUTING.md deleted file mode 100644 index d7b4b8d58..000000000 --- a/vendor/github.com/huandu/xstrings/CONTRIBUTING.md +++ /dev/null @@ -1,23 +0,0 @@ -# Contributing # - -Thanks for your contribution in advance. No matter what you will contribute to this project, pull request or bug report or feature discussion, it's always highly appreciated. - -## New API or feature ## - -I want to speak more about how to add new functions to this package. - -Package `xstring` is a collection of useful string functions which should be implemented in Go. It's a bit subject to say which function should be included and which should not. I set up following rules in order to make it clear and as objective as possible. - -* Rule 1: Only string algorithm, which takes string as input, can be included. -* Rule 2: If a function has been implemented in package `string`, it must not be included. -* Rule 3: If a function is not language neutral, it must not be included. -* Rule 4: If a function is a part of standard library in other languages, it can be included. -* Rule 5: If a function is quite useful in some famous framework or library, it can be included. - -New function must be discussed in project issues before submitting any code. If a pull request with new functions is sent without any ref issue, it will be rejected. - -## Pull request ## - -Pull request is always welcome. Just make sure you have run `go fmt` and all test cases passed before submit. - -If the pull request is to add a new API or feature, don't forget to update README.md and add new API in function list. diff --git a/vendor/github.com/huandu/xstrings/LICENSE b/vendor/github.com/huandu/xstrings/LICENSE deleted file mode 100644 index 270177259..000000000 --- a/vendor/github.com/huandu/xstrings/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Huan Du - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/huandu/xstrings/README.md b/vendor/github.com/huandu/xstrings/README.md deleted file mode 100644 index 750c3c7eb..000000000 --- a/vendor/github.com/huandu/xstrings/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# xstrings - -[![Build Status](https://github.com/huandu/xstrings/workflows/Go/badge.svg)](https://github.com/huandu/xstrings/actions) -[![Go Doc](https://godoc.org/github.com/huandu/xstrings?status.svg)](https://pkg.go.dev/github.com/huandu/xstrings) -[![Go Report](https://goreportcard.com/badge/github.com/huandu/xstrings)](https://goreportcard.com/report/github.com/huandu/xstrings) -[![Coverage Status](https://coveralls.io/repos/github/huandu/xstrings/badge.svg?branch=master)](https://coveralls.io/github/huandu/xstrings?branch=master) - -Go package [xstrings](https://godoc.org/github.com/huandu/xstrings) is a collection of string functions, which are widely used in other languages but absent in Go package [strings](http://golang.org/pkg/strings). - -All functions are well tested and carefully tuned for performance. - -## Propose a new function - -Please review [contributing guideline](CONTRIBUTING.md) and [create new issue](https://github.com/huandu/xstrings/issues) to state why it should be included. - -## Install - -Use `go get` to install this library. - - go get github.com/huandu/xstrings - -## API document - -See [GoDoc](https://godoc.org/github.com/huandu/xstrings) for full document. - -## Function list - -Go functions have a unique naming style. One, who has experience in other language but new in Go, may have difficulties to find out right string function to use. - -Here is a list of functions in [strings](http://golang.org/pkg/strings) and [xstrings](https://godoc.org/github.com/huandu/xstrings) with enough extra information about how to map these functions to their friends in other languages. Hope this list could be helpful for fresh gophers. - -### Package `xstrings` functions - -_Keep this table sorted by Function in ascending order._ - -| Function | Friends | # | -| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------- | -| [Center](https://godoc.org/github.com/huandu/xstrings#Center) | `str.center` in Python; `String#center` in Ruby | [#30](https://github.com/huandu/xstrings/issues/30) | -| [Count](https://godoc.org/github.com/huandu/xstrings#Count) | `String#count` in Ruby | [#16](https://github.com/huandu/xstrings/issues/16) | -| [Delete](https://godoc.org/github.com/huandu/xstrings#Delete) | `String#delete` in Ruby | [#17](https://github.com/huandu/xstrings/issues/17) | -| [ExpandTabs](https://godoc.org/github.com/huandu/xstrings#ExpandTabs) | `str.expandtabs` in Python | [#27](https://github.com/huandu/xstrings/issues/27) | -| [FirstRuneToLower](https://godoc.org/github.com/huandu/xstrings#FirstRuneToLower) | `lcfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | -| [FirstRuneToUpper](https://godoc.org/github.com/huandu/xstrings#FirstRuneToUpper) | `String#capitalize` in Ruby; `ucfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | -| [Insert](https://godoc.org/github.com/huandu/xstrings#Insert) | `String#insert` in Ruby | [#18](https://github.com/huandu/xstrings/issues/18) | -| [LastPartition](https://godoc.org/github.com/huandu/xstrings#LastPartition) | `str.rpartition` in Python; `String#rpartition` in Ruby | [#19](https://github.com/huandu/xstrings/issues/19) | -| [LeftJustify](https://godoc.org/github.com/huandu/xstrings#LeftJustify) | `str.ljust` in Python; `String#ljust` in Ruby | [#28](https://github.com/huandu/xstrings/issues/28) | -| [Len](https://godoc.org/github.com/huandu/xstrings#Len) | `mb_strlen` in PHP | [#23](https://github.com/huandu/xstrings/issues/23) | -| [Partition](https://godoc.org/github.com/huandu/xstrings#Partition) | `str.partition` in Python; `String#partition` in Ruby | [#10](https://github.com/huandu/xstrings/issues/10) | -| [Reverse](https://godoc.org/github.com/huandu/xstrings#Reverse) | `String#reverse` in Ruby; `strrev` in PHP; `reverse` in Perl | [#7](https://github.com/huandu/xstrings/issues/7) | -| [RightJustify](https://godoc.org/github.com/huandu/xstrings#RightJustify) | `str.rjust` in Python; `String#rjust` in Ruby | [#29](https://github.com/huandu/xstrings/issues/29) | -| [RuneWidth](https://godoc.org/github.com/huandu/xstrings#RuneWidth) | - | [#27](https://github.com/huandu/xstrings/issues/27) | -| [Scrub](https://godoc.org/github.com/huandu/xstrings#Scrub) | `String#scrub` in Ruby | [#20](https://github.com/huandu/xstrings/issues/20) | -| [Shuffle](https://godoc.org/github.com/huandu/xstrings#Shuffle) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | -| [ShuffleSource](https://godoc.org/github.com/huandu/xstrings#ShuffleSource) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | -| [Slice](https://godoc.org/github.com/huandu/xstrings#Slice) | `mb_substr` in PHP | [#9](https://github.com/huandu/xstrings/issues/9) | -| [Squeeze](https://godoc.org/github.com/huandu/xstrings#Squeeze) | `String#squeeze` in Ruby | [#11](https://github.com/huandu/xstrings/issues/11) | -| [Successor](https://godoc.org/github.com/huandu/xstrings#Successor) | `String#succ` or `String#next` in Ruby | [#22](https://github.com/huandu/xstrings/issues/22) | -| [SwapCase](https://godoc.org/github.com/huandu/xstrings#SwapCase) | `str.swapcase` in Python; `String#swapcase` in Ruby | [#12](https://github.com/huandu/xstrings/issues/12) | -| [ToCamelCase](https://godoc.org/github.com/huandu/xstrings#ToCamelCase) | `String#camelize` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | -| [ToKebab](https://godoc.org/github.com/huandu/xstrings#ToKebabCase) | - | [#41](https://github.com/huandu/xstrings/issues/41) | -| [ToSnakeCase](https://godoc.org/github.com/huandu/xstrings#ToSnakeCase) | `String#underscore` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | -| [Translate](https://godoc.org/github.com/huandu/xstrings#Translate) | `str.translate` in Python; `String#tr` in Ruby; `strtr` in PHP; `tr///` in Perl | [#21](https://github.com/huandu/xstrings/issues/21) | -| [Width](https://godoc.org/github.com/huandu/xstrings#Width) | `mb_strwidth` in PHP | [#26](https://github.com/huandu/xstrings/issues/26) | -| [WordCount](https://godoc.org/github.com/huandu/xstrings#WordCount) | `str_word_count` in PHP | [#14](https://github.com/huandu/xstrings/issues/14) | -| [WordSplit](https://godoc.org/github.com/huandu/xstrings#WordSplit) | - | [#14](https://github.com/huandu/xstrings/issues/14) | - -### Package `strings` functions - -_Keep this table sorted by Function in ascending order._ - -| Function | Friends | -| --------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| [Contains](http://golang.org/pkg/strings/#Contains) | `String#include?` in Ruby | -| [ContainsAny](http://golang.org/pkg/strings/#ContainsAny) | - | -| [ContainsRune](http://golang.org/pkg/strings/#ContainsRune) | - | -| [Count](http://golang.org/pkg/strings/#Count) | `str.count` in Python; `substr_count` in PHP | -| [EqualFold](http://golang.org/pkg/strings/#EqualFold) | `stricmp` in PHP; `String#casecmp` in Ruby | -| [Fields](http://golang.org/pkg/strings/#Fields) | `str.split` in Python; `split` in Perl; `String#split` in Ruby | -| [FieldsFunc](http://golang.org/pkg/strings/#FieldsFunc) | - | -| [HasPrefix](http://golang.org/pkg/strings/#HasPrefix) | `str.startswith` in Python; `String#start_with?` in Ruby | -| [HasSuffix](http://golang.org/pkg/strings/#HasSuffix) | `str.endswith` in Python; `String#end_with?` in Ruby | -| [Index](http://golang.org/pkg/strings/#Index) | `str.index` in Python; `String#index` in Ruby; `strpos` in PHP; `index` in Perl | -| [IndexAny](http://golang.org/pkg/strings/#IndexAny) | - | -| [IndexByte](http://golang.org/pkg/strings/#IndexByte) | - | -| [IndexFunc](http://golang.org/pkg/strings/#IndexFunc) | - | -| [IndexRune](http://golang.org/pkg/strings/#IndexRune) | - | -| [Join](http://golang.org/pkg/strings/#Join) | `str.join` in Python; `Array#join` in Ruby; `implode` in PHP; `join` in Perl | -| [LastIndex](http://golang.org/pkg/strings/#LastIndex) | `str.rindex` in Python; `String#rindex`; `strrpos` in PHP; `rindex` in Perl | -| [LastIndexAny](http://golang.org/pkg/strings/#LastIndexAny) | - | -| [LastIndexFunc](http://golang.org/pkg/strings/#LastIndexFunc) | - | -| [Map](http://golang.org/pkg/strings/#Map) | `String#each_codepoint` in Ruby | -| [Repeat](http://golang.org/pkg/strings/#Repeat) | operator `*` in Python and Ruby; `str_repeat` in PHP | -| [Replace](http://golang.org/pkg/strings/#Replace) | `str.replace` in Python; `String#sub` in Ruby; `str_replace` in PHP | -| [Split](http://golang.org/pkg/strings/#Split) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | -| [SplitAfter](http://golang.org/pkg/strings/#SplitAfter) | - | -| [SplitAfterN](http://golang.org/pkg/strings/#SplitAfterN) | - | -| [SplitN](http://golang.org/pkg/strings/#SplitN) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | -| [Title](http://golang.org/pkg/strings/#Title) | `str.title` in Python | -| [ToLower](http://golang.org/pkg/strings/#ToLower) | `str.lower` in Python; `String#downcase` in Ruby; `strtolower` in PHP; `lc` in Perl | -| [ToLowerSpecial](http://golang.org/pkg/strings/#ToLowerSpecial) | - | -| [ToTitle](http://golang.org/pkg/strings/#ToTitle) | - | -| [ToTitleSpecial](http://golang.org/pkg/strings/#ToTitleSpecial) | - | -| [ToUpper](http://golang.org/pkg/strings/#ToUpper) | `str.upper` in Python; `String#upcase` in Ruby; `strtoupper` in PHP; `uc` in Perl | -| [ToUpperSpecial](http://golang.org/pkg/strings/#ToUpperSpecial) | - | -| [Trim](http://golang.org/pkg/strings/#Trim) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | -| [TrimFunc](http://golang.org/pkg/strings/#TrimFunc) | - | -| [TrimLeft](http://golang.org/pkg/strings/#TrimLeft) | `str.lstrip` in Python; `String#lstrip` in Ruby; `ltrim` in PHP | -| [TrimLeftFunc](http://golang.org/pkg/strings/#TrimLeftFunc) | - | -| [TrimPrefix](http://golang.org/pkg/strings/#TrimPrefix) | - | -| [TrimRight](http://golang.org/pkg/strings/#TrimRight) | `str.rstrip` in Python; `String#rstrip` in Ruby; `rtrim` in PHP | -| [TrimRightFunc](http://golang.org/pkg/strings/#TrimRightFunc) | - | -| [TrimSpace](http://golang.org/pkg/strings/#TrimSpace) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | -| [TrimSuffix](http://golang.org/pkg/strings/#TrimSuffix) | `String#chomp` in Ruby; `chomp` in Perl | - -## License - -This library is licensed under MIT license. See LICENSE for details. diff --git a/vendor/github.com/huandu/xstrings/common.go b/vendor/github.com/huandu/xstrings/common.go deleted file mode 100644 index f427cc84e..000000000 --- a/vendor/github.com/huandu/xstrings/common.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -const bufferMaxInitGrowSize = 2048 - -// Lazy initialize a buffer. -func allocBuffer(orig, cur string) *stringBuilder { - output := &stringBuilder{} - maxSize := len(orig) * 4 - - // Avoid to reserve too much memory at once. - if maxSize > bufferMaxInitGrowSize { - maxSize = bufferMaxInitGrowSize - } - - output.Grow(maxSize) - output.WriteString(orig[:len(orig)-len(cur)]) - return output -} diff --git a/vendor/github.com/huandu/xstrings/convert.go b/vendor/github.com/huandu/xstrings/convert.go deleted file mode 100644 index cba0d0725..000000000 --- a/vendor/github.com/huandu/xstrings/convert.go +++ /dev/null @@ -1,593 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "math/rand" - "unicode" - "unicode/utf8" -) - -// ToCamelCase is to convert words separated by space, underscore and hyphen to camel case. -// -// Some samples. -// -// "some_words" => "SomeWords" -// "http_server" => "HttpServer" -// "no_https" => "NoHttps" -// "_complex__case_" => "_Complex_Case_" -// "some words" => "SomeWords" -func ToCamelCase(str string) string { - if len(str) == 0 { - return "" - } - - buf := &stringBuilder{} - var r0, r1 rune - var size int - - // leading connector will appear in output. - for len(str) > 0 { - r0, size = utf8.DecodeRuneInString(str) - str = str[size:] - - if !isConnector(r0) { - r0 = unicode.ToUpper(r0) - break - } - - buf.WriteRune(r0) - } - - if len(str) == 0 { - // A special case for a string contains only 1 rune. - if size != 0 { - buf.WriteRune(r0) - } - - return buf.String() - } - - for len(str) > 0 { - r1 = r0 - r0, size = utf8.DecodeRuneInString(str) - str = str[size:] - - if isConnector(r0) && isConnector(r1) { - buf.WriteRune(r1) - continue - } - - if isConnector(r1) { - r0 = unicode.ToUpper(r0) - } else { - buf.WriteRune(r1) - } - } - - buf.WriteRune(r0) - return buf.String() -} - -// ToSnakeCase can convert all upper case characters in a string to -// snake case format. -// -// Some samples. -// -// "FirstName" => "first_name" -// "HTTPServer" => "http_server" -// "NoHTTPS" => "no_https" -// "GO_PATH" => "go_path" -// "GO PATH" => "go_path" // space is converted to underscore. -// "GO-PATH" => "go_path" // hyphen is converted to underscore. -// "http2xx" => "http_2xx" // insert an underscore before a number and after an alphabet. -// "HTTP20xOK" => "http_20x_ok" -// "Duration2m3s" => "duration_2m3s" -// "Bld4Floor3rd" => "bld4_floor_3rd" -func ToSnakeCase(str string) string { - return camelCaseToLowerCase(str, '_') -} - -// ToKebabCase can convert all upper case characters in a string to -// kebab case format. -// -// Some samples. -// -// "FirstName" => "first-name" -// "HTTPServer" => "http-server" -// "NoHTTPS" => "no-https" -// "GO_PATH" => "go-path" -// "GO PATH" => "go-path" // space is converted to '-'. -// "GO-PATH" => "go-path" // hyphen is converted to '-'. -// "http2xx" => "http-2xx" // insert an underscore before a number and after an alphabet. -// "HTTP20xOK" => "http-20x-ok" -// "Duration2m3s" => "duration-2m3s" -// "Bld4Floor3rd" => "bld4-floor-3rd" -func ToKebabCase(str string) string { - return camelCaseToLowerCase(str, '-') -} - -func camelCaseToLowerCase(str string, connector rune) string { - if len(str) == 0 { - return "" - } - - buf := &stringBuilder{} - wt, word, remaining := nextWord(str) - - for len(remaining) > 0 { - if wt != connectorWord { - toLower(buf, wt, word, connector) - } - - prev := wt - last := word - wt, word, remaining = nextWord(remaining) - - switch prev { - case numberWord: - for wt == alphabetWord || wt == numberWord { - toLower(buf, wt, word, connector) - wt, word, remaining = nextWord(remaining) - } - - if wt != invalidWord && wt != punctWord && wt != connectorWord { - buf.WriteRune(connector) - } - - case connectorWord: - toLower(buf, prev, last, connector) - - case punctWord: - // nothing. - - default: - if wt != numberWord { - if wt != connectorWord && wt != punctWord { - buf.WriteRune(connector) - } - - break - } - - if len(remaining) == 0 { - break - } - - last := word - wt, word, remaining = nextWord(remaining) - - // consider number as a part of previous word. - // e.g. "Bld4Floor" => "bld4_floor" - if wt != alphabetWord { - toLower(buf, numberWord, last, connector) - - if wt != connectorWord && wt != punctWord { - buf.WriteRune(connector) - } - - break - } - - // if there are some lower case letters following a number, - // add connector before the number. - // e.g. "HTTP2xx" => "http_2xx" - buf.WriteRune(connector) - toLower(buf, numberWord, last, connector) - - for wt == alphabetWord || wt == numberWord { - toLower(buf, wt, word, connector) - wt, word, remaining = nextWord(remaining) - } - - if wt != invalidWord && wt != connectorWord && wt != punctWord { - buf.WriteRune(connector) - } - } - } - - toLower(buf, wt, word, connector) - return buf.String() -} - -func isConnector(r rune) bool { - return r == '-' || r == '_' || unicode.IsSpace(r) -} - -type wordType int - -const ( - invalidWord wordType = iota - numberWord - upperCaseWord - alphabetWord - connectorWord - punctWord - otherWord -) - -func nextWord(str string) (wt wordType, word, remaining string) { - if len(str) == 0 { - return - } - - var offset int - remaining = str - r, size := nextValidRune(remaining, utf8.RuneError) - offset += size - - if r == utf8.RuneError { - wt = invalidWord - word = str[:offset] - remaining = str[offset:] - return - } - - switch { - case isConnector(r): - wt = connectorWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !isConnector(r) { - break - } - - offset += size - remaining = remaining[size:] - } - - case unicode.IsPunct(r): - wt = punctWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !unicode.IsPunct(r) { - break - } - - offset += size - remaining = remaining[size:] - } - - case unicode.IsUpper(r): - wt = upperCaseWord - remaining = remaining[size:] - - if len(remaining) == 0 { - break - } - - r, size = nextValidRune(remaining, r) - - switch { - case unicode.IsUpper(r): - prevSize := size - offset += size - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !unicode.IsUpper(r) { - break - } - - prevSize = size - offset += size - remaining = remaining[size:] - } - - // it's a bit complex when dealing with a case like "HTTPStatus". - // it's expected to be splitted into "HTTP" and "Status". - // Therefore "S" should be in remaining instead of word. - if len(remaining) > 0 && isAlphabet(r) { - offset -= prevSize - remaining = str[offset:] - } - - case isAlphabet(r): - offset += size - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !isAlphabet(r) || unicode.IsUpper(r) { - break - } - - offset += size - remaining = remaining[size:] - } - } - - case isAlphabet(r): - wt = alphabetWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !isAlphabet(r) || unicode.IsUpper(r) { - break - } - - offset += size - remaining = remaining[size:] - } - - case unicode.IsNumber(r): - wt = numberWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !unicode.IsNumber(r) { - break - } - - offset += size - remaining = remaining[size:] - } - - default: - wt = otherWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if size == 0 || isConnector(r) || isAlphabet(r) || unicode.IsNumber(r) || unicode.IsPunct(r) { - break - } - - offset += size - remaining = remaining[size:] - } - } - - word = str[:offset] - return -} - -func nextValidRune(str string, prev rune) (r rune, size int) { - var sz int - - for len(str) > 0 { - r, sz = utf8.DecodeRuneInString(str) - size += sz - - if r != utf8.RuneError { - return - } - - str = str[sz:] - } - - r = prev - return -} - -func toLower(buf *stringBuilder, wt wordType, str string, connector rune) { - buf.Grow(buf.Len() + len(str)) - - if wt != upperCaseWord && wt != connectorWord { - buf.WriteString(str) - return - } - - for len(str) > 0 { - r, size := utf8.DecodeRuneInString(str) - str = str[size:] - - if isConnector(r) { - buf.WriteRune(connector) - } else if unicode.IsUpper(r) { - buf.WriteRune(unicode.ToLower(r)) - } else { - buf.WriteRune(r) - } - } -} - -// SwapCase will swap characters case from upper to lower or lower to upper. -func SwapCase(str string) string { - var r rune - var size int - - buf := &stringBuilder{} - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - switch { - case unicode.IsUpper(r): - buf.WriteRune(unicode.ToLower(r)) - - case unicode.IsLower(r): - buf.WriteRune(unicode.ToUpper(r)) - - default: - buf.WriteRune(r) - } - - str = str[size:] - } - - return buf.String() -} - -// FirstRuneToUpper converts first rune to upper case if necessary. -func FirstRuneToUpper(str string) string { - if str == "" { - return str - } - - r, size := utf8.DecodeRuneInString(str) - - if !unicode.IsLower(r) { - return str - } - - buf := &stringBuilder{} - buf.WriteRune(unicode.ToUpper(r)) - buf.WriteString(str[size:]) - return buf.String() -} - -// FirstRuneToLower converts first rune to lower case if necessary. -func FirstRuneToLower(str string) string { - if str == "" { - return str - } - - r, size := utf8.DecodeRuneInString(str) - - if !unicode.IsUpper(r) { - return str - } - - buf := &stringBuilder{} - buf.WriteRune(unicode.ToLower(r)) - buf.WriteString(str[size:]) - return buf.String() -} - -// Shuffle randomizes runes in a string and returns the result. -// It uses default random source in `math/rand`. -func Shuffle(str string) string { - if str == "" { - return str - } - - runes := []rune(str) - index := 0 - - for i := len(runes) - 1; i > 0; i-- { - index = rand.Intn(i + 1) - - if i != index { - runes[i], runes[index] = runes[index], runes[i] - } - } - - return string(runes) -} - -// ShuffleSource randomizes runes in a string with given random source. -func ShuffleSource(str string, src rand.Source) string { - if str == "" { - return str - } - - runes := []rune(str) - index := 0 - r := rand.New(src) - - for i := len(runes) - 1; i > 0; i-- { - index = r.Intn(i + 1) - - if i != index { - runes[i], runes[index] = runes[index], runes[i] - } - } - - return string(runes) -} - -// Successor returns the successor to string. -// -// If there is one alphanumeric rune is found in string, increase the rune by 1. -// If increment generates a "carry", the rune to the left of it is incremented. -// This process repeats until there is no carry, adding an additional rune if necessary. -// -// If there is no alphanumeric rune, the rightmost rune will be increased by 1 -// regardless whether the result is a valid rune or not. -// -// Only following characters are alphanumeric. -// - a - z -// - A - Z -// - 0 - 9 -// -// Samples (borrowed from ruby's String#succ document): -// -// "abcd" => "abce" -// "THX1138" => "THX1139" -// "<>" => "<>" -// "1999zzz" => "2000aaa" -// "ZZZ9999" => "AAAA0000" -// "***" => "**+" -func Successor(str string) string { - if str == "" { - return str - } - - var r rune - var i int - carry := ' ' - runes := []rune(str) - l := len(runes) - lastAlphanumeric := l - - for i = l - 1; i >= 0; i-- { - r = runes[i] - - if ('a' <= r && r <= 'y') || - ('A' <= r && r <= 'Y') || - ('0' <= r && r <= '8') { - runes[i]++ - carry = ' ' - lastAlphanumeric = i - break - } - - switch r { - case 'z': - runes[i] = 'a' - carry = 'a' - lastAlphanumeric = i - - case 'Z': - runes[i] = 'A' - carry = 'A' - lastAlphanumeric = i - - case '9': - runes[i] = '0' - carry = '0' - lastAlphanumeric = i - } - } - - // Needs to add one character for carry. - if i < 0 && carry != ' ' { - buf := &stringBuilder{} - buf.Grow(l + 4) // Reserve enough space for write. - - if lastAlphanumeric != 0 { - buf.WriteString(str[:lastAlphanumeric]) - } - - buf.WriteRune(carry) - - for _, r = range runes[lastAlphanumeric:] { - buf.WriteRune(r) - } - - return buf.String() - } - - // No alphanumeric character. Simply increase last rune's value. - if lastAlphanumeric == l { - runes[l-1]++ - } - - return string(runes) -} diff --git a/vendor/github.com/huandu/xstrings/count.go b/vendor/github.com/huandu/xstrings/count.go deleted file mode 100644 index f96e38703..000000000 --- a/vendor/github.com/huandu/xstrings/count.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "unicode" - "unicode/utf8" -) - -// Len returns str's utf8 rune length. -func Len(str string) int { - return utf8.RuneCountInString(str) -} - -// WordCount returns number of words in a string. -// -// Word is defined as a locale dependent string containing alphabetic characters, -// which may also contain but not start with `'` and `-` characters. -func WordCount(str string) int { - var r rune - var size, n int - - inWord := false - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - switch { - case isAlphabet(r): - if !inWord { - inWord = true - n++ - } - - case inWord && (r == '\'' || r == '-'): - // Still in word. - - default: - inWord = false - } - - str = str[size:] - } - - return n -} - -const minCJKCharacter = '\u3400' - -// Checks r is a letter but not CJK character. -func isAlphabet(r rune) bool { - if !unicode.IsLetter(r) { - return false - } - - switch { - // Quick check for non-CJK character. - case r < minCJKCharacter: - return true - - // Common CJK characters. - case r >= '\u4E00' && r <= '\u9FCC': - return false - - // Rare CJK characters. - case r >= '\u3400' && r <= '\u4D85': - return false - - // Rare and historic CJK characters. - case r >= '\U00020000' && r <= '\U0002B81D': - return false - } - - return true -} - -// Width returns string width in monotype font. -// Multi-byte characters are usually twice the width of single byte characters. -// -// Algorithm comes from `mb_strwidth` in PHP. -// http://php.net/manual/en/function.mb-strwidth.php -func Width(str string) int { - var r rune - var size, n int - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - n += RuneWidth(r) - str = str[size:] - } - - return n -} - -// RuneWidth returns character width in monotype font. -// Multi-byte characters are usually twice the width of single byte characters. -// -// Algorithm comes from `mb_strwidth` in PHP. -// http://php.net/manual/en/function.mb-strwidth.php -func RuneWidth(r rune) int { - switch { - case r == utf8.RuneError || r < '\x20': - return 0 - - case '\x20' <= r && r < '\u2000': - return 1 - - case '\u2000' <= r && r < '\uFF61': - return 2 - - case '\uFF61' <= r && r < '\uFFA0': - return 1 - - case '\uFFA0' <= r: - return 2 - } - - return 0 -} diff --git a/vendor/github.com/huandu/xstrings/doc.go b/vendor/github.com/huandu/xstrings/doc.go deleted file mode 100644 index 1a6ef069f..000000000 --- a/vendor/github.com/huandu/xstrings/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -// Package xstrings is to provide string algorithms which are useful but not included in `strings` package. -// See project home page for details. https://github.com/huandu/xstrings -// -// Package xstrings assumes all strings are encoded in utf8. -package xstrings diff --git a/vendor/github.com/huandu/xstrings/format.go b/vendor/github.com/huandu/xstrings/format.go deleted file mode 100644 index b32219bbd..000000000 --- a/vendor/github.com/huandu/xstrings/format.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "unicode/utf8" -) - -// ExpandTabs can expand tabs ('\t') rune in str to one or more spaces dpending on -// current column and tabSize. -// The column number is reset to zero after each newline ('\n') occurring in the str. -// -// ExpandTabs uses RuneWidth to decide rune's width. -// For example, CJK characters will be treated as two characters. -// -// If tabSize <= 0, ExpandTabs panics with error. -// -// Samples: -// -// ExpandTabs("a\tbc\tdef\tghij\tk", 4) => "a bc def ghij k" -// ExpandTabs("abcdefg\thij\nk\tl", 4) => "abcdefg hij\nk l" -// ExpandTabs("z中\t文\tw", 4) => "z中 文 w" -func ExpandTabs(str string, tabSize int) string { - if tabSize <= 0 { - panic("tab size must be positive") - } - - var r rune - var i, size, column, expand int - var output *stringBuilder - - orig := str - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - if r == '\t' { - expand = tabSize - column%tabSize - - if output == nil { - output = allocBuffer(orig, str) - } - - for i = 0; i < expand; i++ { - output.WriteRune(' ') - } - - column += expand - } else { - if r == '\n' { - column = 0 - } else { - column += RuneWidth(r) - } - - if output != nil { - output.WriteRune(r) - } - } - - str = str[size:] - } - - if output == nil { - return orig - } - - return output.String() -} - -// LeftJustify returns a string with pad string at right side if str's rune length is smaller than length. -// If str's rune length is larger than length, str itself will be returned. -// -// If pad is an empty string, str will be returned. -// -// Samples: -// -// LeftJustify("hello", 4, " ") => "hello" -// LeftJustify("hello", 10, " ") => "hello " -// LeftJustify("hello", 10, "123") => "hello12312" -func LeftJustify(str string, length int, pad string) string { - l := Len(str) - - if l >= length || pad == "" { - return str - } - - remains := length - l - padLen := Len(pad) - - output := &stringBuilder{} - output.Grow(len(str) + (remains/padLen+1)*len(pad)) - output.WriteString(str) - writePadString(output, pad, padLen, remains) - return output.String() -} - -// RightJustify returns a string with pad string at left side if str's rune length is smaller than length. -// If str's rune length is larger than length, str itself will be returned. -// -// If pad is an empty string, str will be returned. -// -// Samples: -// -// RightJustify("hello", 4, " ") => "hello" -// RightJustify("hello", 10, " ") => " hello" -// RightJustify("hello", 10, "123") => "12312hello" -func RightJustify(str string, length int, pad string) string { - l := Len(str) - - if l >= length || pad == "" { - return str - } - - remains := length - l - padLen := Len(pad) - - output := &stringBuilder{} - output.Grow(len(str) + (remains/padLen+1)*len(pad)) - writePadString(output, pad, padLen, remains) - output.WriteString(str) - return output.String() -} - -// Center returns a string with pad string at both side if str's rune length is smaller than length. -// If str's rune length is larger than length, str itself will be returned. -// -// If pad is an empty string, str will be returned. -// -// Samples: -// -// Center("hello", 4, " ") => "hello" -// Center("hello", 10, " ") => " hello " -// Center("hello", 10, "123") => "12hello123" -func Center(str string, length int, pad string) string { - l := Len(str) - - if l >= length || pad == "" { - return str - } - - remains := length - l - padLen := Len(pad) - - output := &stringBuilder{} - output.Grow(len(str) + (remains/padLen+1)*len(pad)) - writePadString(output, pad, padLen, remains/2) - output.WriteString(str) - writePadString(output, pad, padLen, (remains+1)/2) - return output.String() -} - -func writePadString(output *stringBuilder, pad string, padLen, remains int) { - var r rune - var size int - - repeats := remains / padLen - - for i := 0; i < repeats; i++ { - output.WriteString(pad) - } - - remains = remains % padLen - - if remains != 0 { - for i := 0; i < remains; i++ { - r, size = utf8.DecodeRuneInString(pad) - output.WriteRune(r) - pad = pad[size:] - } - } -} diff --git a/vendor/github.com/huandu/xstrings/manipulate.go b/vendor/github.com/huandu/xstrings/manipulate.go deleted file mode 100644 index ab42fe0fe..000000000 --- a/vendor/github.com/huandu/xstrings/manipulate.go +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "strings" - "unicode/utf8" -) - -// Reverse a utf8 encoded string. -func Reverse(str string) string { - var size int - - tail := len(str) - buf := make([]byte, tail) - s := buf - - for len(str) > 0 { - _, size = utf8.DecodeRuneInString(str) - tail -= size - s = append(s[:tail], []byte(str[:size])...) - str = str[size:] - } - - return string(buf) -} - -// Slice a string by rune. -// -// Start must satisfy 0 <= start <= rune length. -// -// End can be positive, zero or negative. -// If end >= 0, start and end must satisfy start <= end <= rune length. -// If end < 0, it means slice to the end of string. -// -// Otherwise, Slice will panic as out of range. -func Slice(str string, start, end int) string { - var size, startPos, endPos int - - origin := str - - if start < 0 || end > len(str) || (end >= 0 && start > end) { - panic("out of range") - } - - if end >= 0 { - end -= start - } - - for start > 0 && len(str) > 0 { - _, size = utf8.DecodeRuneInString(str) - start-- - startPos += size - str = str[size:] - } - - if end < 0 { - return origin[startPos:] - } - - endPos = startPos - - for end > 0 && len(str) > 0 { - _, size = utf8.DecodeRuneInString(str) - end-- - endPos += size - str = str[size:] - } - - if len(str) == 0 && (start > 0 || end > 0) { - panic("out of range") - } - - return origin[startPos:endPos] -} - -// Partition splits a string by sep into three parts. -// The return value is a slice of strings with head, match and tail. -// -// If str contains sep, for example "hello" and "l", Partition returns -// -// "he", "l", "lo" -// -// If str doesn't contain sep, for example "hello" and "x", Partition returns -// -// "hello", "", "" -func Partition(str, sep string) (head, match, tail string) { - index := strings.Index(str, sep) - - if index == -1 { - head = str - return - } - - head = str[:index] - match = str[index : index+len(sep)] - tail = str[index+len(sep):] - return -} - -// LastPartition splits a string by last instance of sep into three parts. -// The return value is a slice of strings with head, match and tail. -// -// If str contains sep, for example "hello" and "l", LastPartition returns -// -// "hel", "l", "o" -// -// If str doesn't contain sep, for example "hello" and "x", LastPartition returns -// -// "", "", "hello" -func LastPartition(str, sep string) (head, match, tail string) { - index := strings.LastIndex(str, sep) - - if index == -1 { - tail = str - return - } - - head = str[:index] - match = str[index : index+len(sep)] - tail = str[index+len(sep):] - return -} - -// Insert src into dst at given rune index. -// Index is counted by runes instead of bytes. -// -// If index is out of range of dst, panic with out of range. -func Insert(dst, src string, index int) string { - return Slice(dst, 0, index) + src + Slice(dst, index, -1) -} - -// Scrub scrubs invalid utf8 bytes with repl string. -// Adjacent invalid bytes are replaced only once. -func Scrub(str, repl string) string { - var buf *stringBuilder - var r rune - var size, pos int - var hasError bool - - origin := str - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - if r == utf8.RuneError { - if !hasError { - if buf == nil { - buf = &stringBuilder{} - } - - buf.WriteString(origin[:pos]) - hasError = true - } - } else if hasError { - hasError = false - buf.WriteString(repl) - - origin = origin[pos:] - pos = 0 - } - - pos += size - str = str[size:] - } - - if buf != nil { - buf.WriteString(origin) - return buf.String() - } - - // No invalid byte. - return origin -} - -// WordSplit splits a string into words. Returns a slice of words. -// If there is no word in a string, return nil. -// -// Word is defined as a locale dependent string containing alphabetic characters, -// which may also contain but not start with `'` and `-` characters. -func WordSplit(str string) []string { - var word string - var words []string - var r rune - var size, pos int - - inWord := false - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - switch { - case isAlphabet(r): - if !inWord { - inWord = true - word = str - pos = 0 - } - - case inWord && (r == '\'' || r == '-'): - // Still in word. - - default: - if inWord { - inWord = false - words = append(words, word[:pos]) - } - } - - pos += size - str = str[size:] - } - - if inWord { - words = append(words, word[:pos]) - } - - return words -} diff --git a/vendor/github.com/huandu/xstrings/stringbuilder.go b/vendor/github.com/huandu/xstrings/stringbuilder.go deleted file mode 100644 index 06812fea0..000000000 --- a/vendor/github.com/huandu/xstrings/stringbuilder.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build go1.10 -// +build go1.10 - -package xstrings - -import "strings" - -type stringBuilder = strings.Builder diff --git a/vendor/github.com/huandu/xstrings/stringbuilder_go110.go b/vendor/github.com/huandu/xstrings/stringbuilder_go110.go deleted file mode 100644 index ccaa5aedd..000000000 --- a/vendor/github.com/huandu/xstrings/stringbuilder_go110.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build !go1.10 -// +build !go1.10 - -package xstrings - -import "bytes" - -type stringBuilder struct { - bytes.Buffer -} diff --git a/vendor/github.com/huandu/xstrings/translate.go b/vendor/github.com/huandu/xstrings/translate.go deleted file mode 100644 index 1fac6a00b..000000000 --- a/vendor/github.com/huandu/xstrings/translate.go +++ /dev/null @@ -1,552 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "unicode" - "unicode/utf8" -) - -type runeRangeMap struct { - FromLo rune // Lower bound of range map. - FromHi rune // An inclusive higher bound of range map. - ToLo rune - ToHi rune -} - -type runeDict struct { - Dict [unicode.MaxASCII + 1]rune -} - -type runeMap map[rune]rune - -// Translator can translate string with pre-compiled from and to patterns. -// If a from/to pattern pair needs to be used more than once, it's recommended -// to create a Translator and reuse it. -type Translator struct { - quickDict *runeDict // A quick dictionary to look up rune by index. Only available for latin runes. - runeMap runeMap // Rune map for translation. - ranges []*runeRangeMap // Ranges of runes. - mappedRune rune // If mappedRune >= 0, all matched runes are translated to the mappedRune. - reverted bool // If to pattern is empty, all matched characters will be deleted. - hasPattern bool -} - -// NewTranslator creates new Translator through a from/to pattern pair. -func NewTranslator(from, to string) *Translator { - tr := &Translator{} - - if from == "" { - return tr - } - - reverted := from[0] == '^' - deletion := len(to) == 0 - - if reverted { - from = from[1:] - } - - var fromStart, fromEnd, fromRangeStep rune - var toStart, toEnd, toRangeStep rune - var fromRangeSize, toRangeSize rune - var singleRunes []rune - - // Update the to rune range. - updateRange := func() { - // No more rune to read in the to rune pattern. - if toEnd == utf8.RuneError { - return - } - - if toRangeStep == 0 { - to, toStart, toEnd, toRangeStep = nextRuneRange(to, toEnd) - return - } - - // Current range is not empty. Consume 1 rune from start. - if toStart != toEnd { - toStart += toRangeStep - return - } - - // No more rune. Repeat the last rune. - if to == "" { - toEnd = utf8.RuneError - return - } - - // Both start and end are used. Read two more runes from the to pattern. - to, toStart, toEnd, toRangeStep = nextRuneRange(to, utf8.RuneError) - } - - if deletion { - toStart = utf8.RuneError - toEnd = utf8.RuneError - } else { - // If from pattern is reverted, only the last rune in the to pattern will be used. - if reverted { - var size int - - for len(to) > 0 { - toStart, size = utf8.DecodeRuneInString(to) - to = to[size:] - } - - toEnd = utf8.RuneError - } else { - to, toStart, toEnd, toRangeStep = nextRuneRange(to, utf8.RuneError) - } - } - - fromEnd = utf8.RuneError - - for len(from) > 0 { - from, fromStart, fromEnd, fromRangeStep = nextRuneRange(from, fromEnd) - - // fromStart is a single character. Just map it with a rune in the to pattern. - if fromRangeStep == 0 { - singleRunes = tr.addRune(fromStart, toStart, singleRunes) - updateRange() - continue - } - - for toEnd != utf8.RuneError && fromStart != fromEnd { - // If mapped rune is a single character instead of a range, simply shift first - // rune in the range. - if toRangeStep == 0 { - singleRunes = tr.addRune(fromStart, toStart, singleRunes) - updateRange() - fromStart += fromRangeStep - continue - } - - fromRangeSize = (fromEnd - fromStart) * fromRangeStep - toRangeSize = (toEnd - toStart) * toRangeStep - - // Not enough runes in the to pattern. Need to read more. - if fromRangeSize > toRangeSize { - fromStart, toStart = tr.addRuneRange(fromStart, fromStart+toRangeSize*fromRangeStep, toStart, toEnd, singleRunes) - fromStart += fromRangeStep - updateRange() - - // Edge case: If fromRangeSize == toRangeSize + 1, the last fromStart value needs be considered - // as a single rune. - if fromStart == fromEnd { - singleRunes = tr.addRune(fromStart, toStart, singleRunes) - updateRange() - } - - continue - } - - fromStart, toStart = tr.addRuneRange(fromStart, fromEnd, toStart, toStart+fromRangeSize*toRangeStep, singleRunes) - updateRange() - break - } - - if fromStart == fromEnd { - fromEnd = utf8.RuneError - continue - } - - _, toStart = tr.addRuneRange(fromStart, fromEnd, toStart, toStart, singleRunes) - fromEnd = utf8.RuneError - } - - if fromEnd != utf8.RuneError { - tr.addRune(fromEnd, toStart, singleRunes) - } - - tr.reverted = reverted - tr.mappedRune = -1 - tr.hasPattern = true - - // Translate RuneError only if in deletion or reverted mode. - if deletion || reverted { - tr.mappedRune = toStart - } - - return tr -} - -func (tr *Translator) addRune(from, to rune, singleRunes []rune) []rune { - if from <= unicode.MaxASCII { - if tr.quickDict == nil { - tr.quickDict = &runeDict{} - } - - tr.quickDict.Dict[from] = to - } else { - if tr.runeMap == nil { - tr.runeMap = make(runeMap) - } - - tr.runeMap[from] = to - } - - singleRunes = append(singleRunes, from) - return singleRunes -} - -func (tr *Translator) addRuneRange(fromLo, fromHi, toLo, toHi rune, singleRunes []rune) (rune, rune) { - var r rune - var rrm *runeRangeMap - - if fromLo < fromHi { - rrm = &runeRangeMap{ - FromLo: fromLo, - FromHi: fromHi, - ToLo: toLo, - ToHi: toHi, - } - } else { - rrm = &runeRangeMap{ - FromLo: fromHi, - FromHi: fromLo, - ToLo: toHi, - ToHi: toLo, - } - } - - // If there is any single rune conflicts with this rune range, clear single rune record. - for _, r = range singleRunes { - if rrm.FromLo <= r && r <= rrm.FromHi { - if r <= unicode.MaxASCII { - tr.quickDict.Dict[r] = 0 - } else { - delete(tr.runeMap, r) - } - } - } - - tr.ranges = append(tr.ranges, rrm) - return fromHi, toHi -} - -func nextRuneRange(str string, last rune) (remaining string, start, end rune, rangeStep rune) { - var r rune - var size int - - remaining = str - escaping := false - isRange := false - - for len(remaining) > 0 { - r, size = utf8.DecodeRuneInString(remaining) - remaining = remaining[size:] - - // Parse special characters. - if !escaping { - if r == '\\' { - escaping = true - continue - } - - if r == '-' { - // Ignore slash at beginning of string. - if last == utf8.RuneError { - continue - } - - start = last - isRange = true - continue - } - } - - escaping = false - - if last != utf8.RuneError { - // This is a range which start and end are the same. - // Considier it as a normal character. - if isRange && last == r { - isRange = false - continue - } - - start = last - end = r - - if isRange { - if start < end { - rangeStep = 1 - } else { - rangeStep = -1 - } - } - - return - } - - last = r - } - - start = last - end = utf8.RuneError - return -} - -// Translate str with a from/to pattern pair. -// -// See comment in Translate function for usage and samples. -func (tr *Translator) Translate(str string) string { - if !tr.hasPattern || str == "" { - return str - } - - var r rune - var size int - var needTr bool - - orig := str - - var output *stringBuilder - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - r, needTr = tr.TranslateRune(r) - - if needTr && output == nil { - output = allocBuffer(orig, str) - } - - if r != utf8.RuneError && output != nil { - output.WriteRune(r) - } - - str = str[size:] - } - - // No character is translated. - if output == nil { - return orig - } - - return output.String() -} - -// TranslateRune return translated rune and true if r matches the from pattern. -// If r doesn't match the pattern, original r is returned and translated is false. -func (tr *Translator) TranslateRune(r rune) (result rune, translated bool) { - switch { - case tr.quickDict != nil: - if r <= unicode.MaxASCII { - result = tr.quickDict.Dict[r] - - if result != 0 { - translated = true - - if tr.mappedRune >= 0 { - result = tr.mappedRune - } - - break - } - } - - fallthrough - - case tr.runeMap != nil: - var ok bool - - if result, ok = tr.runeMap[r]; ok { - translated = true - - if tr.mappedRune >= 0 { - result = tr.mappedRune - } - - break - } - - fallthrough - - default: - var rrm *runeRangeMap - ranges := tr.ranges - - for i := len(ranges) - 1; i >= 0; i-- { - rrm = ranges[i] - - if rrm.FromLo <= r && r <= rrm.FromHi { - translated = true - - if tr.mappedRune >= 0 { - result = tr.mappedRune - break - } - - if rrm.ToLo < rrm.ToHi { - result = rrm.ToLo + r - rrm.FromLo - } else if rrm.ToLo > rrm.ToHi { - // ToHi can be smaller than ToLo if range is from higher to lower. - result = rrm.ToLo - r + rrm.FromLo - } else { - result = rrm.ToLo - } - - break - } - } - } - - if tr.reverted { - if !translated { - result = tr.mappedRune - } - - translated = !translated - } - - if !translated { - result = r - } - - return -} - -// HasPattern returns true if Translator has one pattern at least. -func (tr *Translator) HasPattern() bool { - return tr.hasPattern -} - -// Translate str with the characters defined in from replaced by characters defined in to. -// -// From and to are patterns representing a set of characters. Pattern is defined as following. -// -// Special characters: -// -// 1. '-' means a range of runes, e.g. -// "a-z" means all characters from 'a' to 'z' inclusive; -// "z-a" means all characters from 'z' to 'a' inclusive. -// 2. '^' as first character means a set of all runes excepted listed, e.g. -// "^a-z" means all characters except 'a' to 'z' inclusive. -// 3. '\' escapes special characters. -// -// Normal character represents itself, e.g. "abc" is a set including 'a', 'b' and 'c'. -// -// Translate will try to find a 1:1 mapping from from to to. -// If to is smaller than from, last rune in to will be used to map "out of range" characters in from. -// -// Note that '^' only works in the from pattern. It will be considered as a normal character in the to pattern. -// -// If the to pattern is an empty string, Translate works exactly the same as Delete. -// -// Samples: -// -// Translate("hello", "aeiou", "12345") => "h2ll4" -// Translate("hello", "a-z", "A-Z") => "HELLO" -// Translate("hello", "z-a", "a-z") => "svool" -// Translate("hello", "aeiou", "*") => "h*ll*" -// Translate("hello", "^l", "*") => "**ll*" -// Translate("hello ^ world", `\^lo`, "*") => "he*** * w*r*d" -func Translate(str, from, to string) string { - tr := NewTranslator(from, to) - return tr.Translate(str) -} - -// Delete runes in str matching the pattern. -// Pattern is defined in Translate function. -// -// Samples: -// -// Delete("hello", "aeiou") => "hll" -// Delete("hello", "a-k") => "llo" -// Delete("hello", "^a-k") => "he" -func Delete(str, pattern string) string { - tr := NewTranslator(pattern, "") - return tr.Translate(str) -} - -// Count how many runes in str match the pattern. -// Pattern is defined in Translate function. -// -// Samples: -// -// Count("hello", "aeiou") => 3 -// Count("hello", "a-k") => 3 -// Count("hello", "^a-k") => 2 -func Count(str, pattern string) int { - if pattern == "" || str == "" { - return 0 - } - - var r rune - var size int - var matched bool - - tr := NewTranslator(pattern, "") - cnt := 0 - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - str = str[size:] - - if _, matched = tr.TranslateRune(r); matched { - cnt++ - } - } - - return cnt -} - -// Squeeze deletes adjacent repeated runes in str. -// If pattern is not empty, only runes matching the pattern will be squeezed. -// -// Samples: -// -// Squeeze("hello", "") => "helo" -// Squeeze("hello", "m-z") => "hello" -// Squeeze("hello world", " ") => "hello world" -func Squeeze(str, pattern string) string { - var last, r rune - var size int - var skipSqueeze, matched bool - var tr *Translator - var output *stringBuilder - - orig := str - last = -1 - - if len(pattern) > 0 { - tr = NewTranslator(pattern, "") - } - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - // Need to squeeze the str. - if last == r && !skipSqueeze { - if tr != nil { - if _, matched = tr.TranslateRune(r); !matched { - skipSqueeze = true - } - } - - if output == nil { - output = allocBuffer(orig, str) - } - - if skipSqueeze { - output.WriteRune(r) - } - } else { - if output != nil { - output.WriteRune(r) - } - - last = r - skipSqueeze = false - } - - str = str[size:] - } - - if output == nil { - return orig - } - - return output.String() -} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/LICENSE b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/NOTICE b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/NOTICE deleted file mode 100644 index 5d8cb5b72..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/NOTICE +++ /dev/null @@ -1 +0,0 @@ -Copyright 2012 Matt T. Proud (matt.proud@gmail.com) diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/.gitignore b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/.gitignore deleted file mode 100644 index e16fb946b..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cover.dat diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/Makefile b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/Makefile deleted file mode 100644 index 81be21437..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - -cover: - go test -cover -v -coverprofile=cover.dat ./... - go tool cover -func cover.dat - -.PHONY: cover diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/decode.go b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/decode.go deleted file mode 100644 index 7c08e564f..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/decode.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2013 Matt T. Proud -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package pbutil - -import ( - "encoding/binary" - "errors" - "io" - - "google.golang.org/protobuf/proto" -) - -// TODO: Give error package name prefix in next minor release. -var errInvalidVarint = errors.New("invalid varint32 encountered") - -// ReadDelimited decodes a message from the provided length-delimited stream, -// where the length is encoded as 32-bit varint prefix to the message body. -// It returns the total number of bytes read and any applicable error. This is -// roughly equivalent to the companion Java API's -// MessageLite#parseDelimitedFrom. As per the reader contract, this function -// calls r.Read repeatedly as required until exactly one message including its -// prefix is read and decoded (or an error has occurred). The function never -// reads more bytes from the stream than required. The function never returns -// an error if a message has been read and decoded correctly, even if the end -// of the stream has been reached in doing so. In that case, any subsequent -// calls return (0, io.EOF). -func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) { - // TODO: Consider allowing the caller to specify a decode buffer in the - // next major version. - - // TODO: Consider using error wrapping to annotate error state in pass- - // through cases in the next minor version. - - // Per AbstractParser#parsePartialDelimitedFrom with - // CodedInputStream#readRawVarint32. - var headerBuf [binary.MaxVarintLen32]byte - var bytesRead, varIntBytes int - var messageLength uint64 - for varIntBytes == 0 { // i.e. no varint has been decoded yet. - if bytesRead >= len(headerBuf) { - return bytesRead, errInvalidVarint - } - // We have to read byte by byte here to avoid reading more bytes - // than required. Each read byte is appended to what we have - // read before. - newBytesRead, err := r.Read(headerBuf[bytesRead : bytesRead+1]) - if newBytesRead == 0 { - if err != nil { - return bytesRead, err - } - // A Reader should not return (0, nil); but if it does, it should - // be treated as no-op according to the Reader contract. - continue - } - bytesRead += newBytesRead - // Now present everything read so far to the varint decoder and - // see if a varint can be decoded already. - messageLength, varIntBytes = binary.Uvarint(headerBuf[:bytesRead]) - } - - messageBuf := make([]byte, messageLength) - newBytesRead, err := io.ReadFull(r, messageBuf) - bytesRead += newBytesRead - if err != nil { - return bytesRead, err - } - - return bytesRead, proto.Unmarshal(messageBuf, m) -} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/doc.go b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/doc.go deleted file mode 100644 index c318385cb..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/doc.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 Matt T. Proud -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package pbutil provides record length-delimited Protocol Buffer streaming. -package pbutil diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/encode.go b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/encode.go deleted file mode 100644 index e58dd9d29..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/encode.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2013 Matt T. Proud -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package pbutil - -import ( - "encoding/binary" - "io" - - "google.golang.org/protobuf/proto" -) - -// WriteDelimited encodes and dumps a message to the provided writer prefixed -// with a 32-bit varint indicating the length of the encoded message, producing -// a length-delimited record stream, which can be used to chain together -// encoded messages of the same type together in a file. It returns the total -// number of bytes written and any applicable error. This is roughly -// equivalent to the companion Java API's MessageLite#writeDelimitedTo. -func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) { - // TODO: Consider allowing the caller to specify an encode buffer in the - // next major version. - - buffer, err := proto.Marshal(m) - if err != nil { - return 0, err - } - - var buf [binary.MaxVarintLen32]byte - encodedLength := binary.PutUvarint(buf[:], uint64(len(buffer))) - - sync, err := w.Write(buf[:encodedLength]) - if err != nil { - return sync, err - } - - n, err = w.Write(buffer) - return n + sync, err -} diff --git a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md index 57992854b..3011efb57 100644 --- a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md @@ -1,3 +1,100 @@ +## 2.21.0 + + + ### Features + - add support for GINKGO_TIME_FORMAT [a69eb39] + - add GINKGO_NO_COLOR to disable colors via environment variables [bcab9c8] + + ### Fixes + - increase threshold in timeline matcher [e548367] + - Fix the document by replacing `SpecsThatWillBeRun` with `SpecsThatWillRun` + [c2c4d3c] + + ### Maintenance + - bump various dependencies [7e65a00] + +## 2.20.2 + +Require Go 1.22+ + +### Maintenance +- bump go to v1.22 [a671816] + +## 2.20.1 + +### Fixes +- make BeSpecEvent duration matcher more forgiving [d6f9640] + +## 2.20.0 + +### Features +- Add buildvcs flag [be5ab95] + +### Maintenance +- Add update-deps to makefile [d303d14] +- bump all dependencies [7a50221] + +## 2.19.1 + +### Fixes +- update supported platforms for race conditions [63c8c30] +- [build] Allow custom name for binaries. [ff41e27] + +### Maintenance +- bump gomega [76f4e0c] +- Bump rexml from 3.2.6 to 3.2.8 in /docs (#1417) [b69c00d] +- Bump golang.org/x/sys from 0.20.0 to 0.21.0 (#1425) [f097741] + +## 2.19.0 + +### Features + +[Label Sets](https://onsi.github.io/ginkgo/#label-sets) allow for more expressive and flexible label filtering. + +## 2.18.0 + +### Features +- Add --slience-skips and --force-newlines [f010b65] +- fail when no tests were run and --fail-on-empty was set [d80eebe] + +### Fixes +- Fix table entry context edge case [42013d6] + +### Maintenance +- Bump golang.org/x/tools from 0.20.0 to 0.21.0 (#1406) [fcf1fd7] +- Bump github.com/onsi/gomega from 1.33.0 to 1.33.1 (#1399) [8bb14fd] +- Bump golang.org/x/net from 0.24.0 to 0.25.0 (#1407) [04bfad7] + +## 2.17.3 + +### Fixes +`ginkgo watch` now ignores hidden files [bde6e00] + +## 2.17.2 + +### Fixes +- fix: close files [32259c8] +- fix github output log level for skipped specs [780e7a3] + +### Maintenance +- Bump github.com/google/pprof [d91fe4e] +- Bump github.com/go-task/slim-sprig to v3 [8cb662e] +- Bump golang.org/x/net in /integration/_fixtures/version_mismatch_fixture (#1391) [3134422] +- Bump github-pages from 230 to 231 in /docs (#1384) [eca81b4] +- Bump golang.org/x/tools from 0.19.0 to 0.20.0 (#1383) [760def8] +- Bump golang.org/x/net from 0.23.0 to 0.24.0 (#1381) [4ce33f4] +- Fix test for gomega version bump [f2fcd97] +- Bump github.com/onsi/gomega from 1.30.0 to 1.33.0 (#1390) [fd622d2] +- Bump golang.org/x/tools from 0.17.0 to 0.19.0 (#1368) [5474a26] +- Bump github-pages from 229 to 230 in /docs (#1359) [e6d1170] +- Bump google.golang.org/protobuf from 1.28.0 to 1.33.0 (#1374) [7f447b2] +- Bump golang.org/x/net from 0.20.0 to 0.23.0 (#1380) [f15239a] + +## 2.17.1 + +### Fixes +- If the user sets --seed=0, make sure all parallel nodes get the same seed [af0330d] + ## 2.17.0 ### Features diff --git a/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md b/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md index 1da92fe7e..80de566a5 100644 --- a/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md +++ b/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md @@ -6,8 +6,10 @@ Your contributions to Ginkgo are essential for its long-term maintenance and imp - Ensure adequate test coverage: - When adding to the Ginkgo library, add unit and/or integration tests (under the `integration` folder). - When adding to the Ginkgo CLI, note that there are very few unit tests. Please add an integration test. -- Make sure all the tests succeed via `ginkgo -r -p` -- Vet your changes via `go vet ./...` -- Update the documentation. Ginkgo uses `godoc` comments and documentation in `docs/index.md`. You can run `bundle exec jekyll serve` in the `docs` directory to preview your changes. +- Run `make` or: + - Install ginkgo locally via `go install ./...` + - Make sure all the tests succeed via `ginkgo -r -p` + - Vet your changes via `go vet ./...` +- Update the documentation. Ginkgo uses `godoc` comments and documentation in `docs/index.md`. You can run `bundle && bundle exec jekyll serve` in the `docs` directory to preview your changes. -Thanks for supporting Ginkgo! \ No newline at end of file +Thanks for supporting Ginkgo! diff --git a/vendor/github.com/onsi/ginkgo/v2/Makefile b/vendor/github.com/onsi/ginkgo/v2/Makefile new file mode 100644 index 000000000..06dff97cd --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/v2/Makefile @@ -0,0 +1,16 @@ +# default task since it's first +.PHONY: all +all: vet test + +.PHONY: test +test: + go run github.com/onsi/ginkgo/v2/ginkgo -r -p -randomize-all -keep-going + +.PHONY: vet +vet: + go vet ./... + +.PHONY: update-deps +update-deps: + go get -u ./... + go mod tidy \ No newline at end of file diff --git a/vendor/github.com/onsi/ginkgo/v2/formatter/formatter.go b/vendor/github.com/onsi/ginkgo/v2/formatter/formatter.go index 743555dde..4d5749114 100644 --- a/vendor/github.com/onsi/ginkgo/v2/formatter/formatter.go +++ b/vendor/github.com/onsi/ginkgo/v2/formatter/formatter.go @@ -82,6 +82,10 @@ func New(colorMode ColorMode) Formatter { return fmt.Sprintf("\x1b[38;5;%dm", colorCode) } + if _, noColor := os.LookupEnv("GINKGO_NO_COLOR"); noColor { + colorMode = ColorModeNone + } + f := Formatter{ ColorMode: colorMode, colors: map[string]string{ diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/build/build_command.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/build/build_command.go index 5db5d1a7b..fd1726084 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/build/build_command.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/build/build_command.go @@ -2,6 +2,8 @@ package build import ( "fmt" + "os" + "path" "github.com/onsi/ginkgo/v2/ginkgo/command" "github.com/onsi/ginkgo/v2/ginkgo/internal" @@ -53,7 +55,18 @@ func buildSpecs(args []string, cliConfig types.CLIConfig, goFlagsConfig types.Go if suite.State.Is(internal.TestSuiteStateFailedToCompile) { fmt.Println(suite.CompilationError.Error()) } else { - fmt.Printf("Compiled %s.test\n", suite.PackageName) + if len(goFlagsConfig.O) == 0 { + goFlagsConfig.O = path.Join(suite.Path, suite.PackageName+".test") + } else { + stat, err := os.Stat(goFlagsConfig.O) + if err != nil { + panic(err) + } + if stat.IsDir() { + goFlagsConfig.O += "/" + suite.PackageName + ".test" + } + } + fmt.Printf("Compiled %s\n", goFlagsConfig.O) } } diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go index 73aff0b7a..b2dc59be6 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go @@ -7,7 +7,7 @@ import ( "os" "text/template" - sprig "github.com/go-task/slim-sprig" + sprig "github.com/go-task/slim-sprig/v3" "github.com/onsi/ginkgo/v2/ginkgo/command" "github.com/onsi/ginkgo/v2/ginkgo/internal" "github.com/onsi/ginkgo/v2/types" diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go index be01dec97..cf3b7cb6d 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go @@ -10,7 +10,7 @@ import ( "strings" "text/template" - sprig "github.com/go-task/slim-sprig" + sprig "github.com/go-task/slim-sprig/v3" "github.com/onsi/ginkgo/v2/ginkgo/command" "github.com/onsi/ginkgo/v2/ginkgo/internal" "github.com/onsi/ginkgo/v2/types" @@ -174,6 +174,7 @@ func moduleName(modRoot string) string { if err != nil { return "" } + defer modFile.Close() mod := make([]byte, 128) _, err = modFile.Read(mod) diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/compile.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/compile.go index 86da7340d..48827cc5e 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/compile.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/compile.go @@ -25,6 +25,18 @@ func CompileSuite(suite TestSuite, goFlagsConfig types.GoFlagsConfig) TestSuite return suite } + if len(goFlagsConfig.O) > 0 { + userDefinedPath, err := filepath.Abs(goFlagsConfig.O) + if err != nil { + suite.State = TestSuiteStateFailedToCompile + suite.CompilationError = fmt.Errorf("Failed to compute compilation target path %s:\n%s", goFlagsConfig.O, err.Error()) + return suite + } + path = userDefinedPath + } + + goFlagsConfig.O = path + ginkgoInvocationPath, _ := os.Getwd() ginkgoInvocationPath, _ = filepath.Abs(ginkgoInvocationPath) packagePath := suite.AbsPath() @@ -34,7 +46,7 @@ func CompileSuite(suite TestSuite, goFlagsConfig types.GoFlagsConfig) TestSuite suite.CompilationError = fmt.Errorf("Failed to get relative path from package to the current working directory:\n%s", err.Error()) return suite } - args, err := types.GenerateGoTestCompileArgs(goFlagsConfig, path, "./", pathToInvocationPath) + args, err := types.GenerateGoTestCompileArgs(goFlagsConfig, "./", pathToInvocationPath) if err != nil { suite.State = TestSuiteStateFailedToCompile suite.CompilationError = fmt.Errorf("Failed to generate go test compile flags:\n%s", err.Error()) diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/profiles_and_reports.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/profiles_and_reports.go index 5f35864dd..8e16d2bb0 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/profiles_and_reports.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/profiles_and_reports.go @@ -161,6 +161,7 @@ func MergeAndCleanupCoverProfiles(profiles []string, destination string) error { if err != nil { return err } + defer dst.Close() err = DumpCoverProfiles(merged, dst) if err != nil { return err @@ -196,6 +197,7 @@ func MergeProfiles(profilePaths []string, destination string) error { return fmt.Errorf("Could not open profile: %s\n%s", profilePath, err.Error()) } prof, err := profile.Parse(proFile) + _ = proFile.Close() if err != nil { return fmt.Errorf("Could not parse profile: %s\n%s", profilePath, err.Error()) } diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go index 17d052bdc..0e6ae1f29 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/watch/package_hash.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "regexp" + "strings" "time" ) @@ -79,6 +80,10 @@ func (p *PackageHash) computeHashes() (codeHash string, codeModifiedTime time.Ti continue } + if isHiddenFile(info) { + continue + } + if goTestRegExp.MatchString(info.Name()) { testHash += p.hashForFileInfo(info) if info.ModTime().After(testModifiedTime) { @@ -103,6 +108,10 @@ func (p *PackageHash) computeHashes() (codeHash string, codeModifiedTime time.Ti return } +func isHiddenFile(info os.FileInfo) bool { + return strings.HasPrefix(info.Name(), ".") || strings.HasPrefix(info.Name(), "_") +} + func (p *PackageHash) hashForFileInfo(info os.FileInfo) string { return fmt.Sprintf("%s_%d_%d", info.Name(), info.Size(), info.ModTime().UnixNano()) } diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/suite.go b/vendor/github.com/onsi/ginkgo/v2/internal/suite.go index a994ee3d6..a3c9e6bf1 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/suite.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/suite.go @@ -489,10 +489,15 @@ func (suite *Suite) runSpecs(description string, suiteLabels Labels, suitePath s newGroup(suite).run(specs.AtIndices(groupedSpecIndices[groupedSpecIdx])) } - if specs.HasAnySpecsMarkedPending() && suite.config.FailOnPending { + if suite.config.FailOnPending && specs.HasAnySpecsMarkedPending() { suite.report.SpecialSuiteFailureReasons = append(suite.report.SpecialSuiteFailureReasons, "Detected pending specs and --fail-on-pending is set") suite.report.SuiteSucceeded = false } + + if suite.config.FailOnEmpty && specs.CountWithoutSkip() == 0 { + suite.report.SpecialSuiteFailureReasons = append(suite.report.SpecialSuiteFailureReasons, "Detected no specs ran and --fail-on-empty is set") + suite.report.SuiteSucceeded = false + } } if ranBeforeSuite { diff --git a/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go b/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go index 4026859ec..480730486 100644 --- a/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go +++ b/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go @@ -202,6 +202,11 @@ func (r *DefaultReporter) DidRun(report types.SpecReport) { v := r.conf.Verbosity() inParallel := report.RunningInParallel + //should we completely omit this spec? + if report.State.Is(types.SpecStateSkipped) && r.conf.SilenceSkips { + return + } + header := r.specDenoter if report.LeafNodeType.Is(types.NodeTypesForSuiteLevelNodes) { header = fmt.Sprintf("[%s]", report.LeafNodeType) @@ -278,9 +283,12 @@ func (r *DefaultReporter) DidRun(report types.SpecReport) { } } - // If we have no content to show, jsut emit the header and return + // If we have no content to show, just emit the header and return if !reportHasContent { r.emit(r.f(highlightColor + header + "{{/}}")) + if r.conf.ForceNewlines { + r.emit("\n") + } return } @@ -419,7 +427,11 @@ func (r *DefaultReporter) emitFailure(indent uint, state types.SpecState, failur highlightColor := r.highlightColorForState(state) r.emitBlock(r.fi(indent, highlightColor+"[%s] %s{{/}}", r.humanReadableState(state), failure.Message)) if r.conf.GithubOutput { - r.emitBlock(r.fi(indent, "::error file=%s,line=%d::%s %s", failure.Location.FileName, failure.Location.LineNumber, failure.FailureNodeType, failure.TimelineLocation.Time.Format(types.GINKGO_TIME_FORMAT))) + level := "error" + if state.Is(types.SpecStateSkipped) { + level = "notice" + } + r.emitBlock(r.fi(indent, "::%s file=%s,line=%d::%s %s", level, failure.Location.FileName, failure.Location.LineNumber, failure.FailureNodeType, failure.TimelineLocation.Time.Format(types.GINKGO_TIME_FORMAT))) } else { r.emitBlock(r.fi(indent, highlightColor+"In {{bold}}[%s]{{/}}"+highlightColor+" at: {{bold}}%s{{/}} {{gray}}@ %s{{/}}\n", failure.FailureNodeType, failure.Location, failure.TimelineLocation.Time.Format(types.GINKGO_TIME_FORMAT))) } diff --git a/vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go b/vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go index 43244a9bd..562e0f62b 100644 --- a/vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go +++ b/vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go @@ -177,6 +177,7 @@ func GenerateJUnitReportWithConfig(report types.Report, dst string, config Junit {"FocusFiles", strings.Join(report.SuiteConfig.FocusFiles, ";")}, {"SkipFiles", strings.Join(report.SuiteConfig.SkipFiles, ";")}, {"FailOnPending", fmt.Sprintf("%t", report.SuiteConfig.FailOnPending)}, + {"FailOnEmpty", fmt.Sprintf("%t", report.SuiteConfig.FailOnEmpty)}, {"FailFast", fmt.Sprintf("%t", report.SuiteConfig.FailFast)}, {"FlakeAttempts", fmt.Sprintf("%d", report.SuiteConfig.FlakeAttempts)}, {"DryRun", fmt.Sprintf("%t", report.SuiteConfig.DryRun)}, @@ -324,6 +325,7 @@ func MergeAndCleanupJUnitReports(sources []string, dst string) ([]string, error) continue } err = xml.NewDecoder(f).Decode(&report) + _ = f.Close() if err != nil { messages = append(messages, fmt.Sprintf("Could not decode %s:\n%s", source, err.Error())) continue diff --git a/vendor/github.com/onsi/ginkgo/v2/table_dsl.go b/vendor/github.com/onsi/ginkgo/v2/table_dsl.go index a3aef821b..c7de7a8be 100644 --- a/vendor/github.com/onsi/ginkgo/v2/table_dsl.go +++ b/vendor/github.com/onsi/ginkgo/v2/table_dsl.go @@ -269,11 +269,15 @@ func generateTable(description string, isSubtree bool, args ...interface{}) { internalNodeArgs = append(internalNodeArgs, entry.decorations...) hasContext := false - if internalBodyType.NumIn() > 0. { + if internalBodyType.NumIn() > 0 { if internalBodyType.In(0).Implements(specContextType) { hasContext = true - } else if internalBodyType.In(0).Implements(contextType) && (len(entry.parameters) == 0 || !reflect.TypeOf(entry.parameters[0]).Implements(contextType)) { + } else if internalBodyType.In(0).Implements(contextType) { hasContext = true + if len(entry.parameters) > 0 && reflect.TypeOf(entry.parameters[0]) != nil && reflect.TypeOf(entry.parameters[0]).Implements(contextType) { + // we allow you to pass in a non-nil context + hasContext = false + } } } diff --git a/vendor/github.com/onsi/ginkgo/v2/types/config.go b/vendor/github.com/onsi/ginkgo/v2/types/config.go index 7c82065df..8c0dfab8c 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/config.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/config.go @@ -25,6 +25,7 @@ type SuiteConfig struct { SkipFiles []string LabelFilter string FailOnPending bool + FailOnEmpty bool FailFast bool FlakeAttempts int MustPassRepeatedly int @@ -90,6 +91,8 @@ type ReporterConfig struct { FullTrace bool ShowNodeEvents bool GithubOutput bool + SilenceSkips bool + ForceNewlines bool JSONReport string JUnitReport string @@ -199,6 +202,7 @@ type GoFlagsConfig struct { A bool ASMFlags string BuildMode string + BuildVCS bool Compiler string GCCGoFlags string GCFlags string @@ -216,6 +220,7 @@ type GoFlagsConfig struct { ToolExec string Work bool X bool + O string } func NewDefaultGoFlagsConfig() GoFlagsConfig { @@ -265,7 +270,7 @@ var FlagSections = GinkgoFlagSections{ // SuiteConfigFlags provides flags for the Ginkgo test process, and CLI var SuiteConfigFlags = GinkgoFlags{ {KeyPath: "S.RandomSeed", Name: "seed", SectionKey: "order", UsageDefaultValue: "randomly generated by Ginkgo", - Usage: "The seed used to randomize the spec suite."}, + Usage: "The seed used to randomize the spec suite.", AlwaysExport: true}, {KeyPath: "S.RandomizeAllSpecs", Name: "randomize-all", SectionKey: "order", DeprecatedName: "randomizeAllSpecs", DeprecatedDocLink: "changed-command-line-flags", Usage: "If set, ginkgo will randomize all specs together. By default, ginkgo only randomizes the top level Describe, Context and When containers."}, @@ -275,6 +280,8 @@ var SuiteConfigFlags = GinkgoFlags{ Usage: "If set, ginkgo will stop running a test suite after a failure occurs."}, {KeyPath: "S.FlakeAttempts", Name: "flake-attempts", SectionKey: "failure", UsageDefaultValue: "0 - failed tests are not retried", DeprecatedName: "flakeAttempts", DeprecatedDocLink: "changed-command-line-flags", Usage: "Make up to this many attempts to run each spec. If any of the attempts succeed, the suite will not be failed."}, + {KeyPath: "S.FailOnEmpty", Name: "fail-on-empty", SectionKey: "failure", + Usage: "If set, ginkgo will mark the test suite as failed if no specs are run."}, {KeyPath: "S.DryRun", Name: "dry-run", SectionKey: "debug", DeprecatedName: "dryRun", DeprecatedDocLink: "changed-command-line-flags", Usage: "If set, ginkgo will walk the test hierarchy without actually running anything. Best paired with -v."}, @@ -321,7 +328,7 @@ var ParallelConfigFlags = GinkgoFlags{ // ReporterConfigFlags provides flags for the Ginkgo test process, and CLI var ReporterConfigFlags = GinkgoFlags{ {KeyPath: "R.NoColor", Name: "no-color", SectionKey: "output", DeprecatedName: "noColor", DeprecatedDocLink: "changed-command-line-flags", - Usage: "If set, suppress color output in default reporter."}, + Usage: "If set, suppress color output in default reporter. You can also set the environment variable GINKGO_NO_COLOR=TRUE"}, {KeyPath: "R.Verbose", Name: "v", SectionKey: "output", Usage: "If set, emits more output including GinkgoWriter contents."}, {KeyPath: "R.VeryVerbose", Name: "vv", SectionKey: "output", @@ -334,6 +341,10 @@ var ReporterConfigFlags = GinkgoFlags{ Usage: "If set, default reporter prints node > Enter and < Exit events when specs fail"}, {KeyPath: "R.GithubOutput", Name: "github-output", SectionKey: "output", Usage: "If set, default reporter prints easier to manage output in Github Actions."}, + {KeyPath: "R.SilenceSkips", Name: "silence-skips", SectionKey: "output", + Usage: "If set, default reporter will not print out skipped tests."}, + {KeyPath: "R.ForceNewlines", Name: "force-newlines", SectionKey: "output", + Usage: "If set, default reporter will ensure a newline appears after each test."}, {KeyPath: "R.JSONReport", Name: "json-report", UsageArgument: "filename.json", SectionKey: "output", Usage: "If set, Ginkgo will generate a JSON-formatted test report at the specified location."}, @@ -502,7 +513,7 @@ var GinkgoCLIWatchFlags = GinkgoFlags{ // GoBuildFlags provides flags for the Ginkgo CLI build, run, and watch commands that capture go's build-time flags. These are passed to go test -c by the ginkgo CLI var GoBuildFlags = GinkgoFlags{ {KeyPath: "Go.Race", Name: "race", SectionKey: "code-and-coverage-analysis", - Usage: "enable data race detection. Supported only on linux/amd64, freebsd/amd64, darwin/amd64, windows/amd64, linux/ppc64le and linux/arm64 (only for 48-bit VMA)."}, + Usage: "enable data race detection. Supported on linux/amd64, linux/ppc64le, linux/arm64, linux/s390x, freebsd/amd64, netbsd/amd64, darwin/amd64, darwin/arm64, and windows/amd64."}, {KeyPath: "Go.Vet", Name: "vet", UsageArgument: "list", SectionKey: "code-and-coverage-analysis", Usage: `Configure the invocation of "go vet" during "go test" to use the comma-separated list of vet checks. If list is empty, "go test" runs "go vet" with a curated list of checks believed to be always worth addressing. If list is "off", "go test" does not run "go vet" at all. Available checks can be found by running 'go doc cmd/vet'`}, {KeyPath: "Go.Cover", Name: "cover", SectionKey: "code-and-coverage-analysis", @@ -518,6 +529,8 @@ var GoBuildFlags = GinkgoFlags{ Usage: "arguments to pass on each go tool asm invocation."}, {KeyPath: "Go.BuildMode", Name: "buildmode", UsageArgument: "mode", SectionKey: "go-build", Usage: "build mode to use. See 'go help buildmode' for more."}, + {KeyPath: "Go.BuildVCS", Name: "buildvcs", SectionKey: "go-build", + Usage: "adds version control information."}, {KeyPath: "Go.Compiler", Name: "compiler", UsageArgument: "name", SectionKey: "go-build", Usage: "name of compiler to use, as in runtime.Compiler (gccgo or gc)."}, {KeyPath: "Go.GCCGoFlags", Name: "gccgoflags", UsageArgument: "'[pattern=]arg list'", SectionKey: "go-build", @@ -552,6 +565,8 @@ var GoBuildFlags = GinkgoFlags{ Usage: "print the name of the temporary work directory and do not delete it when exiting."}, {KeyPath: "Go.X", Name: "x", SectionKey: "go-build", Usage: "print the commands."}, + {KeyPath: "Go.O", Name: "o", SectionKey: "go-build", + Usage: "output binary path (including name)."}, } // GoRunFlags provides flags for the Ginkgo CLI run, and watch commands that capture go's run-time flags. These are passed to the compiled test binary by the ginkgo CLI @@ -605,7 +620,7 @@ func VetAndInitializeCLIAndGoConfig(cliConfig CLIConfig, goFlagsConfig GoFlagsCo } // GenerateGoTestCompileArgs is used by the Ginkgo CLI to generate command line arguments to pass to the go test -c command when compiling the test -func GenerateGoTestCompileArgs(goFlagsConfig GoFlagsConfig, destination string, packageToBuild string, pathToInvocationPath string) ([]string, error) { +func GenerateGoTestCompileArgs(goFlagsConfig GoFlagsConfig, packageToBuild string, pathToInvocationPath string) ([]string, error) { // if the user has set the CoverProfile run-time flag make sure to set the build-time cover flag to make sure // the built test binary can generate a coverprofile if goFlagsConfig.CoverProfile != "" { @@ -628,7 +643,7 @@ func GenerateGoTestCompileArgs(goFlagsConfig GoFlagsConfig, destination string, goFlagsConfig.CoverPkg = strings.Join(adjustedCoverPkgs, ",") } - args := []string{"test", "-c", "-o", destination, packageToBuild} + args := []string{"test", "-c", packageToBuild} goArgs, err := GenerateFlagArgs( GoBuildFlags, map[string]interface{}{ diff --git a/vendor/github.com/onsi/ginkgo/v2/types/flags.go b/vendor/github.com/onsi/ginkgo/v2/types/flags.go index 9186ae873..de69f3022 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/flags.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/flags.go @@ -24,7 +24,8 @@ type GinkgoFlag struct { DeprecatedDocLink string DeprecatedVersion string - ExportAs string + ExportAs string + AlwaysExport bool } type GinkgoFlags []GinkgoFlag @@ -431,7 +432,7 @@ func (ssv stringSliceVar) Set(s string) error { return nil } -//given a set of GinkgoFlags and bindings, generate flag arguments suitable to be passed to an application with that set of flags configured. +// given a set of GinkgoFlags and bindings, generate flag arguments suitable to be passed to an application with that set of flags configured. func GenerateFlagArgs(flags GinkgoFlags, bindings interface{}) ([]string, error) { result := []string{} for _, flag := range flags { @@ -451,19 +452,19 @@ func GenerateFlagArgs(flags GinkgoFlags, bindings interface{}) ([]string, error) iface := value.Interface() switch value.Type() { case reflect.TypeOf(string("")): - if iface.(string) != "" { + if iface.(string) != "" || flag.AlwaysExport { result = append(result, fmt.Sprintf("--%s=%s", name, iface)) } case reflect.TypeOf(int64(0)): - if iface.(int64) != 0 { + if iface.(int64) != 0 || flag.AlwaysExport { result = append(result, fmt.Sprintf("--%s=%d", name, iface)) } case reflect.TypeOf(float64(0)): - if iface.(float64) != 0 { + if iface.(float64) != 0 || flag.AlwaysExport { result = append(result, fmt.Sprintf("--%s=%f", name, iface)) } case reflect.TypeOf(int(0)): - if iface.(int) != 0 { + if iface.(int) != 0 || flag.AlwaysExport { result = append(result, fmt.Sprintf("--%s=%d", name, iface)) } case reflect.TypeOf(bool(true)): @@ -471,7 +472,7 @@ func GenerateFlagArgs(flags GinkgoFlags, bindings interface{}) ([]string, error) result = append(result, fmt.Sprintf("--%s", name)) } case reflect.TypeOf(time.Duration(0)): - if iface.(time.Duration) != time.Duration(0) { + if iface.(time.Duration) != time.Duration(0) || flag.AlwaysExport { result = append(result, fmt.Sprintf("--%s=%s", name, iface)) } diff --git a/vendor/github.com/onsi/ginkgo/v2/types/label_filter.go b/vendor/github.com/onsi/ginkgo/v2/types/label_filter.go index b0d3b651e..7fdc8aa23 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/label_filter.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/label_filter.go @@ -45,6 +45,83 @@ func orAction(a, b LabelFilter) LabelFilter { return func(labels []string) bool { return a(labels) || b(labels) } } +func labelSetFor(key string, labels []string) map[string]bool { + key = strings.ToLower(strings.TrimSpace(key)) + out := map[string]bool{} + for _, label := range labels { + components := strings.SplitN(label, ":", 2) + if len(components) < 2 { + continue + } + if key == strings.ToLower(strings.TrimSpace(components[0])) { + out[strings.ToLower(strings.TrimSpace(components[1]))] = true + } + } + + return out +} + +func isEmptyLabelSetAction(key string) LabelFilter { + return func(labels []string) bool { + return len(labelSetFor(key, labels)) == 0 + } +} + +func containsAnyLabelSetAction(key string, expectedValues []string) LabelFilter { + return func(labels []string) bool { + set := labelSetFor(key, labels) + for _, value := range expectedValues { + if set[value] { + return true + } + } + return false + } +} + +func containsAllLabelSetAction(key string, expectedValues []string) LabelFilter { + return func(labels []string) bool { + set := labelSetFor(key, labels) + for _, value := range expectedValues { + if !set[value] { + return false + } + } + return true + } +} + +func consistsOfLabelSetAction(key string, expectedValues []string) LabelFilter { + return func(labels []string) bool { + set := labelSetFor(key, labels) + if len(set) != len(expectedValues) { + return false + } + for _, value := range expectedValues { + if !set[value] { + return false + } + } + return true + } +} + +func isSubsetOfLabelSetAction(key string, expectedValues []string) LabelFilter { + expectedSet := map[string]bool{} + for _, value := range expectedValues { + expectedSet[value] = true + } + return func(labels []string) bool { + set := labelSetFor(key, labels) + for value := range set { + if !expectedSet[value] { + return false + } + } + return true + } +} + type lfToken uint const ( @@ -58,6 +135,9 @@ const ( lfTokenOr lfTokenRegexp lfTokenLabel + lfTokenSetKey + lfTokenSetOperation + lfTokenSetArgument lfTokenEOF ) @@ -71,6 +151,8 @@ func (l lfToken) Precedence() int { return 2 case lfTokenNot: return 3 + case lfTokenSetOperation: + return 4 } return -1 } @@ -93,6 +175,12 @@ func (l lfToken) String() string { return "/regexp/" case lfTokenLabel: return "label" + case lfTokenSetKey: + return "set_key" + case lfTokenSetOperation: + return "set_operation" + case lfTokenSetArgument: + return "set_argument" case lfTokenEOF: return "EOF" } @@ -148,6 +236,35 @@ func (tn *treeNode) constructLabelFilter(input string) (LabelFilter, error) { return nil, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, tn.location, fmt.Sprintf("RegExp compilation error: %s", err)) } return matchLabelRegexAction(re), nil + case lfTokenSetOperation: + tokenSetOperation := strings.ToLower(tn.value) + if tokenSetOperation == "isempty" { + return isEmptyLabelSetAction(tn.leftNode.value), nil + } + if tn.rightNode == nil { + return nil, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, tn.location, fmt.Sprintf("Set operation '%s' is missing an argument.", tn.value)) + } + + rawValues := strings.Split(tn.rightNode.value, ",") + values := make([]string, len(rawValues)) + for i := range rawValues { + values[i] = strings.ToLower(strings.TrimSpace(rawValues[i])) + if strings.ContainsAny(values[i], "&|!,()/") { + return nil, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, tn.rightNode.location, fmt.Sprintf("Invalid label value '%s' in set operation argument.", values[i])) + } else if values[i] == "" { + return nil, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, tn.rightNode.location, "Empty label value in set operation argument.") + } + } + switch tokenSetOperation { + case "containsany": + return containsAnyLabelSetAction(tn.leftNode.value, values), nil + case "containsall": + return containsAllLabelSetAction(tn.leftNode.value, values), nil + case "consistsof": + return consistsOfLabelSetAction(tn.leftNode.value, values), nil + case "issubsetof": + return isSubsetOfLabelSetAction(tn.leftNode.value, values), nil + } } if tn.rightNode == nil { @@ -203,7 +320,17 @@ func (tn *treeNode) toString(indent int) string { return out } +var validSetOperations = map[string]string{ + "containsany": "containsAny", + "containsall": "containsAll", + "consistsof": "consistsOf", + "issubsetof": "isSubsetOf", + "isempty": "isEmpty", +} + func tokenize(input string) func() (*treeNode, error) { + lastToken := lfTokenInvalid + lastValue := "" runes, i := []rune(input), 0 peekIs := func(r rune) bool { @@ -233,6 +360,53 @@ func tokenize(input string) func() (*treeNode, error) { } node := &treeNode{location: i} + defer func() { + lastToken = node.token + lastValue = node.value + }() + + if lastToken == lfTokenSetKey { + //we should get a valid set operation next + value, n := consumeUntil(" )") + if validSetOperations[strings.ToLower(value)] == "" { + return &treeNode{}, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, i, fmt.Sprintf("Invalid set operation '%s'.", value)) + } + i += n + node.token, node.value = lfTokenSetOperation, value + return node, nil + } + if lastToken == lfTokenSetOperation { + //we should get an argument next, if we aren't isempty + var arg = "" + origI := i + if runes[i] == '{' { + i += 1 + value, n := consumeUntil("}") + if i+n >= len(runes) { + return &treeNode{}, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, i-1, "Missing closing '}' in set operation argument?") + } + i += n + 1 + arg = value + } else { + value, n := consumeUntil("&|!,()/") + i += n + arg = strings.TrimSpace(value) + } + if strings.ToLower(lastValue) == "isempty" && arg != "" { + return &treeNode{}, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, origI, fmt.Sprintf("isEmpty does not take arguments, was passed '%s'.", arg)) + } + if arg == "" && strings.ToLower(lastValue) != "isempty" { + if i < len(runes) && runes[i] == '/' { + return &treeNode{}, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, origI, "Set operations do not support regular expressions.") + } else { + return &treeNode{}, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, origI, fmt.Sprintf("Set operation '%s' requires an argument.", lastValue)) + } + } + // note that we sent an empty SetArgument token if we are isempty + node.token, node.value = lfTokenSetArgument, arg + return node, nil + } + switch runes[i] { case '&': if !peekIs('&') { @@ -264,8 +438,38 @@ func tokenize(input string) func() (*treeNode, error) { i += n + 1 node.token, node.value = lfTokenRegexp, value default: - value, n := consumeUntil("&|!,()/") + value, n := consumeUntil("&|!,()/:") i += n + value = strings.TrimSpace(value) + + //are we the beginning of a set operation? + if i < len(runes) && runes[i] == ':' { + if peekIs(' ') { + if value == "" { + return &treeNode{}, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, i, "Missing set key.") + } + i += 1 + //we are the beginning of a set operation + node.token, node.value = lfTokenSetKey, value + return node, nil + } + additionalValue, n := consumeUntil("&|!,()/") + additionalValue = strings.TrimSpace(additionalValue) + if additionalValue == ":" { + return &treeNode{}, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, i, "Missing set operation.") + } + i += n + value += additionalValue + } + + valueToCheckForSetOperation := strings.ToLower(value) + for setOperation := range validSetOperations { + idx := strings.Index(valueToCheckForSetOperation, " "+setOperation) + if idx > 0 { + return &treeNode{}, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, i-n+idx+1, fmt.Sprintf("Looks like you are using the set operator '%s' but did not provide a set key. Did you forget the ':'?", validSetOperations[setOperation])) + } + } + node.token, node.value = lfTokenLabel, strings.TrimSpace(value) } return node, nil @@ -307,7 +511,7 @@ LOOP: switch node.token { case lfTokenEOF: break LOOP - case lfTokenLabel, lfTokenRegexp: + case lfTokenLabel, lfTokenRegexp, lfTokenSetKey: if current.rightNode != nil { return nil, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, node.location, "Found two adjacent labels. You need an operator between them.") } @@ -326,6 +530,18 @@ LOOP: node.setLeftNode(nodeToStealFrom.rightNode) nodeToStealFrom.setRightNode(node) current = node + case lfTokenSetOperation: + if current.rightNode == nil { + return nil, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, node.location, fmt.Sprintf("Set operation '%s' missing left hand operand.", node.value)) + } + node.setLeftNode(current.rightNode) + current.setRightNode(node) + current = node + case lfTokenSetArgument: + if current.rightNode != nil { + return nil, GinkgoErrors.SyntaxErrorParsingLabelFilter(input, node.location, fmt.Sprintf("Unexpected set argument '%s'.", node.token)) + } + current.setRightNode(node) case lfTokenCloseGroup: firstUnmatchedOpenNode := current.firstUnmatchedOpenNode() if firstUnmatchedOpenNode == nil { @@ -354,5 +570,14 @@ func ValidateAndCleanupLabel(label string, cl CodeLocation) (string, error) { if strings.ContainsAny(out, "&|!,()/") { return "", GinkgoErrors.InvalidLabel(label, cl) } + if out[0] == ':' { + return "", GinkgoErrors.InvalidLabel(label, cl) + } + if strings.Contains(out, ":") { + components := strings.SplitN(out, ":", 2) + if len(components) < 2 || components[1] == "" { + return "", GinkgoErrors.InvalidLabel(label, cl) + } + } return out, nil } diff --git a/vendor/github.com/onsi/ginkgo/v2/types/types.go b/vendor/github.com/onsi/ginkgo/v2/types/types.go index aae69b04c..ddcbec1ba 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/types.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/types.go @@ -3,13 +3,21 @@ package types import ( "encoding/json" "fmt" + "os" "sort" "strings" "time" ) const GINKGO_FOCUS_EXIT_CODE = 197 -const GINKGO_TIME_FORMAT = "01/02/06 15:04:05.999" + +var GINKGO_TIME_FORMAT = "01/02/06 15:04:05.999" + +func init() { + if os.Getenv("GINKGO_TIME_FORMAT") != "" { + GINKGO_TIME_FORMAT = os.Getenv("GINKGO_TIME_FORMAT") + } +} // Report captures information about a Ginkgo test run type Report struct { diff --git a/vendor/github.com/onsi/ginkgo/v2/types/version.go b/vendor/github.com/onsi/ginkgo/v2/types/version.go index ccd6516fa..caf3c9f5e 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/version.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/version.go @@ -1,3 +1,3 @@ package types -const VERSION = "2.17.0" +const VERSION = "2.21.0" diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 01ec5245c..9f6090b8d 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,72 @@ +## 1.35.1 + +### Fixes +- Export EnforceDefaultTimeoutsWhenUsingContexts and DisableDefaultTimeoutsWhenUsingContext [ca36da1] + +## 1.35.0 + +### Features + +- You can now call `EnforceDefaultTimeoutsWhenUsingContexts()` to have `Eventually` honor the default timeout when passed a context. (prior to this you had to expclility add a timeout) [e4c4265] +- You can call `StopTrying(message).Successfully()` to abort a `Consistently` early without failure [eeca931] + +### Fixes + +- Stop memoizing the result of `HaveField` to avoid unexpected errors when used with async assertions. [3bdbc4e] + +### Maintenance + +- Bump all dependencies [a05a416] + +## 1.34.2 + +Require Go 1.22+ + +### Maintenance +- bump ginkgo as well [c59c6dc] +- bump to go 1.22 - remove x/exp dependency [8158b99] + +## 1.34.1 + +### Maintenance +- Use slices from exp/slices to keep golang 1.20 compat [5e71dcd] + +## 1.34.0 + +### Features +- Add RoundTripper method to ghttp.Server [c549e0d] + +### Fixes +- fix incorrect handling of nil slices in HaveExactElements (fixes #771) [878940c] +- issue_765 - fixed bug in Hopcroft-Karp algorithm [ebadb67] + +### Maintenance +- bump ginkgo [8af2ece] +- Fix typo in docs [123a071] +- Bump github.com/onsi/ginkgo/v2 from 2.17.2 to 2.17.3 (#756) [0e69083] +- Bump google.golang.org/protobuf from 1.33.0 to 1.34.1 (#755) [2675796] +- Bump golang.org/x/net from 0.24.0 to 0.25.0 (#754) [4160c0f] +- Bump github-pages from 230 to 231 in /docs (#748) [892c303] + +## 1.33.1 + +### Fixes +- fix confusing eventually docs [3a66379] + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.17.1 to 2.17.2 [e9bc35a] + +## 1.33.0 + +### Features + +`Receive` not accepts `Receive(, MATCHER>)`, allowing you to pick out a specific value on the channel that satisfies the provided matcher and is stored in the provided pointer. + +### Maintenance +- Bump github.com/onsi/ginkgo/v2 from 2.15.0 to 2.17.1 (#745) [9999deb] +- Bump github-pages from 229 to 230 in /docs (#735) [cb5ff21] +- Bump golang.org/x/net from 0.20.0 to 0.23.0 (#746) [bac6596] + ## 1.32.0 ### Maintenance diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index ffb81b1fe..1038d7dd4 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -22,7 +22,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.32.0" +const GOMEGA_VERSION = "1.35.1" const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. If you're using Ginkgo then you probably forgot to put your assertion in an It(). @@ -319,7 +319,19 @@ you an also use Eventually().WithContext(ctx) to pass in the context. Passed-in Eventually(client.FetchCount).WithContext(ctx).WithArguments("/users").Should(BeNumerically(">=", 17)) }, SpecTimeout(time.Second)) -Either way the context passd to Eventually is also passed to the underlying function. Now, when Ginkgo cancels the context both the FetchCount client and Gomega will be informed and can exit. +Either way the context pasesd to Eventually is also passed to the underlying function. Now, when Ginkgo cancels the context both the FetchCount client and Gomega will be informed and can exit. + +By default, when a context is passed to Eventually *without* an explicit timeout, Gomega will rely solely on the context's cancellation to determine when to stop polling. If you want to specify a timeout in addition to the context you can do so using the .WithTimeout() method. For example: + + Eventually(client.FetchCount).WithContext(ctx).WithTimeout(10*time.Second).Should(BeNumerically(">=", 17)) + +now either the context cacnellation or the timeout will cause Eventually to stop polling. + +If, instead, you would like to opt out of this behavior and have Gomega's default timeouts govern Eventuallys that take a context you can call: + + EnforceDefaultTimeoutsWhenUsingContexts() + +in the DSL (or on a Gomega instance). Now all calls to Eventually that take a context will fail if eitehr the context is cancelled or the default timeout elapses. **Category 3: Making assertions _in_ the function passed into Eventually** @@ -372,11 +384,11 @@ You can ensure that you get a number of consecutive successful tries before succ Finally, in addition to passing timeouts and a context to Eventually you can be more explicit with Eventually's chaining configuration methods: - Eventually(..., "1s", "2s", ctx).Should(...) + Eventually(..., "10s", "2s", ctx).Should(...) is equivalent to - Eventually(...).WithTimeout(time.Second).WithPolling(2*time.Second).WithContext(ctx).Should(...) + Eventually(...).WithTimeout(10*time.Second).WithPolling(2*time.Second).WithContext(ctx).Should(...) */ func Eventually(actualOrCtx interface{}, args ...interface{}) AsyncAssertion { ensureDefaultGomegaIsConfigured() @@ -491,6 +503,16 @@ func SetDefaultConsistentlyPollingInterval(t time.Duration) { Default.SetDefaultConsistentlyPollingInterval(t) } +// EnforceDefaultTimeoutsWhenUsingContexts forces `Eventually` to apply a default timeout even when a context is provided. +func EnforceDefaultTimeoutsWhenUsingContexts() { + Default.EnforceDefaultTimeoutsWhenUsingContexts() +} + +// DisableDefaultTimeoutsWhenUsingContext disables the default timeout when a context is provided to `Eventually`. +func DisableDefaultTimeoutsWhenUsingContext() { + Default.DisableDefaultTimeoutsWhenUsingContext() +} + // AsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against // the matcher passed to the Should and ShouldNot methods. // diff --git a/vendor/github.com/onsi/gomega/internal/async_assertion.go b/vendor/github.com/onsi/gomega/internal/async_assertion.go index cde9e2ec8..8b4cd1f5b 100644 --- a/vendor/github.com/onsi/gomega/internal/async_assertion.go +++ b/vendor/github.com/onsi/gomega/internal/async_assertion.go @@ -335,7 +335,7 @@ func (assertion *AsyncAssertion) afterTimeout() <-chan time.Time { if assertion.asyncType == AsyncAssertionTypeConsistently { return time.After(assertion.g.DurationBundle.ConsistentlyDuration) } else { - if assertion.ctx == nil { + if assertion.ctx == nil || assertion.g.DurationBundle.EnforceDefaultTimeoutsWhenUsingContexts { return time.After(assertion.g.DurationBundle.EventuallyTimeout) } else { return nil @@ -496,7 +496,15 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch for _, err := range []error{actualErr, matcherErr} { if pollingSignalErr, ok := AsPollingSignalError(err); ok { if pollingSignalErr.IsStopTrying() { - fail("Told to stop trying") + if pollingSignalErr.IsSuccessful() { + if assertion.asyncType == AsyncAssertionTypeEventually { + fail("Told to stop trying (and ignoring call to Successfully(), as it is only relevant with Consistently)") + } else { + return true // early escape hatch for Consistently + } + } else { + fail("Told to stop trying") + } return false } if pollingSignalErr.IsTryAgainAfter() { diff --git a/vendor/github.com/onsi/gomega/internal/duration_bundle.go b/vendor/github.com/onsi/gomega/internal/duration_bundle.go index 6e0d90d3a..2e026c336 100644 --- a/vendor/github.com/onsi/gomega/internal/duration_bundle.go +++ b/vendor/github.com/onsi/gomega/internal/duration_bundle.go @@ -8,10 +8,11 @@ import ( ) type DurationBundle struct { - EventuallyTimeout time.Duration - EventuallyPollingInterval time.Duration - ConsistentlyDuration time.Duration - ConsistentlyPollingInterval time.Duration + EventuallyTimeout time.Duration + EventuallyPollingInterval time.Duration + ConsistentlyDuration time.Duration + ConsistentlyPollingInterval time.Duration + EnforceDefaultTimeoutsWhenUsingContexts bool } const ( @@ -20,15 +21,19 @@ const ( ConsistentlyDurationEnvVarName = "GOMEGA_DEFAULT_CONSISTENTLY_DURATION" ConsistentlyPollingIntervalEnvVarName = "GOMEGA_DEFAULT_CONSISTENTLY_POLLING_INTERVAL" + + EnforceDefaultTimeoutsWhenUsingContextsEnvVarName = "GOMEGA_ENFORCE_DEFAULT_TIMEOUTS_WHEN_USING_CONTEXTS" ) func FetchDefaultDurationBundle() DurationBundle { + _, EnforceDefaultTimeoutsWhenUsingContexts := os.LookupEnv(EnforceDefaultTimeoutsWhenUsingContextsEnvVarName) return DurationBundle{ EventuallyTimeout: durationFromEnv(EventuallyTimeoutEnvVarName, time.Second), EventuallyPollingInterval: durationFromEnv(EventuallyPollingIntervalEnvVarName, 10*time.Millisecond), - ConsistentlyDuration: durationFromEnv(ConsistentlyDurationEnvVarName, 100*time.Millisecond), - ConsistentlyPollingInterval: durationFromEnv(ConsistentlyPollingIntervalEnvVarName, 10*time.Millisecond), + ConsistentlyDuration: durationFromEnv(ConsistentlyDurationEnvVarName, 100*time.Millisecond), + ConsistentlyPollingInterval: durationFromEnv(ConsistentlyPollingIntervalEnvVarName, 10*time.Millisecond), + EnforceDefaultTimeoutsWhenUsingContexts: EnforceDefaultTimeoutsWhenUsingContexts, } } diff --git a/vendor/github.com/onsi/gomega/internal/gomega.go b/vendor/github.com/onsi/gomega/internal/gomega.go index de1f4f336..c6e2fcc0e 100644 --- a/vendor/github.com/onsi/gomega/internal/gomega.go +++ b/vendor/github.com/onsi/gomega/internal/gomega.go @@ -127,3 +127,11 @@ func (g *Gomega) SetDefaultConsistentlyDuration(t time.Duration) { func (g *Gomega) SetDefaultConsistentlyPollingInterval(t time.Duration) { g.DurationBundle.ConsistentlyPollingInterval = t } + +func (g *Gomega) EnforceDefaultTimeoutsWhenUsingContexts() { + g.DurationBundle.EnforceDefaultTimeoutsWhenUsingContexts = true +} + +func (g *Gomega) DisableDefaultTimeoutsWhenUsingContext() { + g.DurationBundle.EnforceDefaultTimeoutsWhenUsingContexts = false +} diff --git a/vendor/github.com/onsi/gomega/internal/polling_signal_error.go b/vendor/github.com/onsi/gomega/internal/polling_signal_error.go index 83b04b1a4..3a4f7ddd9 100644 --- a/vendor/github.com/onsi/gomega/internal/polling_signal_error.go +++ b/vendor/github.com/onsi/gomega/internal/polling_signal_error.go @@ -17,6 +17,7 @@ type PollingSignalError interface { error Wrap(err error) PollingSignalError Attach(description string, obj any) PollingSignalError + Successfully() PollingSignalError Now() } @@ -45,6 +46,7 @@ type PollingSignalErrorImpl struct { wrappedErr error pollingSignalErrorType PollingSignalErrorType duration time.Duration + successful bool Attachments []PollingSignalErrorAttachment } @@ -73,6 +75,11 @@ func (s *PollingSignalErrorImpl) Unwrap() error { return s.wrappedErr } +func (s *PollingSignalErrorImpl) Successfully() PollingSignalError { + s.successful = true + return s +} + func (s *PollingSignalErrorImpl) Now() { panic(s) } @@ -81,6 +88,10 @@ func (s *PollingSignalErrorImpl) IsStopTrying() bool { return s.pollingSignalErrorType == PollingSignalErrorTypeStopTrying } +func (s *PollingSignalErrorImpl) IsSuccessful() bool { + return s.successful +} + func (s *PollingSignalErrorImpl) IsTryAgainAfter() bool { return s.pollingSignalErrorType == PollingSignalErrorTypeTryAgainAfter } diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index 8860d677f..7ef27dc9c 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -194,20 +194,21 @@ func BeClosed() types.GomegaMatcher { // // will repeatedly attempt to pull values out of `c` until a value matching "bar" is received. // -// Finally, if you want to have a reference to the value *sent* to the channel you can pass the `Receive` matcher a pointer to a variable of the appropriate type: +// Furthermore, if you want to have a reference to the value *sent* to the channel you can pass the `Receive` matcher a pointer to a variable of the appropriate type: // // var myThing thing // Eventually(thingChan).Should(Receive(&myThing)) // Expect(myThing.Sprocket).Should(Equal("foo")) // Expect(myThing.IsValid()).Should(BeTrue()) +// +// Finally, if you want to match the received object as well as get the actual received value into a variable, so you can reason further about the value received, +// you can pass a pointer to a variable of the approriate type first, and second a matcher: +// +// var myThing thing +// Eventually(thingChan).Should(Receive(&myThing, ContainSubstring("bar"))) func Receive(args ...interface{}) types.GomegaMatcher { - var arg interface{} - if len(args) > 0 { - arg = args[0] - } - return &matchers.ReceiveMatcher{ - Arg: arg, + Args: args, } } diff --git a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go index dca5b9446..5a236d7d6 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go +++ b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go @@ -30,15 +30,18 @@ func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool lenMatchers := len(matchers) lenValues := len(values) + success = true for i := 0; i < lenMatchers || i < lenValues; i++ { if i >= lenMatchers { matcher.extraIndex = i + success = false continue } if i >= lenValues { matcher.missingIndex = i + success = false return } @@ -49,15 +52,17 @@ func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool index: i, failure: err.Error(), }) + success = false } else if !match { matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{ index: i, failure: elemMatcher.FailureMessage(values[i]), }) + success = false } } - return matcher.missingIndex+matcher.extraIndex+len(matcher.mismatchFailures) == 0, nil + return success, nil } func (matcher *HaveExactElementsMatcher) FailureMessage(actual interface{}) (message string) { diff --git a/vendor/github.com/onsi/gomega/matchers/have_field.go b/vendor/github.com/onsi/gomega/matchers/have_field.go index 6989f78c4..8dd3f871a 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_field.go +++ b/vendor/github.com/onsi/gomega/matchers/have_field.go @@ -17,7 +17,7 @@ func (e missingFieldError) Error() string { return string(e) } -func extractField(actual interface{}, field string, matchername string) (interface{}, error) { +func extractField(actual interface{}, field string, matchername string) (any, error) { fields := strings.SplitN(field, ".", 2) actualValue := reflect.ValueOf(actual) @@ -64,36 +64,46 @@ func extractField(actual interface{}, field string, matchername string) (interfa type HaveFieldMatcher struct { Field string Expected interface{} +} - extractedField interface{} - expectedMatcher omegaMatcher +func (matcher *HaveFieldMatcher) expectedMatcher() omegaMatcher { + var isMatcher bool + expectedMatcher, isMatcher := matcher.Expected.(omegaMatcher) + if !isMatcher { + expectedMatcher = &EqualMatcher{Expected: matcher.Expected} + } + return expectedMatcher } func (matcher *HaveFieldMatcher) Match(actual interface{}) (success bool, err error) { - matcher.extractedField, err = extractField(actual, matcher.Field, "HaveField") + extractedField, err := extractField(actual, matcher.Field, "HaveField") if err != nil { return false, err } - var isMatcher bool - matcher.expectedMatcher, isMatcher = matcher.Expected.(omegaMatcher) - if !isMatcher { - matcher.expectedMatcher = &EqualMatcher{Expected: matcher.Expected} - } - - return matcher.expectedMatcher.Match(matcher.extractedField) + return matcher.expectedMatcher().Match(extractedField) } func (matcher *HaveFieldMatcher) FailureMessage(actual interface{}) (message string) { + extractedField, err := extractField(actual, matcher.Field, "HaveField") + if err != nil { + // this really shouldn't happen + return fmt.Sprintf("Failed to extract field '%s': %s", matcher.Field, err) + } message = fmt.Sprintf("Value for field '%s' failed to satisfy matcher.\n", matcher.Field) - message += matcher.expectedMatcher.FailureMessage(matcher.extractedField) + message += matcher.expectedMatcher().FailureMessage(extractedField) return message } func (matcher *HaveFieldMatcher) NegatedFailureMessage(actual interface{}) (message string) { + extractedField, err := extractField(actual, matcher.Field, "HaveField") + if err != nil { + // this really shouldn't happen + return fmt.Sprintf("Failed to extract field '%s': %s", matcher.Field, err) + } message = fmt.Sprintf("Value for field '%s' satisfied matcher, but should not have.\n", matcher.Field) - message += matcher.expectedMatcher.NegatedFailureMessage(matcher.extractedField) + message += matcher.expectedMatcher().NegatedFailureMessage(extractedField) return message } diff --git a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go b/vendor/github.com/onsi/gomega/matchers/receive_matcher.go index 1936a2ba5..948164eaf 100644 --- a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/receive_matcher.go @@ -3,6 +3,7 @@ package matchers import ( + "errors" "fmt" "reflect" @@ -10,7 +11,7 @@ import ( ) type ReceiveMatcher struct { - Arg interface{} + Args []interface{} receivedValue reflect.Value channelClosed bool } @@ -29,15 +30,38 @@ func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err erro var subMatcher omegaMatcher var hasSubMatcher bool - - if matcher.Arg != nil { - subMatcher, hasSubMatcher = (matcher.Arg).(omegaMatcher) + var resultReference interface{} + + // Valid arg formats are as follows, always with optional POINTER before + // optional MATCHER: + // - Receive() + // - Receive(POINTER) + // - Receive(MATCHER) + // - Receive(POINTER, MATCHER) + args := matcher.Args + if len(args) > 0 { + arg := args[0] + _, isSubMatcher := arg.(omegaMatcher) + if !isSubMatcher && reflect.ValueOf(arg).Kind() == reflect.Ptr { + // Consume optional POINTER arg first, if it ain't no matcher ;) + resultReference = arg + args = args[1:] + } + } + if len(args) > 0 { + arg := args[0] + subMatcher, hasSubMatcher = arg.(omegaMatcher) if !hasSubMatcher { - argType := reflect.TypeOf(matcher.Arg) - if argType.Kind() != reflect.Ptr { - return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s\nYou need to pass a pointer!", format.Object(actual, 1), format.Object(matcher.Arg, 1)) - } + // At this point we assume the dev user wanted to assign a received + // value, so [POINTER,]MATCHER. + return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s\nYou need to pass a pointer!", format.Object(actual, 1), format.Object(arg, 1)) } + // Consume optional MATCHER arg. + args = args[1:] + } + if len(args) > 0 { + // If there are still args present, reject all. + return false, errors.New("Receive matcher expects at most an optional pointer and/or an optional matcher") } winnerIndex, value, open := reflect.Select([]reflect.SelectCase{ @@ -58,16 +82,20 @@ func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err erro } if hasSubMatcher { - if didReceive { - matcher.receivedValue = value - return subMatcher.Match(matcher.receivedValue.Interface()) + if !didReceive { + return false, nil } - return false, nil + matcher.receivedValue = value + if match, err := subMatcher.Match(matcher.receivedValue.Interface()); err != nil || !match { + return match, err + } + // if we received a match, then fall through in order to handle an + // optional assignment of the received value to the specified reference. } if didReceive { - if matcher.Arg != nil { - outValue := reflect.ValueOf(matcher.Arg) + if resultReference != nil { + outValue := reflect.ValueOf(resultReference) if value.Type().AssignableTo(outValue.Elem().Type()) { outValue.Elem().Set(value) @@ -77,7 +105,7 @@ func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err erro outValue.Elem().Set(value.Elem()) return true, nil } else { - return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nType:\n%s\nTo:\n%s", format.Object(actual, 1), format.Object(value.Interface(), 1), format.Object(matcher.Arg, 1)) + return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nType:\n%s\nTo:\n%s", format.Object(actual, 1), format.Object(value.Interface(), 1), format.Object(resultReference, 1)) } } @@ -88,7 +116,11 @@ func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err erro } func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message string) { - subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) + var matcherArg interface{} + if len(matcher.Args) > 0 { + matcherArg = matcher.Args[len(matcher.Args)-1] + } + subMatcher, hasSubMatcher := (matcherArg).(omegaMatcher) closedAddendum := "" if matcher.channelClosed { @@ -105,7 +137,11 @@ func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message strin } func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (message string) { - subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) + var matcherArg interface{} + if len(matcher.Args) > 0 { + matcherArg = matcher.Args[len(matcher.Args)-1] + } + subMatcher, hasSubMatcher := (matcherArg).(omegaMatcher) closedAddendum := "" if matcher.channelClosed { diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go index 1c54edd8f..44aa61d4b 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go @@ -1,6 +1,8 @@ package bipartitegraph import ( + "slices" + . "github.com/onsi/gomega/matchers/support/goraph/edge" . "github.com/onsi/gomega/matchers/support/goraph/node" "github.com/onsi/gomega/matchers/support/goraph/util" @@ -157,6 +159,11 @@ func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers [ if len(currentLayer) == 0 { return []NodeOrderedSet{} } + if done { // if last layer - into last layer must be only 'free' nodes + currentLayer = slices.DeleteFunc(currentLayer, func(in Node) bool { + return !matching.Free(in) + }) + } guideLayers = append(guideLayers, currentLayer) } diff --git a/vendor/github.com/onsi/gomega/types/types.go b/vendor/github.com/onsi/gomega/types/types.go index 7c7adb941..30f2beed3 100644 --- a/vendor/github.com/onsi/gomega/types/types.go +++ b/vendor/github.com/onsi/gomega/types/types.go @@ -29,6 +29,8 @@ type Gomega interface { SetDefaultEventuallyPollingInterval(time.Duration) SetDefaultConsistentlyDuration(time.Duration) SetDefaultConsistentlyPollingInterval(time.Duration) + EnforceDefaultTimeoutsWhenUsingContexts() + DisableDefaultTimeoutsWhenUsingContext() } // All Gomega matchers must implement the GomegaMatcher interface diff --git a/vendor/github.com/prometheus/client_model/go/metrics.pb.go b/vendor/github.com/prometheus/client_model/go/metrics.pb.go index cee360db7..2f1549075 100644 --- a/vendor/github.com/prometheus/client_model/go/metrics.pb.go +++ b/vendor/github.com/prometheus/client_model/go/metrics.pb.go @@ -483,6 +483,8 @@ type Histogram struct { // histograms. PositiveDelta []int64 `protobuf:"zigzag64,13,rep,name=positive_delta,json=positiveDelta" json:"positive_delta,omitempty"` // Count delta of each bucket compared to previous one (or to zero for 1st bucket). PositiveCount []float64 `protobuf:"fixed64,14,rep,name=positive_count,json=positiveCount" json:"positive_count,omitempty"` // Absolute count of each bucket. + // Only used for native histograms. These exemplars MUST have a timestamp. + Exemplars []*Exemplar `protobuf:"bytes,16,rep,name=exemplars" json:"exemplars,omitempty"` } func (x *Histogram) Reset() { @@ -622,6 +624,13 @@ func (x *Histogram) GetPositiveCount() []float64 { return nil } +func (x *Histogram) GetExemplars() []*Exemplar { + if x != nil { + return x.Exemplars + } + return nil +} + // A Bucket of a conventional histogram, each of which is treated as // an individual counter-like time series by Prometheus. type Bucket struct { @@ -923,6 +932,7 @@ type MetricFamily struct { Help *string `protobuf:"bytes,2,opt,name=help" json:"help,omitempty"` Type *MetricType `protobuf:"varint,3,opt,name=type,enum=io.prometheus.client.MetricType" json:"type,omitempty"` Metric []*Metric `protobuf:"bytes,4,rep,name=metric" json:"metric,omitempty"` + Unit *string `protobuf:"bytes,5,opt,name=unit" json:"unit,omitempty"` } func (x *MetricFamily) Reset() { @@ -985,6 +995,13 @@ func (x *MetricFamily) GetMetric() []*Metric { return nil } +func (x *MetricFamily) GetUnit() string { + if x != nil && x.Unit != nil { + return *x.Unit + } + return "" +} + var File_io_prometheus_client_metrics_proto protoreflect.FileDescriptor var file_io_prometheus_client_metrics_proto_rawDesc = []byte{ @@ -1028,7 +1045,7 @@ var file_io_prometheus_client_metrics_proto_rawDesc = []byte{ 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x1f, 0x0a, 0x07, 0x55, 0x6e, 0x74, 0x79, 0x70, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xac, 0x05, 0x0a, 0x09, 0x48, + 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xea, 0x05, 0x0a, 0x09, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x73, @@ -1071,79 +1088,84 @@ var file_io_prometheus_client_metrics_proto_rawDesc = []byte{ 0x03, 0x28, 0x12, 0x52, 0x0d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x01, 0x52, 0x0d, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xc6, 0x01, 0x0a, 0x06, 0x42, 0x75, - 0x63, 0x6b, 0x65, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, - 0x76, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, - 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x34, 0x0a, 0x16, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x14, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x62, - 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x75, 0x70, 0x70, 0x65, - 0x72, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, - 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x45, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x72, 0x22, 0x3c, 0x0a, 0x0a, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, - 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x11, - 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0x91, 0x01, 0x0a, 0x08, 0x45, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x12, 0x35, 0x0a, + 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x65, 0x78, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x09, 0x65, 0x78, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x73, 0x22, 0xc6, 0x01, 0x0a, 0x06, 0x42, 0x75, 0x63, 0x6b, + 0x65, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x63, 0x75, + 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, 0x0a, + 0x16, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x14, 0x63, + 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x6c, + 0x6f, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6f, 0x75, + 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x75, 0x70, 0x70, 0x65, 0x72, 0x42, + 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, + 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, + 0x22, 0x3c, 0x0a, 0x0a, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x16, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x11, 0x52, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x91, + 0x01, 0x0a, 0x08, 0x45, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x12, 0x35, 0x0a, 0x05, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x22, 0xff, 0x02, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x35, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x6c, - 0x61, 0x62, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x22, 0xff, 0x02, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, - 0x35, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x52, - 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, - 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x61, 0x75, - 0x67, 0x65, 0x52, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, + 0x61, 0x62, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, + 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x61, 0x75, 0x67, 0x65, + 0x52, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x37, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, + 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, + 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x75, 0x6e, 0x74, + 0x79, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, - 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x75, - 0x6e, 0x74, 0x79, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x6e, 0x74, 0x79, 0x70, 0x65, 0x64, 0x52, 0x07, 0x75, 0x6e, 0x74, - 0x79, 0x70, 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, - 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, - 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x48, - 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, - 0x72, 0x61, 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x5f, 0x6d, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x73, 0x22, 0xa2, 0x01, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, - 0x65, 0x6c, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x6c, 0x70, 0x12, - 0x34, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, - 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, - 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x2a, 0x62, 0x0a, 0x0a, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x55, - 0x4e, 0x54, 0x45, 0x52, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x41, 0x55, 0x47, 0x45, 0x10, - 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x4d, 0x4d, 0x41, 0x52, 0x59, 0x10, 0x02, 0x12, 0x0b, - 0x0a, 0x07, 0x55, 0x4e, 0x54, 0x59, 0x50, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x48, - 0x49, 0x53, 0x54, 0x4f, 0x47, 0x52, 0x41, 0x4d, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x47, 0x41, - 0x55, 0x47, 0x45, 0x5f, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x47, 0x52, 0x41, 0x4d, 0x10, 0x05, 0x42, - 0x52, 0x0a, 0x14, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, - 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2f, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x67, 0x6f, 0x3b, 0x69, - 0x6f, 0x5f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x5f, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, + 0x74, 0x2e, 0x55, 0x6e, 0x74, 0x79, 0x70, 0x65, 0x64, 0x52, 0x07, 0x75, 0x6e, 0x74, 0x79, 0x70, + 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, + 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x48, 0x69, 0x73, + 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, + 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6d, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x4d, 0x73, 0x22, 0xb6, 0x01, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x46, + 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x6c, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x6c, 0x70, 0x12, 0x34, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x69, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, + 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x6e, 0x69, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x2a, 0x62, 0x0a, + 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x43, + 0x4f, 0x55, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x41, 0x55, 0x47, + 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x4d, 0x4d, 0x41, 0x52, 0x59, 0x10, 0x02, + 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x54, 0x59, 0x50, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0d, 0x0a, + 0x09, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x47, 0x52, 0x41, 0x4d, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, + 0x47, 0x41, 0x55, 0x47, 0x45, 0x5f, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x47, 0x52, 0x41, 0x4d, 0x10, + 0x05, 0x42, 0x52, 0x0a, 0x14, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, + 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, + 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x67, 0x6f, + 0x3b, 0x69, 0x6f, 0x5f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x5f, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, } var ( @@ -1185,22 +1207,23 @@ var file_io_prometheus_client_metrics_proto_depIdxs = []int32{ 13, // 5: io.prometheus.client.Histogram.created_timestamp:type_name -> google.protobuf.Timestamp 9, // 6: io.prometheus.client.Histogram.negative_span:type_name -> io.prometheus.client.BucketSpan 9, // 7: io.prometheus.client.Histogram.positive_span:type_name -> io.prometheus.client.BucketSpan - 10, // 8: io.prometheus.client.Bucket.exemplar:type_name -> io.prometheus.client.Exemplar - 1, // 9: io.prometheus.client.Exemplar.label:type_name -> io.prometheus.client.LabelPair - 13, // 10: io.prometheus.client.Exemplar.timestamp:type_name -> google.protobuf.Timestamp - 1, // 11: io.prometheus.client.Metric.label:type_name -> io.prometheus.client.LabelPair - 2, // 12: io.prometheus.client.Metric.gauge:type_name -> io.prometheus.client.Gauge - 3, // 13: io.prometheus.client.Metric.counter:type_name -> io.prometheus.client.Counter - 5, // 14: io.prometheus.client.Metric.summary:type_name -> io.prometheus.client.Summary - 6, // 15: io.prometheus.client.Metric.untyped:type_name -> io.prometheus.client.Untyped - 7, // 16: io.prometheus.client.Metric.histogram:type_name -> io.prometheus.client.Histogram - 0, // 17: io.prometheus.client.MetricFamily.type:type_name -> io.prometheus.client.MetricType - 11, // 18: io.prometheus.client.MetricFamily.metric:type_name -> io.prometheus.client.Metric - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 10, // 8: io.prometheus.client.Histogram.exemplars:type_name -> io.prometheus.client.Exemplar + 10, // 9: io.prometheus.client.Bucket.exemplar:type_name -> io.prometheus.client.Exemplar + 1, // 10: io.prometheus.client.Exemplar.label:type_name -> io.prometheus.client.LabelPair + 13, // 11: io.prometheus.client.Exemplar.timestamp:type_name -> google.protobuf.Timestamp + 1, // 12: io.prometheus.client.Metric.label:type_name -> io.prometheus.client.LabelPair + 2, // 13: io.prometheus.client.Metric.gauge:type_name -> io.prometheus.client.Gauge + 3, // 14: io.prometheus.client.Metric.counter:type_name -> io.prometheus.client.Counter + 5, // 15: io.prometheus.client.Metric.summary:type_name -> io.prometheus.client.Summary + 6, // 16: io.prometheus.client.Metric.untyped:type_name -> io.prometheus.client.Untyped + 7, // 17: io.prometheus.client.Metric.histogram:type_name -> io.prometheus.client.Histogram + 0, // 18: io.prometheus.client.MetricFamily.type:type_name -> io.prometheus.client.MetricType + 11, // 19: io.prometheus.client.MetricFamily.metric:type_name -> io.prometheus.client.Metric + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_io_prometheus_client_metrics_proto_init() } diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go index 0ca86a3dc..25cfaa216 100644 --- a/vendor/github.com/prometheus/common/expfmt/decode.go +++ b/vendor/github.com/prometheus/common/expfmt/decode.go @@ -14,6 +14,7 @@ package expfmt import ( + "bufio" "fmt" "io" "math" @@ -21,8 +22,8 @@ import ( "net/http" dto "github.com/prometheus/client_model/go" + "google.golang.org/protobuf/encoding/protodelim" - "github.com/matttproud/golang_protobuf_extensions/v2/pbutil" "github.com/prometheus/common/model" ) @@ -44,7 +45,7 @@ func ResponseFormat(h http.Header) Format { mediatype, params, err := mime.ParseMediaType(ct) if err != nil { - return FmtUnknown + return fmtUnknown } const textType = "text/plain" @@ -52,42 +53,44 @@ func ResponseFormat(h http.Header) Format { switch mediatype { case ProtoType: if p, ok := params["proto"]; ok && p != ProtoProtocol { - return FmtUnknown + return fmtUnknown } if e, ok := params["encoding"]; ok && e != "delimited" { - return FmtUnknown + return fmtUnknown } - return FmtProtoDelim + return fmtProtoDelim case textType: if v, ok := params["version"]; ok && v != TextVersion { - return FmtUnknown + return fmtUnknown } - return FmtText + return fmtText } - return FmtUnknown + return fmtUnknown } // NewDecoder returns a new decoder based on the given input format. // If the input format does not imply otherwise, a text format decoder is returned. func NewDecoder(r io.Reader, format Format) Decoder { - switch format { - case FmtProtoDelim: - return &protoDecoder{r: r} + switch format.FormatType() { + case TypeProtoDelim: + return &protoDecoder{r: bufio.NewReader(r)} } return &textDecoder{r: r} } // protoDecoder implements the Decoder interface for protocol buffers. type protoDecoder struct { - r io.Reader + r protodelim.Reader } // Decode implements the Decoder interface. func (d *protoDecoder) Decode(v *dto.MetricFamily) error { - _, err := pbutil.ReadDelimited(d.r, v) - if err != nil { + opts := protodelim.UnmarshalOptions{ + MaxSize: -1, + } + if err := opts.UnmarshalFrom(d.r, v); err != nil { return err } if !model.IsValidMetricName(model.LabelValue(v.GetName())) { diff --git a/vendor/github.com/prometheus/common/expfmt/encode.go b/vendor/github.com/prometheus/common/expfmt/encode.go index ca2140600..ff5ef7a9d 100644 --- a/vendor/github.com/prometheus/common/expfmt/encode.go +++ b/vendor/github.com/prometheus/common/expfmt/encode.go @@ -18,10 +18,13 @@ import ( "io" "net/http" - "github.com/matttproud/golang_protobuf_extensions/v2/pbutil" - "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg" + "google.golang.org/protobuf/encoding/protodelim" "google.golang.org/protobuf/encoding/prototext" + "github.com/prometheus/common/model" + + "github.com/munnerz/goautoneg" + dto "github.com/prometheus/client_model/go" ) @@ -60,23 +63,32 @@ func (ec encoderCloser) Close() error { // as the support is still experimental. To include the option to negotiate // FmtOpenMetrics, use NegotiateOpenMetrics. func Negotiate(h http.Header) Format { + escapingScheme := Format(fmt.Sprintf("; escaping=%s", Format(model.NameEscapingScheme.String()))) for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) { + if escapeParam := ac.Params[model.EscapingKey]; escapeParam != "" { + switch Format(escapeParam) { + case model.AllowUTF8, model.EscapeUnderscores, model.EscapeDots, model.EscapeValues: + escapingScheme = Format(fmt.Sprintf("; escaping=%s", escapeParam)) + default: + // If the escaping parameter is unknown, ignore it. + } + } ver := ac.Params["version"] if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol { switch ac.Params["encoding"] { case "delimited": - return FmtProtoDelim + return fmtProtoDelim + escapingScheme case "text": - return FmtProtoText + return fmtProtoText + escapingScheme case "compact-text": - return FmtProtoCompact + return fmtProtoCompact + escapingScheme } } if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") { - return FmtText + return fmtText + escapingScheme } } - return FmtText + return fmtText + escapingScheme } // NegotiateIncludingOpenMetrics works like Negotiate but includes @@ -84,29 +96,40 @@ func Negotiate(h http.Header) Format { // temporary and will disappear once FmtOpenMetrics is fully supported and as // such may be negotiated by the normal Negotiate function. func NegotiateIncludingOpenMetrics(h http.Header) Format { + escapingScheme := Format(fmt.Sprintf("; escaping=%s", Format(model.NameEscapingScheme.String()))) for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) { + if escapeParam := ac.Params[model.EscapingKey]; escapeParam != "" { + switch Format(escapeParam) { + case model.AllowUTF8, model.EscapeUnderscores, model.EscapeDots, model.EscapeValues: + escapingScheme = Format(fmt.Sprintf("; escaping=%s", escapeParam)) + default: + // If the escaping parameter is unknown, ignore it. + } + } ver := ac.Params["version"] if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol { switch ac.Params["encoding"] { case "delimited": - return FmtProtoDelim + return fmtProtoDelim + escapingScheme case "text": - return FmtProtoText + return fmtProtoText + escapingScheme case "compact-text": - return FmtProtoCompact + return fmtProtoCompact + escapingScheme } } if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") { - return FmtText + return fmtText + escapingScheme } if ac.Type+"/"+ac.SubType == OpenMetricsType && (ver == OpenMetricsVersion_0_0_1 || ver == OpenMetricsVersion_1_0_0 || ver == "") { - if ver == OpenMetricsVersion_1_0_0 { - return FmtOpenMetrics_1_0_0 + switch ver { + case OpenMetricsVersion_1_0_0: + return fmtOpenMetrics_1_0_0 + escapingScheme + default: + return fmtOpenMetrics_0_0_1 + escapingScheme } - return FmtOpenMetrics_0_0_1 } } - return FmtText + return fmtText + escapingScheme } // NewEncoder returns a new encoder based on content type negotiation. All @@ -115,44 +138,54 @@ func NegotiateIncludingOpenMetrics(h http.Header) Format { // for FmtOpenMetrics, but a future (breaking) release will add the Close method // to the Encoder interface directly. The current version of the Encoder // interface is kept for backwards compatibility. -func NewEncoder(w io.Writer, format Format) Encoder { - switch format { - case FmtProtoDelim: +// In cases where the Format does not allow for UTF-8 names, the global +// NameEscapingScheme will be applied. +// +// NewEncoder can be called with additional options to customize the OpenMetrics text output. +// For example: +// NewEncoder(w, FmtOpenMetrics_1_0_0, WithCreatedLines()) +// +// Extra options are ignored for all other formats. +func NewEncoder(w io.Writer, format Format, options ...EncoderOption) Encoder { + escapingScheme := format.ToEscapingScheme() + + switch format.FormatType() { + case TypeProtoDelim: return encoderCloser{ encode: func(v *dto.MetricFamily) error { - _, err := pbutil.WriteDelimited(w, v) + _, err := protodelim.MarshalTo(w, v) return err }, close: func() error { return nil }, } - case FmtProtoCompact: + case TypeProtoCompact: return encoderCloser{ encode: func(v *dto.MetricFamily) error { - _, err := fmt.Fprintln(w, v.String()) + _, err := fmt.Fprintln(w, model.EscapeMetricFamily(v, escapingScheme).String()) return err }, close: func() error { return nil }, } - case FmtProtoText: + case TypeProtoText: return encoderCloser{ encode: func(v *dto.MetricFamily) error { - _, err := fmt.Fprintln(w, prototext.Format(v)) + _, err := fmt.Fprintln(w, prototext.Format(model.EscapeMetricFamily(v, escapingScheme))) return err }, close: func() error { return nil }, } - case FmtText: + case TypeTextPlain: return encoderCloser{ encode: func(v *dto.MetricFamily) error { - _, err := MetricFamilyToText(w, v) + _, err := MetricFamilyToText(w, model.EscapeMetricFamily(v, escapingScheme)) return err }, close: func() error { return nil }, } - case FmtOpenMetrics_0_0_1, FmtOpenMetrics_1_0_0: + case TypeOpenMetrics: return encoderCloser{ encode: func(v *dto.MetricFamily) error { - _, err := MetricFamilyToOpenMetrics(w, v) + _, err := MetricFamilyToOpenMetrics(w, model.EscapeMetricFamily(v, escapingScheme), options...) return err }, close: func() error { diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go index c4cb20f0d..051b38cd1 100644 --- a/vendor/github.com/prometheus/common/expfmt/expfmt.go +++ b/vendor/github.com/prometheus/common/expfmt/expfmt.go @@ -14,30 +14,164 @@ // Package expfmt contains tools for reading and writing Prometheus metrics. package expfmt +import ( + "fmt" + "strings" + + "github.com/prometheus/common/model" +) + // Format specifies the HTTP content type of the different wire protocols. type Format string -// Constants to assemble the Content-Type values for the different wire protocols. +// Constants to assemble the Content-Type values for the different wire +// protocols. The Content-Type strings here are all for the legacy exposition +// formats, where valid characters for metric names and label names are limited. +// Support for arbitrary UTF-8 characters in those names is already partially +// implemented in this module (see model.ValidationScheme), but to actually use +// it on the wire, new content-type strings will have to be agreed upon and +// added here. const ( TextVersion = "0.0.4" ProtoType = `application/vnd.google.protobuf` ProtoProtocol = `io.prometheus.client.MetricFamily` - ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" + protoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" OpenMetricsType = `application/openmetrics-text` OpenMetricsVersion_0_0_1 = "0.0.1" OpenMetricsVersion_1_0_0 = "1.0.0" - // The Content-Type values for the different wire protocols. - FmtUnknown Format = `` - FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8` - FmtProtoDelim Format = ProtoFmt + ` encoding=delimited` - FmtProtoText Format = ProtoFmt + ` encoding=text` - FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text` - FmtOpenMetrics_1_0_0 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_1_0_0 + `; charset=utf-8` - FmtOpenMetrics_0_0_1 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_0_0_1 + `; charset=utf-8` + // The Content-Type values for the different wire protocols. Note that these + // values are now unexported. If code was relying on comparisons to these + // constants, instead use FormatType(). + fmtUnknown Format = `` + fmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8` + fmtProtoDelim Format = protoFmt + ` encoding=delimited` + fmtProtoText Format = protoFmt + ` encoding=text` + fmtProtoCompact Format = protoFmt + ` encoding=compact-text` + fmtOpenMetrics_1_0_0 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_1_0_0 + `; charset=utf-8` + fmtOpenMetrics_0_0_1 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_0_0_1 + `; charset=utf-8` ) const ( hdrContentType = "Content-Type" hdrAccept = "Accept" ) + +// FormatType is a Go enum representing the overall category for the given +// Format. As the number of Format permutations increases, doing basic string +// comparisons are not feasible, so this enum captures the most useful +// high-level attribute of the Format string. +type FormatType int + +const ( + TypeUnknown FormatType = iota + TypeProtoCompact + TypeProtoDelim + TypeProtoText + TypeTextPlain + TypeOpenMetrics +) + +// NewFormat generates a new Format from the type provided. Mostly used for +// tests, most Formats should be generated as part of content negotiation in +// encode.go. If a type has more than one version, the latest version will be +// returned. +func NewFormat(t FormatType) Format { + switch t { + case TypeProtoCompact: + return fmtProtoCompact + case TypeProtoDelim: + return fmtProtoDelim + case TypeProtoText: + return fmtProtoText + case TypeTextPlain: + return fmtText + case TypeOpenMetrics: + return fmtOpenMetrics_1_0_0 + default: + return fmtUnknown + } +} + +// NewOpenMetricsFormat generates a new OpenMetrics format matching the +// specified version number. +func NewOpenMetricsFormat(version string) (Format, error) { + if version == OpenMetricsVersion_0_0_1 { + return fmtOpenMetrics_0_0_1, nil + } + if version == OpenMetricsVersion_1_0_0 { + return fmtOpenMetrics_1_0_0, nil + } + return fmtUnknown, fmt.Errorf("unknown open metrics version string") +} + +// FormatType deduces an overall FormatType for the given format. +func (f Format) FormatType() FormatType { + toks := strings.Split(string(f), ";") + params := make(map[string]string) + for i, t := range toks { + if i == 0 { + continue + } + args := strings.Split(t, "=") + if len(args) != 2 { + continue + } + params[strings.TrimSpace(args[0])] = strings.TrimSpace(args[1]) + } + + switch strings.TrimSpace(toks[0]) { + case ProtoType: + if params["proto"] != ProtoProtocol { + return TypeUnknown + } + switch params["encoding"] { + case "delimited": + return TypeProtoDelim + case "text": + return TypeProtoText + case "compact-text": + return TypeProtoCompact + default: + return TypeUnknown + } + case OpenMetricsType: + if params["charset"] != "utf-8" { + return TypeUnknown + } + return TypeOpenMetrics + case "text/plain": + v, ok := params["version"] + if !ok { + return TypeTextPlain + } + if v == TextVersion { + return TypeTextPlain + } + return TypeUnknown + default: + return TypeUnknown + } +} + +// ToEscapingScheme returns an EscapingScheme depending on the Format. Iff the +// Format contains a escaping=allow-utf-8 term, it will select NoEscaping. If a valid +// "escaping" term exists, that will be used. Otherwise, the global default will +// be returned. +func (format Format) ToEscapingScheme() model.EscapingScheme { + for _, p := range strings.Split(string(format), ";") { + toks := strings.Split(p, "=") + if len(toks) != 2 { + continue + } + key, value := strings.TrimSpace(toks[0]), strings.TrimSpace(toks[1]) + if key == model.EscapingKey { + scheme, err := model.ToEscapingScheme(value) + if err != nil { + return model.NameEscapingScheme + } + return scheme + } + } + return model.NameEscapingScheme +} diff --git a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go b/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go index 21cdddcf0..353c5e93f 100644 --- a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go +++ b/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go @@ -22,11 +22,47 @@ import ( "strconv" "strings" + "google.golang.org/protobuf/types/known/timestamppb" + "github.com/prometheus/common/model" dto "github.com/prometheus/client_model/go" ) +type encoderOption struct { + withCreatedLines bool + withUnit bool +} + +type EncoderOption func(*encoderOption) + +// WithCreatedLines is an EncoderOption that configures the OpenMetrics encoder +// to include _created lines (See +// https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#counter-1). +// Created timestamps can improve the accuracy of series reset detection, but +// come with a bandwidth cost. +// +// At the time of writing, created timestamp ingestion is still experimental in +// Prometheus and need to be enabled with the feature-flag +// `--feature-flag=created-timestamp-zero-ingestion`, and breaking changes are +// still possible. Therefore, it is recommended to use this feature with caution. +func WithCreatedLines() EncoderOption { + return func(t *encoderOption) { + t.withCreatedLines = true + } +} + +// WithUnit is an EncoderOption enabling a set unit to be written to the output +// and to be added to the metric name, if it's not there already, as a suffix. +// Without opting in this way, the unit will not be added to the metric name and, +// on top of that, the unit will not be passed onto the output, even if it +// were declared in the *dto.MetricFamily struct, i.e. even if in.Unit !=nil. +func WithUnit() EncoderOption { + return func(t *encoderOption) { + t.withUnit = true + } +} + // MetricFamilyToOpenMetrics converts a MetricFamily proto message into the // OpenMetrics text format and writes the resulting lines to 'out'. It returns // the number of bytes written and any error encountered. The output will have @@ -35,6 +71,18 @@ import ( // sanity checks. If the input contains duplicate metrics or invalid metric or // label names, the conversion will result in invalid text format output. // +// If metric names conform to the legacy validation pattern, they will be placed +// outside the brackets in the traditional way, like `foo{}`. If the metric name +// fails the legacy validation check, it will be placed quoted inside the +// brackets: `{"foo"}`. As stated above, the input is assumed to be santized and +// no error will be thrown in this case. +// +// Similar to metric names, if label names conform to the legacy validation +// pattern, they will be unquoted as normal, like `foo{bar="baz"}`. If the label +// name fails the legacy validation check, it will be quoted: +// `foo{"bar"="baz"}`. As stated above, the input is assumed to be santized and +// no error will be thrown in this case. +// // This function fulfills the type 'expfmt.encoder'. // // Note that OpenMetrics requires a final `# EOF` line. Since this function acts @@ -47,20 +95,34 @@ import ( // Prometheus to OpenMetrics or vice versa: // // - Counters are expected to have the `_total` suffix in their metric name. In -// the output, the suffix will be truncated from the `# TYPE` and `# HELP` -// line. A counter with a missing `_total` suffix is not an error. However, +// the output, the suffix will be truncated from the `# TYPE`, `# HELP` and `# UNIT` +// lines. A counter with a missing `_total` suffix is not an error. However, // its type will be set to `unknown` in that case to avoid invalid OpenMetrics // output. // -// - No support for the following (optional) features: `# UNIT` line, `_created` -// line, info type, stateset type, gaugehistogram type. +// - According to the OM specs, the `# UNIT` line is optional, but if populated, +// the unit has to be present in the metric name as its suffix: +// (see https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#unit). +// However, in order to accommodate any potential scenario where such a change in the +// metric name is not desirable, the users are here given the choice of either explicitly +// opt in, in case they wish for the unit to be included in the output AND in the metric name +// as a suffix (see the description of the WithUnit function above), +// or not to opt in, in case they don't want for any of that to happen. +// +// - No support for the following (optional) features: info type, +// stateset type, gaugehistogram type. // // - The size of exemplar labels is not checked (i.e. it's possible to create // exemplars that are larger than allowed by the OpenMetrics specification). // // - The value of Counters is not checked. (OpenMetrics doesn't allow counters // with a `NaN` value.) -func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int, err error) { +func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...EncoderOption) (written int, err error) { + toOM := encoderOption{} + for _, option := range options { + option(&toOM) + } + name := in.GetName() if name == "" { return 0, fmt.Errorf("MetricFamily has no name: %s", in) @@ -83,12 +145,15 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int } var ( - n int - metricType = in.GetType() - shortName = name + n int + metricType = in.GetType() + compliantName = name ) - if metricType == dto.MetricType_COUNTER && strings.HasSuffix(shortName, "_total") { - shortName = name[:len(name)-6] + if metricType == dto.MetricType_COUNTER && strings.HasSuffix(compliantName, "_total") { + compliantName = name[:len(name)-6] + } + if toOM.withUnit && in.Unit != nil && !strings.HasSuffix(compliantName, fmt.Sprintf("_%s", *in.Unit)) { + compliantName = compliantName + fmt.Sprintf("_%s", *in.Unit) } // Comments, first HELP, then TYPE. @@ -98,7 +163,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int if err != nil { return } - n, err = w.WriteString(shortName) + n, err = writeName(w, compliantName) written += n if err != nil { return @@ -124,7 +189,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int if err != nil { return } - n, err = w.WriteString(shortName) + n, err = writeName(w, compliantName) written += n if err != nil { return @@ -151,55 +216,89 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int if err != nil { return } + if toOM.withUnit && in.Unit != nil { + n, err = w.WriteString("# UNIT ") + written += n + if err != nil { + return + } + n, err = writeName(w, compliantName) + written += n + if err != nil { + return + } + + err = w.WriteByte(' ') + written++ + if err != nil { + return + } + n, err = writeEscapedString(w, *in.Unit, true) + written += n + if err != nil { + return + } + err = w.WriteByte('\n') + written++ + if err != nil { + return + } + } + + var createdTsBytesWritten int // Finally the samples, one line for each. + if metricType == dto.MetricType_COUNTER && strings.HasSuffix(name, "_total") { + compliantName = compliantName + "_total" + } for _, metric := range in.Metric { switch metricType { case dto.MetricType_COUNTER: if metric.Counter == nil { return written, fmt.Errorf( - "expected counter in metric %s %s", name, metric, + "expected counter in metric %s %s", compliantName, metric, ) } - // Note that we have ensured above that either the name - // ends on `_total` or that the rendered type is - // `unknown`. Therefore, no `_total` must be added here. n, err = writeOpenMetricsSample( - w, name, "", metric, "", 0, + w, compliantName, "", metric, "", 0, metric.Counter.GetValue(), 0, false, metric.Counter.Exemplar, ) + if toOM.withCreatedLines && metric.Counter.CreatedTimestamp != nil { + createdTsBytesWritten, err = writeOpenMetricsCreated(w, compliantName, "_total", metric, "", 0, metric.Counter.GetCreatedTimestamp()) + n += createdTsBytesWritten + } case dto.MetricType_GAUGE: if metric.Gauge == nil { return written, fmt.Errorf( - "expected gauge in metric %s %s", name, metric, + "expected gauge in metric %s %s", compliantName, metric, ) } n, err = writeOpenMetricsSample( - w, name, "", metric, "", 0, + w, compliantName, "", metric, "", 0, metric.Gauge.GetValue(), 0, false, nil, ) case dto.MetricType_UNTYPED: if metric.Untyped == nil { return written, fmt.Errorf( - "expected untyped in metric %s %s", name, metric, + "expected untyped in metric %s %s", compliantName, metric, ) } n, err = writeOpenMetricsSample( - w, name, "", metric, "", 0, + w, compliantName, "", metric, "", 0, metric.Untyped.GetValue(), 0, false, nil, ) case dto.MetricType_SUMMARY: if metric.Summary == nil { return written, fmt.Errorf( - "expected summary in metric %s %s", name, metric, + "expected summary in metric %s %s", compliantName, metric, ) } for _, q := range metric.Summary.Quantile { n, err = writeOpenMetricsSample( - w, name, "", metric, + w, compliantName, "", metric, model.QuantileLabel, q.GetQuantile(), q.GetValue(), 0, false, nil, @@ -210,7 +309,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int } } n, err = writeOpenMetricsSample( - w, name, "_sum", metric, "", 0, + w, compliantName, "_sum", metric, "", 0, metric.Summary.GetSampleSum(), 0, false, nil, ) @@ -219,20 +318,24 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int return } n, err = writeOpenMetricsSample( - w, name, "_count", metric, "", 0, + w, compliantName, "_count", metric, "", 0, 0, metric.Summary.GetSampleCount(), true, nil, ) + if toOM.withCreatedLines && metric.Summary.CreatedTimestamp != nil { + createdTsBytesWritten, err = writeOpenMetricsCreated(w, compliantName, "", metric, "", 0, metric.Summary.GetCreatedTimestamp()) + n += createdTsBytesWritten + } case dto.MetricType_HISTOGRAM: if metric.Histogram == nil { return written, fmt.Errorf( - "expected histogram in metric %s %s", name, metric, + "expected histogram in metric %s %s", compliantName, metric, ) } infSeen := false for _, b := range metric.Histogram.Bucket { n, err = writeOpenMetricsSample( - w, name, "_bucket", metric, + w, compliantName, "_bucket", metric, model.BucketLabel, b.GetUpperBound(), 0, b.GetCumulativeCount(), true, b.Exemplar, @@ -247,7 +350,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int } if !infSeen { n, err = writeOpenMetricsSample( - w, name, "_bucket", metric, + w, compliantName, "_bucket", metric, model.BucketLabel, math.Inf(+1), 0, metric.Histogram.GetSampleCount(), true, nil, @@ -258,7 +361,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int } } n, err = writeOpenMetricsSample( - w, name, "_sum", metric, "", 0, + w, compliantName, "_sum", metric, "", 0, metric.Histogram.GetSampleSum(), 0, false, nil, ) @@ -267,13 +370,17 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int return } n, err = writeOpenMetricsSample( - w, name, "_count", metric, "", 0, + w, compliantName, "_count", metric, "", 0, 0, metric.Histogram.GetSampleCount(), true, nil, ) + if toOM.withCreatedLines && metric.Histogram.CreatedTimestamp != nil { + createdTsBytesWritten, err = writeOpenMetricsCreated(w, compliantName, "", metric, "", 0, metric.Histogram.GetCreatedTimestamp()) + n += createdTsBytesWritten + } default: return written, fmt.Errorf( - "unexpected type in metric %s %s", name, metric, + "unexpected type in metric %s %s", compliantName, metric, ) } written += n @@ -303,21 +410,9 @@ func writeOpenMetricsSample( floatValue float64, intValue uint64, useIntValue bool, exemplar *dto.Exemplar, ) (int, error) { - var written int - n, err := w.WriteString(name) - written += n - if err != nil { - return written, err - } - if suffix != "" { - n, err = w.WriteString(suffix) - written += n - if err != nil { - return written, err - } - } - n, err = writeOpenMetricsLabelPairs( - w, metric.Label, additionalLabelName, additionalLabelValue, + written := 0 + n, err := writeOpenMetricsNameAndLabelPairs( + w, name+suffix, metric.Label, additionalLabelName, additionalLabelValue, ) written += n if err != nil { @@ -350,7 +445,7 @@ func writeOpenMetricsSample( return written, err } } - if exemplar != nil { + if exemplar != nil && len(exemplar.Label) > 0 { n, err = writeExemplar(w, exemplar) written += n if err != nil { @@ -365,27 +460,58 @@ func writeOpenMetricsSample( return written, nil } -// writeOpenMetricsLabelPairs works like writeOpenMetrics but formats the float -// in OpenMetrics style. -func writeOpenMetricsLabelPairs( +// writeOpenMetricsNameAndLabelPairs works like writeOpenMetricsSample but +// formats the float in OpenMetrics style. +func writeOpenMetricsNameAndLabelPairs( w enhancedWriter, + name string, in []*dto.LabelPair, additionalLabelName string, additionalLabelValue float64, ) (int, error) { - if len(in) == 0 && additionalLabelName == "" { - return 0, nil - } var ( - written int - separator byte = '{' + written int + separator byte = '{' + metricInsideBraces = false ) + + if name != "" { + // If the name does not pass the legacy validity check, we must put the + // metric name inside the braces, quoted. + if !model.IsValidLegacyMetricName(model.LabelValue(name)) { + metricInsideBraces = true + err := w.WriteByte(separator) + written++ + if err != nil { + return written, err + } + separator = ',' + } + + n, err := writeName(w, name) + written += n + if err != nil { + return written, err + } + } + + if len(in) == 0 && additionalLabelName == "" { + if metricInsideBraces { + err := w.WriteByte('}') + written++ + if err != nil { + return written, err + } + } + return written, nil + } + for _, lp := range in { err := w.WriteByte(separator) written++ if err != nil { return written, err } - n, err := w.WriteString(lp.GetName()) + n, err := writeName(w, lp.GetName()) written += n if err != nil { return written, err @@ -442,6 +568,49 @@ func writeOpenMetricsLabelPairs( return written, nil } +// writeOpenMetricsCreated writes the created timestamp for a single time series +// following OpenMetrics text format to w, given the metric name, the metric proto +// message itself, optionally a suffix to be removed, e.g. '_total' for counters, +// an additional label name with a float64 value (use empty string as label name if +// not required) and the timestamp that represents the created timestamp. +// The function returns the number of bytes written and any error encountered. +func writeOpenMetricsCreated(w enhancedWriter, + name, suffixToTrim string, metric *dto.Metric, + additionalLabelName string, additionalLabelValue float64, + createdTimestamp *timestamppb.Timestamp, +) (int, error) { + written := 0 + n, err := writeOpenMetricsNameAndLabelPairs( + w, strings.TrimSuffix(name, suffixToTrim)+"_created", metric.Label, additionalLabelName, additionalLabelValue, + ) + written += n + if err != nil { + return written, err + } + + err = w.WriteByte(' ') + written++ + if err != nil { + return written, err + } + + // TODO(beorn7): Format this directly from components of ts to + // avoid overflow/underflow and precision issues of the float + // conversion. + n, err = writeOpenMetricsFloat(w, float64(createdTimestamp.AsTime().UnixNano())/1e9) + written += n + if err != nil { + return written, err + } + + err = w.WriteByte('\n') + written++ + if err != nil { + return written, err + } + return written, nil +} + // writeExemplar writes the provided exemplar in OpenMetrics format to w. The // function returns the number of bytes written and any error encountered. func writeExemplar(w enhancedWriter, e *dto.Exemplar) (int, error) { @@ -451,7 +620,7 @@ func writeExemplar(w enhancedWriter, e *dto.Exemplar) (int, error) { if err != nil { return written, err } - n, err = writeOpenMetricsLabelPairs(w, e.Label, "", 0) + n, err = writeOpenMetricsNameAndLabelPairs(w, "", e.Label, "", 0) written += n if err != nil { return written, err diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go index 2946b8f1a..f9b8265a9 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_create.go +++ b/vendor/github.com/prometheus/common/expfmt/text_create.go @@ -62,6 +62,18 @@ var ( // contains duplicate metrics or invalid metric or label names, the conversion // will result in invalid text format output. // +// If metric names conform to the legacy validation pattern, they will be placed +// outside the brackets in the traditional way, like `foo{}`. If the metric name +// fails the legacy validation check, it will be placed quoted inside the +// brackets: `{"foo"}`. As stated above, the input is assumed to be santized and +// no error will be thrown in this case. +// +// Similar to metric names, if label names conform to the legacy validation +// pattern, they will be unquoted as normal, like `foo{bar="baz"}`. If the label +// name fails the legacy validation check, it will be quoted: +// `foo{"bar"="baz"}`. As stated above, the input is assumed to be santized and +// no error will be thrown in this case. +// // This method fulfills the type 'prometheus.encoder'. func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err error) { // Fail-fast checks. @@ -98,7 +110,7 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e if err != nil { return } - n, err = w.WriteString(name) + n, err = writeName(w, name) written += n if err != nil { return @@ -124,7 +136,7 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e if err != nil { return } - n, err = w.WriteString(name) + n, err = writeName(w, name) written += n if err != nil { return @@ -280,21 +292,9 @@ func writeSample( additionalLabelName string, additionalLabelValue float64, value float64, ) (int, error) { - var written int - n, err := w.WriteString(name) - written += n - if err != nil { - return written, err - } - if suffix != "" { - n, err = w.WriteString(suffix) - written += n - if err != nil { - return written, err - } - } - n, err = writeLabelPairs( - w, metric.Label, additionalLabelName, additionalLabelValue, + written := 0 + n, err := writeNameAndLabelPairs( + w, name+suffix, metric.Label, additionalLabelName, additionalLabelValue, ) written += n if err != nil { @@ -330,32 +330,64 @@ func writeSample( return written, nil } -// writeLabelPairs converts a slice of LabelPair proto messages plus the -// explicitly given additional label pair into text formatted as required by the -// text format and writes it to 'w'. An empty slice in combination with an empty -// string 'additionalLabelName' results in nothing being written. Otherwise, the -// label pairs are written, escaped as required by the text format, and enclosed -// in '{...}'. The function returns the number of bytes written and any error -// encountered. -func writeLabelPairs( +// writeNameAndLabelPairs converts a slice of LabelPair proto messages plus the +// explicitly given metric name and additional label pair into text formatted as +// required by the text format and writes it to 'w'. An empty slice in +// combination with an empty string 'additionalLabelName' results in nothing +// being written. Otherwise, the label pairs are written, escaped as required by +// the text format, and enclosed in '{...}'. The function returns the number of +// bytes written and any error encountered. If the metric name is not +// legacy-valid, it will be put inside the brackets as well. Legacy-invalid +// label names will also be quoted. +func writeNameAndLabelPairs( w enhancedWriter, + name string, in []*dto.LabelPair, additionalLabelName string, additionalLabelValue float64, ) (int, error) { - if len(in) == 0 && additionalLabelName == "" { - return 0, nil - } var ( - written int - separator byte = '{' + written int + separator byte = '{' + metricInsideBraces = false ) + + if name != "" { + // If the name does not pass the legacy validity check, we must put the + // metric name inside the braces. + if !model.IsValidLegacyMetricName(model.LabelValue(name)) { + metricInsideBraces = true + err := w.WriteByte(separator) + written++ + if err != nil { + return written, err + } + separator = ',' + } + n, err := writeName(w, name) + written += n + if err != nil { + return written, err + } + } + + if len(in) == 0 && additionalLabelName == "" { + if metricInsideBraces { + err := w.WriteByte('}') + written++ + if err != nil { + return written, err + } + } + return written, nil + } + for _, lp := range in { err := w.WriteByte(separator) written++ if err != nil { return written, err } - n, err := w.WriteString(lp.GetName()) + n, err := writeName(w, lp.GetName()) written += n if err != nil { return written, err @@ -462,3 +494,27 @@ func writeInt(w enhancedWriter, i int64) (int, error) { numBufPool.Put(bp) return written, err } + +// writeName writes a string as-is if it complies with the legacy naming +// scheme, or escapes it in double quotes if not. +func writeName(w enhancedWriter, name string) (int, error) { + if model.IsValidLegacyMetricName(model.LabelValue(name)) { + return w.WriteString(name) + } + var written int + var err error + err = w.WriteByte('"') + written++ + if err != nil { + return written, err + } + var n int + n, err = writeEscapedString(w, name, true) + written += n + if err != nil { + return written, err + } + err = w.WriteByte('"') + written++ + return written, err +} diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go index 35db1cc9d..26490211a 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go @@ -16,6 +16,7 @@ package expfmt import ( "bufio" "bytes" + "errors" "fmt" "io" "math" @@ -24,8 +25,9 @@ import ( dto "github.com/prometheus/client_model/go" - "github.com/prometheus/common/model" "google.golang.org/protobuf/proto" + + "github.com/prometheus/common/model" ) // A stateFn is a function that represents a state in a state machine. By @@ -112,7 +114,7 @@ func (p *TextParser) TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricF // stream. Turn this error into something nicer and more // meaningful. (io.EOF is often used as a signal for the legitimate end // of an input stream.) - if p.err == io.EOF { + if p.err != nil && errors.Is(p.err, io.EOF) { p.parseError("unexpected end of input stream") } return p.metricFamiliesByName, p.err @@ -146,7 +148,7 @@ func (p *TextParser) startOfLine() stateFn { // which is not an error but the signal that we are done. // Any other error that happens to align with the start of // a line is still an error. - if p.err == io.EOF { + if errors.Is(p.err, io.EOF) { p.err = nil } return nil diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt deleted file mode 100644 index 7723656d5..000000000 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt +++ /dev/null @@ -1,67 +0,0 @@ -PACKAGE - -package goautoneg -import "bitbucket.org/ww/goautoneg" - -HTTP Content-Type Autonegotiation. - -The functions in this package implement the behaviour specified in -http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - -Copyright (c) 2011, Open Knowledge Foundation Ltd. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - Neither the name of the Open Knowledge Foundation Ltd. nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -FUNCTIONS - -func Negotiate(header string, alternatives []string) (content_type string) -Negotiate the most appropriate content_type given the accept header -and a list of alternatives. - -func ParseAccept(header string) (accept []Accept) -Parse an Accept Header string returning a sorted list -of clauses - - -TYPES - -type Accept struct { - Type, SubType string - Q float32 - Params map[string]string -} -Structure to represent a clause in an HTTP Accept Header - - -SUBDIRECTORIES - - .hg diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go deleted file mode 100644 index a21b9d15d..000000000 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright (c) 2011, Open Knowledge Foundation Ltd. -All rights reserved. - -HTTP Content-Type Autonegotiation. - -The functions in this package implement the behaviour specified in -http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - Neither the name of the Open Knowledge Foundation Ltd. nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -package goautoneg - -import ( - "sort" - "strconv" - "strings" -) - -// Structure to represent a clause in an HTTP Accept Header -type Accept struct { - Type, SubType string - Q float64 - Params map[string]string -} - -// For internal use, so that we can use the sort interface -type accept_slice []Accept - -func (accept accept_slice) Len() int { - slice := []Accept(accept) - return len(slice) -} - -func (accept accept_slice) Less(i, j int) bool { - slice := []Accept(accept) - ai, aj := slice[i], slice[j] - if ai.Q > aj.Q { - return true - } - if ai.Type != "*" && aj.Type == "*" { - return true - } - if ai.SubType != "*" && aj.SubType == "*" { - return true - } - return false -} - -func (accept accept_slice) Swap(i, j int) { - slice := []Accept(accept) - slice[i], slice[j] = slice[j], slice[i] -} - -// Parse an Accept Header string returning a sorted list -// of clauses -func ParseAccept(header string) (accept []Accept) { - parts := strings.Split(header, ",") - accept = make([]Accept, 0, len(parts)) - for _, part := range parts { - part := strings.Trim(part, " ") - - a := Accept{} - a.Params = make(map[string]string) - a.Q = 1.0 - - mrp := strings.Split(part, ";") - - media_range := mrp[0] - sp := strings.Split(media_range, "/") - a.Type = strings.Trim(sp[0], " ") - - switch { - case len(sp) == 1 && a.Type == "*": - a.SubType = "*" - case len(sp) == 2: - a.SubType = strings.Trim(sp[1], " ") - default: - continue - } - - if len(mrp) == 1 { - accept = append(accept, a) - continue - } - - for _, param := range mrp[1:] { - sp := strings.SplitN(param, "=", 2) - if len(sp) != 2 { - continue - } - token := strings.Trim(sp[0], " ") - if token == "q" { - a.Q, _ = strconv.ParseFloat(sp[1], 32) - } else { - a.Params[token] = strings.Trim(sp[1], " ") - } - } - - accept = append(accept, a) - } - - slice := accept_slice(accept) - sort.Sort(slice) - - return -} - -// Negotiate the most appropriate content_type given the accept header -// and a list of alternatives. -func Negotiate(header string, alternatives []string) (content_type string) { - asp := make([][]string, 0, len(alternatives)) - for _, ctype := range alternatives { - asp = append(asp, strings.SplitN(ctype, "/", 2)) - } - for _, clause := range ParseAccept(header) { - for i, ctsp := range asp { - if clause.Type == ctsp[0] && clause.SubType == ctsp[1] { - content_type = alternatives[i] - return - } - if clause.Type == ctsp[0] && clause.SubType == "*" { - content_type = alternatives[i] - return - } - if clause.Type == "*" && clause.SubType == "*" { - content_type = alternatives[i] - return - } - } - } - return -} diff --git a/vendor/github.com/prometheus/common/model/alert.go b/vendor/github.com/prometheus/common/model/alert.go index 35e739c7a..80d1fe944 100644 --- a/vendor/github.com/prometheus/common/model/alert.go +++ b/vendor/github.com/prometheus/common/model/alert.go @@ -75,7 +75,12 @@ func (a *Alert) ResolvedAt(ts time.Time) bool { // Status returns the status of the alert. func (a *Alert) Status() AlertStatus { - if a.Resolved() { + return a.StatusAt(time.Now()) +} + +// StatusAt returns the status of the alert at the given timestamp. +func (a *Alert) StatusAt(ts time.Time) AlertStatus { + if a.ResolvedAt(ts) { return AlertResolved } return AlertFiring @@ -90,13 +95,13 @@ func (a *Alert) Validate() error { return fmt.Errorf("start time must be before end time") } if err := a.Labels.Validate(); err != nil { - return fmt.Errorf("invalid label set: %s", err) + return fmt.Errorf("invalid label set: %w", err) } if len(a.Labels) == 0 { return fmt.Errorf("at least one label pair required") } if err := a.Annotations.Validate(); err != nil { - return fmt.Errorf("invalid annotations: %s", err) + return fmt.Errorf("invalid annotations: %w", err) } return nil } @@ -127,6 +132,17 @@ func (as Alerts) HasFiring() bool { return false } +// HasFiringAt returns true iff one of the alerts is not resolved +// at the time ts. +func (as Alerts) HasFiringAt(ts time.Time) bool { + for _, a := range as { + if !a.ResolvedAt(ts) { + return true + } + } + return false +} + // Status returns StatusFiring iff at least one of the alerts is firing. func (as Alerts) Status() AlertStatus { if as.HasFiring() { @@ -134,3 +150,12 @@ func (as Alerts) Status() AlertStatus { } return AlertResolved } + +// StatusAt returns StatusFiring iff at least one of the alerts is firing +// at the time ts. +func (as Alerts) StatusAt(ts time.Time) AlertStatus { + if as.HasFiringAt(ts) { + return AlertFiring + } + return AlertResolved +} diff --git a/vendor/github.com/prometheus/common/model/labels.go b/vendor/github.com/prometheus/common/model/labels.go index ef8956335..3317ce22f 100644 --- a/vendor/github.com/prometheus/common/model/labels.go +++ b/vendor/github.com/prometheus/common/model/labels.go @@ -97,17 +97,25 @@ var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$") // therewith. type LabelName string -// IsValid is true iff the label name matches the pattern of LabelNameRE. This -// method, however, does not use LabelNameRE for the check but a much faster -// hardcoded implementation. +// IsValid returns true iff name matches the pattern of LabelNameRE for legacy +// names, and iff it's valid UTF-8 if NameValidationScheme is set to +// UTF8Validation. For the legacy matching, it does not use LabelNameRE for the +// check but a much faster hardcoded implementation. func (ln LabelName) IsValid() bool { if len(ln) == 0 { return false } - for i, b := range ln { - if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) { - return false + switch NameValidationScheme { + case LegacyValidation: + for i, b := range ln { + if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) { + return false + } } + case UTF8Validation: + return utf8.ValidString(string(ln)) + default: + panic(fmt.Sprintf("Invalid name validation scheme requested: %d", NameValidationScheme)) } return true } @@ -164,7 +172,7 @@ func (l LabelNames) String() string { // A LabelValue is an associated value for a LabelName. type LabelValue string -// IsValid returns true iff the string is a valid UTF8. +// IsValid returns true iff the string is a valid UTF-8. func (lv LabelValue) IsValid() bool { return utf8.ValidString(string(lv)) } diff --git a/vendor/github.com/prometheus/common/model/labelset.go b/vendor/github.com/prometheus/common/model/labelset.go index 6eda08a73..d0ad88da3 100644 --- a/vendor/github.com/prometheus/common/model/labelset.go +++ b/vendor/github.com/prometheus/common/model/labelset.go @@ -17,7 +17,6 @@ import ( "encoding/json" "fmt" "sort" - "strings" ) // A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet @@ -129,16 +128,6 @@ func (l LabelSet) Merge(other LabelSet) LabelSet { return result } -func (l LabelSet) String() string { - lstrs := make([]string, 0, len(l)) - for l, v := range l { - lstrs = append(lstrs, fmt.Sprintf("%s=%q", l, v)) - } - - sort.Strings(lstrs) - return fmt.Sprintf("{%s}", strings.Join(lstrs, ", ")) -} - // Fingerprint returns the LabelSet's fingerprint. func (ls LabelSet) Fingerprint() Fingerprint { return labelSetToFingerprint(ls) diff --git a/vendor/github.com/prometheus/common/model/labelset_string.go b/vendor/github.com/prometheus/common/model/labelset_string.go new file mode 100644 index 000000000..481c47b46 --- /dev/null +++ b/vendor/github.com/prometheus/common/model/labelset_string.go @@ -0,0 +1,45 @@ +// Copyright 2024 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.21 + +package model + +import ( + "bytes" + "slices" + "strconv" +) + +// String will look like `{foo="bar", more="less"}`. Names are sorted alphabetically. +func (l LabelSet) String() string { + var lna [32]string // On stack to avoid memory allocation for sorting names. + labelNames := lna[:0] + for name := range l { + labelNames = append(labelNames, string(name)) + } + slices.Sort(labelNames) + var bytea [1024]byte // On stack to avoid memory allocation while building the output. + b := bytes.NewBuffer(bytea[:0]) + b.WriteByte('{') + for i, name := range labelNames { + if i > 0 { + b.WriteString(", ") + } + b.WriteString(name) + b.WriteByte('=') + b.Write(strconv.AppendQuote(b.AvailableBuffer(), string(l[LabelName(name)]))) + } + b.WriteByte('}') + return b.String() +} diff --git a/vendor/github.com/prometheus/common/model/labelset_string_go120.go b/vendor/github.com/prometheus/common/model/labelset_string_go120.go new file mode 100644 index 000000000..c4212685e --- /dev/null +++ b/vendor/github.com/prometheus/common/model/labelset_string_go120.go @@ -0,0 +1,39 @@ +// Copyright 2024 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !go1.21 + +package model + +import ( + "fmt" + "sort" + "strings" +) + +// String was optimized using functions not available for go 1.20 +// or lower. We keep the old implementation for compatibility with client_golang. +// Once client golang drops support for go 1.20 (scheduled for August 2024), this +// file can be removed. +func (l LabelSet) String() string { + labelNames := make([]string, 0, len(l)) + for name := range l { + labelNames = append(labelNames, string(name)) + } + sort.Strings(labelNames) + lstrs := make([]string, 0, len(l)) + for _, name := range labelNames { + lstrs = append(lstrs, fmt.Sprintf("%s=%q", name, l[LabelName(name)])) + } + return fmt.Sprintf("{%s}", strings.Join(lstrs, ", ")) +} diff --git a/vendor/github.com/prometheus/common/model/metadata.go b/vendor/github.com/prometheus/common/model/metadata.go new file mode 100644 index 000000000..447ab8ad6 --- /dev/null +++ b/vendor/github.com/prometheus/common/model/metadata.go @@ -0,0 +1,28 @@ +// Copyright 2023 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package model + +// MetricType represents metric type values. +type MetricType string + +const ( + MetricTypeCounter = MetricType("counter") + MetricTypeGauge = MetricType("gauge") + MetricTypeHistogram = MetricType("histogram") + MetricTypeGaugeHistogram = MetricType("gaugehistogram") + MetricTypeSummary = MetricType("summary") + MetricTypeInfo = MetricType("info") + MetricTypeStateset = MetricType("stateset") + MetricTypeUnknown = MetricType("unknown") +) diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go index 00804b7fe..eb865e5a5 100644 --- a/vendor/github.com/prometheus/common/model/metric.go +++ b/vendor/github.com/prometheus/common/model/metric.go @@ -18,15 +18,84 @@ import ( "regexp" "sort" "strings" + "unicode/utf8" + + dto "github.com/prometheus/client_model/go" + "google.golang.org/protobuf/proto" ) var ( - // MetricNameRE is a regular expression matching valid metric - // names. Note that the IsValidMetricName function performs the same - // check but faster than a match with this regular expression. - MetricNameRE = regexp.MustCompile(`^[a-zA-Z_:][a-zA-Z0-9_:]*$`) + // NameValidationScheme determines the method of name validation to be used by + // all calls to IsValidMetricName() and LabelName IsValid(). Setting UTF-8 mode + // in isolation from other components that don't support UTF-8 may result in + // bugs or other undefined behavior. This value is intended to be set by + // UTF-8-aware binaries as part of their startup. To avoid need for locking, + // this value should be set once, ideally in an init(), before multiple + // goroutines are started. + NameValidationScheme = LegacyValidation + + // NameEscapingScheme defines the default way that names will be + // escaped when presented to systems that do not support UTF-8 names. If the + // Content-Type "escaping" term is specified, that will override this value. + NameEscapingScheme = ValueEncodingEscaping +) + +// ValidationScheme is a Go enum for determining how metric and label names will +// be validated by this library. +type ValidationScheme int + +const ( + // LegacyValidation is a setting that requirets that metric and label names + // conform to the original Prometheus character requirements described by + // MetricNameRE and LabelNameRE. + LegacyValidation ValidationScheme = iota + + // UTF8Validation only requires that metric and label names be valid UTF-8 + // strings. + UTF8Validation +) + +type EscapingScheme int + +const ( + // NoEscaping indicates that a name will not be escaped. Unescaped names that + // do not conform to the legacy validity check will use a new exposition + // format syntax that will be officially standardized in future versions. + NoEscaping EscapingScheme = iota + + // UnderscoreEscaping replaces all legacy-invalid characters with underscores. + UnderscoreEscaping + + // DotsEscaping is similar to UnderscoreEscaping, except that dots are + // converted to `_dot_` and pre-existing underscores are converted to `__`. + DotsEscaping + + // ValueEncodingEscaping prepends the name with `U__` and replaces all invalid + // characters with the unicode value, surrounded by underscores. Single + // underscores are replaced with double underscores. + ValueEncodingEscaping +) + +const ( + // EscapingKey is the key in an Accept or Content-Type header that defines how + // metric and label names that do not conform to the legacy character + // requirements should be escaped when being scraped by a legacy prometheus + // system. If a system does not explicitly pass an escaping parameter in the + // Accept header, the default NameEscapingScheme will be used. + EscapingKey = "escaping" + + // Possible values for Escaping Key: + AllowUTF8 = "allow-utf-8" // No escaping required. + EscapeUnderscores = "underscores" + EscapeDots = "dots" + EscapeValues = "values" ) +// MetricNameRE is a regular expression matching valid metric +// names. Note that the IsValidMetricName function performs the same +// check but faster than a match with this regular expression. +var MetricNameRE = regexp.MustCompile(`^[a-zA-Z_:][a-zA-Z0-9_:]*$`) + // A Metric is similar to a LabelSet, but the key difference is that a Metric is // a singleton and refers to one and only one stream of samples. type Metric LabelSet @@ -86,17 +155,303 @@ func (m Metric) FastFingerprint() Fingerprint { return LabelSet(m).FastFingerprint() } -// IsValidMetricName returns true iff name matches the pattern of MetricNameRE. +// IsValidMetricName returns true iff name matches the pattern of MetricNameRE +// for legacy names, and iff it's valid UTF-8 if the UTF8Validation scheme is +// selected. +func IsValidMetricName(n LabelValue) bool { + switch NameValidationScheme { + case LegacyValidation: + return IsValidLegacyMetricName(n) + case UTF8Validation: + if len(n) == 0 { + return false + } + return utf8.ValidString(string(n)) + default: + panic(fmt.Sprintf("Invalid name validation scheme requested: %d", NameValidationScheme)) + } +} + +// IsValidLegacyMetricName is similar to IsValidMetricName but always uses the +// legacy validation scheme regardless of the value of NameValidationScheme. // This function, however, does not use MetricNameRE for the check but a much // faster hardcoded implementation. -func IsValidMetricName(n LabelValue) bool { +func IsValidLegacyMetricName(n LabelValue) bool { if len(n) == 0 { return false } for i, b := range n { - if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || b == ':' || (b >= '0' && b <= '9' && i > 0)) { + if !isValidLegacyRune(b, i) { return false } } return true } + +// EscapeMetricFamily escapes the given metric names and labels with the given +// escaping scheme. Returns a new object that uses the same pointers to fields +// when possible and creates new escaped versions so as not to mutate the +// input. +func EscapeMetricFamily(v *dto.MetricFamily, scheme EscapingScheme) *dto.MetricFamily { + if v == nil { + return nil + } + + if scheme == NoEscaping { + return v + } + + out := &dto.MetricFamily{ + Help: v.Help, + Type: v.Type, + Unit: v.Unit, + } + + // If the name is nil, copy as-is, don't try to escape. + if v.Name == nil || IsValidLegacyMetricName(LabelValue(v.GetName())) { + out.Name = v.Name + } else { + out.Name = proto.String(EscapeName(v.GetName(), scheme)) + } + for _, m := range v.Metric { + if !metricNeedsEscaping(m) { + out.Metric = append(out.Metric, m) + continue + } + + escaped := &dto.Metric{ + Gauge: m.Gauge, + Counter: m.Counter, + Summary: m.Summary, + Untyped: m.Untyped, + Histogram: m.Histogram, + TimestampMs: m.TimestampMs, + } + + for _, l := range m.Label { + if l.GetName() == MetricNameLabel { + if l.Value == nil || IsValidLegacyMetricName(LabelValue(l.GetValue())) { + escaped.Label = append(escaped.Label, l) + continue + } + escaped.Label = append(escaped.Label, &dto.LabelPair{ + Name: proto.String(MetricNameLabel), + Value: proto.String(EscapeName(l.GetValue(), scheme)), + }) + continue + } + if l.Name == nil || IsValidLegacyMetricName(LabelValue(l.GetName())) { + escaped.Label = append(escaped.Label, l) + continue + } + escaped.Label = append(escaped.Label, &dto.LabelPair{ + Name: proto.String(EscapeName(l.GetName(), scheme)), + Value: l.Value, + }) + } + out.Metric = append(out.Metric, escaped) + } + return out +} + +func metricNeedsEscaping(m *dto.Metric) bool { + for _, l := range m.Label { + if l.GetName() == MetricNameLabel && !IsValidLegacyMetricName(LabelValue(l.GetValue())) { + return true + } + if !IsValidLegacyMetricName(LabelValue(l.GetName())) { + return true + } + } + return false +} + +const ( + lowerhex = "0123456789abcdef" +) + +// EscapeName escapes the incoming name according to the provided escaping +// scheme. Depending on the rules of escaping, this may cause no change in the +// string that is returned. (Especially NoEscaping, which by definition is a +// noop). This function does not do any validation of the name. +func EscapeName(name string, scheme EscapingScheme) string { + if len(name) == 0 { + return name + } + var escaped strings.Builder + switch scheme { + case NoEscaping: + return name + case UnderscoreEscaping: + if IsValidLegacyMetricName(LabelValue(name)) { + return name + } + for i, b := range name { + if isValidLegacyRune(b, i) { + escaped.WriteRune(b) + } else { + escaped.WriteRune('_') + } + } + return escaped.String() + case DotsEscaping: + // Do not early return for legacy valid names, we still escape underscores. + for i, b := range name { + if b == '_' { + escaped.WriteString("__") + } else if b == '.' { + escaped.WriteString("_dot_") + } else if isValidLegacyRune(b, i) { + escaped.WriteRune(b) + } else { + escaped.WriteRune('_') + } + } + return escaped.String() + case ValueEncodingEscaping: + if IsValidLegacyMetricName(LabelValue(name)) { + return name + } + escaped.WriteString("U__") + for i, b := range name { + if isValidLegacyRune(b, i) { + escaped.WriteRune(b) + } else if !utf8.ValidRune(b) { + escaped.WriteString("_FFFD_") + } else if b < 0x100 { + escaped.WriteRune('_') + for s := 4; s >= 0; s -= 4 { + escaped.WriteByte(lowerhex[b>>uint(s)&0xF]) + } + escaped.WriteRune('_') + } else if b < 0x10000 { + escaped.WriteRune('_') + for s := 12; s >= 0; s -= 4 { + escaped.WriteByte(lowerhex[b>>uint(s)&0xF]) + } + escaped.WriteRune('_') + } + } + return escaped.String() + default: + panic(fmt.Sprintf("invalid escaping scheme %d", scheme)) + } +} + +// lower function taken from strconv.atoi +func lower(c byte) byte { + return c | ('x' - 'X') +} + +// UnescapeName unescapes the incoming name according to the provided escaping +// scheme if possible. Some schemes are partially or totally non-roundtripable. +// If any error is enountered, returns the original input. +func UnescapeName(name string, scheme EscapingScheme) string { + if len(name) == 0 { + return name + } + switch scheme { + case NoEscaping: + return name + case UnderscoreEscaping: + // It is not possible to unescape from underscore replacement. + return name + case DotsEscaping: + name = strings.ReplaceAll(name, "_dot_", ".") + name = strings.ReplaceAll(name, "__", "_") + return name + case ValueEncodingEscaping: + escapedName, found := strings.CutPrefix(name, "U__") + if !found { + return name + } + + var unescaped strings.Builder + TOP: + for i := 0; i < len(escapedName); i++ { + // All non-underscores are treated normally. + if escapedName[i] != '_' { + unescaped.WriteByte(escapedName[i]) + continue + } + i++ + if i >= len(escapedName) { + return name + } + // A double underscore is a single underscore. + if escapedName[i] == '_' { + unescaped.WriteByte('_') + continue + } + // We think we are in a UTF-8 code, process it. + var utf8Val uint + for j := 0; i < len(escapedName); j++ { + // This is too many characters for a utf8 value. + if j > 4 { + return name + } + // Found a closing underscore, convert to a rune, check validity, and append. + if escapedName[i] == '_' { + utf8Rune := rune(utf8Val) + if !utf8.ValidRune(utf8Rune) { + return name + } + unescaped.WriteRune(utf8Rune) + continue TOP + } + r := lower(escapedName[i]) + utf8Val *= 16 + if r >= '0' && r <= '9' { + utf8Val += uint(r) - '0' + } else if r >= 'a' && r <= 'f' { + utf8Val += uint(r) - 'a' + 10 + } else { + return name + } + i++ + } + // Didn't find closing underscore, invalid. + return name + } + return unescaped.String() + default: + panic(fmt.Sprintf("invalid escaping scheme %d", scheme)) + } +} + +func isValidLegacyRune(b rune, i int) bool { + return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || b == ':' || (b >= '0' && b <= '9' && i > 0) +} + +func (e EscapingScheme) String() string { + switch e { + case NoEscaping: + return AllowUTF8 + case UnderscoreEscaping: + return EscapeUnderscores + case DotsEscaping: + return EscapeDots + case ValueEncodingEscaping: + return EscapeValues + default: + panic(fmt.Sprintf("unknown format scheme %d", e)) + } +} + +func ToEscapingScheme(s string) (EscapingScheme, error) { + if s == "" { + return NoEscaping, fmt.Errorf("got empty string instead of escaping scheme") + } + switch s { + case AllowUTF8: + return NoEscaping, nil + case EscapeUnderscores: + return UnderscoreEscaping, nil + case EscapeDots: + return DotsEscaping, nil + case EscapeValues: + return ValueEncodingEscaping, nil + default: + return NoEscaping, fmt.Errorf("unknown format scheme " + s) + } +} diff --git a/vendor/github.com/prometheus/common/model/signature.go b/vendor/github.com/prometheus/common/model/signature.go index 8762b13c6..dc8a0026c 100644 --- a/vendor/github.com/prometheus/common/model/signature.go +++ b/vendor/github.com/prometheus/common/model/signature.go @@ -22,10 +22,8 @@ import ( // when calculating their combined hash value (aka signature aka fingerprint). const SeparatorByte byte = 255 -var ( - // cache the signature of an empty label set. - emptyLabelSignature = hashNew() -) +// cache the signature of an empty label set. +var emptyLabelSignature = hashNew() // LabelsToSignature returns a quasi-unique signature (i.e., fingerprint) for a // given label set. (Collisions are possible but unlikely if the number of label diff --git a/vendor/github.com/prometheus/common/model/silence.go b/vendor/github.com/prometheus/common/model/silence.go index bb99889d2..910b0b71f 100644 --- a/vendor/github.com/prometheus/common/model/silence.go +++ b/vendor/github.com/prometheus/common/model/silence.go @@ -81,7 +81,7 @@ func (s *Silence) Validate() error { } for _, m := range s.Matchers { if err := m.Validate(); err != nil { - return fmt.Errorf("invalid matcher: %s", err) + return fmt.Errorf("invalid matcher: %w", err) } } if s.StartsAt.IsZero() { diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go index 9eb440413..8050637d8 100644 --- a/vendor/github.com/prometheus/common/model/value.go +++ b/vendor/github.com/prometheus/common/model/value.go @@ -21,14 +21,12 @@ import ( "strings" ) -var ( - // ZeroSample is the pseudo zero-value of Sample used to signal a - // non-existing sample. It is a Sample with timestamp Earliest, value 0.0, - // and metric nil. Note that the natural zero value of Sample has a timestamp - // of 0, which is possible to appear in a real Sample and thus not suitable - // to signal a non-existing Sample. - ZeroSample = Sample{Timestamp: Earliest} -) +// ZeroSample is the pseudo zero-value of Sample used to signal a +// non-existing sample. It is a Sample with timestamp Earliest, value 0.0, +// and metric nil. Note that the natural zero value of Sample has a timestamp +// of 0, which is possible to appear in a real Sample and thus not suitable +// to signal a non-existing Sample. +var ZeroSample = Sample{Timestamp: Earliest} // Sample is a sample pair associated with a metric. A single sample must either // define Value or Histogram but not both. Histogram == nil implies the Value @@ -274,7 +272,7 @@ func (s *Scalar) UnmarshalJSON(b []byte) error { value, err := strconv.ParseFloat(f, 64) if err != nil { - return fmt.Errorf("error parsing sample value: %s", err) + return fmt.Errorf("error parsing sample value: %w", err) } s.Value = SampleValue(value) return nil diff --git a/vendor/github.com/prometheus/common/model/value_float.go b/vendor/github.com/prometheus/common/model/value_float.go index 0f615a705..ae35cc2ab 100644 --- a/vendor/github.com/prometheus/common/model/value_float.go +++ b/vendor/github.com/prometheus/common/model/value_float.go @@ -20,14 +20,12 @@ import ( "strconv" ) -var ( - // ZeroSamplePair is the pseudo zero-value of SamplePair used to signal a - // non-existing sample pair. It is a SamplePair with timestamp Earliest and - // value 0.0. Note that the natural zero value of SamplePair has a timestamp - // of 0, which is possible to appear in a real SamplePair and thus not - // suitable to signal a non-existing SamplePair. - ZeroSamplePair = SamplePair{Timestamp: Earliest} -) +// ZeroSamplePair is the pseudo zero-value of SamplePair used to signal a +// non-existing sample pair. It is a SamplePair with timestamp Earliest and +// value 0.0. Note that the natural zero value of SamplePair has a timestamp +// of 0, which is possible to appear in a real SamplePair and thus not +// suitable to signal a non-existing SamplePair. +var ZeroSamplePair = SamplePair{Timestamp: Earliest} // A SampleValue is a representation of a value for a given sample at a given // time. diff --git a/vendor/github.com/prometheus/procfs/.golangci.yml b/vendor/github.com/prometheus/procfs/.golangci.yml index c24864a92..126df9e67 100644 --- a/vendor/github.com/prometheus/procfs/.golangci.yml +++ b/vendor/github.com/prometheus/procfs/.golangci.yml @@ -1,9 +1,16 @@ --- linters: enable: + - errcheck - godot + - gosimple + - govet + - ineffassign - misspell - revive + - staticcheck + - testifylint + - unused linter-settings: godot: diff --git a/vendor/github.com/prometheus/procfs/MAINTAINERS.md b/vendor/github.com/prometheus/procfs/MAINTAINERS.md index 56ba67d3e..e00f3b365 100644 --- a/vendor/github.com/prometheus/procfs/MAINTAINERS.md +++ b/vendor/github.com/prometheus/procfs/MAINTAINERS.md @@ -1,2 +1,3 @@ * Johannes 'fish' Ziemke @discordianfish -* Paul Gier @pgier +* Paul Gier @pgier +* Ben Kochie @SuperQ diff --git a/vendor/github.com/prometheus/procfs/Makefile.common b/vendor/github.com/prometheus/procfs/Makefile.common index 062a28185..161729235 100644 --- a/vendor/github.com/prometheus/procfs/Makefile.common +++ b/vendor/github.com/prometheus/procfs/Makefile.common @@ -49,23 +49,23 @@ endif GOTEST := $(GO) test GOTEST_DIR := ifneq ($(CIRCLE_JOB),) -ifneq ($(shell command -v gotestsum > /dev/null),) +ifneq ($(shell command -v gotestsum 2> /dev/null),) GOTEST_DIR := test-results GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml -- endif endif -PROMU_VERSION ?= 0.15.0 +PROMU_VERSION ?= 0.17.0 PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.54.2 -# golangci-lint only supports linux, darwin and windows platforms on i386/amd64. +GOLANGCI_LINT_VERSION ?= v1.59.0 +# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) - ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386)) + ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386 arm64)) # If we're in CI and there is an Actions file, that means the linter # is being run in Actions, so we don't need to run it here. ifneq (,$(SKIP_GOLANGCI_LINT)) @@ -169,16 +169,20 @@ common-vet: common-lint: $(GOLANGCI_LINT) ifdef GOLANGCI_LINT @echo ">> running golangci-lint" -# 'go list' needs to be executed before staticcheck to prepopulate the modules cache. -# Otherwise staticcheck might fail randomly for some reason not yet explained. - $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs) endif +.PHONY: common-lint-fix +common-lint-fix: $(GOLANGCI_LINT) +ifdef GOLANGCI_LINT + @echo ">> running golangci-lint fix" + $(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_OPTS) $(pkgs) +endif + .PHONY: common-yamllint common-yamllint: @echo ">> running yamllint on all YAML files in the repository" -ifeq (, $(shell command -v yamllint > /dev/null)) +ifeq (, $(shell command -v yamllint 2> /dev/null)) @echo "yamllint not installed so skipping" else yamllint . @@ -204,6 +208,10 @@ common-tarball: promu @echo ">> building release tarball" $(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) +.PHONY: common-docker-repo-name +common-docker-repo-name: + @echo "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)" + .PHONY: common-docker $(BUILD_DOCKER_ARCHS) common-docker: $(BUILD_DOCKER_ARCHS) $(BUILD_DOCKER_ARCHS): common-docker-%: diff --git a/vendor/github.com/prometheus/procfs/arp.go b/vendor/github.com/prometheus/procfs/arp.go index 28783e2dd..cdcc8a7cc 100644 --- a/vendor/github.com/prometheus/procfs/arp.go +++ b/vendor/github.com/prometheus/procfs/arp.go @@ -55,7 +55,7 @@ type ARPEntry struct { func (fs FS) GatherARPEntries() ([]ARPEntry, error) { data, err := os.ReadFile(fs.proc.Path("net/arp")) if err != nil { - return nil, fmt.Errorf("%s: error reading arp %s: %w", ErrFileRead, fs.proc.Path("net/arp"), err) + return nil, fmt.Errorf("%w: error reading arp %s: %w", ErrFileRead, fs.proc.Path("net/arp"), err) } return parseARPEntries(data) @@ -78,11 +78,11 @@ func parseARPEntries(data []byte) ([]ARPEntry, error) { } else if width == expectedDataWidth { entry, err := parseARPEntry(columns) if err != nil { - return []ARPEntry{}, fmt.Errorf("%s: Failed to parse ARP entry: %v: %w", ErrFileParse, entry, err) + return []ARPEntry{}, fmt.Errorf("%w: Failed to parse ARP entry: %v: %w", ErrFileParse, entry, err) } entries = append(entries, entry) } else { - return []ARPEntry{}, fmt.Errorf("%s: %d columns found, but expected %d: %w", ErrFileParse, width, expectedDataWidth, err) + return []ARPEntry{}, fmt.Errorf("%w: %d columns found, but expected %d: %w", ErrFileParse, width, expectedDataWidth, err) } } diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go index 4a173636c..838075009 100644 --- a/vendor/github.com/prometheus/procfs/buddyinfo.go +++ b/vendor/github.com/prometheus/procfs/buddyinfo.go @@ -58,8 +58,8 @@ func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { return nil, fmt.Errorf("%w: Invalid number of fields, found: %v", ErrFileParse, parts) } - node := strings.TrimRight(parts[1], ",") - zone := strings.TrimRight(parts[3], ",") + node := strings.TrimSuffix(parts[1], ",") + zone := strings.TrimSuffix(parts[3], ",") arraySize := len(parts[4:]) if bucketCount == -1 { @@ -74,7 +74,7 @@ func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { for i := 0; i < arraySize; i++ { sizes[i], err = strconv.ParseFloat(parts[i+4], 64) if err != nil { - return nil, fmt.Errorf("%s: Invalid valid in buddyinfo: %f: %w", ErrFileParse, sizes[i], err) + return nil, fmt.Errorf("%w: Invalid valid in buddyinfo: %f: %w", ErrFileParse, sizes[i], err) } } diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go index f4f5501c6..f0950bb49 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo.go @@ -194,7 +194,7 @@ func parseCPUInfoARM(info []byte) ([]CPUInfo, error) { firstLine := firstNonEmptyLine(scanner) match, err := regexp.MatchString("^[Pp]rocessor", firstLine) if !match || !strings.Contains(firstLine, ":") { - return nil, fmt.Errorf("%s: Cannot parse line: %q: %w", ErrFileParse, firstLine, err) + return nil, fmt.Errorf("%w: Cannot parse line: %q: %w", ErrFileParse, firstLine, err) } field := strings.SplitN(firstLine, ": ", 2) @@ -386,7 +386,7 @@ func parseCPUInfoLoong(info []byte) ([]CPUInfo, error) { // find the first "processor" line firstLine := firstNonEmptyLine(scanner) if !strings.HasPrefix(firstLine, "system type") || !strings.Contains(firstLine, ":") { - return nil, errors.New("invalid cpuinfo file: " + firstLine) + return nil, fmt.Errorf("%w: %q", ErrFileParse, firstLine) } field := strings.SplitN(firstLine, ": ", 2) cpuinfo := []CPUInfo{} diff --git a/vendor/github.com/prometheus/procfs/crypto.go b/vendor/github.com/prometheus/procfs/crypto.go index 9a73e2639..5f2a37a78 100644 --- a/vendor/github.com/prometheus/procfs/crypto.go +++ b/vendor/github.com/prometheus/procfs/crypto.go @@ -55,13 +55,13 @@ func (fs FS) Crypto() ([]Crypto, error) { path := fs.proc.Path("crypto") b, err := util.ReadFileNoStat(path) if err != nil { - return nil, fmt.Errorf("%s: Cannot read file %v: %w", ErrFileRead, b, err) + return nil, fmt.Errorf("%w: Cannot read file %v: %w", ErrFileRead, b, err) } crypto, err := parseCrypto(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("%s: Cannot parse %v: %w", ErrFileParse, crypto, err) + return nil, fmt.Errorf("%w: Cannot parse %v: %w", ErrFileParse, crypto, err) } return crypto, nil @@ -84,7 +84,7 @@ func parseCrypto(r io.Reader) ([]Crypto, error) { kv := strings.Split(text, ":") if len(kv) != 2 { - return nil, fmt.Errorf("%w: Cannot parae line: %q", ErrFileParse, text) + return nil, fmt.Errorf("%w: Cannot parse line: %q", ErrFileParse, text) } k := strings.TrimSpace(kv[0]) diff --git a/vendor/github.com/prometheus/procfs/fscache.go b/vendor/github.com/prometheus/procfs/fscache.go index f560a8db3..cf2e3eaa0 100644 --- a/vendor/github.com/prometheus/procfs/fscache.go +++ b/vendor/github.com/prometheus/procfs/fscache.go @@ -236,7 +236,7 @@ func (fs FS) Fscacheinfo() (Fscacheinfo, error) { m, err := parseFscacheinfo(bytes.NewReader(b)) if err != nil { - return Fscacheinfo{}, fmt.Errorf("%s: Cannot parse %v: %w", ErrFileParse, m, err) + return Fscacheinfo{}, fmt.Errorf("%w: Cannot parse %v: %w", ErrFileParse, m, err) } return *m, nil @@ -245,7 +245,7 @@ func (fs FS) Fscacheinfo() (Fscacheinfo, error) { func setFSCacheFields(fields []string, setFields ...*uint64) error { var err error if len(fields) < len(setFields) { - return fmt.Errorf("%s: Expected %d, but got %d: %w", ErrFileParse, len(setFields), len(fields), err) + return fmt.Errorf("%w: Expected %d, but got %d: %w", ErrFileParse, len(setFields), len(fields), err) } for i := range setFields { diff --git a/vendor/github.com/prometheus/procfs/ipvs.go b/vendor/github.com/prometheus/procfs/ipvs.go index 5a145bbfe..bc3a20c93 100644 --- a/vendor/github.com/prometheus/procfs/ipvs.go +++ b/vendor/github.com/prometheus/procfs/ipvs.go @@ -221,16 +221,16 @@ func parseIPPort(s string) (net.IP, uint16, error) { case 46: ip = net.ParseIP(s[1:40]) if ip == nil { - return nil, 0, fmt.Errorf("%s: Invalid IPv6 addr %s: %w", ErrFileParse, s[1:40], err) + return nil, 0, fmt.Errorf("%w: Invalid IPv6 addr %s: %w", ErrFileParse, s[1:40], err) } default: - return nil, 0, fmt.Errorf("%s: Unexpected IP:Port %s: %w", ErrFileParse, s, err) + return nil, 0, fmt.Errorf("%w: Unexpected IP:Port %s: %w", ErrFileParse, s, err) } portString := s[len(s)-4:] if len(portString) != 4 { return nil, 0, - fmt.Errorf("%s: Unexpected port string format %s: %w", ErrFileParse, portString, err) + fmt.Errorf("%w: Unexpected port string format %s: %w", ErrFileParse, portString, err) } port, err := strconv.ParseUint(portString, 16, 16) if err != nil { diff --git a/vendor/github.com/prometheus/procfs/loadavg.go b/vendor/github.com/prometheus/procfs/loadavg.go index 59465c5bb..332e76c17 100644 --- a/vendor/github.com/prometheus/procfs/loadavg.go +++ b/vendor/github.com/prometheus/procfs/loadavg.go @@ -51,7 +51,7 @@ func parseLoad(loadavgBytes []byte) (*LoadAvg, error) { for i, load := range parts[0:3] { loads[i], err = strconv.ParseFloat(load, 64) if err != nil { - return nil, fmt.Errorf("%s: Cannot parse load: %f: %w", ErrFileParse, loads[i], err) + return nil, fmt.Errorf("%w: Cannot parse load: %f: %w", ErrFileParse, loads[i], err) } } return &LoadAvg{ diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go index fdd4b9544..67a9d2b44 100644 --- a/vendor/github.com/prometheus/procfs/mdstat.go +++ b/vendor/github.com/prometheus/procfs/mdstat.go @@ -23,7 +23,7 @@ import ( var ( statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[([U_]+)\]`) - recoveryLineBlocksRE = regexp.MustCompile(`\((\d+)/\d+\)`) + recoveryLineBlocksRE = regexp.MustCompile(`\((\d+/\d+)\)`) recoveryLinePctRE = regexp.MustCompile(`= (.+)%`) recoveryLineFinishRE = regexp.MustCompile(`finish=(.+)min`) recoveryLineSpeedRE = regexp.MustCompile(`speed=(.+)[A-Z]`) @@ -50,6 +50,8 @@ type MDStat struct { BlocksTotal int64 // Number of blocks on the device that are in sync. BlocksSynced int64 + // Number of blocks on the device that need to be synced. + BlocksToBeSynced int64 // progress percentage of current sync BlocksSyncedPct float64 // estimated finishing time for current sync (in minutes) @@ -70,7 +72,7 @@ func (fs FS) MDStat() ([]MDStat, error) { } mdstat, err := parseMDStat(data) if err != nil { - return nil, fmt.Errorf("%s: Cannot parse %v: %w", ErrFileParse, fs.proc.Path("mdstat"), err) + return nil, fmt.Errorf("%w: Cannot parse %v: %w", ErrFileParse, fs.proc.Path("mdstat"), err) } return mdstat, nil } @@ -90,7 +92,7 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { deviceFields := strings.Fields(line) if len(deviceFields) < 3 { - return nil, fmt.Errorf("%s: Expected 3+ lines, got %q", ErrFileParse, line) + return nil, fmt.Errorf("%w: Expected 3+ lines, got %q", ErrFileParse, line) } mdName := deviceFields[0] // mdx state := deviceFields[2] // active or inactive @@ -105,7 +107,7 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { active, total, down, size, err := evalStatusLine(lines[i], lines[i+1]) if err != nil { - return nil, fmt.Errorf("%s: Cannot parse md device lines: %v: %w", ErrFileParse, active, err) + return nil, fmt.Errorf("%w: Cannot parse md device lines: %v: %w", ErrFileParse, active, err) } syncLineIdx := i + 2 @@ -115,7 +117,8 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { // If device is syncing at the moment, get the number of currently // synced bytes, otherwise that number equals the size of the device. - syncedBlocks := size + blocksSynced := size + blocksToBeSynced := size speed := float64(0) finish := float64(0) pct := float64(0) @@ -136,11 +139,11 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { // Handle case when resync=PENDING or resync=DELAYED. if strings.Contains(lines[syncLineIdx], "PENDING") || strings.Contains(lines[syncLineIdx], "DELAYED") { - syncedBlocks = 0 + blocksSynced = 0 } else { - syncedBlocks, pct, finish, speed, err = evalRecoveryLine(lines[syncLineIdx]) + blocksSynced, blocksToBeSynced, pct, finish, speed, err = evalRecoveryLine(lines[syncLineIdx]) if err != nil { - return nil, fmt.Errorf("%s: Cannot parse sync line in md device: %q: %w", ErrFileParse, mdName, err) + return nil, fmt.Errorf("%w: Cannot parse sync line in md device: %q: %w", ErrFileParse, mdName, err) } } } @@ -154,7 +157,8 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { DisksSpare: spare, DisksTotal: total, BlocksTotal: size, - BlocksSynced: syncedBlocks, + BlocksSynced: blocksSynced, + BlocksToBeSynced: blocksToBeSynced, BlocksSyncedPct: pct, BlocksSyncedFinishTime: finish, BlocksSyncedSpeed: speed, @@ -168,13 +172,13 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { func evalStatusLine(deviceLine, statusLine string) (active, total, down, size int64, err error) { statusFields := strings.Fields(statusLine) if len(statusFields) < 1 { - return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected statusline %q: %w", ErrFileParse, statusLine, err) + return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected statusline %q: %w", ErrFileParse, statusLine, err) } sizeStr := statusFields[0] size, err = strconv.ParseInt(sizeStr, 10, 64) if err != nil { - return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected statusline %q: %w", ErrFileParse, statusLine, err) + return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected statusline %q: %w", ErrFileParse, statusLine, err) } if strings.Contains(deviceLine, "raid0") || strings.Contains(deviceLine, "linear") { @@ -189,65 +193,71 @@ func evalStatusLine(deviceLine, statusLine string) (active, total, down, size in matches := statusLineRE.FindStringSubmatch(statusLine) if len(matches) != 5 { - return 0, 0, 0, 0, fmt.Errorf("%s: Could not fild all substring matches %s: %w", ErrFileParse, statusLine, err) + return 0, 0, 0, 0, fmt.Errorf("%w: Could not fild all substring matches %s: %w", ErrFileParse, statusLine, err) } total, err = strconv.ParseInt(matches[2], 10, 64) if err != nil { - return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected statusline %q: %w", ErrFileParse, statusLine, err) + return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected statusline %q: %w", ErrFileParse, statusLine, err) } active, err = strconv.ParseInt(matches[3], 10, 64) if err != nil { - return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected active %d: %w", ErrFileParse, active, err) + return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected active %d: %w", ErrFileParse, active, err) } down = int64(strings.Count(matches[4], "_")) return active, total, down, size, nil } -func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, pct float64, finish float64, speed float64, err error) { +func evalRecoveryLine(recoveryLine string) (blocksSynced int64, blocksToBeSynced int64, pct float64, finish float64, speed float64, err error) { matches := recoveryLineBlocksRE.FindStringSubmatch(recoveryLine) if len(matches) != 2 { - return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected recoveryLine %s: %w", ErrFileParse, recoveryLine, err) + return 0, 0, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine blocks %s: %w", ErrFileParse, recoveryLine, err) } - syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64) + blocks := strings.Split(matches[1], "/") + blocksSynced, err = strconv.ParseInt(blocks[0], 10, 64) if err != nil { - return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected parsing of recoveryLine %q: %w", ErrFileParse, recoveryLine, err) + return 0, 0, 0, 0, 0, fmt.Errorf("%w: Unable to parse recovery blocks synced %q: %w", ErrFileParse, matches[1], err) + } + + blocksToBeSynced, err = strconv.ParseInt(blocks[1], 10, 64) + if err != nil { + return blocksSynced, 0, 0, 0, 0, fmt.Errorf("%w: Unable to parse recovery to be synced blocks %q: %w", ErrFileParse, matches[2], err) } // Get percentage complete matches = recoveryLinePctRE.FindStringSubmatch(recoveryLine) if len(matches) != 2 { - return syncedBlocks, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching percentage %s", ErrFileParse, recoveryLine) + return blocksSynced, blocksToBeSynced, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching percentage %s", ErrFileParse, recoveryLine) } pct, err = strconv.ParseFloat(strings.TrimSpace(matches[1]), 64) if err != nil { - return syncedBlocks, 0, 0, 0, fmt.Errorf("%w: Error parsing float from recoveryLine %q", ErrFileParse, recoveryLine) + return blocksSynced, blocksToBeSynced, 0, 0, 0, fmt.Errorf("%w: Error parsing float from recoveryLine %q", ErrFileParse, recoveryLine) } // Get time expected left to complete matches = recoveryLineFinishRE.FindStringSubmatch(recoveryLine) if len(matches) != 2 { - return syncedBlocks, pct, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching est. finish time: %s", ErrFileParse, recoveryLine) + return blocksSynced, blocksToBeSynced, pct, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching est. finish time: %s", ErrFileParse, recoveryLine) } finish, err = strconv.ParseFloat(matches[1], 64) if err != nil { - return syncedBlocks, pct, 0, 0, fmt.Errorf("%w: Unable to parse float from recoveryLine: %q", ErrFileParse, recoveryLine) + return blocksSynced, blocksToBeSynced, pct, 0, 0, fmt.Errorf("%w: Unable to parse float from recoveryLine: %q", ErrFileParse, recoveryLine) } // Get recovery speed matches = recoveryLineSpeedRE.FindStringSubmatch(recoveryLine) if len(matches) != 2 { - return syncedBlocks, pct, finish, 0, fmt.Errorf("%w: Unexpected recoveryLine value: %s", ErrFileParse, recoveryLine) + return blocksSynced, blocksToBeSynced, pct, finish, 0, fmt.Errorf("%w: Unexpected recoveryLine value: %s", ErrFileParse, recoveryLine) } speed, err = strconv.ParseFloat(matches[1], 64) if err != nil { - return syncedBlocks, pct, finish, 0, fmt.Errorf("%s: Error parsing float from recoveryLine: %q: %w", ErrFileParse, recoveryLine, err) + return blocksSynced, blocksToBeSynced, pct, finish, 0, fmt.Errorf("%w: Error parsing float from recoveryLine: %q: %w", ErrFileParse, recoveryLine, err) } - return syncedBlocks, pct, finish, speed, nil + return blocksSynced, blocksToBeSynced, pct, finish, speed, nil } func evalComponentDevices(deviceFields []string) []string { diff --git a/vendor/github.com/prometheus/procfs/meminfo.go b/vendor/github.com/prometheus/procfs/meminfo.go index eaf00e224..4b2c4050a 100644 --- a/vendor/github.com/prometheus/procfs/meminfo.go +++ b/vendor/github.com/prometheus/procfs/meminfo.go @@ -126,6 +126,7 @@ type Meminfo struct { VmallocUsed *uint64 // largest contiguous block of vmalloc area which is free VmallocChunk *uint64 + Percpu *uint64 HardwareCorrupted *uint64 AnonHugePages *uint64 ShmemHugePages *uint64 @@ -140,6 +141,55 @@ type Meminfo struct { DirectMap4k *uint64 DirectMap2M *uint64 DirectMap1G *uint64 + + // The struct fields below are the byte-normalized counterparts to the + // existing struct fields. Values are normalized using the optional + // unit field in the meminfo line. + MemTotalBytes *uint64 + MemFreeBytes *uint64 + MemAvailableBytes *uint64 + BuffersBytes *uint64 + CachedBytes *uint64 + SwapCachedBytes *uint64 + ActiveBytes *uint64 + InactiveBytes *uint64 + ActiveAnonBytes *uint64 + InactiveAnonBytes *uint64 + ActiveFileBytes *uint64 + InactiveFileBytes *uint64 + UnevictableBytes *uint64 + MlockedBytes *uint64 + SwapTotalBytes *uint64 + SwapFreeBytes *uint64 + DirtyBytes *uint64 + WritebackBytes *uint64 + AnonPagesBytes *uint64 + MappedBytes *uint64 + ShmemBytes *uint64 + SlabBytes *uint64 + SReclaimableBytes *uint64 + SUnreclaimBytes *uint64 + KernelStackBytes *uint64 + PageTablesBytes *uint64 + NFSUnstableBytes *uint64 + BounceBytes *uint64 + WritebackTmpBytes *uint64 + CommitLimitBytes *uint64 + CommittedASBytes *uint64 + VmallocTotalBytes *uint64 + VmallocUsedBytes *uint64 + VmallocChunkBytes *uint64 + PercpuBytes *uint64 + HardwareCorruptedBytes *uint64 + AnonHugePagesBytes *uint64 + ShmemHugePagesBytes *uint64 + ShmemPmdMappedBytes *uint64 + CmaTotalBytes *uint64 + CmaFreeBytes *uint64 + HugepagesizeBytes *uint64 + DirectMap4kBytes *uint64 + DirectMap2MBytes *uint64 + DirectMap1GBytes *uint64 } // Meminfo returns an information about current kernel/system memory statistics. @@ -152,7 +202,7 @@ func (fs FS) Meminfo() (Meminfo, error) { m, err := parseMemInfo(bytes.NewReader(b)) if err != nil { - return Meminfo{}, fmt.Errorf("%s: %w", ErrFileParse, err) + return Meminfo{}, fmt.Errorf("%w: %w", ErrFileParse, err) } return *m, nil @@ -162,114 +212,176 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { var m Meminfo s := bufio.NewScanner(r) for s.Scan() { - // Each line has at least a name and value; we ignore the unit. fields := strings.Fields(s.Text()) - if len(fields) < 2 { - return nil, fmt.Errorf("%w: Malformed line %q", ErrFileParse, s.Text()) - } + var val, valBytes uint64 - v, err := strconv.ParseUint(fields[1], 0, 64) + val, err := strconv.ParseUint(fields[1], 0, 64) if err != nil { return nil, err } + switch len(fields) { + case 2: + // No unit present, use the parsed the value as bytes directly. + valBytes = val + case 3: + // Unit present in optional 3rd field, convert it to + // bytes. The only unit supported within the Linux + // kernel is `kB`. + if fields[2] != "kB" { + return nil, fmt.Errorf("%w: Unsupported unit in optional 3rd field %q", ErrFileParse, fields[2]) + } + + valBytes = 1024 * val + + default: + return nil, fmt.Errorf("%w: Malformed line %q", ErrFileParse, s.Text()) + } + switch fields[0] { case "MemTotal:": - m.MemTotal = &v + m.MemTotal = &val + m.MemTotalBytes = &valBytes case "MemFree:": - m.MemFree = &v + m.MemFree = &val + m.MemFreeBytes = &valBytes case "MemAvailable:": - m.MemAvailable = &v + m.MemAvailable = &val + m.MemAvailableBytes = &valBytes case "Buffers:": - m.Buffers = &v + m.Buffers = &val + m.BuffersBytes = &valBytes case "Cached:": - m.Cached = &v + m.Cached = &val + m.CachedBytes = &valBytes case "SwapCached:": - m.SwapCached = &v + m.SwapCached = &val + m.SwapCachedBytes = &valBytes case "Active:": - m.Active = &v + m.Active = &val + m.ActiveBytes = &valBytes case "Inactive:": - m.Inactive = &v + m.Inactive = &val + m.InactiveBytes = &valBytes case "Active(anon):": - m.ActiveAnon = &v + m.ActiveAnon = &val + m.ActiveAnonBytes = &valBytes case "Inactive(anon):": - m.InactiveAnon = &v + m.InactiveAnon = &val + m.InactiveAnonBytes = &valBytes case "Active(file):": - m.ActiveFile = &v + m.ActiveFile = &val + m.ActiveFileBytes = &valBytes case "Inactive(file):": - m.InactiveFile = &v + m.InactiveFile = &val + m.InactiveFileBytes = &valBytes case "Unevictable:": - m.Unevictable = &v + m.Unevictable = &val + m.UnevictableBytes = &valBytes case "Mlocked:": - m.Mlocked = &v + m.Mlocked = &val + m.MlockedBytes = &valBytes case "SwapTotal:": - m.SwapTotal = &v + m.SwapTotal = &val + m.SwapTotalBytes = &valBytes case "SwapFree:": - m.SwapFree = &v + m.SwapFree = &val + m.SwapFreeBytes = &valBytes case "Dirty:": - m.Dirty = &v + m.Dirty = &val + m.DirtyBytes = &valBytes case "Writeback:": - m.Writeback = &v + m.Writeback = &val + m.WritebackBytes = &valBytes case "AnonPages:": - m.AnonPages = &v + m.AnonPages = &val + m.AnonPagesBytes = &valBytes case "Mapped:": - m.Mapped = &v + m.Mapped = &val + m.MappedBytes = &valBytes case "Shmem:": - m.Shmem = &v + m.Shmem = &val + m.ShmemBytes = &valBytes case "Slab:": - m.Slab = &v + m.Slab = &val + m.SlabBytes = &valBytes case "SReclaimable:": - m.SReclaimable = &v + m.SReclaimable = &val + m.SReclaimableBytes = &valBytes case "SUnreclaim:": - m.SUnreclaim = &v + m.SUnreclaim = &val + m.SUnreclaimBytes = &valBytes case "KernelStack:": - m.KernelStack = &v + m.KernelStack = &val + m.KernelStackBytes = &valBytes case "PageTables:": - m.PageTables = &v + m.PageTables = &val + m.PageTablesBytes = &valBytes case "NFS_Unstable:": - m.NFSUnstable = &v + m.NFSUnstable = &val + m.NFSUnstableBytes = &valBytes case "Bounce:": - m.Bounce = &v + m.Bounce = &val + m.BounceBytes = &valBytes case "WritebackTmp:": - m.WritebackTmp = &v + m.WritebackTmp = &val + m.WritebackTmpBytes = &valBytes case "CommitLimit:": - m.CommitLimit = &v + m.CommitLimit = &val + m.CommitLimitBytes = &valBytes case "Committed_AS:": - m.CommittedAS = &v + m.CommittedAS = &val + m.CommittedASBytes = &valBytes case "VmallocTotal:": - m.VmallocTotal = &v + m.VmallocTotal = &val + m.VmallocTotalBytes = &valBytes case "VmallocUsed:": - m.VmallocUsed = &v + m.VmallocUsed = &val + m.VmallocUsedBytes = &valBytes case "VmallocChunk:": - m.VmallocChunk = &v + m.VmallocChunk = &val + m.VmallocChunkBytes = &valBytes + case "Percpu:": + m.Percpu = &val + m.PercpuBytes = &valBytes case "HardwareCorrupted:": - m.HardwareCorrupted = &v + m.HardwareCorrupted = &val + m.HardwareCorruptedBytes = &valBytes case "AnonHugePages:": - m.AnonHugePages = &v + m.AnonHugePages = &val + m.AnonHugePagesBytes = &valBytes case "ShmemHugePages:": - m.ShmemHugePages = &v + m.ShmemHugePages = &val + m.ShmemHugePagesBytes = &valBytes case "ShmemPmdMapped:": - m.ShmemPmdMapped = &v + m.ShmemPmdMapped = &val + m.ShmemPmdMappedBytes = &valBytes case "CmaTotal:": - m.CmaTotal = &v + m.CmaTotal = &val + m.CmaTotalBytes = &valBytes case "CmaFree:": - m.CmaFree = &v + m.CmaFree = &val + m.CmaFreeBytes = &valBytes case "HugePages_Total:": - m.HugePagesTotal = &v + m.HugePagesTotal = &val case "HugePages_Free:": - m.HugePagesFree = &v + m.HugePagesFree = &val case "HugePages_Rsvd:": - m.HugePagesRsvd = &v + m.HugePagesRsvd = &val case "HugePages_Surp:": - m.HugePagesSurp = &v + m.HugePagesSurp = &val case "Hugepagesize:": - m.Hugepagesize = &v + m.Hugepagesize = &val + m.HugepagesizeBytes = &valBytes case "DirectMap4k:": - m.DirectMap4k = &v + m.DirectMap4k = &val + m.DirectMap4kBytes = &valBytes case "DirectMap2M:": - m.DirectMap2M = &v + m.DirectMap2M = &val + m.DirectMap2MBytes = &valBytes case "DirectMap1G:": - m.DirectMap1G = &v + m.DirectMap1G = &val + m.DirectMap1GBytes = &valBytes } } diff --git a/vendor/github.com/prometheus/procfs/mountinfo.go b/vendor/github.com/prometheus/procfs/mountinfo.go index 388ebf396..a704c5e73 100644 --- a/vendor/github.com/prometheus/procfs/mountinfo.go +++ b/vendor/github.com/prometheus/procfs/mountinfo.go @@ -109,7 +109,7 @@ func parseMountInfoString(mountString string) (*MountInfo, error) { if mountInfo[6] != "" { mount.OptionalFields, err = mountOptionsParseOptionalFields(mountInfo[6 : mountInfoLength-4]) if err != nil { - return nil, fmt.Errorf("%s: %w", ErrFileParse, err) + return nil, fmt.Errorf("%w: %w", ErrFileParse, err) } } return mount, nil diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go index 9d8af6db7..75a3b6c81 100644 --- a/vendor/github.com/prometheus/procfs/mountstats.go +++ b/vendor/github.com/prometheus/procfs/mountstats.go @@ -88,7 +88,7 @@ type MountStatsNFS struct { // Statistics broken down by filesystem operation. Operations []NFSOperationStats // Statistics about the NFS RPC transport. - Transport NFSTransportStats + Transport []NFSTransportStats } // mountStats implements MountStats. @@ -194,8 +194,6 @@ type NFSOperationStats struct { CumulativeTotalResponseMilliseconds uint64 // Duration from when a request was enqueued to when it was completely handled. CumulativeTotalRequestMilliseconds uint64 - // The average time from the point the client sends RPC requests until it receives the response. - AverageRTTMilliseconds float64 // The count of operations that complete with tk_status < 0. These statuses usually indicate error conditions. Errors uint64 } @@ -434,7 +432,7 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e return nil, err } - stats.Transport = *tstats + stats.Transport = append(stats.Transport, *tstats) } // When encountering "per-operation statistics", we must break this @@ -582,9 +580,6 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { CumulativeTotalResponseMilliseconds: ns[6], CumulativeTotalRequestMilliseconds: ns[7], } - if ns[0] != 0 { - opStats.AverageRTTMilliseconds = float64(ns[6]) / float64(ns[0]) - } if len(ns) > 8 { opStats.Errors = ns[8] @@ -632,7 +627,7 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats return nil, fmt.Errorf("%w: invalid NFS transport stats 1.1 statement: %v, protocol: %v", ErrFileParse, ss, protocol) } default: - return nil, fmt.Errorf("%s: Unrecognized NFS transport stats version: %q, protocol: %v", ErrFileParse, statVersion, protocol) + return nil, fmt.Errorf("%w: Unrecognized NFS transport stats version: %q, protocol: %v", ErrFileParse, statVersion, protocol) } // Allocate enough for v1.1 stats since zero value for v1.1 stats will be okay diff --git a/vendor/github.com/prometheus/procfs/net_conntrackstat.go b/vendor/github.com/prometheus/procfs/net_conntrackstat.go index fdfa45611..316df5fbb 100644 --- a/vendor/github.com/prometheus/procfs/net_conntrackstat.go +++ b/vendor/github.com/prometheus/procfs/net_conntrackstat.go @@ -58,7 +58,7 @@ func readConntrackStat(path string) ([]ConntrackStatEntry, error) { stat, err := parseConntrackStat(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("%s: Cannot read file: %v: %w", ErrFileRead, path, err) + return nil, fmt.Errorf("%w: Cannot read file: %v: %w", ErrFileRead, path, err) } return stat, nil @@ -86,7 +86,7 @@ func parseConntrackStat(r io.Reader) ([]ConntrackStatEntry, error) { func parseConntrackStatEntry(fields []string) (*ConntrackStatEntry, error) { entries, err := util.ParseHexUint64s(fields) if err != nil { - return nil, fmt.Errorf("%s: Cannot parse entry: %d: %w", ErrFileParse, entries, err) + return nil, fmt.Errorf("%w: Cannot parse entry: %d: %w", ErrFileParse, entries, err) } numEntries := len(entries) if numEntries < 16 || numEntries > 17 { diff --git a/vendor/github.com/prometheus/procfs/net_ip_socket.go b/vendor/github.com/prometheus/procfs/net_ip_socket.go index 4da81ea57..b70f1fc7a 100644 --- a/vendor/github.com/prometheus/procfs/net_ip_socket.go +++ b/vendor/github.com/prometheus/procfs/net_ip_socket.go @@ -50,10 +50,13 @@ type ( // UsedSockets shows the total number of parsed lines representing the // number of used sockets. UsedSockets uint64 + // Drops shows the total number of dropped packets of all UPD sockets. + Drops *uint64 } // netIPSocketLine represents the fields parsed from a single line // in /proc/net/{t,u}dp{,6}. Fields which are not used by IPSocket are skipped. + // Drops is non-nil for udp{,6}, but nil for tcp{,6}. // For the proc file format details, see https://linux.die.net/man/5/proc. netIPSocketLine struct { Sl uint64 @@ -66,6 +69,7 @@ type ( RxQueue uint64 UID uint64 Inode uint64 + Drops *uint64 } ) @@ -77,13 +81,14 @@ func newNetIPSocket(file string) (NetIPSocket, error) { defer f.Close() var netIPSocket NetIPSocket + isUDP := strings.Contains(file, "udp") lr := io.LimitReader(f, readLimit) s := bufio.NewScanner(lr) s.Scan() // skip first line with headers for s.Scan() { fields := strings.Fields(s.Text()) - line, err := parseNetIPSocketLine(fields) + line, err := parseNetIPSocketLine(fields, isUDP) if err != nil { return nil, err } @@ -104,19 +109,25 @@ func newNetIPSocketSummary(file string) (*NetIPSocketSummary, error) { defer f.Close() var netIPSocketSummary NetIPSocketSummary + var udpPacketDrops uint64 + isUDP := strings.Contains(file, "udp") lr := io.LimitReader(f, readLimit) s := bufio.NewScanner(lr) s.Scan() // skip first line with headers for s.Scan() { fields := strings.Fields(s.Text()) - line, err := parseNetIPSocketLine(fields) + line, err := parseNetIPSocketLine(fields, isUDP) if err != nil { return nil, err } netIPSocketSummary.TxQueueLength += line.TxQueue netIPSocketSummary.RxQueueLength += line.RxQueue netIPSocketSummary.UsedSockets++ + if isUDP { + udpPacketDrops += *line.Drops + netIPSocketSummary.Drops = &udpPacketDrops + } } if err := s.Err(); err != nil { return nil, err @@ -130,7 +141,7 @@ func parseIP(hexIP string) (net.IP, error) { var byteIP []byte byteIP, err := hex.DecodeString(hexIP) if err != nil { - return nil, fmt.Errorf("%s: Cannot parse socket field in %q: %w", ErrFileParse, hexIP, err) + return nil, fmt.Errorf("%w: Cannot parse socket field in %q: %w", ErrFileParse, hexIP, err) } switch len(byteIP) { case 4: @@ -144,12 +155,12 @@ func parseIP(hexIP string) (net.IP, error) { } return i, nil default: - return nil, fmt.Errorf("%s: Unable to parse IP %s: %w", ErrFileParse, hexIP, nil) + return nil, fmt.Errorf("%w: Unable to parse IP %s: %v", ErrFileParse, hexIP, nil) } } // parseNetIPSocketLine parses a single line, represented by a list of fields. -func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) { +func parseNetIPSocketLine(fields []string, isUDP bool) (*netIPSocketLine, error) { line := &netIPSocketLine{} if len(fields) < 10 { return nil, fmt.Errorf( @@ -167,7 +178,7 @@ func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) { } if line.Sl, err = strconv.ParseUint(s[0], 0, 64); err != nil { - return nil, fmt.Errorf("%s: Unable to parse sl field in %q: %w", ErrFileParse, line.Sl, err) + return nil, fmt.Errorf("%w: Unable to parse sl field in %q: %w", ErrFileParse, line.Sl, err) } // local_address l := strings.Split(fields[1], ":") @@ -178,7 +189,7 @@ func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) { return nil, err } if line.LocalPort, err = strconv.ParseUint(l[1], 16, 64); err != nil { - return nil, fmt.Errorf("%s: Unable to parse local_address port value line %q: %w", ErrFileParse, line.LocalPort, err) + return nil, fmt.Errorf("%w: Unable to parse local_address port value line %q: %w", ErrFileParse, line.LocalPort, err) } // remote_address @@ -190,12 +201,12 @@ func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) { return nil, err } if line.RemPort, err = strconv.ParseUint(r[1], 16, 64); err != nil { - return nil, fmt.Errorf("%s: Cannot parse rem_address port value in %q: %w", ErrFileParse, line.RemPort, err) + return nil, fmt.Errorf("%w: Cannot parse rem_address port value in %q: %w", ErrFileParse, line.RemPort, err) } // st if line.St, err = strconv.ParseUint(fields[3], 16, 64); err != nil { - return nil, fmt.Errorf("%s: Cannot parse st value in %q: %w", ErrFileParse, line.St, err) + return nil, fmt.Errorf("%w: Cannot parse st value in %q: %w", ErrFileParse, line.St, err) } // tx_queue and rx_queue @@ -208,20 +219,29 @@ func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) { ) } if line.TxQueue, err = strconv.ParseUint(q[0], 16, 64); err != nil { - return nil, fmt.Errorf("%s: Cannot parse tx_queue value in %q: %w", ErrFileParse, line.TxQueue, err) + return nil, fmt.Errorf("%w: Cannot parse tx_queue value in %q: %w", ErrFileParse, line.TxQueue, err) } if line.RxQueue, err = strconv.ParseUint(q[1], 16, 64); err != nil { - return nil, fmt.Errorf("%s: Cannot parse trx_queue value in %q: %w", ErrFileParse, line.RxQueue, err) + return nil, fmt.Errorf("%w: Cannot parse trx_queue value in %q: %w", ErrFileParse, line.RxQueue, err) } // uid if line.UID, err = strconv.ParseUint(fields[7], 0, 64); err != nil { - return nil, fmt.Errorf("%s: Cannot parse UID value in %q: %w", ErrFileParse, line.UID, err) + return nil, fmt.Errorf("%w: Cannot parse UID value in %q: %w", ErrFileParse, line.UID, err) } // inode if line.Inode, err = strconv.ParseUint(fields[9], 0, 64); err != nil { - return nil, fmt.Errorf("%s: Cannot parse inode value in %q: %w", ErrFileParse, line.Inode, err) + return nil, fmt.Errorf("%w: Cannot parse inode value in %q: %w", ErrFileParse, line.Inode, err) + } + + // drops + if isUDP { + drops, err := strconv.ParseUint(fields[12], 0, 64) + if err != nil { + return nil, fmt.Errorf("%w: Cannot parse drops value in %q: %w", ErrFileParse, drops, err) + } + line.Drops = &drops } return line, nil diff --git a/vendor/github.com/prometheus/procfs/net_sockstat.go b/vendor/github.com/prometheus/procfs/net_sockstat.go index 360e36af7..fae62b13d 100644 --- a/vendor/github.com/prometheus/procfs/net_sockstat.go +++ b/vendor/github.com/prometheus/procfs/net_sockstat.go @@ -69,7 +69,7 @@ func readSockstat(name string) (*NetSockstat, error) { stat, err := parseSockstat(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("%s: sockstats from %q: %w", ErrFileRead, name, err) + return nil, fmt.Errorf("%w: sockstats from %q: %w", ErrFileRead, name, err) } return stat, nil @@ -89,7 +89,7 @@ func parseSockstat(r io.Reader) (*NetSockstat, error) { // The remaining fields are key/value pairs. kvs, err := parseSockstatKVs(fields[1:]) if err != nil { - return nil, fmt.Errorf("%s: sockstat key/value pairs from %q: %w", ErrFileParse, s.Text(), err) + return nil, fmt.Errorf("%w: sockstat key/value pairs from %q: %w", ErrFileParse, s.Text(), err) } // The first field is the protocol. We must trim its colon suffix. diff --git a/vendor/github.com/prometheus/procfs/net_softnet.go b/vendor/github.com/prometheus/procfs/net_softnet.go index c77085291..71c8059f4 100644 --- a/vendor/github.com/prometheus/procfs/net_softnet.go +++ b/vendor/github.com/prometheus/procfs/net_softnet.go @@ -64,7 +64,7 @@ func (fs FS) NetSoftnetStat() ([]SoftnetStat, error) { entries, err := parseSoftnet(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("%s: /proc/net/softnet_stat: %w", ErrFileParse, err) + return nil, fmt.Errorf("%w: /proc/net/softnet_stat: %w", ErrFileParse, err) } return entries, nil diff --git a/vendor/github.com/prometheus/procfs/net_tls_stat.go b/vendor/github.com/prometheus/procfs/net_tls_stat.go new file mode 100644 index 000000000..13994c178 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/net_tls_stat.go @@ -0,0 +1,119 @@ +// Copyright 2023 Prometheus Team +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "fmt" + "os" + "strconv" + "strings" +) + +// TLSStat struct represents data in /proc/net/tls_stat. +// See https://docs.kernel.org/networking/tls.html#statistics +type TLSStat struct { + // number of TX sessions currently installed where host handles cryptography + TLSCurrTxSw int + // number of RX sessions currently installed where host handles cryptography + TLSCurrRxSw int + // number of TX sessions currently installed where NIC handles cryptography + TLSCurrTxDevice int + // number of RX sessions currently installed where NIC handles cryptography + TLSCurrRxDevice int + //number of TX sessions opened with host cryptography + TLSTxSw int + //number of RX sessions opened with host cryptography + TLSRxSw int + // number of TX sessions opened with NIC cryptography + TLSTxDevice int + // number of RX sessions opened with NIC cryptography + TLSRxDevice int + // record decryption failed (e.g. due to incorrect authentication tag) + TLSDecryptError int + // number of RX resyncs sent to NICs handling cryptography + TLSRxDeviceResync int + // number of RX records which had to be re-decrypted due to TLS_RX_EXPECT_NO_PAD mis-prediction. Note that this counter will also increment for non-data records. + TLSDecryptRetry int + // number of data RX records which had to be re-decrypted due to TLS_RX_EXPECT_NO_PAD mis-prediction. + TLSRxNoPadViolation int +} + +// NewTLSStat reads the tls_stat statistics. +func NewTLSStat() (TLSStat, error) { + fs, err := NewFS(DefaultMountPoint) + if err != nil { + return TLSStat{}, err + } + + return fs.NewTLSStat() +} + +// NewTLSStat reads the tls_stat statistics. +func (fs FS) NewTLSStat() (TLSStat, error) { + file, err := os.Open(fs.proc.Path("net/tls_stat")) + if err != nil { + return TLSStat{}, err + } + defer file.Close() + + var ( + tlsstat = TLSStat{} + s = bufio.NewScanner(file) + ) + + for s.Scan() { + fields := strings.Fields(s.Text()) + + if len(fields) != 2 { + return TLSStat{}, fmt.Errorf("%w: %q line %q", ErrFileParse, file.Name(), s.Text()) + } + + name := fields[0] + value, err := strconv.Atoi(fields[1]) + if err != nil { + return TLSStat{}, err + } + + switch name { + case "TlsCurrTxSw": + tlsstat.TLSCurrTxSw = value + case "TlsCurrRxSw": + tlsstat.TLSCurrRxSw = value + case "TlsCurrTxDevice": + tlsstat.TLSCurrTxDevice = value + case "TlsCurrRxDevice": + tlsstat.TLSCurrRxDevice = value + case "TlsTxSw": + tlsstat.TLSTxSw = value + case "TlsRxSw": + tlsstat.TLSRxSw = value + case "TlsTxDevice": + tlsstat.TLSTxDevice = value + case "TlsRxDevice": + tlsstat.TLSRxDevice = value + case "TlsDecryptError": + tlsstat.TLSDecryptError = value + case "TlsRxDeviceResync": + tlsstat.TLSRxDeviceResync = value + case "TlsDecryptRetry": + tlsstat.TLSDecryptRetry = value + case "TlsRxNoPadViolation": + tlsstat.TLSRxNoPadViolation = value + } + + } + + return tlsstat, s.Err() +} diff --git a/vendor/github.com/prometheus/procfs/net_unix.go b/vendor/github.com/prometheus/procfs/net_unix.go index acbbc57ea..d868cebda 100644 --- a/vendor/github.com/prometheus/procfs/net_unix.go +++ b/vendor/github.com/prometheus/procfs/net_unix.go @@ -108,14 +108,14 @@ func parseNetUNIX(r io.Reader) (*NetUNIX, error) { line := s.Text() item, err := nu.parseLine(line, hasInode, minFields) if err != nil { - return nil, fmt.Errorf("%s: /proc/net/unix encountered data %q: %w", ErrFileParse, line, err) + return nil, fmt.Errorf("%w: /proc/net/unix encountered data %q: %w", ErrFileParse, line, err) } nu.Rows = append(nu.Rows, item) } if err := s.Err(); err != nil { - return nil, fmt.Errorf("%s: /proc/net/unix encountered data: %w", ErrFileParse, err) + return nil, fmt.Errorf("%w: /proc/net/unix encountered data: %w", ErrFileParse, err) } return &nu, nil @@ -136,29 +136,29 @@ func (u *NetUNIX) parseLine(line string, hasInode bool, min int) (*NetUNIXLine, users, err := u.parseUsers(fields[1]) if err != nil { - return nil, fmt.Errorf("%s: ref count %q: %w", ErrFileParse, fields[1], err) + return nil, fmt.Errorf("%w: ref count %q: %w", ErrFileParse, fields[1], err) } flags, err := u.parseFlags(fields[3]) if err != nil { - return nil, fmt.Errorf("%s: Unable to parse flags %q: %w", ErrFileParse, fields[3], err) + return nil, fmt.Errorf("%w: Unable to parse flags %q: %w", ErrFileParse, fields[3], err) } typ, err := u.parseType(fields[4]) if err != nil { - return nil, fmt.Errorf("%s: Failed to parse type %q: %w", ErrFileParse, fields[4], err) + return nil, fmt.Errorf("%w: Failed to parse type %q: %w", ErrFileParse, fields[4], err) } state, err := u.parseState(fields[5]) if err != nil { - return nil, fmt.Errorf("%s: Failed to parse state %q: %w", ErrFileParse, fields[5], err) + return nil, fmt.Errorf("%w: Failed to parse state %q: %w", ErrFileParse, fields[5], err) } var inode uint64 if hasInode { inode, err = u.parseInode(fields[6]) if err != nil { - return nil, fmt.Errorf("%s failed to parse inode %q: %w", ErrFileParse, fields[6], err) + return nil, fmt.Errorf("%w failed to parse inode %q: %w", ErrFileParse, fields[6], err) } } diff --git a/vendor/github.com/prometheus/procfs/net_wireless.go b/vendor/github.com/prometheus/procfs/net_wireless.go index 7443edca9..7c597bc87 100644 --- a/vendor/github.com/prometheus/procfs/net_wireless.go +++ b/vendor/github.com/prometheus/procfs/net_wireless.go @@ -68,7 +68,7 @@ func (fs FS) Wireless() ([]*Wireless, error) { m, err := parseWireless(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("%s: wireless: %w", ErrFileParse, err) + return nil, fmt.Errorf("%w: wireless: %w", ErrFileParse, err) } return m, nil @@ -114,47 +114,47 @@ func parseWireless(r io.Reader) ([]*Wireless, error) { qlink, err := strconv.Atoi(strings.TrimSuffix(stats[1], ".")) if err != nil { - return nil, fmt.Errorf("%s: parse Quality:link as integer %q: %w", ErrFileParse, qlink, err) + return nil, fmt.Errorf("%w: parse Quality:link as integer %q: %w", ErrFileParse, qlink, err) } qlevel, err := strconv.Atoi(strings.TrimSuffix(stats[2], ".")) if err != nil { - return nil, fmt.Errorf("%s: Quality:level as integer %q: %w", ErrFileParse, qlevel, err) + return nil, fmt.Errorf("%w: Quality:level as integer %q: %w", ErrFileParse, qlevel, err) } qnoise, err := strconv.Atoi(strings.TrimSuffix(stats[3], ".")) if err != nil { - return nil, fmt.Errorf("%s: Quality:noise as integer %q: %w", ErrFileParse, qnoise, err) + return nil, fmt.Errorf("%w: Quality:noise as integer %q: %w", ErrFileParse, qnoise, err) } dnwid, err := strconv.Atoi(stats[4]) if err != nil { - return nil, fmt.Errorf("%s: Discarded:nwid as integer %q: %w", ErrFileParse, dnwid, err) + return nil, fmt.Errorf("%w: Discarded:nwid as integer %q: %w", ErrFileParse, dnwid, err) } dcrypt, err := strconv.Atoi(stats[5]) if err != nil { - return nil, fmt.Errorf("%s: Discarded:crypt as integer %q: %w", ErrFileParse, dcrypt, err) + return nil, fmt.Errorf("%w: Discarded:crypt as integer %q: %w", ErrFileParse, dcrypt, err) } dfrag, err := strconv.Atoi(stats[6]) if err != nil { - return nil, fmt.Errorf("%s: Discarded:frag as integer %q: %w", ErrFileParse, dfrag, err) + return nil, fmt.Errorf("%w: Discarded:frag as integer %q: %w", ErrFileParse, dfrag, err) } dretry, err := strconv.Atoi(stats[7]) if err != nil { - return nil, fmt.Errorf("%s: Discarded:retry as integer %q: %w", ErrFileParse, dretry, err) + return nil, fmt.Errorf("%w: Discarded:retry as integer %q: %w", ErrFileParse, dretry, err) } dmisc, err := strconv.Atoi(stats[8]) if err != nil { - return nil, fmt.Errorf("%s: Discarded:misc as integer %q: %w", ErrFileParse, dmisc, err) + return nil, fmt.Errorf("%w: Discarded:misc as integer %q: %w", ErrFileParse, dmisc, err) } mbeacon, err := strconv.Atoi(stats[9]) if err != nil { - return nil, fmt.Errorf("%s: Missed:beacon as integer %q: %w", ErrFileParse, mbeacon, err) + return nil, fmt.Errorf("%w: Missed:beacon as integer %q: %w", ErrFileParse, mbeacon, err) } w := &Wireless{ @@ -175,7 +175,7 @@ func parseWireless(r io.Reader) ([]*Wireless, error) { } if err := scanner.Err(); err != nil { - return nil, fmt.Errorf("%s: Failed to scan /proc/net/wireless: %w", ErrFileRead, err) + return nil, fmt.Errorf("%w: Failed to scan /proc/net/wireless: %w", ErrFileRead, err) } return interfaces, nil diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go index d1f71caa5..142796368 100644 --- a/vendor/github.com/prometheus/procfs/proc.go +++ b/vendor/github.com/prometheus/procfs/proc.go @@ -111,7 +111,7 @@ func (fs FS) AllProcs() (Procs, error) { names, err := d.Readdirnames(-1) if err != nil { - return Procs{}, fmt.Errorf("%s: Cannot read file: %v: %w", ErrFileRead, names, err) + return Procs{}, fmt.Errorf("%w: Cannot read file: %v: %w", ErrFileRead, names, err) } p := Procs{} @@ -137,7 +137,7 @@ func (p Proc) CmdLine() ([]string, error) { return []string{}, nil } - return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil + return strings.Split(string(bytes.TrimRight(data, "\x00")), "\x00"), nil } // Wchan returns the wchan (wait channel) of a process. @@ -212,7 +212,7 @@ func (p Proc) FileDescriptors() ([]uintptr, error) { for i, n := range names { fd, err := strconv.ParseInt(n, 10, 32) if err != nil { - return nil, fmt.Errorf("%s: Cannot parse line: %v: %w", ErrFileParse, i, err) + return nil, fmt.Errorf("%w: Cannot parse line: %v: %w", ErrFileParse, i, err) } fds[i] = uintptr(fd) } @@ -297,7 +297,7 @@ func (p Proc) fileDescriptors() ([]string, error) { names, err := d.Readdirnames(-1) if err != nil { - return nil, fmt.Errorf("%s: Cannot read file: %v: %w", ErrFileRead, names, err) + return nil, fmt.Errorf("%w: Cannot read file: %v: %w", ErrFileRead, names, err) } return names, nil diff --git a/vendor/github.com/prometheus/procfs/proc_limits.go b/vendor/github.com/prometheus/procfs/proc_limits.go index c86d815d7..9530b14bc 100644 --- a/vendor/github.com/prometheus/procfs/proc_limits.go +++ b/vendor/github.com/prometheus/procfs/proc_limits.go @@ -154,7 +154,7 @@ func parseUint(s string) (uint64, error) { } i, err := strconv.ParseUint(s, 10, 64) if err != nil { - return 0, fmt.Errorf("%s: couldn't parse value %q: %w", ErrFileParse, s, err) + return 0, fmt.Errorf("%w: couldn't parse value %q: %w", ErrFileParse, s, err) } return i, nil } diff --git a/vendor/github.com/prometheus/procfs/proc_ns.go b/vendor/github.com/prometheus/procfs/proc_ns.go index c22666750..0f8f847f9 100644 --- a/vendor/github.com/prometheus/procfs/proc_ns.go +++ b/vendor/github.com/prometheus/procfs/proc_ns.go @@ -40,7 +40,7 @@ func (p Proc) Namespaces() (Namespaces, error) { names, err := d.Readdirnames(-1) if err != nil { - return nil, fmt.Errorf("%s: failed to read contents of ns dir: %w", ErrFileRead, err) + return nil, fmt.Errorf("%w: failed to read contents of ns dir: %w", ErrFileRead, err) } ns := make(Namespaces, len(names)) @@ -58,7 +58,7 @@ func (p Proc) Namespaces() (Namespaces, error) { typ := fields[0] inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32) if err != nil { - return nil, fmt.Errorf("%s: inode from %q: %w", ErrFileParse, fields[1], err) + return nil, fmt.Errorf("%w: inode from %q: %w", ErrFileParse, fields[1], err) } ns[name] = Namespace{typ, uint32(inode)} diff --git a/vendor/github.com/prometheus/procfs/proc_psi.go b/vendor/github.com/prometheus/procfs/proc_psi.go index fe9dbb425..ccd35f153 100644 --- a/vendor/github.com/prometheus/procfs/proc_psi.go +++ b/vendor/github.com/prometheus/procfs/proc_psi.go @@ -61,7 +61,7 @@ type PSIStats struct { func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) { data, err := util.ReadFileNoStat(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource))) if err != nil { - return PSIStats{}, fmt.Errorf("%s: psi_stats: unavailable for %q: %w", ErrFileRead, resource, err) + return PSIStats{}, fmt.Errorf("%w: psi_stats: unavailable for %q: %w", ErrFileRead, resource, err) } return parsePSIStats(bytes.NewReader(data)) diff --git a/vendor/github.com/prometheus/procfs/proc_smaps.go b/vendor/github.com/prometheus/procfs/proc_smaps.go index ad8785a40..09060e820 100644 --- a/vendor/github.com/prometheus/procfs/proc_smaps.go +++ b/vendor/github.com/prometheus/procfs/proc_smaps.go @@ -127,7 +127,7 @@ func (s *ProcSMapsRollup) parseLine(line string) error { } v := strings.TrimSpace(kv[1]) - v = strings.TrimRight(v, " kB") + v = strings.TrimSuffix(v, " kB") vKBytes, err := strconv.ParseUint(v, 10, 64) if err != nil { diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go index 923e55005..06a8d931c 100644 --- a/vendor/github.com/prometheus/procfs/proc_stat.go +++ b/vendor/github.com/prometheus/procfs/proc_stat.go @@ -110,6 +110,11 @@ type ProcStat struct { Policy uint // Aggregated block I/O delays, measured in clock ticks (centiseconds). DelayAcctBlkIOTicks uint64 + // Guest time of the process (time spent running a virtual CPU for a guest + // operating system), measured in clock ticks. + GuestTime int + // Guest time of the process's children, measured in clock ticks. + CGuestTime int proc FS } @@ -189,6 +194,8 @@ func (p Proc) Stat() (ProcStat, error) { &s.RTPriority, &s.Policy, &s.DelayAcctBlkIOTicks, + &s.GuestTime, + &s.CGuestTime, ) if err != nil { return ProcStat{}, err diff --git a/vendor/github.com/prometheus/procfs/proc_status.go b/vendor/github.com/prometheus/procfs/proc_status.go index 46307f572..a055197c6 100644 --- a/vendor/github.com/prometheus/procfs/proc_status.go +++ b/vendor/github.com/prometheus/procfs/proc_status.go @@ -15,6 +15,7 @@ package procfs import ( "bytes" + "math/bits" "sort" "strconv" "strings" @@ -76,9 +77,9 @@ type ProcStatus struct { NonVoluntaryCtxtSwitches uint64 // UIDs of the process (Real, effective, saved set, and filesystem UIDs) - UIDs [4]string + UIDs [4]uint64 // GIDs of the process (Real, effective, saved set, and filesystem GIDs) - GIDs [4]string + GIDs [4]uint64 // CpusAllowedList: List of cpu cores processes are allowed to run on. CpusAllowedList []uint64 @@ -113,22 +114,37 @@ func (p Proc) NewStatus() (ProcStatus, error) { // convert kB to B vBytes := vKBytes * 1024 - s.fillStatus(k, v, vKBytes, vBytes) + err = s.fillStatus(k, v, vKBytes, vBytes) + if err != nil { + return ProcStatus{}, err + } } return s, nil } -func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) { +func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) error { switch k { case "Tgid": s.TGID = int(vUint) case "Name": s.Name = vString case "Uid": - copy(s.UIDs[:], strings.Split(vString, "\t")) + var err error + for i, v := range strings.Split(vString, "\t") { + s.UIDs[i], err = strconv.ParseUint(v, 10, bits.UintSize) + if err != nil { + return err + } + } case "Gid": - copy(s.GIDs[:], strings.Split(vString, "\t")) + var err error + for i, v := range strings.Split(vString, "\t") { + s.GIDs[i], err = strconv.ParseUint(v, 10, bits.UintSize) + if err != nil { + return err + } + } case "NSpid": s.NSpids = calcNSPidsList(vString) case "VmPeak": @@ -173,6 +189,7 @@ func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintByt s.CpusAllowedList = calcCpusAllowedList(vString) } + return nil } // TotalCtxtSwitches returns the total context switch. diff --git a/vendor/github.com/prometheus/procfs/proc_sys.go b/vendor/github.com/prometheus/procfs/proc_sys.go index 12c5bf05b..5eefbe2ef 100644 --- a/vendor/github.com/prometheus/procfs/proc_sys.go +++ b/vendor/github.com/prometheus/procfs/proc_sys.go @@ -44,7 +44,7 @@ func (fs FS) SysctlInts(sysctl string) ([]int, error) { vp := util.NewValueParser(f) values[i] = vp.Int() if err := vp.Err(); err != nil { - return nil, fmt.Errorf("%s: field %d in sysctl %s is not a valid int: %w", ErrFileParse, i, sysctl, err) + return nil, fmt.Errorf("%w: field %d in sysctl %s is not a valid int: %w", ErrFileParse, i, sysctl, err) } } return values, nil diff --git a/vendor/github.com/prometheus/procfs/softirqs.go b/vendor/github.com/prometheus/procfs/softirqs.go index b8fad677d..28708e074 100644 --- a/vendor/github.com/prometheus/procfs/softirqs.go +++ b/vendor/github.com/prometheus/procfs/softirqs.go @@ -74,7 +74,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.Hi = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.Hi[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (HI%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (HI%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "TIMER:": @@ -82,7 +82,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.Timer = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.Timer[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (TIMER%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (TIMER%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "NET_TX:": @@ -90,7 +90,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.NetTx = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.NetTx[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (NET_TX%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (NET_TX%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "NET_RX:": @@ -98,7 +98,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.NetRx = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.NetRx[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (NET_RX%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (NET_RX%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "BLOCK:": @@ -106,7 +106,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.Block = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.Block[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (BLOCK%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (BLOCK%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "IRQ_POLL:": @@ -114,7 +114,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.IRQPoll = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.IRQPoll[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (IRQ_POLL%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (IRQ_POLL%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "TASKLET:": @@ -122,7 +122,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.Tasklet = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.Tasklet[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (TASKLET%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (TASKLET%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "SCHED:": @@ -130,7 +130,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.Sched = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.Sched[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (SCHED%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (SCHED%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "HRTIMER:": @@ -138,7 +138,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.HRTimer = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.HRTimer[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (HRTIMER%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (HRTIMER%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "RCU:": @@ -146,14 +146,14 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { softirqs.RCU = make([]uint64, len(perCPU)) for i, count := range perCPU { if softirqs.RCU[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (RCU%d): %w", ErrFileParse, count, i, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (RCU%d): %w", ErrFileParse, count, i, err) } } } } if err := scanner.Err(); err != nil { - return Softirqs{}, fmt.Errorf("%s: couldn't parse softirqs: %w", ErrFileParse, err) + return Softirqs{}, fmt.Errorf("%w: couldn't parse softirqs: %w", ErrFileParse, err) } return softirqs, scanner.Err() diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go index 34fc3ee21..e36b41c18 100644 --- a/vendor/github.com/prometheus/procfs/stat.go +++ b/vendor/github.com/prometheus/procfs/stat.go @@ -93,7 +93,7 @@ func parseCPUStat(line string) (CPUStat, int64, error) { &cpuStat.Guest, &cpuStat.GuestNice) if err != nil && err != io.EOF { - return CPUStat{}, -1, fmt.Errorf("%s: couldn't parse %q (cpu): %w", ErrFileParse, line, err) + return CPUStat{}, -1, fmt.Errorf("%w: couldn't parse %q (cpu): %w", ErrFileParse, line, err) } if count == 0 { return CPUStat{}, -1, fmt.Errorf("%w: couldn't parse %q (cpu): 0 elements parsed", ErrFileParse, line) @@ -116,7 +116,7 @@ func parseCPUStat(line string) (CPUStat, int64, error) { cpuID, err := strconv.ParseInt(cpu[3:], 10, 64) if err != nil { - return CPUStat{}, -1, fmt.Errorf("%s: couldn't parse %q (cpu/cpuid): %w", ErrFileParse, line, err) + return CPUStat{}, -1, fmt.Errorf("%w: couldn't parse %q (cpu/cpuid): %w", ErrFileParse, line, err) } return cpuStat, cpuID, nil @@ -136,7 +136,7 @@ func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) { &softIRQStat.Hrtimer, &softIRQStat.Rcu) if err != nil { - return SoftIRQStat{}, 0, fmt.Errorf("%s: couldn't parse %q (softirq): %w", ErrFileParse, line, err) + return SoftIRQStat{}, 0, fmt.Errorf("%w: couldn't parse %q (softirq): %w", ErrFileParse, line, err) } return softIRQStat, total, nil @@ -201,34 +201,34 @@ func parseStat(r io.Reader, fileName string) (Stat, error) { switch { case parts[0] == "btime": if stat.BootTime, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("%s: couldn't parse %q (btime): %w", ErrFileParse, parts[1], err) + return Stat{}, fmt.Errorf("%w: couldn't parse %q (btime): %w", ErrFileParse, parts[1], err) } case parts[0] == "intr": if stat.IRQTotal, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("%s: couldn't parse %q (intr): %w", ErrFileParse, parts[1], err) + return Stat{}, fmt.Errorf("%w: couldn't parse %q (intr): %w", ErrFileParse, parts[1], err) } numberedIRQs := parts[2:] stat.IRQ = make([]uint64, len(numberedIRQs)) for i, count := range numberedIRQs { if stat.IRQ[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Stat{}, fmt.Errorf("%s: couldn't parse %q (intr%d): %w", ErrFileParse, count, i, err) + return Stat{}, fmt.Errorf("%w: couldn't parse %q (intr%d): %w", ErrFileParse, count, i, err) } } case parts[0] == "ctxt": if stat.ContextSwitches, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("%s: couldn't parse %q (ctxt): %w", ErrFileParse, parts[1], err) + return Stat{}, fmt.Errorf("%w: couldn't parse %q (ctxt): %w", ErrFileParse, parts[1], err) } case parts[0] == "processes": if stat.ProcessCreated, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("%s: couldn't parse %q (processes): %w", ErrFileParse, parts[1], err) + return Stat{}, fmt.Errorf("%w: couldn't parse %q (processes): %w", ErrFileParse, parts[1], err) } case parts[0] == "procs_running": if stat.ProcessesRunning, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("%s: couldn't parse %q (procs_running): %w", ErrFileParse, parts[1], err) + return Stat{}, fmt.Errorf("%w: couldn't parse %q (procs_running): %w", ErrFileParse, parts[1], err) } case parts[0] == "procs_blocked": if stat.ProcessesBlocked, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("%s: couldn't parse %q (procs_blocked): %w", ErrFileParse, parts[1], err) + return Stat{}, fmt.Errorf("%w: couldn't parse %q (procs_blocked): %w", ErrFileParse, parts[1], err) } case parts[0] == "softirq": softIRQStats, total, err := parseSoftIRQStat(line) @@ -251,7 +251,7 @@ func parseStat(r io.Reader, fileName string) (Stat, error) { } if err := scanner.Err(); err != nil { - return Stat{}, fmt.Errorf("%s: couldn't parse %q: %w", ErrFileParse, fileName, err) + return Stat{}, fmt.Errorf("%w: couldn't parse %q: %w", ErrFileParse, fileName, err) } return stat, nil diff --git a/vendor/github.com/prometheus/procfs/swaps.go b/vendor/github.com/prometheus/procfs/swaps.go index fa00f555d..65fec834b 100644 --- a/vendor/github.com/prometheus/procfs/swaps.go +++ b/vendor/github.com/prometheus/procfs/swaps.go @@ -74,15 +74,15 @@ func parseSwapString(swapString string) (*Swap, error) { swap.Size, err = strconv.Atoi(swapFields[2]) if err != nil { - return nil, fmt.Errorf("%s: invalid swap size: %s: %w", ErrFileParse, swapFields[2], err) + return nil, fmt.Errorf("%w: invalid swap size: %s: %w", ErrFileParse, swapFields[2], err) } swap.Used, err = strconv.Atoi(swapFields[3]) if err != nil { - return nil, fmt.Errorf("%s: invalid swap used: %s: %w", ErrFileParse, swapFields[3], err) + return nil, fmt.Errorf("%w: invalid swap used: %s: %w", ErrFileParse, swapFields[3], err) } swap.Priority, err = strconv.Atoi(swapFields[4]) if err != nil { - return nil, fmt.Errorf("%s: invalid swap priority: %s: %w", ErrFileParse, swapFields[4], err) + return nil, fmt.Errorf("%w: invalid swap priority: %s: %w", ErrFileParse, swapFields[4], err) } return swap, nil diff --git a/vendor/github.com/prometheus/procfs/thread.go b/vendor/github.com/prometheus/procfs/thread.go index df2215ece..80e0e947b 100644 --- a/vendor/github.com/prometheus/procfs/thread.go +++ b/vendor/github.com/prometheus/procfs/thread.go @@ -45,7 +45,7 @@ func (fs FS) AllThreads(pid int) (Procs, error) { names, err := d.Readdirnames(-1) if err != nil { - return Procs{}, fmt.Errorf("%s: could not read %q: %w", ErrFileRead, d.Name(), err) + return Procs{}, fmt.Errorf("%w: could not read %q: %w", ErrFileRead, d.Name(), err) } t := Procs{} diff --git a/vendor/github.com/prometheus/procfs/zoneinfo.go b/vendor/github.com/prometheus/procfs/zoneinfo.go index ce5fefa5b..e54d94b09 100644 --- a/vendor/github.com/prometheus/procfs/zoneinfo.go +++ b/vendor/github.com/prometheus/procfs/zoneinfo.go @@ -75,11 +75,11 @@ var nodeZoneRE = regexp.MustCompile(`(\d+), zone\s+(\w+)`) func (fs FS) Zoneinfo() ([]Zoneinfo, error) { data, err := os.ReadFile(fs.proc.Path("zoneinfo")) if err != nil { - return nil, fmt.Errorf("%s: error reading zoneinfo %q: %w", ErrFileRead, fs.proc.Path("zoneinfo"), err) + return nil, fmt.Errorf("%w: error reading zoneinfo %q: %w", ErrFileRead, fs.proc.Path("zoneinfo"), err) } zoneinfo, err := parseZoneinfo(data) if err != nil { - return nil, fmt.Errorf("%s: error parsing zoneinfo %q: %w", ErrFileParse, fs.proc.Path("zoneinfo"), err) + return nil, fmt.Errorf("%w: error parsing zoneinfo %q: %w", ErrFileParse, fs.proc.Path("zoneinfo"), err) } return zoneinfo, nil } diff --git a/vendor/github.com/spf13/cobra/.golangci.yml b/vendor/github.com/spf13/cobra/.golangci.yml index a618ec24d..2c8f4808c 100644 --- a/vendor/github.com/spf13/cobra/.golangci.yml +++ b/vendor/github.com/spf13/cobra/.golangci.yml @@ -26,33 +26,28 @@ linters: - errcheck #- exhaustive #- funlen - - gas #- gochecknoinits - goconst - #- gocritic + - gocritic #- gocyclo - #- gofmt + - gofmt - goimports - - golint #- gomnd #- goprintffuncname - #- gosec - #- gosimple + - gosec + - gosimple - govet - ineffassign - - interfacer #- lll - - maligned - - megacheck - #- misspell + - misspell #- nakedret #- noctx - #- nolintlint + - nolintlint #- rowserrcheck #- scopelint - #- staticcheck + - staticcheck #- structcheck ! deprecated since v1.49.0; replaced by 'unused' - #- stylecheck + - stylecheck #- typecheck - unconvert #- unparam diff --git a/vendor/github.com/spf13/cobra/active_help.go b/vendor/github.com/spf13/cobra/active_help.go index 5f965e057..25c30e3cc 100644 --- a/vendor/github.com/spf13/cobra/active_help.go +++ b/vendor/github.com/spf13/cobra/active_help.go @@ -17,21 +17,17 @@ package cobra import ( "fmt" "os" - "regexp" - "strings" ) const ( activeHelpMarker = "_activeHelp_ " // The below values should not be changed: programs will be using them explicitly // in their user documentation, and users will be using them explicitly. - activeHelpEnvVarSuffix = "_ACTIVE_HELP" - activeHelpGlobalEnvVar = "COBRA_ACTIVE_HELP" + activeHelpEnvVarSuffix = "ACTIVE_HELP" + activeHelpGlobalEnvVar = configEnvVarGlobalPrefix + "_" + activeHelpEnvVarSuffix activeHelpGlobalDisable = "0" ) -var activeHelpEnvVarPrefixSubstRegexp = regexp.MustCompile(`[^A-Z0-9_]`) - // AppendActiveHelp adds the specified string to the specified array to be used as ActiveHelp. // Such strings will be processed by the completion script and will be shown as ActiveHelp // to the user. @@ -60,8 +56,5 @@ func GetActiveHelpConfig(cmd *Command) string { // variable. It has the format _ACTIVE_HELP where is the name of the // root command in upper case, with all non-ASCII-alphanumeric characters replaced by `_`. func activeHelpEnvVar(name string) string { - // This format should not be changed: users will be using it explicitly. - activeHelpEnvVar := strings.ToUpper(fmt.Sprintf("%s%s", name, activeHelpEnvVarSuffix)) - activeHelpEnvVar = activeHelpEnvVarPrefixSubstRegexp.ReplaceAllString(activeHelpEnvVar, "_") - return activeHelpEnvVar + return configEnvVar(name, activeHelpEnvVarSuffix) } diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go index e79ec33a8..ed1e70cea 100644 --- a/vendor/github.com/spf13/cobra/args.go +++ b/vendor/github.com/spf13/cobra/args.go @@ -52,9 +52,9 @@ func OnlyValidArgs(cmd *Command, args []string) error { if len(cmd.ValidArgs) > 0 { // Remove any description that may be included in ValidArgs. // A description is following a tab character. - var validArgs []string + validArgs := make([]string, 0, len(cmd.ValidArgs)) for _, v := range cmd.ValidArgs { - validArgs = append(validArgs, strings.Split(v, "\t")[0]) + validArgs = append(validArgs, strings.SplitN(v, "\t", 2)[0]) } for _, v := range args { if !stringInSlice(v, validArgs) { diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go index 8a5315184..f4d198cbc 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.go +++ b/vendor/github.com/spf13/cobra/bash_completions.go @@ -597,19 +597,16 @@ func writeRequiredFlag(buf io.StringWriter, cmd *Command) { if nonCompletableFlag(flag) { return } - for key := range flag.Annotations { - switch key { - case BashCompOneRequiredFlag: - format := " must_have_one_flag+=(\"--%s" - if flag.Value.Type() != "bool" { - format += "=" - } - format += cbn - WriteStringAndCheck(buf, fmt.Sprintf(format, flag.Name)) - - if len(flag.Shorthand) > 0 { - WriteStringAndCheck(buf, fmt.Sprintf(" must_have_one_flag+=(\"-%s"+cbn, flag.Shorthand)) - } + if _, ok := flag.Annotations[BashCompOneRequiredFlag]; ok { + format := " must_have_one_flag+=(\"--%s" + if flag.Value.Type() != "bool" { + format += "=" + } + format += cbn + WriteStringAndCheck(buf, fmt.Sprintf(format, flag.Name)) + + if len(flag.Shorthand) > 0 { + WriteStringAndCheck(buf, fmt.Sprintf(" must_have_one_flag+=(\"-%s"+cbn, flag.Shorthand)) } } }) @@ -621,7 +618,7 @@ func writeRequiredNouns(buf io.StringWriter, cmd *Command) { for _, value := range cmd.ValidArgs { // Remove any description that may be included following a tab character. // Descriptions are not supported by bash completion. - value = strings.Split(value, "\t")[0] + value = strings.SplitN(value, "\t", 2)[0] WriteStringAndCheck(buf, fmt.Sprintf(" must_have_one_noun+=(%q)\n", value)) } if cmd.ValidArgsFunction != nil { diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go index a6b160ce5..e0b0947b0 100644 --- a/vendor/github.com/spf13/cobra/cobra.go +++ b/vendor/github.com/spf13/cobra/cobra.go @@ -193,8 +193,6 @@ func ld(s, t string, ignoreCase bool) int { d := make([][]int, len(s)+1) for i := range d { d[i] = make([]int, len(t)+1) - } - for i := range d { d[i][0] = i } for j := range d[0] { diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index 2fbe6c131..54748fc67 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -154,8 +154,10 @@ type Command struct { // pflags contains persistent flags. pflags *flag.FlagSet // lflags contains local flags. + // This field does not represent internal state, it's used as a cache to optimise LocalFlags function call lflags *flag.FlagSet // iflags contains inherited flags. + // This field does not represent internal state, it's used as a cache to optimise InheritedFlags function call iflags *flag.FlagSet // parentsPflags is all persistent flags of cmd's parents. parentsPflags *flag.FlagSet @@ -706,7 +708,7 @@ Loop: // This is not a flag or a flag value. Check to see if it matches what we're looking for, and if so, // return the args, excluding the one at this position. if s == x { - ret := []string{} + ret := make([]string, 0, len(args)-1) ret = append(ret, args[:pos]...) ret = append(ret, args[pos+1:]...) return ret @@ -754,14 +756,14 @@ func (c *Command) findSuggestions(arg string) string { if c.SuggestionsMinimumDistance <= 0 { c.SuggestionsMinimumDistance = 2 } - suggestionsString := "" + var sb strings.Builder if suggestions := c.SuggestionsFor(arg); len(suggestions) > 0 { - suggestionsString += "\n\nDid you mean this?\n" + sb.WriteString("\n\nDid you mean this?\n") for _, s := range suggestions { - suggestionsString += fmt.Sprintf("\t%v\n", s) + _, _ = fmt.Fprintf(&sb, "\t%v\n", s) } } - return suggestionsString + return sb.String() } func (c *Command) findNext(next string) *Command { @@ -873,7 +875,7 @@ func (c *Command) ArgsLenAtDash() int { func (c *Command) execute(a []string) (err error) { if c == nil { - return fmt.Errorf("Called Execute() on a nil Command") + return fmt.Errorf("called Execute() on a nil Command") } if len(c.Deprecated) > 0 { @@ -1187,10 +1189,11 @@ func (c *Command) InitDefaultHelpFlag() { c.mergePersistentFlags() if c.Flags().Lookup("help") == nil { usage := "help for " - if c.Name() == "" { + name := c.displayName() + if name == "" { usage += "this command" } else { - usage += c.Name() + usage += name } c.Flags().BoolP("help", "h", false, usage) _ = c.Flags().SetAnnotation("help", FlagSetByCobraAnnotation, []string{"true"}) @@ -1236,7 +1239,7 @@ func (c *Command) InitDefaultHelpCmd() { Use: "help [command]", Short: "Help about any command", Long: `Help provides help for any command in the application. -Simply type ` + c.Name() + ` help [path to command] for full details.`, +Simply type ` + c.displayName() + ` help [path to command] for full details.`, ValidArgsFunction: func(c *Command, args []string, toComplete string) ([]string, ShellCompDirective) { var completions []string cmd, _, e := c.Root().Find(args) @@ -1427,6 +1430,10 @@ func (c *Command) CommandPath() string { if c.HasParent() { return c.Parent().CommandPath() + " " + c.Name() } + return c.displayName() +} + +func (c *Command) displayName() string { if displayName, ok := c.Annotations[CommandDisplayNameAnnotation]; ok { return displayName } @@ -1436,10 +1443,11 @@ func (c *Command) CommandPath() string { // UseLine puts out the full usage for a given command (including parents). func (c *Command) UseLine() string { var useline string + use := strings.Replace(c.Use, c.Name(), c.displayName(), 1) if c.HasParent() { - useline = c.parent.CommandPath() + " " + c.Use + useline = c.parent.CommandPath() + " " + use } else { - useline = c.Use + useline = use } if c.DisableFlagsInUseLine { return useline @@ -1452,7 +1460,6 @@ func (c *Command) UseLine() string { // DebugFlags used to determine which flags have been assigned to which commands // and which persist. -// nolint:goconst func (c *Command) DebugFlags() { c.Println("DebugFlags called on", c.Name()) var debugflags func(*Command) @@ -1642,7 +1649,7 @@ func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) f // to this command (local and persistent declared here and by all parents). func (c *Command) Flags() *flag.FlagSet { if c.flags == nil { - c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.flags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError) if c.flagErrorBuf == nil { c.flagErrorBuf = new(bytes.Buffer) } @@ -1653,10 +1660,11 @@ func (c *Command) Flags() *flag.FlagSet { } // LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands. +// This function does not modify the flags of the current command, it's purpose is to return the current state. func (c *Command) LocalNonPersistentFlags() *flag.FlagSet { persistentFlags := c.PersistentFlags() - out := flag.NewFlagSet(c.Name(), flag.ContinueOnError) + out := flag.NewFlagSet(c.displayName(), flag.ContinueOnError) c.LocalFlags().VisitAll(func(f *flag.Flag) { if persistentFlags.Lookup(f.Name) == nil { out.AddFlag(f) @@ -1666,11 +1674,12 @@ func (c *Command) LocalNonPersistentFlags() *flag.FlagSet { } // LocalFlags returns the local FlagSet specifically set in the current command. +// This function does not modify the flags of the current command, it's purpose is to return the current state. func (c *Command) LocalFlags() *flag.FlagSet { c.mergePersistentFlags() if c.lflags == nil { - c.lflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.lflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError) if c.flagErrorBuf == nil { c.flagErrorBuf = new(bytes.Buffer) } @@ -1693,11 +1702,12 @@ func (c *Command) LocalFlags() *flag.FlagSet { } // InheritedFlags returns all flags which were inherited from parent commands. +// This function does not modify the flags of the current command, it's purpose is to return the current state. func (c *Command) InheritedFlags() *flag.FlagSet { c.mergePersistentFlags() if c.iflags == nil { - c.iflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.iflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError) if c.flagErrorBuf == nil { c.flagErrorBuf = new(bytes.Buffer) } @@ -1718,6 +1728,7 @@ func (c *Command) InheritedFlags() *flag.FlagSet { } // NonInheritedFlags returns all flags which were not inherited from parent commands. +// This function does not modify the flags of the current command, it's purpose is to return the current state. func (c *Command) NonInheritedFlags() *flag.FlagSet { return c.LocalFlags() } @@ -1725,7 +1736,7 @@ func (c *Command) NonInheritedFlags() *flag.FlagSet { // PersistentFlags returns the persistent FlagSet specifically set in the current command. func (c *Command) PersistentFlags() *flag.FlagSet { if c.pflags == nil { - c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.pflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError) if c.flagErrorBuf == nil { c.flagErrorBuf = new(bytes.Buffer) } @@ -1738,9 +1749,9 @@ func (c *Command) PersistentFlags() *flag.FlagSet { func (c *Command) ResetFlags() { c.flagErrorBuf = new(bytes.Buffer) c.flagErrorBuf.Reset() - c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.flags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError) c.flags.SetOutput(c.flagErrorBuf) - c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.pflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError) c.pflags.SetOutput(c.flagErrorBuf) c.lflags = nil @@ -1857,7 +1868,7 @@ func (c *Command) mergePersistentFlags() { // If c.parentsPflags == nil, it makes new. func (c *Command) updateParentsPflags() { if c.parentsPflags == nil { - c.parentsPflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.parentsPflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError) c.parentsPflags.SetOutput(c.flagErrorBuf) c.parentsPflags.SortFlags = false } diff --git a/vendor/github.com/spf13/cobra/completions.go b/vendor/github.com/spf13/cobra/completions.go index b60f6b200..c0c08b057 100644 --- a/vendor/github.com/spf13/cobra/completions.go +++ b/vendor/github.com/spf13/cobra/completions.go @@ -17,6 +17,8 @@ package cobra import ( "fmt" "os" + "regexp" + "strconv" "strings" "sync" @@ -211,24 +213,29 @@ func (c *Command) initCompleteCmd(args []string) { // 2- Even without completions, we need to print the directive } - noDescriptions := (cmd.CalledAs() == ShellCompNoDescRequestCmd) + noDescriptions := cmd.CalledAs() == ShellCompNoDescRequestCmd + if !noDescriptions { + if doDescriptions, err := strconv.ParseBool(getEnvConfig(cmd, configEnvVarSuffixDescriptions)); err == nil { + noDescriptions = !doDescriptions + } + } + noActiveHelp := GetActiveHelpConfig(finalCmd) == activeHelpGlobalDisable + out := finalCmd.OutOrStdout() for _, comp := range completions { - if GetActiveHelpConfig(finalCmd) == activeHelpGlobalDisable { - // Remove all activeHelp entries in this case - if strings.HasPrefix(comp, activeHelpMarker) { - continue - } + if noActiveHelp && strings.HasPrefix(comp, activeHelpMarker) { + // Remove all activeHelp entries if it's disabled. + continue } if noDescriptions { // Remove any description that may be included following a tab character. - comp = strings.Split(comp, "\t")[0] + comp = strings.SplitN(comp, "\t", 2)[0] } // Make sure we only write the first line to the output. // This is needed if a description contains a linebreak. // Otherwise the shell scripts will interpret the other lines as new flags // and could therefore provide a wrong completion. - comp = strings.Split(comp, "\n")[0] + comp = strings.SplitN(comp, "\n", 2)[0] // Finally trim the completion. This is especially important to get rid // of a trailing tab when there are no description following it. @@ -237,14 +244,14 @@ func (c *Command) initCompleteCmd(args []string) { // although there is no description). comp = strings.TrimSpace(comp) - // Print each possible completion to stdout for the completion script to consume. - fmt.Fprintln(finalCmd.OutOrStdout(), comp) + // Print each possible completion to the output for the completion script to consume. + fmt.Fprintln(out, comp) } // As the last printout, print the completion directive for the completion script to parse. // The directive integer must be that last character following a single colon (:). // The completion script expects : - fmt.Fprintf(finalCmd.OutOrStdout(), ":%d\n", directive) + fmt.Fprintf(out, ":%d\n", directive) // Print some helpful info to stderr for the user to understand. // Output from stderr must be ignored by the completion script. @@ -291,7 +298,7 @@ func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDi } if err != nil { // Unable to find the real command. E.g., someInvalidCmd - return c, []string{}, ShellCompDirectiveDefault, fmt.Errorf("Unable to find a command for arguments: %v", trimmedArgs) + return c, []string{}, ShellCompDirectiveDefault, fmt.Errorf("unable to find a command for arguments: %v", trimmedArgs) } finalCmd.ctx = c.ctx @@ -899,3 +906,34 @@ func CompError(msg string) { func CompErrorln(msg string) { CompError(fmt.Sprintf("%s\n", msg)) } + +// These values should not be changed: users will be using them explicitly. +const ( + configEnvVarGlobalPrefix = "COBRA" + configEnvVarSuffixDescriptions = "COMPLETION_DESCRIPTIONS" +) + +var configEnvVarPrefixSubstRegexp = regexp.MustCompile(`[^A-Z0-9_]`) + +// configEnvVar returns the name of the program-specific configuration environment +// variable. It has the format _ where is the name of the +// root command in upper case, with all non-ASCII-alphanumeric characters replaced by `_`. +func configEnvVar(name, suffix string) string { + // This format should not be changed: users will be using it explicitly. + v := strings.ToUpper(fmt.Sprintf("%s_%s", name, suffix)) + v = configEnvVarPrefixSubstRegexp.ReplaceAllString(v, "_") + return v +} + +// getEnvConfig returns the value of the configuration environment variable +// _ where is the name of the root command in upper +// case, with all non-ASCII-alphanumeric characters replaced by `_`. +// If the value is empty or not set, the value of the environment variable +// COBRA_ is returned instead. +func getEnvConfig(cmd *Command, suffix string) string { + v := os.Getenv(configEnvVar(cmd.Root().Name(), suffix)) + if v == "" { + v = os.Getenv(configEnvVar(configEnvVarGlobalPrefix, suffix)) + } + return v +} diff --git a/vendor/github.com/spf13/cobra/flag_groups.go b/vendor/github.com/spf13/cobra/flag_groups.go index 0671ec5f2..560612fd3 100644 --- a/vendor/github.com/spf13/cobra/flag_groups.go +++ b/vendor/github.com/spf13/cobra/flag_groups.go @@ -23,9 +23,9 @@ import ( ) const ( - requiredAsGroup = "cobra_annotation_required_if_others_set" - oneRequired = "cobra_annotation_one_required" - mutuallyExclusive = "cobra_annotation_mutually_exclusive" + requiredAsGroupAnnotation = "cobra_annotation_required_if_others_set" + oneRequiredAnnotation = "cobra_annotation_one_required" + mutuallyExclusiveAnnotation = "cobra_annotation_mutually_exclusive" ) // MarkFlagsRequiredTogether marks the given flags with annotations so that Cobra errors @@ -37,7 +37,7 @@ func (c *Command) MarkFlagsRequiredTogether(flagNames ...string) { if f == nil { panic(fmt.Sprintf("Failed to find flag %q and mark it as being required in a flag group", v)) } - if err := c.Flags().SetAnnotation(v, requiredAsGroup, append(f.Annotations[requiredAsGroup], strings.Join(flagNames, " "))); err != nil { + if err := c.Flags().SetAnnotation(v, requiredAsGroupAnnotation, append(f.Annotations[requiredAsGroupAnnotation], strings.Join(flagNames, " "))); err != nil { // Only errs if the flag isn't found. panic(err) } @@ -53,7 +53,7 @@ func (c *Command) MarkFlagsOneRequired(flagNames ...string) { if f == nil { panic(fmt.Sprintf("Failed to find flag %q and mark it as being in a one-required flag group", v)) } - if err := c.Flags().SetAnnotation(v, oneRequired, append(f.Annotations[oneRequired], strings.Join(flagNames, " "))); err != nil { + if err := c.Flags().SetAnnotation(v, oneRequiredAnnotation, append(f.Annotations[oneRequiredAnnotation], strings.Join(flagNames, " "))); err != nil { // Only errs if the flag isn't found. panic(err) } @@ -70,7 +70,7 @@ func (c *Command) MarkFlagsMutuallyExclusive(flagNames ...string) { panic(fmt.Sprintf("Failed to find flag %q and mark it as being in a mutually exclusive flag group", v)) } // Each time this is called is a single new entry; this allows it to be a member of multiple groups if needed. - if err := c.Flags().SetAnnotation(v, mutuallyExclusive, append(f.Annotations[mutuallyExclusive], strings.Join(flagNames, " "))); err != nil { + if err := c.Flags().SetAnnotation(v, mutuallyExclusiveAnnotation, append(f.Annotations[mutuallyExclusiveAnnotation], strings.Join(flagNames, " "))); err != nil { panic(err) } } @@ -91,9 +91,9 @@ func (c *Command) ValidateFlagGroups() error { oneRequiredGroupStatus := map[string]map[string]bool{} mutuallyExclusiveGroupStatus := map[string]map[string]bool{} flags.VisitAll(func(pflag *flag.Flag) { - processFlagForGroupAnnotation(flags, pflag, requiredAsGroup, groupStatus) - processFlagForGroupAnnotation(flags, pflag, oneRequired, oneRequiredGroupStatus) - processFlagForGroupAnnotation(flags, pflag, mutuallyExclusive, mutuallyExclusiveGroupStatus) + processFlagForGroupAnnotation(flags, pflag, requiredAsGroupAnnotation, groupStatus) + processFlagForGroupAnnotation(flags, pflag, oneRequiredAnnotation, oneRequiredGroupStatus) + processFlagForGroupAnnotation(flags, pflag, mutuallyExclusiveAnnotation, mutuallyExclusiveGroupStatus) }) if err := validateRequiredFlagGroups(groupStatus); err != nil { @@ -130,7 +130,7 @@ func processFlagForGroupAnnotation(flags *flag.FlagSet, pflag *flag.Flag, annota continue } - groupStatus[group] = map[string]bool{} + groupStatus[group] = make(map[string]bool, len(flagnames)) for _, name := range flagnames { groupStatus[group][name] = false } @@ -232,9 +232,9 @@ func (c *Command) enforceFlagGroupsForCompletion() { oneRequiredGroupStatus := map[string]map[string]bool{} mutuallyExclusiveGroupStatus := map[string]map[string]bool{} c.Flags().VisitAll(func(pflag *flag.Flag) { - processFlagForGroupAnnotation(flags, pflag, requiredAsGroup, groupStatus) - processFlagForGroupAnnotation(flags, pflag, oneRequired, oneRequiredGroupStatus) - processFlagForGroupAnnotation(flags, pflag, mutuallyExclusive, mutuallyExclusiveGroupStatus) + processFlagForGroupAnnotation(flags, pflag, requiredAsGroupAnnotation, groupStatus) + processFlagForGroupAnnotation(flags, pflag, oneRequiredAnnotation, oneRequiredGroupStatus) + processFlagForGroupAnnotation(flags, pflag, mutuallyExclusiveAnnotation, mutuallyExclusiveGroupStatus) }) // If a flag that is part of a group is present, we make all the other flags @@ -253,17 +253,17 @@ func (c *Command) enforceFlagGroupsForCompletion() { // If none of the flags of a one-required group are present, we make all the flags // of that group required so that the shell completion suggests them automatically for flagList, flagnameAndStatus := range oneRequiredGroupStatus { - set := 0 + isSet := false - for _, isSet := range flagnameAndStatus { + for _, isSet = range flagnameAndStatus { if isSet { - set++ + break } } // None of the flags of the group are set, mark all flags in the group // as required - if set == 0 { + if !isSet { for _, fName := range strings.Split(flagList, " ") { _ = c.MarkFlagRequired(fName) } diff --git a/vendor/github.com/spf13/cobra/powershell_completions.go b/vendor/github.com/spf13/cobra/powershell_completions.go index 551951939..a830b7bca 100644 --- a/vendor/github.com/spf13/cobra/powershell_completions.go +++ b/vendor/github.com/spf13/cobra/powershell_completions.go @@ -28,8 +28,8 @@ import ( func genPowerShellComp(buf io.StringWriter, name string, includeDesc bool) { // Variables should not contain a '-' or ':' character nameForVar := name - nameForVar = strings.Replace(nameForVar, "-", "_", -1) - nameForVar = strings.Replace(nameForVar, ":", "_", -1) + nameForVar = strings.ReplaceAll(nameForVar, "-", "_") + nameForVar = strings.ReplaceAll(nameForVar, ":", "_") compCmd := ShellCompRequestCmd if !includeDesc { diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go index 92b8cf73c..6aae83bfd 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -23,7 +12,7 @@ import ( ) // DefaultClient is the default Client and is used by Get, Head, Post and PostForm. -// Please be careful of intitialization order - for example, if you change +// Please be careful of initialization order - for example, if you change // the global propagator, the DefaultClient might still be using the old one. var DefaultClient = &http.Client{Transport: NewTransport(http.DefaultTransport)} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go index 9509014e8..214acaf58 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -31,10 +20,16 @@ const ( // Server HTTP metrics. const ( - RequestCount = "http.server.request_count" // Incoming request count total - RequestContentLength = "http.server.request_content_length" // Incoming request bytes total - ResponseContentLength = "http.server.response_content_length" // Incoming response bytes total - ServerLatency = "http.server.duration" // Incoming end to end duration, milliseconds + serverRequestSize = "http.server.request.size" // Incoming request bytes total + serverResponseSize = "http.server.response.size" // Incoming response bytes total + serverDuration = "http.server.duration" // Incoming end to end duration, milliseconds +) + +// Client HTTP metrics. +const ( + clientRequestSize = "http.client.request.size" // Outgoing request bytes total + clientResponseSize = "http.client.response.size" // Outgoing response bytes total + clientDuration = "http.client.duration" // Outgoing end to end duration, milliseconds ) // Filter is a predicate used to determine whether a given http.request should diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go index a1b5b5e5a..f0a9bb9ef 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -111,7 +100,7 @@ func WithPublicEndpoint() Option { }) } -// WithPublicEndpointFn runs with every request, and allows conditionnally +// WithPublicEndpointFn runs with every request, and allows conditionally // configuring the Handler to link the span with an incoming span context. If // this option is not provided or returns false, then the association is a // child association instead of a link. diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go index 38c7f01c7..56b24b982 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package otelhttp provides an http.Handler and functions that are intended // to be used to add tracing by wrapping existing handlers (with Handler) and diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go index 9a8260059..d01bdccf4 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go @@ -1,32 +1,20 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" import ( - "io" "net/http" "time" "github.com/felixge/httpsnoop" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) @@ -43,10 +31,13 @@ type middleware struct { writeEvent bool filters []Filter spanNameFormatter func(string, *http.Request) string - counters map[string]metric.Int64Counter - valueRecorders map[string]metric.Float64Histogram publicEndpoint bool publicEndpointFn func(*http.Request) bool + + traceSemconv semconv.HTTPServer + requestBytesCounter metric.Int64Counter + responseBytesCounter metric.Int64Counter + serverLatencyMeasure metric.Float64Histogram } func defaultHandlerFormatter(operation string, _ *http.Request) string { @@ -65,6 +56,8 @@ func NewHandler(handler http.Handler, operation string, opts ...Option) http.Han func NewMiddleware(operation string, opts ...Option) func(http.Handler) http.Handler { h := middleware{ operation: operation, + + traceSemconv: semconv.NewHTTPServer(), } defaultOpts := []Option{ @@ -104,33 +97,27 @@ func handleErr(err error) { } func (h *middleware) createMeasures() { - h.counters = make(map[string]metric.Int64Counter) - h.valueRecorders = make(map[string]metric.Float64Histogram) - - requestBytesCounter, err := h.meter.Int64Counter( - RequestContentLength, + var err error + h.requestBytesCounter, err = h.meter.Int64Counter( + serverRequestSize, metric.WithUnit("By"), - metric.WithDescription("Measures the size of HTTP request content length (uncompressed)"), + metric.WithDescription("Measures the size of HTTP request messages."), ) handleErr(err) - responseBytesCounter, err := h.meter.Int64Counter( - ResponseContentLength, + h.responseBytesCounter, err = h.meter.Int64Counter( + serverResponseSize, metric.WithUnit("By"), - metric.WithDescription("Measures the size of HTTP response content length (uncompressed)"), + metric.WithDescription("Measures the size of HTTP response messages."), ) handleErr(err) - serverLatencyMeasure, err := h.meter.Float64Histogram( - ServerLatency, + h.serverLatencyMeasure, err = h.meter.Float64Histogram( + serverDuration, metric.WithUnit("ms"), - metric.WithDescription("Measures the duration of HTTP request handling"), + metric.WithDescription("Measures the duration of inbound HTTP requests."), ) handleErr(err) - - h.counters[RequestContentLength] = requestBytesCounter - h.counters[ResponseContentLength] = responseBytesCounter - h.valueRecorders[ServerLatency] = serverLatencyMeasure } // serveHTTP sets up tracing and calls the given next http.Handler with the span @@ -147,12 +134,9 @@ func (h *middleware) serveHTTP(w http.ResponseWriter, r *http.Request, next http ctx := h.propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) opts := []trace.SpanStartOption{ - trace.WithAttributes(semconvutil.HTTPServerRequest(h.server, r)...), - } - if h.server != "" { - hostAttr := semconv.NetHostName(h.server) - opts = append(opts, trace.WithAttributes(hostAttr)) + trace.WithAttributes(h.traceSemconv.RequestTraceAttrs(h.server, r)...), } + opts = append(opts, h.spanStartOptions...) if h.publicEndpoint || (h.publicEndpointFn != nil && h.publicEndpointFn(r.WithContext(ctx))) { opts = append(opts, trace.WithNewRoot()) @@ -221,61 +205,48 @@ func (h *middleware) serveHTTP(w http.ResponseWriter, r *http.Request, next http WriteHeader: func(httpsnoop.WriteHeaderFunc) httpsnoop.WriteHeaderFunc { return rww.WriteHeader }, + Flush: func(httpsnoop.FlushFunc) httpsnoop.FlushFunc { + return rww.Flush + }, }) - labeler := &Labeler{} - ctx = injectLabeler(ctx, labeler) + labeler, found := LabelerFromContext(ctx) + if !found { + ctx = ContextWithLabeler(ctx, labeler) + } next.ServeHTTP(w, r.WithContext(ctx)) - setAfterServeAttributes(span, bw.read, rww.written, rww.statusCode, bw.err, rww.err) + span.SetStatus(semconv.ServerStatus(rww.statusCode)) + span.SetAttributes(h.traceSemconv.ResponseTraceAttrs(semconv.ResponseTelemetry{ + StatusCode: rww.statusCode, + ReadBytes: bw.read.Load(), + ReadError: bw.err, + WriteBytes: rww.written, + WriteError: rww.err, + })...) // Add metrics attributes := append(labeler.Get(), semconvutil.HTTPServerRequestMetrics(h.server, r)...) if rww.statusCode > 0 { attributes = append(attributes, semconv.HTTPStatusCode(rww.statusCode)) } - o := metric.WithAttributes(attributes...) - h.counters[RequestContentLength].Add(ctx, bw.read, o) - h.counters[ResponseContentLength].Add(ctx, rww.written, o) + o := metric.WithAttributeSet(attribute.NewSet(attributes...)) + addOpts := []metric.AddOption{o} // Allocate vararg slice once. + h.requestBytesCounter.Add(ctx, bw.read.Load(), addOpts...) + h.responseBytesCounter.Add(ctx, rww.written, addOpts...) // Use floating point division here for higher precision (instead of Millisecond method). elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) - h.valueRecorders[ServerLatency].Record(ctx, elapsedTime, o) -} - -func setAfterServeAttributes(span trace.Span, read, wrote int64, statusCode int, rerr, werr error) { - attributes := []attribute.KeyValue{} - - // TODO: Consider adding an event after each read and write, possibly as an - // option (defaulting to off), so as to not create needlessly verbose spans. - if read > 0 { - attributes = append(attributes, ReadBytesKey.Int64(read)) - } - if rerr != nil && rerr != io.EOF { - attributes = append(attributes, ReadErrorKey.String(rerr.Error())) - } - if wrote > 0 { - attributes = append(attributes, WroteBytesKey.Int64(wrote)) - } - if statusCode > 0 { - attributes = append(attributes, semconv.HTTPStatusCode(statusCode)) - } - span.SetStatus(semconvutil.HTTPServerStatus(statusCode)) - - if werr != nil && werr != io.EOF { - attributes = append(attributes, WriteErrorKey.String(werr.Error())) - } - span.SetAttributes(attributes...) + h.serverLatencyMeasure.Record(ctx, elapsedTime, o) } // WithRouteTag annotates spans and metrics with the provided route name // with HTTP route attribute. func WithRouteTag(route string, h http.Handler) http.Handler { + attr := semconv.NewHTTPServer().Route(route) return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - attr := semconv.HTTPRouteKey.String(route) - span := trace.SpanFromContext(r.Context()) span.SetAttributes(attr) diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go new file mode 100644 index 000000000..3ec0ad00c --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go @@ -0,0 +1,82 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "fmt" + "net/http" + "os" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" +) + +type ResponseTelemetry struct { + StatusCode int + ReadBytes int64 + ReadError error + WriteBytes int64 + WriteError error +} + +type HTTPServer struct { + duplicate bool +} + +// RequestTraceAttrs returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +func (s HTTPServer) RequestTraceAttrs(server string, req *http.Request) []attribute.KeyValue { + if s.duplicate { + return append(oldHTTPServer{}.RequestTraceAttrs(server, req), newHTTPServer{}.RequestTraceAttrs(server, req)...) + } + return oldHTTPServer{}.RequestTraceAttrs(server, req) +} + +// ResponseTraceAttrs returns trace attributes for telemetry from an HTTP response. +// +// If any of the fields in the ResponseTelemetry are not set the attribute will be omitted. +func (s HTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue { + if s.duplicate { + return append(oldHTTPServer{}.ResponseTraceAttrs(resp), newHTTPServer{}.ResponseTraceAttrs(resp)...) + } + return oldHTTPServer{}.ResponseTraceAttrs(resp) +} + +// Route returns the attribute for the route. +func (s HTTPServer) Route(route string) attribute.KeyValue { + return oldHTTPServer{}.Route(route) +} + +func NewHTTPServer() HTTPServer { + env := strings.ToLower(os.Getenv("OTEL_HTTP_CLIENT_COMPATIBILITY_MODE")) + return HTTPServer{duplicate: env == "http/dup"} +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 500 { + return codes.Error, "" + } + return codes.Unset, "" +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go new file mode 100644 index 000000000..e7f293761 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go @@ -0,0 +1,91 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "net" + "net/http" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" + semconvNew "go.opentelemetry.io/otel/semconv/v1.24.0" +) + +// splitHostPort splits a network address hostport of the form "host", +// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", +// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and +// port. +// +// An empty host is returned if it is not provided or unparsable. A negative +// port is returned if it is not provided or unparsable. +func splitHostPort(hostport string) (host string, port int) { + port = -1 + + if strings.HasPrefix(hostport, "[") { + addrEnd := strings.LastIndex(hostport, "]") + if addrEnd < 0 { + // Invalid hostport. + return + } + if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 { + host = hostport[1:addrEnd] + return + } + } else { + if i := strings.LastIndex(hostport, ":"); i < 0 { + host = hostport + return + } + } + + host, pStr, err := net.SplitHostPort(hostport) + if err != nil { + return + } + + p, err := strconv.ParseUint(pStr, 10, 16) + if err != nil { + return + } + return host, int(p) +} + +func requiredHTTPPort(https bool, port int) int { // nolint:revive + if https { + if port > 0 && port != 443 { + return port + } + } else { + if port > 0 && port != 80 { + return port + } + } + return -1 +} + +func serverClientIP(xForwardedFor string) string { + if idx := strings.Index(xForwardedFor, ","); idx >= 0 { + xForwardedFor = xForwardedFor[:idx] + } + return xForwardedFor +} + +func netProtocol(proto string) (name string, version string) { + name, version, _ = strings.Cut(proto, "/") + name = strings.ToLower(name) + return name, version +} + +var methodLookup = map[string]attribute.KeyValue{ + http.MethodConnect: semconvNew.HTTPRequestMethodConnect, + http.MethodDelete: semconvNew.HTTPRequestMethodDelete, + http.MethodGet: semconvNew.HTTPRequestMethodGet, + http.MethodHead: semconvNew.HTTPRequestMethodHead, + http.MethodOptions: semconvNew.HTTPRequestMethodOptions, + http.MethodPatch: semconvNew.HTTPRequestMethodPatch, + http.MethodPost: semconvNew.HTTPRequestMethodPost, + http.MethodPut: semconvNew.HTTPRequestMethodPut, + http.MethodTrace: semconvNew.HTTPRequestMethodTrace, +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go new file mode 100644 index 000000000..c3e838aaa --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go @@ -0,0 +1,74 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "errors" + "io" + "net/http" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" + "go.opentelemetry.io/otel/attribute" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" +) + +type oldHTTPServer struct{} + +// RequestTraceAttrs returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +func (o oldHTTPServer) RequestTraceAttrs(server string, req *http.Request) []attribute.KeyValue { + return semconvutil.HTTPServerRequest(server, req) +} + +// ResponseTraceAttrs returns trace attributes for telemetry from an HTTP response. +// +// If any of the fields in the ResponseTelemetry are not set the attribute will be omitted. +func (o oldHTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue { + attributes := []attribute.KeyValue{} + + if resp.ReadBytes > 0 { + attributes = append(attributes, semconv.HTTPRequestContentLength(int(resp.ReadBytes))) + } + if resp.ReadError != nil && !errors.Is(resp.ReadError, io.EOF) { + // This is not in the semantic conventions, but is historically provided + attributes = append(attributes, attribute.String("http.read_error", resp.ReadError.Error())) + } + if resp.WriteBytes > 0 { + attributes = append(attributes, semconv.HTTPResponseContentLength(int(resp.WriteBytes))) + } + if resp.StatusCode > 0 { + attributes = append(attributes, semconv.HTTPStatusCode(resp.StatusCode)) + } + if resp.WriteError != nil && !errors.Is(resp.WriteError, io.EOF) { + // This is not in the semantic conventions, but is historically provided + attributes = append(attributes, attribute.String("http.write_error", resp.WriteError.Error())) + } + + return attributes +} + +// Route returns the attribute for the route. +func (o oldHTTPServer) Route(route string) attribute.KeyValue { + return semconv.HTTPRoute(route) +} + +// HTTPStatusCode returns the attribute for the HTTP status code. +// This is a temporary function needed by metrics. This will be removed when MetricsRequest is added. +func HTTPStatusCode(status int) attribute.KeyValue { + return semconv.HTTPStatusCode(status) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.24.0.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.24.0.go new file mode 100644 index 000000000..0c5d4c460 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.24.0.go @@ -0,0 +1,197 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "net/http" + "strings" + + "go.opentelemetry.io/otel/attribute" + semconvNew "go.opentelemetry.io/otel/semconv/v1.24.0" +) + +type newHTTPServer struct{} + +// TraceRequest returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +func (n newHTTPServer) RequestTraceAttrs(server string, req *http.Request) []attribute.KeyValue { + count := 3 // ServerAddress, Method, Scheme + + var host string + var p int + if server == "" { + host, p = splitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = splitHostPort(server) + if p < 0 { + _, p = splitHostPort(req.Host) + } + } + + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + count++ + } + + method, methodOriginal := n.method(req.Method) + if methodOriginal != (attribute.KeyValue{}) { + count++ + } + + scheme := n.scheme(req.TLS != nil) + + if peer, peerPort := splitHostPort(req.RemoteAddr); peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + count++ + if peerPort > 0 { + count++ + } + } + + useragent := req.UserAgent() + if useragent != "" { + count++ + } + + clientIP := serverClientIP(req.Header.Get("X-Forwarded-For")) + if clientIP != "" { + count++ + } + + if req.URL != nil && req.URL.Path != "" { + count++ + } + + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" && protoName != "http" { + count++ + } + if protoVersion != "" { + count++ + } + + attrs := make([]attribute.KeyValue, 0, count) + attrs = append(attrs, + semconvNew.ServerAddress(host), + method, + scheme, + ) + + if hostPort > 0 { + attrs = append(attrs, semconvNew.ServerPort(hostPort)) + } + if methodOriginal != (attribute.KeyValue{}) { + attrs = append(attrs, methodOriginal) + } + + if peer, peerPort := splitHostPort(req.RemoteAddr); peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + attrs = append(attrs, semconvNew.NetworkPeerAddress(peer)) + if peerPort > 0 { + attrs = append(attrs, semconvNew.NetworkPeerPort(peerPort)) + } + } + + if useragent := req.UserAgent(); useragent != "" { + attrs = append(attrs, semconvNew.UserAgentOriginal(useragent)) + } + + if clientIP != "" { + attrs = append(attrs, semconvNew.ClientAddress(clientIP)) + } + + if req.URL != nil && req.URL.Path != "" { + attrs = append(attrs, semconvNew.URLPath(req.URL.Path)) + } + + if protoName != "" && protoName != "http" { + attrs = append(attrs, semconvNew.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, semconvNew.NetworkProtocolVersion(protoVersion)) + } + + return attrs +} + +func (n newHTTPServer) method(method string) (attribute.KeyValue, attribute.KeyValue) { + if method == "" { + return semconvNew.HTTPRequestMethodGet, attribute.KeyValue{} + } + if attr, ok := methodLookup[method]; ok { + return attr, attribute.KeyValue{} + } + + orig := semconvNew.HTTPRequestMethodOriginal(method) + if attr, ok := methodLookup[strings.ToUpper(method)]; ok { + return attr, orig + } + return semconvNew.HTTPRequestMethodGet, orig +} + +func (n newHTTPServer) scheme(https bool) attribute.KeyValue { // nolint:revive + if https { + return semconvNew.URLScheme("https") + } + return semconvNew.URLScheme("http") +} + +// TraceResponse returns trace attributes for telemetry from an HTTP response. +// +// If any of the fields in the ResponseTelemetry are not set the attribute will be omitted. +func (n newHTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue { + var count int + + if resp.ReadBytes > 0 { + count++ + } + if resp.WriteBytes > 0 { + count++ + } + if resp.StatusCode > 0 { + count++ + } + + attributes := make([]attribute.KeyValue, 0, count) + + if resp.ReadBytes > 0 { + attributes = append(attributes, + semconvNew.HTTPRequestBodySize(int(resp.ReadBytes)), + ) + } + if resp.WriteBytes > 0 { + attributes = append(attributes, + semconvNew.HTTPResponseBodySize(int(resp.WriteBytes)), + ) + } + if resp.StatusCode > 0 { + attributes = append(attributes, + semconvNew.HTTPResponseStatusCode(resp.StatusCode), + ) + } + + return attributes +} + +// Route returns the attribute for the route. +func (n newHTTPServer) Route(route string) attribute.KeyValue { + return semconvNew.HTTPRoute(route) +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go index edf4ce3d3..7aa5f99e8 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go index d3dede9eb..a73bb06e9 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go @@ -2,18 +2,7 @@ // source: internal/shared/semconvutil/httpconv.go.tmpl // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" @@ -24,7 +13,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" ) // HTTPClientResponse returns trace attributes for an HTTP response received by a @@ -43,14 +32,22 @@ func HTTPClientResponse(resp *http.Response) []attribute.KeyValue { } // HTTPClientRequest returns trace attributes for an HTTP request made by a client. -// The following attributes are always returned: "http.url", "http.flavor", -// "http.method", "net.peer.name". The following attributes are returned if the -// related values are defined in req: "net.peer.port", "http.user_agent", -// "http.request_content_length", "enduser.id". +// The following attributes are always returned: "http.url", "http.method", +// "net.peer.name". The following attributes are returned if the related values +// are defined in req: "net.peer.port", "user_agent.original", +// "http.request_content_length". func HTTPClientRequest(req *http.Request) []attribute.KeyValue { return hc.ClientRequest(req) } +// HTTPClientRequestMetrics returns metric attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.method", "net.peer.name". +// The following attributes are returned if the +// related values are defined in req: "net.peer.port". +func HTTPClientRequestMetrics(req *http.Request) []attribute.KeyValue { + return hc.ClientRequestMetrics(req) +} + // HTTPClientStatus returns a span status code and message for an HTTP status code // value received by a client. func HTTPClientStatus(code int) (codes.Code, string) { @@ -75,10 +72,9 @@ func HTTPClientStatus(code int) (codes.Code, string) { // The req Host will be used to determine the server instead. // // The following attributes are always returned: "http.method", "http.scheme", -// "http.flavor", "http.target", "net.host.name". The following attributes are -// returned if they related values are defined in req: "net.host.port", -// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", -// "http.client_ip". +// "http.target", "net.host.name". The following attributes are returned if +// they related values are defined in req: "net.host.port", "net.sock.peer.addr", +// "net.sock.peer.port", "user_agent.original", "http.client_ip". func HTTPServerRequest(server string, req *http.Request) []attribute.KeyValue { return hc.ServerRequest(server, req) } @@ -101,8 +97,8 @@ func HTTPServerRequest(server string, req *http.Request) []attribute.KeyValue { // The req Host will be used to determine the server instead. // // The following attributes are always returned: "http.method", "http.scheme", -// "http.flavor", "net.host.name". The following attributes are -// returned if they related values are defined in req: "net.host.port". +// "net.host.name". The following attributes are returned if they related +// values are defined in req: "net.host.port". func HTTPServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { return hc.ServerRequestMetrics(server, req) } @@ -114,44 +110,12 @@ func HTTPServerStatus(code int) (codes.Code, string) { return hc.ServerStatus(code) } -// HTTPRequestHeader returns the contents of h as attributes. -// -// Instrumentation should require an explicit configuration of which headers to -// captured and then prune what they pass here. Including all headers can be a -// security risk - explicit configuration helps avoid leaking sensitive -// information. -// -// The User-Agent header is already captured in the http.user_agent attribute -// from ClientRequest and ServerRequest. Instrumentation may provide an option -// to capture that header here even though it is not recommended. Otherwise, -// instrumentation should filter that out of what is passed. -func HTTPRequestHeader(h http.Header) []attribute.KeyValue { - return hc.RequestHeader(h) -} - -// HTTPResponseHeader returns the contents of h as attributes. -// -// Instrumentation should require an explicit configuration of which headers to -// captured and then prune what they pass here. Including all headers can be a -// security risk - explicit configuration helps avoid leaking sensitive -// information. -// -// The User-Agent header is already captured in the http.user_agent attribute -// from ClientRequest and ServerRequest. Instrumentation may provide an option -// to capture that header here even though it is not recommended. Otherwise, -// instrumentation should filter that out of what is passed. -func HTTPResponseHeader(h http.Header) []attribute.KeyValue { - return hc.ResponseHeader(h) -} - // httpConv are the HTTP semantic convention attributes defined for a version // of the OpenTelemetry specification. type httpConv struct { NetConv *netConv - EnduserIDKey attribute.Key HTTPClientIPKey attribute.Key - HTTPFlavorKey attribute.Key HTTPMethodKey attribute.Key HTTPRequestContentLengthKey attribute.Key HTTPResponseContentLengthKey attribute.Key @@ -161,15 +125,13 @@ type httpConv struct { HTTPStatusCodeKey attribute.Key HTTPTargetKey attribute.Key HTTPURLKey attribute.Key - HTTPUserAgentKey attribute.Key + UserAgentOriginalKey attribute.Key } var hc = &httpConv{ NetConv: nc, - EnduserIDKey: semconv.EnduserIDKey, HTTPClientIPKey: semconv.HTTPClientIPKey, - HTTPFlavorKey: semconv.HTTPFlavorKey, HTTPMethodKey: semconv.HTTPMethodKey, HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, @@ -179,7 +141,7 @@ var hc = &httpConv{ HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, HTTPTargetKey: semconv.HTTPTargetKey, HTTPURLKey: semconv.HTTPURLKey, - HTTPUserAgentKey: semconv.HTTPUserAgentKey, + UserAgentOriginalKey: semconv.UserAgentOriginalKey, } // ClientResponse returns attributes for an HTTP response received by a client @@ -193,6 +155,10 @@ var hc = &httpConv{ // // append(ClientResponse(resp), ClientRequest(resp.Request)...) func (c *httpConv) ClientResponse(resp *http.Response) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.status_code int + http.response_content_length int + */ var n int if resp.StatusCode > 0 { n++ @@ -212,11 +178,31 @@ func (c *httpConv) ClientResponse(resp *http.Response) []attribute.KeyValue { } // ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.flavor", -// "http.method", "net.peer.name". The following attributes are returned if the -// related values are defined in req: "net.peer.port", "http.user_agent", -// "http.request_content_length", "enduser.id". +// following attributes are always returned: "http.url", "http.method", +// "net.peer.name". The following attributes are returned if the related values +// are defined in req: "net.peer.port", "user_agent.original", +// "http.request_content_length", "user_agent.original". func (c *httpConv) ClientRequest(req *http.Request) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.method string + user_agent.original string + http.url string + net.peer.name string + net.peer.port int + http.request_content_length int + */ + + /* The following semantic conventions are not returned: + http.status_code This requires the response. See ClientResponse. + http.response_content_length This requires the response. See ClientResponse. + net.sock.family This requires the socket used. + net.sock.peer.addr This requires the socket used. + net.sock.peer.name This requires the socket used. + net.sock.peer.port This requires the socket used. + http.resend_count This is something outside of a single request. + net.protocol.name The value is the Request is ignored, and the go client will always use "http". + net.protocol.version The value in the Request is ignored, and the go client will always use 1.1 or 2.0. + */ n := 3 // URL, peer name, proto, and method. var h string if req.URL != nil { @@ -234,14 +220,10 @@ func (c *httpConv) ClientRequest(req *http.Request) []attribute.KeyValue { if req.ContentLength > 0 { n++ } - userID, _, hasUserID := req.BasicAuth() - if hasUserID { - n++ - } + attrs := make([]attribute.KeyValue, 0, n) attrs = append(attrs, c.method(req.Method)) - attrs = append(attrs, c.flavor(req.Proto)) var u string if req.URL != nil { @@ -260,15 +242,43 @@ func (c *httpConv) ClientRequest(req *http.Request) []attribute.KeyValue { } if useragent != "" { - attrs = append(attrs, c.HTTPUserAgentKey.String(useragent)) + attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) } if l := req.ContentLength; l > 0 { attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l)) } - if hasUserID { - attrs = append(attrs, c.EnduserIDKey.String(userID)) + return attrs +} + +// ClientRequestMetrics returns metric attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.method", "net.peer.name". +// The following attributes are returned if the related values +// are defined in req: "net.peer.port". +func (c *httpConv) ClientRequestMetrics(req *http.Request) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.method string + net.peer.name string + net.peer.port int + */ + + n := 2 // method, peer name. + var h string + if req.URL != nil { + h = req.URL.Host + } + peer, p := firstHostPort(h, req.Header.Get("Host")) + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) + if port > 0 { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.method(req.Method), c.NetConv.PeerName(peer)) + + if port > 0 { + attrs = append(attrs, c.NetConv.PeerPort(port)) } return attrs @@ -291,18 +301,35 @@ func (c *httpConv) ClientRequest(req *http.Request) []attribute.KeyValue { // The req Host will be used to determine the server instead. // // The following attributes are always returned: "http.method", "http.scheme", -// "http.flavor", "http.target", "net.host.name". The following attributes are -// returned if they related values are defined in req: "net.host.port", -// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", -// "http.client_ip". +// "http.target", "net.host.name". The following attributes are returned if they +// related values are defined in req: "net.host.port", "net.sock.peer.addr", +// "net.sock.peer.port", "user_agent.original", "http.client_ip", +// "net.protocol.name", "net.protocol.version". func (c *httpConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue { - // TODO: This currently does not add the specification required - // `http.target` attribute. It has too high of a cardinality to safely be - // added. An alternate should be added, or this comment removed, when it is - // addressed by the specification. If it is ultimately decided to continue - // not including the attribute, the HTTPTargetKey field of the httpConv - // should be removed as well. - + /* The following semantic conventions are returned if present: + http.method string + http.scheme string + net.host.name string + net.host.port int + net.sock.peer.addr string + net.sock.peer.port int + user_agent.original string + http.client_ip string + net.protocol.name string Note: not set if the value is "http". + net.protocol.version string + http.target string Note: doesn't include the query parameter. + */ + + /* The following semantic conventions are not returned: + http.status_code This requires the response. + http.request_content_length This requires the len() of body, which can mutate it. + http.response_content_length This requires the response. + http.route This is not available. + net.sock.peer.name This would require a DNS lookup. + net.sock.host.addr The request doesn't have access to the underlying socket. + net.sock.host.port The request doesn't have access to the underlying socket. + + */ n := 4 // Method, scheme, proto, and host name. var host string var p int @@ -330,19 +357,31 @@ func (c *httpConv) ServerRequest(server string, req *http.Request) []attribute.K if useragent != "" { n++ } - userID, _, hasUserID := req.BasicAuth() - if hasUserID { - n++ - } + clientIP := serverClientIP(req.Header.Get("X-Forwarded-For")) if clientIP != "" { n++ } + + var target string + if req.URL != nil { + target = req.URL.Path + if target != "" { + n++ + } + } + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" && protoName != "http" { + n++ + } + if protoVersion != "" { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) attrs = append(attrs, c.method(req.Method)) attrs = append(attrs, c.scheme(req.TLS != nil)) - attrs = append(attrs, c.flavor(req.Proto)) attrs = append(attrs, c.NetConv.HostName(host)) if hostPort > 0 { @@ -359,17 +398,24 @@ func (c *httpConv) ServerRequest(server string, req *http.Request) []attribute.K } if useragent != "" { - attrs = append(attrs, c.HTTPUserAgentKey.String(useragent)) - } - - if hasUserID { - attrs = append(attrs, c.EnduserIDKey.String(userID)) + attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) } if clientIP != "" { attrs = append(attrs, c.HTTPClientIPKey.String(clientIP)) } + if target != "" { + attrs = append(attrs, c.HTTPTargetKey.String(target)) + } + + if protoName != "" && protoName != "http" { + attrs = append(attrs, c.NetConv.NetProtocolName.String(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, c.NetConv.NetProtocolVersion.String(protoVersion)) + } + return attrs } @@ -391,17 +437,21 @@ func (c *httpConv) ServerRequest(server string, req *http.Request) []attribute.K // The req Host will be used to determine the server instead. // // The following attributes are always returned: "http.method", "http.scheme", -// "http.flavor", "net.host.name". The following attributes are -// returned if they related values are defined in req: "net.host.port". +// "net.host.name". The following attributes are returned if they related +// values are defined in req: "net.host.port". func (c *httpConv) ServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { - // TODO: This currently does not add the specification required - // `http.target` attribute. It has too high of a cardinality to safely be - // added. An alternate should be added, or this comment removed, when it is - // addressed by the specification. If it is ultimately decided to continue - // not including the attribute, the HTTPTargetKey field of the httpConv - // should be removed as well. - - n := 4 // Method, scheme, proto, and host name. + /* The following semantic conventions are returned if present: + http.scheme string + http.route string + http.method string + http.status_code int + net.host.name string + net.host.port int + net.protocol.name string Note: not set if the value is "http". + net.protocol.version string + */ + + n := 3 // Method, scheme, and host name. var host string var p int if server == "" { @@ -417,16 +467,29 @@ func (c *httpConv) ServerRequestMetrics(server string, req *http.Request) []attr if hostPort > 0 { n++ } + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" { + n++ + } + if protoVersion != "" { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) attrs = append(attrs, c.methodMetric(req.Method)) attrs = append(attrs, c.scheme(req.TLS != nil)) - attrs = append(attrs, c.flavor(req.Proto)) attrs = append(attrs, c.NetConv.HostName(host)) if hostPort > 0 { attrs = append(attrs, c.NetConv.HostPort(hostPort)) } + if protoName != "" { + attrs = append(attrs, c.NetConv.NetProtocolName.String(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, c.NetConv.NetProtocolVersion.String(protoVersion)) + } return attrs } @@ -455,21 +518,6 @@ func (c *httpConv) scheme(https bool) attribute.KeyValue { // nolint:revive return c.HTTPSchemeHTTP } -func (c *httpConv) flavor(proto string) attribute.KeyValue { - switch proto { - case "HTTP/1.0": - return c.HTTPFlavorKey.String("1.0") - case "HTTP/1.1": - return c.HTTPFlavorKey.String("1.1") - case "HTTP/2": - return c.HTTPFlavorKey.String("2.0") - case "HTTP/3": - return c.HTTPFlavorKey.String("3.0") - default: - return c.HTTPFlavorKey.String(proto) - } -} - func serverClientIP(xForwardedFor string) string { if idx := strings.Index(xForwardedFor, ","); idx >= 0 { xForwardedFor = xForwardedFor[:idx] @@ -501,31 +549,6 @@ func firstHostPort(source ...string) (host string, port int) { return } -// RequestHeader returns the contents of h as OpenTelemetry attributes. -func (c *httpConv) RequestHeader(h http.Header) []attribute.KeyValue { - return c.header("http.request.header", h) -} - -// ResponseHeader returns the contents of h as OpenTelemetry attributes. -func (c *httpConv) ResponseHeader(h http.Header) []attribute.KeyValue { - return c.header("http.response.header", h) -} - -func (c *httpConv) header(prefix string, h http.Header) []attribute.KeyValue { - key := func(k string) attribute.Key { - k = strings.ToLower(k) - k = strings.ReplaceAll(k, "-", "_") - k = fmt.Sprintf("%s.%s", prefix, k) - return attribute.Key(k) - } - - attrs := make([]attribute.KeyValue, 0, len(h)) - for k, v := range h { - attrs = append(attrs, key(k).StringSlice(v)) - } - return attrs -} - // ClientStatus returns a span status code and message for an HTTP status code // value received by a client. func (c *httpConv) ClientStatus(code int) (codes.Code, string) { diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go index bde889343..a9a9226b3 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go @@ -2,17 +2,7 @@ // source: internal/shared/semconvutil/netconv.go.tmpl // Copyright The OpenTelemetry Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" @@ -22,7 +12,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" ) // NetTransport returns a trace attribute describing the transport protocol of the @@ -32,24 +22,6 @@ func NetTransport(network string) attribute.KeyValue { return nc.Transport(network) } -// NetClient returns trace attributes for a client network connection to address. -// See net.Dial for information about acceptable address values, address should -// be the same as the one used to create conn. If conn is nil, only network -// peer attributes will be returned that describe address. Otherwise, the -// socket level information about conn will also be included. -func NetClient(address string, conn net.Conn) []attribute.KeyValue { - return nc.Client(address, conn) -} - -// NetServer returns trace attributes for a network listener listening at address. -// See net.Listen for information about acceptable address values, address -// should be the same as the one used to create ln. If ln is nil, only network -// host attributes will be returned that describe address. Otherwise, the -// socket level information about ln will also be included. -func NetServer(address string, ln net.Listener) []attribute.KeyValue { - return nc.Server(address, ln) -} - // netConv are the network semantic convention attributes defined for a version // of the OpenTelemetry specification. type netConv struct { @@ -57,6 +29,8 @@ type netConv struct { NetHostPortKey attribute.Key NetPeerNameKey attribute.Key NetPeerPortKey attribute.Key + NetProtocolName attribute.Key + NetProtocolVersion attribute.Key NetSockFamilyKey attribute.Key NetSockPeerAddrKey attribute.Key NetSockPeerPortKey attribute.Key @@ -73,6 +47,8 @@ var nc = &netConv{ NetHostPortKey: semconv.NetHostPortKey, NetPeerNameKey: semconv.NetPeerNameKey, NetPeerPortKey: semconv.NetPeerPortKey, + NetProtocolName: semconv.NetProtocolNameKey, + NetProtocolVersion: semconv.NetProtocolVersionKey, NetSockFamilyKey: semconv.NetSockFamilyKey, NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, NetSockPeerPortKey: semconv.NetSockPeerPortKey, @@ -116,57 +92,11 @@ func (c *netConv) Host(address string) []attribute.KeyValue { attrs := make([]attribute.KeyValue, 0, n) attrs = append(attrs, c.HostName(h)) if p > 0 { - attrs = append(attrs, c.HostPort(int(p))) + attrs = append(attrs, c.HostPort(p)) } return attrs } -// Server returns attributes for a network listener listening at address. See -// net.Listen for information about acceptable address values, address should -// be the same as the one used to create ln. If ln is nil, only network host -// attributes will be returned that describe address. Otherwise, the socket -// level information about ln will also be included. -func (c *netConv) Server(address string, ln net.Listener) []attribute.KeyValue { - if ln == nil { - return c.Host(address) - } - - lAddr := ln.Addr() - if lAddr == nil { - return c.Host(address) - } - - hostName, hostPort := splitHostPort(address) - sockHostAddr, sockHostPort := splitHostPort(lAddr.String()) - network := lAddr.Network() - sockFamily := family(network, sockHostAddr) - - n := nonZeroStr(hostName, network, sockHostAddr, sockFamily) - n += positiveInt(hostPort, sockHostPort) - attr := make([]attribute.KeyValue, 0, n) - if hostName != "" { - attr = append(attr, c.HostName(hostName)) - if hostPort > 0 { - // Only if net.host.name is set should net.host.port be. - attr = append(attr, c.HostPort(hostPort)) - } - } - if network != "" { - attr = append(attr, c.Transport(network)) - } - if sockFamily != "" { - attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) - } - if sockHostAddr != "" { - attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) - if sockHostPort > 0 { - // Only if net.sock.host.addr is set should net.sock.host.port be. - attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) - } - } - return attr -} - func (c *netConv) HostName(name string) attribute.KeyValue { return c.NetHostNameKey.String(name) } @@ -175,85 +105,6 @@ func (c *netConv) HostPort(port int) attribute.KeyValue { return c.NetHostPortKey.Int(port) } -// Client returns attributes for a client network connection to address. See -// net.Dial for information about acceptable address values, address should be -// the same as the one used to create conn. If conn is nil, only network peer -// attributes will be returned that describe address. Otherwise, the socket -// level information about conn will also be included. -func (c *netConv) Client(address string, conn net.Conn) []attribute.KeyValue { - if conn == nil { - return c.Peer(address) - } - - lAddr, rAddr := conn.LocalAddr(), conn.RemoteAddr() - - var network string - switch { - case lAddr != nil: - network = lAddr.Network() - case rAddr != nil: - network = rAddr.Network() - default: - return c.Peer(address) - } - - peerName, peerPort := splitHostPort(address) - var ( - sockFamily string - sockPeerAddr string - sockPeerPort int - sockHostAddr string - sockHostPort int - ) - - if lAddr != nil { - sockHostAddr, sockHostPort = splitHostPort(lAddr.String()) - } - - if rAddr != nil { - sockPeerAddr, sockPeerPort = splitHostPort(rAddr.String()) - } - - switch { - case sockHostAddr != "": - sockFamily = family(network, sockHostAddr) - case sockPeerAddr != "": - sockFamily = family(network, sockPeerAddr) - } - - n := nonZeroStr(peerName, network, sockPeerAddr, sockHostAddr, sockFamily) - n += positiveInt(peerPort, sockPeerPort, sockHostPort) - attr := make([]attribute.KeyValue, 0, n) - if peerName != "" { - attr = append(attr, c.PeerName(peerName)) - if peerPort > 0 { - // Only if net.peer.name is set should net.peer.port be. - attr = append(attr, c.PeerPort(peerPort)) - } - } - if network != "" { - attr = append(attr, c.Transport(network)) - } - if sockFamily != "" { - attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) - } - if sockPeerAddr != "" { - attr = append(attr, c.NetSockPeerAddrKey.String(sockPeerAddr)) - if sockPeerPort > 0 { - // Only if net.sock.peer.addr is set should net.sock.peer.port be. - attr = append(attr, c.NetSockPeerPortKey.Int(sockPeerPort)) - } - } - if sockHostAddr != "" { - attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) - if sockHostPort > 0 { - // Only if net.sock.host.addr is set should net.sock.host.port be. - attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) - } - } - return attr -} - func family(network, address string) string { switch network { case "unix", "unixgram", "unixpacket": @@ -269,26 +120,6 @@ func family(network, address string) string { return "" } -func nonZeroStr(strs ...string) int { - var n int - for _, str := range strs { - if str != "" { - n++ - } - } - return n -} - -func positiveInt(ints ...int) int { - var n int - for _, i := range ints { - if i > 0 { - n++ - } - } - return n -} - // Peer returns attributes for a network peer address. func (c *netConv) Peer(address string) []attribute.KeyValue { h, p := splitHostPort(address) @@ -307,7 +138,7 @@ func (c *netConv) Peer(address string) []attribute.KeyValue { attrs := make([]attribute.KeyValue, 0, n) attrs = append(attrs, c.PeerName(h)) if p > 0 { - attrs = append(attrs, c.PeerPort(int(p))) + attrs = append(attrs, c.PeerPort(p)) } return attrs } @@ -366,3 +197,9 @@ func splitHostPort(hostport string) (host string, port int) { } return host, int(p) } + +func netProtocol(proto string) (name string, version string) { + name, version, _ = strings.Cut(proto, "/") + name = strings.ToLower(name) + return name, version +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go index 26a51a180..ea504e396 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/labeler.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -48,8 +37,12 @@ type labelerContextKeyType int const lablelerContextKey labelerContextKeyType = 0 -func injectLabeler(ctx context.Context, l *Labeler) context.Context { - return context.WithValue(ctx, lablelerContextKey, l) +// ContextWithLabeler returns a new context with the provided Labeler instance. +// Attributes added to the specified labeler will be injected into metrics +// emitted by the instrumentation. Only one labeller can be injected into the +// context. Injecting it multiple times will override the previous calls. +func ContextWithLabeler(parent context.Context, l *Labeler) context.Context { + return context.WithValue(parent, lablelerContextKey, l) } // LabelerFromContext retrieves a Labeler instance from the provided context if diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go index e835cac12..0d3cb2e4a 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -19,31 +8,42 @@ import ( "io" "net/http" "net/http/httptrace" + "sync/atomic" + "time" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" "go.opentelemetry.io/otel/trace" ) // Transport implements the http.RoundTripper interface and wraps -// outbound HTTP(S) requests with a span. +// outbound HTTP(S) requests with a span and enriches it with metrics. type Transport struct { rt http.RoundTripper tracer trace.Tracer + meter metric.Meter propagators propagation.TextMapPropagator spanStartOptions []trace.SpanStartOption filters []Filter spanNameFormatter func(string, *http.Request) string clientTrace func(context.Context) *httptrace.ClientTrace + + requestBytesCounter metric.Int64Counter + responseBytesCounter metric.Int64Counter + latencyMeasure metric.Float64Histogram } var _ http.RoundTripper = &Transport{} // NewTransport wraps the provided http.RoundTripper with one that -// starts a span and injects the span context into the outbound request headers. +// starts a span, injects the span context into the outbound request headers, +// and enriches it with metrics. // // If the provided http.RoundTripper is nil, http.DefaultTransport will be used // as the base http.RoundTripper. @@ -63,12 +63,14 @@ func NewTransport(base http.RoundTripper, opts ...Option) *Transport { c := newConfig(append(defaultOpts, opts...)...) t.applyConfig(c) + t.createMeasures() return &t } func (t *Transport) applyConfig(c *config) { t.tracer = c.Tracer + t.meter = c.Meter t.propagators = c.Propagators t.spanStartOptions = c.SpanStartOptions t.filters = c.Filters @@ -76,6 +78,30 @@ func (t *Transport) applyConfig(c *config) { t.clientTrace = c.ClientTrace } +func (t *Transport) createMeasures() { + var err error + t.requestBytesCounter, err = t.meter.Int64Counter( + clientRequestSize, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP request messages."), + ) + handleErr(err) + + t.responseBytesCounter, err = t.meter.Int64Counter( + clientResponseSize, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP response messages."), + ) + handleErr(err) + + t.latencyMeasure, err = t.meter.Float64Histogram( + clientDuration, + metric.WithUnit("ms"), + metric.WithDescription("Measures the duration of outbound HTTP requests."), + ) + handleErr(err) +} + func defaultTransportFormatter(_ string, r *http.Request) string { return "HTTP " + r.Method } @@ -84,6 +110,7 @@ func defaultTransportFormatter(_ string, r *http.Request) string { // before handing the request to the configured base RoundTripper. The created span will // end when the response body is closed or when a read from the body returns io.EOF. func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { + requestStartTime := time.Now() for _, f := range t.filters { if !f(r) { // Simply pass through to the base RoundTripper if a filter rejects the request @@ -109,7 +136,25 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { ctx = httptrace.WithClientTrace(ctx, t.clientTrace(ctx)) } + labeler, found := LabelerFromContext(ctx) + if !found { + ctx = ContextWithLabeler(ctx, labeler) + } + r = r.Clone(ctx) // According to RoundTripper spec, we shouldn't modify the origin request. + + // use a body wrapper to determine the request size + var bw bodyWrapper + // if request body is nil or NoBody, we don't want to mutate the body as it + // will affect the identity of it in an unforeseeable way because we assert + // ReadCloser fulfills a certain interface and it is indeed nil or NoBody. + if r.Body != nil && r.Body != http.NoBody { + bw.ReadCloser = r.Body + // noop to prevent nil panic. not using this record fun yet. + bw.record = func(int64) {} + r.Body = &bw + } + span.SetAttributes(semconvutil.HTTPClientRequest(r)...) t.propagators.Inject(ctx, propagation.HeaderCarrier(r.Header)) @@ -121,9 +166,29 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { return res, err } + // metrics + metricAttrs := append(labeler.Get(), semconvutil.HTTPClientRequestMetrics(r)...) + if res.StatusCode > 0 { + metricAttrs = append(metricAttrs, semconv.HTTPStatusCode(res.StatusCode)) + } + o := metric.WithAttributeSet(attribute.NewSet(metricAttrs...)) + addOpts := []metric.AddOption{o} // Allocate vararg slice once. + t.requestBytesCounter.Add(ctx, bw.read.Load(), addOpts...) + // For handling response bytes we leverage a callback when the client reads the http response + readRecordFunc := func(n int64) { + t.responseBytesCounter.Add(ctx, n, addOpts...) + } + + // traces span.SetAttributes(semconvutil.HTTPClientResponse(res)...) span.SetStatus(semconvutil.HTTPClientStatus(res.StatusCode)) - res.Body = newWrappedBody(span, res.Body) + + res.Body = newWrappedBody(span, readRecordFunc, res.Body) + + // Use floating point division here for higher precision (instead of Millisecond method). + elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) + + t.latencyMeasure.Record(ctx, elapsedTime, o) return res, err } @@ -131,17 +196,17 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { // newWrappedBody returns a new and appropriately scoped *wrappedBody as an // io.ReadCloser. If the passed body implements io.Writer, the returned value // will implement io.ReadWriteCloser. -func newWrappedBody(span trace.Span, body io.ReadCloser) io.ReadCloser { +func newWrappedBody(span trace.Span, record func(n int64), body io.ReadCloser) io.ReadCloser { // The successful protocol switch responses will have a body that // implement an io.ReadWriteCloser. Ensure this interface type continues // to be satisfied if that is the case. if _, ok := body.(io.ReadWriteCloser); ok { - return &wrappedBody{span: span, body: body} + return &wrappedBody{span: span, record: record, body: body} } // Remove the implementation of the io.ReadWriteCloser and only implement // the io.ReadCloser. - return struct{ io.ReadCloser }{&wrappedBody{span: span, body: body}} + return struct{ io.ReadCloser }{&wrappedBody{span: span, record: record, body: body}} } // wrappedBody is the response body type returned by the transport @@ -153,8 +218,11 @@ func newWrappedBody(span trace.Span, body io.ReadCloser) io.ReadCloser { // If the response body implements the io.Writer interface (i.e. for // successful protocol switches), the wrapped body also will. type wrappedBody struct { - span trace.Span - body io.ReadCloser + span trace.Span + recorded atomic.Bool + record func(n int64) + body io.ReadCloser + read atomic.Int64 } var _ io.ReadWriteCloser = &wrappedBody{} @@ -171,11 +239,14 @@ func (wb *wrappedBody) Write(p []byte) (int, error) { func (wb *wrappedBody) Read(b []byte) (int, error) { n, err := wb.body.Read(b) + // Record the number of bytes read + wb.read.Add(int64(n)) switch err { case nil: // nothing to do here but fall through to the return case io.EOF: + wb.recordBytesRead() wb.span.End() default: wb.span.RecordError(err) @@ -184,7 +255,20 @@ func (wb *wrappedBody) Read(b []byte) (int, error) { return n, err } +// recordBytesRead is a function that ensures the number of bytes read is recorded once and only once. +func (wb *wrappedBody) recordBytesRead() { + // note: it is more performant (and equally correct) to use atomic.Bool over sync.Once here. In the event that + // two goroutines are racing to call this method, the number of bytes read will no longer increase. Using + // CompareAndSwap allows later goroutines to return quickly and not block waiting for the race winner to finish + // calling wb.record(wb.read.Load()). + if wb.recorded.CompareAndSwap(false, true) { + // Record the total number of bytes read + wb.record(wb.read.Load()) + } +} + func (wb *wrappedBody) Close() error { + wb.recordBytesRead() wb.span.End() if wb.body != nil { return wb.body.Close() diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go index 8a5cf07bd..b0957f28c 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go @@ -1,22 +1,11 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" // Version is the current release version of the otelhttp instrumentation. func Version() string { - return "0.46.0" + return "0.53.0" // This string is updated by the pre_release.sh script during release } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go index 11a35ed16..948f8406c 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/wrap.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -18,6 +7,7 @@ import ( "context" "io" "net/http" + "sync/atomic" "go.opentelemetry.io/otel/propagation" ) @@ -30,14 +20,14 @@ type bodyWrapper struct { io.ReadCloser record func(n int64) // must not be nil - read int64 + read atomic.Int64 err error } func (w *bodyWrapper) Read(b []byte) (int, error) { n, err := w.ReadCloser.Read(b) n1 := int64(n) - w.read += n1 + w.read.Add(n1) w.err = err w.record(n1) return n, err @@ -97,3 +87,13 @@ func (w *respWriterWrapper) WriteHeader(statusCode int) { } w.ResponseWriter.WriteHeader(statusCode) } + +func (w *respWriterWrapper) Flush() { + if !w.wroteHeader { + w.WriteHeader(http.StatusOK) + } + + if f, ok := w.ResponseWriter.(http.Flusher); ok { + f.Flush() + } +} diff --git a/vendor/go.opentelemetry.io/otel/.codespellignore b/vendor/go.opentelemetry.io/otel/.codespellignore index ae6a3bcf1..6bf3abc41 100644 --- a/vendor/go.opentelemetry.io/otel/.codespellignore +++ b/vendor/go.opentelemetry.io/otel/.codespellignore @@ -3,3 +3,7 @@ fo te collison consequentially +ans +nam +valu +thirdparty diff --git a/vendor/go.opentelemetry.io/otel/.codespellrc b/vendor/go.opentelemetry.io/otel/.codespellrc index 4afbb1fb3..e2cb3ea94 100644 --- a/vendor/go.opentelemetry.io/otel/.codespellrc +++ b/vendor/go.opentelemetry.io/otel/.codespellrc @@ -5,6 +5,6 @@ check-filenames = check-hidden = ignore-words = .codespellignore interactive = 1 -skip = .git,go.mod,go.sum,semconv,venv,.tools +skip = .git,go.mod,go.sum,go.work,go.work.sum,semconv,venv,.tools uri-ignore-words-list = * write = diff --git a/vendor/go.opentelemetry.io/otel/.gitignore b/vendor/go.opentelemetry.io/otel/.gitignore index 924805565..895c7664b 100644 --- a/vendor/go.opentelemetry.io/otel/.gitignore +++ b/vendor/go.opentelemetry.io/otel/.gitignore @@ -14,13 +14,9 @@ go.work.sum gen/ /example/dice/dice -/example/fib/fib -/example/fib/traces.txt -/example/jaeger/jaeger /example/namedtracer/namedtracer /example/otel-collector/otel-collector /example/opencensus/opencensus /example/passthrough/passthrough /example/prometheus/prometheus -/example/view/view /example/zipkin/zipkin diff --git a/vendor/go.opentelemetry.io/otel/.gitmodules b/vendor/go.opentelemetry.io/otel/.gitmodules deleted file mode 100644 index 38a1f5698..000000000 --- a/vendor/go.opentelemetry.io/otel/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "opentelemetry-proto"] - path = exporters/otlp/internal/opentelemetry-proto - url = https://github.com/open-telemetry/opentelemetry-proto diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml index a62511f38..6d9c8b649 100644 --- a/vendor/go.opentelemetry.io/otel/.golangci.yml +++ b/vendor/go.opentelemetry.io/otel/.golangci.yml @@ -11,6 +11,7 @@ linters: enable: - depguard - errcheck + - errorlint - godot - gofumpt - goimports @@ -21,8 +22,11 @@ linters: - misspell - revive - staticcheck + - tenv - typecheck + - unconvert - unused + - unparam issues: # Maximum issues count per one linter. @@ -124,6 +128,8 @@ linters-settings: - "**/example/**/*.go" - "**/trace/*.go" - "**/trace/**/*.go" + - "**/log/*.go" + - "**/log/**/*.go" deny: - pkg: "go.opentelemetry.io/otel/internal$" desc: Do not use cross-module internal packages. diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md index c4e7ad475..c01e6998e 100644 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -8,9 +8,291 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.28.0/0.50.0/0.4.0] 2024-07-02 + +### Added + +- The `IsEmpty` method is added to the `Instrument` type in `go.opentelemetry.io/otel/sdk/metric`. + This method is used to check if an `Instrument` instance is a zero-value. (#5431) +- Store and provide the emitted `context.Context` in `ScopeRecords` of `go.opentelemetry.io/otel/sdk/log/logtest`. (#5468) +- The `go.opentelemetry.io/otel/semconv/v1.26.0` package. + The package contains semantic conventions from the `v1.26.0` version of the OpenTelemetry Semantic Conventions. (#5476) +- The `AssertRecordEqual` method to `go.opentelemetry.io/otel/log/logtest` to allow comparison of two log records in tests. (#5499) +- The `WithHeaders` option to `go.opentelemetry.io/otel/exporters/zipkin` to allow configuring custom http headers while exporting spans. (#5530) + +### Changed + +- `Tracer.Start` in `go.opentelemetry.io/otel/trace/noop` no longer allocates a span for empty span context. (#5457) +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/example/otel-collector`. (#5490) +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/example/zipkin`. (#5490) +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/exporters/zipkin`. (#5490) + - The exporter no longer exports the deprecated "otel.library.name" or "otel.library.version" attributes. +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/sdk/resource`. (#5490) +- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/sdk/trace`. (#5490) +- `SimpleProcessor.OnEmit` in `go.opentelemetry.io/otel/sdk/log` no longer allocates a slice which makes it possible to have a zero-allocation log processing using `SimpleProcessor`. (#5493) +- Use non-generic functions in the `Start` method of `"go.opentelemetry.io/otel/sdk/trace".Trace` to reduce memory allocation. (#5497) +- `service.instance.id` is populated for a `Resource` created with `"go.opentelemetry.io/otel/sdk/resource".Default` with a default value when `OTEL_GO_X_RESOURCE` is set. (#5520) +- Improve performance of metric instruments in `go.opentelemetry.io/otel/sdk/metric` by removing unnecessary calls to `time.Now`. (#5545) + +### Fixed + +- Log a warning to the OpenTelemetry internal logger when a `Record` in `go.opentelemetry.io/otel/sdk/log` drops an attribute due to a limit being reached. (#5376) +- Identify the `Tracer` returned from the global `TracerProvider` in `go.opentelemetry.io/otel/global` with its schema URL. (#5426) +- Identify the `Meter` returned from the global `MeterProvider` in `go.opentelemetry.io/otel/global` with its schema URL. (#5426) +- Log a warning to the OpenTelemetry internal logger when a `Span` in `go.opentelemetry.io/otel/sdk/trace` drops an attribute, event, or link due to a limit being reached. (#5434) +- Document instrument name requirements in `go.opentelemetry.io/otel/metric`. (#5435) +- Prevent random number generation data-race for experimental rand exemplars in `go.opentelemetry.io/otel/sdk/metric`. (#5456) +- Fix counting number of dropped attributes of `Record` in `go.opentelemetry.io/otel/sdk/log`. (#5464) +- Fix panic in baggage creation when a member contains `0x80` char in key or value. (#5494) +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#5508) +- Retry trace and span ID generation if it generated an invalid one in `go.opentelemetry.io/otel/sdk/trace`. (#5514) +- Fix stale timestamps reported by the last-value aggregation. (#5517) +- Indicate the `Exporter` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` must be created by the `New` method. (#5521) +- Improved performance in all `{Bool,Int64,Float64,String}SliceValue` functions of `go.opentelemetry.io/attributes` by reducing the number of allocations. (#5549) + +## [1.27.0/0.49.0/0.3.0] 2024-05-21 + +### Added + +- Add example for `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#5242) +- Add `RecordFactory` in `go.opentelemetry.io/otel/sdk/log/logtest` to facilitate testing exporter and processor implementations. (#5258) +- Add `RecordFactory` in `go.opentelemetry.io/otel/log/logtest` to facilitate testing bridge implementations. (#5263) +- The count of dropped records from the `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` is logged. (#5276) +- Add metrics in the `otel-collector` example. (#5283) +- Add the synchronous gauge instrument to `go.opentelemetry.io/otel/metric`. (#5304) + - An `int64` or `float64` synchronous gauge instrument can now be created from a `Meter`. + - All implementations of the API (`go.opentelemetry.io/otel/metric/noop`, `go.opentelemetry.io/otel/sdk/metric`) are updated to support this instrument. +- Add logs to `go.opentelemetry.io/otel/example/dice`. (#5349) + +### Changed + +- The `Shutdown` method of `Exporter` in `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` ignores the context cancellation and always returns `nil`. (#5189) +- The `ForceFlush` and `Shutdown` methods of the exporter returned by `New` in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` ignore the context cancellation and always return `nil`. (#5189) +- Apply the value length limits to `Record` attributes in `go.opentelemetry.io/otel/sdk/log`. (#5230) +- De-duplicate map attributes added to a `Record` in `go.opentelemetry.io/otel/sdk/log`. (#5230) +- `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` won't print timestamps when `WithoutTimestamps` option is set. (#5241) +- The `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` exporter won't print `AttributeValueLengthLimit` and `AttributeCountLimit` fields now, instead it prints the `DroppedAttributes` field. (#5272) +- Improved performance in the `Stringer` implementation of `go.opentelemetry.io/otel/baggage.Member` by reducing the number of allocations. (#5286) +- Set the start time for last-value aggregates in `go.opentelemetry.io/otel/sdk/metric`. (#5305) +- The `Span` in `go.opentelemetry.io/otel/sdk/trace` will record links without span context if either non-empty `TraceState` or attributes are provided. (#5315) +- Upgrade all dependencies of `go.opentelemetry.io/otel/semconv/v1.24.0` to `go.opentelemetry.io/otel/semconv/v1.25.0`. (#5374) + +### Fixed + +- Comparison of unordered maps for `go.opentelemetry.io/otel/log.KeyValue` and `go.opentelemetry.io/otel/log.Value`. (#5306) +- Fix the empty output of `go.opentelemetry.io/otel/log.Value` in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#5311) +- Split the behavior of `Recorder` in `go.opentelemetry.io/otel/log/logtest` so it behaves as a `LoggerProvider` only. (#5365) +- Fix wrong package name of the error message when parsing endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5371) +- Identify the `Logger` returned from the global `LoggerProvider` in `go.opentelemetry.io/otel/log/global` with its schema URL. (#5375) + +## [1.26.0/0.48.0/0.2.0-alpha] 2024-04-24 + +### Added + +- Add `Recorder` in `go.opentelemetry.io/otel/log/logtest` to facilitate testing the log bridge implementations. (#5134) +- Add span flags to OTLP spans and links exported by `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#5194) +- Make the initial alpha release of `go.opentelemetry.io/otel/sdk/log`. + This new module contains the Go implementation of the OpenTelemetry Logs SDK. + This module is unstable and breaking changes may be introduced. + See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240) +- Make the initial alpha release of `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. + This new module contains an OTLP exporter that transmits log telemetry using HTTP. + This module is unstable and breaking changes may be introduced. + See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240) +- Make the initial alpha release of `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. + This new module contains an exporter prints log records to STDOUT. + This module is unstable and breaking changes may be introduced. + See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240) +- The `go.opentelemetry.io/otel/semconv/v1.25.0` package. + The package contains semantic conventions from the `v1.25.0` version of the OpenTelemetry Semantic Conventions. (#5254) + +### Changed + +- Update `go.opentelemetry.io/proto/otlp` from v1.1.0 to v1.2.0. (#5177) +- Improve performance of baggage member character validation in `go.opentelemetry.io/otel/baggage`. (#5214) +- The `otel-collector` example now uses docker compose to bring up services instead of kubernetes. (#5244) + +### Fixed + +- Slice attribute values in `go.opentelemetry.io/otel/attribute` are now emitted as their JSON representation. (#5159) + +## [1.25.0/0.47.0/0.0.8/0.1.0-alpha] 2024-04-05 + +### Added + +- Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4906) +- Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp`. (#4906) +- Add `AddLink` method to the `Span` interface in `go.opentelemetry.io/otel/trace`. (#5032) +- The `Enabled` method is added to the `Logger` interface in `go.opentelemetry.io/otel/log`. + This method is used to notify users if a log record will be emitted or not. (#5071) +- Add `SeverityUndefined` `const` to `go.opentelemetry.io/otel/log`. + This value represents an unset severity level. (#5072) +- Add `Empty` function in `go.opentelemetry.io/otel/log` to return a `KeyValue` for an empty value. (#5076) +- Add `go.opentelemetry.io/otel/log/global` to manage the global `LoggerProvider`. + This package is provided with the anticipation that all functionality will be migrate to `go.opentelemetry.io/otel` when `go.opentelemetry.io/otel/log` stabilizes. + At which point, users will be required to migrage their code, and this package will be deprecated then removed. (#5085) +- Add support for `Summary` metrics in the `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` exporters. (#5100) +- Add `otel.scope.name` and `otel.scope.version` tags to spans exported by `go.opentelemetry.io/otel/exporters/zipkin`. (#5108) +- Add support for `AddLink` to `go.opentelemetry.io/otel/bridge/opencensus`. (#5116) +- Add `String` method to `Value` and `KeyValue` in `go.opentelemetry.io/otel/log`. (#5117) +- Add Exemplar support to `go.opentelemetry.io/otel/exporters/prometheus`. (#5111) +- Add metric semantic conventions to `go.opentelemetry.io/otel/semconv/v1.24.0`. Future `semconv` packages will include metric semantic conventions as well. (#4528) + +### Changed + +- `SpanFromContext` and `SpanContextFromContext` in `go.opentelemetry.io/otel/trace` no longer make a heap allocation when the passed context has no span. (#5049) +- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` now create a gRPC client in idle mode and with "dns" as the default resolver using [`grpc.NewClient`](https://pkg.go.dev/google.golang.org/grpc#NewClient). (#5151) + Because of that `WithDialOption` ignores [`grpc.WithBlock`](https://pkg.go.dev/google.golang.org/grpc#WithBlock), [`grpc.WithTimeout`](https://pkg.go.dev/google.golang.org/grpc#WithTimeout), and [`grpc.WithReturnConnectionError`](https://pkg.go.dev/google.golang.org/grpc#WithReturnConnectionError). + Notice that [`grpc.DialContext`](https://pkg.go.dev/google.golang.org/grpc#DialContext) which was used before is now deprecated. + +### Fixed + +- Clarify the documentation about equivalence guarantees for the `Set` and `Distinct` types in `go.opentelemetry.io/otel/attribute`. (#5027) +- Prevent default `ErrorHandler` self-delegation. (#5137) +- Update all dependencies to address [GO-2024-2687]. (#5139) + +### Removed + +- Drop support for [Go 1.20]. (#4967) + +### Deprecated + +- Deprecate `go.opentelemetry.io/otel/attribute.Sortable` type. (#4734) +- Deprecate `go.opentelemetry.io/otel/attribute.NewSetWithSortable` function. (#4734) +- Deprecate `go.opentelemetry.io/otel/attribute.NewSetWithSortableFiltered` function. (#4734) + +## [1.24.0/0.46.0/0.0.1-alpha] 2024-02-23 + +This release is the last to support [Go 1.20]. +The next release will require at least [Go 1.21]. + +### Added + +- Support [Go 1.22]. (#4890) +- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4900) +- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900) +- The `go.opentelemetry.io/otel/log` module is added. + This module includes OpenTelemetry Go's implementation of the Logs Bridge API. + This module is in an alpha state, it is subject to breaking changes. + See our [versioning policy](./VERSIONING.md) for more info. (#4961) +- ARM64 platform to the compatibility testing suite. (#4994) + +### Fixed + +- Fix registration of multiple callbacks when using the global meter provider from `go.opentelemetry.io/otel`. (#4945) +- Fix negative buckets in output of exponential histograms. (#4956) + +## [1.23.1] 2024-02-07 + +### Fixed + +- Register all callbacks passed during observable instrument creation instead of just the last one multiple times in `go.opentelemetry.io/otel/sdk/metric`. (#4888) + +## [1.23.0] 2024-02-06 + +This release contains the first stable, `v1`, release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +### Added + +- Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) +- Experimental exemplar exporting is added to the metric SDK. + See [metric documentation](./sdk/metric/internal/x/README.md#exemplars) for more information about this feature and how to enable it. (#4871) +- `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`. + This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attempted. (#4876) + +### Changed + +- The `Merge` and `New` functions in `go.opentelemetry.io/otel/sdk/resource` now returns a partial result if there is a schema URL merge conflict. + Instead of returning `nil` when two `Resource`s with different (non-empty) schema URLs are merged the merged `Resource`, along with the new `ErrSchemaURLConflict` error, is returned. + It is up to the user to decide if they want to use the returned `Resource` or not. + It may have desired attributes overwritten or include stale semantic conventions. (#4876) + +### Fixed + +- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) +- Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820) +- Fix missing `Mix` and `Max` values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for the `Extrema` type in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827) + +## [1.23.0-rc.1] 2024-01-18 + +This is a release candidate for the v1.23.0 release. +That release is expected to include the `v1` release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +## [1.22.0/0.45.0] 2024-01-17 + +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.22.0` package. + The package contains semantic conventions from the `v1.22.0` version of the OpenTelemetry Semantic Conventions. (#4735) +- The `go.opentelemetry.io/otel/semconv/v1.23.0` package. + The package contains semantic conventions from the `v1.23.0` version of the OpenTelemetry Semantic Conventions. (#4746) +- The `go.opentelemetry.io/otel/semconv/v1.23.1` package. + The package contains semantic conventions from the `v1.23.1` version of the OpenTelemetry Semantic Conventions. (#4749) +- The `go.opentelemetry.io/otel/semconv/v1.24.0` package. + The package contains semantic conventions from the `v1.24.0` version of the OpenTelemetry Semantic Conventions. (#4770) +- Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) +- Experimental cardinality limiting is added to the metric SDK. + See [metric documentation](./sdk/metric/internal/x/README.md#cardinality-limit) for more information about this feature and how to enable it. (#4457) +- Add `NewMemberRaw` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage`. (#4804) + +### Changed + +- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.24.0`. (#4754) +- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.24.0` version of the OpenTelemetry specification. (#4754) +- Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`. + If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671) +- Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) +- Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) +- Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) +- Improve performance of the `(*Set).Filter` method in `go.opentelemetry.io/otel/attribute` when the passed filter does not filter out any attributes from the set. (#4774) +- `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775) +- Improve `go.opentelemetry.io/otel/trace.Span`'s performance when adding multiple attributes. (#4818) +- `Property.Value` in `go.opentelemetry.io/otel/baggage` now returns a raw string instead of a percent-encoded value. (#4804) + +### Fixed + +- Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) +- Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756) +- Fix observable not registered error when the asynchronous instrument has a drop aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#4772) +- Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776) +- Fix `go.opentelemetry.io/otel/bridge/opentracing` to properly handle baggage values that requires escaping during propagation. (#4804) +- Fix a bug where using multiple readers resulted in incorrect asynchronous counter values in `go.opentelemetry.io/otel/sdk/metric`. (#4742) + +## [1.21.0/0.44.0] 2023-11-16 + +### Removed + +- Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) +- Remove the deprecated `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` module. (#4707) +- Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) +- Remove the deprecated `go.opentelemetry.io/otel/example/fib` module. (#4723) + +### Fixed + +- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4719) +- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4719) + ## [1.20.0/0.43.0] 2023-11-10 -This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementors need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. +This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementers need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. ### Added @@ -42,15 +324,15 @@ This release brings a breaking change for custom trace API implementations. Some - `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583) - The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type. This extends the `TracerProvider` interface and is is a breaking change for any existing implementation. - Implementors need to update their implementations based on what they want the default behavior of the interface to be. + Implementers need to update their implementations based on what they want the default behavior of the interface to be. See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) - The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type. This extends the `Tracer` interface and is is a breaking change for any existing implementation. - Implementors need to update their implementations based on what they want the default behavior of the interface to be. + Implementers need to update their implementations based on what they want the default behavior of the interface to be. See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) - The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type. This extends the `Span` interface and is is a breaking change for any existing implementation. - Implementors need to update their implementations based on what they want the default behavior of the interface to be. + Implementers need to update their implementations based on what they want the default behavior of the interface to be. See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) @@ -686,7 +968,7 @@ The next release will require at least [Go 1.19]. - Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) - `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436) - Re-enabled Attribute Filters in the Metric SDK. (#3396) -- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408) +- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggregation. (#3408) - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) - Prevent duplicate Prometheus description, unit, and type. (#3469) @@ -1731,7 +2013,7 @@ with major version 0. - `NewExporter` from `exporters/otlp` now takes a `ProtocolDriver` as a parameter. (#1369) - Many OTLP Exporter options became gRPC ProtocolDriver options. (#1369) - Unify endpoint API that related to OTel exporter. (#1401) -- Optimize metric histogram aggregator to re-use its slice of buckets. (#1435) +- Optimize metric histogram aggregator to reuse its slice of buckets. (#1435) - Metric aggregator Count() and histogram Bucket.Counts are consistently `uint64`. (1430) - Histogram aggregator accepts functional options, uses default boundaries if none given. (#1434) - `SamplingResult` now passed a `Tracestate` from the parent `SpanContext` (#1432) @@ -2721,7 +3003,17 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.20.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.28.0...HEAD +[1.28.0/0.50.0/0.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.28.0 +[1.27.0/0.49.0/0.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.27.0 +[1.26.0/0.48.0/0.2.0-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.26.0 +[1.25.0/0.47.0/0.0.8/0.1.0-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.25.0 +[1.24.0/0.46.0/0.0.1-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.24.0 +[1.23.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.1 +[1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0 +[1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 +[1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 +[1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 [1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 [1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 [1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 @@ -2794,6 +3086,8 @@ It contains api and sdk for trace and meter. [0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1 [0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 +[Go 1.22]: https://go.dev/doc/go1.22 +[Go 1.21]: https://go.dev/doc/go1.21 [Go 1.20]: https://go.dev/doc/go1.20 [Go 1.19]: https://go.dev/doc/go1.19 [Go 1.18]: https://go.dev/doc/go1.18 @@ -2801,3 +3095,5 @@ It contains api and sdk for trace and meter. [metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric [metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric [trace API]:https://pkg.go.dev/go.opentelemetry.io/otel/trace + +[GO-2024-2687]: https://pkg.go.dev/vuln/GO-2024-2687 diff --git a/vendor/go.opentelemetry.io/otel/CODEOWNERS b/vendor/go.opentelemetry.io/otel/CODEOWNERS index 623740007..202554933 100644 --- a/vendor/go.opentelemetry.io/otel/CODEOWNERS +++ b/vendor/go.opentelemetry.io/otel/CODEOWNERS @@ -12,6 +12,6 @@ # https://help.github.com/en/articles/about-code-owners # -* @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu +* @MrAlias @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu -CODEOWNERS @MrAlias @MadVikingGod @pellared \ No newline at end of file +CODEOWNERS @MrAlias @MadVikingGod @pellared @dashpole @XSAM @dmathieu diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md index a00dbca7b..b86572f58 100644 --- a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md +++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md @@ -90,6 +90,10 @@ git push Open a pull request against the main `opentelemetry-go` repo. Be sure to add the pull request ID to the entry you added to `CHANGELOG.md`. +Avoid rebasing and force-pushing to your branch to facilitate reviewing the pull request. +Rewriting Git history makes it difficult to keep track of iterations during code review. +All pull requests are squashed to a single commit upon merge to `main`. + ### How to Receive Comments * If the PR is not ready for review, please put `[WIP]` in the title, @@ -197,6 +201,16 @@ You can install and run a "local Go Doc site" in the following way: [`go.opentelemetry.io/otel/metric`](https://pkg.go.dev/go.opentelemetry.io/otel/metric) is an example of a very well-documented package. +### README files + +Each (non-internal, non-test, non-documentation) package must contain a +`README.md` file containing at least a title, and a `pkg.go.dev` badge. + +The README should not be a repetition of Go doc comments. + +You can verify the presence of all README files with the `make verify-readmes` +command. + ## Style Guide One of the primary goals of this project is that it is actually used by @@ -556,6 +570,9 @@ functionality should be added, each one will need their own super-set interfaces and will duplicate the pattern. For this reason, the simple targeted interface that defines the specific functionality should be preferred. +See also: +[Keeping Your Modules Compatible: Working with interfaces](https://go.dev/blog/module-compatibility#working-with-interfaces). + ### Testing The tests should never leak goroutines. @@ -587,27 +604,48 @@ this. [^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548 +### Ignoring context cancellation + +OpenTelemetry API implementations need to ignore the cancellation of the context that are +passed when recording a value (e.g. starting a span, recording a measurement, emitting a log). +Recording methods should not return an error describing the cancellation state of the context +when they complete, nor should they abort any work. + +This rule may not apply if the OpenTelemetry specification defines a timeout mechanism for +the method. In that case the context cancellation can be used for the timeout with the +restriction that this behavior is documented for the method. Otherwise, timeouts +are expected to be handled by the user calling the API, not the implementation. + +Stoppage of the telemetry pipeline is handled by calling the appropriate `Shutdown` method +of a provider. It is assumed the context passed from a user is not used for this purpose. + +Outside of the direct recording of telemetry from the API (e.g. exporting telemetry, +force flushing telemetry, shutting down a signal provider) the context cancellation +should be honored. This means all work done on behalf of the user provided context +should be canceled. + ## Approvers and Maintainers ### Approvers -- [Evan Torrie](https://github.com/evantorrie), Verizon Media -- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics -- [David Ashpole](https://github.com/dashpole), Google - [Chester Cheung](https://github.com/hanyuancheung), Tencent -- [Damien Mathieu](https://github.com/dmathieu), Elastic -- [Anthony Mirabella](https://github.com/Aneurysm9), AWS ### Maintainers - [Aaron Clawson](https://github.com/MadVikingGod), LightStep +- [Damien Mathieu](https://github.com/dmathieu), Elastic +- [David Ashpole](https://github.com/dashpole), Google - [Robert Pająk](https://github.com/pellared), Splunk +- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics - [Tyler Yahn](https://github.com/MrAlias), Splunk ### Emeritus +- [Liz Fong-Jones](https://github.com/lizthegrey), Honeycomb - [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep - [Josh MacDonald](https://github.com/jmacd), LightStep +- [Anthony Mirabella](https://github.com/Aneurysm9), AWS +- [Evan Torrie](https://github.com/evantorrie), Yahoo ### Become an Approver or a Maintainer diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile index 35fc18996..f33619f76 100644 --- a/vendor/go.opentelemetry.io/otel/Makefile +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -1,16 +1,5 @@ # Copyright The OpenTelemetry Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# SPDX-License-Identifier: Apache-2.0 TOOLS_MOD_DIR := ./internal/tools @@ -25,8 +14,8 @@ TIMEOUT = 60 .DEFAULT_GOAL := precommit .PHONY: precommit ci -precommit: generate dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default -ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage +precommit: generate license-check misspell go-mod-tidy golangci-lint-fix verify-readmes verify-mods test-default +ci: generate license-check lint vanity-import-check verify-readmes verify-mods build test-default check-clean-work-tree test-coverage # Tools @@ -34,7 +23,7 @@ TOOLS = $(CURDIR)/.tools $(TOOLS): @mkdir -p $@ -$(TOOLS)/%: | $(TOOLS) +$(TOOLS)/%: $(TOOLS_MOD_DIR)/go.mod | $(TOOLS) cd $(TOOLS_MOD_DIR) && \ $(GO) build -o $@ $(PACKAGE) @@ -50,9 +39,6 @@ $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink SEMCONVKIT = $(TOOLS)/semconvkit $(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit -DBOTCONF = $(TOOLS)/dbotconf -$(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/build-tools/dbotconf - GOLANGCI_LINT = $(TOOLS)/golangci-lint $(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint @@ -81,7 +67,7 @@ GOVULNCHECK = $(TOOLS)/govulncheck $(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck .PHONY: tools -tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) +tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) # Virtualized python tools via docker @@ -110,7 +96,7 @@ $(PYTOOLS): @$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip" # Install python packages into the virtual environment. -$(PYTOOLS)/%: | $(PYTOOLS) +$(PYTOOLS)/%: $(PYTOOLS) @$(DOCKERPY) $(PIP) install -r requirements.txt CODESPELL = $(PYTOOLS)/codespell @@ -124,18 +110,18 @@ generate: go-generate vanity-import-fix .PHONY: go-generate go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) go-generate/%: DIR=$* -go-generate/%: | $(STRINGER) $(GOTMPL) +go-generate/%: $(STRINGER) $(GOTMPL) @echo "$(GO) generate $(DIR)/..." \ && cd $(DIR) \ && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... .PHONY: vanity-import-fix -vanity-import-fix: | $(PORTO) +vanity-import-fix: $(PORTO) @$(PORTO) --include-internal -w . # Generate go.work file for local development. .PHONY: go-work -go-work: | $(CROSSLINK) +go-work: $(CROSSLINK) $(CROSSLINK) work --root=$(shell pwd) # Build @@ -178,7 +164,7 @@ test/%: COVERAGE_MODE = atomic COVERAGE_PROFILE = coverage.out .PHONY: test-coverage -test-coverage: | $(GOCOVMERGE) +test-coverage: $(GOCOVMERGE) @set -e; \ printf "" > coverage.txt; \ for dir in $(ALL_COVERAGE_MOD_DIRS); do \ @@ -192,7 +178,7 @@ test-coverage: | $(GOCOVMERGE) done; \ $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt -# Adding a directory will include all benchmarks in that direcotry if a filter is not specified. +# Adding a directory will include all benchmarks in that directory if a filter is not specified. BENCHMARK_TARGETS := sdk/trace .PHONY: benchmark benchmark: $(BENCHMARK_TARGETS:%=benchmark/%) @@ -209,23 +195,23 @@ golangci-lint-fix: ARGS=--fix golangci-lint-fix: golangci-lint golangci-lint: $(OTEL_GO_MOD_DIRS:%=golangci-lint/%) golangci-lint/%: DIR=$* -golangci-lint/%: | $(GOLANGCI_LINT) +golangci-lint/%: $(GOLANGCI_LINT) @echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \ && cd $(DIR) \ && $(GOLANGCI_LINT) run --allow-serial-runners $(ARGS) .PHONY: crosslink -crosslink: | $(CROSSLINK) +crosslink: $(CROSSLINK) @echo "Updating intra-repository dependencies in all go modules" \ && $(CROSSLINK) --root=$(shell pwd) --prune .PHONY: go-mod-tidy go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%) go-mod-tidy/%: DIR=$* -go-mod-tidy/%: | crosslink +go-mod-tidy/%: crosslink @echo "$(GO) mod tidy in $(DIR)" \ && cd $(DIR) \ - && $(GO) mod tidy -compat=1.20 + && $(GO) mod tidy -compat=1.21 .PHONY: lint-modules lint-modules: go-mod-tidy @@ -234,23 +220,23 @@ lint-modules: go-mod-tidy lint: misspell lint-modules golangci-lint govulncheck .PHONY: vanity-import-check -vanity-import-check: | $(PORTO) +vanity-import-check: $(PORTO) @$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 ) .PHONY: misspell -misspell: | $(MISSPELL) +misspell: $(MISSPELL) @$(MISSPELL) -w $(ALL_DOCS) .PHONY: govulncheck govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%) govulncheck/%: DIR=$* -govulncheck/%: | $(GOVULNCHECK) +govulncheck/%: $(GOVULNCHECK) @echo "govulncheck ./... in $(DIR)" \ && cd $(DIR) \ && $(GOVULNCHECK) ./... .PHONY: codespell -codespell: | $(CODESPELL) +codespell: $(CODESPELL) @$(DOCKERPY) $(CODESPELL) .PHONY: license-check @@ -263,15 +249,6 @@ license-check: exit 1; \ fi -DEPENDABOT_CONFIG = .github/dependabot.yml -.PHONY: dependabot-check -dependabot-check: | $(DBOTCONF) - @$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || ( echo "(run: make dependabot-generate)"; exit 1 ) - -.PHONY: dependabot-generate -dependabot-generate: | $(DBOTCONF) - @$(DBOTCONF) generate > $(DEPENDABOT_CONFIG) - .PHONY: check-clean-work-tree check-clean-work-tree: @if ! git diff --quiet; then \ @@ -284,13 +261,11 @@ check-clean-work-tree: SEMCONVPKG ?= "semconv/" .PHONY: semconv-generate -semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) +semconv-generate: $(SEMCONVGEN) $(SEMCONVKIT) [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 ) [ "$(OTEL_SEMCONV_REPO)" ] || ( echo "OTEL_SEMCONV_REPO unset: missing path to opentelemetry semantic-conventions repo"; exit 1 ) - $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=metric -f metric.go -t "$(SEMCONVPKG)/metric_template.j2" -s "$(TAG)" $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" .PHONY: gorelease @@ -302,17 +277,25 @@ gorelease/%:| $(GORELEASE) && $(GORELEASE) \ || echo "" +.PHONY: verify-mods +verify-mods: $(MULTIMOD) + $(MULTIMOD) verify + .PHONY: prerelease -prerelease: | $(MULTIMOD) +prerelease: verify-mods @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) - $(MULTIMOD) verify && $(MULTIMOD) prerelease -m ${MODSET} + $(MULTIMOD) prerelease -m ${MODSET} COMMIT ?= "HEAD" .PHONY: add-tags -add-tags: | $(MULTIMOD) +add-tags: verify-mods @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) - $(MULTIMOD) verify && $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} + $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} .PHONY: lint-markdown -lint-markdown: - docker run -v "$(CURDIR):$(WORKDIR)" docker://avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md +lint-markdown: + docker run -v "$(CURDIR):$(WORKDIR)" avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md + +.PHONY: verify-readmes +verify-readmes: + ./verify_readmes.sh diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md index 2c5b0cc28..5a8909317 100644 --- a/vendor/go.opentelemetry.io/otel/README.md +++ b/vendor/go.opentelemetry.io/otel/README.md @@ -11,14 +11,11 @@ It provides a set of APIs to directly measure performance and behavior of your s ## Project Status -| Signal | Status | -|---------|------------| -| Traces | Stable | -| Metrics | Stable | -| Logs | Design [1] | - -- [1]: Currently the logs signal development is in a design phase ([#4696](https://github.com/open-telemetry/opentelemetry-go/issues/4696)). - No Logs Pull Requests are currently being accepted. +| Signal | Status | +|---------|--------------------| +| Traces | Stable | +| Metrics | Stable | +| Logs | Beta[^1] | Progress and status specific to this repository is tracked in our [project boards](https://github.com/open-telemetry/opentelemetry-go/projects) @@ -28,6 +25,8 @@ and Project versioning information and stability guarantees can be found in the [versioning documentation](VERSIONING.md). +[^1]: https://github.com/orgs/open-telemetry/projects/43 + ### Compatibility OpenTelemetry-Go ensures compatibility with the current supported versions of @@ -50,23 +49,25 @@ Currently, this project supports the following environments. | OS | Go Version | Architecture | |---------|------------|--------------| +| Ubuntu | 1.22 | amd64 | | Ubuntu | 1.21 | amd64 | -| Ubuntu | 1.20 | amd64 | +| Ubuntu | 1.22 | 386 | | Ubuntu | 1.21 | 386 | -| Ubuntu | 1.20 | 386 | +| Linux | 1.22 | arm64 | +| Linux | 1.21 | arm64 | +| MacOS | 1.22 | amd64 | | MacOS | 1.21 | amd64 | -| MacOS | 1.20 | amd64 | +| Windows | 1.22 | amd64 | | Windows | 1.21 | amd64 | -| Windows | 1.20 | amd64 | +| Windows | 1.22 | 386 | | Windows | 1.21 | 386 | -| Windows | 1.20 | 386 | While this project should work for other systems, no compatibility guarantees are made for those systems currently. ## Getting Started -You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/go/getting-started/). +You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/languages/go/getting-started/). OpenTelemetry's goal is to provide a single set of APIs to capture distributed traces and metrics from your application and send them to an observability @@ -96,12 +97,12 @@ export pipeline to send that telemetry to an observability platform. All officially supported exporters for the OpenTelemetry project are contained in the [exporters directory](./exporters). -| Exporter | Metrics | Traces | -|---------------------------------------|:-------:|:------:| -| [OTLP](./exporters/otlp/) | ✓ | ✓ | -| [Prometheus](./exporters/prometheus/) | ✓ | | -| [stdout](./exporters/stdout/) | ✓ | ✓ | -| [Zipkin](./exporters/zipkin/) | | ✓ | +| Exporter | Logs | Metrics | Traces | +|---------------------------------------|:----:|:-------:|:------:| +| [OTLP](./exporters/otlp/) | ✓ | ✓ | ✓ | +| [Prometheus](./exporters/prometheus/) | | ✓ | | +| [stdout](./exporters/stdout/) | ✓ | ✓ | ✓ | +| [Zipkin](./exporters/zipkin/) | | | ✓ | ## Contributing diff --git a/vendor/go.opentelemetry.io/otel/RELEASING.md b/vendor/go.opentelemetry.io/otel/RELEASING.md index 82ce3ee46..940f57f3d 100644 --- a/vendor/go.opentelemetry.io/otel/RELEASING.md +++ b/vendor/go.opentelemetry.io/otel/RELEASING.md @@ -27,6 +27,12 @@ You can run `make gorelease` that runs [gorelease](https://pkg.go.dev/golang.org You can check/report problems with `gorelease` [here](https://golang.org/issues/26420). +## Verify changes for contrib repository + +If the changes in the main repository are going to affect the contrib repository, it is important to verify that the changes are compatible with the contrib repository. + +Follow [the steps](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md#verify-otel-changes) in the contrib repository to verify OTel changes. + ## Pre-Release First, decide which module sets will be released and update their versions @@ -123,12 +129,12 @@ Once verified be sure to [make a release for the `contrib` repository](https://g ### Website Documentation -Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/instrumentation/go]. +Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/languages/go]. Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. [OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions -[Go instrumentation documentation]: https://opentelemetry.io/docs/instrumentation/go/ -[content/en/docs/instrumentation/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/instrumentation/go +[Go instrumentation documentation]: https://opentelemetry.io/docs/languages/go/ +[content/en/docs/languages/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/languages/go ### Demo Repository diff --git a/vendor/go.opentelemetry.io/otel/attribute/README.md b/vendor/go.opentelemetry.io/otel/attribute/README.md new file mode 100644 index 000000000..5b3da8f14 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/attribute/README.md @@ -0,0 +1,3 @@ +# Attribute + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/attribute)](https://pkg.go.dev/go.opentelemetry.io/otel/attribute) diff --git a/vendor/go.opentelemetry.io/otel/attribute/doc.go b/vendor/go.opentelemetry.io/otel/attribute/doc.go index dafe7424d..eef51ebc2 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/doc.go +++ b/vendor/go.opentelemetry.io/otel/attribute/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package attribute provides key and value attributes. package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/encoder.go b/vendor/go.opentelemetry.io/otel/attribute/encoder.go index fe2bc5766..318e42fca 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/encoder.go +++ b/vendor/go.opentelemetry.io/otel/attribute/encoder.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/filter.go b/vendor/go.opentelemetry.io/otel/attribute/filter.go index 638c213d5..be9cd922d 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/filter.go +++ b/vendor/go.opentelemetry.io/otel/attribute/filter.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/iterator.go b/vendor/go.opentelemetry.io/otel/attribute/iterator.go index 841b271fb..f2ba89ce4 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/iterator.go +++ b/vendor/go.opentelemetry.io/otel/attribute/iterator.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/key.go b/vendor/go.opentelemetry.io/otel/attribute/key.go index 0656a04e4..d9a22c650 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/key.go +++ b/vendor/go.opentelemetry.io/otel/attribute/key.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/kv.go b/vendor/go.opentelemetry.io/otel/attribute/kv.go index 1ddf3ce05..3028f9a40 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/kv.go +++ b/vendor/go.opentelemetry.io/otel/attribute/kv.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go index 9f9303d4f..bff9c7fdb 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/set.go +++ b/vendor/go.opentelemetry.io/otel/attribute/set.go @@ -1,24 +1,14 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package attribute // import "go.opentelemetry.io/otel/attribute" import ( + "cmp" "encoding/json" "reflect" + "slices" "sort" - "sync" ) type ( @@ -26,23 +16,33 @@ type ( // immutable set of attributes, with an internal cache for storing // attribute encodings. // - // This type supports the Equivalent method of comparison using values of - // type Distinct. + // This type will remain comparable for backwards compatibility. The + // equivalence of Sets across versions is not guaranteed to be stable. + // Prior versions may find two Sets to be equal or not when compared + // directly (i.e. ==), but subsequent versions may not. Users should use + // the Equals method to ensure stable equivalence checking. + // + // Users should also use the Distinct returned from Equivalent as a map key + // instead of a Set directly. In addition to that type providing guarantees + // on stable equivalence, it may also provide performance improvements. Set struct { equivalent Distinct } - // Distinct wraps a variable-size array of KeyValue, constructed with keys - // in sorted order. This can be used as a map key or for equality checking - // between Sets. + // Distinct is a unique identifier of a Set. + // + // Distinct is designed to be ensures equivalence stability: comparisons + // will return the save value across versions. For this reason, Distinct + // should always be used as a map key instead of a Set. Distinct struct { iface interface{} } - // Sortable implements sort.Interface, used for sorting KeyValue. This is - // an exported type to support a memory optimization. A pointer to one of - // these is needed for the call to sort.Stable(), which the caller may - // provide in order to avoid an allocation. See NewSetWithSortable(). + // Sortable implements sort.Interface, used for sorting KeyValue. + // + // Deprecated: This type is no longer used. It was added as a performance + // optimization for Go < 1.21 that is no longer needed (Go < 1.21 is no + // longer supported by the module). Sortable []KeyValue ) @@ -56,12 +56,6 @@ var ( iface: [0]KeyValue{}, }, } - - // sortables is a pool of Sortables used to create Sets with a user does - // not provide one. - sortables = sync.Pool{ - New: func() interface{} { return new(Sortable) }, - } ) // EmptySet returns a reference to a Set with no elements. @@ -187,13 +181,7 @@ func empty() Set { // Except for empty sets, this method adds an additional allocation compared // with calls that include a Sortable. func NewSet(kvs ...KeyValue) Set { - // Check for empty set. - if len(kvs) == 0 { - return empty() - } - srt := sortables.Get().(*Sortable) - s, _ := NewSetWithSortableFiltered(kvs, srt, nil) - sortables.Put(srt) + s, _ := NewSetWithFiltered(kvs, nil) return s } @@ -201,12 +189,10 @@ func NewSet(kvs ...KeyValue) Set { // NewSetWithSortableFiltered for more details. // // This call includes a Sortable option as a memory optimization. -func NewSetWithSortable(kvs []KeyValue, tmp *Sortable) Set { - // Check for empty set. - if len(kvs) == 0 { - return empty() - } - s, _ := NewSetWithSortableFiltered(kvs, tmp, nil) +// +// Deprecated: Use [NewSet] instead. +func NewSetWithSortable(kvs []KeyValue, _ *Sortable) Set { + s, _ := NewSetWithFiltered(kvs, nil) return s } @@ -220,10 +206,37 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { if len(kvs) == 0 { return empty(), nil } - srt := sortables.Get().(*Sortable) - s, filtered := NewSetWithSortableFiltered(kvs, srt, filter) - sortables.Put(srt) - return s, filtered + + // Stable sort so the following de-duplication can implement + // last-value-wins semantics. + slices.SortStableFunc(kvs, func(a, b KeyValue) int { + return cmp.Compare(a.Key, b.Key) + }) + + position := len(kvs) - 1 + offset := position - 1 + + // The requirements stated above require that the stable + // result be placed in the end of the input slice, while + // overwritten values are swapped to the beginning. + // + // De-duplicate with last-value-wins semantics. Preserve + // duplicate values at the beginning of the input slice. + for ; offset >= 0; offset-- { + if kvs[offset].Key == kvs[position].Key { + continue + } + position-- + kvs[offset], kvs[position] = kvs[position], kvs[offset] + } + kvs = kvs[position:] + + if filter != nil { + if div := filteredToFront(kvs, filter); div != 0 { + return Set{equivalent: computeDistinct(kvs[div:])}, kvs[:div] + } + } + return Set{equivalent: computeDistinct(kvs)}, nil } // NewSetWithSortableFiltered returns a new Set. @@ -249,82 +262,71 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { // // The second []KeyValue return value is a list of attributes that were // excluded by the Filter (if non-nil). -func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (Set, []KeyValue) { - // Check for empty set. - if len(kvs) == 0 { - return empty(), nil - } - - *tmp = kvs - - // Stable sort so the following de-duplication can implement - // last-value-wins semantics. - sort.Stable(tmp) - - *tmp = nil - - position := len(kvs) - 1 - offset := position - 1 - - // The requirements stated above require that the stable - // result be placed in the end of the input slice, while - // overwritten values are swapped to the beginning. - // - // De-duplicate with last-value-wins semantics. Preserve - // duplicate values at the beginning of the input slice. - for ; offset >= 0; offset-- { - if kvs[offset].Key == kvs[position].Key { - continue - } - position-- - kvs[offset], kvs[position] = kvs[position], kvs[offset] - } - if filter != nil { - return filterSet(kvs[position:], filter) - } - return Set{ - equivalent: computeDistinct(kvs[position:]), - }, nil +// +// Deprecated: Use [NewSetWithFiltered] instead. +func NewSetWithSortableFiltered(kvs []KeyValue, _ *Sortable, filter Filter) (Set, []KeyValue) { + return NewSetWithFiltered(kvs, filter) } -// filterSet reorders kvs so that included keys are contiguous at the end of -// the slice, while excluded keys precede the included keys. -func filterSet(kvs []KeyValue, filter Filter) (Set, []KeyValue) { - var excluded []KeyValue - - // Move attributes that do not match the filter so they're adjacent before - // calling computeDistinct(). - distinctPosition := len(kvs) - - // Swap indistinct keys forward and distinct keys toward the - // end of the slice. - offset := len(kvs) - 1 - for ; offset >= 0; offset-- { - if filter(kvs[offset]) { - distinctPosition-- - kvs[offset], kvs[distinctPosition] = kvs[distinctPosition], kvs[offset] - continue +// filteredToFront filters slice in-place using keep function. All KeyValues that need to +// be removed are moved to the front. All KeyValues that need to be kept are +// moved (in-order) to the back. The index for the first KeyValue to be kept is +// returned. +func filteredToFront(slice []KeyValue, keep Filter) int { + n := len(slice) + j := n + for i := n - 1; i >= 0; i-- { + if keep(slice[i]) { + j-- + slice[i], slice[j] = slice[j], slice[i] } } - excluded = kvs[:distinctPosition] - - return Set{ - equivalent: computeDistinct(kvs[distinctPosition:]), - }, excluded + return j } // Filter returns a filtered copy of this Set. See the documentation for // NewSetWithSortableFiltered for more details. func (l *Set) Filter(re Filter) (Set, []KeyValue) { if re == nil { - return Set{ - equivalent: l.equivalent, - }, nil + return *l, nil + } + + // Iterate in reverse to the first attribute that will be filtered out. + n := l.Len() + first := n - 1 + for ; first >= 0; first-- { + kv, _ := l.Get(first) + if !re(kv) { + break + } + } + + // No attributes will be dropped, return the immutable Set l and nil. + if first < 0 { + return *l, nil } - // Note: This could be refactored to avoid the temporary slice - // allocation, if it proves to be expensive. - return filterSet(l.ToSlice(), re) + // Copy now that we know we need to return a modified set. + // + // Do not do this in-place on the underlying storage of *Set l. Sets are + // immutable and filtering should not change this. + slice := l.ToSlice() + + // Don't re-iterate the slice if only slice[0] is filtered. + if first == 0 { + // It is safe to assume len(slice) >= 1 given we found at least one + // attribute above that needs to be filtered out. + return Set{equivalent: computeDistinct(slice[1:])}, slice[:1] + } + + // Move the filtered slice[first] to the front (preserving order). + kv := slice[first] + copy(slice[1:first+1], slice[:first]) + slice[0] = kv + + // Do not re-evaluate re(slice[first+1:]). + div := filteredToFront(slice[1:first+1], re) + 1 + return Set{equivalent: computeDistinct(slice[div:])}, slice[:div] } // computeDistinct returns a Distinct using either the fixed- or @@ -404,7 +406,7 @@ func (l *Set) MarshalJSON() ([]byte, error) { return json.Marshal(l.equivalent.iface) } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Set. func (l Set) MarshalLog() interface{} { kvs := make(map[string]string) for _, kv := range l.ToSlice() { diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go index cb21dd5c0..9ea0ecbbd 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/value.go +++ b/vendor/go.opentelemetry.io/otel/attribute/value.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package attribute // import "go.opentelemetry.io/otel/attribute" @@ -242,15 +231,27 @@ func (v Value) Emit() string { case BOOL: return strconv.FormatBool(v.AsBool()) case INT64SLICE: - return fmt.Sprint(v.asInt64Slice()) + j, err := json.Marshal(v.asInt64Slice()) + if err != nil { + return fmt.Sprintf("invalid: %v", v.asInt64Slice()) + } + return string(j) case INT64: return strconv.FormatInt(v.AsInt64(), 10) case FLOAT64SLICE: - return fmt.Sprint(v.asFloat64Slice()) + j, err := json.Marshal(v.asFloat64Slice()) + if err != nil { + return fmt.Sprintf("invalid: %v", v.asFloat64Slice()) + } + return string(j) case FLOAT64: return fmt.Sprint(v.AsFloat64()) case STRINGSLICE: - return fmt.Sprint(v.asStringSlice()) + j, err := json.Marshal(v.asStringSlice()) + if err != nil { + return fmt.Sprintf("invalid: %v", v.asStringSlice()) + } + return string(j) case STRING: return v.stringly default: diff --git a/vendor/go.opentelemetry.io/otel/baggage/README.md b/vendor/go.opentelemetry.io/otel/baggage/README.md new file mode 100644 index 000000000..7d798435e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/baggage/README.md @@ -0,0 +1,3 @@ +# Baggage + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/baggage)](https://pkg.go.dev/go.opentelemetry.io/otel/baggage) diff --git a/vendor/go.opentelemetry.io/otel/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/baggage/baggage.go index 84532cb1d..c40c896cc 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/baggage.go +++ b/vendor/go.opentelemetry.io/otel/baggage/baggage.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package baggage // import "go.opentelemetry.io/otel/baggage" @@ -18,8 +7,8 @@ import ( "errors" "fmt" "net/url" - "regexp" "strings" + "unicode/utf8" "go.opentelemetry.io/otel/internal/baggage" ) @@ -32,16 +21,6 @@ const ( listDelimiter = "," keyValueDelimiter = "=" propertyDelimiter = ";" - - keyDef = `([\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5a\x5e-\x7a\x7c\x7e]+)` - valueDef = `([\x21\x23-\x2b\x2d-\x3a\x3c-\x5B\x5D-\x7e]*)` - keyValueDef = `\s*` + keyDef + `\s*` + keyValueDelimiter + `\s*` + valueDef + `\s*` -) - -var ( - keyRe = regexp.MustCompile(`^` + keyDef + `$`) - valueRe = regexp.MustCompile(`^` + valueDef + `$`) - propertyRe = regexp.MustCompile(`^(?:\s*` + keyDef + `\s*|` + keyValueDef + `)$`) ) var ( @@ -67,7 +46,7 @@ type Property struct { // // If key is invalid, an error will be returned. func NewKeyProperty(key string) (Property, error) { - if !keyRe.MatchString(key) { + if !validateKey(key) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } @@ -77,14 +56,29 @@ func NewKeyProperty(key string) (Property, error) { // NewKeyValueProperty returns a new Property for key with value. // -// If key or value are invalid, an error will be returned. +// The passed key must be compliant with W3C Baggage specification. +// The passed value must be percent-encoded as defined in W3C Baggage specification. +// +// Notice: Consider using [NewKeyValuePropertyRaw] instead +// that does not require percent-encoding of the value. func NewKeyValueProperty(key, value string) (Property, error) { - if !keyRe.MatchString(key) { - return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + if !validateValue(value) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) } - if !valueRe.MatchString(value) { + decodedValue, err := url.PathUnescape(value) + if err != nil { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) } + return NewKeyValuePropertyRaw(key, decodedValue) +} + +// NewKeyValuePropertyRaw returns a new Property for key with value. +// +// The passed key must be compliant with W3C Baggage specification. +func NewKeyValuePropertyRaw(key, value string) (Property, error) { + if !validateKey(key) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + } p := Property{ key: key, @@ -106,20 +100,11 @@ func parseProperty(property string) (Property, error) { return newInvalidProperty(), nil } - match := propertyRe.FindStringSubmatch(property) - if len(match) != 4 { + p, ok := parsePropertyInternal(property) + if !ok { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property) } - var p Property - if match[1] != "" { - p.key = match[1] - } else { - p.key = match[2] - p.value = match[3] - p.hasValue = true - } - return p, nil } @@ -130,12 +115,9 @@ func (p Property) validate() error { return fmt.Errorf("invalid property: %w", err) } - if !keyRe.MatchString(p.key) { + if !validateKey(p.key) { return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) } - if p.hasValue && !valueRe.MatchString(p.value) { - return errFunc(fmt.Errorf("%w: %q", errInvalidValue, p.value)) - } if !p.hasValue && p.value != "" { return errFunc(errors.New("inconsistent value")) } @@ -154,11 +136,11 @@ func (p Property) Value() (string, bool) { return p.value, p.hasValue } -// String encodes Property into a string compliant with the W3C Baggage +// String encodes Property into a header string compliant with the W3C Baggage // specification. func (p Property) String() string { if p.hasValue { - return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, p.value) + return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, valueEscape(p.value)) } return p.key } @@ -218,7 +200,7 @@ func (p properties) validate() error { return nil } -// String encodes properties into a string compliant with the W3C Baggage +// String encodes properties into a header string compliant with the W3C Baggage // specification. func (p properties) String() string { props := make([]string, len(p)) @@ -240,11 +222,28 @@ type Member struct { hasData bool } -// NewMember returns a new Member from the passed arguments. The key will be -// used directly while the value will be url decoded after validation. An error -// is returned if the created Member would be invalid according to the W3C -// Baggage specification. +// NewMember returns a new Member from the passed arguments. +// +// The passed key must be compliant with W3C Baggage specification. +// The passed value must be percent-encoded as defined in W3C Baggage specification. +// +// Notice: Consider using [NewMemberRaw] instead +// that does not require percent-encoding of the value. func NewMember(key, value string, props ...Property) (Member, error) { + if !validateValue(value) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + decodedValue, err := url.PathUnescape(value) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + return NewMemberRaw(key, decodedValue, props...) +} + +// NewMemberRaw returns a new Member from the passed arguments. +// +// The passed key must be compliant with W3C Baggage specification. +func NewMemberRaw(key, value string, props ...Property) (Member, error) { m := Member{ key: key, value: value, @@ -254,11 +253,6 @@ func NewMember(key, value string, props ...Property) (Member, error) { if err := m.validate(); err != nil { return newInvalidMember(), err } - decodedValue, err := url.PathUnescape(value) - if err != nil { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) - } - m.value = decodedValue return m, nil } @@ -274,11 +268,7 @@ func parseMember(member string) (Member, error) { return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n) } - var ( - key, value string - props properties - ) - + var props properties keyValue, properties, found := strings.Cut(member, propertyDelimiter) if found { // Parse the member properties. @@ -299,36 +289,34 @@ func parseMember(member string) (Member, error) { } // "Leading and trailing whitespaces are allowed but MUST be trimmed // when converting the header into a data structure." - key = strings.TrimSpace(k) - var err error - value, err = url.PathUnescape(strings.TrimSpace(v)) - if err != nil { - return newInvalidMember(), fmt.Errorf("%w: %q", err, value) - } - if !keyRe.MatchString(key) { + key := strings.TrimSpace(k) + if !validateKey(key) { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) } - if !valueRe.MatchString(value) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + + val := strings.TrimSpace(v) + if !validateValue(val) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, v) } + // Decode a percent-encoded value. + value, err := url.PathUnescape(val) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %w", errInvalidValue, err) + } return Member{key: key, value: value, properties: props, hasData: true}, nil } // validate ensures m conforms to the W3C Baggage specification. -// A key is just an ASCII string, but a value must be URL encoded UTF-8, -// returning an error otherwise. +// A key must be an ASCII string, returning an error otherwise. func (m Member) validate() error { if !m.hasData { return fmt.Errorf("%w: %q", errInvalidMember, m) } - if !keyRe.MatchString(m.key) { + if !validateKey(m.key) { return fmt.Errorf("%w: %q", errInvalidKey, m.key) } - if !valueRe.MatchString(m.value) { - return fmt.Errorf("%w: %q", errInvalidValue, m.value) - } return m.properties.validate() } @@ -341,13 +329,15 @@ func (m Member) Value() string { return m.value } // Properties returns a copy of the Member properties. func (m Member) Properties() []Property { return m.properties.Copy() } -// String encodes Member into a string compliant with the W3C Baggage +// String encodes Member into a header string compliant with the W3C Baggage // specification. func (m Member) String() string { - // A key is just an ASCII string, but a value is URL encoded UTF-8. - s := fmt.Sprintf("%s%s%s", m.key, keyValueDelimiter, url.QueryEscape(m.value)) + // A key is just an ASCII string. A value is restricted to be + // US-ASCII characters excluding CTLs, whitespace, + // DQUOTE, comma, semicolon, and backslash. + s := m.key + keyValueDelimiter + valueEscape(m.value) if len(m.properties) > 0 { - s = fmt.Sprintf("%s%s%s", s, propertyDelimiter, m.properties.String()) + s += propertyDelimiter + m.properties.String() } return s } @@ -536,9 +526,8 @@ func (b Baggage) Len() int { return len(b.list) } -// String encodes Baggage into a string compliant with the W3C Baggage -// specification. The returned string will be invalid if the Baggage contains -// any invalid list-members. +// String encodes Baggage into a header string compliant with the W3C Baggage +// specification. func (b Baggage) String() string { members := make([]string, 0, len(b.list)) for k, v := range b.list { @@ -550,3 +539,372 @@ func (b Baggage) String() string { } return strings.Join(members, listDelimiter) } + +// parsePropertyInternal attempts to decode a Property from the passed string. +// It follows the spec at https://www.w3.org/TR/baggage/#definition. +func parsePropertyInternal(s string) (p Property, ok bool) { + // For the entire function we will use " key = value " as an example. + // Attempting to parse the key. + // First skip spaces at the beginning "< >key = value " (they could be empty). + index := skipSpace(s, 0) + + // Parse the key: " = value ". + keyStart := index + keyEnd := index + for _, c := range s[keyStart:] { + if !validateKeyChar(c) { + break + } + keyEnd++ + } + + // If we couldn't find any valid key character, + // it means the key is either empty or invalid. + if keyStart == keyEnd { + return + } + + // Skip spaces after the key: " key< >= value ". + index = skipSpace(s, keyEnd) + + if index == len(s) { + // A key can have no value, like: " key ". + ok = true + p.key = s[keyStart:keyEnd] + return + } + + // If we have not reached the end and we can't find the '=' delimiter, + // it means the property is invalid. + if s[index] != keyValueDelimiter[0] { + return + } + + // Attempting to parse the value. + // Match: " key =< >value ". + index = skipSpace(s, index+1) + + // Match the value string: " key = ". + // A valid property can be: " key =". + // Therefore, we don't have to check if the value is empty. + valueStart := index + valueEnd := index + for _, c := range s[valueStart:] { + if !validateValueChar(c) { + break + } + valueEnd++ + } + + // Skip all trailing whitespaces: " key = value< >". + index = skipSpace(s, valueEnd) + + // If after looking for the value and skipping whitespaces + // we have not reached the end, it means the property is + // invalid, something like: " key = value value1". + if index != len(s) { + return + } + + // Decode a percent-encoded value. + value, err := url.PathUnescape(s[valueStart:valueEnd]) + if err != nil { + return + } + + ok = true + p.key = s[keyStart:keyEnd] + p.hasValue = true + + p.value = value + return +} + +func skipSpace(s string, offset int) int { + i := offset + for ; i < len(s); i++ { + c := s[i] + if c != ' ' && c != '\t' { + break + } + } + return i +} + +var safeKeyCharset = [utf8.RuneSelf]bool{ + // 0x23 to 0x27 + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + + // 0x30 to 0x39 + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + + // 0x41 to 0x5a + 'A': true, + 'B': true, + 'C': true, + 'D': true, + 'E': true, + 'F': true, + 'G': true, + 'H': true, + 'I': true, + 'J': true, + 'K': true, + 'L': true, + 'M': true, + 'N': true, + 'O': true, + 'P': true, + 'Q': true, + 'R': true, + 'S': true, + 'T': true, + 'U': true, + 'V': true, + 'W': true, + 'X': true, + 'Y': true, + 'Z': true, + + // 0x5e to 0x7a + '^': true, + '_': true, + '`': true, + 'a': true, + 'b': true, + 'c': true, + 'd': true, + 'e': true, + 'f': true, + 'g': true, + 'h': true, + 'i': true, + 'j': true, + 'k': true, + 'l': true, + 'm': true, + 'n': true, + 'o': true, + 'p': true, + 'q': true, + 'r': true, + 's': true, + 't': true, + 'u': true, + 'v': true, + 'w': true, + 'x': true, + 'y': true, + 'z': true, + + // remainder + '!': true, + '*': true, + '+': true, + '-': true, + '.': true, + '|': true, + '~': true, +} + +func validateKey(s string) bool { + if len(s) == 0 { + return false + } + + for _, c := range s { + if !validateKeyChar(c) { + return false + } + } + + return true +} + +func validateKeyChar(c int32) bool { + return c >= 0 && c < int32(utf8.RuneSelf) && safeKeyCharset[c] +} + +func validateValue(s string) bool { + for _, c := range s { + if !validateValueChar(c) { + return false + } + } + + return true +} + +var safeValueCharset = [utf8.RuneSelf]bool{ + '!': true, // 0x21 + + // 0x23 to 0x2b + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + '(': true, + ')': true, + '*': true, + '+': true, + + // 0x2d to 0x3a + '-': true, + '.': true, + '/': true, + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + ':': true, + + // 0x3c to 0x5b + '<': true, // 0x3C + '=': true, // 0x3D + '>': true, // 0x3E + '?': true, // 0x3F + '@': true, // 0x40 + 'A': true, // 0x41 + 'B': true, // 0x42 + 'C': true, // 0x43 + 'D': true, // 0x44 + 'E': true, // 0x45 + 'F': true, // 0x46 + 'G': true, // 0x47 + 'H': true, // 0x48 + 'I': true, // 0x49 + 'J': true, // 0x4A + 'K': true, // 0x4B + 'L': true, // 0x4C + 'M': true, // 0x4D + 'N': true, // 0x4E + 'O': true, // 0x4F + 'P': true, // 0x50 + 'Q': true, // 0x51 + 'R': true, // 0x52 + 'S': true, // 0x53 + 'T': true, // 0x54 + 'U': true, // 0x55 + 'V': true, // 0x56 + 'W': true, // 0x57 + 'X': true, // 0x58 + 'Y': true, // 0x59 + 'Z': true, // 0x5A + '[': true, // 0x5B + + // 0x5d to 0x7e + ']': true, // 0x5D + '^': true, // 0x5E + '_': true, // 0x5F + '`': true, // 0x60 + 'a': true, // 0x61 + 'b': true, // 0x62 + 'c': true, // 0x63 + 'd': true, // 0x64 + 'e': true, // 0x65 + 'f': true, // 0x66 + 'g': true, // 0x67 + 'h': true, // 0x68 + 'i': true, // 0x69 + 'j': true, // 0x6A + 'k': true, // 0x6B + 'l': true, // 0x6C + 'm': true, // 0x6D + 'n': true, // 0x6E + 'o': true, // 0x6F + 'p': true, // 0x70 + 'q': true, // 0x71 + 'r': true, // 0x72 + 's': true, // 0x73 + 't': true, // 0x74 + 'u': true, // 0x75 + 'v': true, // 0x76 + 'w': true, // 0x77 + 'x': true, // 0x78 + 'y': true, // 0x79 + 'z': true, // 0x7A + '{': true, // 0x7B + '|': true, // 0x7C + '}': true, // 0x7D + '~': true, // 0x7E +} + +func validateValueChar(c int32) bool { + return c >= 0 && c < int32(utf8.RuneSelf) && safeValueCharset[c] +} + +// valueEscape escapes the string so it can be safely placed inside a baggage value, +// replacing special characters with %XX sequences as needed. +// +// The implementation is based on: +// https://github.com/golang/go/blob/f6509cf5cdbb5787061b784973782933c47f1782/src/net/url/url.go#L285. +func valueEscape(s string) string { + hexCount := 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(c) { + hexCount++ + } + } + + if hexCount == 0 { + return s + } + + var buf [64]byte + var t []byte + + required := len(s) + 2*hexCount + if required <= len(buf) { + t = buf[:required] + } else { + t = make([]byte, required) + } + + j := 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(s[i]) { + const upperhex = "0123456789ABCDEF" + t[j] = '%' + t[j+1] = upperhex[c>>4] + t[j+2] = upperhex[c&15] + j += 3 + } else { + t[j] = c + j++ + } + } + + return string(t) +} + +// shouldEscape returns true if the specified byte should be escaped when +// appearing in a baggage value string. +func shouldEscape(c byte) bool { + if c == '%' { + // The percent character must be encoded so that percent-encoding can work. + return true + } + return !validateValueChar(int32(c)) +} diff --git a/vendor/go.opentelemetry.io/otel/baggage/context.go b/vendor/go.opentelemetry.io/otel/baggage/context.go index 24b34b756..a572461a0 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/context.go +++ b/vendor/go.opentelemetry.io/otel/baggage/context.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package baggage // import "go.opentelemetry.io/otel/baggage" diff --git a/vendor/go.opentelemetry.io/otel/baggage/doc.go b/vendor/go.opentelemetry.io/otel/baggage/doc.go index 4545100df..b51d87cab 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/doc.go +++ b/vendor/go.opentelemetry.io/otel/baggage/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package baggage provides functionality for storing and retrieving diff --git a/vendor/go.opentelemetry.io/otel/codes/README.md b/vendor/go.opentelemetry.io/otel/codes/README.md new file mode 100644 index 000000000..24c52b387 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/codes/README.md @@ -0,0 +1,3 @@ +# Codes + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/codes)](https://pkg.go.dev/go.opentelemetry.io/otel/codes) diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go index 587ebae4e..df29d96a6 100644 --- a/vendor/go.opentelemetry.io/otel/codes/codes.go +++ b/vendor/go.opentelemetry.io/otel/codes/codes.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package codes // import "go.opentelemetry.io/otel/codes" diff --git a/vendor/go.opentelemetry.io/otel/codes/doc.go b/vendor/go.opentelemetry.io/otel/codes/doc.go index 4e328fbb4..ee8db448b 100644 --- a/vendor/go.opentelemetry.io/otel/codes/doc.go +++ b/vendor/go.opentelemetry.io/otel/codes/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package codes defines the canonical error codes used by OpenTelemetry. diff --git a/vendor/go.opentelemetry.io/otel/doc.go b/vendor/go.opentelemetry.io/otel/doc.go index daa36c89d..441c59501 100644 --- a/vendor/go.opentelemetry.io/otel/doc.go +++ b/vendor/go.opentelemetry.io/otel/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package otel provides global access to the OpenTelemetry API. The subpackages of @@ -22,7 +11,7 @@ transmitted anywhere. An implementation of the OpenTelemetry SDK, like the default SDK implementation (go.opentelemetry.io/otel/sdk), and associated exporters are used to process and transport this data. -To read the getting started guide, see https://opentelemetry.io/docs/go/getting-started/. +To read the getting started guide, see https://opentelemetry.io/docs/languages/go/getting-started/. To read more about tracing, see go.opentelemetry.io/otel/trace. diff --git a/vendor/go.opentelemetry.io/otel/error_handler.go b/vendor/go.opentelemetry.io/otel/error_handler.go index 72fad8541..67414c71e 100644 --- a/vendor/go.opentelemetry.io/otel/error_handler.go +++ b/vendor/go.opentelemetry.io/otel/error_handler.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md new file mode 100644 index 000000000..50802d5ae --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md @@ -0,0 +1,3 @@ +# OTLP Trace Exporter + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlptrace)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/clients.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/clients.go index dbb40cf58..3c1a625c0 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/clients.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/clients.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/doc.go index 9e642235a..09ad5eadb 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/doc.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package otlptrace contains abstractions for OTLP span exporters. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go index b46a38d60..3f0a518ae 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" @@ -104,7 +93,7 @@ func NewUnstarted(client Client) *Exporter { } } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Exporter. func (e *Exporter) MarshalLog() interface{} { return struct { Type string diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go index ec74f1aad..4571a5ca3 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go index 7aaec38d2..f6dd3decc 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go index 05a1f78ad..db7b698a5 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go index b83cbd724..c3c69c5a0 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" @@ -121,6 +110,7 @@ func span(sd tracesdk.ReadOnlySpan) *tracepb.Span { if psid := sd.Parent().SpanID(); psid.IsValid() { s.ParentSpanId = psid[:] } + s.Flags = buildSpanFlags(sd.Parent()) return s } @@ -157,16 +147,28 @@ func links(links []tracesdk.Link) []*tracepb.Span_Link { tid := otLink.SpanContext.TraceID() sid := otLink.SpanContext.SpanID() + flags := buildSpanFlags(otLink.SpanContext) + sl = append(sl, &tracepb.Span_Link{ TraceId: tid[:], SpanId: sid[:], Attributes: KeyValues(otLink.Attributes), DroppedAttributesCount: uint32(otLink.DroppedAttributeCount), + Flags: flags, }) } return sl } +func buildSpanFlags(sc trace.SpanContext) uint32 { + flags := tracepb.SpanFlags_SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK + if sc.IsRemote() { + flags |= tracepb.SpanFlags_SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK + } + + return uint32(flags) +} + // spanEvents transforms span Events to an OTLP span events. func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { if len(es) == 0 { diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/README.md b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/README.md new file mode 100644 index 000000000..5309bb7cb --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/README.md @@ -0,0 +1,3 @@ +# OTLP Trace gRPC Exporter + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc) diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go index b4cc21d7a..3993df927 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlptracegrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" @@ -89,11 +78,11 @@ func newClient(opts ...Option) *client { } // Start establishes a gRPC connection to the collector. -func (c *client) Start(ctx context.Context) error { +func (c *client) Start(context.Context) error { if c.conn == nil { // If the caller did not provide a ClientConn when the client was // created, create one using the configuration they did provide. - conn, err := grpc.DialContext(ctx, c.endpoint, c.dialOpts...) + conn, err := grpc.NewClient(c.endpoint, c.dialOpts...) if err != nil { return err } diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go index 1f514ef9e..e783b57ac 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package otlptracegrpc provides an OTLP span exporter using gRPC. @@ -28,7 +17,7 @@ The value may additionally a port, a scheme, and a path. The value accepts "http" and "https" scheme. The value should not contain a query string or fragment. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT takes precedence over OTEL_EXPORTER_OTLP_ENDPOINT. -The configuration can be overridden by [WithEndpoint], [WithInsecure], [WithGRPCConn] options. +The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WithInsecure], and [WithGRPCConn] options. OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_TRACES_INSECURE (default: "false") - setting "true" disables client transport security for the exporter's gRPC connection. @@ -40,7 +29,7 @@ The configuration can be overridden by [WithInsecure], [WithGRPCConn] options. OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS (default: none) - key-value pairs used as gRPC metadata associated with gRPC requests. -The value is expected to be represented in a format matching to the [W3C Baggage HTTP Header Content Format], +The value is expected to be represented in a format matching the [W3C Baggage HTTP Header Content Format], except that additional semi-colon delimited metadata is not supported. Example value: "key1=value1,key2=value2". OTEL_EXPORTER_OTLP_TRACES_HEADERS takes precedence over OTEL_EXPORTER_OTLP_HEADERS. @@ -63,12 +52,12 @@ OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_C The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] options. OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE (default: none) - -the filepath to the client certificate/chain trust for clients private key to use in mTLS communication in PEM format. +the filepath to the client certificate/chain trust for client's private key to use in mTLS communication in PEM format. OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE. The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] options. OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY (default: none) - -the filepath to the clients private key to use in mTLS communication in PEM format. +the filepath to the client's private key to use in mTLS communication in PEM format. OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY takes precedence over OTEL_EXPORTER_OTLP_CLIENT_KEY. The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] option. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/exporter.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/exporter.go index 89af41002..b826b8424 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/exporter.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/exporter.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlptracegrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go index 5530119e4..9513c0a57 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go @@ -2,18 +2,7 @@ // source: internal/shared/otlp/envconfig/envconfig.go.tmpl // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go index 1fb290618..97cd6c54f 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go index 32f6dddb4..7bb189a94 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go @@ -2,18 +2,7 @@ // source: internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go index dddb1f334..8f84a7996 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -2,24 +2,15 @@ // source: internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" import ( "crypto/tls" "fmt" + "net/http" + "net/url" "path" "strings" "time" @@ -32,6 +23,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" + "go.opentelemetry.io/otel/internal/global" ) const ( @@ -44,6 +36,10 @@ const ( ) type ( + // HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. + // This type is compatible with `http.Transport.Proxy` and can be used to set a custom proxy function to the OTLP HTTP client. + HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + SignalConfig struct { Endpoint string Insecure bool @@ -55,6 +51,8 @@ type ( // gRPC configurations GRPCCredentials credentials.TransportCredentials + + Proxy HTTPTransportProxyFunc } Config struct { @@ -258,6 +256,9 @@ func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { // Generic Options +// WithEndpoint configures the trace host and port only; endpoint should +// resemble "example.com" or "localhost:4317". To configure the scheme and path, +// use WithEndpointURL. func WithEndpoint(endpoint string) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Traces.Endpoint = endpoint @@ -265,6 +266,26 @@ func WithEndpoint(endpoint string) GenericOption { }) } +// WithEndpointURL configures the trace scheme, host, port, and path; the +// provided value should resemble "https://example.com:4318/v1/traces". +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlptrace: parse endpoint url", "url", v) + return cfg + } + + cfg.Traces.Endpoint = u.Host + cfg.Traces.URLPath = u.Path + if u.Scheme != "https" { + cfg.Traces.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Traces.Compression = compression @@ -323,3 +344,10 @@ func WithTimeout(duration time.Duration) GenericOption { return cfg }) } + +func WithProxy(pf HTTPTransportProxyFunc) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Proxy = pf + return cfg + }) +} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go index d9dcdc96e..3d4f699d4 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go @@ -2,18 +2,7 @@ // source: internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go index 19b6d4b21..38b97a013 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go @@ -2,18 +2,7 @@ // source: internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go index 076905e54..a12ea4c48 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go @@ -2,18 +2,7 @@ // source: internal/shared/otlp/partialsuccess.go // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go index 3ce7d6632..4f2113ae2 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go @@ -2,18 +2,7 @@ // source: internal/shared/otlp/retry/retry.go.tmpl // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package retry provides request retry functionality that can perform // configurable exponential backoff for transient errors and honor any diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go index 17ffeaf6e..bbad0e6d0 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlptracegrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" @@ -64,14 +53,48 @@ func WithInsecure() Option { return wrappedOption{otlpconfig.WithInsecure()} } -// WithEndpoint sets the target endpoint the exporter will connect to. If -// unset, localhost:4317 will be used as a default. +// WithEndpoint sets the target endpoint (host and port) the Exporter will +// connect to. The provided endpoint should resemble "example.com:4317" (no +// scheme or path). +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpointURL are used, the last used option will +// take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. // // This option has no effect if WithGRPCConn is used. func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} } +// WithEndpointURL sets the target endpoint URL (scheme, host, port, path) +// the Exporter will connect to. The provided endpoint URL should resemble +// "https://example.com:4318/v1/traces". +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpoint are used, the last used option will +// take precedence. +// +// If an invalid URL is provided, the default value will be kept. +// +// By default, if an environment variable is not set, and this option is not +// passed, "https://localhost:4317/v1/traces" will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithEndpointURL(u string) Option { + return wrappedOption{otlpconfig.WithEndpointURL(u)} +} + // WithReconnectionPeriod set the minimum amount of time between connection // attempts to the target endpoint. // @@ -131,6 +154,8 @@ func WithServiceConfig(serviceConfig string) Option { // connection. The options here are appended to the internal grpc.DialOptions // used so they will take precedence over any other internal grpc.DialOptions // they might conflict with. +// The [grpc.WithBlock], [grpc.WithTimeout], and [grpc.WithReturnConnectionError] +// grpc.DialOptions are ignored. // // This option has no effect if WithGRPCConn is used. func WithDialOption(opts ...grpc.DialOption) Option { diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go index 620ea88bf..14ad8c33b 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go @@ -1,20 +1,9 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.20.0" + return "1.28.0" } diff --git a/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh b/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh index 9a58fb1d3..93e80ea30 100644 --- a/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh +++ b/vendor/go.opentelemetry.io/otel/get_main_pkgs.sh @@ -1,18 +1,7 @@ #!/usr/bin/env bash # Copyright The OpenTelemetry Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# SPDX-License-Identifier: Apache-2.0 set -euo pipefail diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go index 4115fe3bb..07623b679 100644 --- a/vendor/go.opentelemetry.io/otel/handler.go +++ b/vendor/go.opentelemetry.io/otel/handler.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otel // import "go.opentelemetry.io/otel" @@ -18,12 +7,8 @@ import ( "go.opentelemetry.io/otel/internal/global" ) -var ( - // Compile-time check global.ErrDelegator implements ErrorHandler. - _ ErrorHandler = (*global.ErrDelegator)(nil) - // Compile-time check global.ErrLogger implements ErrorHandler. - _ ErrorHandler = (*global.ErrLogger)(nil) -) +// Compile-time check global.ErrDelegator implements ErrorHandler. +var _ ErrorHandler = (*global.ErrDelegator)(nil) // GetErrorHandler returns the global ErrorHandler instance. // @@ -44,5 +29,5 @@ func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() } // delegate errors to h. func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) } -// Handle is a convenience function for ErrorHandler().Handle(err). -func Handle(err error) { global.Handle(err) } +// Handle is a convenience function for GetErrorHandler().Handle(err). +func Handle(err error) { global.GetErrorHandler().Handle(err) } diff --git a/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go index 622c3ee3f..822d84794 100644 --- a/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go +++ b/vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package attribute provide several helper functions for some commonly used @@ -25,33 +14,33 @@ import ( // BoolSliceValue converts a bool slice into an array with same elements as slice. func BoolSliceValue(v []bool) interface{} { var zero bool - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]bool), v) - return cp.Elem().Interface() + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } // Int64SliceValue converts an int64 slice into an array with same elements as slice. func Int64SliceValue(v []int64) interface{} { var zero int64 - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]int64), v) - return cp.Elem().Interface() + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } // Float64SliceValue converts a float64 slice into an array with same elements as slice. func Float64SliceValue(v []float64) interface{} { var zero float64 - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]float64), v) - return cp.Elem().Interface() + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } // StringSliceValue converts a string slice into an array with same elements as slice. func StringSliceValue(v []string) interface{} { var zero string - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]string), v) - return cp.Elem().Interface() + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem() + reflect.Copy(cp, reflect.ValueOf(v)) + return cp.Interface() } // AsBoolSlice converts a bool array into a slice into with same elements as array. diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go index b96e5408e..b4f85f44a 100644 --- a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package baggage provides base types and functionality to store and retrieve diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go index 4469700d9..3aea9c491 100644 --- a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package baggage // import "go.opentelemetry.io/otel/internal/baggage" diff --git a/vendor/go.opentelemetry.io/otel/internal/gen.go b/vendor/go.opentelemetry.io/otel/internal/gen.go index f532f07e9..4259f0320 100644 --- a/vendor/go.opentelemetry.io/otel/internal/gen.go +++ b/vendor/go.opentelemetry.io/otel/internal/gen.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package internal // import "go.opentelemetry.io/otel/internal" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/handler.go b/vendor/go.opentelemetry.io/otel/internal/global/handler.go index 5e9b83047..c657ff8e7 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/handler.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/handler.go @@ -1,38 +1,13 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package global // import "go.opentelemetry.io/otel/internal/global" import ( "log" - "os" "sync/atomic" ) -var ( - // GlobalErrorHandler provides an ErrorHandler that can be used - // throughout an OpenTelemetry instrumented project. When a user - // specified ErrorHandler is registered (`SetErrorHandler`) all calls to - // `Handle` and will be delegated to the registered ErrorHandler. - GlobalErrorHandler = defaultErrorHandler() - - // Compile-time check that delegator implements ErrorHandler. - _ ErrorHandler = (*ErrDelegator)(nil) - // Compile-time check that errLogger implements ErrorHandler. - _ ErrorHandler = (*ErrLogger)(nil) -) - // ErrorHandler handles irremediable events. type ErrorHandler interface { // Handle handles any error deemed irremediable by an OpenTelemetry @@ -44,59 +19,18 @@ type ErrDelegator struct { delegate atomic.Pointer[ErrorHandler] } -func (d *ErrDelegator) Handle(err error) { - d.getDelegate().Handle(err) -} +// Compile-time check that delegator implements ErrorHandler. +var _ ErrorHandler = (*ErrDelegator)(nil) -func (d *ErrDelegator) getDelegate() ErrorHandler { - return *d.delegate.Load() +func (d *ErrDelegator) Handle(err error) { + if eh := d.delegate.Load(); eh != nil { + (*eh).Handle(err) + return + } + log.Print(err) } // setDelegate sets the ErrorHandler delegate. func (d *ErrDelegator) setDelegate(eh ErrorHandler) { d.delegate.Store(&eh) } - -func defaultErrorHandler() *ErrDelegator { - d := &ErrDelegator{} - d.setDelegate(&ErrLogger{l: log.New(os.Stderr, "", log.LstdFlags)}) - return d -} - -// ErrLogger logs errors if no delegate is set, otherwise they are delegated. -type ErrLogger struct { - l *log.Logger -} - -// Handle logs err if no delegate is set, otherwise it is delegated. -func (h *ErrLogger) Handle(err error) { - h.l.Print(err) -} - -// GetErrorHandler returns the global ErrorHandler instance. -// -// The default ErrorHandler instance returned will log all errors to STDERR -// until an override ErrorHandler is set with SetErrorHandler. All -// ErrorHandler returned prior to this will automatically forward errors to -// the set instance instead of logging. -// -// Subsequent calls to SetErrorHandler after the first will not forward errors -// to the new ErrorHandler for prior returned instances. -func GetErrorHandler() ErrorHandler { - return GlobalErrorHandler -} - -// SetErrorHandler sets the global ErrorHandler to h. -// -// The first time this is called all ErrorHandler previously returned from -// GetErrorHandler will send errors to h instead of the default logging -// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not -// delegate errors to h. -func SetErrorHandler(h ErrorHandler) { - GlobalErrorHandler.setDelegate(h) -} - -// Handle is a convenience function for ErrorHandler().Handle(err). -func Handle(err error) { - GetErrorHandler().Handle(err) -} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go index ebb13c206..3a0cc42f6 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package global // import "go.opentelemetry.io/otel/internal/global" @@ -292,6 +281,32 @@ func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.Reco } } +type sfGauge struct { + embedded.Float64Gauge + + name string + opts []metric.Float64GaugeOption + + delegate atomic.Value // metric.Float64Gauge +} + +var _ metric.Float64Gauge = (*sfGauge)(nil) + +func (i *sfGauge) setDelegate(m metric.Meter) { + ctr, err := m.Float64Gauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *sfGauge) Record(ctx context.Context, x float64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Float64Gauge).Record(ctx, x, opts...) + } +} + type siCounter struct { embedded.Int64Counter @@ -369,3 +384,29 @@ func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.Record ctr.(metric.Int64Histogram).Record(ctx, x, opts...) } } + +type siGauge struct { + embedded.Int64Gauge + + name string + opts []metric.Int64GaugeOption + + delegate atomic.Value // metric.Int64Gauge +} + +var _ metric.Int64Gauge = (*siGauge)(nil) + +func (i *siGauge) setDelegate(m metric.Meter) { + ctr, err := m.Int64Gauge(i.name, i.opts...) + if err != nil { + GetErrorHandler().Handle(err) + return + } + i.delegate.Store(ctr) +} + +func (i *siGauge) Record(ctx context.Context, x int64, opts ...metric.RecordOption) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(metric.Int64Gauge).Record(ctx, x, opts...) + } +} diff --git a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go index c6f305a2b..adbca7d34 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package global // import "go.opentelemetry.io/otel/internal/global" @@ -23,17 +12,20 @@ import ( "github.com/go-logr/stdr" ) -// globalLogger is the logging interface used within the otel api and sdk provide details of the internals. +// globalLogger holds a reference to the [logr.Logger] used within +// go.opentelemetry.io/otel. // // The default logger uses stdr which is backed by the standard `log.Logger` // interface. This logger will only show messages at the Error Level. -var globalLogger atomic.Pointer[logr.Logger] +var globalLogger = func() *atomic.Pointer[logr.Logger] { + l := stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)) -func init() { - SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) -} + p := new(atomic.Pointer[logr.Logger]) + p.Store(&l) + return p +}() -// SetLogger overrides the globalLogger with l. +// SetLogger sets the global Logger to l. // // To see Warn messages use a logger with `l.V(1).Enabled() == true` // To see Info messages use a logger with `l.V(4).Enabled() == true` @@ -42,28 +34,29 @@ func SetLogger(l logr.Logger) { globalLogger.Store(&l) } -func getLogger() logr.Logger { +// GetLogger returns the global logger. +func GetLogger() logr.Logger { return *globalLogger.Load() } // Info prints messages about the general state of the API or SDK. // This should usually be less than 5 messages a minute. func Info(msg string, keysAndValues ...interface{}) { - getLogger().V(4).Info(msg, keysAndValues...) + GetLogger().V(4).Info(msg, keysAndValues...) } // Error prints messages about exceptional states of the API or SDK. func Error(err error, msg string, keysAndValues ...interface{}) { - getLogger().Error(err, msg, keysAndValues...) + GetLogger().Error(err, msg, keysAndValues...) } // Debug prints messages about all internal changes in the API or SDK. func Debug(msg string, keysAndValues ...interface{}) { - getLogger().V(8).Info(msg, keysAndValues...) + GetLogger().V(8).Info(msg, keysAndValues...) } // Warn prints messages about warnings in the API or SDK. // Not an error but is likely more important than an informational event. func Warn(msg string, keysAndValues ...interface{}) { - getLogger().V(1).Info(msg, keysAndValues...) + GetLogger().V(1).Info(msg, keysAndValues...) } diff --git a/vendor/go.opentelemetry.io/otel/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/internal/global/meter.go index 0097db478..cfd1df9bf 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/meter.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/meter.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package global // import "go.opentelemetry.io/otel/internal/global" @@ -76,6 +65,7 @@ func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Me key := il{ name: name, version: c.InstrumentationVersion(), + schema: c.SchemaURL(), } if p.meters == nil { @@ -130,9 +120,11 @@ func (m *meter) setDelegate(provider metric.MeterProvider) { inst.setDelegate(meter) } - for e := m.registry.Front(); e != nil; e = e.Next() { + var n *list.Element + for e := m.registry.Front(); e != nil; e = n { r := e.Value.(*registration) r.setDelegate(meter) + n = e.Next() m.registry.Remove(e) } @@ -173,6 +165,17 @@ func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOpti return i, nil } +func (m *meter) Int64Gauge(name string, options ...metric.Int64GaugeOption) (metric.Int64Gauge, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64Gauge(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siGauge{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableCounter(name, options...) @@ -239,6 +242,17 @@ func (m *meter) Float64Histogram(name string, options ...metric.Float64Histogram return i, nil } +func (m *meter) Float64Gauge(name string, options ...metric.Float64GaugeOption) (metric.Float64Gauge, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64Gauge(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfGauge{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableCounter(name, options...) diff --git a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go index 06bac35c2..38560ff99 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package global // import "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/state.go b/vendor/go.opentelemetry.io/otel/internal/global/state.go index 7985005bc..204ea142a 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/state.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/state.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package global // import "go.opentelemetry.io/otel/internal/global" @@ -25,6 +14,10 @@ import ( ) type ( + errorHandlerHolder struct { + eh ErrorHandler + } + tracerProviderHolder struct { tp trace.TracerProvider } @@ -39,15 +32,59 @@ type ( ) var ( + globalErrorHandler = defaultErrorHandler() globalTracer = defaultTracerValue() globalPropagators = defaultPropagatorsValue() globalMeterProvider = defaultMeterProvider() + delegateErrorHandlerOnce sync.Once delegateTraceOnce sync.Once delegateTextMapPropagatorOnce sync.Once delegateMeterOnce sync.Once ) +// GetErrorHandler returns the global ErrorHandler instance. +// +// The default ErrorHandler instance returned will log all errors to STDERR +// until an override ErrorHandler is set with SetErrorHandler. All +// ErrorHandler returned prior to this will automatically forward errors to +// the set instance instead of logging. +// +// Subsequent calls to SetErrorHandler after the first will not forward errors +// to the new ErrorHandler for prior returned instances. +func GetErrorHandler() ErrorHandler { + return globalErrorHandler.Load().(errorHandlerHolder).eh +} + +// SetErrorHandler sets the global ErrorHandler to h. +// +// The first time this is called all ErrorHandler previously returned from +// GetErrorHandler will send errors to h instead of the default logging +// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not +// delegate errors to h. +func SetErrorHandler(h ErrorHandler) { + current := GetErrorHandler() + + if _, cOk := current.(*ErrDelegator); cOk { + if _, ehOk := h.(*ErrDelegator); ehOk && current == h { + // Do not assign to the delegate of the default ErrDelegator to be + // itself. + Error( + errors.New("no ErrorHandler delegate configured"), + "ErrorHandler remains its current value.", + ) + return + } + } + + delegateErrorHandlerOnce.Do(func() { + if def, ok := current.(*ErrDelegator); ok { + def.setDelegate(h) + } + }) + globalErrorHandler.Store(errorHandlerHolder{eh: h}) +} + // TracerProvider is the internal implementation for global.TracerProvider. func TracerProvider() trace.TracerProvider { return globalTracer.Load().(tracerProviderHolder).tp @@ -63,7 +100,7 @@ func SetTracerProvider(tp trace.TracerProvider) { // to itself. Error( errors.New("no delegate configured in tracer provider"), - "Setting tracer provider to it's current value. No delegate will be configured", + "Setting tracer provider to its current value. No delegate will be configured", ) return } @@ -92,7 +129,7 @@ func SetTextMapPropagator(p propagation.TextMapPropagator) { // delegate to itself. Error( errors.New("no delegate configured in text map propagator"), - "Setting text map propagator to it's current value. No delegate will be configured", + "Setting text map propagator to its current value. No delegate will be configured", ) return } @@ -123,7 +160,7 @@ func SetMeterProvider(mp metric.MeterProvider) { // to itself. Error( errors.New("no delegate configured in meter provider"), - "Setting meter provider to it's current value. No delegate will be configured", + "Setting meter provider to its current value. No delegate will be configured", ) return } @@ -137,6 +174,12 @@ func SetMeterProvider(mp metric.MeterProvider) { globalMeterProvider.Store(meterProviderHolder{mp: mp}) } +func defaultErrorHandler() *atomic.Value { + v := &atomic.Value{} + v.Store(errorHandlerHolder{eh: &ErrDelegator{}}) + return v +} + func defaultTracerValue() *atomic.Value { v := &atomic.Value{} v.Store(tracerProviderHolder{tp: &tracerProvider{}}) diff --git a/vendor/go.opentelemetry.io/otel/internal/global/trace.go b/vendor/go.opentelemetry.io/otel/internal/global/trace.go index 3f61ec12a..e31f442b4 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/trace.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/trace.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package global // import "go.opentelemetry.io/otel/internal/global" @@ -97,6 +86,7 @@ func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T key := il{ name: name, version: c.InstrumentationVersion(), + schema: c.SchemaURL(), } if p.tracers == nil { @@ -112,10 +102,7 @@ func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T return t } -type il struct { - name string - version string -} +type il struct{ name, version, schema string } // tracer is a placeholder for a trace.Tracer. // @@ -193,6 +180,9 @@ func (nonRecordingSpan) RecordError(error, ...trace.EventOption) {} // AddEvent does nothing. func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {} +// AddLink does nothing. +func (nonRecordingSpan) AddLink(trace.Link) {} + // SetName does nothing. func (nonRecordingSpan) SetName(string) {} diff --git a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go index e07e79400..3e7bb3b35 100644 --- a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go +++ b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package internal // import "go.opentelemetry.io/otel/internal" diff --git a/vendor/go.opentelemetry.io/otel/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal_logging.go index c4f8acd5d..6de7f2e4d 100644 --- a/vendor/go.opentelemetry.io/otel/internal_logging.go +++ b/vendor/go.opentelemetry.io/otel/internal_logging.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/metric.go b/vendor/go.opentelemetry.io/otel/metric.go index f95517195..1e6473b32 100644 --- a/vendor/go.opentelemetry.io/otel/metric.go +++ b/vendor/go.opentelemetry.io/otel/metric.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/metric/README.md b/vendor/go.opentelemetry.io/otel/metric/README.md new file mode 100644 index 000000000..0cf902e01 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/README.md @@ -0,0 +1,3 @@ +# Metric API + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/metric)](https://pkg.go.dev/go.opentelemetry.io/otel/metric) diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go index 072baa8e8..cf23db778 100644 --- a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go +++ b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package metric // import "go.opentelemetry.io/otel/metric" @@ -50,7 +39,7 @@ type Float64ObservableCounter interface { } // Float64ObservableCounterConfig contains options for asynchronous counter -// instruments that record int64 values. +// instruments that record float64 values. type Float64ObservableCounterConfig struct { description string unit string @@ -108,7 +97,7 @@ type Float64ObservableUpDownCounter interface { } // Float64ObservableUpDownCounterConfig contains options for asynchronous -// counter instruments that record int64 values. +// counter instruments that record float64 values. type Float64ObservableUpDownCounterConfig struct { description string unit string @@ -165,7 +154,7 @@ type Float64ObservableGauge interface { } // Float64ObservableGaugeConfig contains options for asynchronous counter -// instruments that record int64 values. +// instruments that record float64 values. type Float64ObservableGaugeConfig struct { description string unit string diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go index 9bd6ebf02..c82ba5324 100644 --- a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go +++ b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package metric // import "go.opentelemetry.io/otel/metric" diff --git a/vendor/go.opentelemetry.io/otel/metric/config.go b/vendor/go.opentelemetry.io/otel/metric/config.go index 778ad2d74..d9e3b13e4 100644 --- a/vendor/go.opentelemetry.io/otel/metric/config.go +++ b/vendor/go.opentelemetry.io/otel/metric/config.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package metric // import "go.opentelemetry.io/otel/metric" diff --git a/vendor/go.opentelemetry.io/otel/metric/doc.go b/vendor/go.opentelemetry.io/otel/metric/doc.go index 54716e13b..f153745b0 100644 --- a/vendor/go.opentelemetry.io/otel/metric/doc.go +++ b/vendor/go.opentelemetry.io/otel/metric/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package metric provides the OpenTelemetry API used to measure metrics about @@ -68,6 +57,23 @@ asynchronous measurement, a Gauge ([Int64ObservableGauge] and See the [OpenTelemetry documentation] for more information about instruments and their intended use. +# Instrument Name + +OpenTelemetry defines an [instrument name syntax] that restricts what +instrument names are allowed. + +Instrument names should ... + + - Not be empty. + - Have an alphabetic character as their first letter. + - Have any letter after the first be an alphanumeric character, ‘_’, ‘.’, + ‘-’, or ‘/’. + - Have a maximum length of 255 letters. + +To ensure compatibility with observability platforms, all instruments created +need to conform to this syntax. Not all implementations of the API will validate +these names, it is the callers responsibility to ensure compliance. + # Measurements Measurements are made by recording values and information about the values with @@ -164,6 +170,7 @@ It is strongly recommended that authors only embed That implementation is the only one OpenTelemetry authors can guarantee will fully implement all the API interfaces when a user updates their API. +[instrument name syntax]: https://opentelemetry.io/docs/specs/otel/metrics/api/#instrument-name-syntax [OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ [GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider */ diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/README.md b/vendor/go.opentelemetry.io/otel/metric/embedded/README.md new file mode 100644 index 000000000..1f6e0efa7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/metric/embedded/README.md @@ -0,0 +1,3 @@ +# Metric Embedded + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/metric/embedded)](https://pkg.go.dev/go.opentelemetry.io/otel/metric/embedded) diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go index ae0bdbd2e..1a9dc6809 100644 --- a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go +++ b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package embedded provides interfaces embedded within the [OpenTelemetry // metric API]. @@ -113,6 +102,16 @@ type Float64Counter interface{ float64Counter() } // the API package). type Float64Histogram interface{ float64Histogram() } +// Float64Gauge is embedded in [go.opentelemetry.io/otel/metric.Float64Gauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Float64Gauge] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Float64Gauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Float64Gauge interface{ float64Gauge() } + // Float64ObservableCounter is embedded in // [go.opentelemetry.io/otel/metric.Float64ObservableCounter]. // @@ -185,6 +184,16 @@ type Int64Counter interface{ int64Counter() } // the API package). type Int64Histogram interface{ int64Histogram() } +// Int64Gauge is embedded in [go.opentelemetry.io/otel/metric.Int64Gauge]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Int64Gauge] if you want users to experience +// a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Int64Gauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type Int64Gauge interface{ int64Gauge() } + // Int64ObservableCounter is embedded in // [go.opentelemetry.io/otel/metric.Int64ObservableCounter]. // diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument.go index be89cd533..ea52e4023 100644 --- a/vendor/go.opentelemetry.io/otel/metric/instrument.go +++ b/vendor/go.opentelemetry.io/otel/metric/instrument.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package metric // import "go.opentelemetry.io/otel/metric" @@ -27,6 +16,7 @@ type InstrumentOption interface { Int64CounterOption Int64UpDownCounterOption Int64HistogramOption + Int64GaugeOption Int64ObservableCounterOption Int64ObservableUpDownCounterOption Int64ObservableGaugeOption @@ -34,6 +24,7 @@ type InstrumentOption interface { Float64CounterOption Float64UpDownCounterOption Float64HistogramOption + Float64GaugeOption Float64ObservableCounterOption Float64ObservableUpDownCounterOption Float64ObservableGaugeOption @@ -62,6 +53,11 @@ func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64Histogra return c } +func (o descOpt) applyFloat64Gauge(c Float64GaugeConfig) Float64GaugeConfig { + c.description = string(o) + return c +} + func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { c.description = string(o) return c @@ -92,6 +88,11 @@ func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfi return c } +func (o descOpt) applyInt64Gauge(c Int64GaugeConfig) Int64GaugeConfig { + c.description = string(o) + return c +} + func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { c.description = string(o) return c @@ -127,6 +128,11 @@ func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64Histogra return c } +func (o unitOpt) applyFloat64Gauge(c Float64GaugeConfig) Float64GaugeConfig { + c.unit = string(o) + return c +} + func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { c.unit = string(o) return c @@ -157,6 +163,11 @@ func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfi return c } +func (o unitOpt) applyInt64Gauge(c Int64GaugeConfig) Int64GaugeConfig { + c.unit = string(o) + return c +} + func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { c.unit = string(o) return c diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go index 2520bc74a..6a7991e01 100644 --- a/vendor/go.opentelemetry.io/otel/metric/meter.go +++ b/vendor/go.opentelemetry.io/otel/metric/meter.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package metric // import "go.opentelemetry.io/otel/metric" @@ -58,17 +47,37 @@ type Meter interface { // Int64Counter returns a new Int64Counter instrument identified by name // and configured with options. The instrument is used to synchronously // record increasing int64 measurements during a computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error) // Int64UpDownCounter returns a new Int64UpDownCounter instrument // identified by name and configured with options. The instrument is used // to synchronously record int64 measurements during a computational // operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error) // Int64Histogram returns a new Int64Histogram instrument identified by // name and configured with options. The instrument is used to // synchronously record the distribution of int64 measurements during a // computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error) + // Int64Gauge returns a new Int64Gauge instrument identified by name and + // configured with options. The instrument is used to synchronously record + // instantaneous int64 measurements during a computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + Int64Gauge(name string, options ...Int64GaugeOption) (Int64Gauge, error) // Int64ObservableCounter returns a new Int64ObservableCounter identified // by name and configured with options. The instrument is used to // asynchronously record increasing int64 measurements once per a @@ -78,6 +87,10 @@ type Meter interface { // the WithInt64Callback option to register the callback here, or use the // RegisterCallback method of this Meter to register one later. See the // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error) // Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter // instrument identified by name and configured with options. The @@ -88,6 +101,10 @@ type Meter interface { // the WithInt64Callback option to register the callback here, or use the // RegisterCallback method of this Meter to register one later. See the // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error) // Int64ObservableGauge returns a new Int64ObservableGauge instrument // identified by name and configured with options. The instrument is used @@ -98,23 +115,47 @@ type Meter interface { // the WithInt64Callback option to register the callback here, or use the // RegisterCallback method of this Meter to register one later. See the // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error) // Float64Counter returns a new Float64Counter instrument identified by // name and configured with options. The instrument is used to // synchronously record increasing float64 measurements during a // computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error) // Float64UpDownCounter returns a new Float64UpDownCounter instrument // identified by name and configured with options. The instrument is used // to synchronously record float64 measurements during a computational // operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) // Float64Histogram returns a new Float64Histogram instrument identified by // name and configured with options. The instrument is used to // synchronously record the distribution of float64 measurements during a // computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error) + // Float64Gauge returns a new Float64Gauge instrument identified by name and + // configured with options. The instrument is used to synchronously record + // instantaneous float64 measurements during a computational operation. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. + Float64Gauge(name string, options ...Float64GaugeOption) (Float64Gauge, error) // Float64ObservableCounter returns a new Float64ObservableCounter // instrument identified by name and configured with options. The // instrument is used to asynchronously record increasing float64 @@ -124,6 +165,10 @@ type Meter interface { // the WithFloat64Callback option to register the callback here, or use the // RegisterCallback method of this Meter to register one later. See the // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error) // Float64ObservableUpDownCounter returns a new // Float64ObservableUpDownCounter instrument identified by name and @@ -134,6 +179,10 @@ type Meter interface { // the WithFloat64Callback option to register the callback here, or use the // RegisterCallback method of this Meter to register one later. See the // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error) // Float64ObservableGauge returns a new Float64ObservableGauge instrument // identified by name and configured with options. The instrument is used @@ -144,6 +193,10 @@ type Meter interface { // the WithFloat64Callback option to register the callback here, or use the // RegisterCallback method of this Meter to register one later. See the // Measurements section of the package documentation for more information. + // + // The name needs to conform to the OpenTelemetry instrument name syntax. + // See the Instrument Name section of the package documentation for more + // information. Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error) // RegisterCallback registers f to be called during the collection of a diff --git a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go index 0a4825ae6..8403a4bad 100644 --- a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go +++ b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package metric // import "go.opentelemetry.io/otel/metric" @@ -39,7 +28,7 @@ type Float64Counter interface { } // Float64CounterConfig contains options for synchronous counter instruments that -// record int64 values. +// record float64 values. type Float64CounterConfig struct { description string unit string @@ -92,7 +81,7 @@ type Float64UpDownCounter interface { } // Float64UpDownCounterConfig contains options for synchronous counter -// instruments that record int64 values. +// instruments that record float64 values. type Float64UpDownCounterConfig struct { description string unit string @@ -144,8 +133,8 @@ type Float64Histogram interface { Record(ctx context.Context, incr float64, options ...RecordOption) } -// Float64HistogramConfig contains options for synchronous counter instruments -// that record int64 values. +// Float64HistogramConfig contains options for synchronous histogram +// instruments that record float64 values. type Float64HistogramConfig struct { description string unit string @@ -183,3 +172,55 @@ func (c Float64HistogramConfig) ExplicitBucketBoundaries() []float64 { type Float64HistogramOption interface { applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig } + +// Float64Gauge is an instrument that records instantaneous float64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Float64Gauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Float64Gauge + + // Record records the instantaneous value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, value float64, options ...RecordOption) +} + +// Float64GaugeConfig contains options for synchronous gauge instruments that +// record float64 values. +type Float64GaugeConfig struct { + description string + unit string +} + +// NewFloat64GaugeConfig returns a new [Float64GaugeConfig] with all opts +// applied. +func NewFloat64GaugeConfig(opts ...Float64GaugeOption) Float64GaugeConfig { + var config Float64GaugeConfig + for _, o := range opts { + config = o.applyFloat64Gauge(config) + } + return config +} + +// Description returns the configured description. +func (c Float64GaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64GaugeConfig) Unit() string { + return c.unit +} + +// Float64GaugeOption applies options to a [Float64GaugeConfig]. See +// [InstrumentOption] for other options that can be used as a +// Float64GaugeOption. +type Float64GaugeOption interface { + applyFloat64Gauge(Float64GaugeConfig) Float64GaugeConfig +} diff --git a/vendor/go.opentelemetry.io/otel/metric/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/syncint64.go index 56667d32f..783fdfba7 100644 --- a/vendor/go.opentelemetry.io/otel/metric/syncint64.go +++ b/vendor/go.opentelemetry.io/otel/metric/syncint64.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package metric // import "go.opentelemetry.io/otel/metric" @@ -144,7 +133,7 @@ type Int64Histogram interface { Record(ctx context.Context, incr int64, options ...RecordOption) } -// Int64HistogramConfig contains options for synchronous counter instruments +// Int64HistogramConfig contains options for synchronous histogram instruments // that record int64 values. type Int64HistogramConfig struct { description string @@ -183,3 +172,55 @@ func (c Int64HistogramConfig) ExplicitBucketBoundaries() []float64 { type Int64HistogramOption interface { applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig } + +// Int64Gauge is an instrument that records instantaneous int64 values. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Int64Gauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Int64Gauge + + // Record records the instantaneous value. + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, value int64, options ...RecordOption) +} + +// Int64GaugeConfig contains options for synchronous gauge instruments that +// record int64 values. +type Int64GaugeConfig struct { + description string + unit string +} + +// NewInt64GaugeConfig returns a new [Int64GaugeConfig] with all opts +// applied. +func NewInt64GaugeConfig(opts ...Int64GaugeOption) Int64GaugeConfig { + var config Int64GaugeConfig + for _, o := range opts { + config = o.applyInt64Gauge(config) + } + return config +} + +// Description returns the configured description. +func (c Int64GaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64GaugeConfig) Unit() string { + return c.unit +} + +// Int64GaugeOption applies options to a [Int64GaugeConfig]. See +// [InstrumentOption] for other options that can be used as a +// Int64GaugeOption. +type Int64GaugeOption interface { + applyInt64Gauge(Int64GaugeConfig) Int64GaugeConfig +} diff --git a/vendor/go.opentelemetry.io/otel/propagation.go b/vendor/go.opentelemetry.io/otel/propagation.go index d29aaa32c..2fd949733 100644 --- a/vendor/go.opentelemetry.io/otel/propagation.go +++ b/vendor/go.opentelemetry.io/otel/propagation.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/propagation/README.md b/vendor/go.opentelemetry.io/otel/propagation/README.md new file mode 100644 index 000000000..e2959ac74 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/propagation/README.md @@ -0,0 +1,3 @@ +# Propagation + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/propagation)](https://pkg.go.dev/go.opentelemetry.io/otel/propagation) diff --git a/vendor/go.opentelemetry.io/otel/propagation/baggage.go b/vendor/go.opentelemetry.io/otel/propagation/baggage.go index 303cdf1cb..552263ba7 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/baggage.go +++ b/vendor/go.opentelemetry.io/otel/propagation/baggage.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package propagation // import "go.opentelemetry.io/otel/propagation" diff --git a/vendor/go.opentelemetry.io/otel/propagation/doc.go b/vendor/go.opentelemetry.io/otel/propagation/doc.go index c119eb285..33a3baf15 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/doc.go +++ b/vendor/go.opentelemetry.io/otel/propagation/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package propagation contains OpenTelemetry context propagators. diff --git a/vendor/go.opentelemetry.io/otel/propagation/propagation.go b/vendor/go.opentelemetry.io/otel/propagation/propagation.go index c94438f73..8c8286aab 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/propagation.go +++ b/vendor/go.opentelemetry.io/otel/propagation/propagation.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package propagation // import "go.opentelemetry.io/otel/propagation" diff --git a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go index 75a8f3435..6870e316d 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go +++ b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package propagation // import "go.opentelemetry.io/otel/propagation" @@ -18,7 +7,7 @@ import ( "context" "encoding/hex" "fmt" - "regexp" + "strings" "go.opentelemetry.io/otel/trace" ) @@ -28,6 +17,7 @@ const ( maxVersion = 254 traceparentHeader = "traceparent" tracestateHeader = "tracestate" + delimiter = "-" ) // TraceContext is a propagator that supports the W3C Trace Context format @@ -41,11 +31,11 @@ const ( type TraceContext struct{} var ( - _ TextMapPropagator = TraceContext{} - traceCtxRegExp = regexp.MustCompile("^(?P[0-9a-f]{2})-(?P[a-f0-9]{32})-(?P[a-f0-9]{16})-(?P[a-f0-9]{2})(?:-.*)?$") + _ TextMapPropagator = TraceContext{} + versionPart = fmt.Sprintf("%.2X", supportedVersion) ) -// Inject set tracecontext from the Context into the carrier. +// Inject injects the trace context from ctx into carrier. func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { sc := trace.SpanContextFromContext(ctx) if !sc.IsValid() { @@ -59,12 +49,19 @@ func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { // Clear all flags other than the trace-context supported sampling bit. flags := sc.TraceFlags() & trace.FlagsSampled - h := fmt.Sprintf("%.2x-%s-%s-%s", - supportedVersion, - sc.TraceID(), - sc.SpanID(), - flags) - carrier.Set(traceparentHeader, h) + var sb strings.Builder + sb.Grow(2 + 32 + 16 + 2 + 3) + _, _ = sb.WriteString(versionPart) + traceID := sc.TraceID() + spanID := sc.SpanID() + flagByte := [1]byte{byte(flags)} + var buf [32]byte + for _, src := range [][]byte{traceID[:], spanID[:], flagByte[:]} { + _ = sb.WriteByte(delimiter[0]) + n := hex.Encode(buf[:], src) + _, _ = sb.Write(buf[:n]) + } + carrier.Set(traceparentHeader, sb.String()) } // Extract reads tracecontext from the carrier into a returned Context. @@ -86,21 +83,8 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { return trace.SpanContext{} } - matches := traceCtxRegExp.FindStringSubmatch(h) - - if len(matches) == 0 { - return trace.SpanContext{} - } - - if len(matches) < 5 { // four subgroups plus the overall match - return trace.SpanContext{} - } - - if len(matches[1]) != 2 { - return trace.SpanContext{} - } - ver, err := hex.DecodeString(matches[1]) - if err != nil { + var ver [1]byte + if !extractPart(ver[:], &h, 2) { return trace.SpanContext{} } version := int(ver[0]) @@ -108,36 +92,24 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { return trace.SpanContext{} } - if version == 0 && len(matches) != 5 { // four subgroups plus the overall match - return trace.SpanContext{} - } - - if len(matches[2]) != 32 { - return trace.SpanContext{} - } - var scc trace.SpanContextConfig - - scc.TraceID, err = trace.TraceIDFromHex(matches[2][:32]) - if err != nil { + if !extractPart(scc.TraceID[:], &h, 32) { return trace.SpanContext{} } - - if len(matches[3]) != 16 { - return trace.SpanContext{} - } - scc.SpanID, err = trace.SpanIDFromHex(matches[3]) - if err != nil { + if !extractPart(scc.SpanID[:], &h, 16) { return trace.SpanContext{} } - if len(matches[4]) != 2 { + var opts [1]byte + if !extractPart(opts[:], &h, 2) { return trace.SpanContext{} } - opts, err := hex.DecodeString(matches[4]) - if err != nil || len(opts) < 1 || (version == 0 && opts[0] > 2) { + if version == 0 && (h != "" || opts[0] > 2) { + // version 0 not allow extra + // version 0 not allow other flag return trace.SpanContext{} } + // Clear all flags other than the trace-context supported sampling bit. scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled @@ -155,6 +127,29 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { return sc } +// upperHex detect hex is upper case Unicode characters. +func upperHex(v string) bool { + for _, c := range v { + if c >= 'A' && c <= 'F' { + return true + } + } + return false +} + +func extractPart(dst []byte, h *string, n int) bool { + part, left, _ := strings.Cut(*h, delimiter) + *h = left + // hex.Decode decodes unsupported upper-case characters, so exclude explicitly. + if len(part) != n || upperHex(part) { + return false + } + if p, err := hex.Decode(dst, []byte(part)); err != nil || p != n/2 { + return false + } + return true +} + // Fields returns the keys who's values are set with Inject. func (tc TraceContext) Fields() []string { return []string{traceparentHeader, tracestateHeader} diff --git a/vendor/go.opentelemetry.io/otel/renovate.json b/vendor/go.opentelemetry.io/otel/renovate.json new file mode 100644 index 000000000..8c5ac55ca --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/renovate.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ], + "ignorePaths": [], + "labels": ["Skip Changelog", "dependencies"], + "postUpdateOptions" : [ + "gomodTidy" + ], + "packageRules": [ + { + "matchManagers": ["gomod"], + "matchDepTypes": ["indirect"], + "enabled": true + }, + { + "matchFileNames": ["internal/tools/**"], + "matchManagers": ["gomod"], + "matchDepTypes": ["indirect"], + "enabled": false + } + ] +} diff --git a/vendor/go.opentelemetry.io/otel/requirements.txt b/vendor/go.opentelemetry.io/otel/requirements.txt index e0a43e138..ab09daf9d 100644 --- a/vendor/go.opentelemetry.io/otel/requirements.txt +++ b/vendor/go.opentelemetry.io/otel/requirements.txt @@ -1 +1 @@ -codespell==2.2.6 +codespell==2.3.0 diff --git a/vendor/go.opentelemetry.io/otel/sdk/README.md b/vendor/go.opentelemetry.io/otel/sdk/README.md new file mode 100644 index 000000000..f81b1576a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/README.md @@ -0,0 +1,3 @@ +# SDK + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/sdk)](https://pkg.go.dev/go.opentelemetry.io/otel/sdk) diff --git a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/README.md b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/README.md new file mode 100644 index 000000000..06e6d8685 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/README.md @@ -0,0 +1,3 @@ +# SDK Instrumentation + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/sdk/instrumentation)](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/instrumentation) diff --git a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go index 6e923acab..a4faa6a03 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go +++ b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package instrumentation provides types to represent the code libraries that // provide OpenTelemetry instrumentation. These types are used in the diff --git a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go index 39f025a17..f4d1857c4 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go +++ b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" diff --git a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go index 09c6d93f6..728115045 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go +++ b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go b/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go index 59dcfab25..07923ed8d 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go +++ b/vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package env // import "go.opentelemetry.io/otel/sdk/internal/env" @@ -33,7 +22,7 @@ const ( BatchSpanProcessorMaxQueueSizeKey = "OTEL_BSP_MAX_QUEUE_SIZE" // BatchSpanProcessorMaxExportBatchSizeKey is the maximum batch size (i.e. // 512). Note: it must be less than or equal to - // EnvBatchSpanProcessorMaxQueueSize. + // BatchSpanProcessorMaxQueueSize. BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" // AttributeValueLengthKey is the maximum allowed attribute value size. diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/gen.go b/vendor/go.opentelemetry.io/otel/sdk/internal/gen.go deleted file mode 100644 index bd84f624b..000000000 --- a/vendor/go.opentelemetry.io/otel/sdk/internal/gen.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/sdk/internal" - -//go:generate gotmpl --body=../../internal/shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go -//go:generate gotmpl --body=../../internal/shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go -//go:generate gotmpl --body=../../internal/shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go - -//go:generate gotmpl --body=../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go -//go:generate gotmpl --body=../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go -//go:generate gotmpl --body=../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go -//go:generate gotmpl --body=../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go -//go:generate gotmpl --body=../../internal/shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/sdk/internal/matchers\"}" --out=internaltest/harness.go -//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go -//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go -//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go -//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go b/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go deleted file mode 100644 index dfeaaa8ca..000000000 --- a/vendor/go.opentelemetry.io/otel/sdk/internal/internal.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/sdk/internal" - -import "time" - -// MonotonicEndTime returns the end time at present -// but offset from start, monotonically. -// -// The monotonic clock is used in subtractions hence -// the duration since start added back to start gives -// end as a monotonic time. -// See https://golang.org/pkg/time/#hdr-Monotonic_Clocks -func MonotonicEndTime(start time.Time) time.Time { - return start.Add(time.Since(start)) -} diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/x/README.md b/vendor/go.opentelemetry.io/otel/sdk/internal/x/README.md new file mode 100644 index 000000000..fab61647c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/internal/x/README.md @@ -0,0 +1,46 @@ +# Experimental Features + +The SDK contains features that have not yet stabilized in the OpenTelemetry specification. +These features are added to the OpenTelemetry Go SDK prior to stabilization in the specification so that users can start experimenting with them and provide feedback. + +These feature may change in backwards incompatible ways as feedback is applied. +See the [Compatibility and Stability](#compatibility-and-stability) section for more information. + +## Features + +- [Resource](#resource) + +### Resource + +[OpenTelemetry resource semantic conventions] include many attribute definitions that are defined as experimental. +To have experimental semantic conventions be added by [resource detectors] set the `OTEL_GO_X_RESOURCE` environment variable. +The value set must be the case-insensitive string of `"true"` to enable the feature. +All other values are ignored. + + + +[OpenTelemetry resource semantic conventions]: https://opentelemetry.io/docs/specs/semconv/resource/ +[resource detectors]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Detector + +#### Examples + +Enable experimental resource semantic conventions. + +```console +export OTEL_GO_X_RESOURCE=true +``` + +Disable experimental resource semantic conventions. + +```console +unset OTEL_GO_X_RESOURCE +``` + +## Compatibility and Stability + +Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../../VERSIONING.md). +These features may be removed or modified in successive version releases, including patch versions. + +When an experimental feature is promoted to a stable feature, a migration path will be included in the changelog entry of the release. +There is no guarantee that any environment variable feature flags that enabled the experimental feature will be supported by the stable version. +If they are supported, they may be accompanied with a deprecation notice stating a timeline for the removal of that support. diff --git a/vendor/go.opentelemetry.io/otel/sdk/internal/x/x.go b/vendor/go.opentelemetry.io/otel/sdk/internal/x/x.go new file mode 100644 index 000000000..68d296cbe --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/internal/x/x.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package x contains support for OTel SDK experimental features. +// +// This package should only be used for features defined in the specification. +// It should not be used for experiments or new project ideas. +package x // import "go.opentelemetry.io/otel/sdk/internal/x" + +import ( + "os" + "strings" +) + +// Resource is an experimental feature flag that defines if resource detectors +// should be included experimental semantic conventions. +// +// To enable this feature set the OTEL_GO_X_RESOURCE environment variable +// to the case-insensitive string value of "true" (i.e. "True" and "TRUE" +// will also enable this). +var Resource = newFeature("RESOURCE", func(v string) (string, bool) { + if strings.ToLower(v) == "true" { + return v, true + } + return "", false +}) + +// Feature is an experimental feature control flag. It provides a uniform way +// to interact with these feature flags and parse their values. +type Feature[T any] struct { + key string + parse func(v string) (T, bool) +} + +func newFeature[T any](suffix string, parse func(string) (T, bool)) Feature[T] { + const envKeyRoot = "OTEL_GO_X_" + return Feature[T]{ + key: envKeyRoot + suffix, + parse: parse, + } +} + +// Key returns the environment variable key that needs to be set to enable the +// feature. +func (f Feature[T]) Key() string { return f.key } + +// Lookup returns the user configured value for the feature and true if the +// user has enabled the feature. Otherwise, if the feature is not enabled, a +// zero-value and false are returned. +func (f Feature[T]) Lookup() (v T, ok bool) { + // https://github.com/open-telemetry/opentelemetry-specification/blob/62effed618589a0bec416a87e559c0a9d96289bb/specification/configuration/sdk-environment-variables.md#parsing-empty-value + // + // > The SDK MUST interpret an empty value of an environment variable the + // > same way as when the variable is unset. + vRaw := os.Getenv(f.key) + if vRaw == "" { + return v, ok + } + return f.parse(vRaw) +} + +// Enabled returns if the feature is enabled. +func (f Feature[T]) Enabled() bool { + _, ok := f.Lookup() + return ok +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/README.md b/vendor/go.opentelemetry.io/otel/sdk/resource/README.md new file mode 100644 index 000000000..4ad864d71 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/README.md @@ -0,0 +1,3 @@ +# SDK Resource + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/sdk/resource)](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource) diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go index 4279013be..95a61d61d 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" @@ -41,8 +30,20 @@ type Detector interface { // must never be done outside of a new major release. } -// Detect calls all input detectors sequentially and merges each result with the previous one. -// It returns the merged error too. +// Detect returns a new [Resource] merged from all the Resources each of the +// detectors produces. Each of the detectors are called sequentially, in the +// order they are passed, merging the produced resource into the previous. +// +// This may return a partial Resource along with an error containing +// [ErrPartialResource] if that error is returned from a detector. It may also +// return a merge-conflicting Resource along with an error containing +// [ErrSchemaURLConflict] if merging Resources from different detectors results +// in a schema URL conflict. It is up to the caller to determine if this +// returned Resource should be used or not. +// +// If one of the detectors returns an error that is not [ErrPartialResource], +// the resource produced by the detector will not be merged and the returned +// error will wrap that detector's error. func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { r := new(Resource) return r, detect(ctx, r, detectors) @@ -50,6 +51,10 @@ func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { // detect runs all detectors using ctx and merges the result into res. This // assumes res is allocated and not nil, it will panic otherwise. +// +// If the detectors or merging resources produces any errors (i.e. +// [ErrPartialResource] [ErrSchemaURLConflict]), a single error wrapping all of +// these errors will be returned. Otherwise, nil is returned. func detect(ctx context.Context, res *Resource, detectors []Detector) error { var ( r *Resource @@ -78,6 +83,11 @@ func detect(ctx context.Context, res *Resource, detectors []Detector) error { if len(errs) == 0 { return nil } + if errors.Is(errs, ErrSchemaURLConflict) { + // If there has been a merge conflict, ensure the resource has no + // schema URL. + res.schemaURL = "" + } return errs } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go b/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go index c63a0dd1f..6ac1cdbf7 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" @@ -20,9 +9,11 @@ import ( "os" "path/filepath" + "github.com/google/uuid" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" ) type ( @@ -47,6 +38,8 @@ type ( } defaultServiceNameDetector struct{} + + defaultServiceInstanceIDDetector struct{} ) var ( @@ -54,6 +47,7 @@ var ( _ Detector = host{} _ Detector = stringDetector{} _ Detector = defaultServiceNameDetector{} + _ Detector = defaultServiceInstanceIDDetector{} ) // Detect returns a *Resource that describes the OpenTelemetry SDK used. @@ -106,3 +100,19 @@ func (defaultServiceNameDetector) Detect(ctx context.Context) (*Resource, error) }, ).Detect(ctx) } + +// Detect implements Detector. +func (defaultServiceInstanceIDDetector) Detect(ctx context.Context) (*Resource, error) { + return StringDetector( + semconv.SchemaURL, + semconv.ServiceInstanceIDKey, + func() (string, error) { + version4Uuid, err := uuid.NewRandom() + if err != nil { + return "", err + } + + return version4Uuid.String(), nil + }, + ).Detect(ctx) +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/config.go b/vendor/go.opentelemetry.io/otel/sdk/resource/config.go index f263919f6..0d6e213d9 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/config.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/config.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/container.go b/vendor/go.opentelemetry.io/otel/sdk/resource/container.go index 3d5362282..5ecd859a5 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/container.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/container.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" @@ -22,14 +11,14 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" ) type containerIDProvider func() (string, error) var ( containerID containerIDProvider = getContainerIDFromCGroup - cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*-)?([0-9a-f]+)(?:\.|\s*$)`) + cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]+)(?:\.|\s*$)`) ) type cgroupContainerIDDetector struct{} diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go b/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go index d55a50b0d..64939a271 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package resource provides detecting and representing resources. // diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/env.go b/vendor/go.opentelemetry.io/otel/sdk/resource/env.go index e29ae563a..813f05624 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/env.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/env.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" @@ -23,7 +12,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" ) const ( diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go index fb1ebf2ca..2d0f65498 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" @@ -19,7 +8,7 @@ import ( "errors" "strings" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" ) type hostIDProvider func() (string, error) diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go index 1778bbacf..cc8b8938e 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 //go:build dragonfly || freebsd || netbsd || openbsd || solaris // +build dragonfly freebsd netbsd openbsd solaris diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go index ba41409b2..b09fde3b7 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go index 207acb0ed..d9e5d1a8f 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 //go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go index 410579b8f..f84f17324 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 //go:build linux // +build linux diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go index 721e3ca6e..6354b3560 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 //go:build linux || dragonfly || freebsd || netbsd || openbsd || solaris diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go index 89df9d688..df12c44c5 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go @@ -1,25 +1,8 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 -// +build !darwin -// +build !dragonfly -// +build !freebsd -// +build !linux -// +build !netbsd -// +build !openbsd -// +build !solaris -// +build !windows +//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows +// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows package resource // import "go.opentelemetry.io/otel/sdk/resource" diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go index 5b431c6ee..71386e2da 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 //go:build windows // +build windows diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/os.go b/vendor/go.opentelemetry.io/otel/sdk/resource/os.go index 0cbd55973..8a48ab4fa 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/os.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/os.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" @@ -19,7 +8,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" ) type osDescriptionProvider func() (string, error) diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go b/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go index 24ec85793..ce455dc54 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go b/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go index c771942de..f537e5ca5 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 //go:build aix || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix dragonfly freebsd linux netbsd openbsd solaris zos diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go b/vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go index 1c84afc18..a6ff26a4d 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go b/vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go index 3ebcb534f..a77742b07 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go @@ -1,27 +1,8 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 -// +build !aix -// +build !darwin -// +build !dragonfly -// +build !freebsd -// +build !linux -// +build !netbsd -// +build !openbsd -// +build !solaris -// +build !windows -// +build !zos +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos +// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package resource // import "go.opentelemetry.io/otel/sdk/resource" diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go b/vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go index faad64d8d..5e3d199d7 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/process.go b/vendor/go.opentelemetry.io/otel/sdk/resource/process.go index ecdd11dd7..085fe68fd 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/process.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/process.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" @@ -22,7 +11,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" ) type ( diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go index 176ff1066..ad4b50df4 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go @@ -1,26 +1,17 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( "context" "errors" + "fmt" "sync" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/internal/x" ) // Resource describes an entity about which identifying information @@ -40,9 +31,20 @@ var ( defaultResourceOnce sync.Once ) -var errMergeConflictSchemaURL = errors.New("cannot merge resource due to conflicting Schema URL") +// ErrSchemaURLConflict is an error returned when two Resources are merged +// together that contain different, non-empty, schema URLs. +var ErrSchemaURLConflict = errors.New("conflicting Schema URL") -// New returns a Resource combined from the user-provided detectors. +// New returns a [Resource] built using opts. +// +// This may return a partial Resource along with an error containing +// [ErrPartialResource] if options that provide a [Detector] are used and that +// error is returned from one or more of the Detectors. It may also return a +// merge-conflict Resource along with an error containing +// [ErrSchemaURLConflict] if merging Resources from the opts results in a +// schema URL conflict (see [Resource.Merge] for more information). It is up to +// the caller to determine if this returned Resource should be used or not +// based on these errors. func New(ctx context.Context, opts ...Option) (*Resource, error) { cfg := config{} for _, opt := range opts { @@ -98,7 +100,7 @@ func (r *Resource) String() string { return r.attrs.Encoded(attribute.DefaultEncoder()) } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Resource. func (r *Resource) MarshalLog() interface{} { return struct { Attributes attribute.Set @@ -146,16 +148,29 @@ func (r *Resource) Equal(eq *Resource) bool { return r.Equivalent() == eq.Equivalent() } -// Merge creates a new resource by combining resource a and b. +// Merge creates a new [Resource] by merging a and b. +// +// If there are common keys between a and b, then the value from b will +// overwrite the value from a, even if b's value is empty. +// +// The SchemaURL of the resources will be merged according to the +// [OpenTelemetry specification rules]: // -// If there are common keys between resource a and b, then the value -// from resource b will overwrite the value from resource a, even -// if resource b's value is empty. +// - If a's schema URL is empty then the returned Resource's schema URL will +// be set to the schema URL of b, +// - Else if b's schema URL is empty then the returned Resource's schema URL +// will be set to the schema URL of a, +// - Else if the schema URLs of a and b are the same then that will be the +// schema URL of the returned Resource, +// - Else this is a merging error. If the resources have different, +// non-empty, schema URLs an error containing [ErrSchemaURLConflict] will +// be returned with the merged Resource. The merged Resource will have an +// empty schema URL. It may be the case that some unintended attributes +// have been overwritten or old semantic conventions persisted in the +// returned Resource. It is up to the caller to determine if this returned +// Resource should be used or not. // -// The SchemaURL of the resources will be merged according to the spec rules: -// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge -// If the resources have different non-empty schemaURL an empty resource and an error -// will be returned. +// [OpenTelemetry specification rules]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge func Merge(a, b *Resource) (*Resource, error) { if a == nil && b == nil { return Empty(), nil @@ -167,19 +182,6 @@ func Merge(a, b *Resource) (*Resource, error) { return a, nil } - // Merge the schema URL. - var schemaURL string - switch true { - case a.schemaURL == "": - schemaURL = b.schemaURL - case b.schemaURL == "": - schemaURL = a.schemaURL - case a.schemaURL == b.schemaURL: - schemaURL = a.schemaURL - default: - return Empty(), errMergeConflictSchemaURL - } - // Note: 'b' attributes will overwrite 'a' with last-value-wins in attribute.Key() // Meaning this is equivalent to: append(a.Attributes(), b.Attributes()...) mi := attribute.NewMergeIterator(b.Set(), a.Set()) @@ -187,8 +189,23 @@ func Merge(a, b *Resource) (*Resource, error) { for mi.Next() { combine = append(combine, mi.Attribute()) } - merged := NewWithAttributes(schemaURL, combine...) - return merged, nil + + switch { + case a.schemaURL == "": + return NewWithAttributes(b.schemaURL, combine...), nil + case b.schemaURL == "": + return NewWithAttributes(a.schemaURL, combine...), nil + case a.schemaURL == b.schemaURL: + return NewWithAttributes(a.schemaURL, combine...), nil + } + // Return the merged resource with an appropriate error. It is up to + // the user to decide if the returned resource can be used or not. + return NewSchemaless(combine...), fmt.Errorf( + "%w: %s and %s", + ErrSchemaURLConflict, + a.schemaURL, + b.schemaURL, + ) } // Empty returns an instance of Resource with no attributes. It is @@ -202,11 +219,17 @@ func Empty() *Resource { func Default() *Resource { defaultResourceOnce.Do(func() { var err error - defaultResource, err = Detect( - context.Background(), + defaultDetectors := []Detector{ defaultServiceNameDetector{}, fromEnv{}, telemetrySDK{}, + } + if x.Resource.Enabled() { + defaultDetectors = append([]Detector{defaultServiceInstanceIDDetector{}}, defaultDetectors...) + } + defaultResource, err = Detect( + context.Background(), + defaultDetectors..., ) if err != nil { otel.Handle(err) diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/README.md b/vendor/go.opentelemetry.io/otel/sdk/trace/README.md new file mode 100644 index 000000000..f2936e143 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/README.md @@ -0,0 +1,3 @@ +# SDK Trace + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/sdk/trace)](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace) diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go index c9c7effbf..1d399a75d 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" @@ -392,7 +381,7 @@ func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd R } } -func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) bool { +func (bsp *batchSpanProcessor) enqueueDrop(_ context.Context, sd ReadOnlySpan) bool { if !sd.SpanContext().IsSampled() { return false } @@ -406,7 +395,7 @@ func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) return false } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Span Processor. func (bsp *batchSpanProcessor) MarshalLog() interface{} { return struct { Type string diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go b/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go index 0285e99be..1f60524e3 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package trace contains support for OpenTelemetry distributed tracing. diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/event.go b/vendor/go.opentelemetry.io/otel/sdk/trace/event.go index 1e3b42675..60a7ed134 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/event.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/event.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/evictedqueue.go b/vendor/go.opentelemetry.io/otel/sdk/trace/evictedqueue.go index d1c86e59b..821c83faa 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/evictedqueue.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/evictedqueue.go @@ -1,36 +1,45 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" +import ( + "slices" + "sync" + + "go.opentelemetry.io/otel/internal/global" +) + // evictedQueue is a FIFO queue with a configurable capacity. -type evictedQueue struct { - queue []interface{} +type evictedQueue[T any] struct { + queue []T capacity int droppedCount int + logDropped func() } -func newEvictedQueue(capacity int) evictedQueue { +func newEvictedQueueEvent(capacity int) evictedQueue[Event] { // Do not pre-allocate queue, do this lazily. - return evictedQueue{capacity: capacity} + return evictedQueue[Event]{ + capacity: capacity, + logDropped: sync.OnceFunc(func() { global.Warn("limit reached: dropping trace trace.Event") }), + } +} + +func newEvictedQueueLink(capacity int) evictedQueue[Link] { + // Do not pre-allocate queue, do this lazily. + return evictedQueue[Link]{ + capacity: capacity, + logDropped: sync.OnceFunc(func() { global.Warn("limit reached: dropping trace trace.Link") }), + } } // add adds value to the evictedQueue eq. If eq is at capacity, the oldest // queued value will be discarded and the drop count incremented. -func (eq *evictedQueue) add(value interface{}) { +func (eq *evictedQueue[T]) add(value T) { if eq.capacity == 0 { eq.droppedCount++ + eq.logDropped() return } @@ -39,6 +48,12 @@ func (eq *evictedQueue) add(value interface{}) { copy(eq.queue[:eq.capacity-1], eq.queue[1:]) eq.queue = eq.queue[:eq.capacity-1] eq.droppedCount++ + eq.logDropped() } eq.queue = append(eq.queue, value) } + +// copy returns a copy of the evictedQueue. +func (eq *evictedQueue[T]) copy() []T { + return slices.Clone(eq.queue) +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/id_generator.go b/vendor/go.opentelemetry.io/otel/sdk/trace/id_generator.go index bba246041..925bcf993 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/id_generator.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/id_generator.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" @@ -52,7 +41,12 @@ func (gen *randomIDGenerator) NewSpanID(ctx context.Context, traceID trace.Trace gen.Lock() defer gen.Unlock() sid := trace.SpanID{} - _, _ = gen.randSource.Read(sid[:]) + for { + _, _ = gen.randSource.Read(sid[:]) + if sid.IsValid() { + break + } + } return sid } @@ -62,9 +56,19 @@ func (gen *randomIDGenerator) NewIDs(ctx context.Context) (trace.TraceID, trace. gen.Lock() defer gen.Unlock() tid := trace.TraceID{} - _, _ = gen.randSource.Read(tid[:]) sid := trace.SpanID{} - _, _ = gen.randSource.Read(sid[:]) + for { + _, _ = gen.randSource.Read(tid[:]) + if tid.IsValid() { + break + } + } + for { + _, _ = gen.randSource.Read(sid[:]) + if sid.IsValid() { + break + } + } return tid, sid } diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/link.go b/vendor/go.opentelemetry.io/otel/sdk/trace/link.go index 19cfea4ba..c03bdc90f 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/link.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/link.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go index 7d46c4b48..14c2e5beb 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" @@ -55,7 +44,7 @@ type tracerProviderConfig struct { resource *resource.Resource } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Provider. func (cfg tracerProviderConfig) MarshalLog() interface{} { return struct { SpanProcessors []SpanProcessor @@ -302,7 +291,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { retErr = err } else { // Poor man's list of errors - retErr = fmt.Errorf("%v; %v", retErr, err) + retErr = fmt.Errorf("%w; %w", retErr, err) } } } diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/sampler_env.go b/vendor/go.opentelemetry.io/otel/sdk/trace/sampler_env.go index 02053b318..d2d1f7246 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/sampler_env.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/sampler_env.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go b/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go index a7bc125b9..ebb6df6c9 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go index f8770fff7..554111bb4 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/simple_span_processor.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" @@ -36,10 +25,10 @@ var _ SpanProcessor = (*simpleSpanProcessor)(nil) // send completed spans to the exporter immediately. // // This SpanProcessor is not recommended for production use. The synchronous -// nature of this SpanProcessor make it good for testing, debugging, or -// showing examples of other feature, but it will be slow and have a high -// computation resource usage overhead. The BatchSpanProcessor is recommended -// for production use instead. +// nature of this SpanProcessor makes it good for testing, debugging, or showing +// examples of other features, but it will be slow and have a high computation +// resource usage overhead. The BatchSpanProcessor is recommended for production +// use instead. func NewSimpleSpanProcessor(exporter SpanExporter) SpanProcessor { ssp := &simpleSpanProcessor{ exporter: exporter, @@ -80,10 +69,10 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error { // // A closure is used to keep reference to the exporter and then the // field is zeroed. This ensures the simpleSpanProcessor is shut down - // before the exporter. This order is important as it avoids a - // potential deadlock. If the exporter shut down operation generates a - // span, that span would need to be exported. Meaning, OnEnd would be - // called and try acquiring the lock that is held here. + // before the exporter. This order is important as it avoids a potential + // deadlock. If the exporter shut down operation generates a span, that + // span would need to be exported. Meaning, OnEnd would be called and + // try acquiring the lock that is held here. ssp.exporterMu.Lock() done, shutdown := stopFunc(ssp.exporter) ssp.exporter = nil @@ -95,15 +84,15 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error { select { case err = <-done: case <-ctx.Done(): - // It is possible for the exporter to have immediately shut down - // and the context to be done simultaneously. In that case this - // outer select statement will randomly choose a case. This will - // result in a different returned error for similar scenarios. - // Instead, double check if the exporter shut down at the same - // time and return that error if so. This will ensure consistency - // as well as ensure the caller knows the exporter shut down - // successfully (they can already determine if the deadline is - // expired given they passed the context). + // It is possible for the exporter to have immediately shut down and + // the context to be done simultaneously. In that case this outer + // select statement will randomly choose a case. This will result in + // a different returned error for similar scenarios. Instead, double + // check if the exporter shut down at the same time and return that + // error if so. This will ensure consistency as well as ensure + // the caller knows the exporter shut down successfully (they can + // already determine if the deadline is expired given they passed + // the context). select { case err = <-done: default: @@ -119,7 +108,8 @@ func (ssp *simpleSpanProcessor) ForceFlush(context.Context) error { return nil } -// MarshalLog is the marshaling function used by the logging system to represent this Span Processor. +// MarshalLog is the marshaling function used by the logging system to represent +// this Span Processor. func (ssp *simpleSpanProcessor) MarshalLog() interface{} { return struct { Type string diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/snapshot.go b/vendor/go.opentelemetry.io/otel/sdk/trace/snapshot.go index 0349b2f19..32f862790 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/snapshot.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/snapshot.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go index 36dbf6776..ac90f1a26 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" @@ -20,6 +9,7 @@ import ( "reflect" "runtime" rt "runtime/trace" + "slices" "strings" "sync" "time" @@ -27,10 +17,10 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace/embedded" ) @@ -147,12 +137,13 @@ type recordingSpan struct { // ReadOnlySpan exported when the span ends. attributes []attribute.KeyValue droppedAttributes int + logDropAttrsOnce sync.Once // events are stored in FIFO queue capped by configured limit. - events evictedQueue + events evictedQueue[Event] // links are stored in FIFO queue capped by configured limit. - links evictedQueue + links evictedQueue[Link] // executionTracerTaskEnd ends the execution tracer span. executionTracerTaskEnd func() @@ -229,7 +220,7 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { limit := s.tracer.provider.spanLimits.AttributeCountLimit if limit == 0 { // No attributes allowed. - s.droppedAttributes += len(attributes) + s.addDroppedAttr(len(attributes)) return } @@ -242,10 +233,11 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { // Otherwise, add without deduplication. When attributes are read they // will be deduplicated, optimizing the operation. + s.attributes = slices.Grow(s.attributes, len(s.attributes)+len(attributes)) for _, a := range attributes { if !a.Valid() { // Drop all invalid attributes. - s.droppedAttributes++ + s.addDroppedAttr(1) continue } a = truncateAttr(s.tracer.provider.spanLimits.AttributeValueLengthLimit, a) @@ -253,6 +245,22 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { } } +// Declared as a var so tests can override. +var logDropAttrs = func() { + global.Warn("limit reached: dropping trace Span attributes") +} + +// addDroppedAttr adds incr to the count of dropped attributes. +// +// The first, and only the first, time this method is called a warning will be +// logged. +// +// This method assumes s.mu.Lock is held by the caller. +func (s *recordingSpan) addDroppedAttr(incr int) { + s.droppedAttributes += incr + s.logDropAttrsOnce.Do(logDropAttrs) +} + // addOverCapAttrs adds the attributes attrs to the span s while // de-duplicating the attributes of s and attrs and dropping attributes that // exceed the limit. @@ -277,10 +285,12 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) { // Now that s.attributes is deduplicated, adding unique attributes up to // the capacity of s will not over allocate s.attributes. + sum := len(attrs) + len(s.attributes) + s.attributes = slices.Grow(s.attributes, min(sum, limit)) for _, a := range attrs { if !a.Valid() { // Drop all invalid attributes. - s.droppedAttributes++ + s.addDroppedAttr(1) continue } @@ -293,7 +303,7 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) { if len(s.attributes) >= limit { // Do not just drop all of the remaining attributes, make sure // updates are checked and performed. - s.droppedAttributes++ + s.addDroppedAttr(1) } else { a = truncateAttr(s.tracer.provider.spanLimits.AttributeValueLengthLimit, a) s.attributes = append(s.attributes, a) @@ -374,7 +384,7 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { // Store the end time as soon as possible to avoid artificially increasing // the span's duration in case some operation below takes a while. - et := internal.MonotonicEndTime(s.startTime) + et := monotonicEndTime(s.startTime) // Do relative expensive check now that we have an end time and see if we // need to do any more processing. @@ -425,6 +435,16 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { } } +// monotonicEndTime returns the end time at present but offset from start, +// monotonically. +// +// The monotonic clock is used in subtractions hence the duration since start +// added back to start gives end as a monotonic time. See +// https://golang.org/pkg/time/#hdr-Monotonic_Clocks +func monotonicEndTime(start time.Time) time.Time { + return start.Add(time.Since(start)) +} + // RecordError will record err as a span event for this span. An additional call to // SetStatus is required if the Status of the Span should be set to Error, this method // does not change the Span status. If this span is not being recorded or err is nil @@ -592,7 +612,7 @@ func (s *recordingSpan) Links() []Link { if len(s.links.queue) == 0 { return []Link{} } - return s.interfaceArrayToLinksArray() + return s.links.copy() } // Events returns the events of this span. @@ -602,7 +622,7 @@ func (s *recordingSpan) Events() []Event { if len(s.events.queue) == 0 { return []Event{} } - return s.interfaceArrayToEventArray() + return s.events.copy() } // Status returns the status of this span. @@ -636,8 +656,12 @@ func (s *recordingSpan) Resource() *resource.Resource { return s.tracer.provider.resource } -func (s *recordingSpan) addLink(link trace.Link) { - if !s.IsRecording() || !link.SpanContext.IsValid() { +func (s *recordingSpan) AddLink(link trace.Link) { + if !s.IsRecording() { + return + } + if !link.SpanContext.IsValid() && len(link.Attributes) == 0 && + link.SpanContext.TraceState().Len() == 0 { return } @@ -720,32 +744,16 @@ func (s *recordingSpan) snapshot() ReadOnlySpan { } sd.droppedAttributeCount = s.droppedAttributes if len(s.events.queue) > 0 { - sd.events = s.interfaceArrayToEventArray() + sd.events = s.events.copy() sd.droppedEventCount = s.events.droppedCount } if len(s.links.queue) > 0 { - sd.links = s.interfaceArrayToLinksArray() + sd.links = s.links.copy() sd.droppedLinkCount = s.links.droppedCount } return &sd } -func (s *recordingSpan) interfaceArrayToLinksArray() []Link { - linkArr := make([]Link, 0) - for _, value := range s.links.queue { - linkArr = append(linkArr, value.(Link)) - } - return linkArr -} - -func (s *recordingSpan) interfaceArrayToEventArray() []Event { - eventArr := make([]Event, 0) - for _, value := range s.events.queue { - eventArr = append(eventArr, value.(Event)) - } - return eventArr -} - func (s *recordingSpan) addChild() { if !s.IsRecording() { return @@ -810,6 +818,9 @@ func (nonRecordingSpan) RecordError(error, ...trace.EventOption) {} // AddEvent does nothing. func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {} +// AddLink does nothing. +func (nonRecordingSpan) AddLink(trace.Link) {} + // SetName does nothing. func (nonRecordingSpan) SetName(string) {} diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go index c9bd52f7a..6bdda3d94 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span_exporter.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span_limits.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span_limits.go index aa4d4221d..bec5e2097 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span_limits.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span_limits.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go index 9c53657a7..af7f9177f 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span_processor.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go b/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go index 301e1a7ab..43419d3b5 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" @@ -143,13 +132,13 @@ func (tr *tracer) newRecordingSpan(psc, sc trace.SpanContext, name string, sr Sa spanKind: trace.ValidateSpanKind(config.SpanKind()), name: name, startTime: startTime, - events: newEvictedQueue(tr.provider.spanLimits.EventCountLimit), - links: newEvictedQueue(tr.provider.spanLimits.LinkCountLimit), + events: newEvictedQueueEvent(tr.provider.spanLimits.EventCountLimit), + links: newEvictedQueueLink(tr.provider.spanLimits.LinkCountLimit), tracer: tr, } for _, l := range config.Links() { - s.addLink(l) + s.AddLink(l) } s.SetAttributes(sr.Attributes...) diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/version.go b/vendor/go.opentelemetry.io/otel/sdk/trace/version.go index d3457ed13..b84dd2c5e 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/version.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/version.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/sdk/trace" diff --git a/vendor/go.opentelemetry.io/otel/sdk/version.go b/vendor/go.opentelemetry.io/otel/sdk/version.go index 7048c788e..33d065a7c 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/version.go +++ b/vendor/go.opentelemetry.io/otel/sdk/version.go @@ -1,20 +1,9 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.20.0" + return "1.28.0" } diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/README.md new file mode 100644 index 000000000..87b842c5d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/README.md @@ -0,0 +1,3 @@ +# Semconv v1.17.0 + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.17.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.17.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go index 71a1f7748..e087c9c04 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package semconv implements OpenTelemetry semantic conventions. // diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go index 679c40c4d..c7b804bbe 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/event.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Code generated from semantic convention specification. DO NOT EDIT. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go index 9b8c559de..137acc67d 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go index d5c4b5c13..d318221e5 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go index 39a2eab3a..7e365e82c 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Code generated from semantic convention specification. DO NOT EDIT. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go index 42fc525d1..634a1dce0 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go index 8c4a7299d..21497bb6b 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Code generated from semantic convention specification. DO NOT EDIT. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/README.md new file mode 100644 index 000000000..82e1f46b4 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/README.md @@ -0,0 +1,3 @@ +# Semconv v1.20.0 + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.20.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.20.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go new file mode 100644 index 000000000..6685c392b --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go @@ -0,0 +1,1198 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// Describes HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the hTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the [HTTP + // response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the hTTP request method. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the [HTTP response +// status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTP Server spans attributes +const ( + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the URI scheme identifying the used + // protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/specification/trace/semantic_conventions/http.md#http-server-definitions) + // if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the URI scheme identifying the used +// protocol. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the transport protocol used. See + // note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. It represents the application + // layer protocol used. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. It represents the version + // of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.protocol.version` refers to the version of the protocol used + // and might be different from the protocol client's version. If the HTTP + // client used has a version of `0.27.2`, but sends HTTP version `1.1`, + // this attribute should be set to `1.1`. + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the remote + // socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from + // `net.peer.name` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the remote + // socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, + // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the remote + // socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the protocol + // [address + // family](https://man7.org/linux/man-pages/man7/address_families.7.html) + // which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if + // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers + // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the logical remote hostname, see + // note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an + // extra DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the logical local hostname or + // similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the logical local port number, + // preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the local + // socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the local + // socket port number. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If defined for the address + // family and if different than `net.host.port` and if `net.sock.host.addr` + // is set. In other cases, it is still recommended to set this.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. It represents the application +// layer protocol used. The value SHOULD be normalized to lowercase. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. It represents the version of +// the application layer protocol used. See note below. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the remote socket +// peer name. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the remote socket +// peer address: IPv4 or IPv6 for internet protocols, path for local +// communication, +// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the remote socket +// peer port. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the logical remote +// hostname, see note below. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the logical remote port +// number +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the logical local +// hostname or similar, see note below. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the logical local port +// number, preferably the one that the peer used to connect +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the local socket +// address. Useful in case of a multi-IP host. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the local socket +// port number. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetHostConnectionTypeKey is the attribute Key conforming to the + // "net.host.connection.type" semantic conventions. It represents the + // internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + + // NetHostConnectionSubtypeKey is the attribute Key conforming to the + // "net.host.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + + // NetHostCarrierNameKey is the attribute Key conforming to the + // "net.host.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + + // NetHostCarrierMccKey is the attribute Key conforming to the + // "net.host.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + + // NetHostCarrierMncKey is the attribute Key conforming to the + // "net.host.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + + // NetHostCarrierIccKey is the attribute Key conforming to the + // "net.host.carrier.icc" semantic conventions. It represents the ISO + // 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// NetHostCarrierName returns an attribute KeyValue conforming to the +// "net.host.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetHostCarrierName(val string) attribute.KeyValue { + return NetHostCarrierNameKey.String(val) +} + +// NetHostCarrierMcc returns an attribute KeyValue conforming to the +// "net.host.carrier.mcc" semantic conventions. It represents the mobile +// carrier country code. +func NetHostCarrierMcc(val string) attribute.KeyValue { + return NetHostCarrierMccKey.String(val) +} + +// NetHostCarrierMnc returns an attribute KeyValue conforming to the +// "net.host.carrier.mnc" semantic conventions. It represents the mobile +// carrier network code. +func NetHostCarrierMnc(val string) attribute.KeyValue { + return NetHostCarrierMncKey.String(val) +} + +// NetHostCarrierIcc returns an attribute KeyValue conforming to the +// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetHostCarrierIcc(val string) attribute.KeyValue { + return NetHostCarrierIccKey.String(val) +} + +// Semantic conventions for HTTP client and server Spans. +const ( + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the size +// of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the size +// of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// Semantic convention for attributes that describe messaging source on broker +const ( + // MessagingSourceNameKey is the attribute Key conforming to the + // "messaging.source.name" semantic conventions. It represents the message + // source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Source name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker does not have such notion, the source name SHOULD uniquely + // identify the broker. + MessagingSourceNameKey = attribute.Key("messaging.source.name") + + // MessagingSourceTemplateKey is the attribute Key conforming to the + // "messaging.source.template" semantic conventions. It represents the low + // cardinality representation of the messaging source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Source names could be constructed from templates. An example would + // be a source name involving a user name or product id. Although the + // source name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. + MessagingSourceTemplateKey = attribute.Key("messaging.source.template") + + // MessagingSourceTemporaryKey is the attribute Key conforming to the + // "messaging.source.temporary" semantic conventions. It represents a + // boolean that is true if the message source is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") + + // MessagingSourceAnonymousKey is the attribute Key conforming to the + // "messaging.source.anonymous" semantic conventions. It represents a + // boolean that is true if the message source is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") +) + +// MessagingSourceName returns an attribute KeyValue conforming to the +// "messaging.source.name" semantic conventions. It represents the message +// source name +func MessagingSourceName(val string) attribute.KeyValue { + return MessagingSourceNameKey.String(val) +} + +// MessagingSourceTemplate returns an attribute KeyValue conforming to the +// "messaging.source.template" semantic conventions. It represents the low +// cardinality representation of the messaging source name +func MessagingSourceTemplate(val string) attribute.KeyValue { + return MessagingSourceTemplateKey.String(val) +} + +// MessagingSourceTemporary returns an attribute KeyValue conforming to the +// "messaging.source.temporary" semantic conventions. It represents a boolean +// that is true if the message source is temporary and might not exist anymore +// after messages are processed. +func MessagingSourceTemporary(val bool) attribute.KeyValue { + return MessagingSourceTemporaryKey.Bool(val) +} + +// MessagingSourceAnonymous returns an attribute KeyValue conforming to the +// "messaging.source.anonymous" semantic conventions. It represents a boolean +// that is true if the message source is anonymous (could be unnamed or have +// auto-generated name). +func MessagingSourceAnonymous(val bool) attribute.KeyValue { + return MessagingSourceAnonymousKey.Bool(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaClientIDKey is the attribute Key conforming to the + // "messaging.kafka.client_id" semantic conventions. It represents the + // client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the + // "messaging.kafka.source.partition" semantic conventions. It represents + // the partition the message is received from. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaClientID returns an attribute KeyValue conforming to the +// "messaging.kafka.client_id" semantic conventions. It represents the client +// ID for the Consumer or Producer that is handling the message. +func MessagingKafkaClientID(val string) attribute.KeyValue { + return MessagingKafkaClientIDKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to +// the "messaging.kafka.source.partition" semantic conventions. It represents +// the partition the message is received from. +func MessagingKafkaSourcePartition(val int) attribute.KeyValue { + return MessagingKafkaSourcePartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqClientIDKey is the attribute Key conforming to the + // "messaging.rocketmq.client_id" semantic conventions. It represents the + // unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqClientID returns an attribute KeyValue conforming to the +// "messaging.rocketmq.client_id" semantic conventions. It represents the +// unique identifier for each client. +func MessagingRocketmqClientID(val string) attribute.KeyValue { + return MessagingRocketmqClientIDKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go new file mode 100644 index 000000000..0d1f55a8f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.20.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/event.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go similarity index 92% rename from vendor/go.opentelemetry.io/otel/semconv/v1.21.0/event.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go index 30ae34fe4..637763932 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/event.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go @@ -1,20 +1,9 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Code generated from semantic convention specification. DO NOT EDIT. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go new file mode 100644 index 000000000..f40c97825 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go new file mode 100644 index 000000000..9c1840631 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go @@ -0,0 +1,10 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go similarity index 86% rename from vendor/go.opentelemetry.io/otel/semconv/v1.21.0/resource.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go index b6d8935cf..3d44dae27 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/resource.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go @@ -1,20 +1,9 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Code generated from semantic convention specification. DO NOT EDIT. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" import "go.opentelemetry.io/otel/attribute" @@ -273,8 +262,6 @@ var ( CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") // Azure Red Hat OpenShift CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") - // Google Bare Metal Solution (BMS) - CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") // Google Cloud Compute Engine (GCE) CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") // Google Cloud Run @@ -547,103 +534,6 @@ func AWSLogStreamARNs(val ...string) attribute.KeyValue { return AWSLogStreamARNsKey.StringSlice(val) } -// Resource used by Google Cloud Run. -const ( - // GCPCloudRunJobExecutionKey is the attribute Key conforming to the - // "gcp.cloud_run.job.execution" semantic conventions. It represents the - // name of the Cloud Run - // [execution](https://cloud.google.com/run/docs/managing/job-executions) - // being run for the Job, as set by the - // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) - // environment variable. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'job-name-xxxx', 'sample-job-mdw84' - GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") - - // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the - // "gcp.cloud_run.job.task_index" semantic conventions. It represents the - // index for a task within an execution as provided by the - // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) - // environment variable. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 0, 1 - GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") -) - -// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the -// "gcp.cloud_run.job.execution" semantic conventions. It represents the name -// of the Cloud Run -// [execution](https://cloud.google.com/run/docs/managing/job-executions) being -// run for the Job, as set by the -// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) -// environment variable. -func GCPCloudRunJobExecution(val string) attribute.KeyValue { - return GCPCloudRunJobExecutionKey.String(val) -} - -// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the -// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index -// for a task within an execution as provided by the -// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) -// environment variable. -func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { - return GCPCloudRunJobTaskIndexKey.Int(val) -} - -// Resources used by Google Compute Engine (GCE). -const ( - // GCPGceInstanceNameKey is the attribute Key conforming to the - // "gcp.gce.instance.name" semantic conventions. It represents the instance - // name of a GCE instance. This is the value provided by `host.name`, the - // visible name of the instance in the Cloud Console UI, and the prefix for - // the default hostname of the instance as defined by the [default internal - // DNS - // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'instance-1', 'my-vm-name' - GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") - - // GCPGceInstanceHostnameKey is the attribute Key conforming to the - // "gcp.gce.instance.hostname" semantic conventions. It represents the - // hostname of a GCE instance. This is the full value of the default or - // [custom - // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'my-host1234.example.com', - // 'sample-vm.us-west1-b.c.my-project.internal' - GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") -) - -// GCPGceInstanceName returns an attribute KeyValue conforming to the -// "gcp.gce.instance.name" semantic conventions. It represents the instance -// name of a GCE instance. This is the value provided by `host.name`, the -// visible name of the instance in the Cloud Console UI, and the prefix for the -// default hostname of the instance as defined by the [default internal DNS -// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). -func GCPGceInstanceName(val string) attribute.KeyValue { - return GCPGceInstanceNameKey.String(val) -} - -// GCPGceInstanceHostname returns an attribute KeyValue conforming to the -// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname -// of a GCE instance. This is the full value of the default or [custom -// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). -func GCPGceInstanceHostname(val string) attribute.KeyValue { - return GCPGceInstanceHostnameKey.String(val) -} - // Heroku dyno metadata const ( // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the @@ -751,59 +641,6 @@ const ( // Stability: stable // Examples: '0.1' ContainerImageTagKey = attribute.Key("container.image.tag") - - // ContainerImageIDKey is the attribute Key conforming to the - // "container.image.id" semantic conventions. It represents the runtime - // specific image identifier. Usually a hash algorithm followed by a UUID. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' - // Note: Docker defines a sha256 of the image id; `container.image.id` - // corresponds to the `Image` field from the Docker container inspect - // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) - // endpoint. - // K8S defines a link to the container registry repository with digest - // `"imageID": "registry.azurecr.io - // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. - // OCI defines a digest of manifest. - ContainerImageIDKey = attribute.Key("container.image.id") - - // ContainerCommandKey is the attribute Key conforming to the - // "container.command" semantic conventions. It represents the command used - // to run the container (i.e. the command name). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'otelcontribcol' - // Note: If using embedded credentials or sensitive data, it is recommended - // to remove them to prevent potential leakage. - ContainerCommandKey = attribute.Key("container.command") - - // ContainerCommandLineKey is the attribute Key conforming to the - // "container.command_line" semantic conventions. It represents the full - // command run by the container as a single string representing the full - // command. [2] - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'otelcontribcol --config config.yaml' - ContainerCommandLineKey = attribute.Key("container.command_line") - - // ContainerCommandArgsKey is the attribute Key conforming to the - // "container.command_args" semantic conventions. It represents the all the - // command arguments (including the command/executable itself) run by the - // container. [2] - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'otelcontribcol, --config, config.yaml' - ContainerCommandArgsKey = attribute.Key("container.command_args") ) // ContainerName returns an attribute KeyValue conforming to the @@ -843,36 +680,6 @@ func ContainerImageTag(val string) attribute.KeyValue { return ContainerImageTagKey.String(val) } -// ContainerImageID returns an attribute KeyValue conforming to the -// "container.image.id" semantic conventions. It represents the runtime -// specific image identifier. Usually a hash algorithm followed by a UUID. -func ContainerImageID(val string) attribute.KeyValue { - return ContainerImageIDKey.String(val) -} - -// ContainerCommand returns an attribute KeyValue conforming to the -// "container.command" semantic conventions. It represents the command used to -// run the container (i.e. the command name). -func ContainerCommand(val string) attribute.KeyValue { - return ContainerCommandKey.String(val) -} - -// ContainerCommandLine returns an attribute KeyValue conforming to the -// "container.command_line" semantic conventions. It represents the full -// command run by the container as a single string representing the full -// command. [2] -func ContainerCommandLine(val string) attribute.KeyValue { - return ContainerCommandLineKey.String(val) -} - -// ContainerCommandArgs returns an attribute KeyValue conforming to the -// "container.command_args" semantic conventions. It represents the all the -// command arguments (including the command/executable itself) run by the -// container. [2] -func ContainerCommandArgs(val ...string) attribute.KeyValue { - return ContainerCommandArgsKey.StringSlice(val) -} - // The software deployment. const ( // DeploymentEnvironmentKey is the attribute Key conforming to the @@ -1002,7 +809,7 @@ const ( // FaaS // platform and is usually different from the name of the callback // function (which may be stored in the - // [`code.namespace`/`code.function`](/docs/general/general-attributes.md#source-code-attributes) + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) // span attributes). // // For some cloud providers, the above definition is ambiguous. The @@ -1032,7 +839,7 @@ const ( // * **AWS Lambda:** The [function // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) // (an integer represented as a decimal string). - // * **Google Cloud Run (Services):** The + // * **Google Cloud Run:** The // [revision](https://cloud.google.com/run/docs/managing/revisions) // (i.e., the function name plus the revision suffix). // * **Google Cloud Functions:** The value of the @@ -1098,8 +905,7 @@ func FaaSMaxMemory(val int) attribute.KeyValue { return FaaSMaxMemoryKey.Int(val) } -// A host is defined as a computing instance. For example, physical servers, -// virtual machines, switches or disk array. +// A host is defined as a general computing instance. const ( // HostIDKey is the attribute Key conforming to the "host.id" semantic // conventions. It represents the unique host ID. For Cloud, this must be @@ -1154,8 +960,8 @@ const ( HostImageNameKey = attribute.Key("host.image.name") // HostImageIDKey is the attribute Key conforming to the "host.image.id" - // semantic conventions. It represents the vM image ID or host OS image ID. - // For Cloud, this value is from the provider. + // semantic conventions. It represents the vM image ID. For Cloud, this + // value is from the provider. // // Type: string // RequirementLevel: Optional @@ -1165,7 +971,7 @@ const ( // HostImageVersionKey is the attribute Key conforming to the // "host.image.version" semantic conventions. It represents the version - // string of the VM image or host OS as defined in [Version + // string of the VM image as defined in [Version // Attributes](README.md#version-attributes). // // Type: string @@ -1226,15 +1032,15 @@ func HostImageName(val string) attribute.KeyValue { } // HostImageID returns an attribute KeyValue conforming to the -// "host.image.id" semantic conventions. It represents the vM image ID or host -// OS image ID. For Cloud, this value is from the provider. +// "host.image.id" semantic conventions. It represents the vM image ID. For +// Cloud, this value is from the provider. func HostImageID(val string) attribute.KeyValue { return HostImageIDKey.String(val) } // HostImageVersion returns an attribute KeyValue conforming to the // "host.image.version" semantic conventions. It represents the version string -// of the VM image or host OS as defined in [Version +// of the VM image as defined in [Version // Attributes](README.md#version-attributes). func HostImageVersion(val string) attribute.KeyValue { return HostImageVersionKey.String(val) @@ -1251,40 +1057,6 @@ const ( // Stability: stable // Examples: 'opentelemetry-cluster' K8SClusterNameKey = attribute.Key("k8s.cluster.name") - - // K8SClusterUIDKey is the attribute Key conforming to the - // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for - // the cluster, set to the UID of the `kube-system` namespace. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' - // Note: K8S does not have support for obtaining a cluster ID. If this is - // ever - // added, we will recommend collecting the `k8s.cluster.uid` through the - // official APIs. In the meantime, we are able to use the `uid` of the - // `kube-system` namespace as a proxy for cluster ID. Read on for the - // rationale. - // - // Every object created in a K8S cluster is assigned a distinct UID. The - // `kube-system` namespace is used by Kubernetes itself and will exist - // for the lifetime of the cluster. Using the `uid` of the `kube-system` - // namespace is a reasonable proxy for the K8S ClusterID as it will only - // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are - // UUIDs as standardized by - // [ISO/IEC 9834-8 and ITU-T - // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). - // Which states: - // - // > If generated according to one of the mechanisms defined in Rec. - // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be - // different from all other UUIDs generated before 3603 A.D., or is - // extremely likely to be different (depending on the mechanism chosen). - // - // Therefore, UIDs between clusters should be extremely unlikely to - // conflict. - K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") ) // K8SClusterName returns an attribute KeyValue conforming to the @@ -1294,13 +1066,6 @@ func K8SClusterName(val string) attribute.KeyValue { return K8SClusterNameKey.String(val) } -// K8SClusterUID returns an attribute KeyValue conforming to the -// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the -// cluster, set to the UID of the `kube-system` namespace. -func K8SClusterUID(val string) attribute.KeyValue { - return K8SClusterUIDKey.String(val) -} - // A Kubernetes Node object. const ( // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" @@ -1683,7 +1448,7 @@ const ( // OSVersionKey is the attribute Key conforming to the "os.version" // semantic conventions. It represents the version string of the operating // system as defined in [Version - // Attributes](/docs/resource/README.md#version-attributes). + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). // // Type: string // RequirementLevel: Optional @@ -1734,7 +1499,7 @@ func OSName(val string) attribute.KeyValue { // OSVersion returns an attribute KeyValue conforming to the "os.version" // semantic conventions. It represents the version string of the operating // system as defined in [Version -// Attributes](/docs/resource/README.md#version-attributes). +// Attributes](../../resource/semantic_conventions/README.md#version-attributes). func OSVersion(val string) attribute.KeyValue { return OSVersionKey.String(val) } @@ -1983,17 +1748,6 @@ const ( // `unknown_service:bash`. If `process.executable.name` is not available, // the value MUST be set to `unknown_service`. ServiceNameKey = attribute.Key("service.name") - - // ServiceVersionKey is the attribute Key conforming to the - // "service.version" semantic conventions. It represents the version string - // of the service API or implementation. The format is not defined by these - // conventions. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2.0.0', 'a01dbef8a' - ServiceVersionKey = attribute.Key("service.version") ) // ServiceName returns an attribute KeyValue conforming to the @@ -2003,14 +1757,6 @@ func ServiceName(val string) attribute.KeyValue { return ServiceNameKey.String(val) } -// ServiceVersion returns an attribute KeyValue conforming to the -// "service.version" semantic conventions. It represents the version string of -// the service API or implementation. The format is not defined by these -// conventions. -func ServiceVersion(val string) attribute.KeyValue { - return ServiceVersionKey.String(val) -} - // A service instance. const ( // ServiceNamespaceKey is the attribute Key conforming to the @@ -2054,6 +1800,16 @@ const ( // RFC 4122 UUID (services aiming for reproducible UUIDs may also use // Version 5, see RFC 4122 for more recommendations). ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") ) // ServiceNamespace returns an attribute KeyValue conforming to the @@ -2070,6 +1826,13 @@ func ServiceInstanceID(val string) attribute.KeyValue { return ServiceInstanceIDKey.String(val) } +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + // The telemetry SDK used to capture data recorded by the instrumentation // libraries. const ( @@ -2081,17 +1844,6 @@ const ( // RequirementLevel: Required // Stability: stable // Examples: 'opentelemetry' - // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute - // to `opentelemetry`. - // If another SDK, like a fork or a vendor-provided implementation, is - // used, this SDK MUST set the - // `telemetry.sdk.name` attribute to the fully-qualified class or module - // name of this SDK's main entry point - // or another suitable identifier depending on the language. - // The identifier `opentelemetry` is reserved and MUST NOT be used in this - // case. - // All custom identifiers SHOULD be stable across different versions of an - // implementation. TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") // TelemetrySDKLanguageKey is the attribute Key conforming to the @@ -2133,12 +1885,10 @@ var ( TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") // ruby TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") - // rust - TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") - // swift - TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") // webjs TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") ) // TelemetrySDKName returns an attribute KeyValue conforming to the diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go new file mode 100644 index 000000000..95d0210e3 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.20.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go similarity index 94% rename from vendor/go.opentelemetry.io/otel/semconv/v1.21.0/trace.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go index b5a91450d..90b1b0452 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/trace.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go @@ -1,20 +1,9 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Code generated from semantic convention specification. DO NOT EDIT. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" import "go.opentelemetry.io/otel/attribute" @@ -84,6 +73,33 @@ func ExceptionStacktrace(val string) attribute.KeyValue { return ExceptionStacktraceKey.String(val) } +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + // Span attributes used by AWS Lambda (in addition to general `faas` // attributes). const ( @@ -498,8 +514,8 @@ const ( // RequirementLevel: Optional // Stability: stable // Examples: 'MSSQLSERVER' - // Note: If setting a `db.mssql.instance_name`, `server.port` is no longer - // required (but still recommended if non-standard). + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no + // longer required (but still recommended if non-standard). DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") ) @@ -1208,9 +1224,9 @@ func FaaSInvokedRegion(val string) attribute.KeyValue { const ( // PeerServiceKey is the attribute Key conforming to the "peer.service" // semantic conventions. It represents the - // [`service.name`](/docs/resource/README.md#service) of the remote - // service. SHOULD be equal to the actual `service.name` resource attribute - // of the remote service if any. + // [`service.name`](../../resource/semantic_conventions/README.md#service) + // of the remote service. SHOULD be equal to the actual `service.name` + // resource attribute of the remote service if any. // // Type: string // RequirementLevel: Optional @@ -1221,9 +1237,9 @@ const ( // PeerService returns an attribute KeyValue conforming to the // "peer.service" semantic conventions. It represents the -// [`service.name`](/docs/resource/README.md#service) of the remote service. -// SHOULD be equal to the actual `service.name` resource attribute of the -// remote service if any. +// [`service.name`](../../resource/semantic_conventions/README.md#service) of +// the remote service. SHOULD be equal to the actual `service.name` resource +// attribute of the remote service if any. func PeerService(val string) attribute.KeyValue { return PeerServiceKey.String(val) } @@ -1436,6 +1452,21 @@ func CodeColumn(val int) attribute.KeyValue { // Semantic Convention for HTTP Client const ( + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the full HTTP request URL in the form + // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is + // not transmitted over HTTP, but if it is known, it should be included + // nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the + // attribute's value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // HTTPResendCountKey is the attribute Key conforming to the // "http.resend_count" semantic conventions. It represents the ordinal // number of request resending attempt (for any reason, including @@ -1452,6 +1483,15 @@ const ( HTTPResendCountKey = attribute.Key("http.resend_count") ) +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the full HTTP request URL in the form +// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not +// transmitted over HTTP, but if it is known, it should be included +// nevertheless. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + // HTTPResendCount returns an attribute KeyValue conforming to the // "http.resend_count" semantic conventions. It represents the ordinal number // of request resending attempt (for any reason, including redirects). @@ -1459,6 +1499,58 @@ func HTTPResendCount(val int) attribute.KeyValue { return HTTPResendCountKey.Int(val) } +// Semantic Convention for HTTP Server +const ( + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the full request target as passed in + // a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/users/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + + // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" + // semantic conventions. It represents the IP address of the original + // client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which + // would + // identify the network-level peer, which may be a proxy. + // + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that + // other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the full request target as passed in a +// HTTP request line or equivalent. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPClientIP returns an attribute KeyValue conforming to the +// "http.client_ip" semantic conventions. It represents the IP address of the +// original client behind all proxies, if known (e.g. from +// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). +func HTTPClientIP(val string) attribute.KeyValue { + return HTTPClientIPKey.String(val) +} + // The `aws` conventions apply to operations using the AWS SDK. They map // request or response parameters in AWS SDK API calls to attributes on a Span. // The conventions have been collected over time based on feedback from AWS @@ -2201,16 +2293,6 @@ const ( // operation, instrumentations SHOULD use `messaging.batch.message_count` // for batching APIs and SHOULD NOT use it for single-message APIs. MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") - - // MessagingClientIDKey is the attribute Key conforming to the - // "messaging.client_id" semantic conventions. It represents a unique - // identifier for the client that consumes or produces a message. - // - // Type: string - // RequirementLevel: Recommended (If a client id is available) - // Stability: stable - // Examples: 'client-5', 'myhost@8742@s8083jm' - MessagingClientIDKey = attribute.Key("messaging.client_id") ) var ( @@ -2237,11 +2319,33 @@ func MessagingBatchMessageCount(val int) attribute.KeyValue { return MessagingBatchMessageCountKey.Int(val) } -// MessagingClientID returns an attribute KeyValue conforming to the -// "messaging.client_id" semantic conventions. It represents a unique -// identifier for the client that consumes or produces a message. -func MessagingClientID(val string) attribute.KeyValue { - return MessagingClientIDKey.String(val) +// Semantic convention for a consumer of messages received from a messaging +// system +const ( + // MessagingConsumerIDKey is the attribute Key conforming to the + // "messaging.consumer.id" semantic conventions. It represents the + // identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if + // both are present, or only `messaging.kafka.consumer.group`. For brokers, + // such as RabbitMQ and Artemis, set it to the `client_id` of the client + // consuming the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") +) + +// MessagingConsumerID returns an attribute KeyValue conforming to the +// "messaging.consumer.id" semantic conventions. It represents the identifier +// for the consumer receiving a message. For Kafka, set it to +// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both +// are present, or only `messaging.kafka.consumer.group`. For brokers, such as +// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the +// message. +func MessagingConsumerID(val string) attribute.KeyValue { + return MessagingConsumerIDKey.String(val) } // Semantic conventions for remote procedure calls. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/attribute_group.go deleted file mode 100644 index e6cf89510..000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/attribute_group.go +++ /dev/null @@ -1,1877 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" - -import "go.opentelemetry.io/otel/attribute" - -// These attributes may be used to describe the client in a connection-based -// network interaction where there is one side that initiates the connection -// (the client is the side that initiates the connection). This covers all TCP -// network interactions since TCP is connection-based and one side initiates -// the connection (an exception is made for peer-to-peer communication over TCP -// where the "user-facing" surface of the protocol / API does not expose a -// clear notion of client and server). This also covers UDP network -// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) -// and DNS. -const ( - // ClientAddressKey is the attribute Key conforming to the "client.address" - // semantic conventions. It represents the client address - unix domain - // socket name, IPv4 or IPv6 address. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/tmp/my.sock', '10.1.2.80' - // Note: When observed from the server side, and when communicating through - // an intermediary, `client.address` SHOULD represent client address behind - // any intermediaries (e.g. proxies) if it's available. - ClientAddressKey = attribute.Key("client.address") - - // ClientPortKey is the attribute Key conforming to the "client.port" - // semantic conventions. It represents the client port number - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 65123 - // Note: When observed from the server side, and when communicating through - // an intermediary, `client.port` SHOULD represent client port behind any - // intermediaries (e.g. proxies) if it's available. - ClientPortKey = attribute.Key("client.port") - - // ClientSocketAddressKey is the attribute Key conforming to the - // "client.socket.address" semantic conventions. It represents the - // immediate client peer address - unix domain socket name, IPv4 or IPv6 - // address. - // - // Type: string - // RequirementLevel: Recommended (If different than `client.address`.) - // Stability: stable - // Examples: '/tmp/my.sock', '127.0.0.1' - ClientSocketAddressKey = attribute.Key("client.socket.address") - - // ClientSocketPortKey is the attribute Key conforming to the - // "client.socket.port" semantic conventions. It represents the immediate - // client peer port number - // - // Type: int - // RequirementLevel: Recommended (If different than `client.port`.) - // Stability: stable - // Examples: 35555 - ClientSocketPortKey = attribute.Key("client.socket.port") -) - -// ClientAddress returns an attribute KeyValue conforming to the -// "client.address" semantic conventions. It represents the client address - -// unix domain socket name, IPv4 or IPv6 address. -func ClientAddress(val string) attribute.KeyValue { - return ClientAddressKey.String(val) -} - -// ClientPort returns an attribute KeyValue conforming to the "client.port" -// semantic conventions. It represents the client port number -func ClientPort(val int) attribute.KeyValue { - return ClientPortKey.Int(val) -} - -// ClientSocketAddress returns an attribute KeyValue conforming to the -// "client.socket.address" semantic conventions. It represents the immediate -// client peer address - unix domain socket name, IPv4 or IPv6 address. -func ClientSocketAddress(val string) attribute.KeyValue { - return ClientSocketAddressKey.String(val) -} - -// ClientSocketPort returns an attribute KeyValue conforming to the -// "client.socket.port" semantic conventions. It represents the immediate -// client peer port number -func ClientSocketPort(val int) attribute.KeyValue { - return ClientSocketPortKey.Int(val) -} - -// Describes deprecated HTTP attributes. -const ( - // HTTPMethodKey is the attribute Key conforming to the "http.method" - // semantic conventions. It represents the deprecated, use - // `http.request.method` instead. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 'GET', 'POST', 'HEAD' - HTTPMethodKey = attribute.Key("http.method") - - // HTTPStatusCodeKey is the attribute Key conforming to the - // "http.status_code" semantic conventions. It represents the deprecated, - // use `http.response.status_code` instead. - // - // Type: int - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 200 - HTTPStatusCodeKey = attribute.Key("http.status_code") - - // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" - // semantic conventions. It represents the deprecated, use `url.scheme` - // instead. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 'http', 'https' - HTTPSchemeKey = attribute.Key("http.scheme") - - // HTTPURLKey is the attribute Key conforming to the "http.url" semantic - // conventions. It represents the deprecated, use `url.full` instead. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' - HTTPURLKey = attribute.Key("http.url") - - // HTTPTargetKey is the attribute Key conforming to the "http.target" - // semantic conventions. It represents the deprecated, use `url.path` and - // `url.query` instead. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: '/search?q=OpenTelemetry#SemConv' - HTTPTargetKey = attribute.Key("http.target") - - // HTTPRequestContentLengthKey is the attribute Key conforming to the - // "http.request_content_length" semantic conventions. It represents the - // deprecated, use `http.request.body.size` instead. - // - // Type: int - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 3495 - HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") - - // HTTPResponseContentLengthKey is the attribute Key conforming to the - // "http.response_content_length" semantic conventions. It represents the - // deprecated, use `http.response.body.size` instead. - // - // Type: int - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 3495 - HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") -) - -// HTTPMethod returns an attribute KeyValue conforming to the "http.method" -// semantic conventions. It represents the deprecated, use -// `http.request.method` instead. -func HTTPMethod(val string) attribute.KeyValue { - return HTTPMethodKey.String(val) -} - -// HTTPStatusCode returns an attribute KeyValue conforming to the -// "http.status_code" semantic conventions. It represents the deprecated, use -// `http.response.status_code` instead. -func HTTPStatusCode(val int) attribute.KeyValue { - return HTTPStatusCodeKey.Int(val) -} - -// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" -// semantic conventions. It represents the deprecated, use `url.scheme` -// instead. -func HTTPScheme(val string) attribute.KeyValue { - return HTTPSchemeKey.String(val) -} - -// HTTPURL returns an attribute KeyValue conforming to the "http.url" -// semantic conventions. It represents the deprecated, use `url.full` instead. -func HTTPURL(val string) attribute.KeyValue { - return HTTPURLKey.String(val) -} - -// HTTPTarget returns an attribute KeyValue conforming to the "http.target" -// semantic conventions. It represents the deprecated, use `url.path` and -// `url.query` instead. -func HTTPTarget(val string) attribute.KeyValue { - return HTTPTargetKey.String(val) -} - -// HTTPRequestContentLength returns an attribute KeyValue conforming to the -// "http.request_content_length" semantic conventions. It represents the -// deprecated, use `http.request.body.size` instead. -func HTTPRequestContentLength(val int) attribute.KeyValue { - return HTTPRequestContentLengthKey.Int(val) -} - -// HTTPResponseContentLength returns an attribute KeyValue conforming to the -// "http.response_content_length" semantic conventions. It represents the -// deprecated, use `http.response.body.size` instead. -func HTTPResponseContentLength(val int) attribute.KeyValue { - return HTTPResponseContentLengthKey.Int(val) -} - -// These attributes may be used for any network related operation. -const ( - // NetSockPeerNameKey is the attribute Key conforming to the - // "net.sock.peer.name" semantic conventions. It represents the deprecated, - // use `server.socket.domain` on client spans. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: '/var/my.sock' - NetSockPeerNameKey = attribute.Key("net.sock.peer.name") - - // NetSockPeerAddrKey is the attribute Key conforming to the - // "net.sock.peer.addr" semantic conventions. It represents the deprecated, - // use `server.socket.address` on client spans and `client.socket.address` - // on server spans. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: '192.168.0.1' - NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") - - // NetSockPeerPortKey is the attribute Key conforming to the - // "net.sock.peer.port" semantic conventions. It represents the deprecated, - // use `server.socket.port` on client spans and `client.socket.port` on - // server spans. - // - // Type: int - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 65531 - NetSockPeerPortKey = attribute.Key("net.sock.peer.port") - - // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" - // semantic conventions. It represents the deprecated, use `server.address` - // on client spans and `client.address` on server spans. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 'example.com' - NetPeerNameKey = attribute.Key("net.peer.name") - - // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" - // semantic conventions. It represents the deprecated, use `server.port` on - // client spans and `client.port` on server spans. - // - // Type: int - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 8080 - NetPeerPortKey = attribute.Key("net.peer.port") - - // NetHostNameKey is the attribute Key conforming to the "net.host.name" - // semantic conventions. It represents the deprecated, use - // `server.address`. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 'example.com' - NetHostNameKey = attribute.Key("net.host.name") - - // NetHostPortKey is the attribute Key conforming to the "net.host.port" - // semantic conventions. It represents the deprecated, use `server.port`. - // - // Type: int - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 8080 - NetHostPortKey = attribute.Key("net.host.port") - - // NetSockHostAddrKey is the attribute Key conforming to the - // "net.sock.host.addr" semantic conventions. It represents the deprecated, - // use `server.socket.address`. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: '/var/my.sock' - NetSockHostAddrKey = attribute.Key("net.sock.host.addr") - - // NetSockHostPortKey is the attribute Key conforming to the - // "net.sock.host.port" semantic conventions. It represents the deprecated, - // use `server.socket.port`. - // - // Type: int - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 8080 - NetSockHostPortKey = attribute.Key("net.sock.host.port") - - // NetTransportKey is the attribute Key conforming to the "net.transport" - // semantic conventions. It represents the deprecated, use - // `network.transport`. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: deprecated - NetTransportKey = attribute.Key("net.transport") - - // NetProtocolNameKey is the attribute Key conforming to the - // "net.protocol.name" semantic conventions. It represents the deprecated, - // use `network.protocol.name`. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 'amqp', 'http', 'mqtt' - NetProtocolNameKey = attribute.Key("net.protocol.name") - - // NetProtocolVersionKey is the attribute Key conforming to the - // "net.protocol.version" semantic conventions. It represents the - // deprecated, use `network.protocol.version`. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: '3.1.1' - NetProtocolVersionKey = attribute.Key("net.protocol.version") - - // NetSockFamilyKey is the attribute Key conforming to the - // "net.sock.family" semantic conventions. It represents the deprecated, - // use `network.transport` and `network.type`. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: deprecated - NetSockFamilyKey = attribute.Key("net.sock.family") -) - -var ( - // ip_tcp - NetTransportTCP = NetTransportKey.String("ip_tcp") - // ip_udp - NetTransportUDP = NetTransportKey.String("ip_udp") - // Named or anonymous pipe - NetTransportPipe = NetTransportKey.String("pipe") - // In-process communication - NetTransportInProc = NetTransportKey.String("inproc") - // Something else (non IP-based) - NetTransportOther = NetTransportKey.String("other") -) - -var ( - // IPv4 address - NetSockFamilyInet = NetSockFamilyKey.String("inet") - // IPv6 address - NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") - // Unix domain socket path - NetSockFamilyUnix = NetSockFamilyKey.String("unix") -) - -// NetSockPeerName returns an attribute KeyValue conforming to the -// "net.sock.peer.name" semantic conventions. It represents the deprecated, use -// `server.socket.domain` on client spans. -func NetSockPeerName(val string) attribute.KeyValue { - return NetSockPeerNameKey.String(val) -} - -// NetSockPeerAddr returns an attribute KeyValue conforming to the -// "net.sock.peer.addr" semantic conventions. It represents the deprecated, use -// `server.socket.address` on client spans and `client.socket.address` on -// server spans. -func NetSockPeerAddr(val string) attribute.KeyValue { - return NetSockPeerAddrKey.String(val) -} - -// NetSockPeerPort returns an attribute KeyValue conforming to the -// "net.sock.peer.port" semantic conventions. It represents the deprecated, use -// `server.socket.port` on client spans and `client.socket.port` on server -// spans. -func NetSockPeerPort(val int) attribute.KeyValue { - return NetSockPeerPortKey.Int(val) -} - -// NetPeerName returns an attribute KeyValue conforming to the -// "net.peer.name" semantic conventions. It represents the deprecated, use -// `server.address` on client spans and `client.address` on server spans. -func NetPeerName(val string) attribute.KeyValue { - return NetPeerNameKey.String(val) -} - -// NetPeerPort returns an attribute KeyValue conforming to the -// "net.peer.port" semantic conventions. It represents the deprecated, use -// `server.port` on client spans and `client.port` on server spans. -func NetPeerPort(val int) attribute.KeyValue { - return NetPeerPortKey.Int(val) -} - -// NetHostName returns an attribute KeyValue conforming to the -// "net.host.name" semantic conventions. It represents the deprecated, use -// `server.address`. -func NetHostName(val string) attribute.KeyValue { - return NetHostNameKey.String(val) -} - -// NetHostPort returns an attribute KeyValue conforming to the -// "net.host.port" semantic conventions. It represents the deprecated, use -// `server.port`. -func NetHostPort(val int) attribute.KeyValue { - return NetHostPortKey.Int(val) -} - -// NetSockHostAddr returns an attribute KeyValue conforming to the -// "net.sock.host.addr" semantic conventions. It represents the deprecated, use -// `server.socket.address`. -func NetSockHostAddr(val string) attribute.KeyValue { - return NetSockHostAddrKey.String(val) -} - -// NetSockHostPort returns an attribute KeyValue conforming to the -// "net.sock.host.port" semantic conventions. It represents the deprecated, use -// `server.socket.port`. -func NetSockHostPort(val int) attribute.KeyValue { - return NetSockHostPortKey.Int(val) -} - -// NetProtocolName returns an attribute KeyValue conforming to the -// "net.protocol.name" semantic conventions. It represents the deprecated, use -// `network.protocol.name`. -func NetProtocolName(val string) attribute.KeyValue { - return NetProtocolNameKey.String(val) -} - -// NetProtocolVersion returns an attribute KeyValue conforming to the -// "net.protocol.version" semantic conventions. It represents the deprecated, -// use `network.protocol.version`. -func NetProtocolVersion(val string) attribute.KeyValue { - return NetProtocolVersionKey.String(val) -} - -// These attributes may be used to describe the receiver of a network -// exchange/packet. These should be used when there is no client/server -// relationship between the two sides, or when that relationship is unknown. -// This covers low-level network interactions (e.g. packet tracing) where you -// don't know if there was a connection or which side initiated it. This also -// covers unidirectional UDP flows and peer-to-peer communication where the -// "user-facing" surface of the protocol / API does not expose a clear notion -// of client and server. -const ( - // DestinationDomainKey is the attribute Key conforming to the - // "destination.domain" semantic conventions. It represents the domain name - // of the destination system. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'foo.example.com' - // Note: This value may be a host name, a fully qualified domain name, or - // another host naming format. - DestinationDomainKey = attribute.Key("destination.domain") - - // DestinationAddressKey is the attribute Key conforming to the - // "destination.address" semantic conventions. It represents the peer - // address, for example IP address or UNIX socket name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '10.5.3.2' - DestinationAddressKey = attribute.Key("destination.address") - - // DestinationPortKey is the attribute Key conforming to the - // "destination.port" semantic conventions. It represents the peer port - // number - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3389, 2888 - DestinationPortKey = attribute.Key("destination.port") -) - -// DestinationDomain returns an attribute KeyValue conforming to the -// "destination.domain" semantic conventions. It represents the domain name of -// the destination system. -func DestinationDomain(val string) attribute.KeyValue { - return DestinationDomainKey.String(val) -} - -// DestinationAddress returns an attribute KeyValue conforming to the -// "destination.address" semantic conventions. It represents the peer address, -// for example IP address or UNIX socket name. -func DestinationAddress(val string) attribute.KeyValue { - return DestinationAddressKey.String(val) -} - -// DestinationPort returns an attribute KeyValue conforming to the -// "destination.port" semantic conventions. It represents the peer port number -func DestinationPort(val int) attribute.KeyValue { - return DestinationPortKey.Int(val) -} - -// Describes HTTP attributes. -const ( - // HTTPRequestMethodKey is the attribute Key conforming to the - // "http.request.method" semantic conventions. It represents the hTTP - // request method. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Examples: 'GET', 'POST', 'HEAD' - // Note: HTTP request method value SHOULD be "known" to the - // instrumentation. - // By default, this convention defines "known" methods as the ones listed - // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) - // and the PATCH method defined in - // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). - // - // If the HTTP request method is not known to instrumentation, it MUST set - // the `http.request.method` attribute to `_OTHER` and, except if reporting - // a metric, MUST - // set the exact method received in the request line as value of the - // `http.request.method_original` attribute. - // - // If the HTTP instrumentation could end up converting valid HTTP request - // methods to `_OTHER`, then it MUST provide a way to override - // the list of known HTTP methods. If this override is done via environment - // variable, then the environment variable MUST be named - // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated - // list of case-sensitive known HTTP methods - // (this list MUST be a full override of the default known method, it is - // not a list of known methods in addition to the defaults). - // - // HTTP method names are case-sensitive and `http.request.method` attribute - // value MUST match a known HTTP method name exactly. - // Instrumentations for specific web frameworks that consider HTTP methods - // to be case insensitive, SHOULD populate a canonical equivalent. - // Tracing instrumentations that do so, MUST also set - // `http.request.method_original` to the original value. - HTTPRequestMethodKey = attribute.Key("http.request.method") - - // HTTPResponseStatusCodeKey is the attribute Key conforming to the - // "http.response.status_code" semantic conventions. It represents the - // [HTTP response status - // code](https://tools.ietf.org/html/rfc7231#section-6). - // - // Type: int - // RequirementLevel: ConditionallyRequired (If and only if one was - // received/sent.) - // Stability: stable - // Examples: 200 - HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") -) - -var ( - // CONNECT method - HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") - // DELETE method - HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") - // GET method - HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") - // HEAD method - HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") - // OPTIONS method - HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") - // PATCH method - HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") - // POST method - HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") - // PUT method - HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") - // TRACE method - HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") - // Any HTTP method that the instrumentation has no prior knowledge of - HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") -) - -// HTTPResponseStatusCode returns an attribute KeyValue conforming to the -// "http.response.status_code" semantic conventions. It represents the [HTTP -// response status code](https://tools.ietf.org/html/rfc7231#section-6). -func HTTPResponseStatusCode(val int) attribute.KeyValue { - return HTTPResponseStatusCodeKey.Int(val) -} - -// HTTP Server attributes -const ( - // HTTPRouteKey is the attribute Key conforming to the "http.route" - // semantic conventions. It represents the matched route (path template in - // the format used by the respective server framework). See note below - // - // Type: string - // RequirementLevel: ConditionallyRequired (If and only if it's available) - // Stability: stable - // Examples: '/users/:userID?', '{controller}/{action}/{id?}' - // Note: MUST NOT be populated when this is not supported by the HTTP - // server framework as the route attribute should have low-cardinality and - // the URI path can NOT substitute it. - // SHOULD include the [application - // root](/docs/http/http-spans.md#http-server-definitions) if there is one. - HTTPRouteKey = attribute.Key("http.route") -) - -// HTTPRoute returns an attribute KeyValue conforming to the "http.route" -// semantic conventions. It represents the matched route (path template in the -// format used by the respective server framework). See note below -func HTTPRoute(val string) attribute.KeyValue { - return HTTPRouteKey.String(val) -} - -// Attributes for Events represented using Log Records. -const ( - // EventNameKey is the attribute Key conforming to the "event.name" - // semantic conventions. It represents the name identifies the event. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'click', 'exception' - EventNameKey = attribute.Key("event.name") - - // EventDomainKey is the attribute Key conforming to the "event.domain" - // semantic conventions. It represents the domain identifies the business - // context for the events. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Note: Events across different domains may have same `event.name`, yet be - // unrelated events. - EventDomainKey = attribute.Key("event.domain") -) - -var ( - // Events from browser apps - EventDomainBrowser = EventDomainKey.String("browser") - // Events from mobile apps - EventDomainDevice = EventDomainKey.String("device") - // Events from Kubernetes - EventDomainK8S = EventDomainKey.String("k8s") -) - -// EventName returns an attribute KeyValue conforming to the "event.name" -// semantic conventions. It represents the name identifies the event. -func EventName(val string) attribute.KeyValue { - return EventNameKey.String(val) -} - -// The attributes described in this section are rather generic. They may be -// used in any Log Record they apply to. -const ( - // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" - // semantic conventions. It represents a unique identifier for the Log - // Record. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' - // Note: If an id is provided, other log records with the same id will be - // considered duplicates and can be removed safely. This means, that two - // distinguishable log records MUST have different values. - // The id MAY be an [Universally Unique Lexicographically Sortable - // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers - // (e.g. UUID) may be used as needed. - LogRecordUIDKey = attribute.Key("log.record.uid") -) - -// LogRecordUID returns an attribute KeyValue conforming to the -// "log.record.uid" semantic conventions. It represents a unique identifier for -// the Log Record. -func LogRecordUID(val string) attribute.KeyValue { - return LogRecordUIDKey.String(val) -} - -// Describes Log attributes -const ( - // LogIostreamKey is the attribute Key conforming to the "log.iostream" - // semantic conventions. It represents the stream associated with the log. - // See below for a list of well-known values. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - LogIostreamKey = attribute.Key("log.iostream") -) - -var ( - // Logs from stdout stream - LogIostreamStdout = LogIostreamKey.String("stdout") - // Events from stderr stream - LogIostreamStderr = LogIostreamKey.String("stderr") -) - -// A file to which log was emitted. -const ( - // LogFileNameKey is the attribute Key conforming to the "log.file.name" - // semantic conventions. It represents the basename of the file. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'audit.log' - LogFileNameKey = attribute.Key("log.file.name") - - // LogFilePathKey is the attribute Key conforming to the "log.file.path" - // semantic conventions. It represents the full path to the file. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/var/log/mysql/audit.log' - LogFilePathKey = attribute.Key("log.file.path") - - // LogFileNameResolvedKey is the attribute Key conforming to the - // "log.file.name_resolved" semantic conventions. It represents the - // basename of the file, with symlinks resolved. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'uuid.log' - LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") - - // LogFilePathResolvedKey is the attribute Key conforming to the - // "log.file.path_resolved" semantic conventions. It represents the full - // path to the file, with symlinks resolved. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/var/lib/docker/uuid.log' - LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") -) - -// LogFileName returns an attribute KeyValue conforming to the -// "log.file.name" semantic conventions. It represents the basename of the -// file. -func LogFileName(val string) attribute.KeyValue { - return LogFileNameKey.String(val) -} - -// LogFilePath returns an attribute KeyValue conforming to the -// "log.file.path" semantic conventions. It represents the full path to the -// file. -func LogFilePath(val string) attribute.KeyValue { - return LogFilePathKey.String(val) -} - -// LogFileNameResolved returns an attribute KeyValue conforming to the -// "log.file.name_resolved" semantic conventions. It represents the basename of -// the file, with symlinks resolved. -func LogFileNameResolved(val string) attribute.KeyValue { - return LogFileNameResolvedKey.String(val) -} - -// LogFilePathResolved returns an attribute KeyValue conforming to the -// "log.file.path_resolved" semantic conventions. It represents the full path -// to the file, with symlinks resolved. -func LogFilePathResolved(val string) attribute.KeyValue { - return LogFilePathResolvedKey.String(val) -} - -// Describes JVM memory metric attributes. -const ( - // TypeKey is the attribute Key conforming to the "type" semantic - // conventions. It represents the type of memory. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'heap', 'non_heap' - TypeKey = attribute.Key("type") - - // PoolKey is the attribute Key conforming to the "pool" semantic - // conventions. It represents the name of the memory pool. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' - // Note: Pool names are generally obtained via - // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). - PoolKey = attribute.Key("pool") -) - -var ( - // Heap memory - TypeHeap = TypeKey.String("heap") - // Non-heap memory - TypeNonHeap = TypeKey.String("non_heap") -) - -// Pool returns an attribute KeyValue conforming to the "pool" semantic -// conventions. It represents the name of the memory pool. -func Pool(val string) attribute.KeyValue { - return PoolKey.String(val) -} - -// These attributes may be used to describe the server in a connection-based -// network interaction where there is one side that initiates the connection -// (the client is the side that initiates the connection). This covers all TCP -// network interactions since TCP is connection-based and one side initiates -// the connection (an exception is made for peer-to-peer communication over TCP -// where the "user-facing" surface of the protocol / API does not expose a -// clear notion of client and server). This also covers UDP network -// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) -// and DNS. -const ( - // ServerAddressKey is the attribute Key conforming to the "server.address" - // semantic conventions. It represents the logical server hostname, matches - // server FQDN if available, and IP or socket address if FQDN is not known. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'example.com' - ServerAddressKey = attribute.Key("server.address") - - // ServerPortKey is the attribute Key conforming to the "server.port" - // semantic conventions. It represents the logical server port number - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 80, 8080, 443 - ServerPortKey = attribute.Key("server.port") - - // ServerSocketDomainKey is the attribute Key conforming to the - // "server.socket.domain" semantic conventions. It represents the domain - // name of an immediate peer. - // - // Type: string - // RequirementLevel: Recommended (If different than `server.address`.) - // Stability: stable - // Examples: 'proxy.example.com' - // Note: Typically observed from the client side, and represents a proxy or - // other intermediary domain name. - ServerSocketDomainKey = attribute.Key("server.socket.domain") - - // ServerSocketAddressKey is the attribute Key conforming to the - // "server.socket.address" semantic conventions. It represents the physical - // server IP address or Unix socket address. If set from the client, should - // simply use the socket's peer address, and not attempt to find any actual - // server IP (i.e., if set from client, this may represent some proxy - // server instead of the logical server). - // - // Type: string - // RequirementLevel: Recommended (If different than `server.address`.) - // Stability: stable - // Examples: '10.5.3.2' - ServerSocketAddressKey = attribute.Key("server.socket.address") - - // ServerSocketPortKey is the attribute Key conforming to the - // "server.socket.port" semantic conventions. It represents the physical - // server port. - // - // Type: int - // RequirementLevel: Recommended (If different than `server.port`.) - // Stability: stable - // Examples: 16456 - ServerSocketPortKey = attribute.Key("server.socket.port") -) - -// ServerAddress returns an attribute KeyValue conforming to the -// "server.address" semantic conventions. It represents the logical server -// hostname, matches server FQDN if available, and IP or socket address if FQDN -// is not known. -func ServerAddress(val string) attribute.KeyValue { - return ServerAddressKey.String(val) -} - -// ServerPort returns an attribute KeyValue conforming to the "server.port" -// semantic conventions. It represents the logical server port number -func ServerPort(val int) attribute.KeyValue { - return ServerPortKey.Int(val) -} - -// ServerSocketDomain returns an attribute KeyValue conforming to the -// "server.socket.domain" semantic conventions. It represents the domain name -// of an immediate peer. -func ServerSocketDomain(val string) attribute.KeyValue { - return ServerSocketDomainKey.String(val) -} - -// ServerSocketAddress returns an attribute KeyValue conforming to the -// "server.socket.address" semantic conventions. It represents the physical -// server IP address or Unix socket address. If set from the client, should -// simply use the socket's peer address, and not attempt to find any actual -// server IP (i.e., if set from client, this may represent some proxy server -// instead of the logical server). -func ServerSocketAddress(val string) attribute.KeyValue { - return ServerSocketAddressKey.String(val) -} - -// ServerSocketPort returns an attribute KeyValue conforming to the -// "server.socket.port" semantic conventions. It represents the physical server -// port. -func ServerSocketPort(val int) attribute.KeyValue { - return ServerSocketPortKey.Int(val) -} - -// These attributes may be used to describe the sender of a network -// exchange/packet. These should be used when there is no client/server -// relationship between the two sides, or when that relationship is unknown. -// This covers low-level network interactions (e.g. packet tracing) where you -// don't know if there was a connection or which side initiated it. This also -// covers unidirectional UDP flows and peer-to-peer communication where the -// "user-facing" surface of the protocol / API does not expose a clear notion -// of client and server. -const ( - // SourceDomainKey is the attribute Key conforming to the "source.domain" - // semantic conventions. It represents the domain name of the source - // system. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'foo.example.com' - // Note: This value may be a host name, a fully qualified domain name, or - // another host naming format. - SourceDomainKey = attribute.Key("source.domain") - - // SourceAddressKey is the attribute Key conforming to the "source.address" - // semantic conventions. It represents the source address, for example IP - // address or Unix socket name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '10.5.3.2' - SourceAddressKey = attribute.Key("source.address") - - // SourcePortKey is the attribute Key conforming to the "source.port" - // semantic conventions. It represents the source port number - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3389, 2888 - SourcePortKey = attribute.Key("source.port") -) - -// SourceDomain returns an attribute KeyValue conforming to the -// "source.domain" semantic conventions. It represents the domain name of the -// source system. -func SourceDomain(val string) attribute.KeyValue { - return SourceDomainKey.String(val) -} - -// SourceAddress returns an attribute KeyValue conforming to the -// "source.address" semantic conventions. It represents the source address, for -// example IP address or Unix socket name. -func SourceAddress(val string) attribute.KeyValue { - return SourceAddressKey.String(val) -} - -// SourcePort returns an attribute KeyValue conforming to the "source.port" -// semantic conventions. It represents the source port number -func SourcePort(val int) attribute.KeyValue { - return SourcePortKey.Int(val) -} - -// These attributes may be used for any network related operation. -const ( - // NetworkTransportKey is the attribute Key conforming to the - // "network.transport" semantic conventions. It represents the [OSI - // Transport Layer](https://osi-model.com/transport-layer/) or - // [Inter-process Communication - // method](https://en.wikipedia.org/wiki/Inter-process_communication). The - // value SHOULD be normalized to lowercase. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'tcp', 'udp' - NetworkTransportKey = attribute.Key("network.transport") - - // NetworkTypeKey is the attribute Key conforming to the "network.type" - // semantic conventions. It represents the [OSI Network - // Layer](https://osi-model.com/network-layer/) or non-OSI equivalent. The - // value SHOULD be normalized to lowercase. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'ipv4', 'ipv6' - NetworkTypeKey = attribute.Key("network.type") - - // NetworkProtocolNameKey is the attribute Key conforming to the - // "network.protocol.name" semantic conventions. It represents the [OSI - // Application Layer](https://osi-model.com/application-layer/) or non-OSI - // equivalent. The value SHOULD be normalized to lowercase. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'amqp', 'http', 'mqtt' - NetworkProtocolNameKey = attribute.Key("network.protocol.name") - - // NetworkProtocolVersionKey is the attribute Key conforming to the - // "network.protocol.version" semantic conventions. It represents the - // version of the application layer protocol used. See note below. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '3.1.1' - // Note: `network.protocol.version` refers to the version of the protocol - // used and might be different from the protocol client's version. If the - // HTTP client used has a version of `0.27.2`, but sends HTTP version - // `1.1`, this attribute should be set to `1.1`. - NetworkProtocolVersionKey = attribute.Key("network.protocol.version") -) - -var ( - // TCP - NetworkTransportTCP = NetworkTransportKey.String("tcp") - // UDP - NetworkTransportUDP = NetworkTransportKey.String("udp") - // Named or anonymous pipe. See note below - NetworkTransportPipe = NetworkTransportKey.String("pipe") - // Unix domain socket - NetworkTransportUnix = NetworkTransportKey.String("unix") -) - -var ( - // IPv4 - NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") - // IPv6 - NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") -) - -// NetworkProtocolName returns an attribute KeyValue conforming to the -// "network.protocol.name" semantic conventions. It represents the [OSI -// Application Layer](https://osi-model.com/application-layer/) or non-OSI -// equivalent. The value SHOULD be normalized to lowercase. -func NetworkProtocolName(val string) attribute.KeyValue { - return NetworkProtocolNameKey.String(val) -} - -// NetworkProtocolVersion returns an attribute KeyValue conforming to the -// "network.protocol.version" semantic conventions. It represents the version -// of the application layer protocol used. See note below. -func NetworkProtocolVersion(val string) attribute.KeyValue { - return NetworkProtocolVersionKey.String(val) -} - -// These attributes may be used for any network related operation. -const ( - // NetworkConnectionTypeKey is the attribute Key conforming to the - // "network.connection.type" semantic conventions. It represents the - // internet connection type. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'wifi' - NetworkConnectionTypeKey = attribute.Key("network.connection.type") - - // NetworkConnectionSubtypeKey is the attribute Key conforming to the - // "network.connection.subtype" semantic conventions. It represents the - // this describes more details regarding the connection.type. It may be the - // type of cell technology connection, but it could be used for describing - // details about a wifi connection. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'LTE' - NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") - - // NetworkCarrierNameKey is the attribute Key conforming to the - // "network.carrier.name" semantic conventions. It represents the name of - // the mobile carrier. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'sprint' - NetworkCarrierNameKey = attribute.Key("network.carrier.name") - - // NetworkCarrierMccKey is the attribute Key conforming to the - // "network.carrier.mcc" semantic conventions. It represents the mobile - // carrier country code. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '310' - NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") - - // NetworkCarrierMncKey is the attribute Key conforming to the - // "network.carrier.mnc" semantic conventions. It represents the mobile - // carrier network code. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '001' - NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") - - // NetworkCarrierIccKey is the attribute Key conforming to the - // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 - // alpha-2 2-character country code associated with the mobile carrier - // network. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'DE' - NetworkCarrierIccKey = attribute.Key("network.carrier.icc") -) - -var ( - // wifi - NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") - // wired - NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") - // cell - NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") - // unavailable - NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") - // unknown - NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") -) - -var ( - // GPRS - NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") - // EDGE - NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") - // UMTS - NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") - // CDMA - NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") - // EVDO Rel. 0 - NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") - // EVDO Rev. A - NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") - // CDMA2000 1XRTT - NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") - // HSDPA - NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") - // HSUPA - NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") - // HSPA - NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") - // IDEN - NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") - // EVDO Rev. B - NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") - // LTE - NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") - // EHRPD - NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") - // HSPAP - NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") - // GSM - NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") - // TD-SCDMA - NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") - // IWLAN - NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") - // 5G NR (New Radio) - NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") - // 5G NRNSA (New Radio Non-Standalone) - NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") - // LTE CA - NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") -) - -// NetworkCarrierName returns an attribute KeyValue conforming to the -// "network.carrier.name" semantic conventions. It represents the name of the -// mobile carrier. -func NetworkCarrierName(val string) attribute.KeyValue { - return NetworkCarrierNameKey.String(val) -} - -// NetworkCarrierMcc returns an attribute KeyValue conforming to the -// "network.carrier.mcc" semantic conventions. It represents the mobile carrier -// country code. -func NetworkCarrierMcc(val string) attribute.KeyValue { - return NetworkCarrierMccKey.String(val) -} - -// NetworkCarrierMnc returns an attribute KeyValue conforming to the -// "network.carrier.mnc" semantic conventions. It represents the mobile carrier -// network code. -func NetworkCarrierMnc(val string) attribute.KeyValue { - return NetworkCarrierMncKey.String(val) -} - -// NetworkCarrierIcc returns an attribute KeyValue conforming to the -// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 -// alpha-2 2-character country code associated with the mobile carrier network. -func NetworkCarrierIcc(val string) attribute.KeyValue { - return NetworkCarrierIccKey.String(val) -} - -// Semantic conventions for HTTP client and server Spans. -const ( - // HTTPRequestMethodOriginalKey is the attribute Key conforming to the - // "http.request.method_original" semantic conventions. It represents the - // original HTTP method sent by the client in the request line. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If and only if it's different - // than `http.request.method`.) - // Stability: stable - // Examples: 'GeT', 'ACL', 'foo' - HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") - - // HTTPRequestBodySizeKey is the attribute Key conforming to the - // "http.request.body.size" semantic conventions. It represents the size of - // the request payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as - // the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) - // header. For requests using transport encoding, this should be the - // compressed size. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3495 - HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") - - // HTTPResponseBodySizeKey is the attribute Key conforming to the - // "http.response.body.size" semantic conventions. It represents the size - // of the response payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as - // the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) - // header. For requests using transport encoding, this should be the - // compressed size. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3495 - HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") -) - -// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the -// "http.request.method_original" semantic conventions. It represents the -// original HTTP method sent by the client in the request line. -func HTTPRequestMethodOriginal(val string) attribute.KeyValue { - return HTTPRequestMethodOriginalKey.String(val) -} - -// HTTPRequestBodySize returns an attribute KeyValue conforming to the -// "http.request.body.size" semantic conventions. It represents the size of the -// request payload body in bytes. This is the number of bytes transferred -// excluding headers and is often, but not always, present as the -// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) -// header. For requests using transport encoding, this should be the compressed -// size. -func HTTPRequestBodySize(val int) attribute.KeyValue { - return HTTPRequestBodySizeKey.Int(val) -} - -// HTTPResponseBodySize returns an attribute KeyValue conforming to the -// "http.response.body.size" semantic conventions. It represents the size of -// the response payload body in bytes. This is the number of bytes transferred -// excluding headers and is often, but not always, present as the -// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) -// header. For requests using transport encoding, this should be the compressed -// size. -func HTTPResponseBodySize(val int) attribute.KeyValue { - return HTTPResponseBodySizeKey.Int(val) -} - -// Semantic convention describing per-message attributes populated on messaging -// spans or links. -const ( - // MessagingMessageIDKey is the attribute Key conforming to the - // "messaging.message.id" semantic conventions. It represents a value used - // by the messaging system as an identifier for the message, represented as - // a string. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '452a7c7c7c7048c2f887f61572b18fc2' - MessagingMessageIDKey = attribute.Key("messaging.message.id") - - // MessagingMessageConversationIDKey is the attribute Key conforming to the - // "messaging.message.conversation_id" semantic conventions. It represents - // the [conversation ID](#conversations) identifying the conversation to - // which the message belongs, represented as a string. Sometimes called - // "Correlation ID". - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MyConversationID' - MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") - - // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to - // the "messaging.message.payload_size_bytes" semantic conventions. It - // represents the (uncompressed) size of the message payload in bytes. Also - // use this attribute if it is unknown whether the compressed or - // uncompressed payload size is reported. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2738 - MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") - - // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key - // conforming to the "messaging.message.payload_compressed_size_bytes" - // semantic conventions. It represents the compressed size of the message - // payload in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2048 - MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") -) - -// MessagingMessageID returns an attribute KeyValue conforming to the -// "messaging.message.id" semantic conventions. It represents a value used by -// the messaging system as an identifier for the message, represented as a -// string. -func MessagingMessageID(val string) attribute.KeyValue { - return MessagingMessageIDKey.String(val) -} - -// MessagingMessageConversationID returns an attribute KeyValue conforming -// to the "messaging.message.conversation_id" semantic conventions. It -// represents the [conversation ID](#conversations) identifying the -// conversation to which the message belongs, represented as a string. -// Sometimes called "Correlation ID". -func MessagingMessageConversationID(val string) attribute.KeyValue { - return MessagingMessageConversationIDKey.String(val) -} - -// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming -// to the "messaging.message.payload_size_bytes" semantic conventions. It -// represents the (uncompressed) size of the message payload in bytes. Also use -// this attribute if it is unknown whether the compressed or uncompressed -// payload size is reported. -func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { - return MessagingMessagePayloadSizeBytesKey.Int(val) -} - -// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue -// conforming to the "messaging.message.payload_compressed_size_bytes" semantic -// conventions. It represents the compressed size of the message payload in -// bytes. -func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { - return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) -} - -// Semantic convention for attributes that describe messaging destination on -// broker -const ( - // MessagingDestinationNameKey is the attribute Key conforming to the - // "messaging.destination.name" semantic conventions. It represents the - // message destination name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MyQueue', 'MyTopic' - // Note: Destination name SHOULD uniquely identify a specific queue, topic - // or other entity within the broker. If - // the broker does not have such notion, the destination name SHOULD - // uniquely identify the broker. - MessagingDestinationNameKey = attribute.Key("messaging.destination.name") - - // MessagingDestinationTemplateKey is the attribute Key conforming to the - // "messaging.destination.template" semantic conventions. It represents the - // low cardinality representation of the messaging destination name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/customers/{customerID}' - // Note: Destination names could be constructed from templates. An example - // would be a destination name involving a user name or product id. - // Although the destination name in this case is of high cardinality, the - // underlying template is of low cardinality and can be effectively used - // for grouping and aggregation. - MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") - - // MessagingDestinationTemporaryKey is the attribute Key conforming to the - // "messaging.destination.temporary" semantic conventions. It represents a - // boolean that is true if the message destination is temporary and might - // not exist anymore after messages are processed. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") - - // MessagingDestinationAnonymousKey is the attribute Key conforming to the - // "messaging.destination.anonymous" semantic conventions. It represents a - // boolean that is true if the message destination is anonymous (could be - // unnamed or have auto-generated name). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") -) - -// MessagingDestinationName returns an attribute KeyValue conforming to the -// "messaging.destination.name" semantic conventions. It represents the message -// destination name -func MessagingDestinationName(val string) attribute.KeyValue { - return MessagingDestinationNameKey.String(val) -} - -// MessagingDestinationTemplate returns an attribute KeyValue conforming to -// the "messaging.destination.template" semantic conventions. It represents the -// low cardinality representation of the messaging destination name -func MessagingDestinationTemplate(val string) attribute.KeyValue { - return MessagingDestinationTemplateKey.String(val) -} - -// MessagingDestinationTemporary returns an attribute KeyValue conforming to -// the "messaging.destination.temporary" semantic conventions. It represents a -// boolean that is true if the message destination is temporary and might not -// exist anymore after messages are processed. -func MessagingDestinationTemporary(val bool) attribute.KeyValue { - return MessagingDestinationTemporaryKey.Bool(val) -} - -// MessagingDestinationAnonymous returns an attribute KeyValue conforming to -// the "messaging.destination.anonymous" semantic conventions. It represents a -// boolean that is true if the message destination is anonymous (could be -// unnamed or have auto-generated name). -func MessagingDestinationAnonymous(val bool) attribute.KeyValue { - return MessagingDestinationAnonymousKey.Bool(val) -} - -// Attributes for RabbitMQ -const ( - // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key - // conforming to the "messaging.rabbitmq.destination.routing_key" semantic - // conventions. It represents the rabbitMQ message routing key. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If not empty.) - // Stability: stable - // Examples: 'myKey' - MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") -) - -// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue -// conforming to the "messaging.rabbitmq.destination.routing_key" semantic -// conventions. It represents the rabbitMQ message routing key. -func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { - return MessagingRabbitmqDestinationRoutingKeyKey.String(val) -} - -// Attributes for Apache Kafka -const ( - // MessagingKafkaMessageKeyKey is the attribute Key conforming to the - // "messaging.kafka.message.key" semantic conventions. It represents the - // message keys in Kafka are used for grouping alike messages to ensure - // they're processed on the same partition. They differ from - // `messaging.message.id` in that they're not unique. If the key is `null`, - // the attribute MUST NOT be set. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'myKey' - // Note: If the key type is not string, it's string representation has to - // be supplied for the attribute. If the key has no unambiguous, canonical - // string form, don't include its value. - MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") - - // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the - // "messaging.kafka.consumer.group" semantic conventions. It represents the - // name of the Kafka Consumer Group that is handling the message. Only - // applies to consumers, not producers. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'my-group' - MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") - - // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to - // the "messaging.kafka.destination.partition" semantic conventions. It - // represents the partition the message is sent to. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2 - MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") - - // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the - // "messaging.kafka.message.offset" semantic conventions. It represents the - // offset of a record in the corresponding Kafka partition. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 42 - MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") - - // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the - // "messaging.kafka.message.tombstone" semantic conventions. It represents - // a boolean that is true if the message is a tombstone. - // - // Type: boolean - // RequirementLevel: ConditionallyRequired (If value is `true`. When - // missing, the value is assumed to be `false`.) - // Stability: stable - MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") -) - -// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the -// "messaging.kafka.message.key" semantic conventions. It represents the -// message keys in Kafka are used for grouping alike messages to ensure they're -// processed on the same partition. They differ from `messaging.message.id` in -// that they're not unique. If the key is `null`, the attribute MUST NOT be -// set. -func MessagingKafkaMessageKey(val string) attribute.KeyValue { - return MessagingKafkaMessageKeyKey.String(val) -} - -// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to -// the "messaging.kafka.consumer.group" semantic conventions. It represents the -// name of the Kafka Consumer Group that is handling the message. Only applies -// to consumers, not producers. -func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { - return MessagingKafkaConsumerGroupKey.String(val) -} - -// MessagingKafkaDestinationPartition returns an attribute KeyValue -// conforming to the "messaging.kafka.destination.partition" semantic -// conventions. It represents the partition the message is sent to. -func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { - return MessagingKafkaDestinationPartitionKey.Int(val) -} - -// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to -// the "messaging.kafka.message.offset" semantic conventions. It represents the -// offset of a record in the corresponding Kafka partition. -func MessagingKafkaMessageOffset(val int) attribute.KeyValue { - return MessagingKafkaMessageOffsetKey.Int(val) -} - -// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming -// to the "messaging.kafka.message.tombstone" semantic conventions. It -// represents a boolean that is true if the message is a tombstone. -func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { - return MessagingKafkaMessageTombstoneKey.Bool(val) -} - -// Attributes for Apache RocketMQ -const ( - // MessagingRocketmqNamespaceKey is the attribute Key conforming to the - // "messaging.rocketmq.namespace" semantic conventions. It represents the - // namespace of RocketMQ resources, resources in different namespaces are - // individual. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myNamespace' - MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") - - // MessagingRocketmqClientGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.client_group" semantic conventions. It represents - // the name of the RocketMQ producer/consumer group that is handling the - // message. The client type is identified by the SpanKind. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myConsumerGroup' - MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") - - // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key - // conforming to the "messaging.rocketmq.message.delivery_timestamp" - // semantic conventions. It represents the timestamp in milliseconds that - // the delay message is expected to be delivered to consumer. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If the message type is delay - // and delay time level is not specified.) - // Stability: stable - // Examples: 1665987217045 - MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") - - // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key - // conforming to the "messaging.rocketmq.message.delay_time_level" semantic - // conventions. It represents the delay time level for delay message, which - // determines the message delay time. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If the message type is delay - // and delivery timestamp is not specified.) - // Stability: stable - // Examples: 3 - MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") - - // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.message.group" semantic conventions. It represents - // the it is essential for FIFO message. Messages that belong to the same - // message group are always processed one by one within the same consumer - // group. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) - // Stability: stable - // Examples: 'myMessageGroup' - MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") - - // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the - // "messaging.rocketmq.message.type" semantic conventions. It represents - // the type of message. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") - - // MessagingRocketmqMessageTagKey is the attribute Key conforming to the - // "messaging.rocketmq.message.tag" semantic conventions. It represents the - // secondary classifier of message besides topic. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'tagA' - MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") - - // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the - // "messaging.rocketmq.message.keys" semantic conventions. It represents - // the key(s) of message, another way to mark message besides message id. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'keyA', 'keyB' - MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") - - // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to - // the "messaging.rocketmq.consumption_model" semantic conventions. It - // represents the model of message consumption. This only applies to - // consumer spans. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") -) - -var ( - // Normal message - MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") - // FIFO message - MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") - // Delay message - MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") - // Transaction message - MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") -) - -var ( - // Clustering consumption model - MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") - // Broadcasting consumption model - MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") -) - -// MessagingRocketmqNamespace returns an attribute KeyValue conforming to -// the "messaging.rocketmq.namespace" semantic conventions. It represents the -// namespace of RocketMQ resources, resources in different namespaces are -// individual. -func MessagingRocketmqNamespace(val string) attribute.KeyValue { - return MessagingRocketmqNamespaceKey.String(val) -} - -// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to -// the "messaging.rocketmq.client_group" semantic conventions. It represents -// the name of the RocketMQ producer/consumer group that is handling the -// message. The client type is identified by the SpanKind. -func MessagingRocketmqClientGroup(val string) attribute.KeyValue { - return MessagingRocketmqClientGroupKey.String(val) -} - -// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic -// conventions. It represents the timestamp in milliseconds that the delay -// message is expected to be delivered to consumer. -func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { - return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) -} - -// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delay_time_level" semantic -// conventions. It represents the delay time level for delay message, which -// determines the message delay time. -func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { - return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) -} - -// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.group" semantic conventions. It represents -// the it is essential for FIFO message. Messages that belong to the same -// message group are always processed one by one within the same consumer -// group. -func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { - return MessagingRocketmqMessageGroupKey.String(val) -} - -// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.tag" semantic conventions. It represents the -// secondary classifier of message besides topic. -func MessagingRocketmqMessageTag(val string) attribute.KeyValue { - return MessagingRocketmqMessageTagKey.String(val) -} - -// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.keys" semantic conventions. It represents -// the key(s) of message, another way to mark message besides message id. -func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { - return MessagingRocketmqMessageKeysKey.StringSlice(val) -} - -// Attributes describing URL. -const ( - // URLSchemeKey is the attribute Key conforming to the "url.scheme" - // semantic conventions. It represents the [URI - // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component - // identifying the used protocol. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'https', 'ftp', 'telnet' - URLSchemeKey = attribute.Key("url.scheme") - - // URLFullKey is the attribute Key conforming to the "url.full" semantic - // conventions. It represents the absolute URL describing a network - // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', - // '//localhost' - // Note: For network calls, URL usually has - // `scheme://host[:port][path][?query][#fragment]` format, where the - // fragment is not transmitted over HTTP, but if it is known, it should be - // included nevertheless. - // `url.full` MUST NOT contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. In such case username and - // password should be redacted and attribute's value should be - // `https://REDACTED:REDACTED@www.example.com/`. - // `url.full` SHOULD capture the absolute URL when it is available (or can - // be reconstructed) and SHOULD NOT be validated or modified except for - // sanitizing purposes. - URLFullKey = attribute.Key("url.full") - - // URLPathKey is the attribute Key conforming to the "url.path" semantic - // conventions. It represents the [URI - // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/search' - // Note: When missing, the value is assumed to be `/` - URLPathKey = attribute.Key("url.path") - - // URLQueryKey is the attribute Key conforming to the "url.query" semantic - // conventions. It represents the [URI - // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'q=OpenTelemetry' - // Note: Sensitive content provided in query string SHOULD be scrubbed when - // instrumentations can identify it. - URLQueryKey = attribute.Key("url.query") - - // URLFragmentKey is the attribute Key conforming to the "url.fragment" - // semantic conventions. It represents the [URI - // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'SemConv' - URLFragmentKey = attribute.Key("url.fragment") -) - -// URLScheme returns an attribute KeyValue conforming to the "url.scheme" -// semantic conventions. It represents the [URI -// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component -// identifying the used protocol. -func URLScheme(val string) attribute.KeyValue { - return URLSchemeKey.String(val) -} - -// URLFull returns an attribute KeyValue conforming to the "url.full" -// semantic conventions. It represents the absolute URL describing a network -// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) -func URLFull(val string) attribute.KeyValue { - return URLFullKey.String(val) -} - -// URLPath returns an attribute KeyValue conforming to the "url.path" -// semantic conventions. It represents the [URI -// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component -func URLPath(val string) attribute.KeyValue { - return URLPathKey.String(val) -} - -// URLQuery returns an attribute KeyValue conforming to the "url.query" -// semantic conventions. It represents the [URI -// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component -func URLQuery(val string) attribute.KeyValue { - return URLQueryKey.String(val) -} - -// URLFragment returns an attribute KeyValue conforming to the -// "url.fragment" semantic conventions. It represents the [URI -// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component -func URLFragment(val string) attribute.KeyValue { - return URLFragmentKey.String(val) -} - -// Describes user-agent attributes. -const ( - // UserAgentOriginalKey is the attribute Key conforming to the - // "user_agent.original" semantic conventions. It represents the value of - // the [HTTP - // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) - // header sent by the client. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' - UserAgentOriginalKey = attribute.Key("user_agent.original") -) - -// UserAgentOriginal returns an attribute KeyValue conforming to the -// "user_agent.original" semantic conventions. It represents the value of the -// [HTTP -// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) -// header sent by the client. -func UserAgentOriginal(val string) attribute.KeyValue { - return UserAgentOriginalKey.String(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/doc.go deleted file mode 100644 index 7cf424855..000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package semconv implements OpenTelemetry semantic conventions. -// -// OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the conventions -// as of the v1.21.0 version of the OpenTelemetry specification. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/exception.go deleted file mode 100644 index 93d3c1760..000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/exception.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" - -const ( - // ExceptionEventName is the name of the Span event representing an exception. - ExceptionEventName = "exception" -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/schema.go deleted file mode 100644 index 66ffd5989..000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.21.0/schema.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" - -// SchemaURL is the schema URL that matches the version of the semantic conventions -// that this package defines. Semconv packages starting from v1.4.0 must declare -// non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/1.21.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/README.md new file mode 100644 index 000000000..0b6cbe960 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/README.md @@ -0,0 +1,3 @@ +# Semconv v1.24.0 + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.24.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.24.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/attribute_group.go new file mode 100644 index 000000000..6e688345c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/attribute_group.go @@ -0,0 +1,4387 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +import "go.opentelemetry.io/otel/attribute" + +// Describes FaaS attributes. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: experimental + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") + + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + FaaSTriggerKey = attribute.Key("faas.trigger") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the identifies the class / type of + // event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'browser.mouse.click', 'device.app.lifecycle' + // Note: Event names are subject to the same rules as [attribute + // names](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.26.0/specification/common/attribute-naming.md). + // Notably, event names are namespaced to avoid collisions and provide a + // clean separation of semantics for events in separate domains like + // browser, mobile, and kubernetes. + EventNameKey = attribute.Key("event.name") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the identifies the class / type of +// event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Describes Log attributes +const ( + // LogIostreamKey is the attribute Key conforming to the "log.iostream" + // semantic conventions. It represents the stream associated with the log. + // See below for a list of well-known values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + LogIostreamKey = attribute.Key("log.iostream") +) + +var ( + // Logs from stdout stream + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// A file to which log was emitted. +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'audit.log' + LogFileNameKey = attribute.Key("log.file.name") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the + // basename of the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'uuid.log' + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/log/mysql/audit.log' + LogFilePathKey = attribute.Key("log.file.path") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full + // path to the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/lib/docker/uuid.log' + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") +) + +// LogFileName returns an attribute KeyValue conforming to the +// "log.file.name" semantic conventions. It represents the basename of the +// file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the +// "log.file.path" semantic conventions. It represents the full path to the +// file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path +// to the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// Describes Database attributes +const ( + // PoolNameKey is the attribute Key conforming to the "pool.name" semantic + // conventions. It represents the name of the connection pool; unique + // within the instrumented application. In case the connection pool + // implementation doesn't provide a name, then the + // [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) + // should be used + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myDataSource' + PoolNameKey = attribute.Key("pool.name") + + // StateKey is the attribute Key conforming to the "state" semantic + // conventions. It represents the state of a connection in the pool + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Examples: 'idle' + StateKey = attribute.Key("state") +) + +var ( + // idle + StateIdle = StateKey.String("idle") + // used + StateUsed = StateKey.String("used") +) + +// PoolName returns an attribute KeyValue conforming to the "pool.name" +// semantic conventions. It represents the name of the connection pool; unique +// within the instrumented application. In case the connection pool +// implementation doesn't provide a name, then the +// [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) +// should be used +func PoolName(val string) attribute.KeyValue { + return PoolNameKey.String(val) +} + +// ASP.NET Core attributes +const ( + // AspnetcoreDiagnosticsHandlerTypeKey is the attribute Key conforming to + // the "aspnetcore.diagnostics.handler.type" semantic conventions. It + // represents the full type name of the + // [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) + // implementation that handled the exception. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if and only if the exception + // was handled by this handler.) + // Stability: experimental + // Examples: 'Contoso.MyHandler' + AspnetcoreDiagnosticsHandlerTypeKey = attribute.Key("aspnetcore.diagnostics.handler.type") + + // AspnetcoreRateLimitingPolicyKey is the attribute Key conforming to the + // "aspnetcore.rate_limiting.policy" semantic conventions. It represents + // the rate limiting policy name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if the matched endpoint for the + // request had a rate-limiting policy.) + // Stability: experimental + // Examples: 'fixed', 'sliding', 'token' + AspnetcoreRateLimitingPolicyKey = attribute.Key("aspnetcore.rate_limiting.policy") + + // AspnetcoreRateLimitingResultKey is the attribute Key conforming to the + // "aspnetcore.rate_limiting.result" semantic conventions. It represents + // the rate-limiting result, shows whether the lease was acquired or + // contains a rejection reason + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Examples: 'acquired', 'request_canceled' + AspnetcoreRateLimitingResultKey = attribute.Key("aspnetcore.rate_limiting.result") + + // AspnetcoreRequestIsUnhandledKey is the attribute Key conforming to the + // "aspnetcore.request.is_unhandled" semantic conventions. It represents + // the flag indicating if request was handled by the application pipeline. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (if and only if the request was + // not handled.) + // Stability: experimental + // Examples: True + AspnetcoreRequestIsUnhandledKey = attribute.Key("aspnetcore.request.is_unhandled") + + // AspnetcoreRoutingIsFallbackKey is the attribute Key conforming to the + // "aspnetcore.routing.is_fallback" semantic conventions. It represents a + // value that indicates whether the matched route is a fallback route. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If and only if a route was + // successfully matched.) + // Stability: experimental + // Examples: True + AspnetcoreRoutingIsFallbackKey = attribute.Key("aspnetcore.routing.is_fallback") +) + +var ( + // Lease was acquired + AspnetcoreRateLimitingResultAcquired = AspnetcoreRateLimitingResultKey.String("acquired") + // Lease request was rejected by the endpoint limiter + AspnetcoreRateLimitingResultEndpointLimiter = AspnetcoreRateLimitingResultKey.String("endpoint_limiter") + // Lease request was rejected by the global limiter + AspnetcoreRateLimitingResultGlobalLimiter = AspnetcoreRateLimitingResultKey.String("global_limiter") + // Lease request was canceled + AspnetcoreRateLimitingResultRequestCanceled = AspnetcoreRateLimitingResultKey.String("request_canceled") +) + +// AspnetcoreDiagnosticsHandlerType returns an attribute KeyValue conforming +// to the "aspnetcore.diagnostics.handler.type" semantic conventions. It +// represents the full type name of the +// [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) +// implementation that handled the exception. +func AspnetcoreDiagnosticsHandlerType(val string) attribute.KeyValue { + return AspnetcoreDiagnosticsHandlerTypeKey.String(val) +} + +// AspnetcoreRateLimitingPolicy returns an attribute KeyValue conforming to +// the "aspnetcore.rate_limiting.policy" semantic conventions. It represents +// the rate limiting policy name. +func AspnetcoreRateLimitingPolicy(val string) attribute.KeyValue { + return AspnetcoreRateLimitingPolicyKey.String(val) +} + +// AspnetcoreRequestIsUnhandled returns an attribute KeyValue conforming to +// the "aspnetcore.request.is_unhandled" semantic conventions. It represents +// the flag indicating if request was handled by the application pipeline. +func AspnetcoreRequestIsUnhandled(val bool) attribute.KeyValue { + return AspnetcoreRequestIsUnhandledKey.Bool(val) +} + +// AspnetcoreRoutingIsFallback returns an attribute KeyValue conforming to +// the "aspnetcore.routing.is_fallback" semantic conventions. It represents a +// value that indicates whether the matched route is a fallback route. +func AspnetcoreRoutingIsFallback(val bool) attribute.KeyValue { + return AspnetcoreRoutingIsFallbackKey.Bool(val) +} + +// SignalR attributes +const ( + // SignalrConnectionStatusKey is the attribute Key conforming to the + // "signalr.connection.status" semantic conventions. It represents the + // signalR HTTP connection closure status. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'app_shutdown', 'timeout' + SignalrConnectionStatusKey = attribute.Key("signalr.connection.status") + + // SignalrTransportKey is the attribute Key conforming to the + // "signalr.transport" semantic conventions. It represents the [SignalR + // transport + // type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'web_sockets', 'long_polling' + SignalrTransportKey = attribute.Key("signalr.transport") +) + +var ( + // The connection was closed normally + SignalrConnectionStatusNormalClosure = SignalrConnectionStatusKey.String("normal_closure") + // The connection was closed due to a timeout + SignalrConnectionStatusTimeout = SignalrConnectionStatusKey.String("timeout") + // The connection was closed because the app is shutting down + SignalrConnectionStatusAppShutdown = SignalrConnectionStatusKey.String("app_shutdown") +) + +var ( + // ServerSentEvents protocol + SignalrTransportServerSentEvents = SignalrTransportKey.String("server_sent_events") + // LongPolling protocol + SignalrTransportLongPolling = SignalrTransportKey.String("long_polling") + // WebSockets protocol + SignalrTransportWebSockets = SignalrTransportKey.String("web_sockets") +) + +// Describes JVM buffer metric attributes. +const ( + // JvmBufferPoolNameKey is the attribute Key conforming to the + // "jvm.buffer.pool.name" semantic conventions. It represents the name of + // the buffer pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'mapped', 'direct' + // Note: Pool names are generally obtained via + // [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). + JvmBufferPoolNameKey = attribute.Key("jvm.buffer.pool.name") +) + +// JvmBufferPoolName returns an attribute KeyValue conforming to the +// "jvm.buffer.pool.name" semantic conventions. It represents the name of the +// buffer pool. +func JvmBufferPoolName(val string) attribute.KeyValue { + return JvmBufferPoolNameKey.String(val) +} + +// Describes JVM memory metric attributes. +const ( + // JvmMemoryPoolNameKey is the attribute Key conforming to the + // "jvm.memory.pool.name" semantic conventions. It represents the name of + // the memory pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' + // Note: Pool names are generally obtained via + // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + JvmMemoryPoolNameKey = attribute.Key("jvm.memory.pool.name") + + // JvmMemoryTypeKey is the attribute Key conforming to the + // "jvm.memory.type" semantic conventions. It represents the type of + // memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'heap', 'non_heap' + JvmMemoryTypeKey = attribute.Key("jvm.memory.type") +) + +var ( + // Heap memory + JvmMemoryTypeHeap = JvmMemoryTypeKey.String("heap") + // Non-heap memory + JvmMemoryTypeNonHeap = JvmMemoryTypeKey.String("non_heap") +) + +// JvmMemoryPoolName returns an attribute KeyValue conforming to the +// "jvm.memory.pool.name" semantic conventions. It represents the name of the +// memory pool. +func JvmMemoryPoolName(val string) attribute.KeyValue { + return JvmMemoryPoolNameKey.String(val) +} + +// Describes System metric attributes +const ( + // SystemDeviceKey is the attribute Key conforming to the "system.device" + // semantic conventions. It represents the device identifier + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '(identifier)' + SystemDeviceKey = attribute.Key("system.device") +) + +// SystemDevice returns an attribute KeyValue conforming to the +// "system.device" semantic conventions. It represents the device identifier +func SystemDevice(val string) attribute.KeyValue { + return SystemDeviceKey.String(val) +} + +// Describes System CPU metric attributes +const ( + // SystemCPULogicalNumberKey is the attribute Key conforming to the + // "system.cpu.logical_number" semantic conventions. It represents the + // logical CPU number [0..n-1] + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + SystemCPULogicalNumberKey = attribute.Key("system.cpu.logical_number") + + // SystemCPUStateKey is the attribute Key conforming to the + // "system.cpu.state" semantic conventions. It represents the state of the + // CPU + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'idle', 'interrupt' + SystemCPUStateKey = attribute.Key("system.cpu.state") +) + +var ( + // user + SystemCPUStateUser = SystemCPUStateKey.String("user") + // system + SystemCPUStateSystem = SystemCPUStateKey.String("system") + // nice + SystemCPUStateNice = SystemCPUStateKey.String("nice") + // idle + SystemCPUStateIdle = SystemCPUStateKey.String("idle") + // iowait + SystemCPUStateIowait = SystemCPUStateKey.String("iowait") + // interrupt + SystemCPUStateInterrupt = SystemCPUStateKey.String("interrupt") + // steal + SystemCPUStateSteal = SystemCPUStateKey.String("steal") +) + +// SystemCPULogicalNumber returns an attribute KeyValue conforming to the +// "system.cpu.logical_number" semantic conventions. It represents the logical +// CPU number [0..n-1] +func SystemCPULogicalNumber(val int) attribute.KeyValue { + return SystemCPULogicalNumberKey.Int(val) +} + +// Describes System Memory metric attributes +const ( + // SystemMemoryStateKey is the attribute Key conforming to the + // "system.memory.state" semantic conventions. It represents the memory + // state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free', 'cached' + SystemMemoryStateKey = attribute.Key("system.memory.state") +) + +var ( + // used + SystemMemoryStateUsed = SystemMemoryStateKey.String("used") + // free + SystemMemoryStateFree = SystemMemoryStateKey.String("free") + // shared + SystemMemoryStateShared = SystemMemoryStateKey.String("shared") + // buffers + SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") + // cached + SystemMemoryStateCached = SystemMemoryStateKey.String("cached") +) + +// Describes System Memory Paging metric attributes +const ( + // SystemPagingDirectionKey is the attribute Key conforming to the + // "system.paging.direction" semantic conventions. It represents the paging + // access direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'in' + SystemPagingDirectionKey = attribute.Key("system.paging.direction") + + // SystemPagingStateKey is the attribute Key conforming to the + // "system.paging.state" semantic conventions. It represents the memory + // paging state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free' + SystemPagingStateKey = attribute.Key("system.paging.state") + + // SystemPagingTypeKey is the attribute Key conforming to the + // "system.paging.type" semantic conventions. It represents the memory + // paging type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'minor' + SystemPagingTypeKey = attribute.Key("system.paging.type") +) + +var ( + // in + SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") + // out + SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") +) + +var ( + // used + SystemPagingStateUsed = SystemPagingStateKey.String("used") + // free + SystemPagingStateFree = SystemPagingStateKey.String("free") +) + +var ( + // major + SystemPagingTypeMajor = SystemPagingTypeKey.String("major") + // minor + SystemPagingTypeMinor = SystemPagingTypeKey.String("minor") +) + +// Describes Filesystem metric attributes +const ( + // SystemFilesystemModeKey is the attribute Key conforming to the + // "system.filesystem.mode" semantic conventions. It represents the + // filesystem mode + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'rw, ro' + SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") + + // SystemFilesystemMountpointKey is the attribute Key conforming to the + // "system.filesystem.mountpoint" semantic conventions. It represents the + // filesystem mount path + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/mnt/data' + SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") + + // SystemFilesystemStateKey is the attribute Key conforming to the + // "system.filesystem.state" semantic conventions. It represents the + // filesystem state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'used' + SystemFilesystemStateKey = attribute.Key("system.filesystem.state") + + // SystemFilesystemTypeKey is the attribute Key conforming to the + // "system.filesystem.type" semantic conventions. It represents the + // filesystem type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ext4' + SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") +) + +var ( + // used + SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") + // free + SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") + // reserved + SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") +) + +var ( + // fat32 + SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") + // exfat + SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") + // ntfs + SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") + // refs + SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") + // hfsplus + SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") + // ext4 + SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") +) + +// SystemFilesystemMode returns an attribute KeyValue conforming to the +// "system.filesystem.mode" semantic conventions. It represents the filesystem +// mode +func SystemFilesystemMode(val string) attribute.KeyValue { + return SystemFilesystemModeKey.String(val) +} + +// SystemFilesystemMountpoint returns an attribute KeyValue conforming to +// the "system.filesystem.mountpoint" semantic conventions. It represents the +// filesystem mount path +func SystemFilesystemMountpoint(val string) attribute.KeyValue { + return SystemFilesystemMountpointKey.String(val) +} + +// Describes Network metric attributes +const ( + // SystemNetworkStateKey is the attribute Key conforming to the + // "system.network.state" semantic conventions. It represents a stateless + // protocol MUST NOT set this attribute + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'close_wait' + SystemNetworkStateKey = attribute.Key("system.network.state") +) + +var ( + // close + SystemNetworkStateClose = SystemNetworkStateKey.String("close") + // close_wait + SystemNetworkStateCloseWait = SystemNetworkStateKey.String("close_wait") + // closing + SystemNetworkStateClosing = SystemNetworkStateKey.String("closing") + // delete + SystemNetworkStateDelete = SystemNetworkStateKey.String("delete") + // established + SystemNetworkStateEstablished = SystemNetworkStateKey.String("established") + // fin_wait_1 + SystemNetworkStateFinWait1 = SystemNetworkStateKey.String("fin_wait_1") + // fin_wait_2 + SystemNetworkStateFinWait2 = SystemNetworkStateKey.String("fin_wait_2") + // last_ack + SystemNetworkStateLastAck = SystemNetworkStateKey.String("last_ack") + // listen + SystemNetworkStateListen = SystemNetworkStateKey.String("listen") + // syn_recv + SystemNetworkStateSynRecv = SystemNetworkStateKey.String("syn_recv") + // syn_sent + SystemNetworkStateSynSent = SystemNetworkStateKey.String("syn_sent") + // time_wait + SystemNetworkStateTimeWait = SystemNetworkStateKey.String("time_wait") +) + +// Describes System Process metric attributes +const ( + // SystemProcessesStatusKey is the attribute Key conforming to the + // "system.processes.status" semantic conventions. It represents the + // process state, e.g., [Linux Process State + // Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'running' + SystemProcessesStatusKey = attribute.Key("system.processes.status") +) + +var ( + // running + SystemProcessesStatusRunning = SystemProcessesStatusKey.String("running") + // sleeping + SystemProcessesStatusSleeping = SystemProcessesStatusKey.String("sleeping") + // stopped + SystemProcessesStatusStopped = SystemProcessesStatusKey.String("stopped") + // defunct + SystemProcessesStatusDefunct = SystemProcessesStatusKey.String("defunct") +) + +// These attributes may be used to describe the client in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.address` SHOULD represent the client address + // behind any intermediaries, for example proxies, if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" + // semantic conventions. It represents the client port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.port` SHOULD represent the client port behind + // any intermediaries, for example proxies, if it's available. + ClientPortKey = attribute.Key("client.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the +// "client.address" semantic conventions. It represents the client address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number. +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// The attributes used to describe telemetry in the context of databases. +const ( + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary Cassandra table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") + + // DBElasticsearchClusterNameKey is the attribute Key conforming to the + // "db.elasticsearch.cluster.name" semantic conventions. It represents the + // represents the identifier of an Elasticsearch cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e9106fc68e3044f0b1475b04bf4ffd5f' + DBElasticsearchClusterNameKey = attribute.Key("db.elasticsearch.cluster.name") + + // DBElasticsearchNodeNameKey is the attribute Key conforming to the + // "db.elasticsearch.node.name" semantic conventions. It represents the + // represents the human-readable identifier of the node/instance to which a + // request was routed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-0000000001' + DBElasticsearchNodeNameKey = attribute.Key("db.elasticsearch.node.name") + + // DBInstanceIDKey is the attribute Key conforming to the "db.instance.id" + // semantic conventions. It represents an identifier (address, unique name, + // or any other identifier) of the database instance that is executing + // queries or mutations on the current connection. This is useful in cases + // where the database is running in a clustered environment and the + // instrumentation is able to record the node executing the query. The + // client may obtain this value in databases like MySQL using queries like + // `select @@hostname`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mysql-e26b99z.example.com' + DBInstanceIDKey = attribute.Key("db.instance.id") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the MongoDB + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") + + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `server.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") + + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") + + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBSystemKey = attribute.Key("db.system") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary Cassandra table that the operation is acting upon, including the +// keyspace name (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// DBElasticsearchClusterName returns an attribute KeyValue conforming to +// the "db.elasticsearch.cluster.name" semantic conventions. It represents the +// represents the identifier of an Elasticsearch cluster. +func DBElasticsearchClusterName(val string) attribute.KeyValue { + return DBElasticsearchClusterNameKey.String(val) +} + +// DBElasticsearchNodeName returns an attribute KeyValue conforming to the +// "db.elasticsearch.node.name" semantic conventions. It represents the +// represents the human-readable identifier of the node/instance to which a +// request was routed. +func DBElasticsearchNodeName(val string) attribute.KeyValue { + return DBElasticsearchNodeNameKey.String(val) +} + +// DBInstanceID returns an attribute KeyValue conforming to the +// "db.instance.id" semantic conventions. It represents an identifier (address, +// unique name, or any other identifier) of the database instance that is +// executing queries or mutations on the current connection. This is useful in +// cases where the database is running in a clustered environment and the +// instrumentation is able to record the node executing the query. The client +// may obtain this value in databases like MySQL using queries like `select +// @@hostname`. +func DBInstanceID(val string) attribute.KeyValue { + return DBInstanceIDKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the MongoDB +// collection being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// Describes deprecated HTTP attributes. +const ( + // HTTPFlavorKey is the attribute Key conforming to the "http.flavor" + // semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorKey = attribute.Key("http.flavor") + + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'GET', 'POST', 'HEAD' + // Deprecated: use `http.request.method` instead. + HTTPMethodKey = attribute.Key("http.method") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.request.header.content-length` instead. + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.response.header.content-length` instead. + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'http', 'https' + // Deprecated: use `url.scheme` instead. + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 200 + // Deprecated: use `http.response.status_code` instead. + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.path` and `url.query` instead. + HTTPTargetKey = attribute.Key("http.target") + + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.full` instead. + HTTPURLKey = attribute.Key("http.url") + + // HTTPUserAgentKey is the attribute Key conforming to the + // "http.user_agent" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3', 'Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1' + // Deprecated: use `user_agent.original` instead. + HTTPUserAgentKey = attribute.Key("http.user_agent") +) + +var ( + // HTTP/1.0 + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. +// +// Deprecated: use `http.request.method` instead. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. +// +// Deprecated: use `http.request.header.content-length` instead. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. +// +// Deprecated: use `http.response.header.content-length` instead. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. +// +// Deprecated: use `url.scheme` instead. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. +// +// Deprecated: use `http.response.status_code` instead. +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. +// +// Deprecated: use `url.path` and `url.query` instead. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. +// +// Deprecated: use `url.full` instead. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPUserAgent returns an attribute KeyValue conforming to the +// "http.user_agent" semantic conventions. +// +// Deprecated: use `user_agent.original` instead. +func HTTPUserAgent(val string) attribute.KeyValue { + return HTTPUserAgentKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address`. + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port`. + NetHostPortKey = attribute.Key("net.host.port") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address` on client spans and `client.address` on + // server spans. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port` on client spans and `client.port` on + // server spans. + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'amqp', 'http', 'mqtt' + // Deprecated: use `network.protocol.name`. + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '3.1.1' + // Deprecated: use `network.protocol.version`. + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: use `network.local.address`. + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `network.local.port`. + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '192.168.0.1' + // Deprecated: use `network.peer.address`. + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: no replacement at this time. + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 65531 + // Deprecated: use `network.peer.port`. + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport`. + NetTransportKey = attribute.Key("net.transport") +) + +var ( + // IPv4 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // ip_tcp + // + // Deprecated: use `network.transport`. + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + // + // Deprecated: use `network.transport`. + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe + // + // Deprecated: use `network.transport`. + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + // + // Deprecated: use `network.transport`. + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + // + // Deprecated: use `network.transport`. + NetTransportOther = NetTransportKey.String("other") +) + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. +// +// Deprecated: use `server.address`. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. +// +// Deprecated: use `server.port`. +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. +// +// Deprecated: use `server.address` on client spans and `client.address` on +// server spans. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. +// +// Deprecated: use `server.port` on client spans and `client.port` on server +// spans. +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. +// +// Deprecated: use `network.protocol.name`. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. +// +// Deprecated: use `network.protocol.version`. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. +// +// Deprecated: use `network.local.address`. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. +// +// Deprecated: use `network.local.port`. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. +// +// Deprecated: use `network.peer.address`. +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. +// +// Deprecated: no replacement at this time. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. +// +// Deprecated: use `network.peer.port`. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// These attributes may be used to describe the receiver of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the + // destination address - domain name if available without reverse DNS + // lookup; otherwise, IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'destination.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the source side, and when communicating through + // an intermediary, `destination.address` SHOULD represent the destination + // address behind any intermediaries, for example proxies, if it's + // available. + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the + // "destination.port" semantic conventions. It represents the destination + // port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the destination +// address - domain name if available without reverse DNS lookup; otherwise, IP +// address or Unix domain socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the destination port +// number +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// These attributes may be used for any disk related operation. +const ( + // DiskIoDirectionKey is the attribute Key conforming to the + // "disk.io.direction" semantic conventions. It represents the disk IO + // operation direction. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read' + DiskIoDirectionKey = attribute.Key("disk.io.direction") +) + +var ( + // read + DiskIoDirectionRead = DiskIoDirectionKey.String("read") + // write + DiskIoDirectionWrite = DiskIoDirectionKey.String("write") +) + +// The shared attributes used to report an error. +const ( + // ErrorTypeKey is the attribute Key conforming to the "error.type" + // semantic conventions. It represents the describes a class of error the + // operation ended with. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'timeout', 'java.net.UnknownHostException', + // 'server_certificate_invalid', '500' + // Note: The `error.type` SHOULD be predictable and SHOULD have low + // cardinality. + // Instrumentations SHOULD document the list of errors they report. + // + // The cardinality of `error.type` within one instrumentation library + // SHOULD be low. + // Telemetry consumers that aggregate data from multiple instrumentation + // libraries and applications + // should be prepared for `error.type` to have high cardinality at query + // time when no + // additional filters are applied. + // + // If the operation has completed successfully, instrumentations SHOULD NOT + // set `error.type`. + // + // If a specific domain defines its own set of error identifiers (such as + // HTTP or gRPC status codes), + // it's RECOMMENDED to: + // + // * Use a domain-specific attribute + // * Set `error.type` to capture all errors, regardless of whether they are + // defined within the domain-specific set or not. + ErrorTypeKey = attribute.Key("error.type") +) + +var ( + // A fallback error value to be used when the instrumentation doesn't define a custom value + ErrorTypeOther = ErrorTypeKey.String("_OTHER") +) + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example for recording span + // exceptions](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// Semantic convention attributes in the HTTP namespace. +const ( + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of + // the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the hTTP + // request method. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + // Note: HTTP request method value SHOULD be "known" to the + // instrumentation. + // By default, this convention defines "known" methods as the ones listed + // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + // and the PATCH method defined in + // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + // + // If the HTTP request method is not known to instrumentation, it MUST set + // the `http.request.method` attribute to `_OTHER`. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated + // list of case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is + // not a list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods + // to be case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GeT', 'ACL', 'foo' + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestResendCountKey is the attribute Key conforming to the + // "http.request.resend_count" semantic conventions. It represents the + // ordinal number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size + // of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status + // code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 200 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route, that is, the path + // template in the format used by the respective server framework. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/docs/http/http-spans.md#http-server-definitions) if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +var ( + // CONNECT method + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestResendCount returns an attribute KeyValue conforming to the +// "http.request.resend_count" semantic conventions. It represents the ordinal +// number of request resending attempt (for any reason, including redirects). +func HTTPRequestResendCount(val int) attribute.KeyValue { + return HTTPRequestResendCountKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of +// the response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the [HTTP +// response status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route, that is, the path +// template in the format used by the respective server framework. +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes describing telemetry around messaging systems and messaging +// activities. +const ( + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client_id" semantic conventions. It represents a unique + // identifier for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'client-5', 'myhost@8742@s8083jm' + MessagingClientIDKey = attribute.Key("messaging.client_id") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") + + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker doesn't have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationPublishAnonymousKey is the attribute Key conforming + // to the "messaging.destination_publish.anonymous" semantic conventions. + // It represents a boolean that is true if the publish message destination + // is anonymous (could be unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationPublishAnonymousKey = attribute.Key("messaging.destination_publish.anonymous") + + // MessagingDestinationPublishNameKey is the attribute Key conforming to + // the "messaging.destination_publish.name" semantic conventions. It + // represents the name of the original destination the message was + // published to + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: The name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker doesn't have such notion, the original destination name + // SHOULD uniquely identify the broker. + MessagingDestinationPublishNameKey = attribute.Key("messaging.destination_publish.name") + + // MessagingGCPPubsubMessageOrderingKeyKey is the attribute Key conforming + // to the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. + // It represents the ordering key for a given message. If the attribute is + // not present, the message does not have an ordering key. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ordering_key' + MessagingGCPPubsubMessageOrderingKeyKey = attribute.Key("messaging.gcp_pubsub.message.ordering_key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") + + // MessagingMessageBodySizeKey is the attribute Key conforming to the + // "messaging.message.body.size" semantic conventions. It represents the + // size of the message body in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1439 + // Note: This can refer to both the compressed or uncompressed body size. + // If both sizes are known, the uncompressed + // body size should be used. + MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the conversation ID identifying the conversation to which the message + // belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the + // "messaging.message.envelope.size" semantic conventions. It represents + // the size of the message body and metadata in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2738 + // Note: This can refer to both the compressed or uncompressed size. If + // both sizes are known, the uncompressed + // size should be used. + MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") + + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents an identifier for + // the messaging system being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingSystemKey = attribute.Key("messaging.system") +) + +var ( + // One or more messages are provided for publishing to an intermediary. If a single message is published, the context of the "Publish" span can be used as the creation context and no "Create" span needs to be created + MessagingOperationPublish = MessagingOperationKey.String("publish") + // A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch publishing scenarios + MessagingOperationCreate = MessagingOperationKey.String("create") + // One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages + MessagingOperationReceive = MessagingOperationKey.String("receive") + // One or more messages are passed to a consumer. This operation refers to push-based scenarios, where consumer register callbacks which get called by messaging SDKs + MessagingOperationDeliver = MessagingOperationKey.String("deliver") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Apache ActiveMQ + MessagingSystemActivemq = MessagingSystemKey.String("activemq") + // Amazon Simple Queue Service (SQS) + MessagingSystemAWSSqs = MessagingSystemKey.String("aws_sqs") + // Azure Event Grid + MessagingSystemAzureEventgrid = MessagingSystemKey.String("azure_eventgrid") + // Azure Event Hubs + MessagingSystemAzureEventhubs = MessagingSystemKey.String("azure_eventhubs") + // Azure Service Bus + MessagingSystemAzureServicebus = MessagingSystemKey.String("azure_servicebus") + // Google Cloud Pub/Sub + MessagingSystemGCPPubsub = MessagingSystemKey.String("gcp_pubsub") + // Java Message Service + MessagingSystemJms = MessagingSystemKey.String("jms") + // Apache Kafka + MessagingSystemKafka = MessagingSystemKey.String("kafka") + // RabbitMQ + MessagingSystemRabbitmq = MessagingSystemKey.String("rabbitmq") + // Apache RocketMQ + MessagingSystemRocketmq = MessagingSystemKey.String("rocketmq") +) + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client_id" semantic conventions. It represents a unique +// identifier for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationPublishAnonymous returns an attribute KeyValue +// conforming to the "messaging.destination_publish.anonymous" semantic +// conventions. It represents a boolean that is true if the publish message +// destination is anonymous (could be unnamed or have auto-generated name). +func MessagingDestinationPublishAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationPublishAnonymousKey.Bool(val) +} + +// MessagingDestinationPublishName returns an attribute KeyValue conforming +// to the "messaging.destination_publish.name" semantic conventions. It +// represents the name of the original destination the message was published to +func MessagingDestinationPublishName(val string) attribute.KeyValue { + return MessagingDestinationPublishNameKey.String(val) +} + +// MessagingGCPPubsubMessageOrderingKey returns an attribute KeyValue +// conforming to the "messaging.gcp_pubsub.message.ordering_key" semantic +// conventions. It represents the ordering key for a given message. If the +// attribute is not present, the message does not have an ordering key. +func MessagingGCPPubsubMessageOrderingKey(val string) attribute.KeyValue { + return MessagingGCPPubsubMessageOrderingKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// MessagingMessageBodySize returns an attribute KeyValue conforming to the +// "messaging.message.body.size" semantic conventions. It represents the size +// of the message body in bytes. +func MessagingMessageBodySize(val int) attribute.KeyValue { + return MessagingMessageBodySizeKey.Int(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the conversation ID identifying the conversation to which the +// message belongs, represented as a string. Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to +// the "messaging.message.envelope.size" semantic conventions. It represents +// the size of the message body and metadata in bytes. +func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { + return MessagingMessageEnvelopeSizeKey.Int(val) +} + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkCarrierIccKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier + // network. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'DE' + NetworkCarrierIccKey = attribute.Key("network.carrier.icc") + + // NetworkCarrierMccKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '310' + NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMncKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '001' + NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'sprint' + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'LTE' + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the + // internet connection type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'wifi' + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkIoDirectionKey is the attribute Key conforming to the + // "network.io.direction" semantic conventions. It represents the network + // IO operation direction. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'transmit' + NetworkIoDirectionKey = attribute.Key("network.io.direction") + + // NetworkLocalAddressKey is the attribute Key conforming to the + // "network.local.address" semantic conventions. It represents the local + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkLocalAddressKey = attribute.Key("network.local.address") + + // NetworkLocalPortKey is the attribute Key conforming to the + // "network.local.port" semantic conventions. It represents the local port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkLocalPortKey = attribute.Key("network.local.port") + + // NetworkPeerAddressKey is the attribute Key conforming to the + // "network.peer.address" semantic conventions. It represents the peer + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkPeerAddressKey = attribute.Key("network.peer.address") + + // NetworkPeerPortKey is the attribute Key conforming to the + // "network.peer.port" semantic conventions. It represents the peer port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkPeerPortKey = attribute.Key("network.peer.port") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the [OSI + // application layer](https://osi-model.com/application-layer/) or non-OSI + // equivalent. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + // Note: The value SHOULD be normalized to lowercase. + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the + // version of the protocol specified in `network.protocol.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `network.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, + // this attribute should be set to `1.1`. + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") + + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the [OSI + // transport layer](https://osi-model.com/transport-layer/) or + // [inter-process communication + // method](https://wikipedia.org/wiki/Inter-process_communication). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tcp', 'udp' + // Note: The value SHOULD be normalized to lowercase. + // + // Consider always setting the transport when setting a port number, since + // a port number is ambiguous without knowing the transport. For example + // different processes could be listening on TCP port 12345 and UDP port + // 12345. + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" + // semantic conventions. It represents the [OSI network + // layer](https://osi-model.com/network-layer/) or non-OSI equivalent. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ipv4', 'ipv6' + // Note: The value SHOULD be normalized to lowercase. + NetworkTypeKey = attribute.Key("network.type") +) + +var ( + // GPRS + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +var ( + // wifi + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +var ( + // transmit + NetworkIoDirectionTransmit = NetworkIoDirectionKey.String("transmit") + // receive + NetworkIoDirectionReceive = NetworkIoDirectionKey.String("receive") +) + +var ( + // TCP + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + NetworkTransportUnix = NetworkTransportKey.String("unix") +) + +var ( + // IPv4 + NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") + // IPv6 + NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") +) + +// NetworkCarrierIcc returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierIcc(val string) attribute.KeyValue { + return NetworkCarrierIccKey.String(val) +} + +// NetworkCarrierMcc returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMcc(val string) attribute.KeyValue { + return NetworkCarrierMccKey.String(val) +} + +// NetworkCarrierMnc returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMnc(val string) attribute.KeyValue { + return NetworkCarrierMncKey.String(val) +} + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkLocalAddress returns an attribute KeyValue conforming to the +// "network.local.address" semantic conventions. It represents the local +// address of the network connection - IP address or Unix domain socket name. +func NetworkLocalAddress(val string) attribute.KeyValue { + return NetworkLocalAddressKey.String(val) +} + +// NetworkLocalPort returns an attribute KeyValue conforming to the +// "network.local.port" semantic conventions. It represents the local port +// number of the network connection. +func NetworkLocalPort(val int) attribute.KeyValue { + return NetworkLocalPortKey.Int(val) +} + +// NetworkPeerAddress returns an attribute KeyValue conforming to the +// "network.peer.address" semantic conventions. It represents the peer address +// of the network connection - IP address or Unix domain socket name. +func NetworkPeerAddress(val string) attribute.KeyValue { + return NetworkPeerAddressKey.String(val) +} + +// NetworkPeerPort returns an attribute KeyValue conforming to the +// "network.peer.port" semantic conventions. It represents the peer port number +// of the network connection. +func NetworkPeerPort(val int) attribute.KeyValue { + return NetworkPeerPortKey.Int(val) +} + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the [OSI +// application layer](https://osi-model.com/application-layer/) or non-OSI +// equivalent. +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the version +// of the protocol specified in `network.protocol.name`. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// Attributes for remote procedure calls. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") + + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // doesn't specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCSystemKey = attribute.Key("rpc.system") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// doesn't specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// These attributes may be used to describe the server in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the server domain name if available + // without reverse DNS lookup; otherwise, IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.address` SHOULD represent the server address + // behind any intermediaries, for example proxies, if it's available. + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" + // semantic conventions. It represents the server port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.port` SHOULD represent the server port behind + // any intermediaries, for example proxies, if it's available. + ServerPortKey = attribute.Key("server.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the +// "server.address" semantic conventions. It represents the server domain name +// if available without reverse DNS lookup; otherwise, IP address or Unix +// domain socket name. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the server port number. +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// These attributes may be used to describe the sender of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'source.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the destination side, and when communicating + // through an intermediary, `source.address` SHOULD represent the source + // address behind any intermediaries, for example proxies, if it's + // available. + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" + // semantic conventions. It represents the source port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceAddress returns an attribute KeyValue conforming to the +// "source.address" semantic conventions. It represents the source address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} + +// Semantic convention attributes in the TLS namespace. +const ( + // TLSCipherKey is the attribute Key conforming to the "tls.cipher" + // semantic conventions. It represents the string indicating the + // [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) + // used during the current connection. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TLS_RSA_WITH_3DES_EDE_CBC_SHA', + // 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256' + // Note: The values allowed for `tls.cipher` MUST be one of the + // `Descriptions` of the [registered TLS Cipher + // Suits](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4). + TLSCipherKey = attribute.Key("tls.cipher") + + // TLSClientCertificateKey is the attribute Key conforming to the + // "tls.client.certificate" semantic conventions. It represents the + // pEM-encoded stand-alone certificate offered by the client. This is + // usually mutually-exclusive of `client.certificate_chain` since this + // value also exists in that list. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...' + TLSClientCertificateKey = attribute.Key("tls.client.certificate") + + // TLSClientCertificateChainKey is the attribute Key conforming to the + // "tls.client.certificate_chain" semantic conventions. It represents the + // array of PEM-encoded certificates that make up the certificate chain + // offered by the client. This is usually mutually-exclusive of + // `client.certificate` since that value should be the first certificate in + // the chain. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...', 'MI...' + TLSClientCertificateChainKey = attribute.Key("tls.client.certificate_chain") + + // TLSClientHashMd5Key is the attribute Key conforming to the + // "tls.client.hash.md5" semantic conventions. It represents the + // certificate fingerprint using the MD5 digest of DER-encoded version of + // certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC' + TLSClientHashMd5Key = attribute.Key("tls.client.hash.md5") + + // TLSClientHashSha1Key is the attribute Key conforming to the + // "tls.client.hash.sha1" semantic conventions. It represents the + // certificate fingerprint using the SHA1 digest of DER-encoded version of + // certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '9E393D93138888D288266C2D915214D1D1CCEB2A' + TLSClientHashSha1Key = attribute.Key("tls.client.hash.sha1") + + // TLSClientHashSha256Key is the attribute Key conforming to the + // "tls.client.hash.sha256" semantic conventions. It represents the + // certificate fingerprint using the SHA256 digest of DER-encoded version + // of certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // '0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0' + TLSClientHashSha256Key = attribute.Key("tls.client.hash.sha256") + + // TLSClientIssuerKey is the attribute Key conforming to the + // "tls.client.issuer" semantic conventions. It represents the + // distinguished name of + // [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) + // of the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=Example Root CA, OU=Infrastructure Team, DC=example, + // DC=com' + TLSClientIssuerKey = attribute.Key("tls.client.issuer") + + // TLSClientJa3Key is the attribute Key conforming to the "tls.client.ja3" + // semantic conventions. It represents a hash that identifies clients based + // on how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'd4e5b18d6b55c71272893221c96ba240' + TLSClientJa3Key = attribute.Key("tls.client.ja3") + + // TLSClientNotAfterKey is the attribute Key conforming to the + // "tls.client.not_after" semantic conventions. It represents the date/Time + // indicating when client certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021-01-01T00:00:00.000Z' + TLSClientNotAfterKey = attribute.Key("tls.client.not_after") + + // TLSClientNotBeforeKey is the attribute Key conforming to the + // "tls.client.not_before" semantic conventions. It represents the + // date/Time indicating when client certificate is first considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1970-01-01T00:00:00.000Z' + TLSClientNotBeforeKey = attribute.Key("tls.client.not_before") + + // TLSClientServerNameKey is the attribute Key conforming to the + // "tls.client.server_name" semantic conventions. It represents the also + // called an SNI, this tells the server which hostname to which the client + // is attempting to connect to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry.io' + TLSClientServerNameKey = attribute.Key("tls.client.server_name") + + // TLSClientSubjectKey is the attribute Key conforming to the + // "tls.client.subject" semantic conventions. It represents the + // distinguished name of subject of the x.509 certificate presented by the + // client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=myclient, OU=Documentation Team, DC=example, DC=com' + TLSClientSubjectKey = attribute.Key("tls.client.subject") + + // TLSClientSupportedCiphersKey is the attribute Key conforming to the + // "tls.client.supported_ciphers" semantic conventions. It represents the + // array of ciphers offered by the client during the client hello. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + // "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "..."' + TLSClientSupportedCiphersKey = attribute.Key("tls.client.supported_ciphers") + + // TLSCurveKey is the attribute Key conforming to the "tls.curve" semantic + // conventions. It represents the string indicating the curve used for the + // given cipher, when applicable + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'secp256r1' + TLSCurveKey = attribute.Key("tls.curve") + + // TLSEstablishedKey is the attribute Key conforming to the + // "tls.established" semantic conventions. It represents the boolean flag + // indicating if the TLS negotiation was successful and transitioned to an + // encrypted tunnel. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Examples: True + TLSEstablishedKey = attribute.Key("tls.established") + + // TLSNextProtocolKey is the attribute Key conforming to the + // "tls.next_protocol" semantic conventions. It represents the string + // indicating the protocol being tunneled. Per the values in the [IANA + // registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), + // this string should be lower case. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'http/1.1' + TLSNextProtocolKey = attribute.Key("tls.next_protocol") + + // TLSProtocolNameKey is the attribute Key conforming to the + // "tls.protocol.name" semantic conventions. It represents the normalized + // lowercase protocol name parsed from original string of the negotiated + // [SSL/TLS protocol + // version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + TLSProtocolNameKey = attribute.Key("tls.protocol.name") + + // TLSProtocolVersionKey is the attribute Key conforming to the + // "tls.protocol.version" semantic conventions. It represents the numeric + // part of the version parsed from the original string of the negotiated + // [SSL/TLS protocol + // version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2', '3' + TLSProtocolVersionKey = attribute.Key("tls.protocol.version") + + // TLSResumedKey is the attribute Key conforming to the "tls.resumed" + // semantic conventions. It represents the boolean flag indicating if this + // TLS connection was resumed from an existing TLS negotiation. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Examples: True + TLSResumedKey = attribute.Key("tls.resumed") + + // TLSServerCertificateKey is the attribute Key conforming to the + // "tls.server.certificate" semantic conventions. It represents the + // pEM-encoded stand-alone certificate offered by the server. This is + // usually mutually-exclusive of `server.certificate_chain` since this + // value also exists in that list. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...' + TLSServerCertificateKey = attribute.Key("tls.server.certificate") + + // TLSServerCertificateChainKey is the attribute Key conforming to the + // "tls.server.certificate_chain" semantic conventions. It represents the + // array of PEM-encoded certificates that make up the certificate chain + // offered by the server. This is usually mutually-exclusive of + // `server.certificate` since that value should be the first certificate in + // the chain. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...', 'MI...' + TLSServerCertificateChainKey = attribute.Key("tls.server.certificate_chain") + + // TLSServerHashMd5Key is the attribute Key conforming to the + // "tls.server.hash.md5" semantic conventions. It represents the + // certificate fingerprint using the MD5 digest of DER-encoded version of + // certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC' + TLSServerHashMd5Key = attribute.Key("tls.server.hash.md5") + + // TLSServerHashSha1Key is the attribute Key conforming to the + // "tls.server.hash.sha1" semantic conventions. It represents the + // certificate fingerprint using the SHA1 digest of DER-encoded version of + // certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '9E393D93138888D288266C2D915214D1D1CCEB2A' + TLSServerHashSha1Key = attribute.Key("tls.server.hash.sha1") + + // TLSServerHashSha256Key is the attribute Key conforming to the + // "tls.server.hash.sha256" semantic conventions. It represents the + // certificate fingerprint using the SHA256 digest of DER-encoded version + // of certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // '0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0' + TLSServerHashSha256Key = attribute.Key("tls.server.hash.sha256") + + // TLSServerIssuerKey is the attribute Key conforming to the + // "tls.server.issuer" semantic conventions. It represents the + // distinguished name of + // [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) + // of the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=Example Root CA, OU=Infrastructure Team, DC=example, + // DC=com' + TLSServerIssuerKey = attribute.Key("tls.server.issuer") + + // TLSServerJa3sKey is the attribute Key conforming to the + // "tls.server.ja3s" semantic conventions. It represents a hash that + // identifies servers based on how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'd4e5b18d6b55c71272893221c96ba240' + TLSServerJa3sKey = attribute.Key("tls.server.ja3s") + + // TLSServerNotAfterKey is the attribute Key conforming to the + // "tls.server.not_after" semantic conventions. It represents the date/Time + // indicating when server certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021-01-01T00:00:00.000Z' + TLSServerNotAfterKey = attribute.Key("tls.server.not_after") + + // TLSServerNotBeforeKey is the attribute Key conforming to the + // "tls.server.not_before" semantic conventions. It represents the + // date/Time indicating when server certificate is first considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1970-01-01T00:00:00.000Z' + TLSServerNotBeforeKey = attribute.Key("tls.server.not_before") + + // TLSServerSubjectKey is the attribute Key conforming to the + // "tls.server.subject" semantic conventions. It represents the + // distinguished name of subject of the x.509 certificate presented by the + // server. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=myserver, OU=Documentation Team, DC=example, DC=com' + TLSServerSubjectKey = attribute.Key("tls.server.subject") +) + +var ( + // ssl + TLSProtocolNameSsl = TLSProtocolNameKey.String("ssl") + // tls + TLSProtocolNameTLS = TLSProtocolNameKey.String("tls") +) + +// TLSCipher returns an attribute KeyValue conforming to the "tls.cipher" +// semantic conventions. It represents the string indicating the +// [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) used +// during the current connection. +func TLSCipher(val string) attribute.KeyValue { + return TLSCipherKey.String(val) +} + +// TLSClientCertificate returns an attribute KeyValue conforming to the +// "tls.client.certificate" semantic conventions. It represents the pEM-encoded +// stand-alone certificate offered by the client. This is usually +// mutually-exclusive of `client.certificate_chain` since this value also +// exists in that list. +func TLSClientCertificate(val string) attribute.KeyValue { + return TLSClientCertificateKey.String(val) +} + +// TLSClientCertificateChain returns an attribute KeyValue conforming to the +// "tls.client.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by +// the client. This is usually mutually-exclusive of `client.certificate` since +// that value should be the first certificate in the chain. +func TLSClientCertificateChain(val ...string) attribute.KeyValue { + return TLSClientCertificateChainKey.StringSlice(val) +} + +// TLSClientHashMd5 returns an attribute KeyValue conforming to the +// "tls.client.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashMd5(val string) attribute.KeyValue { + return TLSClientHashMd5Key.String(val) +} + +// TLSClientHashSha1 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha1(val string) attribute.KeyValue { + return TLSClientHashSha1Key.String(val) +} + +// TLSClientHashSha256 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha256(val string) attribute.KeyValue { + return TLSClientHashSha256Key.String(val) +} + +// TLSClientIssuer returns an attribute KeyValue conforming to the +// "tls.client.issuer" semantic conventions. It represents the distinguished +// name of +// [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of +// the issuer of the x.509 certificate presented by the client. +func TLSClientIssuer(val string) attribute.KeyValue { + return TLSClientIssuerKey.String(val) +} + +// TLSClientJa3 returns an attribute KeyValue conforming to the +// "tls.client.ja3" semantic conventions. It represents a hash that identifies +// clients based on how they perform an SSL/TLS handshake. +func TLSClientJa3(val string) attribute.KeyValue { + return TLSClientJa3Key.String(val) +} + +// TLSClientNotAfter returns an attribute KeyValue conforming to the +// "tls.client.not_after" semantic conventions. It represents the date/Time +// indicating when client certificate is no longer considered valid. +func TLSClientNotAfter(val string) attribute.KeyValue { + return TLSClientNotAfterKey.String(val) +} + +// TLSClientNotBefore returns an attribute KeyValue conforming to the +// "tls.client.not_before" semantic conventions. It represents the date/Time +// indicating when client certificate is first considered valid. +func TLSClientNotBefore(val string) attribute.KeyValue { + return TLSClientNotBeforeKey.String(val) +} + +// TLSClientServerName returns an attribute KeyValue conforming to the +// "tls.client.server_name" semantic conventions. It represents the also called +// an SNI, this tells the server which hostname to which the client is +// attempting to connect to. +func TLSClientServerName(val string) attribute.KeyValue { + return TLSClientServerNameKey.String(val) +} + +// TLSClientSubject returns an attribute KeyValue conforming to the +// "tls.client.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the client. +func TLSClientSubject(val string) attribute.KeyValue { + return TLSClientSubjectKey.String(val) +} + +// TLSClientSupportedCiphers returns an attribute KeyValue conforming to the +// "tls.client.supported_ciphers" semantic conventions. It represents the array +// of ciphers offered by the client during the client hello. +func TLSClientSupportedCiphers(val ...string) attribute.KeyValue { + return TLSClientSupportedCiphersKey.StringSlice(val) +} + +// TLSCurve returns an attribute KeyValue conforming to the "tls.curve" +// semantic conventions. It represents the string indicating the curve used for +// the given cipher, when applicable +func TLSCurve(val string) attribute.KeyValue { + return TLSCurveKey.String(val) +} + +// TLSEstablished returns an attribute KeyValue conforming to the +// "tls.established" semantic conventions. It represents the boolean flag +// indicating if the TLS negotiation was successful and transitioned to an +// encrypted tunnel. +func TLSEstablished(val bool) attribute.KeyValue { + return TLSEstablishedKey.Bool(val) +} + +// TLSNextProtocol returns an attribute KeyValue conforming to the +// "tls.next_protocol" semantic conventions. It represents the string +// indicating the protocol being tunneled. Per the values in the [IANA +// registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), +// this string should be lower case. +func TLSNextProtocol(val string) attribute.KeyValue { + return TLSNextProtocolKey.String(val) +} + +// TLSProtocolVersion returns an attribute KeyValue conforming to the +// "tls.protocol.version" semantic conventions. It represents the numeric part +// of the version parsed from the original string of the negotiated [SSL/TLS +// protocol +// version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) +func TLSProtocolVersion(val string) attribute.KeyValue { + return TLSProtocolVersionKey.String(val) +} + +// TLSResumed returns an attribute KeyValue conforming to the "tls.resumed" +// semantic conventions. It represents the boolean flag indicating if this TLS +// connection was resumed from an existing TLS negotiation. +func TLSResumed(val bool) attribute.KeyValue { + return TLSResumedKey.Bool(val) +} + +// TLSServerCertificate returns an attribute KeyValue conforming to the +// "tls.server.certificate" semantic conventions. It represents the pEM-encoded +// stand-alone certificate offered by the server. This is usually +// mutually-exclusive of `server.certificate_chain` since this value also +// exists in that list. +func TLSServerCertificate(val string) attribute.KeyValue { + return TLSServerCertificateKey.String(val) +} + +// TLSServerCertificateChain returns an attribute KeyValue conforming to the +// "tls.server.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by +// the server. This is usually mutually-exclusive of `server.certificate` since +// that value should be the first certificate in the chain. +func TLSServerCertificateChain(val ...string) attribute.KeyValue { + return TLSServerCertificateChainKey.StringSlice(val) +} + +// TLSServerHashMd5 returns an attribute KeyValue conforming to the +// "tls.server.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashMd5(val string) attribute.KeyValue { + return TLSServerHashMd5Key.String(val) +} + +// TLSServerHashSha1 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha1(val string) attribute.KeyValue { + return TLSServerHashSha1Key.String(val) +} + +// TLSServerHashSha256 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha256(val string) attribute.KeyValue { + return TLSServerHashSha256Key.String(val) +} + +// TLSServerIssuer returns an attribute KeyValue conforming to the +// "tls.server.issuer" semantic conventions. It represents the distinguished +// name of +// [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of +// the issuer of the x.509 certificate presented by the client. +func TLSServerIssuer(val string) attribute.KeyValue { + return TLSServerIssuerKey.String(val) +} + +// TLSServerJa3s returns an attribute KeyValue conforming to the +// "tls.server.ja3s" semantic conventions. It represents a hash that identifies +// servers based on how they perform an SSL/TLS handshake. +func TLSServerJa3s(val string) attribute.KeyValue { + return TLSServerJa3sKey.String(val) +} + +// TLSServerNotAfter returns an attribute KeyValue conforming to the +// "tls.server.not_after" semantic conventions. It represents the date/Time +// indicating when server certificate is no longer considered valid. +func TLSServerNotAfter(val string) attribute.KeyValue { + return TLSServerNotAfterKey.String(val) +} + +// TLSServerNotBefore returns an attribute KeyValue conforming to the +// "tls.server.not_before" semantic conventions. It represents the date/Time +// indicating when server certificate is first considered valid. +func TLSServerNotBefore(val string) attribute.KeyValue { + return TLSServerNotBeforeKey.String(val) +} + +// TLSServerSubject returns an attribute KeyValue conforming to the +// "tls.server.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the server. +func TLSServerSubject(val string) attribute.KeyValue { + return TLSServerSubjectKey.String(val) +} + +// Attributes describing URL. +const ( + // URLFragmentKey is the attribute Key conforming to the "url.fragment" + // semantic conventions. It represents the [URI + // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'SemConv' + URLFragmentKey = attribute.Key("url.fragment") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network + // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // '//localhost' + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the + // fragment is not transmitted over HTTP, but if it is known, it SHOULD be + // included nevertheless. + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case username and + // password SHOULD be redacted and attribute's value SHOULD be + // `https://REDACTED:REDACTED@www.example.com/`. + // `url.full` SHOULD capture the absolute URL when it is available (or can + // be reconstructed) and SHOULD NOT be validated or modified except for + // sanitizing purposes. + URLFullKey = attribute.Key("url.full") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI + // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/search' + URLPathKey = attribute.Key("url.path") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI + // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'q=OpenTelemetry' + // Note: Sensitive content provided in query string SHOULD be scrubbed when + // instrumentations can identify it. + URLQueryKey = attribute.Key("url.query") + + // URLSchemeKey is the attribute Key conforming to the "url.scheme" + // semantic conventions. It represents the [URI + // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component + // identifying the used protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https', 'ftp', 'telnet' + URLSchemeKey = attribute.Key("url.scheme") +) + +// URLFragment returns an attribute KeyValue conforming to the +// "url.fragment" semantic conventions. It represents the [URI +// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" +// semantic conventions. It represents the absolute URL describing a network +// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" +// semantic conventions. It represents the [URI +// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" +// semantic conventions. It represents the [URI +// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI +// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component +// identifying the used protocol. +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3', 'Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} + +// Session is defined as the period of time encompassing all activities +// performed by the application and the actions executed by the end user. +// Consequently, a Session is represented as a collection of Logs, Events, and +// Spans emitted by the Client Application throughout the Session's duration. +// Each Session is assigned a unique identifier, which is included as an +// attribute in the Logs, Events, and Spans generated during the Session's +// lifecycle. +// When a session reaches end of life, typically due to user inactivity or +// session timeout, a new session identifier will be assigned. The previous +// session identifier may be provided by the instrumentation so that telemetry +// backends can link the two sessions. +const ( + // SessionIDKey is the attribute Key conforming to the "session.id" + // semantic conventions. It represents a unique id to identify a session. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionIDKey = attribute.Key("session.id") + + // SessionPreviousIDKey is the attribute Key conforming to the + // "session.previous_id" semantic conventions. It represents the previous + // `session.id` for this user, when known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionPreviousIDKey = attribute.Key("session.previous_id") +) + +// SessionID returns an attribute KeyValue conforming to the "session.id" +// semantic conventions. It represents a unique id to identify a session. +func SessionID(val string) attribute.KeyValue { + return SessionIDKey.String(val) +} + +// SessionPreviousID returns an attribute KeyValue conforming to the +// "session.previous_id" semantic conventions. It represents the previous +// `session.id` for this user, when known. +func SessionPreviousID(val string) attribute.KeyValue { + return SessionPreviousIDKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/doc.go new file mode 100644 index 000000000..d27e8a8f8 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/doc.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the v1.24.0 +// version of the OpenTelemetry semantic conventions. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/event.go b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/event.go new file mode 100644 index 000000000..6c019aafc --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/event.go @@ -0,0 +1,200 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +import "go.opentelemetry.io/otel/attribute" + +// This event represents an occurrence of a lifecycle transition on the iOS +// platform. +const ( + // IosStateKey is the attribute Key conforming to the "ios.state" semantic + // conventions. It represents the this attribute represents the state the + // application has transitioned into at the occurrence of the event. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: The iOS lifecycle states are defined in the [UIApplicationDelegate + // documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), + // and from which the `OS terminology` column values are derived. + IosStateKey = attribute.Key("ios.state") +) + +var ( + // The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive` + IosStateActive = IosStateKey.String("active") + // The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive` + IosStateInactive = IosStateKey.String("inactive") + // The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground` + IosStateBackground = IosStateKey.String("background") + // The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground` + IosStateForeground = IosStateKey.String("foreground") + // The app is about to terminate. Associated with UIKit notification `applicationWillTerminate` + IosStateTerminate = IosStateKey.String("terminate") +) + +// This event represents an occurrence of a lifecycle transition on the Android +// platform. +const ( + // AndroidStateKey is the attribute Key conforming to the "android.state" + // semantic conventions. It represents the this attribute represents the + // state the application has transitioned into at the occurrence of the + // event. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: The Android lifecycle states are defined in [Activity lifecycle + // callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), + // and from which the `OS identifiers` are derived. + AndroidStateKey = attribute.Key("android.state") +) + +var ( + // Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time + AndroidStateCreated = AndroidStateKey.String("created") + // Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state + AndroidStateBackground = AndroidStateKey.String("background") + // Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states + AndroidStateForeground = AndroidStateKey.String("foreground") +) + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessageTypeKey = attribute.Key("message.type") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/exception.go new file mode 100644 index 000000000..7235bb51d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/exception.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/metric.go new file mode 100644 index 000000000..a6b953f62 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/metric.go @@ -0,0 +1,1071 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +const ( + + // DBClientConnectionsUsage is the metric conforming to the + // "db.client.connections.usage" semantic conventions. It represents the number + // of connections that are currently in state described by the `state` + // attribute. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionsUsageName = "db.client.connections.usage" + DBClientConnectionsUsageUnit = "{connection}" + DBClientConnectionsUsageDescription = "The number of connections that are currently in state described by the `state` attribute" + + // DBClientConnectionsIdleMax is the metric conforming to the + // "db.client.connections.idle.max" semantic conventions. It represents the + // maximum number of idle open connections allowed. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionsIdleMaxName = "db.client.connections.idle.max" + DBClientConnectionsIdleMaxUnit = "{connection}" + DBClientConnectionsIdleMaxDescription = "The maximum number of idle open connections allowed" + + // DBClientConnectionsIdleMin is the metric conforming to the + // "db.client.connections.idle.min" semantic conventions. It represents the + // minimum number of idle open connections allowed. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionsIdleMinName = "db.client.connections.idle.min" + DBClientConnectionsIdleMinUnit = "{connection}" + DBClientConnectionsIdleMinDescription = "The minimum number of idle open connections allowed" + + // DBClientConnectionsMax is the metric conforming to the + // "db.client.connections.max" semantic conventions. It represents the maximum + // number of open connections allowed. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionsMaxName = "db.client.connections.max" + DBClientConnectionsMaxUnit = "{connection}" + DBClientConnectionsMaxDescription = "The maximum number of open connections allowed" + + // DBClientConnectionsPendingRequests is the metric conforming to the + // "db.client.connections.pending_requests" semantic conventions. It represents + // the number of pending requests for an open connection, cumulative for the + // entire pool. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + DBClientConnectionsPendingRequestsName = "db.client.connections.pending_requests" + DBClientConnectionsPendingRequestsUnit = "{request}" + DBClientConnectionsPendingRequestsDescription = "The number of pending requests for an open connection, cumulative for the entire pool" + + // DBClientConnectionsTimeouts is the metric conforming to the + // "db.client.connections.timeouts" semantic conventions. It represents the + // number of connection timeouts that have occurred trying to obtain a + // connection from the pool. + // Instrument: counter + // Unit: {timeout} + // Stability: Experimental + DBClientConnectionsTimeoutsName = "db.client.connections.timeouts" + DBClientConnectionsTimeoutsUnit = "{timeout}" + DBClientConnectionsTimeoutsDescription = "The number of connection timeouts that have occurred trying to obtain a connection from the pool" + + // DBClientConnectionsCreateTime is the metric conforming to the + // "db.client.connections.create_time" semantic conventions. It represents the + // time it took to create a new connection. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + DBClientConnectionsCreateTimeName = "db.client.connections.create_time" + DBClientConnectionsCreateTimeUnit = "ms" + DBClientConnectionsCreateTimeDescription = "The time it took to create a new connection" + + // DBClientConnectionsWaitTime is the metric conforming to the + // "db.client.connections.wait_time" semantic conventions. It represents the + // time it took to obtain an open connection from the pool. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + DBClientConnectionsWaitTimeName = "db.client.connections.wait_time" + DBClientConnectionsWaitTimeUnit = "ms" + DBClientConnectionsWaitTimeDescription = "The time it took to obtain an open connection from the pool" + + // DBClientConnectionsUseTime is the metric conforming to the + // "db.client.connections.use_time" semantic conventions. It represents the + // time between borrowing a connection and returning it to the pool. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + DBClientConnectionsUseTimeName = "db.client.connections.use_time" + DBClientConnectionsUseTimeUnit = "ms" + DBClientConnectionsUseTimeDescription = "The time between borrowing a connection and returning it to the pool" + + // AspnetcoreRoutingMatchAttempts is the metric conforming to the + // "aspnetcore.routing.match_attempts" semantic conventions. It represents the + // number of requests that were attempted to be matched to an endpoint. + // Instrument: counter + // Unit: {match_attempt} + // Stability: Experimental + AspnetcoreRoutingMatchAttemptsName = "aspnetcore.routing.match_attempts" + AspnetcoreRoutingMatchAttemptsUnit = "{match_attempt}" + AspnetcoreRoutingMatchAttemptsDescription = "Number of requests that were attempted to be matched to an endpoint." + + // AspnetcoreDiagnosticsExceptions is the metric conforming to the + // "aspnetcore.diagnostics.exceptions" semantic conventions. It represents the + // number of exceptions caught by exception handling middleware. + // Instrument: counter + // Unit: {exception} + // Stability: Experimental + AspnetcoreDiagnosticsExceptionsName = "aspnetcore.diagnostics.exceptions" + AspnetcoreDiagnosticsExceptionsUnit = "{exception}" + AspnetcoreDiagnosticsExceptionsDescription = "Number of exceptions caught by exception handling middleware." + + // AspnetcoreRateLimitingActiveRequestLeases is the metric conforming to the + // "aspnetcore.rate_limiting.active_request_leases" semantic conventions. It + // represents the number of requests that are currently active on the server + // that hold a rate limiting lease. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + AspnetcoreRateLimitingActiveRequestLeasesName = "aspnetcore.rate_limiting.active_request_leases" + AspnetcoreRateLimitingActiveRequestLeasesUnit = "{request}" + AspnetcoreRateLimitingActiveRequestLeasesDescription = "Number of requests that are currently active on the server that hold a rate limiting lease." + + // AspnetcoreRateLimitingRequestLeaseDuration is the metric conforming to the + // "aspnetcore.rate_limiting.request_lease.duration" semantic conventions. It + // represents the duration of rate limiting lease held by requests on the + // server. + // Instrument: histogram + // Unit: s + // Stability: Experimental + AspnetcoreRateLimitingRequestLeaseDurationName = "aspnetcore.rate_limiting.request_lease.duration" + AspnetcoreRateLimitingRequestLeaseDurationUnit = "s" + AspnetcoreRateLimitingRequestLeaseDurationDescription = "The duration of rate limiting lease held by requests on the server." + + // AspnetcoreRateLimitingRequestTimeInQueue is the metric conforming to the + // "aspnetcore.rate_limiting.request.time_in_queue" semantic conventions. It + // represents the time the request spent in a queue waiting to acquire a rate + // limiting lease. + // Instrument: histogram + // Unit: s + // Stability: Experimental + AspnetcoreRateLimitingRequestTimeInQueueName = "aspnetcore.rate_limiting.request.time_in_queue" + AspnetcoreRateLimitingRequestTimeInQueueUnit = "s" + AspnetcoreRateLimitingRequestTimeInQueueDescription = "The time the request spent in a queue waiting to acquire a rate limiting lease." + + // AspnetcoreRateLimitingQueuedRequests is the metric conforming to the + // "aspnetcore.rate_limiting.queued_requests" semantic conventions. It + // represents the number of requests that are currently queued, waiting to + // acquire a rate limiting lease. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + AspnetcoreRateLimitingQueuedRequestsName = "aspnetcore.rate_limiting.queued_requests" + AspnetcoreRateLimitingQueuedRequestsUnit = "{request}" + AspnetcoreRateLimitingQueuedRequestsDescription = "Number of requests that are currently queued, waiting to acquire a rate limiting lease." + + // AspnetcoreRateLimitingRequests is the metric conforming to the + // "aspnetcore.rate_limiting.requests" semantic conventions. It represents the + // number of requests that tried to acquire a rate limiting lease. + // Instrument: counter + // Unit: {request} + // Stability: Experimental + AspnetcoreRateLimitingRequestsName = "aspnetcore.rate_limiting.requests" + AspnetcoreRateLimitingRequestsUnit = "{request}" + AspnetcoreRateLimitingRequestsDescription = "Number of requests that tried to acquire a rate limiting lease." + + // DNSLookupDuration is the metric conforming to the "dns.lookup.duration" + // semantic conventions. It represents the measures the time taken to perform a + // DNS lookup. + // Instrument: histogram + // Unit: s + // Stability: Experimental + DNSLookupDurationName = "dns.lookup.duration" + DNSLookupDurationUnit = "s" + DNSLookupDurationDescription = "Measures the time taken to perform a DNS lookup." + + // HTTPClientOpenConnections is the metric conforming to the + // "http.client.open_connections" semantic conventions. It represents the + // number of outbound HTTP connections that are currently active or idle on the + // client. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + HTTPClientOpenConnectionsName = "http.client.open_connections" + HTTPClientOpenConnectionsUnit = "{connection}" + HTTPClientOpenConnectionsDescription = "Number of outbound HTTP connections that are currently active or idle on the client." + + // HTTPClientConnectionDuration is the metric conforming to the + // "http.client.connection.duration" semantic conventions. It represents the + // duration of the successfully established outbound HTTP connections. + // Instrument: histogram + // Unit: s + // Stability: Experimental + HTTPClientConnectionDurationName = "http.client.connection.duration" + HTTPClientConnectionDurationUnit = "s" + HTTPClientConnectionDurationDescription = "The duration of the successfully established outbound HTTP connections." + + // HTTPClientActiveRequests is the metric conforming to the + // "http.client.active_requests" semantic conventions. It represents the number + // of active HTTP requests. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + HTTPClientActiveRequestsName = "http.client.active_requests" + HTTPClientActiveRequestsUnit = "{request}" + HTTPClientActiveRequestsDescription = "Number of active HTTP requests." + + // HTTPClientRequestTimeInQueue is the metric conforming to the + // "http.client.request.time_in_queue" semantic conventions. It represents the + // amount of time requests spent on a queue waiting for an available + // connection. + // Instrument: histogram + // Unit: s + // Stability: Experimental + HTTPClientRequestTimeInQueueName = "http.client.request.time_in_queue" + HTTPClientRequestTimeInQueueUnit = "s" + HTTPClientRequestTimeInQueueDescription = "The amount of time requests spent on a queue waiting for an available connection." + + // KestrelActiveConnections is the metric conforming to the + // "kestrel.active_connections" semantic conventions. It represents the number + // of connections that are currently active on the server. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + KestrelActiveConnectionsName = "kestrel.active_connections" + KestrelActiveConnectionsUnit = "{connection}" + KestrelActiveConnectionsDescription = "Number of connections that are currently active on the server." + + // KestrelConnectionDuration is the metric conforming to the + // "kestrel.connection.duration" semantic conventions. It represents the + // duration of connections on the server. + // Instrument: histogram + // Unit: s + // Stability: Experimental + KestrelConnectionDurationName = "kestrel.connection.duration" + KestrelConnectionDurationUnit = "s" + KestrelConnectionDurationDescription = "The duration of connections on the server." + + // KestrelRejectedConnections is the metric conforming to the + // "kestrel.rejected_connections" semantic conventions. It represents the + // number of connections rejected by the server. + // Instrument: counter + // Unit: {connection} + // Stability: Experimental + KestrelRejectedConnectionsName = "kestrel.rejected_connections" + KestrelRejectedConnectionsUnit = "{connection}" + KestrelRejectedConnectionsDescription = "Number of connections rejected by the server." + + // KestrelQueuedConnections is the metric conforming to the + // "kestrel.queued_connections" semantic conventions. It represents the number + // of connections that are currently queued and are waiting to start. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + KestrelQueuedConnectionsName = "kestrel.queued_connections" + KestrelQueuedConnectionsUnit = "{connection}" + KestrelQueuedConnectionsDescription = "Number of connections that are currently queued and are waiting to start." + + // KestrelQueuedRequests is the metric conforming to the + // "kestrel.queued_requests" semantic conventions. It represents the number of + // HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are + // currently queued and are waiting to start. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + KestrelQueuedRequestsName = "kestrel.queued_requests" + KestrelQueuedRequestsUnit = "{request}" + KestrelQueuedRequestsDescription = "Number of HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are currently queued and are waiting to start." + + // KestrelUpgradedConnections is the metric conforming to the + // "kestrel.upgraded_connections" semantic conventions. It represents the + // number of connections that are currently upgraded (WebSockets). . + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + KestrelUpgradedConnectionsName = "kestrel.upgraded_connections" + KestrelUpgradedConnectionsUnit = "{connection}" + KestrelUpgradedConnectionsDescription = "Number of connections that are currently upgraded (WebSockets). ." + + // KestrelTLSHandshakeDuration is the metric conforming to the + // "kestrel.tls_handshake.duration" semantic conventions. It represents the + // duration of TLS handshakes on the server. + // Instrument: histogram + // Unit: s + // Stability: Experimental + KestrelTLSHandshakeDurationName = "kestrel.tls_handshake.duration" + KestrelTLSHandshakeDurationUnit = "s" + KestrelTLSHandshakeDurationDescription = "The duration of TLS handshakes on the server." + + // KestrelActiveTLSHandshakes is the metric conforming to the + // "kestrel.active_tls_handshakes" semantic conventions. It represents the + // number of TLS handshakes that are currently in progress on the server. + // Instrument: updowncounter + // Unit: {handshake} + // Stability: Experimental + KestrelActiveTLSHandshakesName = "kestrel.active_tls_handshakes" + KestrelActiveTLSHandshakesUnit = "{handshake}" + KestrelActiveTLSHandshakesDescription = "Number of TLS handshakes that are currently in progress on the server." + + // SignalrServerConnectionDuration is the metric conforming to the + // "signalr.server.connection.duration" semantic conventions. It represents the + // duration of connections on the server. + // Instrument: histogram + // Unit: s + // Stability: Experimental + SignalrServerConnectionDurationName = "signalr.server.connection.duration" + SignalrServerConnectionDurationUnit = "s" + SignalrServerConnectionDurationDescription = "The duration of connections on the server." + + // SignalrServerActiveConnections is the metric conforming to the + // "signalr.server.active_connections" semantic conventions. It represents the + // number of connections that are currently active on the server. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + SignalrServerActiveConnectionsName = "signalr.server.active_connections" + SignalrServerActiveConnectionsUnit = "{connection}" + SignalrServerActiveConnectionsDescription = "Number of connections that are currently active on the server." + + // FaaSInvokeDuration is the metric conforming to the "faas.invoke_duration" + // semantic conventions. It represents the measures the duration of the + // function's logic execution. + // Instrument: histogram + // Unit: s + // Stability: Experimental + FaaSInvokeDurationName = "faas.invoke_duration" + FaaSInvokeDurationUnit = "s" + FaaSInvokeDurationDescription = "Measures the duration of the function's logic execution" + + // FaaSInitDuration is the metric conforming to the "faas.init_duration" + // semantic conventions. It represents the measures the duration of the + // function's initialization, such as a cold start. + // Instrument: histogram + // Unit: s + // Stability: Experimental + FaaSInitDurationName = "faas.init_duration" + FaaSInitDurationUnit = "s" + FaaSInitDurationDescription = "Measures the duration of the function's initialization, such as a cold start" + + // FaaSColdstarts is the metric conforming to the "faas.coldstarts" semantic + // conventions. It represents the number of invocation cold starts. + // Instrument: counter + // Unit: {coldstart} + // Stability: Experimental + FaaSColdstartsName = "faas.coldstarts" + FaaSColdstartsUnit = "{coldstart}" + FaaSColdstartsDescription = "Number of invocation cold starts" + + // FaaSErrors is the metric conforming to the "faas.errors" semantic + // conventions. It represents the number of invocation errors. + // Instrument: counter + // Unit: {error} + // Stability: Experimental + FaaSErrorsName = "faas.errors" + FaaSErrorsUnit = "{error}" + FaaSErrorsDescription = "Number of invocation errors" + + // FaaSInvocations is the metric conforming to the "faas.invocations" semantic + // conventions. It represents the number of successful invocations. + // Instrument: counter + // Unit: {invocation} + // Stability: Experimental + FaaSInvocationsName = "faas.invocations" + FaaSInvocationsUnit = "{invocation}" + FaaSInvocationsDescription = "Number of successful invocations" + + // FaaSTimeouts is the metric conforming to the "faas.timeouts" semantic + // conventions. It represents the number of invocation timeouts. + // Instrument: counter + // Unit: {timeout} + // Stability: Experimental + FaaSTimeoutsName = "faas.timeouts" + FaaSTimeoutsUnit = "{timeout}" + FaaSTimeoutsDescription = "Number of invocation timeouts" + + // FaaSMemUsage is the metric conforming to the "faas.mem_usage" semantic + // conventions. It represents the distribution of max memory usage per + // invocation. + // Instrument: histogram + // Unit: By + // Stability: Experimental + FaaSMemUsageName = "faas.mem_usage" + FaaSMemUsageUnit = "By" + FaaSMemUsageDescription = "Distribution of max memory usage per invocation" + + // FaaSCPUUsage is the metric conforming to the "faas.cpu_usage" semantic + // conventions. It represents the distribution of CPU usage per invocation. + // Instrument: histogram + // Unit: s + // Stability: Experimental + FaaSCPUUsageName = "faas.cpu_usage" + FaaSCPUUsageUnit = "s" + FaaSCPUUsageDescription = "Distribution of CPU usage per invocation" + + // FaaSNetIo is the metric conforming to the "faas.net_io" semantic + // conventions. It represents the distribution of net I/O usage per invocation. + // Instrument: histogram + // Unit: By + // Stability: Experimental + FaaSNetIoName = "faas.net_io" + FaaSNetIoUnit = "By" + FaaSNetIoDescription = "Distribution of net I/O usage per invocation" + + // HTTPServerRequestDuration is the metric conforming to the + // "http.server.request.duration" semantic conventions. It represents the + // duration of HTTP server requests. + // Instrument: histogram + // Unit: s + // Stability: Stable + HTTPServerRequestDurationName = "http.server.request.duration" + HTTPServerRequestDurationUnit = "s" + HTTPServerRequestDurationDescription = "Duration of HTTP server requests." + + // HTTPServerActiveRequests is the metric conforming to the + // "http.server.active_requests" semantic conventions. It represents the number + // of active HTTP server requests. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + HTTPServerActiveRequestsName = "http.server.active_requests" + HTTPServerActiveRequestsUnit = "{request}" + HTTPServerActiveRequestsDescription = "Number of active HTTP server requests." + + // HTTPServerRequestBodySize is the metric conforming to the + // "http.server.request.body.size" semantic conventions. It represents the size + // of HTTP server request bodies. + // Instrument: histogram + // Unit: By + // Stability: Experimental + HTTPServerRequestBodySizeName = "http.server.request.body.size" + HTTPServerRequestBodySizeUnit = "By" + HTTPServerRequestBodySizeDescription = "Size of HTTP server request bodies." + + // HTTPServerResponseBodySize is the metric conforming to the + // "http.server.response.body.size" semantic conventions. It represents the + // size of HTTP server response bodies. + // Instrument: histogram + // Unit: By + // Stability: Experimental + HTTPServerResponseBodySizeName = "http.server.response.body.size" + HTTPServerResponseBodySizeUnit = "By" + HTTPServerResponseBodySizeDescription = "Size of HTTP server response bodies." + + // HTTPClientRequestDuration is the metric conforming to the + // "http.client.request.duration" semantic conventions. It represents the + // duration of HTTP client requests. + // Instrument: histogram + // Unit: s + // Stability: Stable + HTTPClientRequestDurationName = "http.client.request.duration" + HTTPClientRequestDurationUnit = "s" + HTTPClientRequestDurationDescription = "Duration of HTTP client requests." + + // HTTPClientRequestBodySize is the metric conforming to the + // "http.client.request.body.size" semantic conventions. It represents the size + // of HTTP client request bodies. + // Instrument: histogram + // Unit: By + // Stability: Experimental + HTTPClientRequestBodySizeName = "http.client.request.body.size" + HTTPClientRequestBodySizeUnit = "By" + HTTPClientRequestBodySizeDescription = "Size of HTTP client request bodies." + + // HTTPClientResponseBodySize is the metric conforming to the + // "http.client.response.body.size" semantic conventions. It represents the + // size of HTTP client response bodies. + // Instrument: histogram + // Unit: By + // Stability: Experimental + HTTPClientResponseBodySizeName = "http.client.response.body.size" + HTTPClientResponseBodySizeUnit = "By" + HTTPClientResponseBodySizeDescription = "Size of HTTP client response bodies." + + // JvmMemoryInit is the metric conforming to the "jvm.memory.init" semantic + // conventions. It represents the measure of initial memory requested. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + JvmMemoryInitName = "jvm.memory.init" + JvmMemoryInitUnit = "By" + JvmMemoryInitDescription = "Measure of initial memory requested." + + // JvmSystemCPUUtilization is the metric conforming to the + // "jvm.system.cpu.utilization" semantic conventions. It represents the recent + // CPU utilization for the whole system as reported by the JVM. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + JvmSystemCPUUtilizationName = "jvm.system.cpu.utilization" + JvmSystemCPUUtilizationUnit = "1" + JvmSystemCPUUtilizationDescription = "Recent CPU utilization for the whole system as reported by the JVM." + + // JvmSystemCPULoad1m is the metric conforming to the "jvm.system.cpu.load_1m" + // semantic conventions. It represents the average CPU load of the whole system + // for the last minute as reported by the JVM. + // Instrument: gauge + // Unit: {run_queue_item} + // Stability: Experimental + JvmSystemCPULoad1mName = "jvm.system.cpu.load_1m" + JvmSystemCPULoad1mUnit = "{run_queue_item}" + JvmSystemCPULoad1mDescription = "Average CPU load of the whole system for the last minute as reported by the JVM." + + // JvmBufferMemoryUsage is the metric conforming to the + // "jvm.buffer.memory.usage" semantic conventions. It represents the measure of + // memory used by buffers. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + JvmBufferMemoryUsageName = "jvm.buffer.memory.usage" + JvmBufferMemoryUsageUnit = "By" + JvmBufferMemoryUsageDescription = "Measure of memory used by buffers." + + // JvmBufferMemoryLimit is the metric conforming to the + // "jvm.buffer.memory.limit" semantic conventions. It represents the measure of + // total memory capacity of buffers. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + JvmBufferMemoryLimitName = "jvm.buffer.memory.limit" + JvmBufferMemoryLimitUnit = "By" + JvmBufferMemoryLimitDescription = "Measure of total memory capacity of buffers." + + // JvmBufferCount is the metric conforming to the "jvm.buffer.count" semantic + // conventions. It represents the number of buffers in the pool. + // Instrument: updowncounter + // Unit: {buffer} + // Stability: Experimental + JvmBufferCountName = "jvm.buffer.count" + JvmBufferCountUnit = "{buffer}" + JvmBufferCountDescription = "Number of buffers in the pool." + + // JvmMemoryUsed is the metric conforming to the "jvm.memory.used" semantic + // conventions. It represents the measure of memory used. + // Instrument: updowncounter + // Unit: By + // Stability: Stable + JvmMemoryUsedName = "jvm.memory.used" + JvmMemoryUsedUnit = "By" + JvmMemoryUsedDescription = "Measure of memory used." + + // JvmMemoryCommitted is the metric conforming to the "jvm.memory.committed" + // semantic conventions. It represents the measure of memory committed. + // Instrument: updowncounter + // Unit: By + // Stability: Stable + JvmMemoryCommittedName = "jvm.memory.committed" + JvmMemoryCommittedUnit = "By" + JvmMemoryCommittedDescription = "Measure of memory committed." + + // JvmMemoryLimit is the metric conforming to the "jvm.memory.limit" semantic + // conventions. It represents the measure of max obtainable memory. + // Instrument: updowncounter + // Unit: By + // Stability: Stable + JvmMemoryLimitName = "jvm.memory.limit" + JvmMemoryLimitUnit = "By" + JvmMemoryLimitDescription = "Measure of max obtainable memory." + + // JvmMemoryUsedAfterLastGc is the metric conforming to the + // "jvm.memory.used_after_last_gc" semantic conventions. It represents the + // measure of memory used, as measured after the most recent garbage collection + // event on this pool. + // Instrument: updowncounter + // Unit: By + // Stability: Stable + JvmMemoryUsedAfterLastGcName = "jvm.memory.used_after_last_gc" + JvmMemoryUsedAfterLastGcUnit = "By" + JvmMemoryUsedAfterLastGcDescription = "Measure of memory used, as measured after the most recent garbage collection event on this pool." + + // JvmGcDuration is the metric conforming to the "jvm.gc.duration" semantic + // conventions. It represents the duration of JVM garbage collection actions. + // Instrument: histogram + // Unit: s + // Stability: Stable + JvmGcDurationName = "jvm.gc.duration" + JvmGcDurationUnit = "s" + JvmGcDurationDescription = "Duration of JVM garbage collection actions." + + // JvmThreadCount is the metric conforming to the "jvm.thread.count" semantic + // conventions. It represents the number of executing platform threads. + // Instrument: updowncounter + // Unit: {thread} + // Stability: Stable + JvmThreadCountName = "jvm.thread.count" + JvmThreadCountUnit = "{thread}" + JvmThreadCountDescription = "Number of executing platform threads." + + // JvmClassLoaded is the metric conforming to the "jvm.class.loaded" semantic + // conventions. It represents the number of classes loaded since JVM start. + // Instrument: counter + // Unit: {class} + // Stability: Stable + JvmClassLoadedName = "jvm.class.loaded" + JvmClassLoadedUnit = "{class}" + JvmClassLoadedDescription = "Number of classes loaded since JVM start." + + // JvmClassUnloaded is the metric conforming to the "jvm.class.unloaded" + // semantic conventions. It represents the number of classes unloaded since JVM + // start. + // Instrument: counter + // Unit: {class} + // Stability: Stable + JvmClassUnloadedName = "jvm.class.unloaded" + JvmClassUnloadedUnit = "{class}" + JvmClassUnloadedDescription = "Number of classes unloaded since JVM start." + + // JvmClassCount is the metric conforming to the "jvm.class.count" semantic + // conventions. It represents the number of classes currently loaded. + // Instrument: updowncounter + // Unit: {class} + // Stability: Stable + JvmClassCountName = "jvm.class.count" + JvmClassCountUnit = "{class}" + JvmClassCountDescription = "Number of classes currently loaded." + + // JvmCPUCount is the metric conforming to the "jvm.cpu.count" semantic + // conventions. It represents the number of processors available to the Java + // virtual machine. + // Instrument: updowncounter + // Unit: {cpu} + // Stability: Stable + JvmCPUCountName = "jvm.cpu.count" + JvmCPUCountUnit = "{cpu}" + JvmCPUCountDescription = "Number of processors available to the Java virtual machine." + + // JvmCPUTime is the metric conforming to the "jvm.cpu.time" semantic + // conventions. It represents the cPU time used by the process as reported by + // the JVM. + // Instrument: counter + // Unit: s + // Stability: Stable + JvmCPUTimeName = "jvm.cpu.time" + JvmCPUTimeUnit = "s" + JvmCPUTimeDescription = "CPU time used by the process as reported by the JVM." + + // JvmCPURecentUtilization is the metric conforming to the + // "jvm.cpu.recent_utilization" semantic conventions. It represents the recent + // CPU utilization for the process as reported by the JVM. + // Instrument: gauge + // Unit: 1 + // Stability: Stable + JvmCPURecentUtilizationName = "jvm.cpu.recent_utilization" + JvmCPURecentUtilizationUnit = "1" + JvmCPURecentUtilizationDescription = "Recent CPU utilization for the process as reported by the JVM." + + // MessagingPublishDuration is the metric conforming to the + // "messaging.publish.duration" semantic conventions. It represents the + // measures the duration of publish operation. + // Instrument: histogram + // Unit: s + // Stability: Experimental + MessagingPublishDurationName = "messaging.publish.duration" + MessagingPublishDurationUnit = "s" + MessagingPublishDurationDescription = "Measures the duration of publish operation." + + // MessagingReceiveDuration is the metric conforming to the + // "messaging.receive.duration" semantic conventions. It represents the + // measures the duration of receive operation. + // Instrument: histogram + // Unit: s + // Stability: Experimental + MessagingReceiveDurationName = "messaging.receive.duration" + MessagingReceiveDurationUnit = "s" + MessagingReceiveDurationDescription = "Measures the duration of receive operation." + + // MessagingDeliverDuration is the metric conforming to the + // "messaging.deliver.duration" semantic conventions. It represents the + // measures the duration of deliver operation. + // Instrument: histogram + // Unit: s + // Stability: Experimental + MessagingDeliverDurationName = "messaging.deliver.duration" + MessagingDeliverDurationUnit = "s" + MessagingDeliverDurationDescription = "Measures the duration of deliver operation." + + // MessagingPublishMessages is the metric conforming to the + // "messaging.publish.messages" semantic conventions. It represents the + // measures the number of published messages. + // Instrument: counter + // Unit: {message} + // Stability: Experimental + MessagingPublishMessagesName = "messaging.publish.messages" + MessagingPublishMessagesUnit = "{message}" + MessagingPublishMessagesDescription = "Measures the number of published messages." + + // MessagingReceiveMessages is the metric conforming to the + // "messaging.receive.messages" semantic conventions. It represents the + // measures the number of received messages. + // Instrument: counter + // Unit: {message} + // Stability: Experimental + MessagingReceiveMessagesName = "messaging.receive.messages" + MessagingReceiveMessagesUnit = "{message}" + MessagingReceiveMessagesDescription = "Measures the number of received messages." + + // MessagingDeliverMessages is the metric conforming to the + // "messaging.deliver.messages" semantic conventions. It represents the + // measures the number of delivered messages. + // Instrument: counter + // Unit: {message} + // Stability: Experimental + MessagingDeliverMessagesName = "messaging.deliver.messages" + MessagingDeliverMessagesUnit = "{message}" + MessagingDeliverMessagesDescription = "Measures the number of delivered messages." + + // RPCServerDuration is the metric conforming to the "rpc.server.duration" + // semantic conventions. It represents the measures the duration of inbound + // RPC. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + RPCServerDurationName = "rpc.server.duration" + RPCServerDurationUnit = "ms" + RPCServerDurationDescription = "Measures the duration of inbound RPC." + + // RPCServerRequestSize is the metric conforming to the + // "rpc.server.request.size" semantic conventions. It represents the measures + // the size of RPC request messages (uncompressed). + // Instrument: histogram + // Unit: By + // Stability: Experimental + RPCServerRequestSizeName = "rpc.server.request.size" + RPCServerRequestSizeUnit = "By" + RPCServerRequestSizeDescription = "Measures the size of RPC request messages (uncompressed)." + + // RPCServerResponseSize is the metric conforming to the + // "rpc.server.response.size" semantic conventions. It represents the measures + // the size of RPC response messages (uncompressed). + // Instrument: histogram + // Unit: By + // Stability: Experimental + RPCServerResponseSizeName = "rpc.server.response.size" + RPCServerResponseSizeUnit = "By" + RPCServerResponseSizeDescription = "Measures the size of RPC response messages (uncompressed)." + + // RPCServerRequestsPerRPC is the metric conforming to the + // "rpc.server.requests_per_rpc" semantic conventions. It represents the + // measures the number of messages received per RPC. + // Instrument: histogram + // Unit: {count} + // Stability: Experimental + RPCServerRequestsPerRPCName = "rpc.server.requests_per_rpc" + RPCServerRequestsPerRPCUnit = "{count}" + RPCServerRequestsPerRPCDescription = "Measures the number of messages received per RPC." + + // RPCServerResponsesPerRPC is the metric conforming to the + // "rpc.server.responses_per_rpc" semantic conventions. It represents the + // measures the number of messages sent per RPC. + // Instrument: histogram + // Unit: {count} + // Stability: Experimental + RPCServerResponsesPerRPCName = "rpc.server.responses_per_rpc" + RPCServerResponsesPerRPCUnit = "{count}" + RPCServerResponsesPerRPCDescription = "Measures the number of messages sent per RPC." + + // RPCClientDuration is the metric conforming to the "rpc.client.duration" + // semantic conventions. It represents the measures the duration of outbound + // RPC. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + RPCClientDurationName = "rpc.client.duration" + RPCClientDurationUnit = "ms" + RPCClientDurationDescription = "Measures the duration of outbound RPC." + + // RPCClientRequestSize is the metric conforming to the + // "rpc.client.request.size" semantic conventions. It represents the measures + // the size of RPC request messages (uncompressed). + // Instrument: histogram + // Unit: By + // Stability: Experimental + RPCClientRequestSizeName = "rpc.client.request.size" + RPCClientRequestSizeUnit = "By" + RPCClientRequestSizeDescription = "Measures the size of RPC request messages (uncompressed)." + + // RPCClientResponseSize is the metric conforming to the + // "rpc.client.response.size" semantic conventions. It represents the measures + // the size of RPC response messages (uncompressed). + // Instrument: histogram + // Unit: By + // Stability: Experimental + RPCClientResponseSizeName = "rpc.client.response.size" + RPCClientResponseSizeUnit = "By" + RPCClientResponseSizeDescription = "Measures the size of RPC response messages (uncompressed)." + + // RPCClientRequestsPerRPC is the metric conforming to the + // "rpc.client.requests_per_rpc" semantic conventions. It represents the + // measures the number of messages received per RPC. + // Instrument: histogram + // Unit: {count} + // Stability: Experimental + RPCClientRequestsPerRPCName = "rpc.client.requests_per_rpc" + RPCClientRequestsPerRPCUnit = "{count}" + RPCClientRequestsPerRPCDescription = "Measures the number of messages received per RPC." + + // RPCClientResponsesPerRPC is the metric conforming to the + // "rpc.client.responses_per_rpc" semantic conventions. It represents the + // measures the number of messages sent per RPC. + // Instrument: histogram + // Unit: {count} + // Stability: Experimental + RPCClientResponsesPerRPCName = "rpc.client.responses_per_rpc" + RPCClientResponsesPerRPCUnit = "{count}" + RPCClientResponsesPerRPCDescription = "Measures the number of messages sent per RPC." + + // SystemCPUTime is the metric conforming to the "system.cpu.time" semantic + // conventions. It represents the seconds each logical CPU spent on each mode. + // Instrument: counter + // Unit: s + // Stability: Experimental + SystemCPUTimeName = "system.cpu.time" + SystemCPUTimeUnit = "s" + SystemCPUTimeDescription = "Seconds each logical CPU spent on each mode" + + // SystemCPUUtilization is the metric conforming to the + // "system.cpu.utilization" semantic conventions. It represents the difference + // in system.cpu.time since the last measurement, divided by the elapsed time + // and number of logical CPUs. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + SystemCPUUtilizationName = "system.cpu.utilization" + SystemCPUUtilizationUnit = "1" + SystemCPUUtilizationDescription = "Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs" + + // SystemCPUFrequency is the metric conforming to the "system.cpu.frequency" + // semantic conventions. It represents the reports the current frequency of the + // CPU in Hz. + // Instrument: gauge + // Unit: {Hz} + // Stability: Experimental + SystemCPUFrequencyName = "system.cpu.frequency" + SystemCPUFrequencyUnit = "{Hz}" + SystemCPUFrequencyDescription = "Reports the current frequency of the CPU in Hz" + + // SystemCPUPhysicalCount is the metric conforming to the + // "system.cpu.physical.count" semantic conventions. It represents the reports + // the number of actual physical processor cores on the hardware. + // Instrument: updowncounter + // Unit: {cpu} + // Stability: Experimental + SystemCPUPhysicalCountName = "system.cpu.physical.count" + SystemCPUPhysicalCountUnit = "{cpu}" + SystemCPUPhysicalCountDescription = "Reports the number of actual physical processor cores on the hardware" + + // SystemCPULogicalCount is the metric conforming to the + // "system.cpu.logical.count" semantic conventions. It represents the reports + // the number of logical (virtual) processor cores created by the operating + // system to manage multitasking. + // Instrument: updowncounter + // Unit: {cpu} + // Stability: Experimental + SystemCPULogicalCountName = "system.cpu.logical.count" + SystemCPULogicalCountUnit = "{cpu}" + SystemCPULogicalCountDescription = "Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking" + + // SystemMemoryUsage is the metric conforming to the "system.memory.usage" + // semantic conventions. It represents the reports memory in use by state. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemMemoryUsageName = "system.memory.usage" + SystemMemoryUsageUnit = "By" + SystemMemoryUsageDescription = "Reports memory in use by state." + + // SystemMemoryLimit is the metric conforming to the "system.memory.limit" + // semantic conventions. It represents the total memory available in the + // system. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemMemoryLimitName = "system.memory.limit" + SystemMemoryLimitUnit = "By" + SystemMemoryLimitDescription = "Total memory available in the system." + + // SystemMemoryUtilization is the metric conforming to the + // "system.memory.utilization" semantic conventions. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemMemoryUtilizationName = "system.memory.utilization" + SystemMemoryUtilizationUnit = "1" + + // SystemPagingUsage is the metric conforming to the "system.paging.usage" + // semantic conventions. It represents the unix swap or windows pagefile usage. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemPagingUsageName = "system.paging.usage" + SystemPagingUsageUnit = "By" + SystemPagingUsageDescription = "Unix swap or windows pagefile usage" + + // SystemPagingUtilization is the metric conforming to the + // "system.paging.utilization" semantic conventions. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemPagingUtilizationName = "system.paging.utilization" + SystemPagingUtilizationUnit = "1" + + // SystemPagingFaults is the metric conforming to the "system.paging.faults" + // semantic conventions. + // Instrument: counter + // Unit: {fault} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemPagingFaultsName = "system.paging.faults" + SystemPagingFaultsUnit = "{fault}" + + // SystemPagingOperations is the metric conforming to the + // "system.paging.operations" semantic conventions. + // Instrument: counter + // Unit: {operation} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemPagingOperationsName = "system.paging.operations" + SystemPagingOperationsUnit = "{operation}" + + // SystemDiskIo is the metric conforming to the "system.disk.io" semantic + // conventions. + // Instrument: counter + // Unit: By + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemDiskIoName = "system.disk.io" + SystemDiskIoUnit = "By" + + // SystemDiskOperations is the metric conforming to the + // "system.disk.operations" semantic conventions. + // Instrument: counter + // Unit: {operation} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemDiskOperationsName = "system.disk.operations" + SystemDiskOperationsUnit = "{operation}" + + // SystemDiskIoTime is the metric conforming to the "system.disk.io_time" + // semantic conventions. It represents the time disk spent activated. + // Instrument: counter + // Unit: s + // Stability: Experimental + SystemDiskIoTimeName = "system.disk.io_time" + SystemDiskIoTimeUnit = "s" + SystemDiskIoTimeDescription = "Time disk spent activated" + + // SystemDiskOperationTime is the metric conforming to the + // "system.disk.operation_time" semantic conventions. It represents the sum of + // the time each operation took to complete. + // Instrument: counter + // Unit: s + // Stability: Experimental + SystemDiskOperationTimeName = "system.disk.operation_time" + SystemDiskOperationTimeUnit = "s" + SystemDiskOperationTimeDescription = "Sum of the time each operation took to complete" + + // SystemDiskMerged is the metric conforming to the "system.disk.merged" + // semantic conventions. + // Instrument: counter + // Unit: {operation} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemDiskMergedName = "system.disk.merged" + SystemDiskMergedUnit = "{operation}" + + // SystemFilesystemUsage is the metric conforming to the + // "system.filesystem.usage" semantic conventions. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemFilesystemUsageName = "system.filesystem.usage" + SystemFilesystemUsageUnit = "By" + + // SystemFilesystemUtilization is the metric conforming to the + // "system.filesystem.utilization" semantic conventions. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemFilesystemUtilizationName = "system.filesystem.utilization" + SystemFilesystemUtilizationUnit = "1" + + // SystemNetworkDropped is the metric conforming to the + // "system.network.dropped" semantic conventions. It represents the count of + // packets that are dropped or discarded even though there was no error. + // Instrument: counter + // Unit: {packet} + // Stability: Experimental + SystemNetworkDroppedName = "system.network.dropped" + SystemNetworkDroppedUnit = "{packet}" + SystemNetworkDroppedDescription = "Count of packets that are dropped or discarded even though there was no error" + + // SystemNetworkPackets is the metric conforming to the + // "system.network.packets" semantic conventions. + // Instrument: counter + // Unit: {packet} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemNetworkPacketsName = "system.network.packets" + SystemNetworkPacketsUnit = "{packet}" + + // SystemNetworkErrors is the metric conforming to the "system.network.errors" + // semantic conventions. It represents the count of network errors detected. + // Instrument: counter + // Unit: {error} + // Stability: Experimental + SystemNetworkErrorsName = "system.network.errors" + SystemNetworkErrorsUnit = "{error}" + SystemNetworkErrorsDescription = "Count of network errors detected" + + // SystemNetworkIo is the metric conforming to the "system.network.io" semantic + // conventions. + // Instrument: counter + // Unit: By + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemNetworkIoName = "system.network.io" + SystemNetworkIoUnit = "By" + + // SystemNetworkConnections is the metric conforming to the + // "system.network.connections" semantic conventions. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemNetworkConnectionsName = "system.network.connections" + SystemNetworkConnectionsUnit = "{connection}" + + // SystemProcessesCount is the metric conforming to the + // "system.processes.count" semantic conventions. It represents the total + // number of processes in each state. + // Instrument: updowncounter + // Unit: {process} + // Stability: Experimental + SystemProcessesCountName = "system.processes.count" + SystemProcessesCountUnit = "{process}" + SystemProcessesCountDescription = "Total number of processes in each state" + + // SystemProcessesCreated is the metric conforming to the + // "system.processes.created" semantic conventions. It represents the total + // number of processes created over uptime of the host. + // Instrument: counter + // Unit: {process} + // Stability: Experimental + SystemProcessesCreatedName = "system.processes.created" + SystemProcessesCreatedUnit = "{process}" + SystemProcessesCreatedDescription = "Total number of processes created over uptime of the host" + + // SystemLinuxMemoryAvailable is the metric conforming to the + // "system.linux.memory.available" semantic conventions. It represents an + // estimate of how much memory is available for starting new applications, + // without causing swapping. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemLinuxMemoryAvailableName = "system.linux.memory.available" + SystemLinuxMemoryAvailableUnit = "By" + SystemLinuxMemoryAvailableDescription = "An estimate of how much memory is available for starting new applications, without causing swapping" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/resource.go new file mode 100644 index 000000000..d66bbe9c2 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/resource.go @@ -0,0 +1,2545 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +import "go.opentelemetry.io/otel/attribute" + +// A cloud environment (e.g. GCP, Azure, AWS). +const ( + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") + + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Bare Metal Solution (BMS) + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on +// Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// A container instance. +const ( + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used + // to run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol' + // Note: If using embedded credentials or sensitive data, it is recommended + // to remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. [2] + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol, --config, config.yaml' + ContainerCommandArgsKey = attribute.Key("container.command_args") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full + // command run by the container as a single string representing the full + // command. [2] + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol --config config.yaml' + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime + // specific image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect + // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) + // endpoint. + // K8S defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io + // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. + // The ID is assinged by the container runtime and can vary in different + // environments. Consider using `oci.manifest.digest` if it is important to + // identify the same image in different environments/runtimes. + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageRepoDigestsKey is the attribute Key conforming to the + // "container.image.repo_digests" semantic conventions. It represents the + // repo digests of the container image as provided by the container + // runtime. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb', + // 'internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578' + // Note: + // [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) + // and + // [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) + // report those under the `RepoDigests` field. + ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") + + // ContainerImageTagsKey is the attribute Key conforming to the + // "container.image.tags" semantic conventions. It represents the container + // image tags. An example can be found in [Docker Image + // Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). + // Should be only the `` section of the full name for example from + // `registry.example.com/my-org/my-image:`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'v1.27.1', '3.5.7-0' + ContainerImageTagsKey = attribute.Key("container.image.tags") + + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") +) + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. [2] +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full +// command run by the container as a single string representing the full +// command. [2] +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime +// specific image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageRepoDigests returns an attribute KeyValue conforming to the +// "container.image.repo_digests" semantic conventions. It represents the repo +// digests of the container image as provided by the container runtime. +func ContainerImageRepoDigests(val ...string) attribute.KeyValue { + return ContainerImageRepoDigestsKey.StringSlice(val) +} + +// ContainerImageTags returns an attribute KeyValue conforming to the +// "container.image.tags" semantic conventions. It represents the container +// image tags. An example can be found in [Docker Image +// Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). +// Should be only the `` section of the full name for example from +// `registry.example.com/my-org/my-image:`. +func ContainerImageTags(val ...string) attribute.KeyValue { + return ContainerImageTagsKey.StringSlice(val) +} + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// Describes device attributes. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine-readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human-readable version of + // the device model rather than a machine-readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// A host is defined as a computing instance. For example, physical servers, +// virtual machines, switches or disk array. +const ( + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + HostArchKey = attribute.Key("host.arch") + + // HostCPUCacheL2SizeKey is the attribute Key conforming to the + // "host.cpu.cache.l2.size" semantic conventions. It represents the amount + // of level 2 memory cache available to the processor (in Bytes). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 12288000 + HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") + + // HostCPUFamilyKey is the attribute Key conforming to the + // "host.cpu.family" semantic conventions. It represents the family or + // generation of the CPU. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '6', 'PA-RISC 1.1e' + HostCPUFamilyKey = attribute.Key("host.cpu.family") + + // HostCPUModelIDKey is the attribute Key conforming to the + // "host.cpu.model.id" semantic conventions. It represents the model + // identifier. It provides more granular information about the CPU, + // distinguishing it from other CPUs within the same family. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '6', '9000/778/B180L' + HostCPUModelIDKey = attribute.Key("host.cpu.model.id") + + // HostCPUModelNameKey is the attribute Key conforming to the + // "host.cpu.model.name" semantic conventions. It represents the model + // designation of the processor. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz' + HostCPUModelNameKey = attribute.Key("host.cpu.model.name") + + // HostCPUSteppingKey is the attribute Key conforming to the + // "host.cpu.stepping" semantic conventions. It represents the stepping or + // core revisions. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + HostCPUSteppingKey = attribute.Key("host.cpu.stepping") + + // HostCPUVendorIDKey is the attribute Key conforming to the + // "host.cpu.vendor.id" semantic conventions. It represents the processor + // manufacturer identifier. A maximum 12-character string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'GenuineIntel' + // Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor + // ID string in EBX, EDX and ECX registers. Writing these to memory in this + // order results in a 12-character string. + HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") + + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID or host OS image ID. + // For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image or host OS as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") + + // HostIPKey is the attribute Key conforming to the "host.ip" semantic + // conventions. It represents the available IP addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '192.168.1.140', 'fe80::abc2:4a28:737a:609e' + // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 + // addresses MUST be specified in the [RFC + // 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format. + HostIPKey = attribute.Key("host.ip") + + // HostMacKey is the attribute Key conforming to the "host.mac" semantic + // conventions. It represents the available MAC addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AC-DE-48-23-45-67', 'AC-DE-48-23-45-67-01-9F' + // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal + // form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): + // as hyphen-separated octets in uppercase hexadecimal form from most to + // least significant. + HostMacKey = attribute.Key("host.mac") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostCPUCacheL2Size returns an attribute KeyValue conforming to the +// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of +// level 2 memory cache available to the processor (in Bytes). +func HostCPUCacheL2Size(val int) attribute.KeyValue { + return HostCPUCacheL2SizeKey.Int(val) +} + +// HostCPUFamily returns an attribute KeyValue conforming to the +// "host.cpu.family" semantic conventions. It represents the family or +// generation of the CPU. +func HostCPUFamily(val string) attribute.KeyValue { + return HostCPUFamilyKey.String(val) +} + +// HostCPUModelID returns an attribute KeyValue conforming to the +// "host.cpu.model.id" semantic conventions. It represents the model +// identifier. It provides more granular information about the CPU, +// distinguishing it from other CPUs within the same family. +func HostCPUModelID(val string) attribute.KeyValue { + return HostCPUModelIDKey.String(val) +} + +// HostCPUModelName returns an attribute KeyValue conforming to the +// "host.cpu.model.name" semantic conventions. It represents the model +// designation of the processor. +func HostCPUModelName(val string) attribute.KeyValue { + return HostCPUModelNameKey.String(val) +} + +// HostCPUStepping returns an attribute KeyValue conforming to the +// "host.cpu.stepping" semantic conventions. It represents the stepping or core +// revisions. +func HostCPUStepping(val int) attribute.KeyValue { + return HostCPUSteppingKey.Int(val) +} + +// HostCPUVendorID returns an attribute KeyValue conforming to the +// "host.cpu.vendor.id" semantic conventions. It represents the processor +// manufacturer identifier. A maximum 12-character string. +func HostCPUVendorID(val string) attribute.KeyValue { + return HostCPUVendorIDKey.String(val) +} + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID or host +// OS image ID. For Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image or host OS as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic +// conventions. It represents the available IP addresses of the host, excluding +// loopback interfaces. +func HostIP(val ...string) attribute.KeyValue { + return HostIPKey.StringSlice(val) +} + +// HostMac returns an attribute KeyValue conforming to the "host.mac" +// semantic conventions. It represents the available MAC addresses of the host, +// excluding loopback interfaces. +func HostMac(val ...string) attribute.KeyValue { + return HostMacKey.StringSlice(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// Kubernetes resource attributes. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the + // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for + // the cluster, set to the UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' + // Note: K8S doesn't have support for obtaining a cluster ID. If this is + // ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8S cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8S ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T + // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // different from all other UUIDs generated before 3603 A.D., or is + // extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") + + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") + + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") + + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") + + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") + + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") + + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") + + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") + + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") + + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// An OCI image manifest. +const ( + // OciManifestDigestKey is the attribute Key conforming to the + // "oci.manifest.digest" semantic conventions. It represents the digest of + // the OCI image manifest. For container images specifically is the digest + // by which the container image is known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4' + // Note: Follows [OCI Image Manifest + // Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), + // and specifically the [Digest + // property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). + // An example can be found in [Example Image + // Manifest](https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest). + OciManifestDigestKey = attribute.Key("oci.manifest.digest") +) + +// OciManifestDigest returns an attribute KeyValue conforming to the +// "oci.manifest.digest" semantic conventions. It represents the digest of the +// OCI image manifest. For container images specifically is the digest by which +// the container image is known. +func OciManifestDigest(val string) attribute.KeyValue { + return OciManifestDigestKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSBuildIDKey is the attribute Key conforming to the "os.build_id" + // semantic conventions. It represents the unique identifier for a + // particular build or compilation of the operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TQ3C.230805.001.B2', '20E247', '22621' + OSBuildIDKey = attribute.Key("os.build_id") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + OSTypeKey = attribute.Key("os.type") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the operating system. +func OSBuildID(val string) attribute.KeyValue { + return OSBuildIDKey.String(val) +} + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PPID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") + + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") +) + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PPID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// The Android platform on which the Android application is running. +const ( + // AndroidOSAPILevelKey is the attribute Key conforming to the + // "android.os.api_level" semantic conventions. It represents the uniquely + // identifies the framework API revision offered by a version + // (`os.version`) of the android operating system. More information can be + // found + // [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '33', '32' + AndroidOSAPILevelKey = attribute.Key("android.os.api_level") +) + +// AndroidOSAPILevel returns an attribute KeyValue conforming to the +// "android.os.api_level" semantic conventions. It represents the uniquely +// identifies the framework API revision offered by a version (`os.version`) of +// the android operating system. More information can be found +// [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). +func AndroidOSAPILevel(val string) attribute.KeyValue { + return AndroidOSAPILevelKey.String(val) +} + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") +) + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// Resource used by Google Cloud Run. +const ( + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the + // name of the Cloud Run + // [execution](https://cloud.google.com/run/docs/managing/job-executions) + // being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'job-name-xxxx', 'sample-job-mdw84' + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the + // index for a task within an execution as provided by the + // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1 + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") +) + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name +// of the Cloud Run +// [execution](https://cloud.google.com/run/docs/managing/job-executions) being +// run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the +// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// Resources used by Google Compute Engine (GCE). +const ( + // GCPGceInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the + // hostname of a GCE instance. This is the full value of the default or + // [custom + // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-host1234.example.com', + // 'sample-vm.us-west1-b.c.my-project.internal' + GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") + + // GCPGceInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance + // name of a GCE instance. This is the value provided by `host.name`, the + // visible name of the instance in the Cloud Console UI, and the prefix for + // the default hostname of the instance as defined by the [default internal + // DNS + // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-1', 'my-vm-name' + GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") +) + +// GCPGceInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom +// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). +func GCPGceInstanceHostname(val string) attribute.KeyValue { + return GCPGceInstanceHostnameKey.String(val) +} + +// GCPGceInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance +// name of a GCE instance. This is the value provided by `host.name`, the +// visible name of the instance in the Cloud Console UI, and the prefix for the +// default hostname of the instance as defined by the [default internal DNS +// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). +func GCPGceInstanceName(val string) attribute.KeyValue { + return GCPGceInstanceNameKey.String(val) +} + +// Heroku dyno metadata +const ( + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") +) + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'staging', 'production' + // Note: `deployment.environment` does not affect the uniqueness + // constraints defined through + // the `service.namespace`, `service.name` and `service.instance.id` + // resource attributes. + // This implies that resources carrying the following attribute + // combinations MUST be + // considered to be identifying the same service: + // + // * `service.name=frontend`, `deployment.environment=production` + // * `service.name=frontend`, `deployment.environment=staging`. + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment environment](https://wikipedia.org/wiki/Deployment_environment) +// (aka deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// A serverless instance. +const ( + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") + + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run (Services):** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") +) + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. The format is not defined by these + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0.0', 'a01dbef8a' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") +) + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'opentelemetry' + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute + // to `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is + // used, this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module + // name of this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this + // case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryDistroNameKey is the attribute Key conforming to the + // "telemetry.distro.name" semantic conventions. It represents the name of + // the auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'parts-unlimited-java' + // Note: Official auto instrumentation agents and distributions SHOULD set + // the `telemetry.distro.name` attribute to + // a string starting with `opentelemetry-`, e.g. + // `opentelemetry-java-instrumentation`. + TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") + + // TelemetryDistroVersionKey is the attribute Key conforming to the + // "telemetry.distro.version" semantic conventions. It represents the + // version string of the auto instrumentation agent or distribution, if + // used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2.3' + TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") +) + +// TelemetryDistroName returns an attribute KeyValue conforming to the +// "telemetry.distro.name" semantic conventions. It represents the name of the +// auto instrumentation agent or distribution, if used. +func TelemetryDistroName(val string) attribute.KeyValue { + return TelemetryDistroNameKey.String(val) +} + +// TelemetryDistroVersion returns an attribute KeyValue conforming to the +// "telemetry.distro.version" semantic conventions. It represents the version +// string of the auto instrumentation agent or distribution, if used. +func TelemetryDistroVersion(val string) attribute.KeyValue { + return TelemetryDistroVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") + + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") +) + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + // Deprecated: use the `otel.scope.name` attribute. + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + // Deprecated: use the `otel.scope.version` attribute. + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. +// +// Deprecated: use the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. +// +// Deprecated: use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/schema.go new file mode 100644 index 000000000..fe80b1731 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/schema.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.24.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/trace.go new file mode 100644 index 000000000..c1718234e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.24.0/trace.go @@ -0,0 +1,1323 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +import "go.opentelemetry.io/otel/attribute" + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](/docs/resource/README.md#service) of the remote + // service. SHOULD be equal to the actual `service.name` resource attribute + // of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](/docs/resource/README.md#service) of the remote service. +// SHOULD be equal to the actual `service.name` resource attribute of the +// remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeStacktraceKey is the attribute Key conforming to the + // "code.stacktrace" semantic conventions. It represents a stacktrace as a + // string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'at + // com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + CodeStacktraceKey = attribute.Key("code.stacktrace") +) + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeStacktrace returns an attribute KeyValue conforming to the +// "code.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func CodeStacktrace(val string) attribute.KeyValue { + return CodeStacktraceKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span doesn't depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") + + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") +) + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") + + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") +) + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") + + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") +) + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") + + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/README.md new file mode 100644 index 000000000..2de1fc3c6 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/README.md @@ -0,0 +1,3 @@ +# Semconv v1.26.0 + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.26.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.26.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/attribute_group.go new file mode 100644 index 000000000..d8dc822b2 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/attribute_group.go @@ -0,0 +1,8996 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" + +import "go.opentelemetry.io/otel/attribute" + +// The Android platform on which the Android application is running. +const ( + // AndroidOSAPILevelKey is the attribute Key conforming to the + // "android.os.api_level" semantic conventions. It represents the uniquely + // identifies the framework API revision offered by a version + // (`os.version`) of the android operating system. More information can be + // found + // [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '33', '32' + AndroidOSAPILevelKey = attribute.Key("android.os.api_level") +) + +// AndroidOSAPILevel returns an attribute KeyValue conforming to the +// "android.os.api_level" semantic conventions. It represents the uniquely +// identifies the framework API revision offered by a version (`os.version`) of +// the android operating system. More information can be found +// [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). +func AndroidOSAPILevel(val string) attribute.KeyValue { + return AndroidOSAPILevelKey.String(val) +} + +// ASP.NET Core attributes +const ( + // AspnetcoreRateLimitingResultKey is the attribute Key conforming to the + // "aspnetcore.rate_limiting.result" semantic conventions. It represents + // the rate-limiting result, shows whether the lease was acquired or + // contains a rejection reason + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Examples: 'acquired', 'request_canceled' + AspnetcoreRateLimitingResultKey = attribute.Key("aspnetcore.rate_limiting.result") + + // AspnetcoreDiagnosticsHandlerTypeKey is the attribute Key conforming to + // the "aspnetcore.diagnostics.handler.type" semantic conventions. It + // represents the full type name of the + // [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) + // implementation that handled the exception. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if and only if the exception + // was handled by this handler.) + // Stability: stable + // Examples: 'Contoso.MyHandler' + AspnetcoreDiagnosticsHandlerTypeKey = attribute.Key("aspnetcore.diagnostics.handler.type") + + // AspnetcoreDiagnosticsExceptionResultKey is the attribute Key conforming + // to the "aspnetcore.diagnostics.exception.result" semantic conventions. + // It represents the aSP.NET Core exception middleware handling result + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'handled', 'unhandled' + AspnetcoreDiagnosticsExceptionResultKey = attribute.Key("aspnetcore.diagnostics.exception.result") + + // AspnetcoreRateLimitingPolicyKey is the attribute Key conforming to the + // "aspnetcore.rate_limiting.policy" semantic conventions. It represents + // the rate limiting policy name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fixed', 'sliding', 'token' + AspnetcoreRateLimitingPolicyKey = attribute.Key("aspnetcore.rate_limiting.policy") + + // AspnetcoreRequestIsUnhandledKey is the attribute Key conforming to the + // "aspnetcore.request.is_unhandled" semantic conventions. It represents + // the flag indicating if request was handled by the application pipeline. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Examples: True + AspnetcoreRequestIsUnhandledKey = attribute.Key("aspnetcore.request.is_unhandled") + + // AspnetcoreRoutingIsFallbackKey is the attribute Key conforming to the + // "aspnetcore.routing.is_fallback" semantic conventions. It represents a + // value that indicates whether the matched route is a fallback route. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Examples: True + AspnetcoreRoutingIsFallbackKey = attribute.Key("aspnetcore.routing.is_fallback") + + // AspnetcoreRoutingMatchStatusKey is the attribute Key conforming to the + // "aspnetcore.routing.match_status" semantic conventions. It represents + // the match result - success or failure + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'success', 'failure' + AspnetcoreRoutingMatchStatusKey = attribute.Key("aspnetcore.routing.match_status") +) + +var ( + // Lease was acquired + AspnetcoreRateLimitingResultAcquired = AspnetcoreRateLimitingResultKey.String("acquired") + // Lease request was rejected by the endpoint limiter + AspnetcoreRateLimitingResultEndpointLimiter = AspnetcoreRateLimitingResultKey.String("endpoint_limiter") + // Lease request was rejected by the global limiter + AspnetcoreRateLimitingResultGlobalLimiter = AspnetcoreRateLimitingResultKey.String("global_limiter") + // Lease request was canceled + AspnetcoreRateLimitingResultRequestCanceled = AspnetcoreRateLimitingResultKey.String("request_canceled") +) + +var ( + // Exception was handled by the exception handling middleware + AspnetcoreDiagnosticsExceptionResultHandled = AspnetcoreDiagnosticsExceptionResultKey.String("handled") + // Exception was not handled by the exception handling middleware + AspnetcoreDiagnosticsExceptionResultUnhandled = AspnetcoreDiagnosticsExceptionResultKey.String("unhandled") + // Exception handling was skipped because the response had started + AspnetcoreDiagnosticsExceptionResultSkipped = AspnetcoreDiagnosticsExceptionResultKey.String("skipped") + // Exception handling didn't run because the request was aborted + AspnetcoreDiagnosticsExceptionResultAborted = AspnetcoreDiagnosticsExceptionResultKey.String("aborted") +) + +var ( + // Match succeeded + AspnetcoreRoutingMatchStatusSuccess = AspnetcoreRoutingMatchStatusKey.String("success") + // Match failed + AspnetcoreRoutingMatchStatusFailure = AspnetcoreRoutingMatchStatusKey.String("failure") +) + +// AspnetcoreDiagnosticsHandlerType returns an attribute KeyValue conforming +// to the "aspnetcore.diagnostics.handler.type" semantic conventions. It +// represents the full type name of the +// [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) +// implementation that handled the exception. +func AspnetcoreDiagnosticsHandlerType(val string) attribute.KeyValue { + return AspnetcoreDiagnosticsHandlerTypeKey.String(val) +} + +// AspnetcoreRateLimitingPolicy returns an attribute KeyValue conforming to +// the "aspnetcore.rate_limiting.policy" semantic conventions. It represents +// the rate limiting policy name. +func AspnetcoreRateLimitingPolicy(val string) attribute.KeyValue { + return AspnetcoreRateLimitingPolicyKey.String(val) +} + +// AspnetcoreRequestIsUnhandled returns an attribute KeyValue conforming to +// the "aspnetcore.request.is_unhandled" semantic conventions. It represents +// the flag indicating if request was handled by the application pipeline. +func AspnetcoreRequestIsUnhandled(val bool) attribute.KeyValue { + return AspnetcoreRequestIsUnhandledKey.Bool(val) +} + +// AspnetcoreRoutingIsFallback returns an attribute KeyValue conforming to +// the "aspnetcore.routing.is_fallback" semantic conventions. It represents a +// value that indicates whether the matched route is a fallback route. +func AspnetcoreRoutingIsFallback(val bool) attribute.KeyValue { + return AspnetcoreRoutingIsFallbackKey.Bool(val) +} + +// Generic attributes for AWS services. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes for AWS DynamoDB. +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") + + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") + + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") + + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the number of +// items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// Attributes for AWS Elastic Container Service (ECS). +const ( + // AWSECSTaskIDKey is the attribute Key conforming to the "aws.ecs.task.id" + // semantic conventions. It represents the ID of a running ECS task. The ID + // MUST be extracted from `task.arn`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if `task.arn` is + // populated.) + // Stability: experimental + // Examples: '10838bed-421f-43ef-870a-f43feacbbb5b', + // '23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd' + AWSECSTaskIDKey = attribute.Key("aws.ecs.task.id") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of a + // running [ECS + // task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b', + // 'arn:aws:ecs:us-west-1:123456789123:task/my-cluster/task-id/23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the family + // name of the [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) + // used to create the ECS task. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for the task definition used to create the ECS task. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSTaskID returns an attribute KeyValue conforming to the +// "aws.ecs.task.id" semantic conventions. It represents the ID of a running +// ECS task. The ID MUST be extracted from `task.arn`. +func AWSECSTaskID(val string) attribute.KeyValue { + return AWSECSTaskIDKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of a running +// [ECS +// task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the family name of +// the [ECS task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) +// used to create the ECS task. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// the task definition used to create the ECS task. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Attributes for AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Attributes for AWS Logs. +const ( + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") +) + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// Attributes for AWS Lambda. +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for AWS S3. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// The web browser attributes +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// These attributes may be used to describe the client in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.address` SHOULD represent the client address + // behind any intermediaries, for example proxies, if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" + // semantic conventions. It represents the client port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.port` SHOULD represent the client port behind + // any intermediaries, for example proxies, if it's available. + ClientPortKey = attribute.Key("client.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the +// "client.address" semantic conventions. It represents the client address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number. +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS). +const ( + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") + + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Apps + CloudPlatformAzureContainerApps = CloudPlatformKey.String("azure_container_apps") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Bare Metal Solution (BMS) + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on +// Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// Attributes for CloudEvents. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeStacktraceKey is the attribute Key conforming to the + // "code.stacktrace" semantic conventions. It represents a stacktrace as a + // string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'at + // com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + CodeStacktraceKey = attribute.Key("code.stacktrace") +) + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeStacktrace returns an attribute KeyValue conforming to the +// "code.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func CodeStacktrace(val string) attribute.KeyValue { + return CodeStacktraceKey.String(val) +} + +// A container instance. +const ( + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used + // to run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol' + // Note: If using embedded credentials or sensitive data, it is recommended + // to remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. [2] + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol, --config, config.yaml' + ContainerCommandArgsKey = attribute.Key("container.command_args") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full + // command run by the container as a single string representing the full + // command. [2] + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol --config config.yaml' + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerCPUStateKey is the attribute Key conforming to the + // "container.cpu.state" semantic conventions. It represents the CPU state + // for this data point. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'user', 'kernel' + ContainerCPUStateKey = attribute.Key("container.cpu.state") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime + // specific image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect + // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) + // endpoint. + // K8S defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io + // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. + // The ID is assigned by the container runtime and can vary in different + // environments. Consider using `oci.manifest.digest` if it is important to + // identify the same image in different environments/runtimes. + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageRepoDigestsKey is the attribute Key conforming to the + // "container.image.repo_digests" semantic conventions. It represents the + // repo digests of the container image as provided by the container + // runtime. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb', + // 'internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578' + // Note: + // [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) + // and + // [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) + // report those under the `RepoDigests` field. + ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") + + // ContainerImageTagsKey is the attribute Key conforming to the + // "container.image.tags" semantic conventions. It represents the container + // image tags. An example can be found in [Docker Image + // Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). + // Should be only the `` section of the full name for example from + // `registry.example.com/my-org/my-image:`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'v1.27.1', '3.5.7-0' + ContainerImageTagsKey = attribute.Key("container.image.tags") + + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") +) + +var ( + // When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows) + ContainerCPUStateUser = ContainerCPUStateKey.String("user") + // When CPU is used by the system (host OS) + ContainerCPUStateSystem = ContainerCPUStateKey.String("system") + // When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows) + ContainerCPUStateKernel = ContainerCPUStateKey.String("kernel") +) + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. [2] +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full +// command run by the container as a single string representing the full +// command. [2] +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime +// specific image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageRepoDigests returns an attribute KeyValue conforming to the +// "container.image.repo_digests" semantic conventions. It represents the repo +// digests of the container image as provided by the container runtime. +func ContainerImageRepoDigests(val ...string) attribute.KeyValue { + return ContainerImageRepoDigestsKey.StringSlice(val) +} + +// ContainerImageTags returns an attribute KeyValue conforming to the +// "container.image.tags" semantic conventions. It represents the container +// image tags. An example can be found in [Docker Image +// Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). +// Should be only the `` section of the full name for example from +// `registry.example.com/my-org/my-image:`. +func ContainerImageTags(val ...string) attribute.KeyValue { + return ContainerImageTagsKey.StringSlice(val) +} + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// This group defines the attributes used to describe telemetry in the context +// of databases. +const ( + // DBClientConnectionsPoolNameKey is the attribute Key conforming to the + // "db.client.connections.pool.name" semantic conventions. It represents + // the name of the connection pool; unique within the instrumented + // application. In case the connection pool implementation doesn't provide + // a name, instrumentation should use a combination of `server.address` and + // `server.port` attributes formatted as `server.address:server.port`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myDataSource' + DBClientConnectionsPoolNameKey = attribute.Key("db.client.connections.pool.name") + + // DBClientConnectionsStateKey is the attribute Key conforming to the + // "db.client.connections.state" semantic conventions. It represents the + // state of a connection in the pool + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'idle' + DBClientConnectionsStateKey = attribute.Key("db.client.connections.state") + + // DBCollectionNameKey is the attribute Key conforming to the + // "db.collection.name" semantic conventions. It represents the name of a + // collection (table, container) within the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'public.users', 'customers' + // Note: If the collection name is parsed from the query, it SHOULD match + // the value provided in the query and may be qualified with the schema and + // database name. + // It is RECOMMENDED to capture the value as provided by the application + // without attempting to do any case normalization. + DBCollectionNameKey = attribute.Key("db.collection.name") + + // DBNamespaceKey is the attribute Key conforming to the "db.namespace" + // semantic conventions. It represents the name of the database, fully + // qualified within the server address and port. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'customers', 'test.users' + // Note: If a database system has multiple namespace components, they + // SHOULD be concatenated (potentially using database system specific + // conventions) from most general to most specific namespace component, and + // more specific namespaces SHOULD NOT be captured without the more general + // namespaces, to ensure that "startswith" queries for the more general + // namespaces will be valid. + // Semantic conventions for individual database systems SHOULD document + // what `db.namespace` means in the context of that system. + // It is RECOMMENDED to capture the value as provided by the application + // without attempting to do any case normalization. + DBNamespaceKey = attribute.Key("db.namespace") + + // DBOperationNameKey is the attribute Key conforming to the + // "db.operation.name" semantic conventions. It represents the name of the + // operation or command being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: It is RECOMMENDED to capture the value as provided by the + // application without attempting to do any case normalization. + DBOperationNameKey = attribute.Key("db.operation.name") + + // DBQueryTextKey is the attribute Key conforming to the "db.query.text" + // semantic conventions. It represents the database query being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'SELECT * FROM wuser_table where username = ?', 'SET mykey + // "WuValue"' + DBQueryTextKey = attribute.Key("db.query.text") + + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents the database management system (DBMS) product + // as identified by the client instrumentation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The actual DBMS may differ from the one identified by the client. + // For example, when using PostgreSQL client libraries to connect to a + // CockroachDB, the `db.system` is set to `postgresql` based on the + // instrumentation's best knowledge. + DBSystemKey = attribute.Key("db.system") +) + +var ( + // idle + DBClientConnectionsStateIdle = DBClientConnectionsStateKey.String("idle") + // used + DBClientConnectionsStateUsed = DBClientConnectionsStateKey.String("used") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBClientConnectionsPoolName returns an attribute KeyValue conforming to +// the "db.client.connections.pool.name" semantic conventions. It represents +// the name of the connection pool; unique within the instrumented application. +// In case the connection pool implementation doesn't provide a name, +// instrumentation should use a combination of `server.address` and +// `server.port` attributes formatted as `server.address:server.port`. +func DBClientConnectionsPoolName(val string) attribute.KeyValue { + return DBClientConnectionsPoolNameKey.String(val) +} + +// DBCollectionName returns an attribute KeyValue conforming to the +// "db.collection.name" semantic conventions. It represents the name of a +// collection (table, container) within the database. +func DBCollectionName(val string) attribute.KeyValue { + return DBCollectionNameKey.String(val) +} + +// DBNamespace returns an attribute KeyValue conforming to the +// "db.namespace" semantic conventions. It represents the name of the database, +// fully qualified within the server address and port. +func DBNamespace(val string) attribute.KeyValue { + return DBNamespaceKey.String(val) +} + +// DBOperationName returns an attribute KeyValue conforming to the +// "db.operation.name" semantic conventions. It represents the name of the +// operation or command being executed. +func DBOperationName(val string) attribute.KeyValue { + return DBOperationNameKey.String(val) +} + +// DBQueryText returns an attribute KeyValue conforming to the +// "db.query.text" semantic conventions. It represents the database query being +// executed. +func DBQueryText(val string) attribute.KeyValue { + return DBQueryTextKey.String(val) +} + +// This group defines attributes for Cassandra. +const ( + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// This group defines attributes for Azure Cosmos DB. +const ( + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// This group defines attributes for Elasticsearch. +const ( + // DBElasticsearchClusterNameKey is the attribute Key conforming to the + // "db.elasticsearch.cluster.name" semantic conventions. It represents the + // represents the identifier of an Elasticsearch cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e9106fc68e3044f0b1475b04bf4ffd5f' + DBElasticsearchClusterNameKey = attribute.Key("db.elasticsearch.cluster.name") + + // DBElasticsearchNodeNameKey is the attribute Key conforming to the + // "db.elasticsearch.node.name" semantic conventions. It represents the + // represents the human-readable identifier of the node/instance to which a + // request was routed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-0000000001' + DBElasticsearchNodeNameKey = attribute.Key("db.elasticsearch.node.name") +) + +// DBElasticsearchClusterName returns an attribute KeyValue conforming to +// the "db.elasticsearch.cluster.name" semantic conventions. It represents the +// represents the identifier of an Elasticsearch cluster. +func DBElasticsearchClusterName(val string) attribute.KeyValue { + return DBElasticsearchClusterNameKey.String(val) +} + +// DBElasticsearchNodeName returns an attribute KeyValue conforming to the +// "db.elasticsearch.node.name" semantic conventions. It represents the +// represents the human-readable identifier of the node/instance to which a +// request was routed. +func DBElasticsearchNodeName(val string) attribute.KeyValue { + return DBElasticsearchNodeNameKey.String(val) +} + +// Attributes for software deployments. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'staging', 'production' + // Note: `deployment.environment` does not affect the uniqueness + // constraints defined through + // the `service.namespace`, `service.name` and `service.instance.id` + // resource attributes. + // This implies that resources carrying the following attribute + // combinations MUST be + // considered to be identifying the same service: + // + // * `service.name=frontend`, `deployment.environment=production` + // * `service.name=frontend`, `deployment.environment=staging`. + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment environment](https://wikipedia.org/wiki/Deployment_environment) +// (aka deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// Attributes that represents an occurrence of a lifecycle transition on the +// Android platform. +const ( + // AndroidStateKey is the attribute Key conforming to the "android.state" + // semantic conventions. It represents the deprecated use the + // `device.app.lifecycle` event definition including `android.state` as a + // payload field instead. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The Android lifecycle states are defined in [Activity lifecycle + // callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), + // and from which the `OS identifiers` are derived. + AndroidStateKey = attribute.Key("android.state") +) + +var ( + // Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time + AndroidStateCreated = AndroidStateKey.String("created") + // Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state + AndroidStateBackground = AndroidStateKey.String("background") + // Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states + AndroidStateForeground = AndroidStateKey.String("foreground") +) + +// These attributes may be used to describe the receiver of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the + // destination address - domain name if available without reverse DNS + // lookup; otherwise, IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'destination.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the source side, and when communicating through + // an intermediary, `destination.address` SHOULD represent the destination + // address behind any intermediaries, for example proxies, if it's + // available. + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the + // "destination.port" semantic conventions. It represents the destination + // port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the destination +// address - domain name if available without reverse DNS lookup; otherwise, IP +// address or Unix domain socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the destination port +// number +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// Describes device attributes. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine-readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human-readable version of + // the device model rather than a machine-readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// These attributes may be used for any disk related operation. +const ( + // DiskIoDirectionKey is the attribute Key conforming to the + // "disk.io.direction" semantic conventions. It represents the disk IO + // operation direction. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read' + DiskIoDirectionKey = attribute.Key("disk.io.direction") +) + +var ( + // read + DiskIoDirectionRead = DiskIoDirectionKey.String("read") + // write + DiskIoDirectionWrite = DiskIoDirectionKey.String("write") +) + +// The shared attributes used to report a DNS query. +const ( + // DNSQuestionNameKey is the attribute Key conforming to the + // "dns.question.name" semantic conventions. It represents the name being + // queried. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'www.example.com', 'opentelemetry.io' + // Note: If the name field contains non-printable characters (below 32 or + // above 126), those characters should be represented as escaped base 10 + // integers (\DDD). Back slashes and quotes should be escaped. Tabs, + // carriage returns, and line feeds should be converted to \t, \r, and \n + // respectively. + DNSQuestionNameKey = attribute.Key("dns.question.name") +) + +// DNSQuestionName returns an attribute KeyValue conforming to the +// "dns.question.name" semantic conventions. It represents the name being +// queried. +func DNSQuestionName(val string) attribute.KeyValue { + return DNSQuestionNameKey.String(val) +} + +// Attributes for operations with an authenticated and/or authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// The shared attributes used to report an error. +const ( + // ErrorTypeKey is the attribute Key conforming to the "error.type" + // semantic conventions. It represents the describes a class of error the + // operation ended with. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'timeout', 'java.net.UnknownHostException', + // 'server_certificate_invalid', '500' + // Note: The `error.type` SHOULD be predictable, and SHOULD have low + // cardinality. + // + // When `error.type` is set to a type (e.g., an exception type), its + // canonical class name identifying the type within the artifact SHOULD be + // used. + // + // Instrumentations SHOULD document the list of errors they report. + // + // The cardinality of `error.type` within one instrumentation library + // SHOULD be low. + // Telemetry consumers that aggregate data from multiple instrumentation + // libraries and applications + // should be prepared for `error.type` to have high cardinality at query + // time when no + // additional filters are applied. + // + // If the operation has completed successfully, instrumentations SHOULD NOT + // set `error.type`. + // + // If a specific domain defines its own set of error identifiers (such as + // HTTP or gRPC status codes), + // it's RECOMMENDED to: + // + // * Use a domain-specific attribute + // * Set `error.type` to capture all errors, regardless of whether they are + // defined within the domain-specific set or not. + ErrorTypeKey = attribute.Key("error.type") +) + +var ( + // A fallback error value to be used when the instrumentation doesn't define a custom value + ErrorTypeOther = ErrorTypeKey.String("_OTHER") +) + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the identifies the class / type of + // event. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'browser.mouse.click', 'device.app.lifecycle' + // Note: Event names are subject to the same rules as [attribute + // names](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.33.0/specification/common/attribute-naming.md). + // Notably, event names are namespaced to avoid collisions and provide a + // clean separation of semantics for events in separate domains like + // browser, mobile, and kubernetes. + EventNameKey = attribute.Key("event.name") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the identifies the class / type of +// event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example for recording span + // exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// FaaS attributes +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + FaaSColdstartKey = attribute.Key("faas.coldstart") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") + + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") + + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") + + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run (Services):** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// Attributes for Feature Flags. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// Describes file attributes. +const ( + // FileDirectoryKey is the attribute Key conforming to the "file.directory" + // semantic conventions. It represents the directory where the file is + // located. It should include the drive letter, when appropriate. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/home/user', 'C:\\Program Files\\MyApp' + FileDirectoryKey = attribute.Key("file.directory") + + // FileExtensionKey is the attribute Key conforming to the "file.extension" + // semantic conventions. It represents the file extension, excluding the + // leading dot. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'png', 'gz' + // Note: When the file name has multiple extensions (example.tar.gz), only + // the last one should be captured ("gz", not "tar.gz"). + FileExtensionKey = attribute.Key("file.extension") + + // FileNameKey is the attribute Key conforming to the "file.name" semantic + // conventions. It represents the name of the file including the extension, + // without the directory. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'example.png' + FileNameKey = attribute.Key("file.name") + + // FilePathKey is the attribute Key conforming to the "file.path" semantic + // conventions. It represents the full path to the file, including the file + // name. It should include the drive letter, when appropriate. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/home/alice/example.png', 'C:\\Program + // Files\\MyApp\\myapp.exe' + FilePathKey = attribute.Key("file.path") + + // FileSizeKey is the attribute Key conforming to the "file.size" semantic + // conventions. It represents the file size in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + FileSizeKey = attribute.Key("file.size") +) + +// FileDirectory returns an attribute KeyValue conforming to the +// "file.directory" semantic conventions. It represents the directory where the +// file is located. It should include the drive letter, when appropriate. +func FileDirectory(val string) attribute.KeyValue { + return FileDirectoryKey.String(val) +} + +// FileExtension returns an attribute KeyValue conforming to the +// "file.extension" semantic conventions. It represents the file extension, +// excluding the leading dot. +func FileExtension(val string) attribute.KeyValue { + return FileExtensionKey.String(val) +} + +// FileName returns an attribute KeyValue conforming to the "file.name" +// semantic conventions. It represents the name of the file including the +// extension, without the directory. +func FileName(val string) attribute.KeyValue { + return FileNameKey.String(val) +} + +// FilePath returns an attribute KeyValue conforming to the "file.path" +// semantic conventions. It represents the full path to the file, including the +// file name. It should include the drive letter, when appropriate. +func FilePath(val string) attribute.KeyValue { + return FilePathKey.String(val) +} + +// FileSize returns an attribute KeyValue conforming to the "file.size" +// semantic conventions. It represents the file size in bytes. +func FileSize(val int) attribute.KeyValue { + return FileSizeKey.Int(val) +} + +// Attributes for Google Cloud Run. +const ( + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the + // name of the Cloud Run + // [execution](https://cloud.google.com/run/docs/managing/job-executions) + // being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'job-name-xxxx', 'sample-job-mdw84' + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the + // index for a task within an execution as provided by the + // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1 + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") +) + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name +// of the Cloud Run +// [execution](https://cloud.google.com/run/docs/managing/job-executions) being +// run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the +// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// Attributes for Google Compute Engine (GCE). +const ( + // GCPGceInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the + // hostname of a GCE instance. This is the full value of the default or + // [custom + // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-host1234.example.com', + // 'sample-vm.us-west1-b.c.my-project.internal' + GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") + + // GCPGceInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance + // name of a GCE instance. This is the value provided by `host.name`, the + // visible name of the instance in the Cloud Console UI, and the prefix for + // the default hostname of the instance as defined by the [default internal + // DNS + // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-1', 'my-vm-name' + GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") +) + +// GCPGceInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom +// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). +func GCPGceInstanceHostname(val string) attribute.KeyValue { + return GCPGceInstanceHostnameKey.String(val) +} + +// GCPGceInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance +// name of a GCE instance. This is the value provided by `host.name`, the +// visible name of the instance in the Cloud Console UI, and the prefix for the +// default hostname of the instance as defined by the [default internal DNS +// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). +func GCPGceInstanceName(val string) attribute.KeyValue { + return GCPGceInstanceNameKey.String(val) +} + +// The attributes used to describe telemetry in the context of LLM (Large +// Language Models) requests and responses. +const ( + // GenAiCompletionKey is the attribute Key conforming to the + // "gen_ai.completion" semantic conventions. It represents the full + // response received from the LLM. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: "[{'role': 'assistant', 'content': 'The capital of France is + // Paris.'}]" + // Note: It's RECOMMENDED to format completions as JSON string matching + // [OpenAI messages + // format](https://platform.openai.com/docs/guides/text-generation) + GenAiCompletionKey = attribute.Key("gen_ai.completion") + + // GenAiPromptKey is the attribute Key conforming to the "gen_ai.prompt" + // semantic conventions. It represents the full prompt sent to an LLM. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: "[{'role': 'user', 'content': 'What is the capital of + // France?'}]" + // Note: It's RECOMMENDED to format prompts as JSON string matching [OpenAI + // messages + // format](https://platform.openai.com/docs/guides/text-generation) + GenAiPromptKey = attribute.Key("gen_ai.prompt") + + // GenAiRequestMaxTokensKey is the attribute Key conforming to the + // "gen_ai.request.max_tokens" semantic conventions. It represents the + // maximum number of tokens the LLM generates for a request. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 100 + GenAiRequestMaxTokensKey = attribute.Key("gen_ai.request.max_tokens") + + // GenAiRequestModelKey is the attribute Key conforming to the + // "gen_ai.request.model" semantic conventions. It represents the name of + // the LLM a request is being made to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'gpt-4' + GenAiRequestModelKey = attribute.Key("gen_ai.request.model") + + // GenAiRequestTemperatureKey is the attribute Key conforming to the + // "gen_ai.request.temperature" semantic conventions. It represents the + // temperature setting for the LLM request. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0.0 + GenAiRequestTemperatureKey = attribute.Key("gen_ai.request.temperature") + + // GenAiRequestTopPKey is the attribute Key conforming to the + // "gen_ai.request.top_p" semantic conventions. It represents the top_p + // sampling setting for the LLM request. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0 + GenAiRequestTopPKey = attribute.Key("gen_ai.request.top_p") + + // GenAiResponseFinishReasonsKey is the attribute Key conforming to the + // "gen_ai.response.finish_reasons" semantic conventions. It represents the + // array of reasons the model stopped generating tokens, corresponding to + // each generation received. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'stop' + GenAiResponseFinishReasonsKey = attribute.Key("gen_ai.response.finish_reasons") + + // GenAiResponseIDKey is the attribute Key conforming to the + // "gen_ai.response.id" semantic conventions. It represents the unique + // identifier for the completion. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'chatcmpl-123' + GenAiResponseIDKey = attribute.Key("gen_ai.response.id") + + // GenAiResponseModelKey is the attribute Key conforming to the + // "gen_ai.response.model" semantic conventions. It represents the name of + // the LLM a response was generated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'gpt-4-0613' + GenAiResponseModelKey = attribute.Key("gen_ai.response.model") + + // GenAiSystemKey is the attribute Key conforming to the "gen_ai.system" + // semantic conventions. It represents the Generative AI product as + // identified by the client instrumentation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'openai' + // Note: The actual GenAI product may differ from the one identified by the + // client. For example, when using OpenAI client libraries to communicate + // with Mistral, the `gen_ai.system` is set to `openai` based on the + // instrumentation's best knowledge. + GenAiSystemKey = attribute.Key("gen_ai.system") + + // GenAiUsageCompletionTokensKey is the attribute Key conforming to the + // "gen_ai.usage.completion_tokens" semantic conventions. It represents the + // number of tokens used in the LLM response (completion). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 180 + GenAiUsageCompletionTokensKey = attribute.Key("gen_ai.usage.completion_tokens") + + // GenAiUsagePromptTokensKey is the attribute Key conforming to the + // "gen_ai.usage.prompt_tokens" semantic conventions. It represents the + // number of tokens used in the LLM prompt. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 100 + GenAiUsagePromptTokensKey = attribute.Key("gen_ai.usage.prompt_tokens") +) + +var ( + // OpenAI + GenAiSystemOpenai = GenAiSystemKey.String("openai") +) + +// GenAiCompletion returns an attribute KeyValue conforming to the +// "gen_ai.completion" semantic conventions. It represents the full response +// received from the LLM. +func GenAiCompletion(val string) attribute.KeyValue { + return GenAiCompletionKey.String(val) +} + +// GenAiPrompt returns an attribute KeyValue conforming to the +// "gen_ai.prompt" semantic conventions. It represents the full prompt sent to +// an LLM. +func GenAiPrompt(val string) attribute.KeyValue { + return GenAiPromptKey.String(val) +} + +// GenAiRequestMaxTokens returns an attribute KeyValue conforming to the +// "gen_ai.request.max_tokens" semantic conventions. It represents the maximum +// number of tokens the LLM generates for a request. +func GenAiRequestMaxTokens(val int) attribute.KeyValue { + return GenAiRequestMaxTokensKey.Int(val) +} + +// GenAiRequestModel returns an attribute KeyValue conforming to the +// "gen_ai.request.model" semantic conventions. It represents the name of the +// LLM a request is being made to. +func GenAiRequestModel(val string) attribute.KeyValue { + return GenAiRequestModelKey.String(val) +} + +// GenAiRequestTemperature returns an attribute KeyValue conforming to the +// "gen_ai.request.temperature" semantic conventions. It represents the +// temperature setting for the LLM request. +func GenAiRequestTemperature(val float64) attribute.KeyValue { + return GenAiRequestTemperatureKey.Float64(val) +} + +// GenAiRequestTopP returns an attribute KeyValue conforming to the +// "gen_ai.request.top_p" semantic conventions. It represents the top_p +// sampling setting for the LLM request. +func GenAiRequestTopP(val float64) attribute.KeyValue { + return GenAiRequestTopPKey.Float64(val) +} + +// GenAiResponseFinishReasons returns an attribute KeyValue conforming to +// the "gen_ai.response.finish_reasons" semantic conventions. It represents the +// array of reasons the model stopped generating tokens, corresponding to each +// generation received. +func GenAiResponseFinishReasons(val ...string) attribute.KeyValue { + return GenAiResponseFinishReasonsKey.StringSlice(val) +} + +// GenAiResponseID returns an attribute KeyValue conforming to the +// "gen_ai.response.id" semantic conventions. It represents the unique +// identifier for the completion. +func GenAiResponseID(val string) attribute.KeyValue { + return GenAiResponseIDKey.String(val) +} + +// GenAiResponseModel returns an attribute KeyValue conforming to the +// "gen_ai.response.model" semantic conventions. It represents the name of the +// LLM a response was generated from. +func GenAiResponseModel(val string) attribute.KeyValue { + return GenAiResponseModelKey.String(val) +} + +// GenAiUsageCompletionTokens returns an attribute KeyValue conforming to +// the "gen_ai.usage.completion_tokens" semantic conventions. It represents the +// number of tokens used in the LLM response (completion). +func GenAiUsageCompletionTokens(val int) attribute.KeyValue { + return GenAiUsageCompletionTokensKey.Int(val) +} + +// GenAiUsagePromptTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.prompt_tokens" semantic conventions. It represents the number +// of tokens used in the LLM prompt. +func GenAiUsagePromptTokens(val int) attribute.KeyValue { + return GenAiUsagePromptTokensKey.Int(val) +} + +// Attributes for GraphQL. +const ( + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") + + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// Attributes for the Android platform on which the Android application is +// running. +const ( + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") +) + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// A host is defined as a computing instance. For example, physical servers, +// virtual machines, switches or disk array. +const ( + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + HostArchKey = attribute.Key("host.arch") + + // HostCPUCacheL2SizeKey is the attribute Key conforming to the + // "host.cpu.cache.l2.size" semantic conventions. It represents the amount + // of level 2 memory cache available to the processor (in Bytes). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 12288000 + HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") + + // HostCPUFamilyKey is the attribute Key conforming to the + // "host.cpu.family" semantic conventions. It represents the family or + // generation of the CPU. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '6', 'PA-RISC 1.1e' + HostCPUFamilyKey = attribute.Key("host.cpu.family") + + // HostCPUModelIDKey is the attribute Key conforming to the + // "host.cpu.model.id" semantic conventions. It represents the model + // identifier. It provides more granular information about the CPU, + // distinguishing it from other CPUs within the same family. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '6', '9000/778/B180L' + HostCPUModelIDKey = attribute.Key("host.cpu.model.id") + + // HostCPUModelNameKey is the attribute Key conforming to the + // "host.cpu.model.name" semantic conventions. It represents the model + // designation of the processor. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz' + HostCPUModelNameKey = attribute.Key("host.cpu.model.name") + + // HostCPUSteppingKey is the attribute Key conforming to the + // "host.cpu.stepping" semantic conventions. It represents the stepping or + // core revisions. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1', 'r1p1' + HostCPUSteppingKey = attribute.Key("host.cpu.stepping") + + // HostCPUVendorIDKey is the attribute Key conforming to the + // "host.cpu.vendor.id" semantic conventions. It represents the processor + // manufacturer identifier. A maximum 12-character string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'GenuineIntel' + // Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor + // ID string in EBX, EDX and ECX registers. Writing these to memory in this + // order results in a 12-character string. + HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") + + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID or host OS image ID. + // For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image or host OS as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") + + // HostIPKey is the attribute Key conforming to the "host.ip" semantic + // conventions. It represents the available IP addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '192.168.1.140', 'fe80::abc2:4a28:737a:609e' + // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 + // addresses MUST be specified in the [RFC + // 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format. + HostIPKey = attribute.Key("host.ip") + + // HostMacKey is the attribute Key conforming to the "host.mac" semantic + // conventions. It represents the available MAC addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AC-DE-48-23-45-67', 'AC-DE-48-23-45-67-01-9F' + // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal + // form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): + // as hyphen-separated octets in uppercase hexadecimal form from most to + // least significant. + HostMacKey = attribute.Key("host.mac") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostCPUCacheL2Size returns an attribute KeyValue conforming to the +// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of +// level 2 memory cache available to the processor (in Bytes). +func HostCPUCacheL2Size(val int) attribute.KeyValue { + return HostCPUCacheL2SizeKey.Int(val) +} + +// HostCPUFamily returns an attribute KeyValue conforming to the +// "host.cpu.family" semantic conventions. It represents the family or +// generation of the CPU. +func HostCPUFamily(val string) attribute.KeyValue { + return HostCPUFamilyKey.String(val) +} + +// HostCPUModelID returns an attribute KeyValue conforming to the +// "host.cpu.model.id" semantic conventions. It represents the model +// identifier. It provides more granular information about the CPU, +// distinguishing it from other CPUs within the same family. +func HostCPUModelID(val string) attribute.KeyValue { + return HostCPUModelIDKey.String(val) +} + +// HostCPUModelName returns an attribute KeyValue conforming to the +// "host.cpu.model.name" semantic conventions. It represents the model +// designation of the processor. +func HostCPUModelName(val string) attribute.KeyValue { + return HostCPUModelNameKey.String(val) +} + +// HostCPUStepping returns an attribute KeyValue conforming to the +// "host.cpu.stepping" semantic conventions. It represents the stepping or core +// revisions. +func HostCPUStepping(val string) attribute.KeyValue { + return HostCPUSteppingKey.String(val) +} + +// HostCPUVendorID returns an attribute KeyValue conforming to the +// "host.cpu.vendor.id" semantic conventions. It represents the processor +// manufacturer identifier. A maximum 12-character string. +func HostCPUVendorID(val string) attribute.KeyValue { + return HostCPUVendorIDKey.String(val) +} + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID or host +// OS image ID. For Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image or host OS as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic +// conventions. It represents the available IP addresses of the host, excluding +// loopback interfaces. +func HostIP(val ...string) attribute.KeyValue { + return HostIPKey.StringSlice(val) +} + +// HostMac returns an attribute KeyValue conforming to the "host.mac" +// semantic conventions. It represents the available MAC addresses of the host, +// excluding loopback interfaces. +func HostMac(val ...string) attribute.KeyValue { + return HostMacKey.StringSlice(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// Semantic convention attributes in the HTTP namespace. +const ( + // HTTPConnectionStateKey is the attribute Key conforming to the + // "http.connection.state" semantic conventions. It represents the state of + // the HTTP connection in the HTTP connection pool. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'active', 'idle' + HTTPConnectionStateKey = attribute.Key("http.connection.state") + + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of + // the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the hTTP + // request method. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + // Note: HTTP request method value SHOULD be "known" to the + // instrumentation. + // By default, this convention defines "known" methods as the ones listed + // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + // and the PATCH method defined in + // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + // + // If the HTTP request method is not known to instrumentation, it MUST set + // the `http.request.method` attribute to `_OTHER`. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated + // list of case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is + // not a list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods + // to be case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GeT', 'ACL', 'foo' + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestResendCountKey is the attribute Key conforming to the + // "http.request.resend_count" semantic conventions. It represents the + // ordinal number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") + + // HTTPRequestSizeKey is the attribute Key conforming to the + // "http.request.size" semantic conventions. It represents the total size + // of the request in bytes. This should be the total number of bytes sent + // over the wire, including the request line (HTTP/1.1), framing (HTTP/2 + // and HTTP/3), headers, and request body if any. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1437 + HTTPRequestSizeKey = attribute.Key("http.request.size") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size + // of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") + + // HTTPResponseSizeKey is the attribute Key conforming to the + // "http.response.size" semantic conventions. It represents the total size + // of the response in bytes. This should be the total number of bytes sent + // over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and + // HTTP/3), headers, and response body and trailers if any. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1437 + HTTPResponseSizeKey = attribute.Key("http.response.size") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status + // code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 200 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route, that is, the path + // template in the format used by the respective server framework. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/docs/http/http-spans.md#http-server-definitions) if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +var ( + // active state + HTTPConnectionStateActive = HTTPConnectionStateKey.String("active") + // idle state + HTTPConnectionStateIdle = HTTPConnectionStateKey.String("idle") +) + +var ( + // CONNECT method + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestResendCount returns an attribute KeyValue conforming to the +// "http.request.resend_count" semantic conventions. It represents the ordinal +// number of request resending attempt (for any reason, including redirects). +func HTTPRequestResendCount(val int) attribute.KeyValue { + return HTTPRequestResendCountKey.Int(val) +} + +// HTTPRequestSize returns an attribute KeyValue conforming to the +// "http.request.size" semantic conventions. It represents the total size of +// the request in bytes. This should be the total number of bytes sent over the +// wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), +// headers, and request body if any. +func HTTPRequestSize(val int) attribute.KeyValue { + return HTTPRequestSizeKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of +// the response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// HTTPResponseSize returns an attribute KeyValue conforming to the +// "http.response.size" semantic conventions. It represents the total size of +// the response in bytes. This should be the total number of bytes sent over +// the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), +// headers, and response body and trailers if any. +func HTTPResponseSize(val int) attribute.KeyValue { + return HTTPResponseSizeKey.Int(val) +} + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the [HTTP +// response status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route, that is, the path +// template in the format used by the respective server framework. +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Java Virtual machine related attributes. +const ( + // JvmBufferPoolNameKey is the attribute Key conforming to the + // "jvm.buffer.pool.name" semantic conventions. It represents the name of + // the buffer pool. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mapped', 'direct' + // Note: Pool names are generally obtained via + // [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). + JvmBufferPoolNameKey = attribute.Key("jvm.buffer.pool.name") + + // JvmGcActionKey is the attribute Key conforming to the "jvm.gc.action" + // semantic conventions. It represents the name of the garbage collector + // action. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'end of minor GC', 'end of major GC' + // Note: Garbage collector action is generally obtained via + // [GarbageCollectionNotificationInfo#getGcAction()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcAction()). + JvmGcActionKey = attribute.Key("jvm.gc.action") + + // JvmGcNameKey is the attribute Key conforming to the "jvm.gc.name" + // semantic conventions. It represents the name of the garbage collector. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'G1 Young Generation', 'G1 Old Generation' + // Note: Garbage collector name is generally obtained via + // [GarbageCollectionNotificationInfo#getGcName()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcName()). + JvmGcNameKey = attribute.Key("jvm.gc.name") + + // JvmMemoryPoolNameKey is the attribute Key conforming to the + // "jvm.memory.pool.name" semantic conventions. It represents the name of + // the memory pool. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' + // Note: Pool names are generally obtained via + // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + JvmMemoryPoolNameKey = attribute.Key("jvm.memory.pool.name") + + // JvmMemoryTypeKey is the attribute Key conforming to the + // "jvm.memory.type" semantic conventions. It represents the type of + // memory. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'heap', 'non_heap' + JvmMemoryTypeKey = attribute.Key("jvm.memory.type") + + // JvmThreadDaemonKey is the attribute Key conforming to the + // "jvm.thread.daemon" semantic conventions. It represents the whether the + // thread is daemon or not. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + JvmThreadDaemonKey = attribute.Key("jvm.thread.daemon") + + // JvmThreadStateKey is the attribute Key conforming to the + // "jvm.thread.state" semantic conventions. It represents the state of the + // thread. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'runnable', 'blocked' + JvmThreadStateKey = attribute.Key("jvm.thread.state") +) + +var ( + // Heap memory + JvmMemoryTypeHeap = JvmMemoryTypeKey.String("heap") + // Non-heap memory + JvmMemoryTypeNonHeap = JvmMemoryTypeKey.String("non_heap") +) + +var ( + // A thread that has not yet started is in this state + JvmThreadStateNew = JvmThreadStateKey.String("new") + // A thread executing in the Java virtual machine is in this state + JvmThreadStateRunnable = JvmThreadStateKey.String("runnable") + // A thread that is blocked waiting for a monitor lock is in this state + JvmThreadStateBlocked = JvmThreadStateKey.String("blocked") + // A thread that is waiting indefinitely for another thread to perform a particular action is in this state + JvmThreadStateWaiting = JvmThreadStateKey.String("waiting") + // A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state + JvmThreadStateTimedWaiting = JvmThreadStateKey.String("timed_waiting") + // A thread that has exited is in this state + JvmThreadStateTerminated = JvmThreadStateKey.String("terminated") +) + +// JvmBufferPoolName returns an attribute KeyValue conforming to the +// "jvm.buffer.pool.name" semantic conventions. It represents the name of the +// buffer pool. +func JvmBufferPoolName(val string) attribute.KeyValue { + return JvmBufferPoolNameKey.String(val) +} + +// JvmGcAction returns an attribute KeyValue conforming to the +// "jvm.gc.action" semantic conventions. It represents the name of the garbage +// collector action. +func JvmGcAction(val string) attribute.KeyValue { + return JvmGcActionKey.String(val) +} + +// JvmGcName returns an attribute KeyValue conforming to the "jvm.gc.name" +// semantic conventions. It represents the name of the garbage collector. +func JvmGcName(val string) attribute.KeyValue { + return JvmGcNameKey.String(val) +} + +// JvmMemoryPoolName returns an attribute KeyValue conforming to the +// "jvm.memory.pool.name" semantic conventions. It represents the name of the +// memory pool. +func JvmMemoryPoolName(val string) attribute.KeyValue { + return JvmMemoryPoolNameKey.String(val) +} + +// JvmThreadDaemon returns an attribute KeyValue conforming to the +// "jvm.thread.daemon" semantic conventions. It represents the whether the +// thread is daemon or not. +func JvmThreadDaemon(val bool) attribute.KeyValue { + return JvmThreadDaemonKey.Bool(val) +} + +// Kubernetes resource attributes. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the + // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for + // the cluster, set to the UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' + // Note: K8S doesn't have support for obtaining a cluster ID. If this is + // ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8S cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8S ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T + // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // different from all other UUIDs generated before 3603 A.D., or is + // extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") + + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") + + // K8SContainerStatusLastTerminatedReasonKey is the attribute Key + // conforming to the "k8s.container.status.last_terminated_reason" semantic + // conventions. It represents the last terminated reason of the Container. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Evicted', 'Error' + K8SContainerStatusLastTerminatedReasonKey = attribute.Key("k8s.container.status.last_terminated_reason") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") + + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") + + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") + + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") + + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") + + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") + + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") + + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") + + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// K8SContainerStatusLastTerminatedReason returns an attribute KeyValue +// conforming to the "k8s.container.status.last_terminated_reason" semantic +// conventions. It represents the last terminated reason of the Container. +func K8SContainerStatusLastTerminatedReason(val string) attribute.KeyValue { + return K8SContainerStatusLastTerminatedReasonKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// Log attributes +const ( + // LogIostreamKey is the attribute Key conforming to the "log.iostream" + // semantic conventions. It represents the stream associated with the log. + // See below for a list of well-known values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + LogIostreamKey = attribute.Key("log.iostream") +) + +var ( + // Logs from stdout stream + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// Attributes for a file to which log was emitted. +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'audit.log' + LogFileNameKey = attribute.Key("log.file.name") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the + // basename of the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'uuid.log' + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/log/mysql/audit.log' + LogFilePathKey = attribute.Key("log.file.path") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full + // path to the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/lib/docker/uuid.log' + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") +) + +// LogFileName returns an attribute KeyValue conforming to the +// "log.file.name" semantic conventions. It represents the basename of the +// file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the +// "log.file.path" semantic conventions. It represents the full path to the +// file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path +// to the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// The generic attributes that may be used in any Log Record. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Attributes describing telemetry around messaging systems and messaging +// activities. +const ( + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client.id" semantic conventions. It represents a unique + // identifier for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'client-5', 'myhost@8742@s8083jm' + MessagingClientIDKey = attribute.Key("messaging.client.id") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") + + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker doesn't have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationPartitionIDKey is the attribute Key conforming to + // the "messaging.destination.partition.id" semantic conventions. It + // represents the identifier of the partition messages are sent to or + // received from, unique within the `messaging.destination.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1' + MessagingDestinationPartitionIDKey = attribute.Key("messaging.destination.partition.id") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationPublishAnonymousKey is the attribute Key conforming + // to the "messaging.destination_publish.anonymous" semantic conventions. + // It represents a boolean that is true if the publish message destination + // is anonymous (could be unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationPublishAnonymousKey = attribute.Key("messaging.destination_publish.anonymous") + + // MessagingDestinationPublishNameKey is the attribute Key conforming to + // the "messaging.destination_publish.name" semantic conventions. It + // represents the name of the original destination the message was + // published to + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: The name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker doesn't have such notion, the original destination name + // SHOULD uniquely identify the broker. + MessagingDestinationPublishNameKey = attribute.Key("messaging.destination_publish.name") + + // MessagingMessageBodySizeKey is the attribute Key conforming to the + // "messaging.message.body.size" semantic conventions. It represents the + // size of the message body in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1439 + // Note: This can refer to both the compressed or uncompressed body size. + // If both sizes are known, the uncompressed + // body size should be used. + MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the conversation ID identifying the conversation to which the message + // belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the + // "messaging.message.envelope.size" semantic conventions. It represents + // the size of the message body and metadata in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2738 + // Note: This can refer to both the compressed or uncompressed size. If + // both sizes are known, the uncompressed + // size should be used. + MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") + + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingOperationNameKey is the attribute Key conforming to the + // "messaging.operation.name" semantic conventions. It represents the + // system-specific name of the messaging operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ack', 'nack', 'send' + MessagingOperationNameKey = attribute.Key("messaging.operation.name") + + // MessagingOperationTypeKey is the attribute Key conforming to the + // "messaging.operation.type" semantic conventions. It represents a string + // identifying the type of the messaging operation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationTypeKey = attribute.Key("messaging.operation.type") + + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents the messaging + // system as identified by the client instrumentation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The actual messaging system may differ from the one known by the + // client. For example, when using Kafka client libraries to communicate + // with Azure Event Hubs, the `messaging.system` is set to `kafka` based on + // the instrumentation's best knowledge. + MessagingSystemKey = attribute.Key("messaging.system") +) + +var ( + // One or more messages are provided for publishing to an intermediary. If a single message is published, the context of the "Publish" span can be used as the creation context and no "Create" span needs to be created + MessagingOperationTypePublish = MessagingOperationTypeKey.String("publish") + // A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch publishing scenarios + MessagingOperationTypeCreate = MessagingOperationTypeKey.String("create") + // One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages + MessagingOperationTypeReceive = MessagingOperationTypeKey.String("receive") + // One or more messages are delivered to or processed by a consumer + MessagingOperationTypeDeliver = MessagingOperationTypeKey.String("process") + // One or more messages are settled + MessagingOperationTypeSettle = MessagingOperationTypeKey.String("settle") +) + +var ( + // Apache ActiveMQ + MessagingSystemActivemq = MessagingSystemKey.String("activemq") + // Amazon Simple Queue Service (SQS) + MessagingSystemAWSSqs = MessagingSystemKey.String("aws_sqs") + // Azure Event Grid + MessagingSystemEventgrid = MessagingSystemKey.String("eventgrid") + // Azure Event Hubs + MessagingSystemEventhubs = MessagingSystemKey.String("eventhubs") + // Azure Service Bus + MessagingSystemServicebus = MessagingSystemKey.String("servicebus") + // Google Cloud Pub/Sub + MessagingSystemGCPPubsub = MessagingSystemKey.String("gcp_pubsub") + // Java Message Service + MessagingSystemJms = MessagingSystemKey.String("jms") + // Apache Kafka + MessagingSystemKafka = MessagingSystemKey.String("kafka") + // RabbitMQ + MessagingSystemRabbitmq = MessagingSystemKey.String("rabbitmq") + // Apache RocketMQ + MessagingSystemRocketmq = MessagingSystemKey.String("rocketmq") +) + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client.id" semantic conventions. It represents a unique +// identifier for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationPartitionID returns an attribute KeyValue conforming +// to the "messaging.destination.partition.id" semantic conventions. It +// represents the identifier of the partition messages are sent to or received +// from, unique within the `messaging.destination.name`. +func MessagingDestinationPartitionID(val string) attribute.KeyValue { + return MessagingDestinationPartitionIDKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationPublishAnonymous returns an attribute KeyValue +// conforming to the "messaging.destination_publish.anonymous" semantic +// conventions. It represents a boolean that is true if the publish message +// destination is anonymous (could be unnamed or have auto-generated name). +func MessagingDestinationPublishAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationPublishAnonymousKey.Bool(val) +} + +// MessagingDestinationPublishName returns an attribute KeyValue conforming +// to the "messaging.destination_publish.name" semantic conventions. It +// represents the name of the original destination the message was published to +func MessagingDestinationPublishName(val string) attribute.KeyValue { + return MessagingDestinationPublishNameKey.String(val) +} + +// MessagingMessageBodySize returns an attribute KeyValue conforming to the +// "messaging.message.body.size" semantic conventions. It represents the size +// of the message body in bytes. +func MessagingMessageBodySize(val int) attribute.KeyValue { + return MessagingMessageBodySizeKey.Int(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the conversation ID identifying the conversation to which the +// message belongs, represented as a string. Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to +// the "messaging.message.envelope.size" semantic conventions. It represents +// the size of the message body and metadata in bytes. +func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { + return MessagingMessageEnvelopeSizeKey.Int(val) +} + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingOperationName returns an attribute KeyValue conforming to the +// "messaging.operation.name" semantic conventions. It represents the +// system-specific name of the messaging operation. +func MessagingOperationName(val string) attribute.KeyValue { + return MessagingOperationNameKey.String(val) +} + +// This group describes attributes specific to Apache Kafka. +const ( + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// This group describes attributes specific to RabbitMQ. +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") + + // MessagingRabbitmqMessageDeliveryTagKey is the attribute Key conforming + // to the "messaging.rabbitmq.message.delivery_tag" semantic conventions. + // It represents the rabbitMQ message delivery tag + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 123 + MessagingRabbitmqMessageDeliveryTagKey = attribute.Key("messaging.rabbitmq.message.delivery_tag") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// MessagingRabbitmqMessageDeliveryTag returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.message.delivery_tag" semantic +// conventions. It represents the rabbitMQ message delivery tag +func MessagingRabbitmqMessageDeliveryTag(val int) attribute.KeyValue { + return MessagingRabbitmqMessageDeliveryTagKey.Int(val) +} + +// This group describes attributes specific to RocketMQ. +const ( + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// This group describes attributes specific to GCP Pub/Sub. +const ( + // MessagingGCPPubsubMessageAckDeadlineKey is the attribute Key conforming + // to the "messaging.gcp_pubsub.message.ack_deadline" semantic conventions. + // It represents the ack deadline in seconds set for the modify ack + // deadline request. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + MessagingGCPPubsubMessageAckDeadlineKey = attribute.Key("messaging.gcp_pubsub.message.ack_deadline") + + // MessagingGCPPubsubMessageAckIDKey is the attribute Key conforming to the + // "messaging.gcp_pubsub.message.ack_id" semantic conventions. It + // represents the ack id for a given message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ack_id' + MessagingGCPPubsubMessageAckIDKey = attribute.Key("messaging.gcp_pubsub.message.ack_id") + + // MessagingGCPPubsubMessageDeliveryAttemptKey is the attribute Key + // conforming to the "messaging.gcp_pubsub.message.delivery_attempt" + // semantic conventions. It represents the delivery attempt for a given + // message. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2 + MessagingGCPPubsubMessageDeliveryAttemptKey = attribute.Key("messaging.gcp_pubsub.message.delivery_attempt") + + // MessagingGCPPubsubMessageOrderingKeyKey is the attribute Key conforming + // to the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. + // It represents the ordering key for a given message. If the attribute is + // not present, the message does not have an ordering key. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ordering_key' + MessagingGCPPubsubMessageOrderingKeyKey = attribute.Key("messaging.gcp_pubsub.message.ordering_key") +) + +// MessagingGCPPubsubMessageAckDeadline returns an attribute KeyValue +// conforming to the "messaging.gcp_pubsub.message.ack_deadline" semantic +// conventions. It represents the ack deadline in seconds set for the modify +// ack deadline request. +func MessagingGCPPubsubMessageAckDeadline(val int) attribute.KeyValue { + return MessagingGCPPubsubMessageAckDeadlineKey.Int(val) +} + +// MessagingGCPPubsubMessageAckID returns an attribute KeyValue conforming +// to the "messaging.gcp_pubsub.message.ack_id" semantic conventions. It +// represents the ack id for a given message. +func MessagingGCPPubsubMessageAckID(val string) attribute.KeyValue { + return MessagingGCPPubsubMessageAckIDKey.String(val) +} + +// MessagingGCPPubsubMessageDeliveryAttempt returns an attribute KeyValue +// conforming to the "messaging.gcp_pubsub.message.delivery_attempt" semantic +// conventions. It represents the delivery attempt for a given message. +func MessagingGCPPubsubMessageDeliveryAttempt(val int) attribute.KeyValue { + return MessagingGCPPubsubMessageDeliveryAttemptKey.Int(val) +} + +// MessagingGCPPubsubMessageOrderingKey returns an attribute KeyValue +// conforming to the "messaging.gcp_pubsub.message.ordering_key" semantic +// conventions. It represents the ordering key for a given message. If the +// attribute is not present, the message does not have an ordering key. +func MessagingGCPPubsubMessageOrderingKey(val string) attribute.KeyValue { + return MessagingGCPPubsubMessageOrderingKeyKey.String(val) +} + +// This group describes attributes specific to Azure Service Bus. +const ( + // MessagingServicebusDestinationSubscriptionNameKey is the attribute Key + // conforming to the "messaging.servicebus.destination.subscription_name" + // semantic conventions. It represents the name of the subscription in the + // topic messages are received from. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mySubscription' + MessagingServicebusDestinationSubscriptionNameKey = attribute.Key("messaging.servicebus.destination.subscription_name") + + // MessagingServicebusDispositionStatusKey is the attribute Key conforming + // to the "messaging.servicebus.disposition_status" semantic conventions. + // It represents the describes the [settlement + // type](https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingServicebusDispositionStatusKey = attribute.Key("messaging.servicebus.disposition_status") + + // MessagingServicebusMessageDeliveryCountKey is the attribute Key + // conforming to the "messaging.servicebus.message.delivery_count" semantic + // conventions. It represents the number of deliveries that have been + // attempted for this message. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2 + MessagingServicebusMessageDeliveryCountKey = attribute.Key("messaging.servicebus.message.delivery_count") + + // MessagingServicebusMessageEnqueuedTimeKey is the attribute Key + // conforming to the "messaging.servicebus.message.enqueued_time" semantic + // conventions. It represents the UTC epoch seconds at which the message + // has been accepted and stored in the entity. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1701393730 + MessagingServicebusMessageEnqueuedTimeKey = attribute.Key("messaging.servicebus.message.enqueued_time") +) + +var ( + // Message is completed + MessagingServicebusDispositionStatusComplete = MessagingServicebusDispositionStatusKey.String("complete") + // Message is abandoned + MessagingServicebusDispositionStatusAbandon = MessagingServicebusDispositionStatusKey.String("abandon") + // Message is sent to dead letter queue + MessagingServicebusDispositionStatusDeadLetter = MessagingServicebusDispositionStatusKey.String("dead_letter") + // Message is deferred + MessagingServicebusDispositionStatusDefer = MessagingServicebusDispositionStatusKey.String("defer") +) + +// MessagingServicebusDestinationSubscriptionName returns an attribute +// KeyValue conforming to the +// "messaging.servicebus.destination.subscription_name" semantic conventions. +// It represents the name of the subscription in the topic messages are +// received from. +func MessagingServicebusDestinationSubscriptionName(val string) attribute.KeyValue { + return MessagingServicebusDestinationSubscriptionNameKey.String(val) +} + +// MessagingServicebusMessageDeliveryCount returns an attribute KeyValue +// conforming to the "messaging.servicebus.message.delivery_count" semantic +// conventions. It represents the number of deliveries that have been attempted +// for this message. +func MessagingServicebusMessageDeliveryCount(val int) attribute.KeyValue { + return MessagingServicebusMessageDeliveryCountKey.Int(val) +} + +// MessagingServicebusMessageEnqueuedTime returns an attribute KeyValue +// conforming to the "messaging.servicebus.message.enqueued_time" semantic +// conventions. It represents the UTC epoch seconds at which the message has +// been accepted and stored in the entity. +func MessagingServicebusMessageEnqueuedTime(val int) attribute.KeyValue { + return MessagingServicebusMessageEnqueuedTimeKey.Int(val) +} + +// This group describes attributes specific to Azure Event Hubs. +const ( + // MessagingEventhubsConsumerGroupKey is the attribute Key conforming to + // the "messaging.eventhubs.consumer.group" semantic conventions. It + // represents the name of the consumer group the event consumer is + // associated with. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'indexer' + MessagingEventhubsConsumerGroupKey = attribute.Key("messaging.eventhubs.consumer.group") + + // MessagingEventhubsMessageEnqueuedTimeKey is the attribute Key conforming + // to the "messaging.eventhubs.message.enqueued_time" semantic conventions. + // It represents the UTC epoch seconds at which the message has been + // accepted and stored in the entity. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1701393730 + MessagingEventhubsMessageEnqueuedTimeKey = attribute.Key("messaging.eventhubs.message.enqueued_time") +) + +// MessagingEventhubsConsumerGroup returns an attribute KeyValue conforming +// to the "messaging.eventhubs.consumer.group" semantic conventions. It +// represents the name of the consumer group the event consumer is associated +// with. +func MessagingEventhubsConsumerGroup(val string) attribute.KeyValue { + return MessagingEventhubsConsumerGroupKey.String(val) +} + +// MessagingEventhubsMessageEnqueuedTime returns an attribute KeyValue +// conforming to the "messaging.eventhubs.message.enqueued_time" semantic +// conventions. It represents the UTC epoch seconds at which the message has +// been accepted and stored in the entity. +func MessagingEventhubsMessageEnqueuedTime(val int) attribute.KeyValue { + return MessagingEventhubsMessageEnqueuedTimeKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkCarrierIccKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier + // network. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'DE' + NetworkCarrierIccKey = attribute.Key("network.carrier.icc") + + // NetworkCarrierMccKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '310' + NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMncKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '001' + NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'sprint' + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'LTE' + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the + // internet connection type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'wifi' + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkIoDirectionKey is the attribute Key conforming to the + // "network.io.direction" semantic conventions. It represents the network + // IO operation direction. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'transmit' + NetworkIoDirectionKey = attribute.Key("network.io.direction") + + // NetworkLocalAddressKey is the attribute Key conforming to the + // "network.local.address" semantic conventions. It represents the local + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkLocalAddressKey = attribute.Key("network.local.address") + + // NetworkLocalPortKey is the attribute Key conforming to the + // "network.local.port" semantic conventions. It represents the local port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkLocalPortKey = attribute.Key("network.local.port") + + // NetworkPeerAddressKey is the attribute Key conforming to the + // "network.peer.address" semantic conventions. It represents the peer + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkPeerAddressKey = attribute.Key("network.peer.address") + + // NetworkPeerPortKey is the attribute Key conforming to the + // "network.peer.port" semantic conventions. It represents the peer port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkPeerPortKey = attribute.Key("network.peer.port") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the [OSI + // application layer](https://osi-model.com/application-layer/) or non-OSI + // equivalent. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + // Note: The value SHOULD be normalized to lowercase. + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the + // actual version of the protocol used for network communication. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.1', '2' + // Note: If protocol version is subject to negotiation (for example using + // [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute + // SHOULD be set to the negotiated version. If the actual protocol version + // is not known, this attribute SHOULD NOT be set. + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") + + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the [OSI + // transport layer](https://osi-model.com/transport-layer/) or + // [inter-process communication + // method](https://wikipedia.org/wiki/Inter-process_communication). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tcp', 'udp' + // Note: The value SHOULD be normalized to lowercase. + // + // Consider always setting the transport when setting a port number, since + // a port number is ambiguous without knowing the transport. For example + // different processes could be listening on TCP port 12345 and UDP port + // 12345. + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" + // semantic conventions. It represents the [OSI network + // layer](https://osi-model.com/network-layer/) or non-OSI equivalent. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ipv4', 'ipv6' + // Note: The value SHOULD be normalized to lowercase. + NetworkTypeKey = attribute.Key("network.type") +) + +var ( + // GPRS + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +var ( + // wifi + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +var ( + // transmit + NetworkIoDirectionTransmit = NetworkIoDirectionKey.String("transmit") + // receive + NetworkIoDirectionReceive = NetworkIoDirectionKey.String("receive") +) + +var ( + // TCP + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + NetworkTransportUnix = NetworkTransportKey.String("unix") +) + +var ( + // IPv4 + NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") + // IPv6 + NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") +) + +// NetworkCarrierIcc returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierIcc(val string) attribute.KeyValue { + return NetworkCarrierIccKey.String(val) +} + +// NetworkCarrierMcc returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMcc(val string) attribute.KeyValue { + return NetworkCarrierMccKey.String(val) +} + +// NetworkCarrierMnc returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMnc(val string) attribute.KeyValue { + return NetworkCarrierMncKey.String(val) +} + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkLocalAddress returns an attribute KeyValue conforming to the +// "network.local.address" semantic conventions. It represents the local +// address of the network connection - IP address or Unix domain socket name. +func NetworkLocalAddress(val string) attribute.KeyValue { + return NetworkLocalAddressKey.String(val) +} + +// NetworkLocalPort returns an attribute KeyValue conforming to the +// "network.local.port" semantic conventions. It represents the local port +// number of the network connection. +func NetworkLocalPort(val int) attribute.KeyValue { + return NetworkLocalPortKey.Int(val) +} + +// NetworkPeerAddress returns an attribute KeyValue conforming to the +// "network.peer.address" semantic conventions. It represents the peer address +// of the network connection - IP address or Unix domain socket name. +func NetworkPeerAddress(val string) attribute.KeyValue { + return NetworkPeerAddressKey.String(val) +} + +// NetworkPeerPort returns an attribute KeyValue conforming to the +// "network.peer.port" semantic conventions. It represents the peer port number +// of the network connection. +func NetworkPeerPort(val int) attribute.KeyValue { + return NetworkPeerPortKey.Int(val) +} + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the [OSI +// application layer](https://osi-model.com/application-layer/) or non-OSI +// equivalent. +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the actual +// version of the protocol used for network communication. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// An OCI image manifest. +const ( + // OciManifestDigestKey is the attribute Key conforming to the + // "oci.manifest.digest" semantic conventions. It represents the digest of + // the OCI image manifest. For container images specifically is the digest + // by which the container image is known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4' + // Note: Follows [OCI Image Manifest + // Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), + // and specifically the [Digest + // property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). + // An example can be found in [Example Image + // Manifest](https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest). + OciManifestDigestKey = attribute.Key("oci.manifest.digest") +) + +// OciManifestDigest returns an attribute KeyValue conforming to the +// "oci.manifest.digest" semantic conventions. It represents the digest of the +// OCI image manifest. For container images specifically is the digest by which +// the container image is known. +func OciManifestDigest(val string) attribute.KeyValue { + return OciManifestDigestKey.String(val) +} + +// Attributes used by the OpenTracing Shim layer. +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span doesn't depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSBuildIDKey is the attribute Key conforming to the "os.build_id" + // semantic conventions. It represents the unique identifier for a + // particular build or compilation of the operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TQ3C.230805.001.B2', '20E247', '22621' + OSBuildIDKey = attribute.Key("os.build_id") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + OSTypeKey = attribute.Key("os.type") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the operating system. +func OSBuildID(val string) attribute.KeyValue { + return OSBuildIDKey.String(val) +} + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// Attributes reserved for OpenTelemetry +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](/docs/resource/README.md#service) of the remote + // service. SHOULD be equal to the actual `service.name` resource attribute + // of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](/docs/resource/README.md#service) of the remote service. +// SHOULD be equal to the actual `service.name` resource attribute of the +// remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// An operating system process. +const ( + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessContextSwitchTypeKey is the attribute Key conforming to the + // "process.context_switch_type" semantic conventions. It represents the + // specifies whether the context switches for this data point were + // voluntary or involuntary. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + ProcessContextSwitchTypeKey = attribute.Key("process.context_switch_type") + + // ProcessCreationTimeKey is the attribute Key conforming to the + // "process.creation.time" semantic conventions. It represents the date and + // time the process was created, in ISO 8601 format. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2023-11-21T09:25:34.853Z' + ProcessCreationTimeKey = attribute.Key("process.creation.time") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessExitCodeKey is the attribute Key conforming to the + // "process.exit.code" semantic conventions. It represents the exit code of + // the process. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 127 + ProcessExitCodeKey = attribute.Key("process.exit.code") + + // ProcessExitTimeKey is the attribute Key conforming to the + // "process.exit.time" semantic conventions. It represents the date and + // time the process exited, in ISO 8601 format. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2023-11-21T09:26:12.315Z' + ProcessExitTimeKey = attribute.Key("process.exit.time") + + // ProcessGroupLeaderPIDKey is the attribute Key conforming to the + // "process.group_leader.pid" semantic conventions. It represents the PID + // of the process's group leader. This is also the process group ID (PGID) + // of the process. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 23 + ProcessGroupLeaderPIDKey = attribute.Key("process.group_leader.pid") + + // ProcessInteractiveKey is the attribute Key conforming to the + // "process.interactive" semantic conventions. It represents the whether + // the process is connected to an interactive shell. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + ProcessInteractiveKey = attribute.Key("process.interactive") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") + + // ProcessPagingFaultTypeKey is the attribute Key conforming to the + // "process.paging.fault_type" semantic conventions. It represents the type + // of page fault for this data point. Type `major` is for major/hard page + // faults, and `minor` is for minor/soft page faults. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + ProcessPagingFaultTypeKey = attribute.Key("process.paging.fault_type") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PPID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessRealUserIDKey is the attribute Key conforming to the + // "process.real_user.id" semantic conventions. It represents the real user + // ID (RUID) of the process. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1000 + ProcessRealUserIDKey = attribute.Key("process.real_user.id") + + // ProcessRealUserNameKey is the attribute Key conforming to the + // "process.real_user.name" semantic conventions. It represents the + // username of the real user of the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'operator' + ProcessRealUserNameKey = attribute.Key("process.real_user.name") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") + + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessSavedUserIDKey is the attribute Key conforming to the + // "process.saved_user.id" semantic conventions. It represents the saved + // user ID (SUID) of the process. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1002 + ProcessSavedUserIDKey = attribute.Key("process.saved_user.id") + + // ProcessSavedUserNameKey is the attribute Key conforming to the + // "process.saved_user.name" semantic conventions. It represents the + // username of the saved user. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'operator' + ProcessSavedUserNameKey = attribute.Key("process.saved_user.name") + + // ProcessSessionLeaderPIDKey is the attribute Key conforming to the + // "process.session_leader.pid" semantic conventions. It represents the PID + // of the process's session leader. This is also the session ID (SID) of + // the process. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 14 + ProcessSessionLeaderPIDKey = attribute.Key("process.session_leader.pid") + + // ProcessUserIDKey is the attribute Key conforming to the + // "process.user.id" semantic conventions. It represents the effective user + // ID (EUID) of the process. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1001 + ProcessUserIDKey = attribute.Key("process.user.id") + + // ProcessUserNameKey is the attribute Key conforming to the + // "process.user.name" semantic conventions. It represents the username of + // the effective user of the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'root' + ProcessUserNameKey = attribute.Key("process.user.name") + + // ProcessVpidKey is the attribute Key conforming to the "process.vpid" + // semantic conventions. It represents the virtual process identifier. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 12 + // Note: The process ID within a PID namespace. This is not necessarily + // unique across all processes on the host but it is unique within the + // process namespace that the process exists within. + ProcessVpidKey = attribute.Key("process.vpid") +) + +var ( + // voluntary + ProcessContextSwitchTypeVoluntary = ProcessContextSwitchTypeKey.String("voluntary") + // involuntary + ProcessContextSwitchTypeInvoluntary = ProcessContextSwitchTypeKey.String("involuntary") +) + +var ( + // major + ProcessPagingFaultTypeMajor = ProcessPagingFaultTypeKey.String("major") + // minor + ProcessPagingFaultTypeMinor = ProcessPagingFaultTypeKey.String("minor") +) + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCreationTime returns an attribute KeyValue conforming to the +// "process.creation.time" semantic conventions. It represents the date and +// time the process was created, in ISO 8601 format. +func ProcessCreationTime(val string) attribute.KeyValue { + return ProcessCreationTimeKey.String(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessExitCode returns an attribute KeyValue conforming to the +// "process.exit.code" semantic conventions. It represents the exit code of the +// process. +func ProcessExitCode(val int) attribute.KeyValue { + return ProcessExitCodeKey.Int(val) +} + +// ProcessExitTime returns an attribute KeyValue conforming to the +// "process.exit.time" semantic conventions. It represents the date and time +// the process exited, in ISO 8601 format. +func ProcessExitTime(val string) attribute.KeyValue { + return ProcessExitTimeKey.String(val) +} + +// ProcessGroupLeaderPID returns an attribute KeyValue conforming to the +// "process.group_leader.pid" semantic conventions. It represents the PID of +// the process's group leader. This is also the process group ID (PGID) of the +// process. +func ProcessGroupLeaderPID(val int) attribute.KeyValue { + return ProcessGroupLeaderPIDKey.Int(val) +} + +// ProcessInteractive returns an attribute KeyValue conforming to the +// "process.interactive" semantic conventions. It represents the whether the +// process is connected to an interactive shell. +func ProcessInteractive(val bool) attribute.KeyValue { + return ProcessInteractiveKey.Bool(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PPID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessRealUserID returns an attribute KeyValue conforming to the +// "process.real_user.id" semantic conventions. It represents the real user ID +// (RUID) of the process. +func ProcessRealUserID(val int) attribute.KeyValue { + return ProcessRealUserIDKey.Int(val) +} + +// ProcessRealUserName returns an attribute KeyValue conforming to the +// "process.real_user.name" semantic conventions. It represents the username of +// the real user of the process. +func ProcessRealUserName(val string) attribute.KeyValue { + return ProcessRealUserNameKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessSavedUserID returns an attribute KeyValue conforming to the +// "process.saved_user.id" semantic conventions. It represents the saved user +// ID (SUID) of the process. +func ProcessSavedUserID(val int) attribute.KeyValue { + return ProcessSavedUserIDKey.Int(val) +} + +// ProcessSavedUserName returns an attribute KeyValue conforming to the +// "process.saved_user.name" semantic conventions. It represents the username +// of the saved user. +func ProcessSavedUserName(val string) attribute.KeyValue { + return ProcessSavedUserNameKey.String(val) +} + +// ProcessSessionLeaderPID returns an attribute KeyValue conforming to the +// "process.session_leader.pid" semantic conventions. It represents the PID of +// the process's session leader. This is also the session ID (SID) of the +// process. +func ProcessSessionLeaderPID(val int) attribute.KeyValue { + return ProcessSessionLeaderPIDKey.Int(val) +} + +// ProcessUserID returns an attribute KeyValue conforming to the +// "process.user.id" semantic conventions. It represents the effective user ID +// (EUID) of the process. +func ProcessUserID(val int) attribute.KeyValue { + return ProcessUserIDKey.Int(val) +} + +// ProcessUserName returns an attribute KeyValue conforming to the +// "process.user.name" semantic conventions. It represents the username of the +// effective user of the process. +func ProcessUserName(val string) attribute.KeyValue { + return ProcessUserNameKey.String(val) +} + +// ProcessVpid returns an attribute KeyValue conforming to the +// "process.vpid" semantic conventions. It represents the virtual process +// identifier. +func ProcessVpid(val int) attribute.KeyValue { + return ProcessVpidKey.Int(val) +} + +// Attributes for process CPU +const ( + // ProcessCPUStateKey is the attribute Key conforming to the + // "process.cpu.state" semantic conventions. It represents the CPU state of + // the process. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + ProcessCPUStateKey = attribute.Key("process.cpu.state") +) + +var ( + // system + ProcessCPUStateSystem = ProcessCPUStateKey.String("system") + // user + ProcessCPUStateUser = ProcessCPUStateKey.String("user") + // wait + ProcessCPUStateWait = ProcessCPUStateKey.String("wait") +) + +// Attributes for remote procedure calls. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") + + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // doesn't specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCMessageCompressedSizeKey is the attribute Key conforming to the + // "rpc.message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + RPCMessageCompressedSizeKey = attribute.Key("rpc.message.compressed_size") + + // RPCMessageIDKey is the attribute Key conforming to the "rpc.message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Note: This way we guarantee that the values will be consistent between + // different implementations. + RPCMessageIDKey = attribute.Key("rpc.message.id") + + // RPCMessageTypeKey is the attribute Key conforming to the + // "rpc.message.type" semantic conventions. It represents the whether this + // is a received or sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCMessageTypeKey = attribute.Key("rpc.message.type") + + // RPCMessageUncompressedSizeKey is the attribute Key conforming to the + // "rpc.message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + RPCMessageUncompressedSizeKey = attribute.Key("rpc.message.uncompressed_size") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCSystemKey = attribute.Key("rpc.system") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +var ( + // sent + RPCMessageTypeSent = RPCMessageTypeKey.String("SENT") + // received + RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// doesn't specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCMessageCompressedSize returns an attribute KeyValue conforming to the +// "rpc.message.compressed_size" semantic conventions. It represents the +// compressed size of the message in bytes. +func RPCMessageCompressedSize(val int) attribute.KeyValue { + return RPCMessageCompressedSizeKey.Int(val) +} + +// RPCMessageID returns an attribute KeyValue conforming to the +// "rpc.message.id" semantic conventions. It represents the mUST be calculated +// as two different counters starting from `1` one for sent messages and one +// for received message. +func RPCMessageID(val int) attribute.KeyValue { + return RPCMessageIDKey.Int(val) +} + +// RPCMessageUncompressedSize returns an attribute KeyValue conforming to +// the "rpc.message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func RPCMessageUncompressedSize(val int) attribute.KeyValue { + return RPCMessageUncompressedSizeKey.Int(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// These attributes may be used to describe the server in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the server domain name if available + // without reverse DNS lookup; otherwise, IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.address` SHOULD represent the server address + // behind any intermediaries, for example proxies, if it's available. + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" + // semantic conventions. It represents the server port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.port` SHOULD represent the server port behind + // any intermediaries, for example proxies, if it's available. + ServerPortKey = attribute.Key("server.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the +// "server.address" semantic conventions. It represents the server domain name +// if available without reverse DNS lookup; otherwise, IP address or Unix +// domain socket name. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the server port number. +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// A service instance. +const ( + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to + // distinguish instances of the same service that exist at the same time + // (e.g. instances of a horizontally scaled + // service). + // + // Implementations, such as SDKs, are recommended to generate a random + // Version 1 or Version 4 [RFC + // 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an + // inherent unique ID as the source of + // this value if stability is desirable. In that case, the ID SHOULD be + // used as source of a UUID Version 5 and + // SHOULD use the following UUID as the namespace: + // `4d63009a-8d0f-11ee-aad7-4c796ed8e320`. + // + // UUIDs are typically recommended, as only an opaque value for the + // purposes of identifying a service instance is + // needed. Similar to what can be seen in the man page for the + // [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/machine-id.html) + // file, the underlying + // data, such as pod name and namespace should be treated as confidential, + // being the user's choice to expose it + // or not via another resource attribute. + // + // For applications running behind an application server (like unicorn), we + // do not recommend using one identifier + // for all processes participating in the application. Instead, it's + // recommended each division (e.g. a worker + // thread in unicorn) to have its own instance.id. + // + // It's not recommended for a Collector to set `service.instance.id` if it + // can't unambiguously determine the + // service instance that is generating that telemetry. For instance, + // creating an UUID based on `pod.name` will + // likely be wrong, as the Collector might not know from which container + // within that pod the telemetry originated. + // However, Collectors can set the `service.instance.id` if they can + // unambiguously determine the service instance + // for that telemetry. This is typically the case for scraping receivers, + // as they know the target address and + // port. + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md), e.g. `unknown_service:bash`. If + // `process.executable.name` is not available, the value MUST be set to + // `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. The format is not defined by these + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0', 'a01dbef8a' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// Session is defined as the period of time encompassing all activities +// performed by the application and the actions executed by the end user. +// Consequently, a Session is represented as a collection of Logs, Events, and +// Spans emitted by the Client Application throughout the Session's duration. +// Each Session is assigned a unique identifier, which is included as an +// attribute in the Logs, Events, and Spans generated during the Session's +// lifecycle. +// When a session reaches end of life, typically due to user inactivity or +// session timeout, a new session identifier will be assigned. The previous +// session identifier may be provided by the instrumentation so that telemetry +// backends can link the two sessions. +const ( + // SessionIDKey is the attribute Key conforming to the "session.id" + // semantic conventions. It represents a unique id to identify a session. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionIDKey = attribute.Key("session.id") + + // SessionPreviousIDKey is the attribute Key conforming to the + // "session.previous_id" semantic conventions. It represents the previous + // `session.id` for this user, when known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionPreviousIDKey = attribute.Key("session.previous_id") +) + +// SessionID returns an attribute KeyValue conforming to the "session.id" +// semantic conventions. It represents a unique id to identify a session. +func SessionID(val string) attribute.KeyValue { + return SessionIDKey.String(val) +} + +// SessionPreviousID returns an attribute KeyValue conforming to the +// "session.previous_id" semantic conventions. It represents the previous +// `session.id` for this user, when known. +func SessionPreviousID(val string) attribute.KeyValue { + return SessionPreviousIDKey.String(val) +} + +// SignalR attributes +const ( + // SignalrConnectionStatusKey is the attribute Key conforming to the + // "signalr.connection.status" semantic conventions. It represents the + // signalR HTTP connection closure status. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'app_shutdown', 'timeout' + SignalrConnectionStatusKey = attribute.Key("signalr.connection.status") + + // SignalrTransportKey is the attribute Key conforming to the + // "signalr.transport" semantic conventions. It represents the [SignalR + // transport + // type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'web_sockets', 'long_polling' + SignalrTransportKey = attribute.Key("signalr.transport") +) + +var ( + // The connection was closed normally + SignalrConnectionStatusNormalClosure = SignalrConnectionStatusKey.String("normal_closure") + // The connection was closed due to a timeout + SignalrConnectionStatusTimeout = SignalrConnectionStatusKey.String("timeout") + // The connection was closed because the app is shutting down + SignalrConnectionStatusAppShutdown = SignalrConnectionStatusKey.String("app_shutdown") +) + +var ( + // ServerSentEvents protocol + SignalrTransportServerSentEvents = SignalrTransportKey.String("server_sent_events") + // LongPolling protocol + SignalrTransportLongPolling = SignalrTransportKey.String("long_polling") + // WebSockets protocol + SignalrTransportWebSockets = SignalrTransportKey.String("web_sockets") +) + +// These attributes may be used to describe the sender of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'source.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the destination side, and when communicating + // through an intermediary, `source.address` SHOULD represent the source + // address behind any intermediaries, for example proxies, if it's + // available. + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" + // semantic conventions. It represents the source port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceAddress returns an attribute KeyValue conforming to the +// "source.address" semantic conventions. It represents the source address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} + +// Describes System attributes +const ( + // SystemDeviceKey is the attribute Key conforming to the "system.device" + // semantic conventions. It represents the device identifier + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '(identifier)' + SystemDeviceKey = attribute.Key("system.device") +) + +// SystemDevice returns an attribute KeyValue conforming to the +// "system.device" semantic conventions. It represents the device identifier +func SystemDevice(val string) attribute.KeyValue { + return SystemDeviceKey.String(val) +} + +// Describes System CPU attributes +const ( + // SystemCPULogicalNumberKey is the attribute Key conforming to the + // "system.cpu.logical_number" semantic conventions. It represents the + // logical CPU number [0..n-1] + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + SystemCPULogicalNumberKey = attribute.Key("system.cpu.logical_number") + + // SystemCPUStateKey is the attribute Key conforming to the + // "system.cpu.state" semantic conventions. It represents the state of the + // CPU + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'idle', 'interrupt' + SystemCPUStateKey = attribute.Key("system.cpu.state") +) + +var ( + // user + SystemCPUStateUser = SystemCPUStateKey.String("user") + // system + SystemCPUStateSystem = SystemCPUStateKey.String("system") + // nice + SystemCPUStateNice = SystemCPUStateKey.String("nice") + // idle + SystemCPUStateIdle = SystemCPUStateKey.String("idle") + // iowait + SystemCPUStateIowait = SystemCPUStateKey.String("iowait") + // interrupt + SystemCPUStateInterrupt = SystemCPUStateKey.String("interrupt") + // steal + SystemCPUStateSteal = SystemCPUStateKey.String("steal") +) + +// SystemCPULogicalNumber returns an attribute KeyValue conforming to the +// "system.cpu.logical_number" semantic conventions. It represents the logical +// CPU number [0..n-1] +func SystemCPULogicalNumber(val int) attribute.KeyValue { + return SystemCPULogicalNumberKey.Int(val) +} + +// Describes System Memory attributes +const ( + // SystemMemoryStateKey is the attribute Key conforming to the + // "system.memory.state" semantic conventions. It represents the memory + // state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free', 'cached' + SystemMemoryStateKey = attribute.Key("system.memory.state") +) + +var ( + // used + SystemMemoryStateUsed = SystemMemoryStateKey.String("used") + // free + SystemMemoryStateFree = SystemMemoryStateKey.String("free") + // shared + SystemMemoryStateShared = SystemMemoryStateKey.String("shared") + // buffers + SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") + // cached + SystemMemoryStateCached = SystemMemoryStateKey.String("cached") +) + +// Describes System Memory Paging attributes +const ( + // SystemPagingDirectionKey is the attribute Key conforming to the + // "system.paging.direction" semantic conventions. It represents the paging + // access direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'in' + SystemPagingDirectionKey = attribute.Key("system.paging.direction") + + // SystemPagingStateKey is the attribute Key conforming to the + // "system.paging.state" semantic conventions. It represents the memory + // paging state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free' + SystemPagingStateKey = attribute.Key("system.paging.state") + + // SystemPagingTypeKey is the attribute Key conforming to the + // "system.paging.type" semantic conventions. It represents the memory + // paging type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'minor' + SystemPagingTypeKey = attribute.Key("system.paging.type") +) + +var ( + // in + SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") + // out + SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") +) + +var ( + // used + SystemPagingStateUsed = SystemPagingStateKey.String("used") + // free + SystemPagingStateFree = SystemPagingStateKey.String("free") +) + +var ( + // major + SystemPagingTypeMajor = SystemPagingTypeKey.String("major") + // minor + SystemPagingTypeMinor = SystemPagingTypeKey.String("minor") +) + +// Describes Filesystem attributes +const ( + // SystemFilesystemModeKey is the attribute Key conforming to the + // "system.filesystem.mode" semantic conventions. It represents the + // filesystem mode + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'rw, ro' + SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") + + // SystemFilesystemMountpointKey is the attribute Key conforming to the + // "system.filesystem.mountpoint" semantic conventions. It represents the + // filesystem mount path + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/mnt/data' + SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") + + // SystemFilesystemStateKey is the attribute Key conforming to the + // "system.filesystem.state" semantic conventions. It represents the + // filesystem state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'used' + SystemFilesystemStateKey = attribute.Key("system.filesystem.state") + + // SystemFilesystemTypeKey is the attribute Key conforming to the + // "system.filesystem.type" semantic conventions. It represents the + // filesystem type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ext4' + SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") +) + +var ( + // used + SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") + // free + SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") + // reserved + SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") +) + +var ( + // fat32 + SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") + // exfat + SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") + // ntfs + SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") + // refs + SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") + // hfsplus + SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") + // ext4 + SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") +) + +// SystemFilesystemMode returns an attribute KeyValue conforming to the +// "system.filesystem.mode" semantic conventions. It represents the filesystem +// mode +func SystemFilesystemMode(val string) attribute.KeyValue { + return SystemFilesystemModeKey.String(val) +} + +// SystemFilesystemMountpoint returns an attribute KeyValue conforming to +// the "system.filesystem.mountpoint" semantic conventions. It represents the +// filesystem mount path +func SystemFilesystemMountpoint(val string) attribute.KeyValue { + return SystemFilesystemMountpointKey.String(val) +} + +// Describes Network attributes +const ( + // SystemNetworkStateKey is the attribute Key conforming to the + // "system.network.state" semantic conventions. It represents a stateless + // protocol MUST NOT set this attribute + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'close_wait' + SystemNetworkStateKey = attribute.Key("system.network.state") +) + +var ( + // close + SystemNetworkStateClose = SystemNetworkStateKey.String("close") + // close_wait + SystemNetworkStateCloseWait = SystemNetworkStateKey.String("close_wait") + // closing + SystemNetworkStateClosing = SystemNetworkStateKey.String("closing") + // delete + SystemNetworkStateDelete = SystemNetworkStateKey.String("delete") + // established + SystemNetworkStateEstablished = SystemNetworkStateKey.String("established") + // fin_wait_1 + SystemNetworkStateFinWait1 = SystemNetworkStateKey.String("fin_wait_1") + // fin_wait_2 + SystemNetworkStateFinWait2 = SystemNetworkStateKey.String("fin_wait_2") + // last_ack + SystemNetworkStateLastAck = SystemNetworkStateKey.String("last_ack") + // listen + SystemNetworkStateListen = SystemNetworkStateKey.String("listen") + // syn_recv + SystemNetworkStateSynRecv = SystemNetworkStateKey.String("syn_recv") + // syn_sent + SystemNetworkStateSynSent = SystemNetworkStateKey.String("syn_sent") + // time_wait + SystemNetworkStateTimeWait = SystemNetworkStateKey.String("time_wait") +) + +// Describes System Process attributes +const ( + // SystemProcessStatusKey is the attribute Key conforming to the + // "system.process.status" semantic conventions. It represents the process + // state, e.g., [Linux Process State + // Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'running' + SystemProcessStatusKey = attribute.Key("system.process.status") +) + +var ( + // running + SystemProcessStatusRunning = SystemProcessStatusKey.String("running") + // sleeping + SystemProcessStatusSleeping = SystemProcessStatusKey.String("sleeping") + // stopped + SystemProcessStatusStopped = SystemProcessStatusKey.String("stopped") + // defunct + SystemProcessStatusDefunct = SystemProcessStatusKey.String("defunct") +) + +// Attributes for telemetry SDK. +const ( + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'opentelemetry' + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute + // to `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is + // used, this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module + // name of this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this + // case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + + // TelemetryDistroNameKey is the attribute Key conforming to the + // "telemetry.distro.name" semantic conventions. It represents the name of + // the auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'parts-unlimited-java' + // Note: Official auto instrumentation agents and distributions SHOULD set + // the `telemetry.distro.name` attribute to + // a string starting with `opentelemetry-`, e.g. + // `opentelemetry-java-instrumentation`. + TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") + + // TelemetryDistroVersionKey is the attribute Key conforming to the + // "telemetry.distro.version" semantic conventions. It represents the + // version string of the auto instrumentation agent or distribution, if + // used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2.3' + TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// TelemetryDistroName returns an attribute KeyValue conforming to the +// "telemetry.distro.name" semantic conventions. It represents the name of the +// auto instrumentation agent or distribution, if used. +func TelemetryDistroName(val string) attribute.KeyValue { + return TelemetryDistroNameKey.String(val) +} + +// TelemetryDistroVersion returns an attribute KeyValue conforming to the +// "telemetry.distro.version" semantic conventions. It represents the version +// string of the auto instrumentation agent or distribution, if used. +func TelemetryDistroVersion(val string) attribute.KeyValue { + return TelemetryDistroVersionKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// Semantic convention attributes in the TLS namespace. +const ( + // TLSCipherKey is the attribute Key conforming to the "tls.cipher" + // semantic conventions. It represents the string indicating the + // [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) + // used during the current connection. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TLS_RSA_WITH_3DES_EDE_CBC_SHA', + // 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256' + // Note: The values allowed for `tls.cipher` MUST be one of the + // `Descriptions` of the [registered TLS Cipher + // Suits](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4). + TLSCipherKey = attribute.Key("tls.cipher") + + // TLSClientCertificateKey is the attribute Key conforming to the + // "tls.client.certificate" semantic conventions. It represents the + // pEM-encoded stand-alone certificate offered by the client. This is + // usually mutually-exclusive of `client.certificate_chain` since this + // value also exists in that list. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...' + TLSClientCertificateKey = attribute.Key("tls.client.certificate") + + // TLSClientCertificateChainKey is the attribute Key conforming to the + // "tls.client.certificate_chain" semantic conventions. It represents the + // array of PEM-encoded certificates that make up the certificate chain + // offered by the client. This is usually mutually-exclusive of + // `client.certificate` since that value should be the first certificate in + // the chain. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...', 'MI...' + TLSClientCertificateChainKey = attribute.Key("tls.client.certificate_chain") + + // TLSClientHashMd5Key is the attribute Key conforming to the + // "tls.client.hash.md5" semantic conventions. It represents the + // certificate fingerprint using the MD5 digest of DER-encoded version of + // certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC' + TLSClientHashMd5Key = attribute.Key("tls.client.hash.md5") + + // TLSClientHashSha1Key is the attribute Key conforming to the + // "tls.client.hash.sha1" semantic conventions. It represents the + // certificate fingerprint using the SHA1 digest of DER-encoded version of + // certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '9E393D93138888D288266C2D915214D1D1CCEB2A' + TLSClientHashSha1Key = attribute.Key("tls.client.hash.sha1") + + // TLSClientHashSha256Key is the attribute Key conforming to the + // "tls.client.hash.sha256" semantic conventions. It represents the + // certificate fingerprint using the SHA256 digest of DER-encoded version + // of certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // '0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0' + TLSClientHashSha256Key = attribute.Key("tls.client.hash.sha256") + + // TLSClientIssuerKey is the attribute Key conforming to the + // "tls.client.issuer" semantic conventions. It represents the + // distinguished name of + // [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) + // of the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=Example Root CA, OU=Infrastructure Team, DC=example, + // DC=com' + TLSClientIssuerKey = attribute.Key("tls.client.issuer") + + // TLSClientJa3Key is the attribute Key conforming to the "tls.client.ja3" + // semantic conventions. It represents a hash that identifies clients based + // on how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'd4e5b18d6b55c71272893221c96ba240' + TLSClientJa3Key = attribute.Key("tls.client.ja3") + + // TLSClientNotAfterKey is the attribute Key conforming to the + // "tls.client.not_after" semantic conventions. It represents the date/Time + // indicating when client certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021-01-01T00:00:00.000Z' + TLSClientNotAfterKey = attribute.Key("tls.client.not_after") + + // TLSClientNotBeforeKey is the attribute Key conforming to the + // "tls.client.not_before" semantic conventions. It represents the + // date/Time indicating when client certificate is first considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1970-01-01T00:00:00.000Z' + TLSClientNotBeforeKey = attribute.Key("tls.client.not_before") + + // TLSClientServerNameKey is the attribute Key conforming to the + // "tls.client.server_name" semantic conventions. It represents the also + // called an SNI, this tells the server which hostname to which the client + // is attempting to connect to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry.io' + TLSClientServerNameKey = attribute.Key("tls.client.server_name") + + // TLSClientSubjectKey is the attribute Key conforming to the + // "tls.client.subject" semantic conventions. It represents the + // distinguished name of subject of the x.509 certificate presented by the + // client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=myclient, OU=Documentation Team, DC=example, DC=com' + TLSClientSubjectKey = attribute.Key("tls.client.subject") + + // TLSClientSupportedCiphersKey is the attribute Key conforming to the + // "tls.client.supported_ciphers" semantic conventions. It represents the + // array of ciphers offered by the client during the client hello. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + // "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "..."' + TLSClientSupportedCiphersKey = attribute.Key("tls.client.supported_ciphers") + + // TLSCurveKey is the attribute Key conforming to the "tls.curve" semantic + // conventions. It represents the string indicating the curve used for the + // given cipher, when applicable + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'secp256r1' + TLSCurveKey = attribute.Key("tls.curve") + + // TLSEstablishedKey is the attribute Key conforming to the + // "tls.established" semantic conventions. It represents the boolean flag + // indicating if the TLS negotiation was successful and transitioned to an + // encrypted tunnel. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Examples: True + TLSEstablishedKey = attribute.Key("tls.established") + + // TLSNextProtocolKey is the attribute Key conforming to the + // "tls.next_protocol" semantic conventions. It represents the string + // indicating the protocol being tunneled. Per the values in the [IANA + // registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), + // this string should be lower case. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'http/1.1' + TLSNextProtocolKey = attribute.Key("tls.next_protocol") + + // TLSProtocolNameKey is the attribute Key conforming to the + // "tls.protocol.name" semantic conventions. It represents the normalized + // lowercase protocol name parsed from original string of the negotiated + // [SSL/TLS protocol + // version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + TLSProtocolNameKey = attribute.Key("tls.protocol.name") + + // TLSProtocolVersionKey is the attribute Key conforming to the + // "tls.protocol.version" semantic conventions. It represents the numeric + // part of the version parsed from the original string of the negotiated + // [SSL/TLS protocol + // version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2', '3' + TLSProtocolVersionKey = attribute.Key("tls.protocol.version") + + // TLSResumedKey is the attribute Key conforming to the "tls.resumed" + // semantic conventions. It represents the boolean flag indicating if this + // TLS connection was resumed from an existing TLS negotiation. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Examples: True + TLSResumedKey = attribute.Key("tls.resumed") + + // TLSServerCertificateKey is the attribute Key conforming to the + // "tls.server.certificate" semantic conventions. It represents the + // pEM-encoded stand-alone certificate offered by the server. This is + // usually mutually-exclusive of `server.certificate_chain` since this + // value also exists in that list. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...' + TLSServerCertificateKey = attribute.Key("tls.server.certificate") + + // TLSServerCertificateChainKey is the attribute Key conforming to the + // "tls.server.certificate_chain" semantic conventions. It represents the + // array of PEM-encoded certificates that make up the certificate chain + // offered by the server. This is usually mutually-exclusive of + // `server.certificate` since that value should be the first certificate in + // the chain. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...', 'MI...' + TLSServerCertificateChainKey = attribute.Key("tls.server.certificate_chain") + + // TLSServerHashMd5Key is the attribute Key conforming to the + // "tls.server.hash.md5" semantic conventions. It represents the + // certificate fingerprint using the MD5 digest of DER-encoded version of + // certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC' + TLSServerHashMd5Key = attribute.Key("tls.server.hash.md5") + + // TLSServerHashSha1Key is the attribute Key conforming to the + // "tls.server.hash.sha1" semantic conventions. It represents the + // certificate fingerprint using the SHA1 digest of DER-encoded version of + // certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '9E393D93138888D288266C2D915214D1D1CCEB2A' + TLSServerHashSha1Key = attribute.Key("tls.server.hash.sha1") + + // TLSServerHashSha256Key is the attribute Key conforming to the + // "tls.server.hash.sha256" semantic conventions. It represents the + // certificate fingerprint using the SHA256 digest of DER-encoded version + // of certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // '0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0' + TLSServerHashSha256Key = attribute.Key("tls.server.hash.sha256") + + // TLSServerIssuerKey is the attribute Key conforming to the + // "tls.server.issuer" semantic conventions. It represents the + // distinguished name of + // [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) + // of the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=Example Root CA, OU=Infrastructure Team, DC=example, + // DC=com' + TLSServerIssuerKey = attribute.Key("tls.server.issuer") + + // TLSServerJa3sKey is the attribute Key conforming to the + // "tls.server.ja3s" semantic conventions. It represents a hash that + // identifies servers based on how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'd4e5b18d6b55c71272893221c96ba240' + TLSServerJa3sKey = attribute.Key("tls.server.ja3s") + + // TLSServerNotAfterKey is the attribute Key conforming to the + // "tls.server.not_after" semantic conventions. It represents the date/Time + // indicating when server certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021-01-01T00:00:00.000Z' + TLSServerNotAfterKey = attribute.Key("tls.server.not_after") + + // TLSServerNotBeforeKey is the attribute Key conforming to the + // "tls.server.not_before" semantic conventions. It represents the + // date/Time indicating when server certificate is first considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1970-01-01T00:00:00.000Z' + TLSServerNotBeforeKey = attribute.Key("tls.server.not_before") + + // TLSServerSubjectKey is the attribute Key conforming to the + // "tls.server.subject" semantic conventions. It represents the + // distinguished name of subject of the x.509 certificate presented by the + // server. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=myserver, OU=Documentation Team, DC=example, DC=com' + TLSServerSubjectKey = attribute.Key("tls.server.subject") +) + +var ( + // ssl + TLSProtocolNameSsl = TLSProtocolNameKey.String("ssl") + // tls + TLSProtocolNameTLS = TLSProtocolNameKey.String("tls") +) + +// TLSCipher returns an attribute KeyValue conforming to the "tls.cipher" +// semantic conventions. It represents the string indicating the +// [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) used +// during the current connection. +func TLSCipher(val string) attribute.KeyValue { + return TLSCipherKey.String(val) +} + +// TLSClientCertificate returns an attribute KeyValue conforming to the +// "tls.client.certificate" semantic conventions. It represents the pEM-encoded +// stand-alone certificate offered by the client. This is usually +// mutually-exclusive of `client.certificate_chain` since this value also +// exists in that list. +func TLSClientCertificate(val string) attribute.KeyValue { + return TLSClientCertificateKey.String(val) +} + +// TLSClientCertificateChain returns an attribute KeyValue conforming to the +// "tls.client.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by +// the client. This is usually mutually-exclusive of `client.certificate` since +// that value should be the first certificate in the chain. +func TLSClientCertificateChain(val ...string) attribute.KeyValue { + return TLSClientCertificateChainKey.StringSlice(val) +} + +// TLSClientHashMd5 returns an attribute KeyValue conforming to the +// "tls.client.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashMd5(val string) attribute.KeyValue { + return TLSClientHashMd5Key.String(val) +} + +// TLSClientHashSha1 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha1(val string) attribute.KeyValue { + return TLSClientHashSha1Key.String(val) +} + +// TLSClientHashSha256 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha256(val string) attribute.KeyValue { + return TLSClientHashSha256Key.String(val) +} + +// TLSClientIssuer returns an attribute KeyValue conforming to the +// "tls.client.issuer" semantic conventions. It represents the distinguished +// name of +// [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of +// the issuer of the x.509 certificate presented by the client. +func TLSClientIssuer(val string) attribute.KeyValue { + return TLSClientIssuerKey.String(val) +} + +// TLSClientJa3 returns an attribute KeyValue conforming to the +// "tls.client.ja3" semantic conventions. It represents a hash that identifies +// clients based on how they perform an SSL/TLS handshake. +func TLSClientJa3(val string) attribute.KeyValue { + return TLSClientJa3Key.String(val) +} + +// TLSClientNotAfter returns an attribute KeyValue conforming to the +// "tls.client.not_after" semantic conventions. It represents the date/Time +// indicating when client certificate is no longer considered valid. +func TLSClientNotAfter(val string) attribute.KeyValue { + return TLSClientNotAfterKey.String(val) +} + +// TLSClientNotBefore returns an attribute KeyValue conforming to the +// "tls.client.not_before" semantic conventions. It represents the date/Time +// indicating when client certificate is first considered valid. +func TLSClientNotBefore(val string) attribute.KeyValue { + return TLSClientNotBeforeKey.String(val) +} + +// TLSClientServerName returns an attribute KeyValue conforming to the +// "tls.client.server_name" semantic conventions. It represents the also called +// an SNI, this tells the server which hostname to which the client is +// attempting to connect to. +func TLSClientServerName(val string) attribute.KeyValue { + return TLSClientServerNameKey.String(val) +} + +// TLSClientSubject returns an attribute KeyValue conforming to the +// "tls.client.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the client. +func TLSClientSubject(val string) attribute.KeyValue { + return TLSClientSubjectKey.String(val) +} + +// TLSClientSupportedCiphers returns an attribute KeyValue conforming to the +// "tls.client.supported_ciphers" semantic conventions. It represents the array +// of ciphers offered by the client during the client hello. +func TLSClientSupportedCiphers(val ...string) attribute.KeyValue { + return TLSClientSupportedCiphersKey.StringSlice(val) +} + +// TLSCurve returns an attribute KeyValue conforming to the "tls.curve" +// semantic conventions. It represents the string indicating the curve used for +// the given cipher, when applicable +func TLSCurve(val string) attribute.KeyValue { + return TLSCurveKey.String(val) +} + +// TLSEstablished returns an attribute KeyValue conforming to the +// "tls.established" semantic conventions. It represents the boolean flag +// indicating if the TLS negotiation was successful and transitioned to an +// encrypted tunnel. +func TLSEstablished(val bool) attribute.KeyValue { + return TLSEstablishedKey.Bool(val) +} + +// TLSNextProtocol returns an attribute KeyValue conforming to the +// "tls.next_protocol" semantic conventions. It represents the string +// indicating the protocol being tunneled. Per the values in the [IANA +// registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), +// this string should be lower case. +func TLSNextProtocol(val string) attribute.KeyValue { + return TLSNextProtocolKey.String(val) +} + +// TLSProtocolVersion returns an attribute KeyValue conforming to the +// "tls.protocol.version" semantic conventions. It represents the numeric part +// of the version parsed from the original string of the negotiated [SSL/TLS +// protocol +// version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) +func TLSProtocolVersion(val string) attribute.KeyValue { + return TLSProtocolVersionKey.String(val) +} + +// TLSResumed returns an attribute KeyValue conforming to the "tls.resumed" +// semantic conventions. It represents the boolean flag indicating if this TLS +// connection was resumed from an existing TLS negotiation. +func TLSResumed(val bool) attribute.KeyValue { + return TLSResumedKey.Bool(val) +} + +// TLSServerCertificate returns an attribute KeyValue conforming to the +// "tls.server.certificate" semantic conventions. It represents the pEM-encoded +// stand-alone certificate offered by the server. This is usually +// mutually-exclusive of `server.certificate_chain` since this value also +// exists in that list. +func TLSServerCertificate(val string) attribute.KeyValue { + return TLSServerCertificateKey.String(val) +} + +// TLSServerCertificateChain returns an attribute KeyValue conforming to the +// "tls.server.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by +// the server. This is usually mutually-exclusive of `server.certificate` since +// that value should be the first certificate in the chain. +func TLSServerCertificateChain(val ...string) attribute.KeyValue { + return TLSServerCertificateChainKey.StringSlice(val) +} + +// TLSServerHashMd5 returns an attribute KeyValue conforming to the +// "tls.server.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashMd5(val string) attribute.KeyValue { + return TLSServerHashMd5Key.String(val) +} + +// TLSServerHashSha1 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha1(val string) attribute.KeyValue { + return TLSServerHashSha1Key.String(val) +} + +// TLSServerHashSha256 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha256(val string) attribute.KeyValue { + return TLSServerHashSha256Key.String(val) +} + +// TLSServerIssuer returns an attribute KeyValue conforming to the +// "tls.server.issuer" semantic conventions. It represents the distinguished +// name of +// [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of +// the issuer of the x.509 certificate presented by the client. +func TLSServerIssuer(val string) attribute.KeyValue { + return TLSServerIssuerKey.String(val) +} + +// TLSServerJa3s returns an attribute KeyValue conforming to the +// "tls.server.ja3s" semantic conventions. It represents a hash that identifies +// servers based on how they perform an SSL/TLS handshake. +func TLSServerJa3s(val string) attribute.KeyValue { + return TLSServerJa3sKey.String(val) +} + +// TLSServerNotAfter returns an attribute KeyValue conforming to the +// "tls.server.not_after" semantic conventions. It represents the date/Time +// indicating when server certificate is no longer considered valid. +func TLSServerNotAfter(val string) attribute.KeyValue { + return TLSServerNotAfterKey.String(val) +} + +// TLSServerNotBefore returns an attribute KeyValue conforming to the +// "tls.server.not_before" semantic conventions. It represents the date/Time +// indicating when server certificate is first considered valid. +func TLSServerNotBefore(val string) attribute.KeyValue { + return TLSServerNotBeforeKey.String(val) +} + +// TLSServerSubject returns an attribute KeyValue conforming to the +// "tls.server.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the server. +func TLSServerSubject(val string) attribute.KeyValue { + return TLSServerSubjectKey.String(val) +} + +// Attributes describing URL. +const ( + // URLDomainKey is the attribute Key conforming to the "url.domain" + // semantic conventions. It represents the domain extracted from the + // `url.full`, such as "opentelemetry.io". + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'www.foo.bar', 'opentelemetry.io', '3.12.167.2', + // '[1080:0:0:0:8:800:200C:417A]' + // Note: In some cases a URL may refer to an IP and/or port directly, + // without a domain name. In this case, the IP address would go to the + // domain field. If the URL contains a [literal IPv6 + // address](https://www.rfc-editor.org/rfc/rfc2732#section-2) enclosed by + // `[` and `]`, the `[` and `]` characters should also be captured in the + // domain field. + URLDomainKey = attribute.Key("url.domain") + + // URLExtensionKey is the attribute Key conforming to the "url.extension" + // semantic conventions. It represents the file extension extracted from + // the `url.full`, excluding the leading dot. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'png', 'gz' + // Note: The file extension is only set if it exists, as not every url has + // a file extension. When the file name has multiple extensions + // `example.tar.gz`, only the last one should be captured `gz`, not + // `tar.gz`. + URLExtensionKey = attribute.Key("url.extension") + + // URLFragmentKey is the attribute Key conforming to the "url.fragment" + // semantic conventions. It represents the [URI + // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'SemConv' + URLFragmentKey = attribute.Key("url.fragment") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network + // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // '//localhost' + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the + // fragment is not transmitted over HTTP, but if it is known, it SHOULD be + // included nevertheless. + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case username and + // password SHOULD be redacted and attribute's value SHOULD be + // `https://REDACTED:REDACTED@www.example.com/`. + // `url.full` SHOULD capture the absolute URL when it is available (or can + // be reconstructed). Sensitive content provided in `url.full` SHOULD be + // scrubbed when instrumentations can identify it. + URLFullKey = attribute.Key("url.full") + + // URLOriginalKey is the attribute Key conforming to the "url.original" + // semantic conventions. It represents the unmodified original URL as seen + // in the event source. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // 'search?q=OpenTelemetry' + // Note: In network monitoring, the observed URL may be a full URL, whereas + // in access logs, the URL is often just represented as a path. This field + // is meant to represent the URL as it was observed, complete or not. + // `url.original` might contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case password and + // username SHOULD NOT be redacted and attribute's value SHOULD remain the + // same. + URLOriginalKey = attribute.Key("url.original") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI + // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/search' + // Note: Sensitive content provided in `url.path` SHOULD be scrubbed when + // instrumentations can identify it. + URLPathKey = attribute.Key("url.path") + + // URLPortKey is the attribute Key conforming to the "url.port" semantic + // conventions. It represents the port extracted from the `url.full` + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 443 + URLPortKey = attribute.Key("url.port") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI + // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'q=OpenTelemetry' + // Note: Sensitive content provided in `url.query` SHOULD be scrubbed when + // instrumentations can identify it. + URLQueryKey = attribute.Key("url.query") + + // URLRegisteredDomainKey is the attribute Key conforming to the + // "url.registered_domain" semantic conventions. It represents the highest + // registered url domain, stripped of the subdomain. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'example.com', 'foo.co.uk' + // Note: This value can be determined precisely with the [public suffix + // list](http://publicsuffix.org). For example, the registered domain for + // `foo.example.com` is `example.com`. Trying to approximate this by simply + // taking the last two labels will not work well for TLDs such as `co.uk`. + URLRegisteredDomainKey = attribute.Key("url.registered_domain") + + // URLSchemeKey is the attribute Key conforming to the "url.scheme" + // semantic conventions. It represents the [URI + // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component + // identifying the used protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https', 'ftp', 'telnet' + URLSchemeKey = attribute.Key("url.scheme") + + // URLSubdomainKey is the attribute Key conforming to the "url.subdomain" + // semantic conventions. It represents the subdomain portion of a fully + // qualified domain name includes all of the names except the host name + // under the registered_domain. In a partially qualified domain, or if the + // qualification level of the full name cannot be determined, subdomain + // contains all of the names below the registered domain. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'east', 'sub2.sub1' + // Note: The subdomain portion of `www.east.mydomain.co.uk` is `east`. If + // the domain has multiple levels of subdomain, such as + // `sub2.sub1.example.com`, the subdomain field should contain `sub2.sub1`, + // with no trailing period. + URLSubdomainKey = attribute.Key("url.subdomain") + + // URLTemplateKey is the attribute Key conforming to the "url.template" + // semantic conventions. It represents the low-cardinality template of an + // [absolute path + // reference](https://www.rfc-editor.org/rfc/rfc3986#section-4.2). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/users/{id}', '/users/:id', '/users?id={id}' + URLTemplateKey = attribute.Key("url.template") + + // URLTopLevelDomainKey is the attribute Key conforming to the + // "url.top_level_domain" semantic conventions. It represents the effective + // top level domain (eTLD), also known as the domain suffix, is the last + // part of the domain name. For example, the top level domain for + // example.com is `com`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com', 'co.uk' + // Note: This value can be determined precisely with the [public suffix + // list](http://publicsuffix.org). + URLTopLevelDomainKey = attribute.Key("url.top_level_domain") +) + +// URLDomain returns an attribute KeyValue conforming to the "url.domain" +// semantic conventions. It represents the domain extracted from the +// `url.full`, such as "opentelemetry.io". +func URLDomain(val string) attribute.KeyValue { + return URLDomainKey.String(val) +} + +// URLExtension returns an attribute KeyValue conforming to the +// "url.extension" semantic conventions. It represents the file extension +// extracted from the `url.full`, excluding the leading dot. +func URLExtension(val string) attribute.KeyValue { + return URLExtensionKey.String(val) +} + +// URLFragment returns an attribute KeyValue conforming to the +// "url.fragment" semantic conventions. It represents the [URI +// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" +// semantic conventions. It represents the absolute URL describing a network +// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLOriginal returns an attribute KeyValue conforming to the +// "url.original" semantic conventions. It represents the unmodified original +// URL as seen in the event source. +func URLOriginal(val string) attribute.KeyValue { + return URLOriginalKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" +// semantic conventions. It represents the [URI +// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLPort returns an attribute KeyValue conforming to the "url.port" +// semantic conventions. It represents the port extracted from the `url.full` +func URLPort(val int) attribute.KeyValue { + return URLPortKey.Int(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" +// semantic conventions. It represents the [URI +// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLRegisteredDomain returns an attribute KeyValue conforming to the +// "url.registered_domain" semantic conventions. It represents the highest +// registered url domain, stripped of the subdomain. +func URLRegisteredDomain(val string) attribute.KeyValue { + return URLRegisteredDomainKey.String(val) +} + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI +// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component +// identifying the used protocol. +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// URLSubdomain returns an attribute KeyValue conforming to the +// "url.subdomain" semantic conventions. It represents the subdomain portion of +// a fully qualified domain name includes all of the names except the host name +// under the registered_domain. In a partially qualified domain, or if the +// qualification level of the full name cannot be determined, subdomain +// contains all of the names below the registered domain. +func URLSubdomain(val string) attribute.KeyValue { + return URLSubdomainKey.String(val) +} + +// URLTemplate returns an attribute KeyValue conforming to the +// "url.template" semantic conventions. It represents the low-cardinality +// template of an [absolute path +// reference](https://www.rfc-editor.org/rfc/rfc3986#section-4.2). +func URLTemplate(val string) attribute.KeyValue { + return URLTemplateKey.String(val) +} + +// URLTopLevelDomain returns an attribute KeyValue conforming to the +// "url.top_level_domain" semantic conventions. It represents the effective top +// level domain (eTLD), also known as the domain suffix, is the last part of +// the domain name. For example, the top level domain for example.com is `com`. +func URLTopLevelDomain(val string) attribute.KeyValue { + return URLTopLevelDomainKey.String(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentNameKey is the attribute Key conforming to the + // "user_agent.name" semantic conventions. It represents the name of the + // user-agent extracted from original. Usually refers to the browser's + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Safari', 'YourApp' + // Note: [Example](https://www.whatsmyua.info) of extracting browser's name + // from original string. In the case of using a user-agent for non-browser + // products, such as microservices with multiple names/versions inside the + // `user_agent.original`, the most significant name SHOULD be selected. In + // such a scenario it should align with `user_agent.version` + UserAgentNameKey = attribute.Key("user_agent.name") + + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3', 'Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1', 'YourApp/1.0.0 + // grpc-java-okhttp/1.27.2' + UserAgentOriginalKey = attribute.Key("user_agent.original") + + // UserAgentVersionKey is the attribute Key conforming to the + // "user_agent.version" semantic conventions. It represents the version of + // the user-agent extracted from original. Usually refers to the browser's + // version + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.1.2', '1.0.0' + // Note: [Example](https://www.whatsmyua.info) of extracting browser's + // version from original string. In the case of using a user-agent for + // non-browser products, such as microservices with multiple names/versions + // inside the `user_agent.original`, the most significant version SHOULD be + // selected. In such a scenario it should align with `user_agent.name` + UserAgentVersionKey = attribute.Key("user_agent.version") +) + +// UserAgentName returns an attribute KeyValue conforming to the +// "user_agent.name" semantic conventions. It represents the name of the +// user-agent extracted from original. Usually refers to the browser's name. +func UserAgentName(val string) attribute.KeyValue { + return UserAgentNameKey.String(val) +} + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} + +// UserAgentVersion returns an attribute KeyValue conforming to the +// "user_agent.version" semantic conventions. It represents the version of the +// user-agent extracted from original. Usually refers to the browser's version +func UserAgentVersion(val string) attribute.KeyValue { + return UserAgentVersionKey.String(val) +} + +// The attributes used to describe the packaged software running the +// application code. +const ( + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") + + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") +) + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/doc.go new file mode 100644 index 000000000..d031bbea7 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/doc.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the v1.26.0 +// version of the OpenTelemetry semantic conventions. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/exception.go new file mode 100644 index 000000000..bfaee0d56 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/exception.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/metric.go new file mode 100644 index 000000000..fcdb9f485 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/metric.go @@ -0,0 +1,1307 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" + +const ( + + // ContainerCPUTime is the metric conforming to the "container.cpu.time" + // semantic conventions. It represents the total CPU time consumed. + // Instrument: counter + // Unit: s + // Stability: Experimental + ContainerCPUTimeName = "container.cpu.time" + ContainerCPUTimeUnit = "s" + ContainerCPUTimeDescription = "Total CPU time consumed" + + // ContainerMemoryUsage is the metric conforming to the + // "container.memory.usage" semantic conventions. It represents the memory + // usage of the container. + // Instrument: counter + // Unit: By + // Stability: Experimental + ContainerMemoryUsageName = "container.memory.usage" + ContainerMemoryUsageUnit = "By" + ContainerMemoryUsageDescription = "Memory usage of the container." + + // ContainerDiskIo is the metric conforming to the "container.disk.io" semantic + // conventions. It represents the disk bytes for the container. + // Instrument: counter + // Unit: By + // Stability: Experimental + ContainerDiskIoName = "container.disk.io" + ContainerDiskIoUnit = "By" + ContainerDiskIoDescription = "Disk bytes for the container." + + // ContainerNetworkIo is the metric conforming to the "container.network.io" + // semantic conventions. It represents the network bytes for the container. + // Instrument: counter + // Unit: By + // Stability: Experimental + ContainerNetworkIoName = "container.network.io" + ContainerNetworkIoUnit = "By" + ContainerNetworkIoDescription = "Network bytes for the container." + + // DBClientOperationDuration is the metric conforming to the + // "db.client.operation.duration" semantic conventions. It represents the + // duration of database client operations. + // Instrument: histogram + // Unit: s + // Stability: Experimental + DBClientOperationDurationName = "db.client.operation.duration" + DBClientOperationDurationUnit = "s" + DBClientOperationDurationDescription = "Duration of database client operations." + + // DBClientConnectionCount is the metric conforming to the + // "db.client.connection.count" semantic conventions. It represents the number + // of connections that are currently in state described by the `state` + // attribute. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionCountName = "db.client.connection.count" + DBClientConnectionCountUnit = "{connection}" + DBClientConnectionCountDescription = "The number of connections that are currently in state described by the `state` attribute" + + // DBClientConnectionIdleMax is the metric conforming to the + // "db.client.connection.idle.max" semantic conventions. It represents the + // maximum number of idle open connections allowed. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionIdleMaxName = "db.client.connection.idle.max" + DBClientConnectionIdleMaxUnit = "{connection}" + DBClientConnectionIdleMaxDescription = "The maximum number of idle open connections allowed" + + // DBClientConnectionIdleMin is the metric conforming to the + // "db.client.connection.idle.min" semantic conventions. It represents the + // minimum number of idle open connections allowed. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionIdleMinName = "db.client.connection.idle.min" + DBClientConnectionIdleMinUnit = "{connection}" + DBClientConnectionIdleMinDescription = "The minimum number of idle open connections allowed" + + // DBClientConnectionMax is the metric conforming to the + // "db.client.connection.max" semantic conventions. It represents the maximum + // number of open connections allowed. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionMaxName = "db.client.connection.max" + DBClientConnectionMaxUnit = "{connection}" + DBClientConnectionMaxDescription = "The maximum number of open connections allowed" + + // DBClientConnectionPendingRequests is the metric conforming to the + // "db.client.connection.pending_requests" semantic conventions. It represents + // the number of pending requests for an open connection, cumulative for the + // entire pool. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + DBClientConnectionPendingRequestsName = "db.client.connection.pending_requests" + DBClientConnectionPendingRequestsUnit = "{request}" + DBClientConnectionPendingRequestsDescription = "The number of pending requests for an open connection, cumulative for the entire pool" + + // DBClientConnectionTimeouts is the metric conforming to the + // "db.client.connection.timeouts" semantic conventions. It represents the + // number of connection timeouts that have occurred trying to obtain a + // connection from the pool. + // Instrument: counter + // Unit: {timeout} + // Stability: Experimental + DBClientConnectionTimeoutsName = "db.client.connection.timeouts" + DBClientConnectionTimeoutsUnit = "{timeout}" + DBClientConnectionTimeoutsDescription = "The number of connection timeouts that have occurred trying to obtain a connection from the pool" + + // DBClientConnectionCreateTime is the metric conforming to the + // "db.client.connection.create_time" semantic conventions. It represents the + // time it took to create a new connection. + // Instrument: histogram + // Unit: s + // Stability: Experimental + DBClientConnectionCreateTimeName = "db.client.connection.create_time" + DBClientConnectionCreateTimeUnit = "s" + DBClientConnectionCreateTimeDescription = "The time it took to create a new connection" + + // DBClientConnectionWaitTime is the metric conforming to the + // "db.client.connection.wait_time" semantic conventions. It represents the + // time it took to obtain an open connection from the pool. + // Instrument: histogram + // Unit: s + // Stability: Experimental + DBClientConnectionWaitTimeName = "db.client.connection.wait_time" + DBClientConnectionWaitTimeUnit = "s" + DBClientConnectionWaitTimeDescription = "The time it took to obtain an open connection from the pool" + + // DBClientConnectionUseTime is the metric conforming to the + // "db.client.connection.use_time" semantic conventions. It represents the time + // between borrowing a connection and returning it to the pool. + // Instrument: histogram + // Unit: s + // Stability: Experimental + DBClientConnectionUseTimeName = "db.client.connection.use_time" + DBClientConnectionUseTimeUnit = "s" + DBClientConnectionUseTimeDescription = "The time between borrowing a connection and returning it to the pool" + + // DBClientConnectionsUsage is the metric conforming to the + // "db.client.connections.usage" semantic conventions. It represents the + // deprecated, use `db.client.connection.count` instead. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionsUsageName = "db.client.connections.usage" + DBClientConnectionsUsageUnit = "{connection}" + DBClientConnectionsUsageDescription = "Deprecated, use `db.client.connection.count` instead." + + // DBClientConnectionsIdleMax is the metric conforming to the + // "db.client.connections.idle.max" semantic conventions. It represents the + // deprecated, use `db.client.connection.idle.max` instead. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionsIdleMaxName = "db.client.connections.idle.max" + DBClientConnectionsIdleMaxUnit = "{connection}" + DBClientConnectionsIdleMaxDescription = "Deprecated, use `db.client.connection.idle.max` instead." + + // DBClientConnectionsIdleMin is the metric conforming to the + // "db.client.connections.idle.min" semantic conventions. It represents the + // deprecated, use `db.client.connection.idle.min` instead. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionsIdleMinName = "db.client.connections.idle.min" + DBClientConnectionsIdleMinUnit = "{connection}" + DBClientConnectionsIdleMinDescription = "Deprecated, use `db.client.connection.idle.min` instead." + + // DBClientConnectionsMax is the metric conforming to the + // "db.client.connections.max" semantic conventions. It represents the + // deprecated, use `db.client.connection.max` instead. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + DBClientConnectionsMaxName = "db.client.connections.max" + DBClientConnectionsMaxUnit = "{connection}" + DBClientConnectionsMaxDescription = "Deprecated, use `db.client.connection.max` instead." + + // DBClientConnectionsPendingRequests is the metric conforming to the + // "db.client.connections.pending_requests" semantic conventions. It represents + // the deprecated, use `db.client.connection.pending_requests` instead. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + DBClientConnectionsPendingRequestsName = "db.client.connections.pending_requests" + DBClientConnectionsPendingRequestsUnit = "{request}" + DBClientConnectionsPendingRequestsDescription = "Deprecated, use `db.client.connection.pending_requests` instead." + + // DBClientConnectionsTimeouts is the metric conforming to the + // "db.client.connections.timeouts" semantic conventions. It represents the + // deprecated, use `db.client.connection.timeouts` instead. + // Instrument: counter + // Unit: {timeout} + // Stability: Experimental + DBClientConnectionsTimeoutsName = "db.client.connections.timeouts" + DBClientConnectionsTimeoutsUnit = "{timeout}" + DBClientConnectionsTimeoutsDescription = "Deprecated, use `db.client.connection.timeouts` instead." + + // DBClientConnectionsCreateTime is the metric conforming to the + // "db.client.connections.create_time" semantic conventions. It represents the + // deprecated, use `db.client.connection.create_time` instead. Note: the unit + // also changed from `ms` to `s`. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + DBClientConnectionsCreateTimeName = "db.client.connections.create_time" + DBClientConnectionsCreateTimeUnit = "ms" + DBClientConnectionsCreateTimeDescription = "Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`." + + // DBClientConnectionsWaitTime is the metric conforming to the + // "db.client.connections.wait_time" semantic conventions. It represents the + // deprecated, use `db.client.connection.wait_time` instead. Note: the unit + // also changed from `ms` to `s`. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + DBClientConnectionsWaitTimeName = "db.client.connections.wait_time" + DBClientConnectionsWaitTimeUnit = "ms" + DBClientConnectionsWaitTimeDescription = "Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from `ms` to `s`." + + // DBClientConnectionsUseTime is the metric conforming to the + // "db.client.connections.use_time" semantic conventions. It represents the + // deprecated, use `db.client.connection.use_time` instead. Note: the unit also + // changed from `ms` to `s`. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + DBClientConnectionsUseTimeName = "db.client.connections.use_time" + DBClientConnectionsUseTimeUnit = "ms" + DBClientConnectionsUseTimeDescription = "Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`." + + // DNSLookupDuration is the metric conforming to the "dns.lookup.duration" + // semantic conventions. It represents the measures the time taken to perform a + // DNS lookup. + // Instrument: histogram + // Unit: s + // Stability: Experimental + DNSLookupDurationName = "dns.lookup.duration" + DNSLookupDurationUnit = "s" + DNSLookupDurationDescription = "Measures the time taken to perform a DNS lookup." + + // AspnetcoreRoutingMatchAttempts is the metric conforming to the + // "aspnetcore.routing.match_attempts" semantic conventions. It represents the + // number of requests that were attempted to be matched to an endpoint. + // Instrument: counter + // Unit: {match_attempt} + // Stability: Stable + AspnetcoreRoutingMatchAttemptsName = "aspnetcore.routing.match_attempts" + AspnetcoreRoutingMatchAttemptsUnit = "{match_attempt}" + AspnetcoreRoutingMatchAttemptsDescription = "Number of requests that were attempted to be matched to an endpoint." + + // AspnetcoreDiagnosticsExceptions is the metric conforming to the + // "aspnetcore.diagnostics.exceptions" semantic conventions. It represents the + // number of exceptions caught by exception handling middleware. + // Instrument: counter + // Unit: {exception} + // Stability: Stable + AspnetcoreDiagnosticsExceptionsName = "aspnetcore.diagnostics.exceptions" + AspnetcoreDiagnosticsExceptionsUnit = "{exception}" + AspnetcoreDiagnosticsExceptionsDescription = "Number of exceptions caught by exception handling middleware." + + // AspnetcoreRateLimitingActiveRequestLeases is the metric conforming to the + // "aspnetcore.rate_limiting.active_request_leases" semantic conventions. It + // represents the number of requests that are currently active on the server + // that hold a rate limiting lease. + // Instrument: updowncounter + // Unit: {request} + // Stability: Stable + AspnetcoreRateLimitingActiveRequestLeasesName = "aspnetcore.rate_limiting.active_request_leases" + AspnetcoreRateLimitingActiveRequestLeasesUnit = "{request}" + AspnetcoreRateLimitingActiveRequestLeasesDescription = "Number of requests that are currently active on the server that hold a rate limiting lease." + + // AspnetcoreRateLimitingRequestLeaseDuration is the metric conforming to the + // "aspnetcore.rate_limiting.request_lease.duration" semantic conventions. It + // represents the duration of rate limiting lease held by requests on the + // server. + // Instrument: histogram + // Unit: s + // Stability: Stable + AspnetcoreRateLimitingRequestLeaseDurationName = "aspnetcore.rate_limiting.request_lease.duration" + AspnetcoreRateLimitingRequestLeaseDurationUnit = "s" + AspnetcoreRateLimitingRequestLeaseDurationDescription = "The duration of rate limiting lease held by requests on the server." + + // AspnetcoreRateLimitingRequestTimeInQueue is the metric conforming to the + // "aspnetcore.rate_limiting.request.time_in_queue" semantic conventions. It + // represents the time the request spent in a queue waiting to acquire a rate + // limiting lease. + // Instrument: histogram + // Unit: s + // Stability: Stable + AspnetcoreRateLimitingRequestTimeInQueueName = "aspnetcore.rate_limiting.request.time_in_queue" + AspnetcoreRateLimitingRequestTimeInQueueUnit = "s" + AspnetcoreRateLimitingRequestTimeInQueueDescription = "The time the request spent in a queue waiting to acquire a rate limiting lease." + + // AspnetcoreRateLimitingQueuedRequests is the metric conforming to the + // "aspnetcore.rate_limiting.queued_requests" semantic conventions. It + // represents the number of requests that are currently queued, waiting to + // acquire a rate limiting lease. + // Instrument: updowncounter + // Unit: {request} + // Stability: Stable + AspnetcoreRateLimitingQueuedRequestsName = "aspnetcore.rate_limiting.queued_requests" + AspnetcoreRateLimitingQueuedRequestsUnit = "{request}" + AspnetcoreRateLimitingQueuedRequestsDescription = "Number of requests that are currently queued, waiting to acquire a rate limiting lease." + + // AspnetcoreRateLimitingRequests is the metric conforming to the + // "aspnetcore.rate_limiting.requests" semantic conventions. It represents the + // number of requests that tried to acquire a rate limiting lease. + // Instrument: counter + // Unit: {request} + // Stability: Stable + AspnetcoreRateLimitingRequestsName = "aspnetcore.rate_limiting.requests" + AspnetcoreRateLimitingRequestsUnit = "{request}" + AspnetcoreRateLimitingRequestsDescription = "Number of requests that tried to acquire a rate limiting lease." + + // KestrelActiveConnections is the metric conforming to the + // "kestrel.active_connections" semantic conventions. It represents the number + // of connections that are currently active on the server. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Stable + KestrelActiveConnectionsName = "kestrel.active_connections" + KestrelActiveConnectionsUnit = "{connection}" + KestrelActiveConnectionsDescription = "Number of connections that are currently active on the server." + + // KestrelConnectionDuration is the metric conforming to the + // "kestrel.connection.duration" semantic conventions. It represents the + // duration of connections on the server. + // Instrument: histogram + // Unit: s + // Stability: Stable + KestrelConnectionDurationName = "kestrel.connection.duration" + KestrelConnectionDurationUnit = "s" + KestrelConnectionDurationDescription = "The duration of connections on the server." + + // KestrelRejectedConnections is the metric conforming to the + // "kestrel.rejected_connections" semantic conventions. It represents the + // number of connections rejected by the server. + // Instrument: counter + // Unit: {connection} + // Stability: Stable + KestrelRejectedConnectionsName = "kestrel.rejected_connections" + KestrelRejectedConnectionsUnit = "{connection}" + KestrelRejectedConnectionsDescription = "Number of connections rejected by the server." + + // KestrelQueuedConnections is the metric conforming to the + // "kestrel.queued_connections" semantic conventions. It represents the number + // of connections that are currently queued and are waiting to start. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Stable + KestrelQueuedConnectionsName = "kestrel.queued_connections" + KestrelQueuedConnectionsUnit = "{connection}" + KestrelQueuedConnectionsDescription = "Number of connections that are currently queued and are waiting to start." + + // KestrelQueuedRequests is the metric conforming to the + // "kestrel.queued_requests" semantic conventions. It represents the number of + // HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are + // currently queued and are waiting to start. + // Instrument: updowncounter + // Unit: {request} + // Stability: Stable + KestrelQueuedRequestsName = "kestrel.queued_requests" + KestrelQueuedRequestsUnit = "{request}" + KestrelQueuedRequestsDescription = "Number of HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are currently queued and are waiting to start." + + // KestrelUpgradedConnections is the metric conforming to the + // "kestrel.upgraded_connections" semantic conventions. It represents the + // number of connections that are currently upgraded (WebSockets). . + // Instrument: updowncounter + // Unit: {connection} + // Stability: Stable + KestrelUpgradedConnectionsName = "kestrel.upgraded_connections" + KestrelUpgradedConnectionsUnit = "{connection}" + KestrelUpgradedConnectionsDescription = "Number of connections that are currently upgraded (WebSockets). ." + + // KestrelTLSHandshakeDuration is the metric conforming to the + // "kestrel.tls_handshake.duration" semantic conventions. It represents the + // duration of TLS handshakes on the server. + // Instrument: histogram + // Unit: s + // Stability: Stable + KestrelTLSHandshakeDurationName = "kestrel.tls_handshake.duration" + KestrelTLSHandshakeDurationUnit = "s" + KestrelTLSHandshakeDurationDescription = "The duration of TLS handshakes on the server." + + // KestrelActiveTLSHandshakes is the metric conforming to the + // "kestrel.active_tls_handshakes" semantic conventions. It represents the + // number of TLS handshakes that are currently in progress on the server. + // Instrument: updowncounter + // Unit: {handshake} + // Stability: Stable + KestrelActiveTLSHandshakesName = "kestrel.active_tls_handshakes" + KestrelActiveTLSHandshakesUnit = "{handshake}" + KestrelActiveTLSHandshakesDescription = "Number of TLS handshakes that are currently in progress on the server." + + // SignalrServerConnectionDuration is the metric conforming to the + // "signalr.server.connection.duration" semantic conventions. It represents the + // duration of connections on the server. + // Instrument: histogram + // Unit: s + // Stability: Stable + SignalrServerConnectionDurationName = "signalr.server.connection.duration" + SignalrServerConnectionDurationUnit = "s" + SignalrServerConnectionDurationDescription = "The duration of connections on the server." + + // SignalrServerActiveConnections is the metric conforming to the + // "signalr.server.active_connections" semantic conventions. It represents the + // number of connections that are currently active on the server. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Stable + SignalrServerActiveConnectionsName = "signalr.server.active_connections" + SignalrServerActiveConnectionsUnit = "{connection}" + SignalrServerActiveConnectionsDescription = "Number of connections that are currently active on the server." + + // FaaSInvokeDuration is the metric conforming to the "faas.invoke_duration" + // semantic conventions. It represents the measures the duration of the + // function's logic execution. + // Instrument: histogram + // Unit: s + // Stability: Experimental + FaaSInvokeDurationName = "faas.invoke_duration" + FaaSInvokeDurationUnit = "s" + FaaSInvokeDurationDescription = "Measures the duration of the function's logic execution" + + // FaaSInitDuration is the metric conforming to the "faas.init_duration" + // semantic conventions. It represents the measures the duration of the + // function's initialization, such as a cold start. + // Instrument: histogram + // Unit: s + // Stability: Experimental + FaaSInitDurationName = "faas.init_duration" + FaaSInitDurationUnit = "s" + FaaSInitDurationDescription = "Measures the duration of the function's initialization, such as a cold start" + + // FaaSColdstarts is the metric conforming to the "faas.coldstarts" semantic + // conventions. It represents the number of invocation cold starts. + // Instrument: counter + // Unit: {coldstart} + // Stability: Experimental + FaaSColdstartsName = "faas.coldstarts" + FaaSColdstartsUnit = "{coldstart}" + FaaSColdstartsDescription = "Number of invocation cold starts" + + // FaaSErrors is the metric conforming to the "faas.errors" semantic + // conventions. It represents the number of invocation errors. + // Instrument: counter + // Unit: {error} + // Stability: Experimental + FaaSErrorsName = "faas.errors" + FaaSErrorsUnit = "{error}" + FaaSErrorsDescription = "Number of invocation errors" + + // FaaSInvocations is the metric conforming to the "faas.invocations" semantic + // conventions. It represents the number of successful invocations. + // Instrument: counter + // Unit: {invocation} + // Stability: Experimental + FaaSInvocationsName = "faas.invocations" + FaaSInvocationsUnit = "{invocation}" + FaaSInvocationsDescription = "Number of successful invocations" + + // FaaSTimeouts is the metric conforming to the "faas.timeouts" semantic + // conventions. It represents the number of invocation timeouts. + // Instrument: counter + // Unit: {timeout} + // Stability: Experimental + FaaSTimeoutsName = "faas.timeouts" + FaaSTimeoutsUnit = "{timeout}" + FaaSTimeoutsDescription = "Number of invocation timeouts" + + // FaaSMemUsage is the metric conforming to the "faas.mem_usage" semantic + // conventions. It represents the distribution of max memory usage per + // invocation. + // Instrument: histogram + // Unit: By + // Stability: Experimental + FaaSMemUsageName = "faas.mem_usage" + FaaSMemUsageUnit = "By" + FaaSMemUsageDescription = "Distribution of max memory usage per invocation" + + // FaaSCPUUsage is the metric conforming to the "faas.cpu_usage" semantic + // conventions. It represents the distribution of CPU usage per invocation. + // Instrument: histogram + // Unit: s + // Stability: Experimental + FaaSCPUUsageName = "faas.cpu_usage" + FaaSCPUUsageUnit = "s" + FaaSCPUUsageDescription = "Distribution of CPU usage per invocation" + + // FaaSNetIo is the metric conforming to the "faas.net_io" semantic + // conventions. It represents the distribution of net I/O usage per invocation. + // Instrument: histogram + // Unit: By + // Stability: Experimental + FaaSNetIoName = "faas.net_io" + FaaSNetIoUnit = "By" + FaaSNetIoDescription = "Distribution of net I/O usage per invocation" + + // HTTPServerRequestDuration is the metric conforming to the + // "http.server.request.duration" semantic conventions. It represents the + // duration of HTTP server requests. + // Instrument: histogram + // Unit: s + // Stability: Stable + HTTPServerRequestDurationName = "http.server.request.duration" + HTTPServerRequestDurationUnit = "s" + HTTPServerRequestDurationDescription = "Duration of HTTP server requests." + + // HTTPServerActiveRequests is the metric conforming to the + // "http.server.active_requests" semantic conventions. It represents the number + // of active HTTP server requests. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + HTTPServerActiveRequestsName = "http.server.active_requests" + HTTPServerActiveRequestsUnit = "{request}" + HTTPServerActiveRequestsDescription = "Number of active HTTP server requests." + + // HTTPServerRequestBodySize is the metric conforming to the + // "http.server.request.body.size" semantic conventions. It represents the size + // of HTTP server request bodies. + // Instrument: histogram + // Unit: By + // Stability: Experimental + HTTPServerRequestBodySizeName = "http.server.request.body.size" + HTTPServerRequestBodySizeUnit = "By" + HTTPServerRequestBodySizeDescription = "Size of HTTP server request bodies." + + // HTTPServerResponseBodySize is the metric conforming to the + // "http.server.response.body.size" semantic conventions. It represents the + // size of HTTP server response bodies. + // Instrument: histogram + // Unit: By + // Stability: Experimental + HTTPServerResponseBodySizeName = "http.server.response.body.size" + HTTPServerResponseBodySizeUnit = "By" + HTTPServerResponseBodySizeDescription = "Size of HTTP server response bodies." + + // HTTPClientRequestDuration is the metric conforming to the + // "http.client.request.duration" semantic conventions. It represents the + // duration of HTTP client requests. + // Instrument: histogram + // Unit: s + // Stability: Stable + HTTPClientRequestDurationName = "http.client.request.duration" + HTTPClientRequestDurationUnit = "s" + HTTPClientRequestDurationDescription = "Duration of HTTP client requests." + + // HTTPClientRequestBodySize is the metric conforming to the + // "http.client.request.body.size" semantic conventions. It represents the size + // of HTTP client request bodies. + // Instrument: histogram + // Unit: By + // Stability: Experimental + HTTPClientRequestBodySizeName = "http.client.request.body.size" + HTTPClientRequestBodySizeUnit = "By" + HTTPClientRequestBodySizeDescription = "Size of HTTP client request bodies." + + // HTTPClientResponseBodySize is the metric conforming to the + // "http.client.response.body.size" semantic conventions. It represents the + // size of HTTP client response bodies. + // Instrument: histogram + // Unit: By + // Stability: Experimental + HTTPClientResponseBodySizeName = "http.client.response.body.size" + HTTPClientResponseBodySizeUnit = "By" + HTTPClientResponseBodySizeDescription = "Size of HTTP client response bodies." + + // HTTPClientOpenConnections is the metric conforming to the + // "http.client.open_connections" semantic conventions. It represents the + // number of outbound HTTP connections that are currently active or idle on the + // client. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + HTTPClientOpenConnectionsName = "http.client.open_connections" + HTTPClientOpenConnectionsUnit = "{connection}" + HTTPClientOpenConnectionsDescription = "Number of outbound HTTP connections that are currently active or idle on the client." + + // HTTPClientConnectionDuration is the metric conforming to the + // "http.client.connection.duration" semantic conventions. It represents the + // duration of the successfully established outbound HTTP connections. + // Instrument: histogram + // Unit: s + // Stability: Experimental + HTTPClientConnectionDurationName = "http.client.connection.duration" + HTTPClientConnectionDurationUnit = "s" + HTTPClientConnectionDurationDescription = "The duration of the successfully established outbound HTTP connections." + + // HTTPClientActiveRequests is the metric conforming to the + // "http.client.active_requests" semantic conventions. It represents the number + // of active HTTP requests. + // Instrument: updowncounter + // Unit: {request} + // Stability: Experimental + HTTPClientActiveRequestsName = "http.client.active_requests" + HTTPClientActiveRequestsUnit = "{request}" + HTTPClientActiveRequestsDescription = "Number of active HTTP requests." + + // JvmMemoryInit is the metric conforming to the "jvm.memory.init" semantic + // conventions. It represents the measure of initial memory requested. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + JvmMemoryInitName = "jvm.memory.init" + JvmMemoryInitUnit = "By" + JvmMemoryInitDescription = "Measure of initial memory requested." + + // JvmSystemCPUUtilization is the metric conforming to the + // "jvm.system.cpu.utilization" semantic conventions. It represents the recent + // CPU utilization for the whole system as reported by the JVM. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + JvmSystemCPUUtilizationName = "jvm.system.cpu.utilization" + JvmSystemCPUUtilizationUnit = "1" + JvmSystemCPUUtilizationDescription = "Recent CPU utilization for the whole system as reported by the JVM." + + // JvmSystemCPULoad1m is the metric conforming to the "jvm.system.cpu.load_1m" + // semantic conventions. It represents the average CPU load of the whole system + // for the last minute as reported by the JVM. + // Instrument: gauge + // Unit: {run_queue_item} + // Stability: Experimental + JvmSystemCPULoad1mName = "jvm.system.cpu.load_1m" + JvmSystemCPULoad1mUnit = "{run_queue_item}" + JvmSystemCPULoad1mDescription = "Average CPU load of the whole system for the last minute as reported by the JVM." + + // JvmBufferMemoryUsage is the metric conforming to the + // "jvm.buffer.memory.usage" semantic conventions. It represents the measure of + // memory used by buffers. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + JvmBufferMemoryUsageName = "jvm.buffer.memory.usage" + JvmBufferMemoryUsageUnit = "By" + JvmBufferMemoryUsageDescription = "Measure of memory used by buffers." + + // JvmBufferMemoryLimit is the metric conforming to the + // "jvm.buffer.memory.limit" semantic conventions. It represents the measure of + // total memory capacity of buffers. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + JvmBufferMemoryLimitName = "jvm.buffer.memory.limit" + JvmBufferMemoryLimitUnit = "By" + JvmBufferMemoryLimitDescription = "Measure of total memory capacity of buffers." + + // JvmBufferCount is the metric conforming to the "jvm.buffer.count" semantic + // conventions. It represents the number of buffers in the pool. + // Instrument: updowncounter + // Unit: {buffer} + // Stability: Experimental + JvmBufferCountName = "jvm.buffer.count" + JvmBufferCountUnit = "{buffer}" + JvmBufferCountDescription = "Number of buffers in the pool." + + // JvmMemoryUsed is the metric conforming to the "jvm.memory.used" semantic + // conventions. It represents the measure of memory used. + // Instrument: updowncounter + // Unit: By + // Stability: Stable + JvmMemoryUsedName = "jvm.memory.used" + JvmMemoryUsedUnit = "By" + JvmMemoryUsedDescription = "Measure of memory used." + + // JvmMemoryCommitted is the metric conforming to the "jvm.memory.committed" + // semantic conventions. It represents the measure of memory committed. + // Instrument: updowncounter + // Unit: By + // Stability: Stable + JvmMemoryCommittedName = "jvm.memory.committed" + JvmMemoryCommittedUnit = "By" + JvmMemoryCommittedDescription = "Measure of memory committed." + + // JvmMemoryLimit is the metric conforming to the "jvm.memory.limit" semantic + // conventions. It represents the measure of max obtainable memory. + // Instrument: updowncounter + // Unit: By + // Stability: Stable + JvmMemoryLimitName = "jvm.memory.limit" + JvmMemoryLimitUnit = "By" + JvmMemoryLimitDescription = "Measure of max obtainable memory." + + // JvmMemoryUsedAfterLastGc is the metric conforming to the + // "jvm.memory.used_after_last_gc" semantic conventions. It represents the + // measure of memory used, as measured after the most recent garbage collection + // event on this pool. + // Instrument: updowncounter + // Unit: By + // Stability: Stable + JvmMemoryUsedAfterLastGcName = "jvm.memory.used_after_last_gc" + JvmMemoryUsedAfterLastGcUnit = "By" + JvmMemoryUsedAfterLastGcDescription = "Measure of memory used, as measured after the most recent garbage collection event on this pool." + + // JvmGcDuration is the metric conforming to the "jvm.gc.duration" semantic + // conventions. It represents the duration of JVM garbage collection actions. + // Instrument: histogram + // Unit: s + // Stability: Stable + JvmGcDurationName = "jvm.gc.duration" + JvmGcDurationUnit = "s" + JvmGcDurationDescription = "Duration of JVM garbage collection actions." + + // JvmThreadCount is the metric conforming to the "jvm.thread.count" semantic + // conventions. It represents the number of executing platform threads. + // Instrument: updowncounter + // Unit: {thread} + // Stability: Stable + JvmThreadCountName = "jvm.thread.count" + JvmThreadCountUnit = "{thread}" + JvmThreadCountDescription = "Number of executing platform threads." + + // JvmClassLoaded is the metric conforming to the "jvm.class.loaded" semantic + // conventions. It represents the number of classes loaded since JVM start. + // Instrument: counter + // Unit: {class} + // Stability: Stable + JvmClassLoadedName = "jvm.class.loaded" + JvmClassLoadedUnit = "{class}" + JvmClassLoadedDescription = "Number of classes loaded since JVM start." + + // JvmClassUnloaded is the metric conforming to the "jvm.class.unloaded" + // semantic conventions. It represents the number of classes unloaded since JVM + // start. + // Instrument: counter + // Unit: {class} + // Stability: Stable + JvmClassUnloadedName = "jvm.class.unloaded" + JvmClassUnloadedUnit = "{class}" + JvmClassUnloadedDescription = "Number of classes unloaded since JVM start." + + // JvmClassCount is the metric conforming to the "jvm.class.count" semantic + // conventions. It represents the number of classes currently loaded. + // Instrument: updowncounter + // Unit: {class} + // Stability: Stable + JvmClassCountName = "jvm.class.count" + JvmClassCountUnit = "{class}" + JvmClassCountDescription = "Number of classes currently loaded." + + // JvmCPUCount is the metric conforming to the "jvm.cpu.count" semantic + // conventions. It represents the number of processors available to the Java + // virtual machine. + // Instrument: updowncounter + // Unit: {cpu} + // Stability: Stable + JvmCPUCountName = "jvm.cpu.count" + JvmCPUCountUnit = "{cpu}" + JvmCPUCountDescription = "Number of processors available to the Java virtual machine." + + // JvmCPUTime is the metric conforming to the "jvm.cpu.time" semantic + // conventions. It represents the cPU time used by the process as reported by + // the JVM. + // Instrument: counter + // Unit: s + // Stability: Stable + JvmCPUTimeName = "jvm.cpu.time" + JvmCPUTimeUnit = "s" + JvmCPUTimeDescription = "CPU time used by the process as reported by the JVM." + + // JvmCPURecentUtilization is the metric conforming to the + // "jvm.cpu.recent_utilization" semantic conventions. It represents the recent + // CPU utilization for the process as reported by the JVM. + // Instrument: gauge + // Unit: 1 + // Stability: Stable + JvmCPURecentUtilizationName = "jvm.cpu.recent_utilization" + JvmCPURecentUtilizationUnit = "1" + JvmCPURecentUtilizationDescription = "Recent CPU utilization for the process as reported by the JVM." + + // MessagingPublishDuration is the metric conforming to the + // "messaging.publish.duration" semantic conventions. It represents the + // measures the duration of publish operation. + // Instrument: histogram + // Unit: s + // Stability: Experimental + MessagingPublishDurationName = "messaging.publish.duration" + MessagingPublishDurationUnit = "s" + MessagingPublishDurationDescription = "Measures the duration of publish operation." + + // MessagingReceiveDuration is the metric conforming to the + // "messaging.receive.duration" semantic conventions. It represents the + // measures the duration of receive operation. + // Instrument: histogram + // Unit: s + // Stability: Experimental + MessagingReceiveDurationName = "messaging.receive.duration" + MessagingReceiveDurationUnit = "s" + MessagingReceiveDurationDescription = "Measures the duration of receive operation." + + // MessagingProcessDuration is the metric conforming to the + // "messaging.process.duration" semantic conventions. It represents the + // measures the duration of process operation. + // Instrument: histogram + // Unit: s + // Stability: Experimental + MessagingProcessDurationName = "messaging.process.duration" + MessagingProcessDurationUnit = "s" + MessagingProcessDurationDescription = "Measures the duration of process operation." + + // MessagingPublishMessages is the metric conforming to the + // "messaging.publish.messages" semantic conventions. It represents the + // measures the number of published messages. + // Instrument: counter + // Unit: {message} + // Stability: Experimental + MessagingPublishMessagesName = "messaging.publish.messages" + MessagingPublishMessagesUnit = "{message}" + MessagingPublishMessagesDescription = "Measures the number of published messages." + + // MessagingReceiveMessages is the metric conforming to the + // "messaging.receive.messages" semantic conventions. It represents the + // measures the number of received messages. + // Instrument: counter + // Unit: {message} + // Stability: Experimental + MessagingReceiveMessagesName = "messaging.receive.messages" + MessagingReceiveMessagesUnit = "{message}" + MessagingReceiveMessagesDescription = "Measures the number of received messages." + + // MessagingProcessMessages is the metric conforming to the + // "messaging.process.messages" semantic conventions. It represents the + // measures the number of processed messages. + // Instrument: counter + // Unit: {message} + // Stability: Experimental + MessagingProcessMessagesName = "messaging.process.messages" + MessagingProcessMessagesUnit = "{message}" + MessagingProcessMessagesDescription = "Measures the number of processed messages." + + // ProcessCPUTime is the metric conforming to the "process.cpu.time" semantic + // conventions. It represents the total CPU seconds broken down by different + // states. + // Instrument: counter + // Unit: s + // Stability: Experimental + ProcessCPUTimeName = "process.cpu.time" + ProcessCPUTimeUnit = "s" + ProcessCPUTimeDescription = "Total CPU seconds broken down by different states." + + // ProcessCPUUtilization is the metric conforming to the + // "process.cpu.utilization" semantic conventions. It represents the difference + // in process.cpu.time since the last measurement, divided by the elapsed time + // and number of CPUs available to the process. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + ProcessCPUUtilizationName = "process.cpu.utilization" + ProcessCPUUtilizationUnit = "1" + ProcessCPUUtilizationDescription = "Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process." + + // ProcessMemoryUsage is the metric conforming to the "process.memory.usage" + // semantic conventions. It represents the amount of physical memory in use. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + ProcessMemoryUsageName = "process.memory.usage" + ProcessMemoryUsageUnit = "By" + ProcessMemoryUsageDescription = "The amount of physical memory in use." + + // ProcessMemoryVirtual is the metric conforming to the + // "process.memory.virtual" semantic conventions. It represents the amount of + // committed virtual memory. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + ProcessMemoryVirtualName = "process.memory.virtual" + ProcessMemoryVirtualUnit = "By" + ProcessMemoryVirtualDescription = "The amount of committed virtual memory." + + // ProcessDiskIo is the metric conforming to the "process.disk.io" semantic + // conventions. It represents the disk bytes transferred. + // Instrument: counter + // Unit: By + // Stability: Experimental + ProcessDiskIoName = "process.disk.io" + ProcessDiskIoUnit = "By" + ProcessDiskIoDescription = "Disk bytes transferred." + + // ProcessNetworkIo is the metric conforming to the "process.network.io" + // semantic conventions. It represents the network bytes transferred. + // Instrument: counter + // Unit: By + // Stability: Experimental + ProcessNetworkIoName = "process.network.io" + ProcessNetworkIoUnit = "By" + ProcessNetworkIoDescription = "Network bytes transferred." + + // ProcessThreadCount is the metric conforming to the "process.thread.count" + // semantic conventions. It represents the process threads count. + // Instrument: updowncounter + // Unit: {thread} + // Stability: Experimental + ProcessThreadCountName = "process.thread.count" + ProcessThreadCountUnit = "{thread}" + ProcessThreadCountDescription = "Process threads count." + + // ProcessOpenFileDescriptorCount is the metric conforming to the + // "process.open_file_descriptor.count" semantic conventions. It represents the + // number of file descriptors in use by the process. + // Instrument: updowncounter + // Unit: {count} + // Stability: Experimental + ProcessOpenFileDescriptorCountName = "process.open_file_descriptor.count" + ProcessOpenFileDescriptorCountUnit = "{count}" + ProcessOpenFileDescriptorCountDescription = "Number of file descriptors in use by the process." + + // ProcessContextSwitches is the metric conforming to the + // "process.context_switches" semantic conventions. It represents the number of + // times the process has been context switched. + // Instrument: counter + // Unit: {count} + // Stability: Experimental + ProcessContextSwitchesName = "process.context_switches" + ProcessContextSwitchesUnit = "{count}" + ProcessContextSwitchesDescription = "Number of times the process has been context switched." + + // ProcessPagingFaults is the metric conforming to the "process.paging.faults" + // semantic conventions. It represents the number of page faults the process + // has made. + // Instrument: counter + // Unit: {fault} + // Stability: Experimental + ProcessPagingFaultsName = "process.paging.faults" + ProcessPagingFaultsUnit = "{fault}" + ProcessPagingFaultsDescription = "Number of page faults the process has made." + + // RPCServerDuration is the metric conforming to the "rpc.server.duration" + // semantic conventions. It represents the measures the duration of inbound + // RPC. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + RPCServerDurationName = "rpc.server.duration" + RPCServerDurationUnit = "ms" + RPCServerDurationDescription = "Measures the duration of inbound RPC." + + // RPCServerRequestSize is the metric conforming to the + // "rpc.server.request.size" semantic conventions. It represents the measures + // the size of RPC request messages (uncompressed). + // Instrument: histogram + // Unit: By + // Stability: Experimental + RPCServerRequestSizeName = "rpc.server.request.size" + RPCServerRequestSizeUnit = "By" + RPCServerRequestSizeDescription = "Measures the size of RPC request messages (uncompressed)." + + // RPCServerResponseSize is the metric conforming to the + // "rpc.server.response.size" semantic conventions. It represents the measures + // the size of RPC response messages (uncompressed). + // Instrument: histogram + // Unit: By + // Stability: Experimental + RPCServerResponseSizeName = "rpc.server.response.size" + RPCServerResponseSizeUnit = "By" + RPCServerResponseSizeDescription = "Measures the size of RPC response messages (uncompressed)." + + // RPCServerRequestsPerRPC is the metric conforming to the + // "rpc.server.requests_per_rpc" semantic conventions. It represents the + // measures the number of messages received per RPC. + // Instrument: histogram + // Unit: {count} + // Stability: Experimental + RPCServerRequestsPerRPCName = "rpc.server.requests_per_rpc" + RPCServerRequestsPerRPCUnit = "{count}" + RPCServerRequestsPerRPCDescription = "Measures the number of messages received per RPC." + + // RPCServerResponsesPerRPC is the metric conforming to the + // "rpc.server.responses_per_rpc" semantic conventions. It represents the + // measures the number of messages sent per RPC. + // Instrument: histogram + // Unit: {count} + // Stability: Experimental + RPCServerResponsesPerRPCName = "rpc.server.responses_per_rpc" + RPCServerResponsesPerRPCUnit = "{count}" + RPCServerResponsesPerRPCDescription = "Measures the number of messages sent per RPC." + + // RPCClientDuration is the metric conforming to the "rpc.client.duration" + // semantic conventions. It represents the measures the duration of outbound + // RPC. + // Instrument: histogram + // Unit: ms + // Stability: Experimental + RPCClientDurationName = "rpc.client.duration" + RPCClientDurationUnit = "ms" + RPCClientDurationDescription = "Measures the duration of outbound RPC." + + // RPCClientRequestSize is the metric conforming to the + // "rpc.client.request.size" semantic conventions. It represents the measures + // the size of RPC request messages (uncompressed). + // Instrument: histogram + // Unit: By + // Stability: Experimental + RPCClientRequestSizeName = "rpc.client.request.size" + RPCClientRequestSizeUnit = "By" + RPCClientRequestSizeDescription = "Measures the size of RPC request messages (uncompressed)." + + // RPCClientResponseSize is the metric conforming to the + // "rpc.client.response.size" semantic conventions. It represents the measures + // the size of RPC response messages (uncompressed). + // Instrument: histogram + // Unit: By + // Stability: Experimental + RPCClientResponseSizeName = "rpc.client.response.size" + RPCClientResponseSizeUnit = "By" + RPCClientResponseSizeDescription = "Measures the size of RPC response messages (uncompressed)." + + // RPCClientRequestsPerRPC is the metric conforming to the + // "rpc.client.requests_per_rpc" semantic conventions. It represents the + // measures the number of messages received per RPC. + // Instrument: histogram + // Unit: {count} + // Stability: Experimental + RPCClientRequestsPerRPCName = "rpc.client.requests_per_rpc" + RPCClientRequestsPerRPCUnit = "{count}" + RPCClientRequestsPerRPCDescription = "Measures the number of messages received per RPC." + + // RPCClientResponsesPerRPC is the metric conforming to the + // "rpc.client.responses_per_rpc" semantic conventions. It represents the + // measures the number of messages sent per RPC. + // Instrument: histogram + // Unit: {count} + // Stability: Experimental + RPCClientResponsesPerRPCName = "rpc.client.responses_per_rpc" + RPCClientResponsesPerRPCUnit = "{count}" + RPCClientResponsesPerRPCDescription = "Measures the number of messages sent per RPC." + + // SystemCPUTime is the metric conforming to the "system.cpu.time" semantic + // conventions. It represents the seconds each logical CPU spent on each mode. + // Instrument: counter + // Unit: s + // Stability: Experimental + SystemCPUTimeName = "system.cpu.time" + SystemCPUTimeUnit = "s" + SystemCPUTimeDescription = "Seconds each logical CPU spent on each mode" + + // SystemCPUUtilization is the metric conforming to the + // "system.cpu.utilization" semantic conventions. It represents the difference + // in system.cpu.time since the last measurement, divided by the elapsed time + // and number of logical CPUs. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + SystemCPUUtilizationName = "system.cpu.utilization" + SystemCPUUtilizationUnit = "1" + SystemCPUUtilizationDescription = "Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs" + + // SystemCPUFrequency is the metric conforming to the "system.cpu.frequency" + // semantic conventions. It represents the reports the current frequency of the + // CPU in Hz. + // Instrument: gauge + // Unit: {Hz} + // Stability: Experimental + SystemCPUFrequencyName = "system.cpu.frequency" + SystemCPUFrequencyUnit = "{Hz}" + SystemCPUFrequencyDescription = "Reports the current frequency of the CPU in Hz" + + // SystemCPUPhysicalCount is the metric conforming to the + // "system.cpu.physical.count" semantic conventions. It represents the reports + // the number of actual physical processor cores on the hardware. + // Instrument: updowncounter + // Unit: {cpu} + // Stability: Experimental + SystemCPUPhysicalCountName = "system.cpu.physical.count" + SystemCPUPhysicalCountUnit = "{cpu}" + SystemCPUPhysicalCountDescription = "Reports the number of actual physical processor cores on the hardware" + + // SystemCPULogicalCount is the metric conforming to the + // "system.cpu.logical.count" semantic conventions. It represents the reports + // the number of logical (virtual) processor cores created by the operating + // system to manage multitasking. + // Instrument: updowncounter + // Unit: {cpu} + // Stability: Experimental + SystemCPULogicalCountName = "system.cpu.logical.count" + SystemCPULogicalCountUnit = "{cpu}" + SystemCPULogicalCountDescription = "Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking" + + // SystemMemoryUsage is the metric conforming to the "system.memory.usage" + // semantic conventions. It represents the reports memory in use by state. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemMemoryUsageName = "system.memory.usage" + SystemMemoryUsageUnit = "By" + SystemMemoryUsageDescription = "Reports memory in use by state." + + // SystemMemoryLimit is the metric conforming to the "system.memory.limit" + // semantic conventions. It represents the total memory available in the + // system. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemMemoryLimitName = "system.memory.limit" + SystemMemoryLimitUnit = "By" + SystemMemoryLimitDescription = "Total memory available in the system." + + // SystemMemoryShared is the metric conforming to the "system.memory.shared" + // semantic conventions. It represents the shared memory used (mostly by + // tmpfs). + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemMemorySharedName = "system.memory.shared" + SystemMemorySharedUnit = "By" + SystemMemorySharedDescription = "Shared memory used (mostly by tmpfs)." + + // SystemMemoryUtilization is the metric conforming to the + // "system.memory.utilization" semantic conventions. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemMemoryUtilizationName = "system.memory.utilization" + SystemMemoryUtilizationUnit = "1" + + // SystemPagingUsage is the metric conforming to the "system.paging.usage" + // semantic conventions. It represents the unix swap or windows pagefile usage. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemPagingUsageName = "system.paging.usage" + SystemPagingUsageUnit = "By" + SystemPagingUsageDescription = "Unix swap or windows pagefile usage" + + // SystemPagingUtilization is the metric conforming to the + // "system.paging.utilization" semantic conventions. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemPagingUtilizationName = "system.paging.utilization" + SystemPagingUtilizationUnit = "1" + + // SystemPagingFaults is the metric conforming to the "system.paging.faults" + // semantic conventions. + // Instrument: counter + // Unit: {fault} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemPagingFaultsName = "system.paging.faults" + SystemPagingFaultsUnit = "{fault}" + + // SystemPagingOperations is the metric conforming to the + // "system.paging.operations" semantic conventions. + // Instrument: counter + // Unit: {operation} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemPagingOperationsName = "system.paging.operations" + SystemPagingOperationsUnit = "{operation}" + + // SystemDiskIo is the metric conforming to the "system.disk.io" semantic + // conventions. + // Instrument: counter + // Unit: By + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemDiskIoName = "system.disk.io" + SystemDiskIoUnit = "By" + + // SystemDiskOperations is the metric conforming to the + // "system.disk.operations" semantic conventions. + // Instrument: counter + // Unit: {operation} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemDiskOperationsName = "system.disk.operations" + SystemDiskOperationsUnit = "{operation}" + + // SystemDiskIoTime is the metric conforming to the "system.disk.io_time" + // semantic conventions. It represents the time disk spent activated. + // Instrument: counter + // Unit: s + // Stability: Experimental + SystemDiskIoTimeName = "system.disk.io_time" + SystemDiskIoTimeUnit = "s" + SystemDiskIoTimeDescription = "Time disk spent activated" + + // SystemDiskOperationTime is the metric conforming to the + // "system.disk.operation_time" semantic conventions. It represents the sum of + // the time each operation took to complete. + // Instrument: counter + // Unit: s + // Stability: Experimental + SystemDiskOperationTimeName = "system.disk.operation_time" + SystemDiskOperationTimeUnit = "s" + SystemDiskOperationTimeDescription = "Sum of the time each operation took to complete" + + // SystemDiskMerged is the metric conforming to the "system.disk.merged" + // semantic conventions. + // Instrument: counter + // Unit: {operation} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemDiskMergedName = "system.disk.merged" + SystemDiskMergedUnit = "{operation}" + + // SystemFilesystemUsage is the metric conforming to the + // "system.filesystem.usage" semantic conventions. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemFilesystemUsageName = "system.filesystem.usage" + SystemFilesystemUsageUnit = "By" + + // SystemFilesystemUtilization is the metric conforming to the + // "system.filesystem.utilization" semantic conventions. + // Instrument: gauge + // Unit: 1 + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemFilesystemUtilizationName = "system.filesystem.utilization" + SystemFilesystemUtilizationUnit = "1" + + // SystemNetworkDropped is the metric conforming to the + // "system.network.dropped" semantic conventions. It represents the count of + // packets that are dropped or discarded even though there was no error. + // Instrument: counter + // Unit: {packet} + // Stability: Experimental + SystemNetworkDroppedName = "system.network.dropped" + SystemNetworkDroppedUnit = "{packet}" + SystemNetworkDroppedDescription = "Count of packets that are dropped or discarded even though there was no error" + + // SystemNetworkPackets is the metric conforming to the + // "system.network.packets" semantic conventions. + // Instrument: counter + // Unit: {packet} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemNetworkPacketsName = "system.network.packets" + SystemNetworkPacketsUnit = "{packet}" + + // SystemNetworkErrors is the metric conforming to the "system.network.errors" + // semantic conventions. It represents the count of network errors detected. + // Instrument: counter + // Unit: {error} + // Stability: Experimental + SystemNetworkErrorsName = "system.network.errors" + SystemNetworkErrorsUnit = "{error}" + SystemNetworkErrorsDescription = "Count of network errors detected" + + // SystemNetworkIo is the metric conforming to the "system.network.io" semantic + // conventions. + // Instrument: counter + // Unit: By + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemNetworkIoName = "system.network.io" + SystemNetworkIoUnit = "By" + + // SystemNetworkConnections is the metric conforming to the + // "system.network.connections" semantic conventions. + // Instrument: updowncounter + // Unit: {connection} + // Stability: Experimental + // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. + SystemNetworkConnectionsName = "system.network.connections" + SystemNetworkConnectionsUnit = "{connection}" + + // SystemProcessCount is the metric conforming to the "system.process.count" + // semantic conventions. It represents the total number of processes in each + // state. + // Instrument: updowncounter + // Unit: {process} + // Stability: Experimental + SystemProcessCountName = "system.process.count" + SystemProcessCountUnit = "{process}" + SystemProcessCountDescription = "Total number of processes in each state" + + // SystemProcessCreated is the metric conforming to the + // "system.process.created" semantic conventions. It represents the total + // number of processes created over uptime of the host. + // Instrument: counter + // Unit: {process} + // Stability: Experimental + SystemProcessCreatedName = "system.process.created" + SystemProcessCreatedUnit = "{process}" + SystemProcessCreatedDescription = "Total number of processes created over uptime of the host" + + // SystemLinuxMemoryAvailable is the metric conforming to the + // "system.linux.memory.available" semantic conventions. It represents an + // estimate of how much memory is available for starting new applications, + // without causing swapping. + // Instrument: updowncounter + // Unit: By + // Stability: Experimental + SystemLinuxMemoryAvailableName = "system.linux.memory.available" + SystemLinuxMemoryAvailableUnit = "By" + SystemLinuxMemoryAvailableDescription = "An estimate of how much memory is available for starting new applications, without causing swapping" +) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/schema.go new file mode 100644 index 000000000..4c87c7adc --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/schema.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.26.0" diff --git a/vendor/go.opentelemetry.io/otel/trace.go b/vendor/go.opentelemetry.io/otel/trace.go index caf7249de..6836c6547 100644 --- a/vendor/go.opentelemetry.io/otel/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/trace/README.md b/vendor/go.opentelemetry.io/otel/trace/README.md new file mode 100644 index 000000000..58ccaba69 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/README.md @@ -0,0 +1,3 @@ +# Trace API + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/trace)](https://pkg.go.dev/go.opentelemetry.io/otel/trace) diff --git a/vendor/go.opentelemetry.io/otel/trace/config.go b/vendor/go.opentelemetry.io/otel/trace/config.go index 3aadc66cf..273d58e00 100644 --- a/vendor/go.opentelemetry.io/otel/trace/config.go +++ b/vendor/go.opentelemetry.io/otel/trace/config.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/trace" diff --git a/vendor/go.opentelemetry.io/otel/trace/context.go b/vendor/go.opentelemetry.io/otel/trace/context.go index 76f9a083c..5650a174b 100644 --- a/vendor/go.opentelemetry.io/otel/trace/context.go +++ b/vendor/go.opentelemetry.io/otel/trace/context.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/trace" @@ -47,12 +36,12 @@ func ContextWithRemoteSpanContext(parent context.Context, rsc SpanContext) conte // performs no operations is returned. func SpanFromContext(ctx context.Context) Span { if ctx == nil { - return noopSpan{} + return noopSpanInstance } if span, ok := ctx.Value(currentSpanKey).(Span); ok { return span } - return noopSpan{} + return noopSpanInstance } // SpanContextFromContext returns the current Span's SpanContext. diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go index 440f3d756..d661c5d10 100644 --- a/vendor/go.opentelemetry.io/otel/trace/doc.go +++ b/vendor/go.opentelemetry.io/otel/trace/doc.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 /* Package trace provides an implementation of the tracing part of the diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/README.md b/vendor/go.opentelemetry.io/otel/trace/embedded/README.md new file mode 100644 index 000000000..7754a239e --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/embedded/README.md @@ -0,0 +1,3 @@ +# Trace Embedded + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/trace/embedded)](https://pkg.go.dev/go.opentelemetry.io/otel/trace/embedded) diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go index 898db5a75..3e359a00b 100644 --- a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go +++ b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package embedded provides interfaces embedded within the [OpenTelemetry // trace API]. diff --git a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go index 88fcb8161..c00221e7b 100644 --- a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go +++ b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/trace" diff --git a/vendor/go.opentelemetry.io/otel/trace/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop.go index c125491ca..ca20e9997 100644 --- a/vendor/go.opentelemetry.io/otel/trace/noop.go +++ b/vendor/go.opentelemetry.io/otel/trace/noop.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/trace" @@ -52,7 +41,7 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption span := SpanFromContext(ctx) if _, ok := span.(nonRecordingSpan); !ok { // span is likely already a noopSpan, but let's be sure - span = noopSpan{} + span = noopSpanInstance } return ContextWithSpan(ctx, span), span } @@ -60,7 +49,7 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption // noopSpan is an implementation of Span that performs no operations. type noopSpan struct{ embedded.Span } -var _ Span = noopSpan{} +var noopSpanInstance Span = noopSpan{} // SpanContext returns an empty span context. func (noopSpan) SpanContext() SpanContext { return SpanContext{} } @@ -86,6 +75,9 @@ func (noopSpan) RecordError(error, ...EventOption) {} // AddEvent does nothing. func (noopSpan) AddEvent(string, ...EventOption) {} +// AddLink does nothing. +func (noopSpan) AddLink(Link) {} + // SetName does nothing. func (noopSpan) SetName(string) {} diff --git a/vendor/go.opentelemetry.io/otel/trace/noop/README.md b/vendor/go.opentelemetry.io/otel/trace/noop/README.md new file mode 100644 index 000000000..cd382c82a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/noop/README.md @@ -0,0 +1,3 @@ +# Trace Noop + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/trace/noop)](https://pkg.go.dev/go.opentelemetry.io/otel/trace/noop) diff --git a/vendor/go.opentelemetry.io/otel/trace/noop/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go index 7f485543c..64a4f1b36 100644 --- a/vendor/go.opentelemetry.io/otel/trace/noop/noop.go +++ b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 // Package noop provides an implementation of the OpenTelemetry trace API that // produces no telemetry and minimizes used computation resources. @@ -78,11 +67,13 @@ func (t Tracer) Start(ctx context.Context, _ string, _ ...trace.SpanStartOption) span = Span{sc: sc} } else { // No parent, return a No-Op span with an empty span context. - span = Span{} + span = noopSpanInstance } return trace.ContextWithSpan(ctx, span), span } +var noopSpanInstance trace.Span = Span{} + // Span is an OpenTelemetry No-Op Span. type Span struct { embedded.Span @@ -111,6 +102,9 @@ func (Span) RecordError(error, ...trace.EventOption) {} // AddEvent does nothing. func (Span) AddEvent(string, ...trace.EventOption) {} +// AddLink does nothing. +func (Span) AddLink(trace.Link) {} + // SetName does nothing. func (Span) SetName(string) {} diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go index 26a4b2260..28877d4ab 100644 --- a/vendor/go.opentelemetry.io/otel/trace/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -1,16 +1,5 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/trace" @@ -361,6 +350,12 @@ type Span interface { // AddEvent adds an event with the provided name and options. AddEvent(name string, options ...EventOption) + // AddLink adds a link. + // Adding links at span creation using WithLinks is preferred to calling AddLink + // later, for contexts that are available during span creation, because head + // sampling decisions can only consider information present during span creation. + AddLink(link Link) + // IsRecording returns the recording state of the Span. It will return // true if the Span is active and events can be recorded. IsRecording() bool diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go index d1e47ca2f..20b5cf243 100644 --- a/vendor/go.opentelemetry.io/otel/trace/tracestate.go +++ b/vendor/go.opentelemetry.io/otel/trace/tracestate.go @@ -1,36 +1,19 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package trace // import "go.opentelemetry.io/otel/trace" import ( "encoding/json" "fmt" - "regexp" "strings" ) const ( maxListMembers = 32 - listDelimiter = "," - - // based on the W3C Trace Context specification, see - // https://www.w3.org/TR/trace-context-1/#tracestate-header - noTenantKeyFormat = `[a-z][_0-9a-z\-\*\/]*` - withTenantKeyFormat = `[a-z0-9][_0-9a-z\-\*\/]*@[a-z][_0-9a-z\-\*\/]*` - valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]*[\x21-\x2b\x2d-\x3c\x3e-\x7e]` + listDelimiters = "," + memberDelimiter = "=" errInvalidKey errorConst = "invalid tracestate key" errInvalidValue errorConst = "invalid tracestate value" @@ -39,43 +22,128 @@ const ( errDuplicate errorConst = "duplicate list-member in tracestate" ) -var ( - noTenantKeyRe = regexp.MustCompile(`^` + noTenantKeyFormat + `$`) - withTenantKeyRe = regexp.MustCompile(`^` + withTenantKeyFormat + `$`) - valueRe = regexp.MustCompile(`^` + valueFormat + `$`) - memberRe = regexp.MustCompile(`^\s*((?:` + noTenantKeyFormat + `)|(?:` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`) -) - type member struct { Key string Value string } -func newMember(key, value string) (member, error) { - if len(key) > 256 { - return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) +// according to (chr = %x20 / (nblk-char = %x21-2B / %x2D-3C / %x3E-7E) ) +// means (chr = %x20-2B / %x2D-3C / %x3E-7E) . +func checkValueChar(v byte) bool { + return v >= '\x20' && v <= '\x7e' && v != '\x2c' && v != '\x3d' +} + +// according to (nblk-chr = %x21-2B / %x2D-3C / %x3E-7E) . +func checkValueLast(v byte) bool { + return v >= '\x21' && v <= '\x7e' && v != '\x2c' && v != '\x3d' +} + +// based on the W3C Trace Context specification +// +// value = (0*255(chr)) nblk-chr +// nblk-chr = %x21-2B / %x2D-3C / %x3E-7E +// chr = %x20 / nblk-chr +// +// see https://www.w3.org/TR/trace-context-1/#value +func checkValue(val string) bool { + n := len(val) + if n == 0 || n > 256 { + return false } - if !noTenantKeyRe.MatchString(key) { - if !withTenantKeyRe.MatchString(key) { - return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) + for i := 0; i < n-1; i++ { + if !checkValueChar(val[i]) { + return false } - atIndex := strings.LastIndex(key, "@") - if atIndex > 241 || len(key)-1-atIndex > 14 { - return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) + } + return checkValueLast(val[n-1]) +} + +func checkKeyRemain(key string) bool { + // ( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) + for _, v := range key { + if isAlphaNum(byte(v)) { + continue } + switch v { + case '_', '-', '*', '/': + continue + } + return false } - if len(value) > 256 || !valueRe.MatchString(value) { - return member{}, fmt.Errorf("%w: %s", errInvalidValue, value) + return true +} + +// according to +// +// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// +// param n is remain part length, should be 255 in simple-key or 13 in system-id. +func checkKeyPart(key string, n int) bool { + if len(key) == 0 { + return false + } + first := key[0] // key's first char + ret := len(key[1:]) <= n + ret = ret && first >= 'a' && first <= 'z' + return ret && checkKeyRemain(key[1:]) +} + +func isAlphaNum(c byte) bool { + if c >= 'a' && c <= 'z' { + return true + } + return c >= '0' && c <= '9' +} + +// according to +// +// tenant-id = ( lcalpha / DIGIT ) 0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) +// +// param n is remain part length, should be 240 exactly. +func checkKeyTenant(key string, n int) bool { + if len(key) == 0 { + return false + } + return isAlphaNum(key[0]) && len(key[1:]) <= n && checkKeyRemain(key[1:]) +} + +// based on the W3C Trace Context specification +// +// key = simple-key / multi-tenant-key +// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// multi-tenant-key = tenant-id "@" system-id +// tenant-id = ( lcalpha / DIGIT ) (0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// lcalpha = %x61-7A ; a-z +// +// see https://www.w3.org/TR/trace-context-1/#tracestate-header. +func checkKey(key string) bool { + tenant, system, ok := strings.Cut(key, "@") + if !ok { + return checkKeyPart(key, 255) + } + return checkKeyTenant(tenant, 240) && checkKeyPart(system, 13) +} + +func newMember(key, value string) (member, error) { + if !checkKey(key) { + return member{}, errInvalidKey + } + if !checkValue(value) { + return member{}, errInvalidValue } return member{Key: key, Value: value}, nil } func parseMember(m string) (member, error) { - matches := memberRe.FindStringSubmatch(m) - if len(matches) != 3 { + key, val, ok := strings.Cut(m, memberDelimiter) + if !ok { return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) } - result, e := newMember(matches[1], matches[2]) + key = strings.TrimLeft(key, " \t") + val = strings.TrimRight(val, " \t") + result, e := newMember(key, val) if e != nil { return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) } @@ -85,7 +153,7 @@ func parseMember(m string) (member, error) { // String encodes member into a string compliant with the W3C Trace Context // specification. func (m member) String() string { - return fmt.Sprintf("%s=%s", m.Key, m.Value) + return m.Key + "=" + m.Value } // TraceState provides additional vendor-specific trace identification @@ -109,8 +177,8 @@ var _ json.Marshaler = TraceState{} // ParseTraceState attempts to decode a TraceState from the passed // string. It returns an error if the input is invalid according to the W3C // Trace Context specification. -func ParseTraceState(tracestate string) (TraceState, error) { - if tracestate == "" { +func ParseTraceState(ts string) (TraceState, error) { + if ts == "" { return TraceState{}, nil } @@ -120,7 +188,9 @@ func ParseTraceState(tracestate string) (TraceState, error) { var members []member found := make(map[string]struct{}) - for _, memberStr := range strings.Split(tracestate, listDelimiter) { + for ts != "" { + var memberStr string + memberStr, ts, _ = strings.Cut(ts, listDelimiters) if len(memberStr) == 0 { continue } @@ -153,11 +223,29 @@ func (ts TraceState) MarshalJSON() ([]byte, error) { // Trace Context specification. The returned string will be invalid if the // TraceState contains any invalid members. func (ts TraceState) String() string { - members := make([]string, len(ts.list)) - for i, m := range ts.list { - members[i] = m.String() + if len(ts.list) == 0 { + return "" + } + var n int + n += len(ts.list) // member delimiters: '=' + n += len(ts.list) - 1 // list delimiters: ',' + for _, mem := range ts.list { + n += len(mem.Key) + n += len(mem.Value) } - return strings.Join(members, listDelimiter) + + var sb strings.Builder + sb.Grow(n) + _, _ = sb.WriteString(ts.list[0].Key) + _ = sb.WriteByte('=') + _, _ = sb.WriteString(ts.list[0].Value) + for i := 1; i < len(ts.list); i++ { + _ = sb.WriteByte(listDelimiters[0]) + _, _ = sb.WriteString(ts.list[i].Key) + _ = sb.WriteByte('=') + _, _ = sb.WriteString(ts.list[i].Value) + } + return sb.String() } // Get returns the value paired with key from the corresponding TraceState @@ -189,15 +277,25 @@ func (ts TraceState) Insert(key, value string) (TraceState, error) { if err != nil { return ts, err } - - cTS := ts.Delete(key) - if cTS.Len()+1 <= maxListMembers { - cTS.list = append(cTS.list, member{}) + n := len(ts.list) + found := n + for i := range ts.list { + if ts.list[i].Key == key { + found = i + } + } + cTS := TraceState{} + if found == n && n < maxListMembers { + cTS.list = make([]member, n+1) + } else { + cTS.list = make([]member, n) } - // When the number of members exceeds capacity, drop the "right-most". - copy(cTS.list[1:], cTS.list) cTS.list[0] = m - + // When the number of members exceeds capacity, drop the "right-most". + copy(cTS.list[1:], ts.list[0:found]) + if found < n { + copy(cTS.list[1+found:], ts.list[found+1:]) + } return cTS, nil } diff --git a/vendor/go.opentelemetry.io/otel/verify_examples.sh b/vendor/go.opentelemetry.io/otel/verify_examples.sh index dbb61a422..e57bf57fc 100644 --- a/vendor/go.opentelemetry.io/otel/verify_examples.sh +++ b/vendor/go.opentelemetry.io/otel/verify_examples.sh @@ -1,18 +1,7 @@ #!/bin/bash # Copyright The OpenTelemetry Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# SPDX-License-Identifier: Apache-2.0 set -euo pipefail diff --git a/vendor/go.opentelemetry.io/otel/verify_readmes.sh b/vendor/go.opentelemetry.io/otel/verify_readmes.sh new file mode 100644 index 000000000..1e87855ee --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/verify_readmes.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -euo pipefail + +dirs=$(find . -type d -not -path "*/internal*" -not -path "*/test*" -not -path "*/example*" -not -path "*/.*" | sort) + +missingReadme=false +for dir in $dirs; do + if [ ! -f "$dir/README.md" ]; then + echo "couldn't find README.md for $dir" + missingReadme=true + fi +done + +if [ "$missingReadme" = true ] ; then + echo "Error: some READMEs couldn't be found." + exit 1 +fi diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go index 5a92f1d4b..ab2896052 100644 --- a/vendor/go.opentelemetry.io/otel/version.go +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -1,20 +1,9 @@ // Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// SPDX-License-Identifier: Apache-2.0 package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.20.0" + return "1.28.0" } diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml index 82366e799..241cfc82a 100644 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -1,33 +1,27 @@ # Copyright The OpenTelemetry Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# SPDX-License-Identifier: Apache-2.0 module-sets: stable-v1: - version: v1.20.0 + version: v1.28.0 modules: - go.opentelemetry.io/otel + - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/bridge/opentracing - go.opentelemetry.io/otel/bridge/opentracing/test - go.opentelemetry.io/otel/example/dice - - go.opentelemetry.io/otel/example/fib - go.opentelemetry.io/otel/example/namedtracer + - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/otel-collector - go.opentelemetry.io/otel/example/passthrough - go.opentelemetry.io/otel/example/zipkin + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/otlp/otlptrace - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp + - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - go.opentelemetry.io/otel/exporters/stdout/stdouttrace - go.opentelemetry.io/otel/exporters/zipkin - go.opentelemetry.io/otel/metric @@ -35,21 +29,21 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.43.0 + version: v0.50.0 modules: - - go.opentelemetry.io/otel/bridge/opencensus - - go.opentelemetry.io/otel/bridge/opencensus/test - - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus - - go.opentelemetry.io/otel/example/view - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric + experimental-logs: + version: v0.4.0 + modules: + - go.opentelemetry.io/otel/log + - go.opentelemetry.io/otel/sdk/log + - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp + - go.opentelemetry.io/otel/exporters/stdout/stdoutlog experimental-schema: - version: v0.0.7 + version: v0.0.8 modules: - go.opentelemetry.io/otel/schema excluded-modules: - go.opentelemetry.io/otel/internal/tools + - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc diff --git a/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go b/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go index 51a499816..d7099c35b 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go @@ -36,6 +36,78 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// SpanFlags represents constants used to interpret the +// Span.flags field, which is protobuf 'fixed32' type and is to +// be used as bit-fields. Each non-zero value defined in this enum is +// a bit-mask. To extract the bit-field, for example, use an +// expression like: +// +// (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK) +// +// See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. +// +// Note that Span flags were introduced in version 1.1 of the +// OpenTelemetry protocol. Older Span producers do not set this +// field, consequently consumers should not rely on the absence of a +// particular flag bit to indicate the presence of a particular feature. +type SpanFlags int32 + +const ( + // The zero value for the enum. Should not be used for comparisons. + // Instead use bitwise "and" with the appropriate mask as shown above. + SpanFlags_SPAN_FLAGS_DO_NOT_USE SpanFlags = 0 + // Bits 0-7 are used for trace flags. + SpanFlags_SPAN_FLAGS_TRACE_FLAGS_MASK SpanFlags = 255 + // Bits 8 and 9 are used to indicate that the parent span or link span is remote. + // Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known. + // Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote. + SpanFlags_SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK SpanFlags = 256 + SpanFlags_SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK SpanFlags = 512 +) + +// Enum value maps for SpanFlags. +var ( + SpanFlags_name = map[int32]string{ + 0: "SPAN_FLAGS_DO_NOT_USE", + 255: "SPAN_FLAGS_TRACE_FLAGS_MASK", + 256: "SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK", + 512: "SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK", + } + SpanFlags_value = map[string]int32{ + "SPAN_FLAGS_DO_NOT_USE": 0, + "SPAN_FLAGS_TRACE_FLAGS_MASK": 255, + "SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK": 256, + "SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK": 512, + } +) + +func (x SpanFlags) Enum() *SpanFlags { + p := new(SpanFlags) + *p = x + return p +} + +func (x SpanFlags) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SpanFlags) Descriptor() protoreflect.EnumDescriptor { + return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[0].Descriptor() +} + +func (SpanFlags) Type() protoreflect.EnumType { + return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[0] +} + +func (x SpanFlags) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SpanFlags.Descriptor instead. +func (SpanFlags) EnumDescriptor() ([]byte, []int) { + return file_opentelemetry_proto_trace_v1_trace_proto_rawDescGZIP(), []int{0} +} + // SpanKind is the type of span. Can be used to specify additional relationships between spans // in addition to a parent/child relationship. type Span_SpanKind int32 @@ -94,11 +166,11 @@ func (x Span_SpanKind) String() string { } func (Span_SpanKind) Descriptor() protoreflect.EnumDescriptor { - return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[0].Descriptor() + return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[1].Descriptor() } func (Span_SpanKind) Type() protoreflect.EnumType { - return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[0] + return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[1] } func (x Span_SpanKind) Number() protoreflect.EnumNumber { @@ -149,11 +221,11 @@ func (x Status_StatusCode) String() string { } func (Status_StatusCode) Descriptor() protoreflect.EnumDescriptor { - return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[1].Descriptor() + return file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[2].Descriptor() } func (Status_StatusCode) Type() protoreflect.EnumType { - return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[1] + return &file_opentelemetry_proto_trace_v1_trace_proto_enumTypes[2] } func (x Status_StatusCode) Number() protoreflect.EnumNumber { @@ -238,6 +310,9 @@ type ResourceSpans struct { Resource *v1.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` // A list of ScopeSpans that originate from a resource. ScopeSpans []*ScopeSpans `protobuf:"bytes,2,rep,name=scope_spans,json=scopeSpans,proto3" json:"scope_spans,omitempty"` + // The Schema URL, if known. This is the identifier of the Schema that the resource data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to the data in the "resource" field. It does not apply // to the data in the "scope_spans" field which have their own schema_url field. SchemaUrl string `protobuf:"bytes,3,opt,name=schema_url,json=schemaUrl,proto3" json:"schema_url,omitempty"` @@ -308,6 +383,9 @@ type ScopeSpans struct { Scope *v11.InstrumentationScope `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"` // A list of Spans that originate from an instrumentation scope. Spans []*Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"` + // The Schema URL, if known. This is the identifier of the Schema that the span data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to all spans and span events in the "spans" field. SchemaUrl string `protobuf:"bytes,3,opt,name=schema_url,json=schemaUrl,proto3" json:"schema_url,omitempty"` } @@ -394,6 +472,28 @@ type Span struct { // The `span_id` of this span's parent span. If this is a root span, then this // field must be empty. The ID is an 8-byte array. ParentSpanId []byte `protobuf:"bytes,4,opt,name=parent_span_id,json=parentSpanId,proto3" json:"parent_span_id,omitempty"` + // Flags, a bit field. + // + // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + // Context specification. To read the 8-bit W3C trace flag, use + // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + // + // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + // + // Bits 8 and 9 represent the 3 states of whether a span's parent + // is remote. The states are (unknown, is not remote, is remote). + // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + // To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + // + // When creating span messages, if the message is logically forwarded from another source + // with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD + // be copied as-is. If creating from a source that does not have an equivalent flags field + // (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST + // be set to zero. + // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + // + // [Optional]. + Flags uint32 `protobuf:"fixed32,16,opt,name=flags,proto3" json:"flags,omitempty"` // A description of the span's operation. // // For example, the name can be a qualified method name or a file name @@ -517,6 +617,13 @@ func (x *Span) GetParentSpanId() []byte { return nil } +func (x *Span) GetFlags() uint32 { + if x != nil { + return x.Flags + } + return 0 +} + func (x *Span) GetName() string { if x != nil { return x.Name @@ -757,6 +864,24 @@ type Span_Link struct { // dropped_attributes_count is the number of dropped attributes. If the value is 0, // then no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,5,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + // Flags, a bit field. + // + // Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace + // Context specification. To read the 8-bit W3C trace flag, use + // `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`. + // + // See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions. + // + // Bits 8 and 9 represent the 3 states of whether the link is remote. + // The states are (unknown, is not remote, is remote). + // To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`. + // To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`. + // + // Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero. + // When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero. + // + // [Optional]. + Flags uint32 `protobuf:"fixed32,6,opt,name=flags,proto3" json:"flags,omitempty"` } func (x *Span_Link) Reset() { @@ -826,6 +951,13 @@ func (x *Span_Link) GetDroppedAttributesCount() uint32 { return 0 } +func (x *Span_Link) GetFlags() uint32 { + if x != nil { + return x.Flags + } + return 0 +} + var File_opentelemetry_proto_trace_v1_trace_proto protoreflect.FileDescriptor var file_opentelemetry_proto_trace_v1_trace_proto_rawDesc = []byte{ @@ -869,7 +1001,7 @@ var file_opentelemetry_proto_trace_v1_trace_proto_rawDesc = []byte{ 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x05, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x55, 0x72, 0x6c, 0x22, 0x9c, 0x0a, 0x0a, 0x04, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x19, 0x0a, + 0x61, 0x55, 0x72, 0x6c, 0x22, 0xc8, 0x0a, 0x0a, 0x04, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x70, 0x61, 0x6e, 0x49, @@ -877,101 +1009,113 @@ var file_opentelemetry_proto_trace_v1_trace_proto_rawDesc = []byte{ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x04, - 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x53, - 0x70, 0x61, 0x6e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x2f, 0x0a, - 0x14, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, - 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x06, 0x52, 0x11, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x2b, - 0x0a, 0x12, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, - 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x54, - 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x47, 0x0a, 0x0a, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x40, - 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, - 0x61, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, - 0x12, 0x30, 0x0a, 0x14, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, - 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x6e, - 0x6b, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x3c, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, - 0xc4, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x69, 0x6d, - 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x06, 0x52, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0xde, 0x01, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, - 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x70, - 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x70, 0x61, - 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x63, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, - 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, - 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x08, 0x53, 0x70, 0x61, 0x6e, - 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, - 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x16, 0x0a, 0x12, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x49, 0x4e, 0x54, - 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x50, 0x41, 0x4e, 0x5f, - 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x14, 0x0a, - 0x10, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, - 0x54, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, - 0x5f, 0x50, 0x52, 0x4f, 0x44, 0x55, 0x43, 0x45, 0x52, 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x53, - 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4f, 0x4e, 0x53, 0x55, 0x4d, 0x45, - 0x52, 0x10, 0x05, 0x22, 0xbd, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, - 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, - 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x4e, 0x0a, - 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, - 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x44, - 0x45, 0x5f, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, - 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x4a, 0x04, 0x08, - 0x01, 0x10, 0x02, 0x42, 0x77, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, + 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x07, 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, + 0x69, 0x6e, 0x64, 0x12, 0x2f, 0x0a, 0x14, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x06, 0x52, 0x11, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, + 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x2b, 0x0a, 0x12, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x06, + 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x4e, 0x61, 0x6e, + 0x6f, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, + 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, + 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, + 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, + 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0b, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, + 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, + 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, - 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x72, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, - 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x6f, 0x74, 0x6c, 0x70, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1c, - 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, + 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x72, 0x6f, 0x70, 0x70, + 0x65, 0x64, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x4c, 0x69, 0x6e, + 0x6b, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, + 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, + 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0xc4, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, + 0x24, 0x0a, 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x6e, 0x61, 0x6e, + 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, + 0x78, 0x4e, 0x61, 0x6e, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, + 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0xf4, 0x01, 0x0a, + 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, + 0x12, 0x17, 0x0a, 0x07, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x06, 0x73, 0x70, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x72, 0x61, + 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x74, 0x72, 0x61, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4b, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x07, 0x52, 0x05, 0x66, 0x6c, + 0x61, 0x67, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x08, 0x53, 0x70, 0x61, 0x6e, 0x4b, 0x69, 0x6e, 0x64, + 0x12, 0x19, 0x0a, 0x15, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, + 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, + 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, + 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x50, 0x41, + 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, + 0x16, 0x0a, 0x12, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x50, 0x52, 0x4f, + 0x44, 0x55, 0x43, 0x45, 0x52, 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x50, 0x41, 0x4e, 0x5f, + 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4f, 0x4e, 0x53, 0x55, 0x4d, 0x45, 0x52, 0x10, 0x05, 0x22, + 0xbd, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, + 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, + 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x4e, 0x0a, 0x0a, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x00, 0x12, 0x12, + 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4f, 0x4b, + 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, 0x44, + 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x2a, + 0x9c, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a, + 0x15, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x53, 0x5f, 0x44, 0x4f, 0x5f, 0x4e, + 0x4f, 0x54, 0x5f, 0x55, 0x53, 0x45, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1b, 0x53, 0x50, 0x41, 0x4e, + 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x53, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x46, 0x4c, 0x41, + 0x47, 0x53, 0x5f, 0x4d, 0x41, 0x53, 0x4b, 0x10, 0xff, 0x01, 0x12, 0x2a, 0x0a, 0x25, 0x53, 0x50, + 0x41, 0x4e, 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x53, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x45, 0x58, 0x54, + 0x5f, 0x48, 0x41, 0x53, 0x5f, 0x49, 0x53, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x5f, 0x4d, + 0x41, 0x53, 0x4b, 0x10, 0x80, 0x02, 0x12, 0x26, 0x0a, 0x21, 0x53, 0x50, 0x41, 0x4e, 0x5f, 0x46, + 0x4c, 0x41, 0x47, 0x53, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x45, 0x58, 0x54, 0x5f, 0x49, 0x53, 0x5f, + 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x5f, 0x4d, 0x41, 0x53, 0x4b, 0x10, 0x80, 0x04, 0x42, 0x77, + 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, + 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x42, 0x0a, 0x54, 0x72, 0x61, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x27, 0x67, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, + 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x74, 0x6c, 0x70, 0x2f, + 0x74, 0x72, 0x61, 0x63, 0x65, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1c, 0x4f, 0x70, 0x65, 0x6e, 0x54, + 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, + 0x72, 0x61, 0x63, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -986,36 +1130,37 @@ func file_opentelemetry_proto_trace_v1_trace_proto_rawDescGZIP() []byte { return file_opentelemetry_proto_trace_v1_trace_proto_rawDescData } -var file_opentelemetry_proto_trace_v1_trace_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_opentelemetry_proto_trace_v1_trace_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_opentelemetry_proto_trace_v1_trace_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_opentelemetry_proto_trace_v1_trace_proto_goTypes = []interface{}{ - (Span_SpanKind)(0), // 0: opentelemetry.proto.trace.v1.Span.SpanKind - (Status_StatusCode)(0), // 1: opentelemetry.proto.trace.v1.Status.StatusCode - (*TracesData)(nil), // 2: opentelemetry.proto.trace.v1.TracesData - (*ResourceSpans)(nil), // 3: opentelemetry.proto.trace.v1.ResourceSpans - (*ScopeSpans)(nil), // 4: opentelemetry.proto.trace.v1.ScopeSpans - (*Span)(nil), // 5: opentelemetry.proto.trace.v1.Span - (*Status)(nil), // 6: opentelemetry.proto.trace.v1.Status - (*Span_Event)(nil), // 7: opentelemetry.proto.trace.v1.Span.Event - (*Span_Link)(nil), // 8: opentelemetry.proto.trace.v1.Span.Link - (*v1.Resource)(nil), // 9: opentelemetry.proto.resource.v1.Resource - (*v11.InstrumentationScope)(nil), // 10: opentelemetry.proto.common.v1.InstrumentationScope - (*v11.KeyValue)(nil), // 11: opentelemetry.proto.common.v1.KeyValue + (SpanFlags)(0), // 0: opentelemetry.proto.trace.v1.SpanFlags + (Span_SpanKind)(0), // 1: opentelemetry.proto.trace.v1.Span.SpanKind + (Status_StatusCode)(0), // 2: opentelemetry.proto.trace.v1.Status.StatusCode + (*TracesData)(nil), // 3: opentelemetry.proto.trace.v1.TracesData + (*ResourceSpans)(nil), // 4: opentelemetry.proto.trace.v1.ResourceSpans + (*ScopeSpans)(nil), // 5: opentelemetry.proto.trace.v1.ScopeSpans + (*Span)(nil), // 6: opentelemetry.proto.trace.v1.Span + (*Status)(nil), // 7: opentelemetry.proto.trace.v1.Status + (*Span_Event)(nil), // 8: opentelemetry.proto.trace.v1.Span.Event + (*Span_Link)(nil), // 9: opentelemetry.proto.trace.v1.Span.Link + (*v1.Resource)(nil), // 10: opentelemetry.proto.resource.v1.Resource + (*v11.InstrumentationScope)(nil), // 11: opentelemetry.proto.common.v1.InstrumentationScope + (*v11.KeyValue)(nil), // 12: opentelemetry.proto.common.v1.KeyValue } var file_opentelemetry_proto_trace_v1_trace_proto_depIdxs = []int32{ - 3, // 0: opentelemetry.proto.trace.v1.TracesData.resource_spans:type_name -> opentelemetry.proto.trace.v1.ResourceSpans - 9, // 1: opentelemetry.proto.trace.v1.ResourceSpans.resource:type_name -> opentelemetry.proto.resource.v1.Resource - 4, // 2: opentelemetry.proto.trace.v1.ResourceSpans.scope_spans:type_name -> opentelemetry.proto.trace.v1.ScopeSpans - 10, // 3: opentelemetry.proto.trace.v1.ScopeSpans.scope:type_name -> opentelemetry.proto.common.v1.InstrumentationScope - 5, // 4: opentelemetry.proto.trace.v1.ScopeSpans.spans:type_name -> opentelemetry.proto.trace.v1.Span - 0, // 5: opentelemetry.proto.trace.v1.Span.kind:type_name -> opentelemetry.proto.trace.v1.Span.SpanKind - 11, // 6: opentelemetry.proto.trace.v1.Span.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue - 7, // 7: opentelemetry.proto.trace.v1.Span.events:type_name -> opentelemetry.proto.trace.v1.Span.Event - 8, // 8: opentelemetry.proto.trace.v1.Span.links:type_name -> opentelemetry.proto.trace.v1.Span.Link - 6, // 9: opentelemetry.proto.trace.v1.Span.status:type_name -> opentelemetry.proto.trace.v1.Status - 1, // 10: opentelemetry.proto.trace.v1.Status.code:type_name -> opentelemetry.proto.trace.v1.Status.StatusCode - 11, // 11: opentelemetry.proto.trace.v1.Span.Event.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue - 11, // 12: opentelemetry.proto.trace.v1.Span.Link.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue + 4, // 0: opentelemetry.proto.trace.v1.TracesData.resource_spans:type_name -> opentelemetry.proto.trace.v1.ResourceSpans + 10, // 1: opentelemetry.proto.trace.v1.ResourceSpans.resource:type_name -> opentelemetry.proto.resource.v1.Resource + 5, // 2: opentelemetry.proto.trace.v1.ResourceSpans.scope_spans:type_name -> opentelemetry.proto.trace.v1.ScopeSpans + 11, // 3: opentelemetry.proto.trace.v1.ScopeSpans.scope:type_name -> opentelemetry.proto.common.v1.InstrumentationScope + 6, // 4: opentelemetry.proto.trace.v1.ScopeSpans.spans:type_name -> opentelemetry.proto.trace.v1.Span + 1, // 5: opentelemetry.proto.trace.v1.Span.kind:type_name -> opentelemetry.proto.trace.v1.Span.SpanKind + 12, // 6: opentelemetry.proto.trace.v1.Span.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue + 8, // 7: opentelemetry.proto.trace.v1.Span.events:type_name -> opentelemetry.proto.trace.v1.Span.Event + 9, // 8: opentelemetry.proto.trace.v1.Span.links:type_name -> opentelemetry.proto.trace.v1.Span.Link + 7, // 9: opentelemetry.proto.trace.v1.Span.status:type_name -> opentelemetry.proto.trace.v1.Status + 2, // 10: opentelemetry.proto.trace.v1.Status.code:type_name -> opentelemetry.proto.trace.v1.Status.StatusCode + 12, // 11: opentelemetry.proto.trace.v1.Span.Event.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue + 12, // 12: opentelemetry.proto.trace.v1.Span.Link.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue 13, // [13:13] is the sub-list for method output_type 13, // [13:13] is the sub-list for method input_type 13, // [13:13] is the sub-list for extension type_name @@ -1119,7 +1264,7 @@ func file_opentelemetry_proto_trace_v1_trace_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_opentelemetry_proto_trace_v1_trace_proto_rawDesc, - NumEnums: 2, + NumEnums: 3, NumMessages: 7, NumExtensions: 0, NumServices: 0, diff --git a/vendor/go.uber.org/zap/.golangci.yml b/vendor/go.uber.org/zap/.golangci.yml index fbc6df790..2346df135 100644 --- a/vendor/go.uber.org/zap/.golangci.yml +++ b/vendor/go.uber.org/zap/.golangci.yml @@ -17,7 +17,7 @@ linters: - unused # Our own extras: - - gofmt + - gofumpt - nolintlint # lints nolint directives - revive diff --git a/vendor/go.uber.org/zap/.readme.tmpl b/vendor/go.uber.org/zap/.readme.tmpl index 92aa65d66..4fea3027a 100644 --- a/vendor/go.uber.org/zap/.readme.tmpl +++ b/vendor/go.uber.org/zap/.readme.tmpl @@ -1,7 +1,15 @@ # :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] +
+ Blazing fast, structured, leveled logging in Go. +![Zap logo](assets/logo.png) + +[![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] + +
+ ## Installation `go get -u go.uber.org/zap` @@ -92,7 +100,7 @@ standard.
-Released under the [MIT License](LICENSE.txt). +Released under the [MIT License](LICENSE). 1 In particular, keep in mind that we may be benchmarking against slightly older versions of other packages. Versions are diff --git a/vendor/go.uber.org/zap/CHANGELOG.md b/vendor/go.uber.org/zap/CHANGELOG.md index 11b465976..6d6cd5f4d 100644 --- a/vendor/go.uber.org/zap/CHANGELOG.md +++ b/vendor/go.uber.org/zap/CHANGELOG.md @@ -3,14 +3,30 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.27.0 (20 Feb 2024) +Enhancements: +* [#1378][]: Add `WithLazy` method for `SugaredLogger`. +* [#1399][]: zaptest: Add `NewTestingWriter` for customizing TestingWriter with more flexibility than `NewLogger`. +* [#1406][]: Add `Log`, `Logw`, `Logln` methods for `SugaredLogger`. +* [#1416][]: Add `WithPanicHook` option for testing panic logs. + +Thanks to @defval, @dimmo, @arxeiss, and @MKrupauskas for their contributions to this release. + +[#1378]: https://github.com/uber-go/zap/pull/1378 +[#1399]: https://github.com/uber-go/zap/pull/1399 +[#1406]: https://github.com/uber-go/zap/pull/1406 +[#1416]: https://github.com/uber-go/zap/pull/1416 + ## 1.26.0 (14 Sep 2023) Enhancements: +* [#1297][]: Add Dict as a Field. * [#1319][]: Add `WithLazy` method to `Logger` which lazily evaluates the structured context. * [#1350][]: String encoding is much (~50%) faster now. -Thanks to @jquirke, @cdvr1993 for their contributions to this release. +Thanks to @hhk7734, @jquirke, and @cdvr1993 for their contributions to this release. +[#1297]: https://github.com/uber-go/zap/pull/1297 [#1319]: https://github.com/uber-go/zap/pull/1319 [#1350]: https://github.com/uber-go/zap/pull/1350 @@ -25,7 +41,7 @@ Enhancements: * [#1273][]: Add `Name` to `Logger` which returns the Logger's name if one is set. * [#1281][]: Add `zap/exp/expfield` package which contains helper methods `Str` and `Strs` for constructing String-like zap.Fields. -* [#1310][]: Reduce stack size on `Any`. +* [#1310][]: Reduce stack size on `Any`. Thanks to @knight42, @dzakaammar, @bcspragu, and @rexywork for their contributions to this release. @@ -352,7 +368,7 @@ to this release. [#675]: https://github.com/uber-go/zap/pull/675 [#704]: https://github.com/uber-go/zap/pull/704 -## v1.9.1 (06 Aug 2018) +## 1.9.1 (06 Aug 2018) Bugfixes: @@ -360,7 +376,7 @@ Bugfixes: [#614]: https://github.com/uber-go/zap/pull/614 -## v1.9.0 (19 Jul 2018) +## 1.9.0 (19 Jul 2018) Enhancements: * [#602][]: Reduce number of allocations when logging with reflection. @@ -373,7 +389,7 @@ Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and [#572]: https://github.com/uber-go/zap/pull/572 [#606]: https://github.com/uber-go/zap/pull/606 -## v1.8.0 (13 Apr 2018) +## 1.8.0 (13 Apr 2018) Enhancements: * [#508][]: Make log level configurable when redirecting the standard @@ -391,14 +407,14 @@ Thanks to @DiSiqueira and @djui for their contributions to this release. [#577]: https://github.com/uber-go/zap/pull/577 [#574]: https://github.com/uber-go/zap/pull/574 -## v1.7.1 (25 Sep 2017) +## 1.7.1 (25 Sep 2017) Bugfixes: * [#504][]: Store strings when using AddByteString with the map encoder. [#504]: https://github.com/uber-go/zap/pull/504 -## v1.7.0 (21 Sep 2017) +## 1.7.0 (21 Sep 2017) Enhancements: @@ -407,7 +423,7 @@ Enhancements: [#487]: https://github.com/uber-go/zap/pull/487 -## v1.6.0 (30 Aug 2017) +## 1.6.0 (30 Aug 2017) Enhancements: @@ -418,7 +434,7 @@ Enhancements: [#490]: https://github.com/uber-go/zap/pull/490 [#491]: https://github.com/uber-go/zap/pull/491 -## v1.5.0 (22 Jul 2017) +## 1.5.0 (22 Jul 2017) Enhancements: @@ -436,7 +452,7 @@ Thanks to @richard-tunein and @pavius for their contributions to this release. [#460]: https://github.com/uber-go/zap/pull/460 [#470]: https://github.com/uber-go/zap/pull/470 -## v1.4.1 (08 Jun 2017) +## 1.4.1 (08 Jun 2017) This release fixes two bugs. @@ -448,7 +464,7 @@ Bugfixes: [#435]: https://github.com/uber-go/zap/pull/435 [#444]: https://github.com/uber-go/zap/pull/444 -## v1.4.0 (12 May 2017) +## 1.4.0 (12 May 2017) This release adds a few small features and is fully backward-compatible. @@ -464,7 +480,7 @@ Enhancements: [#425]: https://github.com/uber-go/zap/pull/425 [#431]: https://github.com/uber-go/zap/pull/431 -## v1.3.0 (25 Apr 2017) +## 1.3.0 (25 Apr 2017) This release adds an enhancement to zap's testing helpers as well as the ability to marshal an AtomicLevel. It is fully backward-compatible. @@ -478,7 +494,7 @@ Enhancements: [#415]: https://github.com/uber-go/zap/pull/415 [#416]: https://github.com/uber-go/zap/pull/416 -## v1.2.0 (13 Apr 2017) +## 1.2.0 (13 Apr 2017) This release adds a gRPC compatibility wrapper. It is fully backward-compatible. @@ -489,7 +505,7 @@ Enhancements: [#402]: https://github.com/uber-go/zap/pull/402 -## v1.1.0 (31 Mar 2017) +## 1.1.0 (31 Mar 2017) This release fixes two bugs and adds some enhancements to zap's testing helpers. It is fully backward-compatible. @@ -510,7 +526,7 @@ Thanks to @moitias for contributing to this release. [#396]: https://github.com/uber-go/zap/pull/396 [#386]: https://github.com/uber-go/zap/pull/386 -## v1.0.0 (14 Mar 2017) +## 1.0.0 (14 Mar 2017) This is zap's first stable release. All exported APIs are now final, and no further breaking changes will be made in the 1.x release series. Anyone using a @@ -569,7 +585,7 @@ contributions to this release. [#365]: https://github.com/uber-go/zap/pull/365 [#372]: https://github.com/uber-go/zap/pull/372 -## v1.0.0-rc.3 (7 Mar 2017) +## 1.0.0-rc.3 (7 Mar 2017) This is the third release candidate for zap's stable release. There are no breaking changes. @@ -595,7 +611,7 @@ Thanks to @ansel1 and @suyash for their contributions to this release. [#353]: https://github.com/uber-go/zap/pull/353 [#311]: https://github.com/uber-go/zap/pull/311 -## v1.0.0-rc.2 (21 Feb 2017) +## 1.0.0-rc.2 (21 Feb 2017) This is the second release candidate for zap's stable release. It includes two breaking changes. @@ -641,7 +657,7 @@ Thanks to @skipor and @chapsuk for their contributions to this release. [#326]: https://github.com/uber-go/zap/pull/326 [#300]: https://github.com/uber-go/zap/pull/300 -## v1.0.0-rc.1 (14 Feb 2017) +## 1.0.0-rc.1 (14 Feb 2017) This is the first release candidate for zap's stable release. There are multiple breaking changes and improvements from the pre-release version. Most notably: @@ -661,7 +677,7 @@ breaking changes and improvements from the pre-release version. Most notably: * Sampling is more accurate, and doesn't depend on the standard library's shared timer heap. -## v0.1.0-beta.1 (6 Feb 2017) +## 0.1.0-beta.1 (6 Feb 2017) This is a minor version, tagged to allow users to pin to the pre-1.0 APIs and upgrade at their leisure. Since this is the first tagged release, there are no diff --git a/vendor/go.uber.org/zap/LICENSE.txt b/vendor/go.uber.org/zap/LICENSE similarity index 100% rename from vendor/go.uber.org/zap/LICENSE.txt rename to vendor/go.uber.org/zap/LICENSE diff --git a/vendor/go.uber.org/zap/README.md b/vendor/go.uber.org/zap/README.md index 9de08927b..a17035cb6 100644 --- a/vendor/go.uber.org/zap/README.md +++ b/vendor/go.uber.org/zap/README.md @@ -1,7 +1,16 @@ -# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] +# :zap: zap + + +
Blazing fast, structured, leveled logging in Go. +![Zap logo](assets/logo.png) + +[![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] + +
+ ## Installation `go get -u go.uber.org/zap` @@ -66,41 +75,44 @@ Log a message and 10 fields: | Package | Time | Time % to zap | Objects Allocated | | :------ | :--: | :-----------: | :---------------: | -| :zap: zap | 1744 ns/op | +0% | 5 allocs/op -| :zap: zap (sugared) | 2483 ns/op | +42% | 10 allocs/op -| zerolog | 918 ns/op | -47% | 1 allocs/op -| go-kit | 5590 ns/op | +221% | 57 allocs/op -| slog | 5640 ns/op | +223% | 40 allocs/op -| apex/log | 21184 ns/op | +1115% | 63 allocs/op -| logrus | 24338 ns/op | +1296% | 79 allocs/op -| log15 | 26054 ns/op | +1394% | 74 allocs/op +| :zap: zap | 656 ns/op | +0% | 5 allocs/op +| :zap: zap (sugared) | 935 ns/op | +43% | 10 allocs/op +| zerolog | 380 ns/op | -42% | 1 allocs/op +| go-kit | 2249 ns/op | +243% | 57 allocs/op +| slog (LogAttrs) | 2479 ns/op | +278% | 40 allocs/op +| slog | 2481 ns/op | +278% | 42 allocs/op +| apex/log | 9591 ns/op | +1362% | 63 allocs/op +| log15 | 11393 ns/op | +1637% | 75 allocs/op +| logrus | 11654 ns/op | +1677% | 79 allocs/op Log a message with a logger that already has 10 fields of context: | Package | Time | Time % to zap | Objects Allocated | | :------ | :--: | :-----------: | :---------------: | -| :zap: zap | 193 ns/op | +0% | 0 allocs/op -| :zap: zap (sugared) | 227 ns/op | +18% | 1 allocs/op -| zerolog | 81 ns/op | -58% | 0 allocs/op -| slog | 322 ns/op | +67% | 0 allocs/op -| go-kit | 5377 ns/op | +2686% | 56 allocs/op -| apex/log | 19518 ns/op | +10013% | 53 allocs/op -| log15 | 19812 ns/op | +10165% | 70 allocs/op -| logrus | 21997 ns/op | +11297% | 68 allocs/op +| :zap: zap | 67 ns/op | +0% | 0 allocs/op +| :zap: zap (sugared) | 84 ns/op | +25% | 1 allocs/op +| zerolog | 35 ns/op | -48% | 0 allocs/op +| slog | 193 ns/op | +188% | 0 allocs/op +| slog (LogAttrs) | 200 ns/op | +199% | 0 allocs/op +| go-kit | 2460 ns/op | +3572% | 56 allocs/op +| log15 | 9038 ns/op | +13390% | 70 allocs/op +| apex/log | 9068 ns/op | +13434% | 53 allocs/op +| logrus | 10521 ns/op | +15603% | 68 allocs/op Log a static string, without any context or `printf`-style templating: | Package | Time | Time % to zap | Objects Allocated | | :------ | :--: | :-----------: | :---------------: | -| :zap: zap | 165 ns/op | +0% | 0 allocs/op -| :zap: zap (sugared) | 212 ns/op | +28% | 1 allocs/op -| zerolog | 95 ns/op | -42% | 0 allocs/op -| slog | 296 ns/op | +79% | 0 allocs/op -| go-kit | 415 ns/op | +152% | 9 allocs/op -| standard library | 422 ns/op | +156% | 2 allocs/op -| apex/log | 1601 ns/op | +870% | 5 allocs/op -| logrus | 3017 ns/op | +1728% | 23 allocs/op -| log15 | 3469 ns/op | +2002% | 20 allocs/op +| :zap: zap | 63 ns/op | +0% | 0 allocs/op +| :zap: zap (sugared) | 81 ns/op | +29% | 1 allocs/op +| zerolog | 32 ns/op | -49% | 0 allocs/op +| standard library | 124 ns/op | +97% | 1 allocs/op +| slog | 196 ns/op | +211% | 0 allocs/op +| slog (LogAttrs) | 200 ns/op | +217% | 0 allocs/op +| go-kit | 213 ns/op | +238% | 9 allocs/op +| apex/log | 771 ns/op | +1124% | 5 allocs/op +| logrus | 1439 ns/op | +2184% | 23 allocs/op +| log15 | 2069 ns/op | +3184% | 20 allocs/op ## Development Status: Stable @@ -120,7 +132,7 @@ standard.
-Released under the [MIT License](LICENSE.txt). +Released under the [MIT License](LICENSE). 1 In particular, keep in mind that we may be benchmarking against slightly older versions of other packages. Versions are diff --git a/vendor/go.uber.org/zap/buffer/buffer.go b/vendor/go.uber.org/zap/buffer/buffer.go index 27fb5cd5d..0b8540c21 100644 --- a/vendor/go.uber.org/zap/buffer/buffer.go +++ b/vendor/go.uber.org/zap/buffer/buffer.go @@ -42,7 +42,7 @@ func (b *Buffer) AppendByte(v byte) { b.bs = append(b.bs, v) } -// AppendBytes writes a single byte to the Buffer. +// AppendBytes writes the given slice of bytes to the Buffer. func (b *Buffer) AppendBytes(v []byte) { b.bs = append(b.bs, v...) } diff --git a/vendor/go.uber.org/zap/field.go b/vendor/go.uber.org/zap/field.go index c8dd3358a..6743930b8 100644 --- a/vendor/go.uber.org/zap/field.go +++ b/vendor/go.uber.org/zap/field.go @@ -460,6 +460,8 @@ func (d dictObject) MarshalLogObject(enc zapcore.ObjectEncoder) error { // - https://github.com/uber-go/zap/pull/1304 // - https://github.com/uber-go/zap/pull/1305 // - https://github.com/uber-go/zap/pull/1308 +// +// See https://github.com/golang/go/issues/62077 for upstream issue. type anyFieldC[T any] func(string, T) Field func (f anyFieldC[T]) Any(key string, val any) Field { diff --git a/vendor/go.uber.org/zap/logger.go b/vendor/go.uber.org/zap/logger.go index 6205fe48a..c4d300323 100644 --- a/vendor/go.uber.org/zap/logger.go +++ b/vendor/go.uber.org/zap/logger.go @@ -43,6 +43,7 @@ type Logger struct { development bool addCaller bool + onPanic zapcore.CheckWriteHook // default is WriteThenPanic onFatal zapcore.CheckWriteHook // default is WriteThenFatal name string @@ -345,27 +346,12 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry { // Set up any required terminal behavior. switch ent.Level { case zapcore.PanicLevel: - ce = ce.After(ent, zapcore.WriteThenPanic) + ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenPanic, log.onPanic)) case zapcore.FatalLevel: - onFatal := log.onFatal - // nil or WriteThenNoop will lead to continued execution after - // a Fatal log entry, which is unexpected. For example, - // - // f, err := os.Open(..) - // if err != nil { - // log.Fatal("cannot open", zap.Error(err)) - // } - // fmt.Println(f.Name()) - // - // The f.Name() will panic if we continue execution after the - // log.Fatal. - if onFatal == nil || onFatal == zapcore.WriteThenNoop { - onFatal = zapcore.WriteThenFatal - } - ce = ce.After(ent, onFatal) + ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenFatal, log.onFatal)) case zapcore.DPanicLevel: if log.development { - ce = ce.After(ent, zapcore.WriteThenPanic) + ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenPanic, log.onPanic)) } } @@ -430,3 +416,20 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry { return ce } + +func terminalHookOverride(defaultHook, override zapcore.CheckWriteHook) zapcore.CheckWriteHook { + // A nil or WriteThenNoop hook will lead to continued execution after + // a Panic or Fatal log entry, which is unexpected. For example, + // + // f, err := os.Open(..) + // if err != nil { + // log.Fatal("cannot open", zap.Error(err)) + // } + // fmt.Println(f.Name()) + // + // The f.Name() will panic if we continue execution after the log.Fatal. + if override == nil || override == zapcore.WriteThenNoop { + return defaultHook + } + return override +} diff --git a/vendor/go.uber.org/zap/options.go b/vendor/go.uber.org/zap/options.go index c4f3bca3d..43d357ac9 100644 --- a/vendor/go.uber.org/zap/options.go +++ b/vendor/go.uber.org/zap/options.go @@ -132,6 +132,21 @@ func IncreaseLevel(lvl zapcore.LevelEnabler) Option { }) } +// WithPanicHook sets a CheckWriteHook to run on Panic/DPanic logs. +// Zap will call this hook after writing a log statement with a Panic/DPanic level. +// +// For example, the following builds a logger that will exit the current +// goroutine after writing a Panic/DPanic log message, but it will not start a panic. +// +// zap.New(core, zap.WithPanicHook(zapcore.WriteThenGoexit)) +// +// This is useful for testing Panic/DPanic log output. +func WithPanicHook(hook zapcore.CheckWriteHook) Option { + return optionFunc(func(log *Logger) { + log.onPanic = hook + }) +} + // OnFatal sets the action to take on fatal logs. // // Deprecated: Use [WithFatalHook] instead. diff --git a/vendor/go.uber.org/zap/sugar.go b/vendor/go.uber.org/zap/sugar.go index 00ac5fe3a..8904cd087 100644 --- a/vendor/go.uber.org/zap/sugar.go +++ b/vendor/go.uber.org/zap/sugar.go @@ -115,6 +115,21 @@ func (s *SugaredLogger) With(args ...interface{}) *SugaredLogger { return &SugaredLogger{base: s.base.With(s.sweetenFields(args)...)} } +// WithLazy adds a variadic number of fields to the logging context lazily. +// The fields are evaluated only if the logger is further chained with [With] +// or is written to with any of the log level methods. +// Until that occurs, the logger may retain references to objects inside the fields, +// and logging will reflect the state of an object at the time of logging, +// not the time of WithLazy(). +// +// Similar to [With], fields added to the child don't affect the parent, +// and vice versa. Also, the keys in key-value pairs should be strings. In development, +// passing a non-string key panics, while in production it logs an error and skips the pair. +// Passing an orphaned key has the same behavior. +func (s *SugaredLogger) WithLazy(args ...interface{}) *SugaredLogger { + return &SugaredLogger{base: s.base.WithLazy(s.sweetenFields(args)...)} +} + // Level reports the minimum enabled level for this logger. // // For NopLoggers, this is [zapcore.InvalidLevel]. @@ -122,6 +137,12 @@ func (s *SugaredLogger) Level() zapcore.Level { return zapcore.LevelOf(s.base.core) } +// Log logs the provided arguments at provided level. +// Spaces are added between arguments when neither is a string. +func (s *SugaredLogger) Log(lvl zapcore.Level, args ...interface{}) { + s.log(lvl, "", args, nil) +} + // Debug logs the provided arguments at [DebugLevel]. // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) Debug(args ...interface{}) { @@ -165,6 +186,12 @@ func (s *SugaredLogger) Fatal(args ...interface{}) { s.log(FatalLevel, "", args, nil) } +// Logf formats the message according to the format specifier +// and logs it at provided level. +func (s *SugaredLogger) Logf(lvl zapcore.Level, template string, args ...interface{}) { + s.log(lvl, template, args, nil) +} + // Debugf formats the message according to the format specifier // and logs it at [DebugLevel]. func (s *SugaredLogger) Debugf(template string, args ...interface{}) { @@ -208,6 +235,12 @@ func (s *SugaredLogger) Fatalf(template string, args ...interface{}) { s.log(FatalLevel, template, args, nil) } +// Logw logs a message with some additional context. The variadic key-value +// pairs are treated as they are in With. +func (s *SugaredLogger) Logw(lvl zapcore.Level, msg string, keysAndValues ...interface{}) { + s.log(lvl, msg, nil, keysAndValues) +} + // Debugw logs a message with some additional context. The variadic key-value // pairs are treated as they are in With. // @@ -255,6 +288,12 @@ func (s *SugaredLogger) Fatalw(msg string, keysAndValues ...interface{}) { s.log(FatalLevel, msg, nil, keysAndValues) } +// Logln logs a message at provided level. +// Spaces are always added between arguments. +func (s *SugaredLogger) Logln(lvl zapcore.Level, args ...interface{}) { + s.logln(lvl, args, nil) +} + // Debugln logs a message at [DebugLevel]. // Spaces are always added between arguments. func (s *SugaredLogger) Debugln(args ...interface{}) { diff --git a/vendor/go.uber.org/zap/zapcore/console_encoder.go b/vendor/go.uber.org/zap/zapcore/console_encoder.go index 8ca0bfaf5..cc2b4e07b 100644 --- a/vendor/go.uber.org/zap/zapcore/console_encoder.go +++ b/vendor/go.uber.org/zap/zapcore/console_encoder.go @@ -77,7 +77,7 @@ func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, // If this ever becomes a performance bottleneck, we can implement // ArrayEncoder for our plain-text format. arr := getSliceEncoder() - if c.TimeKey != "" && c.EncodeTime != nil { + if c.TimeKey != "" && c.EncodeTime != nil && !ent.Time.IsZero() { c.EncodeTime(ent.Time, arr) } if c.LevelKey != "" && c.EncodeLevel != nil { diff --git a/vendor/go.uber.org/zap/zapcore/encoder.go b/vendor/go.uber.org/zap/zapcore/encoder.go index 5769ff3e4..044625415 100644 --- a/vendor/go.uber.org/zap/zapcore/encoder.go +++ b/vendor/go.uber.org/zap/zapcore/encoder.go @@ -37,6 +37,9 @@ const DefaultLineEnding = "\n" const OmitKey = "" // A LevelEncoder serializes a Level to a primitive type. +// +// This function must make exactly one call +// to a PrimitiveArrayEncoder's Append* method. type LevelEncoder func(Level, PrimitiveArrayEncoder) // LowercaseLevelEncoder serializes a Level to a lowercase string. For example, @@ -90,6 +93,9 @@ func (e *LevelEncoder) UnmarshalText(text []byte) error { } // A TimeEncoder serializes a time.Time to a primitive type. +// +// This function must make exactly one call +// to a PrimitiveArrayEncoder's Append* method. type TimeEncoder func(time.Time, PrimitiveArrayEncoder) // EpochTimeEncoder serializes a time.Time to a floating-point number of seconds @@ -219,6 +225,9 @@ func (e *TimeEncoder) UnmarshalJSON(data []byte) error { } // A DurationEncoder serializes a time.Duration to a primitive type. +// +// This function must make exactly one call +// to a PrimitiveArrayEncoder's Append* method. type DurationEncoder func(time.Duration, PrimitiveArrayEncoder) // SecondsDurationEncoder serializes a time.Duration to a floating-point number of seconds elapsed. @@ -262,6 +271,9 @@ func (e *DurationEncoder) UnmarshalText(text []byte) error { } // A CallerEncoder serializes an EntryCaller to a primitive type. +// +// This function must make exactly one call +// to a PrimitiveArrayEncoder's Append* method. type CallerEncoder func(EntryCaller, PrimitiveArrayEncoder) // FullCallerEncoder serializes a caller in /full/path/to/package/file:line @@ -292,6 +304,9 @@ func (e *CallerEncoder) UnmarshalText(text []byte) error { // A NameEncoder serializes a period-separated logger name to a primitive // type. +// +// This function must make exactly one call +// to a PrimitiveArrayEncoder's Append* method. type NameEncoder func(string, PrimitiveArrayEncoder) // FullNameEncoder serializes the logger name as-is. diff --git a/vendor/go.uber.org/zap/zapcore/field.go b/vendor/go.uber.org/zap/zapcore/field.go index 95bdb0a12..308c9781e 100644 --- a/vendor/go.uber.org/zap/zapcore/field.go +++ b/vendor/go.uber.org/zap/zapcore/field.go @@ -47,7 +47,7 @@ const ( ByteStringType // Complex128Type indicates that the field carries a complex128. Complex128Type - // Complex64Type indicates that the field carries a complex128. + // Complex64Type indicates that the field carries a complex64. Complex64Type // DurationType indicates that the field carries a time.Duration. DurationType diff --git a/vendor/go.uber.org/zap/zapcore/json_encoder.go b/vendor/go.uber.org/zap/zapcore/json_encoder.go index c8ab86979..9685169b2 100644 --- a/vendor/go.uber.org/zap/zapcore/json_encoder.go +++ b/vendor/go.uber.org/zap/zapcore/json_encoder.go @@ -372,7 +372,7 @@ func (enc *jsonEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, final.AppendString(ent.Level.String()) } } - if final.TimeKey != "" { + if final.TimeKey != "" && !ent.Time.IsZero() { final.AddTime(final.TimeKey, ent.Time) } if ent.LoggerName != "" && final.NameKey != "" { diff --git a/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go deleted file mode 100644 index 28cd99c7f..000000000 --- a/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2012 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 pbkdf2 implements the key derivation function PBKDF2 as defined in RFC -2898 / PKCS #5 v2.0. - -A key derivation function is useful when encrypting data based on a password -or any other not-fully-random data. It uses a pseudorandom function to derive -a secure encryption key based on the password. - -While v2.0 of the standard defines only one pseudorandom function to use, -HMAC-SHA1, the drafted v2.1 specification allows use of all five FIPS Approved -Hash Functions SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 for HMAC. To -choose, you can pass the `New` functions from the different SHA packages to -pbkdf2.Key. -*/ -package pbkdf2 - -import ( - "crypto/hmac" - "hash" -) - -// Key derives a key from the password, salt and iteration count, returning a -// []byte of length keylen that can be used as cryptographic key. The key is -// derived based on the method described as PBKDF2 with the HMAC variant using -// the supplied hash function. -// -// For example, to use a HMAC-SHA-1 based PBKDF2 key derivation function, you -// can get a derived key for e.g. AES-256 (which needs a 32-byte key) by -// doing: -// -// dk := pbkdf2.Key([]byte("some password"), salt, 4096, 32, sha1.New) -// -// Remember to get a good random salt. At least 8 bytes is recommended by the -// RFC. -// -// Using a higher iteration count will increase the cost of an exhaustive -// search but will also make derivation proportionally slower. -func Key(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte { - prf := hmac.New(h, password) - hashLen := prf.Size() - numBlocks := (keyLen + hashLen - 1) / hashLen - - var buf [4]byte - dk := make([]byte, 0, numBlocks*hashLen) - U := make([]byte, hashLen) - for block := 1; block <= numBlocks; block++ { - // N.B.: || means concatenation, ^ means XOR - // for each block T_i = U_1 ^ U_2 ^ ... ^ U_iter - // U_1 = PRF(password, salt || uint(i)) - prf.Reset() - prf.Write(salt) - buf[0] = byte(block >> 24) - buf[1] = byte(block >> 16) - buf[2] = byte(block >> 8) - buf[3] = byte(block) - prf.Write(buf[:4]) - dk = prf.Sum(dk) - T := dk[len(dk)-hashLen:] - copy(U, T) - - // U_n = PRF(password, U_(n-1)) - for n := 2; n <= iter; n++ { - prf.Reset() - prf.Write(U) - U = U[:0] - U = prf.Sum(U) - for x := range U { - T[x] ^= U[x] - } - } - } - return dk[:keyLen] -} diff --git a/vendor/golang.org/x/crypto/scrypt/scrypt.go b/vendor/golang.org/x/crypto/scrypt/scrypt.go deleted file mode 100644 index 76fa40fb2..000000000 --- a/vendor/golang.org/x/crypto/scrypt/scrypt.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2012 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 scrypt implements the scrypt key derivation function as defined in -// Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard -// Functions" (https://www.tarsnap.com/scrypt/scrypt.pdf). -package scrypt - -import ( - "crypto/sha256" - "encoding/binary" - "errors" - "math/bits" - - "golang.org/x/crypto/pbkdf2" -) - -const maxInt = int(^uint(0) >> 1) - -// blockCopy copies n numbers from src into dst. -func blockCopy(dst, src []uint32, n int) { - copy(dst, src[:n]) -} - -// blockXOR XORs numbers from dst with n numbers from src. -func blockXOR(dst, src []uint32, n int) { - for i, v := range src[:n] { - dst[i] ^= v - } -} - -// salsaXOR applies Salsa20/8 to the XOR of 16 numbers from tmp and in, -// and puts the result into both tmp and out. -func salsaXOR(tmp *[16]uint32, in, out []uint32) { - w0 := tmp[0] ^ in[0] - w1 := tmp[1] ^ in[1] - w2 := tmp[2] ^ in[2] - w3 := tmp[3] ^ in[3] - w4 := tmp[4] ^ in[4] - w5 := tmp[5] ^ in[5] - w6 := tmp[6] ^ in[6] - w7 := tmp[7] ^ in[7] - w8 := tmp[8] ^ in[8] - w9 := tmp[9] ^ in[9] - w10 := tmp[10] ^ in[10] - w11 := tmp[11] ^ in[11] - w12 := tmp[12] ^ in[12] - w13 := tmp[13] ^ in[13] - w14 := tmp[14] ^ in[14] - w15 := tmp[15] ^ in[15] - - x0, x1, x2, x3, x4, x5, x6, x7, x8 := w0, w1, w2, w3, w4, w5, w6, w7, w8 - x9, x10, x11, x12, x13, x14, x15 := w9, w10, w11, w12, w13, w14, w15 - - for i := 0; i < 8; i += 2 { - x4 ^= bits.RotateLeft32(x0+x12, 7) - x8 ^= bits.RotateLeft32(x4+x0, 9) - x12 ^= bits.RotateLeft32(x8+x4, 13) - x0 ^= bits.RotateLeft32(x12+x8, 18) - - x9 ^= bits.RotateLeft32(x5+x1, 7) - x13 ^= bits.RotateLeft32(x9+x5, 9) - x1 ^= bits.RotateLeft32(x13+x9, 13) - x5 ^= bits.RotateLeft32(x1+x13, 18) - - x14 ^= bits.RotateLeft32(x10+x6, 7) - x2 ^= bits.RotateLeft32(x14+x10, 9) - x6 ^= bits.RotateLeft32(x2+x14, 13) - x10 ^= bits.RotateLeft32(x6+x2, 18) - - x3 ^= bits.RotateLeft32(x15+x11, 7) - x7 ^= bits.RotateLeft32(x3+x15, 9) - x11 ^= bits.RotateLeft32(x7+x3, 13) - x15 ^= bits.RotateLeft32(x11+x7, 18) - - x1 ^= bits.RotateLeft32(x0+x3, 7) - x2 ^= bits.RotateLeft32(x1+x0, 9) - x3 ^= bits.RotateLeft32(x2+x1, 13) - x0 ^= bits.RotateLeft32(x3+x2, 18) - - x6 ^= bits.RotateLeft32(x5+x4, 7) - x7 ^= bits.RotateLeft32(x6+x5, 9) - x4 ^= bits.RotateLeft32(x7+x6, 13) - x5 ^= bits.RotateLeft32(x4+x7, 18) - - x11 ^= bits.RotateLeft32(x10+x9, 7) - x8 ^= bits.RotateLeft32(x11+x10, 9) - x9 ^= bits.RotateLeft32(x8+x11, 13) - x10 ^= bits.RotateLeft32(x9+x8, 18) - - x12 ^= bits.RotateLeft32(x15+x14, 7) - x13 ^= bits.RotateLeft32(x12+x15, 9) - x14 ^= bits.RotateLeft32(x13+x12, 13) - x15 ^= bits.RotateLeft32(x14+x13, 18) - } - x0 += w0 - x1 += w1 - x2 += w2 - x3 += w3 - x4 += w4 - x5 += w5 - x6 += w6 - x7 += w7 - x8 += w8 - x9 += w9 - x10 += w10 - x11 += w11 - x12 += w12 - x13 += w13 - x14 += w14 - x15 += w15 - - out[0], tmp[0] = x0, x0 - out[1], tmp[1] = x1, x1 - out[2], tmp[2] = x2, x2 - out[3], tmp[3] = x3, x3 - out[4], tmp[4] = x4, x4 - out[5], tmp[5] = x5, x5 - out[6], tmp[6] = x6, x6 - out[7], tmp[7] = x7, x7 - out[8], tmp[8] = x8, x8 - out[9], tmp[9] = x9, x9 - out[10], tmp[10] = x10, x10 - out[11], tmp[11] = x11, x11 - out[12], tmp[12] = x12, x12 - out[13], tmp[13] = x13, x13 - out[14], tmp[14] = x14, x14 - out[15], tmp[15] = x15, x15 -} - -func blockMix(tmp *[16]uint32, in, out []uint32, r int) { - blockCopy(tmp[:], in[(2*r-1)*16:], 16) - for i := 0; i < 2*r; i += 2 { - salsaXOR(tmp, in[i*16:], out[i*8:]) - salsaXOR(tmp, in[i*16+16:], out[i*8+r*16:]) - } -} - -func integer(b []uint32, r int) uint64 { - j := (2*r - 1) * 16 - return uint64(b[j]) | uint64(b[j+1])<<32 -} - -func smix(b []byte, r, N int, v, xy []uint32) { - var tmp [16]uint32 - R := 32 * r - x := xy - y := xy[R:] - - j := 0 - for i := 0; i < R; i++ { - x[i] = binary.LittleEndian.Uint32(b[j:]) - j += 4 - } - for i := 0; i < N; i += 2 { - blockCopy(v[i*R:], x, R) - blockMix(&tmp, x, y, r) - - blockCopy(v[(i+1)*R:], y, R) - blockMix(&tmp, y, x, r) - } - for i := 0; i < N; i += 2 { - j := int(integer(x, r) & uint64(N-1)) - blockXOR(x, v[j*R:], R) - blockMix(&tmp, x, y, r) - - j = int(integer(y, r) & uint64(N-1)) - blockXOR(y, v[j*R:], R) - blockMix(&tmp, y, x, r) - } - j = 0 - for _, v := range x[:R] { - binary.LittleEndian.PutUint32(b[j:], v) - j += 4 - } -} - -// Key derives a key from the password, salt, and cost parameters, returning -// a byte slice of length keyLen that can be used as cryptographic key. -// -// N is a CPU/memory cost parameter, which must be a power of two greater than 1. -// r and p must satisfy r * p < 2³⁰. If the parameters do not satisfy the -// limits, the function returns a nil byte slice and an error. -// -// For example, you can get a derived key for e.g. AES-256 (which needs a -// 32-byte key) by doing: -// -// dk, err := scrypt.Key([]byte("some password"), salt, 32768, 8, 1, 32) -// -// The recommended parameters for interactive logins as of 2017 are N=32768, r=8 -// and p=1. The parameters N, r, and p should be increased as memory latency and -// CPU parallelism increases; consider setting N to the highest power of 2 you -// can derive within 100 milliseconds. Remember to get a good random salt. -func Key(password, salt []byte, N, r, p, keyLen int) ([]byte, error) { - if N <= 1 || N&(N-1) != 0 { - return nil, errors.New("scrypt: N must be > 1 and a power of 2") - } - if uint64(r)*uint64(p) >= 1<<30 || r > maxInt/128/p || r > maxInt/256 || N > maxInt/128/r { - return nil, errors.New("scrypt: parameters are too large") - } - - xy := make([]uint32, 64*r) - v := make([]uint32, 32*N*r) - b := pbkdf2.Key(password, salt, 1, p*128*r, sha256.New) - - for i := 0; i < p; i++ { - smix(b[i*128*r:], r, N, v, xy) - } - - return pbkdf2.Key(password, b, 1, keyLen, sha256.New), nil -} diff --git a/vendor/golang.org/x/exp/LICENSE b/vendor/golang.org/x/exp/LICENSE index 6a66aea5e..2a7cf70da 100644 --- a/vendor/golang.org/x/exp/LICENSE +++ b/vendor/golang.org/x/exp/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/exp/slices/slices.go b/vendor/golang.org/x/exp/slices/slices.go index 5e8158bba..46ceac343 100644 --- a/vendor/golang.org/x/exp/slices/slices.go +++ b/vendor/golang.org/x/exp/slices/slices.go @@ -209,25 +209,37 @@ func Insert[S ~[]E, E any](s S, i int, v ...E) S { return s } +// clearSlice sets all elements up to the length of s to the zero value of E. +// We may use the builtin clear func instead, and remove clearSlice, when upgrading +// to Go 1.21+. +func clearSlice[S ~[]E, E any](s S) { + var zero E + for i := range s { + s[i] = zero + } +} + // Delete removes the elements s[i:j] from s, returning the modified slice. -// Delete panics if s[i:j] is not a valid slice of s. -// Delete is O(len(s)-j), so if many items must be deleted, it is better to +// Delete panics if j > len(s) or s[i:j] is not a valid slice of s. +// Delete is O(len(s)-i), so if many items must be deleted, it is better to // make a single call deleting them all together than to delete one at a time. -// Delete might not modify the elements s[len(s)-(j-i):len(s)]. If those -// elements contain pointers you might consider zeroing those elements so that -// objects they reference can be garbage collected. +// Delete zeroes the elements s[len(s)-(j-i):len(s)]. func Delete[S ~[]E, E any](s S, i, j int) S { - _ = s[i:j] // bounds check + _ = s[i:j:len(s)] // bounds check - return append(s[:i], s[j:]...) + if i == j { + return s + } + + oldlen := len(s) + s = append(s[:i], s[j:]...) + clearSlice(s[len(s):oldlen]) // zero/nil out the obsolete elements, for GC + return s } // DeleteFunc removes any elements from s for which del returns true, // returning the modified slice. -// When DeleteFunc removes m elements, it might not modify the elements -// s[len(s)-m:len(s)]. If those elements contain pointers you might consider -// zeroing those elements so that objects they reference can be garbage -// collected. +// DeleteFunc zeroes the elements between the new length and the original length. func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S { i := IndexFunc(s, del) if i == -1 { @@ -240,11 +252,13 @@ func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S { i++ } } + clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC return s[:i] } // Replace replaces the elements s[i:j] by the given v, and returns the // modified slice. Replace panics if s[i:j] is not a valid slice of s. +// When len(v) < (j-i), Replace zeroes the elements between the new length and the original length. func Replace[S ~[]E, E any](s S, i, j int, v ...E) S { _ = s[i:j] // verify that i:j is a valid subslice @@ -272,6 +286,7 @@ func Replace[S ~[]E, E any](s S, i, j int, v ...E) S { if i+len(v) != j { copy(r[i+len(v):], s[j:]) } + clearSlice(s[tot:]) // zero/nil out the obsolete elements, for GC return r } @@ -345,9 +360,7 @@ func Clone[S ~[]E, E any](s S) S { // This is like the uniq command found on Unix. // Compact modifies the contents of the slice s and returns the modified slice, // which may have a smaller length. -// When Compact discards m elements in total, it might not modify the elements -// s[len(s)-m:len(s)]. If those elements contain pointers you might consider -// zeroing those elements so that objects they reference can be garbage collected. +// Compact zeroes the elements between the new length and the original length. func Compact[S ~[]E, E comparable](s S) S { if len(s) < 2 { return s @@ -361,11 +374,13 @@ func Compact[S ~[]E, E comparable](s S) S { i++ } } + clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC return s[:i] } // CompactFunc is like [Compact] but uses an equality function to compare elements. // For runs of elements that compare equal, CompactFunc keeps the first one. +// CompactFunc zeroes the elements between the new length and the original length. func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S { if len(s) < 2 { return s @@ -379,6 +394,7 @@ func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S { i++ } } + clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC return s[:i] } diff --git a/vendor/golang.org/x/exp/slices/sort.go b/vendor/golang.org/x/exp/slices/sort.go index b67897f76..f58bbc7ba 100644 --- a/vendor/golang.org/x/exp/slices/sort.go +++ b/vendor/golang.org/x/exp/slices/sort.go @@ -22,10 +22,12 @@ func Sort[S ~[]E, E constraints.Ordered](x S) { // SortFunc sorts the slice x in ascending order as determined by the cmp // function. This sort is not guaranteed to be stable. // cmp(a, b) should return a negative number when a < b, a positive number when -// a > b and zero when a == b. +// a > b and zero when a == b or when a is not comparable to b in the sense +// of the formal definition of Strict Weak Ordering. // // SortFunc requires that cmp is a strict weak ordering. // See https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings. +// To indicate 'uncomparable', return 0 from the function. func SortFunc[S ~[]E, E any](x S, cmp func(a, b E) int) { n := len(x) pdqsortCmpFunc(x, 0, n, bits.Len(uint(n)), cmp) diff --git a/vendor/golang.org/x/exp/slog/handler.go b/vendor/golang.org/x/exp/slog/handler.go index 74f88738c..bd635cb81 100644 --- a/vendor/golang.org/x/exp/slog/handler.go +++ b/vendor/golang.org/x/exp/slog/handler.go @@ -8,6 +8,7 @@ import ( "context" "fmt" "io" + "reflect" "strconv" "sync" "time" @@ -504,6 +505,23 @@ func (s *handleState) appendString(str string) { } func (s *handleState) appendValue(v Value) { + defer func() { + if r := recover(); r != nil { + // If it panics with a nil pointer, the most likely cases are + // an encoding.TextMarshaler or error fails to guard against nil, + // in which case "" seems to be the feasible choice. + // + // Adapted from the code in fmt/print.go. + if v := reflect.ValueOf(v.any); v.Kind() == reflect.Pointer && v.IsNil() { + s.appendString("") + return + } + + // Otherwise just print the original panic message. + s.appendString(fmt.Sprintf("!PANIC: %v", r)) + } + }() + var err error if s.h.json { err = appendJSONValue(s, v) diff --git a/vendor/golang.org/x/oauth2/LICENSE b/vendor/golang.org/x/oauth2/LICENSE index 6a66aea5e..2a7cf70da 100644 --- a/vendor/golang.org/x/oauth2/LICENSE +++ b/vendor/golang.org/x/oauth2/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/oauth2/internal/client_appengine.go b/vendor/golang.org/x/oauth2/internal/client_appengine.go deleted file mode 100644 index d28140f78..000000000 --- a/vendor/golang.org/x/oauth2/internal/client_appengine.go +++ /dev/null @@ -1,13 +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. - -//go:build appengine - -package internal - -import "google.golang.org/appengine/urlfetch" - -func init() { - appengineClientHook = urlfetch.Client -} diff --git a/vendor/golang.org/x/oauth2/internal/transport.go b/vendor/golang.org/x/oauth2/internal/transport.go index 572074a63..b9db01ddf 100644 --- a/vendor/golang.org/x/oauth2/internal/transport.go +++ b/vendor/golang.org/x/oauth2/internal/transport.go @@ -18,16 +18,11 @@ var HTTPClient ContextKey // because nobody else can create a ContextKey, being unexported. type ContextKey struct{} -var appengineClientHook func(context.Context) *http.Client - func ContextClient(ctx context.Context) *http.Client { if ctx != nil { if hc, ok := ctx.Value(HTTPClient).(*http.Client); ok { return hc } } - if appengineClientHook != nil { - return appengineClientHook(ctx) - } return http.DefaultClient } diff --git a/vendor/golang.org/x/oauth2/oauth2.go b/vendor/golang.org/x/oauth2/oauth2.go index 90a2c3d6d..09f6a49b8 100644 --- a/vendor/golang.org/x/oauth2/oauth2.go +++ b/vendor/golang.org/x/oauth2/oauth2.go @@ -393,7 +393,7 @@ func ReuseTokenSource(t *Token, src TokenSource) TokenSource { } } -// ReuseTokenSource returns a TokenSource that acts in the same manner as the +// ReuseTokenSourceWithExpiry returns a TokenSource that acts in the same manner as the // TokenSource returned by ReuseTokenSource, except the expiry buffer is // configurable. The expiration time of a token is calculated as // t.Expiry.Add(-earlyExpiry). diff --git a/vendor/golang.org/x/oauth2/token.go b/vendor/golang.org/x/oauth2/token.go index 5bbb33217..109997d77 100644 --- a/vendor/golang.org/x/oauth2/token.go +++ b/vendor/golang.org/x/oauth2/token.go @@ -49,6 +49,13 @@ type Token struct { // mechanisms for that TokenSource will not be used. Expiry time.Time `json:"expiry,omitempty"` + // ExpiresIn is the OAuth2 wire format "expires_in" field, + // which specifies how many seconds later the token expires, + // relative to an unknown time base approximately around "now". + // It is the application's responsibility to populate + // `Expiry` from `ExpiresIn` when required. + ExpiresIn int64 `json:"expires_in,omitempty"` + // raw optionally contains extra metadata from the server // when updating a token. raw interface{} diff --git a/vendor/golang.org/x/time/LICENSE b/vendor/golang.org/x/time/LICENSE index 6a66aea5e..2a7cf70da 100644 --- a/vendor/golang.org/x/time/LICENSE +++ b/vendor/golang.org/x/time/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go index 8f6c7f493..93a798ab6 100644 --- a/vendor/golang.org/x/time/rate/rate.go +++ b/vendor/golang.org/x/time/rate/rate.go @@ -99,8 +99,9 @@ func (lim *Limiter) Tokens() float64 { // bursts of at most b tokens. func NewLimiter(r Limit, b int) *Limiter { return &Limiter{ - limit: r, - burst: b, + limit: r, + burst: b, + tokens: float64(b), } } @@ -344,18 +345,6 @@ func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration) tokens: n, timeToAct: t, } - } else if lim.limit == 0 { - var ok bool - if lim.burst >= n { - ok = true - lim.burst -= n - } - return Reservation{ - ok: ok, - lim: lim, - tokens: lim.burst, - timeToAct: t, - } } t, tokens := lim.advance(t) diff --git a/vendor/golang.org/x/tools/LICENSE b/vendor/golang.org/x/tools/LICENSE index 6a66aea5e..2a7cf70da 100644 --- a/vendor/golang.org/x/tools/LICENSE +++ b/vendor/golang.org/x/tools/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/tools/go/ast/inspector/inspector.go b/vendor/golang.org/x/tools/go/ast/inspector/inspector.go index 1fc1de0bd..0e0ba4c03 100644 --- a/vendor/golang.org/x/tools/go/ast/inspector/inspector.go +++ b/vendor/golang.org/x/tools/go/ast/inspector/inspector.go @@ -73,6 +73,15 @@ func (in *Inspector) Preorder(types []ast.Node, f func(ast.Node)) { // check, Preorder is almost twice as fast as Nodes. The two // features seem to contribute similar slowdowns (~1.4x each). + // This function is equivalent to the PreorderSeq call below, + // but to avoid the additional dynamic call (which adds 13-35% + // to the benchmarks), we expand it out. + // + // in.PreorderSeq(types...)(func(n ast.Node) bool { + // f(n) + // return true + // }) + mask := maskOf(types) for i := 0; i < len(in.events); { ev := in.events[i] diff --git a/vendor/golang.org/x/tools/go/ast/inspector/iter.go b/vendor/golang.org/x/tools/go/ast/inspector/iter.go new file mode 100644 index 000000000..b7e959114 --- /dev/null +++ b/vendor/golang.org/x/tools/go/ast/inspector/iter.go @@ -0,0 +1,85 @@ +// Copyright 2024 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:build go1.23 + +package inspector + +import ( + "go/ast" + "iter" +) + +// PreorderSeq returns an iterator that visits all the +// nodes of the files supplied to New in depth-first order. +// It visits each node n before n's children. +// The complete traversal sequence is determined by ast.Inspect. +// +// The types argument, if non-empty, enables type-based +// filtering of events: only nodes whose type matches an +// element of the types slice are included in the sequence. +func (in *Inspector) PreorderSeq(types ...ast.Node) iter.Seq[ast.Node] { + + // This implementation is identical to Preorder, + // except that it supports breaking out of the loop. + + return func(yield func(ast.Node) bool) { + mask := maskOf(types) + for i := 0; i < len(in.events); { + ev := in.events[i] + if ev.index > i { + // push + if ev.typ&mask != 0 { + if !yield(ev.node) { + break + } + } + pop := ev.index + if in.events[pop].typ&mask == 0 { + // Subtrees do not contain types: skip them and pop. + i = pop + 1 + continue + } + } + i++ + } + } +} + +// All[N] returns an iterator over all the nodes of type N. +// N must be a pointer-to-struct type that implements ast.Node. +// +// Example: +// +// for call := range All[*ast.CallExpr](in) { ... } +func All[N interface { + *S + ast.Node +}, S any](in *Inspector) iter.Seq[N] { + + // To avoid additional dynamic call overheads, + // we duplicate rather than call the logic of PreorderSeq. + + mask := typeOf((N)(nil)) + return func(yield func(N) bool) { + for i := 0; i < len(in.events); { + ev := in.events[i] + if ev.index > i { + // push + if ev.typ&mask != 0 { + if !yield(ev.node.(N)) { + break + } + } + pop := ev.index + if in.events[pop].typ&mask == 0 { + // Subtrees do not contain types: skip them and pop. + i = pop + 1 + continue + } + } + i++ + } + } +} diff --git a/vendor/google.golang.org/appengine/LICENSE b/vendor/google.golang.org/appengine/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/google.golang.org/appengine/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/google.golang.org/appengine/internal/api.go b/vendor/google.golang.org/appengine/internal/api.go deleted file mode 100644 index 0569f5dd4..000000000 --- a/vendor/google.golang.org/appengine/internal/api.go +++ /dev/null @@ -1,653 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build !appengine -// +build !appengine - -package internal - -import ( - "bytes" - "context" - "errors" - "fmt" - "io/ioutil" - "log" - "net" - "net/http" - "net/url" - "os" - "runtime" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - - "github.com/golang/protobuf/proto" - - basepb "google.golang.org/appengine/internal/base" - logpb "google.golang.org/appengine/internal/log" - remotepb "google.golang.org/appengine/internal/remote_api" -) - -const ( - apiPath = "/rpc_http" -) - -var ( - // Incoming headers. - ticketHeader = http.CanonicalHeaderKey("X-AppEngine-API-Ticket") - dapperHeader = http.CanonicalHeaderKey("X-Google-DapperTraceInfo") - traceHeader = http.CanonicalHeaderKey("X-Cloud-Trace-Context") - curNamespaceHeader = http.CanonicalHeaderKey("X-AppEngine-Current-Namespace") - userIPHeader = http.CanonicalHeaderKey("X-AppEngine-User-IP") - remoteAddrHeader = http.CanonicalHeaderKey("X-AppEngine-Remote-Addr") - devRequestIdHeader = http.CanonicalHeaderKey("X-Appengine-Dev-Request-Id") - - // Outgoing headers. - apiEndpointHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Endpoint") - apiEndpointHeaderValue = []string{"app-engine-apis"} - apiMethodHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Method") - apiMethodHeaderValue = []string{"/VMRemoteAPI.CallRemoteAPI"} - apiDeadlineHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Deadline") - apiContentType = http.CanonicalHeaderKey("Content-Type") - apiContentTypeValue = []string{"application/octet-stream"} - logFlushHeader = http.CanonicalHeaderKey("X-AppEngine-Log-Flush-Count") - - apiHTTPClient = &http.Client{ - Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - Dial: limitDial, - MaxIdleConns: 1000, - MaxIdleConnsPerHost: 10000, - IdleConnTimeout: 90 * time.Second, - }, - } -) - -func apiURL(ctx context.Context) *url.URL { - host, port := "appengine.googleapis.internal", "10001" - if h := os.Getenv("API_HOST"); h != "" { - host = h - } - if hostOverride := ctx.Value(apiHostOverrideKey); hostOverride != nil { - host = hostOverride.(string) - } - if p := os.Getenv("API_PORT"); p != "" { - port = p - } - if portOverride := ctx.Value(apiPortOverrideKey); portOverride != nil { - port = portOverride.(string) - } - return &url.URL{ - Scheme: "http", - Host: host + ":" + port, - Path: apiPath, - } -} - -// Middleware wraps an http handler so that it can make GAE API calls -func Middleware(next http.Handler) http.Handler { - return handleHTTPMiddleware(executeRequestSafelyMiddleware(next)) -} - -func handleHTTPMiddleware(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - c := &aeContext{ - req: r, - outHeader: w.Header(), - } - r = r.WithContext(withContext(r.Context(), c)) - c.req = r - - stopFlushing := make(chan int) - - // Patch up RemoteAddr so it looks reasonable. - if addr := r.Header.Get(userIPHeader); addr != "" { - r.RemoteAddr = addr - } else if addr = r.Header.Get(remoteAddrHeader); addr != "" { - r.RemoteAddr = addr - } else { - // Should not normally reach here, but pick a sensible default anyway. - r.RemoteAddr = "127.0.0.1" - } - // The address in the headers will most likely be of these forms: - // 123.123.123.123 - // 2001:db8::1 - // net/http.Request.RemoteAddr is specified to be in "IP:port" form. - if _, _, err := net.SplitHostPort(r.RemoteAddr); err != nil { - // Assume the remote address is only a host; add a default port. - r.RemoteAddr = net.JoinHostPort(r.RemoteAddr, "80") - } - - if logToLogservice() { - // Start goroutine responsible for flushing app logs. - // This is done after adding c to ctx.m (and stopped before removing it) - // because flushing logs requires making an API call. - go c.logFlusher(stopFlushing) - } - - next.ServeHTTP(c, r) - c.outHeader = nil // make sure header changes aren't respected any more - - flushed := make(chan struct{}) - if logToLogservice() { - stopFlushing <- 1 // any logging beyond this point will be dropped - - // Flush any pending logs asynchronously. - c.pendingLogs.Lock() - flushes := c.pendingLogs.flushes - if len(c.pendingLogs.lines) > 0 { - flushes++ - } - c.pendingLogs.Unlock() - go func() { - defer close(flushed) - // Force a log flush, because with very short requests we - // may not ever flush logs. - c.flushLog(true) - }() - w.Header().Set(logFlushHeader, strconv.Itoa(flushes)) - } - - // Avoid nil Write call if c.Write is never called. - if c.outCode != 0 { - w.WriteHeader(c.outCode) - } - if c.outBody != nil { - w.Write(c.outBody) - } - if logToLogservice() { - // Wait for the last flush to complete before returning, - // otherwise the security ticket will not be valid. - <-flushed - } - }) -} - -func executeRequestSafelyMiddleware(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - defer func() { - if x := recover(); x != nil { - c := w.(*aeContext) - logf(c, 4, "%s", renderPanic(x)) // 4 == critical - c.outCode = 500 - } - }() - - next.ServeHTTP(w, r) - }) -} - -func renderPanic(x interface{}) string { - buf := make([]byte, 16<<10) // 16 KB should be plenty - buf = buf[:runtime.Stack(buf, false)] - - // Remove the first few stack frames: - // this func - // the recover closure in the caller - // That will root the stack trace at the site of the panic. - const ( - skipStart = "internal.renderPanic" - skipFrames = 2 - ) - start := bytes.Index(buf, []byte(skipStart)) - p := start - for i := 0; i < skipFrames*2 && p+1 < len(buf); i++ { - p = bytes.IndexByte(buf[p+1:], '\n') + p + 1 - if p < 0 { - break - } - } - if p >= 0 { - // buf[start:p+1] is the block to remove. - // Copy buf[p+1:] over buf[start:] and shrink buf. - copy(buf[start:], buf[p+1:]) - buf = buf[:len(buf)-(p+1-start)] - } - - // Add panic heading. - head := fmt.Sprintf("panic: %v\n\n", x) - if len(head) > len(buf) { - // Extremely unlikely to happen. - return head - } - copy(buf[len(head):], buf) - copy(buf, head) - - return string(buf) -} - -// aeContext represents the aeContext of an in-flight HTTP request. -// It implements the appengine.Context and http.ResponseWriter interfaces. -type aeContext struct { - req *http.Request - - outCode int - outHeader http.Header - outBody []byte - - pendingLogs struct { - sync.Mutex - lines []*logpb.UserAppLogLine - flushes int - } -} - -var contextKey = "holds a *context" - -// jointContext joins two contexts in a superficial way. -// It takes values and timeouts from a base context, and only values from another context. -type jointContext struct { - base context.Context - valuesOnly context.Context -} - -func (c jointContext) Deadline() (time.Time, bool) { - return c.base.Deadline() -} - -func (c jointContext) Done() <-chan struct{} { - return c.base.Done() -} - -func (c jointContext) Err() error { - return c.base.Err() -} - -func (c jointContext) Value(key interface{}) interface{} { - if val := c.base.Value(key); val != nil { - return val - } - return c.valuesOnly.Value(key) -} - -// fromContext returns the App Engine context or nil if ctx is not -// derived from an App Engine context. -func fromContext(ctx context.Context) *aeContext { - c, _ := ctx.Value(&contextKey).(*aeContext) - return c -} - -func withContext(parent context.Context, c *aeContext) context.Context { - ctx := context.WithValue(parent, &contextKey, c) - if ns := c.req.Header.Get(curNamespaceHeader); ns != "" { - ctx = withNamespace(ctx, ns) - } - return ctx -} - -func toContext(c *aeContext) context.Context { - return withContext(context.Background(), c) -} - -func IncomingHeaders(ctx context.Context) http.Header { - if c := fromContext(ctx); c != nil { - return c.req.Header - } - return nil -} - -func ReqContext(req *http.Request) context.Context { - return req.Context() -} - -func WithContext(parent context.Context, req *http.Request) context.Context { - return jointContext{ - base: parent, - valuesOnly: req.Context(), - } -} - -// RegisterTestRequest registers the HTTP request req for testing, such that -// any API calls are sent to the provided URL. -// It should only be used by aetest package. -func RegisterTestRequest(req *http.Request, apiURL *url.URL, appID string) *http.Request { - ctx := req.Context() - ctx = withAPIHostOverride(ctx, apiURL.Hostname()) - ctx = withAPIPortOverride(ctx, apiURL.Port()) - ctx = WithAppIDOverride(ctx, appID) - - // use the unregistered request as a placeholder so that withContext can read the headers - c := &aeContext{req: req} - c.req = req.WithContext(withContext(ctx, c)) - return c.req -} - -var errTimeout = &CallError{ - Detail: "Deadline exceeded", - Code: int32(remotepb.RpcError_CANCELLED), - Timeout: true, -} - -func (c *aeContext) Header() http.Header { return c.outHeader } - -// Copied from $GOROOT/src/pkg/net/http/transfer.go. Some response status -// codes do not permit a response body (nor response entity headers such as -// Content-Length, Content-Type, etc). -func bodyAllowedForStatus(status int) bool { - switch { - case status >= 100 && status <= 199: - return false - case status == 204: - return false - case status == 304: - return false - } - return true -} - -func (c *aeContext) Write(b []byte) (int, error) { - if c.outCode == 0 { - c.WriteHeader(http.StatusOK) - } - if len(b) > 0 && !bodyAllowedForStatus(c.outCode) { - return 0, http.ErrBodyNotAllowed - } - c.outBody = append(c.outBody, b...) - return len(b), nil -} - -func (c *aeContext) WriteHeader(code int) { - if c.outCode != 0 { - logf(c, 3, "WriteHeader called multiple times on request.") // error level - return - } - c.outCode = code -} - -func post(ctx context.Context, body []byte, timeout time.Duration) (b []byte, err error) { - apiURL := apiURL(ctx) - hreq := &http.Request{ - Method: "POST", - URL: apiURL, - Header: http.Header{ - apiEndpointHeader: apiEndpointHeaderValue, - apiMethodHeader: apiMethodHeaderValue, - apiContentType: apiContentTypeValue, - apiDeadlineHeader: []string{strconv.FormatFloat(timeout.Seconds(), 'f', -1, 64)}, - }, - Body: ioutil.NopCloser(bytes.NewReader(body)), - ContentLength: int64(len(body)), - Host: apiURL.Host, - } - c := fromContext(ctx) - if c != nil { - if info := c.req.Header.Get(dapperHeader); info != "" { - hreq.Header.Set(dapperHeader, info) - } - if info := c.req.Header.Get(traceHeader); info != "" { - hreq.Header.Set(traceHeader, info) - } - } - - tr := apiHTTPClient.Transport.(*http.Transport) - - var timedOut int32 // atomic; set to 1 if timed out - t := time.AfterFunc(timeout, func() { - atomic.StoreInt32(&timedOut, 1) - tr.CancelRequest(hreq) - }) - defer t.Stop() - defer func() { - // Check if timeout was exceeded. - if atomic.LoadInt32(&timedOut) != 0 { - err = errTimeout - } - }() - - hresp, err := apiHTTPClient.Do(hreq) - if err != nil { - return nil, &CallError{ - Detail: fmt.Sprintf("service bridge HTTP failed: %v", err), - Code: int32(remotepb.RpcError_UNKNOWN), - } - } - defer hresp.Body.Close() - hrespBody, err := ioutil.ReadAll(hresp.Body) - if hresp.StatusCode != 200 { - return nil, &CallError{ - Detail: fmt.Sprintf("service bridge returned HTTP %d (%q)", hresp.StatusCode, hrespBody), - Code: int32(remotepb.RpcError_UNKNOWN), - } - } - if err != nil { - return nil, &CallError{ - Detail: fmt.Sprintf("service bridge response bad: %v", err), - Code: int32(remotepb.RpcError_UNKNOWN), - } - } - return hrespBody, nil -} - -func Call(ctx context.Context, service, method string, in, out proto.Message) error { - if ns := NamespaceFromContext(ctx); ns != "" { - if fn, ok := NamespaceMods[service]; ok { - fn(in, ns) - } - } - - if f, ctx, ok := callOverrideFromContext(ctx); ok { - return f(ctx, service, method, in, out) - } - - // Handle already-done contexts quickly. - select { - case <-ctx.Done(): - return ctx.Err() - default: - } - - c := fromContext(ctx) - - // Apply transaction modifications if we're in a transaction. - if t := transactionFromContext(ctx); t != nil { - if t.finished { - return errors.New("transaction aeContext has expired") - } - applyTransaction(in, &t.transaction) - } - - // Default RPC timeout is 60s. - timeout := 60 * time.Second - if deadline, ok := ctx.Deadline(); ok { - timeout = deadline.Sub(time.Now()) - } - - data, err := proto.Marshal(in) - if err != nil { - return err - } - - ticket := "" - if c != nil { - ticket = c.req.Header.Get(ticketHeader) - if dri := c.req.Header.Get(devRequestIdHeader); IsDevAppServer() && dri != "" { - ticket = dri - } - } - req := &remotepb.Request{ - ServiceName: &service, - Method: &method, - Request: data, - RequestId: &ticket, - } - hreqBody, err := proto.Marshal(req) - if err != nil { - return err - } - - hrespBody, err := post(ctx, hreqBody, timeout) - if err != nil { - return err - } - - res := &remotepb.Response{} - if err := proto.Unmarshal(hrespBody, res); err != nil { - return err - } - if res.RpcError != nil { - ce := &CallError{ - Detail: res.RpcError.GetDetail(), - Code: *res.RpcError.Code, - } - switch remotepb.RpcError_ErrorCode(ce.Code) { - case remotepb.RpcError_CANCELLED, remotepb.RpcError_DEADLINE_EXCEEDED: - ce.Timeout = true - } - return ce - } - if res.ApplicationError != nil { - return &APIError{ - Service: *req.ServiceName, - Detail: res.ApplicationError.GetDetail(), - Code: *res.ApplicationError.Code, - } - } - if res.Exception != nil || res.JavaException != nil { - // This shouldn't happen, but let's be defensive. - return &CallError{ - Detail: "service bridge returned exception", - Code: int32(remotepb.RpcError_UNKNOWN), - } - } - return proto.Unmarshal(res.Response, out) -} - -func (c *aeContext) Request() *http.Request { - return c.req -} - -func (c *aeContext) addLogLine(ll *logpb.UserAppLogLine) { - // Truncate long log lines. - // TODO(dsymonds): Check if this is still necessary. - const lim = 8 << 10 - if len(*ll.Message) > lim { - suffix := fmt.Sprintf("...(length %d)", len(*ll.Message)) - ll.Message = proto.String((*ll.Message)[:lim-len(suffix)] + suffix) - } - - c.pendingLogs.Lock() - c.pendingLogs.lines = append(c.pendingLogs.lines, ll) - c.pendingLogs.Unlock() -} - -var logLevelName = map[int64]string{ - 0: "DEBUG", - 1: "INFO", - 2: "WARNING", - 3: "ERROR", - 4: "CRITICAL", -} - -func logf(c *aeContext, level int64, format string, args ...interface{}) { - if c == nil { - panic("not an App Engine aeContext") - } - s := fmt.Sprintf(format, args...) - s = strings.TrimRight(s, "\n") // Remove any trailing newline characters. - if logToLogservice() { - c.addLogLine(&logpb.UserAppLogLine{ - TimestampUsec: proto.Int64(time.Now().UnixNano() / 1e3), - Level: &level, - Message: &s, - }) - } - // Log to stdout if not deployed - if !IsSecondGen() { - log.Print(logLevelName[level] + ": " + s) - } -} - -// flushLog attempts to flush any pending logs to the appserver. -// It should not be called concurrently. -func (c *aeContext) flushLog(force bool) (flushed bool) { - c.pendingLogs.Lock() - // Grab up to 30 MB. We can get away with up to 32 MB, but let's be cautious. - n, rem := 0, 30<<20 - for ; n < len(c.pendingLogs.lines); n++ { - ll := c.pendingLogs.lines[n] - // Each log line will require about 3 bytes of overhead. - nb := proto.Size(ll) + 3 - if nb > rem { - break - } - rem -= nb - } - lines := c.pendingLogs.lines[:n] - c.pendingLogs.lines = c.pendingLogs.lines[n:] - c.pendingLogs.Unlock() - - if len(lines) == 0 && !force { - // Nothing to flush. - return false - } - - rescueLogs := false - defer func() { - if rescueLogs { - c.pendingLogs.Lock() - c.pendingLogs.lines = append(lines, c.pendingLogs.lines...) - c.pendingLogs.Unlock() - } - }() - - buf, err := proto.Marshal(&logpb.UserAppLogGroup{ - LogLine: lines, - }) - if err != nil { - log.Printf("internal.flushLog: marshaling UserAppLogGroup: %v", err) - rescueLogs = true - return false - } - - req := &logpb.FlushRequest{ - Logs: buf, - } - res := &basepb.VoidProto{} - c.pendingLogs.Lock() - c.pendingLogs.flushes++ - c.pendingLogs.Unlock() - if err := Call(toContext(c), "logservice", "Flush", req, res); err != nil { - log.Printf("internal.flushLog: Flush RPC: %v", err) - rescueLogs = true - return false - } - return true -} - -const ( - // Log flushing parameters. - flushInterval = 1 * time.Second - forceFlushInterval = 60 * time.Second -) - -func (c *aeContext) logFlusher(stop <-chan int) { - lastFlush := time.Now() - tick := time.NewTicker(flushInterval) - for { - select { - case <-stop: - // Request finished. - tick.Stop() - return - case <-tick.C: - force := time.Now().Sub(lastFlush) > forceFlushInterval - if c.flushLog(force) { - lastFlush = time.Now() - } - } - } -} - -func ContextForTesting(req *http.Request) context.Context { - return toContext(&aeContext{req: req}) -} - -func logToLogservice() bool { - // TODO: replace logservice with json structured logs to $LOG_DIR/app.log.json - // where $LOG_DIR is /var/log in prod and some tmpdir in dev - return os.Getenv("LOG_TO_LOGSERVICE") != "0" -} diff --git a/vendor/google.golang.org/appengine/internal/api_classic.go b/vendor/google.golang.org/appengine/internal/api_classic.go deleted file mode 100644 index 87c33c798..000000000 --- a/vendor/google.golang.org/appengine/internal/api_classic.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build appengine -// +build appengine - -package internal - -import ( - "context" - "errors" - "fmt" - "net/http" - "time" - - "appengine" - "appengine_internal" - basepb "appengine_internal/base" - - "github.com/golang/protobuf/proto" -) - -var contextKey = "holds an appengine.Context" - -// fromContext returns the App Engine context or nil if ctx is not -// derived from an App Engine context. -func fromContext(ctx context.Context) appengine.Context { - c, _ := ctx.Value(&contextKey).(appengine.Context) - return c -} - -// This is only for classic App Engine adapters. -func ClassicContextFromContext(ctx context.Context) (appengine.Context, error) { - c := fromContext(ctx) - if c == nil { - return nil, errNotAppEngineContext - } - return c, nil -} - -func withContext(parent context.Context, c appengine.Context) context.Context { - ctx := context.WithValue(parent, &contextKey, c) - - s := &basepb.StringProto{} - c.Call("__go__", "GetNamespace", &basepb.VoidProto{}, s, nil) - if ns := s.GetValue(); ns != "" { - ctx = NamespacedContext(ctx, ns) - } - - return ctx -} - -func IncomingHeaders(ctx context.Context) http.Header { - if c := fromContext(ctx); c != nil { - if req, ok := c.Request().(*http.Request); ok { - return req.Header - } - } - return nil -} - -func ReqContext(req *http.Request) context.Context { - return WithContext(context.Background(), req) -} - -func WithContext(parent context.Context, req *http.Request) context.Context { - c := appengine.NewContext(req) - return withContext(parent, c) -} - -type testingContext struct { - appengine.Context - - req *http.Request -} - -func (t *testingContext) FullyQualifiedAppID() string { return "dev~testcontext" } -func (t *testingContext) Call(service, method string, _, _ appengine_internal.ProtoMessage, _ *appengine_internal.CallOptions) error { - if service == "__go__" && method == "GetNamespace" { - return nil - } - return fmt.Errorf("testingContext: unsupported Call") -} -func (t *testingContext) Request() interface{} { return t.req } - -func ContextForTesting(req *http.Request) context.Context { - return withContext(context.Background(), &testingContext{req: req}) -} - -func Call(ctx context.Context, service, method string, in, out proto.Message) error { - if ns := NamespaceFromContext(ctx); ns != "" { - if fn, ok := NamespaceMods[service]; ok { - fn(in, ns) - } - } - - if f, ctx, ok := callOverrideFromContext(ctx); ok { - return f(ctx, service, method, in, out) - } - - // Handle already-done contexts quickly. - select { - case <-ctx.Done(): - return ctx.Err() - default: - } - - c := fromContext(ctx) - if c == nil { - // Give a good error message rather than a panic lower down. - return errNotAppEngineContext - } - - // Apply transaction modifications if we're in a transaction. - if t := transactionFromContext(ctx); t != nil { - if t.finished { - return errors.New("transaction context has expired") - } - applyTransaction(in, &t.transaction) - } - - var opts *appengine_internal.CallOptions - if d, ok := ctx.Deadline(); ok { - opts = &appengine_internal.CallOptions{ - Timeout: d.Sub(time.Now()), - } - } - - err := c.Call(service, method, in, out, opts) - switch v := err.(type) { - case *appengine_internal.APIError: - return &APIError{ - Service: v.Service, - Detail: v.Detail, - Code: v.Code, - } - case *appengine_internal.CallError: - return &CallError{ - Detail: v.Detail, - Code: v.Code, - Timeout: v.Timeout, - } - } - return err -} - -func Middleware(next http.Handler) http.Handler { - panic("Middleware called; this should be impossible") -} - -func logf(c appengine.Context, level int64, format string, args ...interface{}) { - var fn func(format string, args ...interface{}) - switch level { - case 0: - fn = c.Debugf - case 1: - fn = c.Infof - case 2: - fn = c.Warningf - case 3: - fn = c.Errorf - case 4: - fn = c.Criticalf - default: - // This shouldn't happen. - fn = c.Criticalf - } - fn(format, args...) -} diff --git a/vendor/google.golang.org/appengine/internal/api_common.go b/vendor/google.golang.org/appengine/internal/api_common.go deleted file mode 100644 index 5b95c13d9..000000000 --- a/vendor/google.golang.org/appengine/internal/api_common.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -package internal - -import ( - "context" - "errors" - "os" - - "github.com/golang/protobuf/proto" -) - -type ctxKey string - -func (c ctxKey) String() string { - return "appengine context key: " + string(c) -} - -var errNotAppEngineContext = errors.New("not an App Engine context") - -type CallOverrideFunc func(ctx context.Context, service, method string, in, out proto.Message) error - -var callOverrideKey = "holds []CallOverrideFunc" - -func WithCallOverride(ctx context.Context, f CallOverrideFunc) context.Context { - // We avoid appending to any existing call override - // so we don't risk overwriting a popped stack below. - var cofs []CallOverrideFunc - if uf, ok := ctx.Value(&callOverrideKey).([]CallOverrideFunc); ok { - cofs = append(cofs, uf...) - } - cofs = append(cofs, f) - return context.WithValue(ctx, &callOverrideKey, cofs) -} - -func callOverrideFromContext(ctx context.Context) (CallOverrideFunc, context.Context, bool) { - cofs, _ := ctx.Value(&callOverrideKey).([]CallOverrideFunc) - if len(cofs) == 0 { - return nil, nil, false - } - // We found a list of overrides; grab the last, and reconstitute a - // context that will hide it. - f := cofs[len(cofs)-1] - ctx = context.WithValue(ctx, &callOverrideKey, cofs[:len(cofs)-1]) - return f, ctx, true -} - -type logOverrideFunc func(level int64, format string, args ...interface{}) - -var logOverrideKey = "holds a logOverrideFunc" - -func WithLogOverride(ctx context.Context, f logOverrideFunc) context.Context { - return context.WithValue(ctx, &logOverrideKey, f) -} - -var appIDOverrideKey = "holds a string, being the full app ID" - -func WithAppIDOverride(ctx context.Context, appID string) context.Context { - return context.WithValue(ctx, &appIDOverrideKey, appID) -} - -var apiHostOverrideKey = ctxKey("holds a string, being the alternate API_HOST") - -func withAPIHostOverride(ctx context.Context, apiHost string) context.Context { - return context.WithValue(ctx, apiHostOverrideKey, apiHost) -} - -var apiPortOverrideKey = ctxKey("holds a string, being the alternate API_PORT") - -func withAPIPortOverride(ctx context.Context, apiPort string) context.Context { - return context.WithValue(ctx, apiPortOverrideKey, apiPort) -} - -var namespaceKey = "holds the namespace string" - -func withNamespace(ctx context.Context, ns string) context.Context { - return context.WithValue(ctx, &namespaceKey, ns) -} - -func NamespaceFromContext(ctx context.Context) string { - // If there's no namespace, return the empty string. - ns, _ := ctx.Value(&namespaceKey).(string) - return ns -} - -// FullyQualifiedAppID returns the fully-qualified application ID. -// This may contain a partition prefix (e.g. "s~" for High Replication apps), -// or a domain prefix (e.g. "example.com:"). -func FullyQualifiedAppID(ctx context.Context) string { - if id, ok := ctx.Value(&appIDOverrideKey).(string); ok { - return id - } - return fullyQualifiedAppID(ctx) -} - -func Logf(ctx context.Context, level int64, format string, args ...interface{}) { - if f, ok := ctx.Value(&logOverrideKey).(logOverrideFunc); ok { - f(level, format, args...) - return - } - c := fromContext(ctx) - if c == nil { - panic(errNotAppEngineContext) - } - logf(c, level, format, args...) -} - -// NamespacedContext wraps a Context to support namespaces. -func NamespacedContext(ctx context.Context, namespace string) context.Context { - return withNamespace(ctx, namespace) -} - -// SetTestEnv sets the env variables for testing background ticket in Flex. -func SetTestEnv() func() { - var environ = []struct { - key, value string - }{ - {"GAE_LONG_APP_ID", "my-app-id"}, - {"GAE_MINOR_VERSION", "067924799508853122"}, - {"GAE_MODULE_INSTANCE", "0"}, - {"GAE_MODULE_NAME", "default"}, - {"GAE_MODULE_VERSION", "20150612t184001"}, - } - - for _, v := range environ { - old := os.Getenv(v.key) - os.Setenv(v.key, v.value) - v.value = old - } - return func() { // Restore old environment after the test completes. - for _, v := range environ { - if v.value == "" { - os.Unsetenv(v.key) - continue - } - os.Setenv(v.key, v.value) - } - } -} diff --git a/vendor/google.golang.org/appengine/internal/app_id.go b/vendor/google.golang.org/appengine/internal/app_id.go deleted file mode 100644 index 11df8c07b..000000000 --- a/vendor/google.golang.org/appengine/internal/app_id.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -package internal - -import ( - "strings" -) - -func parseFullAppID(appid string) (partition, domain, displayID string) { - if i := strings.Index(appid, "~"); i != -1 { - partition, appid = appid[:i], appid[i+1:] - } - if i := strings.Index(appid, ":"); i != -1 { - domain, appid = appid[:i], appid[i+1:] - } - return partition, domain, appid -} - -// appID returns "appid" or "domain.com:appid". -func appID(fullAppID string) string { - _, dom, dis := parseFullAppID(fullAppID) - if dom != "" { - return dom + ":" + dis - } - return dis -} diff --git a/vendor/google.golang.org/appengine/internal/base/api_base.pb.go b/vendor/google.golang.org/appengine/internal/base/api_base.pb.go deleted file mode 100644 index db4777e68..000000000 --- a/vendor/google.golang.org/appengine/internal/base/api_base.pb.go +++ /dev/null @@ -1,308 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google.golang.org/appengine/internal/base/api_base.proto - -package base - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type StringProto struct { - Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StringProto) Reset() { *m = StringProto{} } -func (m *StringProto) String() string { return proto.CompactTextString(m) } -func (*StringProto) ProtoMessage() {} -func (*StringProto) Descriptor() ([]byte, []int) { - return fileDescriptor_api_base_9d49f8792e0c1140, []int{0} -} -func (m *StringProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StringProto.Unmarshal(m, b) -} -func (m *StringProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StringProto.Marshal(b, m, deterministic) -} -func (dst *StringProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_StringProto.Merge(dst, src) -} -func (m *StringProto) XXX_Size() int { - return xxx_messageInfo_StringProto.Size(m) -} -func (m *StringProto) XXX_DiscardUnknown() { - xxx_messageInfo_StringProto.DiscardUnknown(m) -} - -var xxx_messageInfo_StringProto proto.InternalMessageInfo - -func (m *StringProto) GetValue() string { - if m != nil && m.Value != nil { - return *m.Value - } - return "" -} - -type Integer32Proto struct { - Value *int32 `protobuf:"varint,1,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Integer32Proto) Reset() { *m = Integer32Proto{} } -func (m *Integer32Proto) String() string { return proto.CompactTextString(m) } -func (*Integer32Proto) ProtoMessage() {} -func (*Integer32Proto) Descriptor() ([]byte, []int) { - return fileDescriptor_api_base_9d49f8792e0c1140, []int{1} -} -func (m *Integer32Proto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Integer32Proto.Unmarshal(m, b) -} -func (m *Integer32Proto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Integer32Proto.Marshal(b, m, deterministic) -} -func (dst *Integer32Proto) XXX_Merge(src proto.Message) { - xxx_messageInfo_Integer32Proto.Merge(dst, src) -} -func (m *Integer32Proto) XXX_Size() int { - return xxx_messageInfo_Integer32Proto.Size(m) -} -func (m *Integer32Proto) XXX_DiscardUnknown() { - xxx_messageInfo_Integer32Proto.DiscardUnknown(m) -} - -var xxx_messageInfo_Integer32Proto proto.InternalMessageInfo - -func (m *Integer32Proto) GetValue() int32 { - if m != nil && m.Value != nil { - return *m.Value - } - return 0 -} - -type Integer64Proto struct { - Value *int64 `protobuf:"varint,1,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Integer64Proto) Reset() { *m = Integer64Proto{} } -func (m *Integer64Proto) String() string { return proto.CompactTextString(m) } -func (*Integer64Proto) ProtoMessage() {} -func (*Integer64Proto) Descriptor() ([]byte, []int) { - return fileDescriptor_api_base_9d49f8792e0c1140, []int{2} -} -func (m *Integer64Proto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Integer64Proto.Unmarshal(m, b) -} -func (m *Integer64Proto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Integer64Proto.Marshal(b, m, deterministic) -} -func (dst *Integer64Proto) XXX_Merge(src proto.Message) { - xxx_messageInfo_Integer64Proto.Merge(dst, src) -} -func (m *Integer64Proto) XXX_Size() int { - return xxx_messageInfo_Integer64Proto.Size(m) -} -func (m *Integer64Proto) XXX_DiscardUnknown() { - xxx_messageInfo_Integer64Proto.DiscardUnknown(m) -} - -var xxx_messageInfo_Integer64Proto proto.InternalMessageInfo - -func (m *Integer64Proto) GetValue() int64 { - if m != nil && m.Value != nil { - return *m.Value - } - return 0 -} - -type BoolProto struct { - Value *bool `protobuf:"varint,1,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BoolProto) Reset() { *m = BoolProto{} } -func (m *BoolProto) String() string { return proto.CompactTextString(m) } -func (*BoolProto) ProtoMessage() {} -func (*BoolProto) Descriptor() ([]byte, []int) { - return fileDescriptor_api_base_9d49f8792e0c1140, []int{3} -} -func (m *BoolProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BoolProto.Unmarshal(m, b) -} -func (m *BoolProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BoolProto.Marshal(b, m, deterministic) -} -func (dst *BoolProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_BoolProto.Merge(dst, src) -} -func (m *BoolProto) XXX_Size() int { - return xxx_messageInfo_BoolProto.Size(m) -} -func (m *BoolProto) XXX_DiscardUnknown() { - xxx_messageInfo_BoolProto.DiscardUnknown(m) -} - -var xxx_messageInfo_BoolProto proto.InternalMessageInfo - -func (m *BoolProto) GetValue() bool { - if m != nil && m.Value != nil { - return *m.Value - } - return false -} - -type DoubleProto struct { - Value *float64 `protobuf:"fixed64,1,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DoubleProto) Reset() { *m = DoubleProto{} } -func (m *DoubleProto) String() string { return proto.CompactTextString(m) } -func (*DoubleProto) ProtoMessage() {} -func (*DoubleProto) Descriptor() ([]byte, []int) { - return fileDescriptor_api_base_9d49f8792e0c1140, []int{4} -} -func (m *DoubleProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DoubleProto.Unmarshal(m, b) -} -func (m *DoubleProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DoubleProto.Marshal(b, m, deterministic) -} -func (dst *DoubleProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_DoubleProto.Merge(dst, src) -} -func (m *DoubleProto) XXX_Size() int { - return xxx_messageInfo_DoubleProto.Size(m) -} -func (m *DoubleProto) XXX_DiscardUnknown() { - xxx_messageInfo_DoubleProto.DiscardUnknown(m) -} - -var xxx_messageInfo_DoubleProto proto.InternalMessageInfo - -func (m *DoubleProto) GetValue() float64 { - if m != nil && m.Value != nil { - return *m.Value - } - return 0 -} - -type BytesProto struct { - Value []byte `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BytesProto) Reset() { *m = BytesProto{} } -func (m *BytesProto) String() string { return proto.CompactTextString(m) } -func (*BytesProto) ProtoMessage() {} -func (*BytesProto) Descriptor() ([]byte, []int) { - return fileDescriptor_api_base_9d49f8792e0c1140, []int{5} -} -func (m *BytesProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BytesProto.Unmarshal(m, b) -} -func (m *BytesProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BytesProto.Marshal(b, m, deterministic) -} -func (dst *BytesProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_BytesProto.Merge(dst, src) -} -func (m *BytesProto) XXX_Size() int { - return xxx_messageInfo_BytesProto.Size(m) -} -func (m *BytesProto) XXX_DiscardUnknown() { - xxx_messageInfo_BytesProto.DiscardUnknown(m) -} - -var xxx_messageInfo_BytesProto proto.InternalMessageInfo - -func (m *BytesProto) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type VoidProto struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *VoidProto) Reset() { *m = VoidProto{} } -func (m *VoidProto) String() string { return proto.CompactTextString(m) } -func (*VoidProto) ProtoMessage() {} -func (*VoidProto) Descriptor() ([]byte, []int) { - return fileDescriptor_api_base_9d49f8792e0c1140, []int{6} -} -func (m *VoidProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_VoidProto.Unmarshal(m, b) -} -func (m *VoidProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_VoidProto.Marshal(b, m, deterministic) -} -func (dst *VoidProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_VoidProto.Merge(dst, src) -} -func (m *VoidProto) XXX_Size() int { - return xxx_messageInfo_VoidProto.Size(m) -} -func (m *VoidProto) XXX_DiscardUnknown() { - xxx_messageInfo_VoidProto.DiscardUnknown(m) -} - -var xxx_messageInfo_VoidProto proto.InternalMessageInfo - -func init() { - proto.RegisterType((*StringProto)(nil), "appengine.base.StringProto") - proto.RegisterType((*Integer32Proto)(nil), "appengine.base.Integer32Proto") - proto.RegisterType((*Integer64Proto)(nil), "appengine.base.Integer64Proto") - proto.RegisterType((*BoolProto)(nil), "appengine.base.BoolProto") - proto.RegisterType((*DoubleProto)(nil), "appengine.base.DoubleProto") - proto.RegisterType((*BytesProto)(nil), "appengine.base.BytesProto") - proto.RegisterType((*VoidProto)(nil), "appengine.base.VoidProto") -} - -func init() { - proto.RegisterFile("google.golang.org/appengine/internal/base/api_base.proto", fileDescriptor_api_base_9d49f8792e0c1140) -} - -var fileDescriptor_api_base_9d49f8792e0c1140 = []byte{ - // 199 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0xcf, 0x3f, 0x4b, 0xc6, 0x30, - 0x10, 0x06, 0x70, 0x5a, 0xad, 0xb4, 0x57, 0xe9, 0x20, 0x0e, 0x1d, 0xb5, 0x05, 0x71, 0x4a, 0x40, - 0x45, 0x9c, 0x83, 0x8b, 0x9b, 0x28, 0x38, 0xb8, 0x48, 0x8a, 0xc7, 0x11, 0x08, 0xb9, 0x90, 0xa6, - 0x82, 0xdf, 0x5e, 0xda, 0xd2, 0xfa, 0xc2, 0x9b, 0xed, 0xfe, 0xfc, 0xe0, 0xe1, 0x81, 0x27, 0x62, - 0x26, 0x8b, 0x82, 0xd8, 0x6a, 0x47, 0x82, 0x03, 0x49, 0xed, 0x3d, 0x3a, 0x32, 0x0e, 0xa5, 0x71, - 0x11, 0x83, 0xd3, 0x56, 0x0e, 0x7a, 0x44, 0xa9, 0xbd, 0xf9, 0x9a, 0x07, 0xe1, 0x03, 0x47, 0xbe, - 0x68, 0x76, 0x27, 0xe6, 0x6b, 0xd7, 0x43, 0xfd, 0x1e, 0x83, 0x71, 0xf4, 0xba, 0xbc, 0x2f, 0xa1, - 0xf8, 0xd1, 0x76, 0xc2, 0x36, 0xbb, 0xca, 0x6f, 0xab, 0xb7, 0x75, 0xe9, 0x6e, 0xa0, 0x79, 0x71, - 0x11, 0x09, 0xc3, 0xfd, 0x5d, 0xc2, 0x15, 0xc7, 0xee, 0xf1, 0x21, 0xe1, 0x4e, 0x36, 0x77, 0x0d, - 0x95, 0x62, 0xb6, 0x09, 0x52, 0x6e, 0xa4, 0x87, 0xfa, 0x99, 0xa7, 0xc1, 0x62, 0x02, 0x65, 0xff, - 0x79, 0xa0, 0x7e, 0x23, 0x8e, 0xab, 0x69, 0x0f, 0xcd, 0xb9, 0xca, 0xcb, 0xdd, 0xd5, 0x50, 0x7d, - 0xb0, 0xf9, 0x5e, 0x98, 0x3a, 0xfb, 0x3c, 0x9d, 0x9b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xba, - 0x37, 0x25, 0xea, 0x44, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/appengine/internal/base/api_base.proto b/vendor/google.golang.org/appengine/internal/base/api_base.proto deleted file mode 100644 index 56cd7a3ca..000000000 --- a/vendor/google.golang.org/appengine/internal/base/api_base.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Built-in base types for API calls. Primarily useful as return types. - -syntax = "proto2"; -option go_package = "base"; - -package appengine.base; - -message StringProto { - required string value = 1; -} - -message Integer32Proto { - required int32 value = 1; -} - -message Integer64Proto { - required int64 value = 1; -} - -message BoolProto { - required bool value = 1; -} - -message DoubleProto { - required double value = 1; -} - -message BytesProto { - required bytes value = 1 [ctype=CORD]; -} - -message VoidProto { -} diff --git a/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go b/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go deleted file mode 100644 index 2fb748289..000000000 --- a/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go +++ /dev/null @@ -1,4367 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google.golang.org/appengine/internal/datastore/datastore_v3.proto - -package datastore - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type Property_Meaning int32 - -const ( - Property_NO_MEANING Property_Meaning = 0 - Property_BLOB Property_Meaning = 14 - Property_TEXT Property_Meaning = 15 - Property_BYTESTRING Property_Meaning = 16 - Property_ATOM_CATEGORY Property_Meaning = 1 - Property_ATOM_LINK Property_Meaning = 2 - Property_ATOM_TITLE Property_Meaning = 3 - Property_ATOM_CONTENT Property_Meaning = 4 - Property_ATOM_SUMMARY Property_Meaning = 5 - Property_ATOM_AUTHOR Property_Meaning = 6 - Property_GD_WHEN Property_Meaning = 7 - Property_GD_EMAIL Property_Meaning = 8 - Property_GEORSS_POINT Property_Meaning = 9 - Property_GD_IM Property_Meaning = 10 - Property_GD_PHONENUMBER Property_Meaning = 11 - Property_GD_POSTALADDRESS Property_Meaning = 12 - Property_GD_RATING Property_Meaning = 13 - Property_BLOBKEY Property_Meaning = 17 - Property_ENTITY_PROTO Property_Meaning = 19 - Property_INDEX_VALUE Property_Meaning = 18 -) - -var Property_Meaning_name = map[int32]string{ - 0: "NO_MEANING", - 14: "BLOB", - 15: "TEXT", - 16: "BYTESTRING", - 1: "ATOM_CATEGORY", - 2: "ATOM_LINK", - 3: "ATOM_TITLE", - 4: "ATOM_CONTENT", - 5: "ATOM_SUMMARY", - 6: "ATOM_AUTHOR", - 7: "GD_WHEN", - 8: "GD_EMAIL", - 9: "GEORSS_POINT", - 10: "GD_IM", - 11: "GD_PHONENUMBER", - 12: "GD_POSTALADDRESS", - 13: "GD_RATING", - 17: "BLOBKEY", - 19: "ENTITY_PROTO", - 18: "INDEX_VALUE", -} -var Property_Meaning_value = map[string]int32{ - "NO_MEANING": 0, - "BLOB": 14, - "TEXT": 15, - "BYTESTRING": 16, - "ATOM_CATEGORY": 1, - "ATOM_LINK": 2, - "ATOM_TITLE": 3, - "ATOM_CONTENT": 4, - "ATOM_SUMMARY": 5, - "ATOM_AUTHOR": 6, - "GD_WHEN": 7, - "GD_EMAIL": 8, - "GEORSS_POINT": 9, - "GD_IM": 10, - "GD_PHONENUMBER": 11, - "GD_POSTALADDRESS": 12, - "GD_RATING": 13, - "BLOBKEY": 17, - "ENTITY_PROTO": 19, - "INDEX_VALUE": 18, -} - -func (x Property_Meaning) Enum() *Property_Meaning { - p := new(Property_Meaning) - *p = x - return p -} -func (x Property_Meaning) String() string { - return proto.EnumName(Property_Meaning_name, int32(x)) -} -func (x *Property_Meaning) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Property_Meaning_value, data, "Property_Meaning") - if err != nil { - return err - } - *x = Property_Meaning(value) - return nil -} -func (Property_Meaning) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{2, 0} -} - -type Property_FtsTokenizationOption int32 - -const ( - Property_HTML Property_FtsTokenizationOption = 1 - Property_ATOM Property_FtsTokenizationOption = 2 -) - -var Property_FtsTokenizationOption_name = map[int32]string{ - 1: "HTML", - 2: "ATOM", -} -var Property_FtsTokenizationOption_value = map[string]int32{ - "HTML": 1, - "ATOM": 2, -} - -func (x Property_FtsTokenizationOption) Enum() *Property_FtsTokenizationOption { - p := new(Property_FtsTokenizationOption) - *p = x - return p -} -func (x Property_FtsTokenizationOption) String() string { - return proto.EnumName(Property_FtsTokenizationOption_name, int32(x)) -} -func (x *Property_FtsTokenizationOption) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Property_FtsTokenizationOption_value, data, "Property_FtsTokenizationOption") - if err != nil { - return err - } - *x = Property_FtsTokenizationOption(value) - return nil -} -func (Property_FtsTokenizationOption) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{2, 1} -} - -type EntityProto_Kind int32 - -const ( - EntityProto_GD_CONTACT EntityProto_Kind = 1 - EntityProto_GD_EVENT EntityProto_Kind = 2 - EntityProto_GD_MESSAGE EntityProto_Kind = 3 -) - -var EntityProto_Kind_name = map[int32]string{ - 1: "GD_CONTACT", - 2: "GD_EVENT", - 3: "GD_MESSAGE", -} -var EntityProto_Kind_value = map[string]int32{ - "GD_CONTACT": 1, - "GD_EVENT": 2, - "GD_MESSAGE": 3, -} - -func (x EntityProto_Kind) Enum() *EntityProto_Kind { - p := new(EntityProto_Kind) - *p = x - return p -} -func (x EntityProto_Kind) String() string { - return proto.EnumName(EntityProto_Kind_name, int32(x)) -} -func (x *EntityProto_Kind) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(EntityProto_Kind_value, data, "EntityProto_Kind") - if err != nil { - return err - } - *x = EntityProto_Kind(value) - return nil -} -func (EntityProto_Kind) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{6, 0} -} - -type Index_Property_Direction int32 - -const ( - Index_Property_ASCENDING Index_Property_Direction = 1 - Index_Property_DESCENDING Index_Property_Direction = 2 -) - -var Index_Property_Direction_name = map[int32]string{ - 1: "ASCENDING", - 2: "DESCENDING", -} -var Index_Property_Direction_value = map[string]int32{ - "ASCENDING": 1, - "DESCENDING": 2, -} - -func (x Index_Property_Direction) Enum() *Index_Property_Direction { - p := new(Index_Property_Direction) - *p = x - return p -} -func (x Index_Property_Direction) String() string { - return proto.EnumName(Index_Property_Direction_name, int32(x)) -} -func (x *Index_Property_Direction) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Index_Property_Direction_value, data, "Index_Property_Direction") - if err != nil { - return err - } - *x = Index_Property_Direction(value) - return nil -} -func (Index_Property_Direction) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{8, 0, 0} -} - -type CompositeIndex_State int32 - -const ( - CompositeIndex_WRITE_ONLY CompositeIndex_State = 1 - CompositeIndex_READ_WRITE CompositeIndex_State = 2 - CompositeIndex_DELETED CompositeIndex_State = 3 - CompositeIndex_ERROR CompositeIndex_State = 4 -) - -var CompositeIndex_State_name = map[int32]string{ - 1: "WRITE_ONLY", - 2: "READ_WRITE", - 3: "DELETED", - 4: "ERROR", -} -var CompositeIndex_State_value = map[string]int32{ - "WRITE_ONLY": 1, - "READ_WRITE": 2, - "DELETED": 3, - "ERROR": 4, -} - -func (x CompositeIndex_State) Enum() *CompositeIndex_State { - p := new(CompositeIndex_State) - *p = x - return p -} -func (x CompositeIndex_State) String() string { - return proto.EnumName(CompositeIndex_State_name, int32(x)) -} -func (x *CompositeIndex_State) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CompositeIndex_State_value, data, "CompositeIndex_State") - if err != nil { - return err - } - *x = CompositeIndex_State(value) - return nil -} -func (CompositeIndex_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{9, 0} -} - -type Snapshot_Status int32 - -const ( - Snapshot_INACTIVE Snapshot_Status = 0 - Snapshot_ACTIVE Snapshot_Status = 1 -) - -var Snapshot_Status_name = map[int32]string{ - 0: "INACTIVE", - 1: "ACTIVE", -} -var Snapshot_Status_value = map[string]int32{ - "INACTIVE": 0, - "ACTIVE": 1, -} - -func (x Snapshot_Status) Enum() *Snapshot_Status { - p := new(Snapshot_Status) - *p = x - return p -} -func (x Snapshot_Status) String() string { - return proto.EnumName(Snapshot_Status_name, int32(x)) -} -func (x *Snapshot_Status) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Snapshot_Status_value, data, "Snapshot_Status") - if err != nil { - return err - } - *x = Snapshot_Status(value) - return nil -} -func (Snapshot_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{12, 0} -} - -type Query_Hint int32 - -const ( - Query_ORDER_FIRST Query_Hint = 1 - Query_ANCESTOR_FIRST Query_Hint = 2 - Query_FILTER_FIRST Query_Hint = 3 -) - -var Query_Hint_name = map[int32]string{ - 1: "ORDER_FIRST", - 2: "ANCESTOR_FIRST", - 3: "FILTER_FIRST", -} -var Query_Hint_value = map[string]int32{ - "ORDER_FIRST": 1, - "ANCESTOR_FIRST": 2, - "FILTER_FIRST": 3, -} - -func (x Query_Hint) Enum() *Query_Hint { - p := new(Query_Hint) - *p = x - return p -} -func (x Query_Hint) String() string { - return proto.EnumName(Query_Hint_name, int32(x)) -} -func (x *Query_Hint) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Query_Hint_value, data, "Query_Hint") - if err != nil { - return err - } - *x = Query_Hint(value) - return nil -} -func (Query_Hint) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 0} -} - -type Query_Filter_Operator int32 - -const ( - Query_Filter_LESS_THAN Query_Filter_Operator = 1 - Query_Filter_LESS_THAN_OR_EQUAL Query_Filter_Operator = 2 - Query_Filter_GREATER_THAN Query_Filter_Operator = 3 - Query_Filter_GREATER_THAN_OR_EQUAL Query_Filter_Operator = 4 - Query_Filter_EQUAL Query_Filter_Operator = 5 - Query_Filter_IN Query_Filter_Operator = 6 - Query_Filter_EXISTS Query_Filter_Operator = 7 -) - -var Query_Filter_Operator_name = map[int32]string{ - 1: "LESS_THAN", - 2: "LESS_THAN_OR_EQUAL", - 3: "GREATER_THAN", - 4: "GREATER_THAN_OR_EQUAL", - 5: "EQUAL", - 6: "IN", - 7: "EXISTS", -} -var Query_Filter_Operator_value = map[string]int32{ - "LESS_THAN": 1, - "LESS_THAN_OR_EQUAL": 2, - "GREATER_THAN": 3, - "GREATER_THAN_OR_EQUAL": 4, - "EQUAL": 5, - "IN": 6, - "EXISTS": 7, -} - -func (x Query_Filter_Operator) Enum() *Query_Filter_Operator { - p := new(Query_Filter_Operator) - *p = x - return p -} -func (x Query_Filter_Operator) String() string { - return proto.EnumName(Query_Filter_Operator_name, int32(x)) -} -func (x *Query_Filter_Operator) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Query_Filter_Operator_value, data, "Query_Filter_Operator") - if err != nil { - return err - } - *x = Query_Filter_Operator(value) - return nil -} -func (Query_Filter_Operator) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 0, 0} -} - -type Query_Order_Direction int32 - -const ( - Query_Order_ASCENDING Query_Order_Direction = 1 - Query_Order_DESCENDING Query_Order_Direction = 2 -) - -var Query_Order_Direction_name = map[int32]string{ - 1: "ASCENDING", - 2: "DESCENDING", -} -var Query_Order_Direction_value = map[string]int32{ - "ASCENDING": 1, - "DESCENDING": 2, -} - -func (x Query_Order_Direction) Enum() *Query_Order_Direction { - p := new(Query_Order_Direction) - *p = x - return p -} -func (x Query_Order_Direction) String() string { - return proto.EnumName(Query_Order_Direction_name, int32(x)) -} -func (x *Query_Order_Direction) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Query_Order_Direction_value, data, "Query_Order_Direction") - if err != nil { - return err - } - *x = Query_Order_Direction(value) - return nil -} -func (Query_Order_Direction) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 1, 0} -} - -type Error_ErrorCode int32 - -const ( - Error_BAD_REQUEST Error_ErrorCode = 1 - Error_CONCURRENT_TRANSACTION Error_ErrorCode = 2 - Error_INTERNAL_ERROR Error_ErrorCode = 3 - Error_NEED_INDEX Error_ErrorCode = 4 - Error_TIMEOUT Error_ErrorCode = 5 - Error_PERMISSION_DENIED Error_ErrorCode = 6 - Error_BIGTABLE_ERROR Error_ErrorCode = 7 - Error_COMMITTED_BUT_STILL_APPLYING Error_ErrorCode = 8 - Error_CAPABILITY_DISABLED Error_ErrorCode = 9 - Error_TRY_ALTERNATE_BACKEND Error_ErrorCode = 10 - Error_SAFE_TIME_TOO_OLD Error_ErrorCode = 11 -) - -var Error_ErrorCode_name = map[int32]string{ - 1: "BAD_REQUEST", - 2: "CONCURRENT_TRANSACTION", - 3: "INTERNAL_ERROR", - 4: "NEED_INDEX", - 5: "TIMEOUT", - 6: "PERMISSION_DENIED", - 7: "BIGTABLE_ERROR", - 8: "COMMITTED_BUT_STILL_APPLYING", - 9: "CAPABILITY_DISABLED", - 10: "TRY_ALTERNATE_BACKEND", - 11: "SAFE_TIME_TOO_OLD", -} -var Error_ErrorCode_value = map[string]int32{ - "BAD_REQUEST": 1, - "CONCURRENT_TRANSACTION": 2, - "INTERNAL_ERROR": 3, - "NEED_INDEX": 4, - "TIMEOUT": 5, - "PERMISSION_DENIED": 6, - "BIGTABLE_ERROR": 7, - "COMMITTED_BUT_STILL_APPLYING": 8, - "CAPABILITY_DISABLED": 9, - "TRY_ALTERNATE_BACKEND": 10, - "SAFE_TIME_TOO_OLD": 11, -} - -func (x Error_ErrorCode) Enum() *Error_ErrorCode { - p := new(Error_ErrorCode) - *p = x - return p -} -func (x Error_ErrorCode) String() string { - return proto.EnumName(Error_ErrorCode_name, int32(x)) -} -func (x *Error_ErrorCode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Error_ErrorCode_value, data, "Error_ErrorCode") - if err != nil { - return err - } - *x = Error_ErrorCode(value) - return nil -} -func (Error_ErrorCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{19, 0} -} - -type PutRequest_AutoIdPolicy int32 - -const ( - PutRequest_CURRENT PutRequest_AutoIdPolicy = 0 - PutRequest_SEQUENTIAL PutRequest_AutoIdPolicy = 1 -) - -var PutRequest_AutoIdPolicy_name = map[int32]string{ - 0: "CURRENT", - 1: "SEQUENTIAL", -} -var PutRequest_AutoIdPolicy_value = map[string]int32{ - "CURRENT": 0, - "SEQUENTIAL": 1, -} - -func (x PutRequest_AutoIdPolicy) Enum() *PutRequest_AutoIdPolicy { - p := new(PutRequest_AutoIdPolicy) - *p = x - return p -} -func (x PutRequest_AutoIdPolicy) String() string { - return proto.EnumName(PutRequest_AutoIdPolicy_name, int32(x)) -} -func (x *PutRequest_AutoIdPolicy) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(PutRequest_AutoIdPolicy_value, data, "PutRequest_AutoIdPolicy") - if err != nil { - return err - } - *x = PutRequest_AutoIdPolicy(value) - return nil -} -func (PutRequest_AutoIdPolicy) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{23, 0} -} - -type BeginTransactionRequest_TransactionMode int32 - -const ( - BeginTransactionRequest_UNKNOWN BeginTransactionRequest_TransactionMode = 0 - BeginTransactionRequest_READ_ONLY BeginTransactionRequest_TransactionMode = 1 - BeginTransactionRequest_READ_WRITE BeginTransactionRequest_TransactionMode = 2 -) - -var BeginTransactionRequest_TransactionMode_name = map[int32]string{ - 0: "UNKNOWN", - 1: "READ_ONLY", - 2: "READ_WRITE", -} -var BeginTransactionRequest_TransactionMode_value = map[string]int32{ - "UNKNOWN": 0, - "READ_ONLY": 1, - "READ_WRITE": 2, -} - -func (x BeginTransactionRequest_TransactionMode) Enum() *BeginTransactionRequest_TransactionMode { - p := new(BeginTransactionRequest_TransactionMode) - *p = x - return p -} -func (x BeginTransactionRequest_TransactionMode) String() string { - return proto.EnumName(BeginTransactionRequest_TransactionMode_name, int32(x)) -} -func (x *BeginTransactionRequest_TransactionMode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(BeginTransactionRequest_TransactionMode_value, data, "BeginTransactionRequest_TransactionMode") - if err != nil { - return err - } - *x = BeginTransactionRequest_TransactionMode(value) - return nil -} -func (BeginTransactionRequest_TransactionMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{36, 0} -} - -type Action struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Action) Reset() { *m = Action{} } -func (m *Action) String() string { return proto.CompactTextString(m) } -func (*Action) ProtoMessage() {} -func (*Action) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{0} -} -func (m *Action) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Action.Unmarshal(m, b) -} -func (m *Action) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Action.Marshal(b, m, deterministic) -} -func (dst *Action) XXX_Merge(src proto.Message) { - xxx_messageInfo_Action.Merge(dst, src) -} -func (m *Action) XXX_Size() int { - return xxx_messageInfo_Action.Size(m) -} -func (m *Action) XXX_DiscardUnknown() { - xxx_messageInfo_Action.DiscardUnknown(m) -} - -var xxx_messageInfo_Action proto.InternalMessageInfo - -type PropertyValue struct { - Int64Value *int64 `protobuf:"varint,1,opt,name=int64Value" json:"int64Value,omitempty"` - BooleanValue *bool `protobuf:"varint,2,opt,name=booleanValue" json:"booleanValue,omitempty"` - StringValue *string `protobuf:"bytes,3,opt,name=stringValue" json:"stringValue,omitempty"` - DoubleValue *float64 `protobuf:"fixed64,4,opt,name=doubleValue" json:"doubleValue,omitempty"` - Pointvalue *PropertyValue_PointValue `protobuf:"group,5,opt,name=PointValue,json=pointvalue" json:"pointvalue,omitempty"` - Uservalue *PropertyValue_UserValue `protobuf:"group,8,opt,name=UserValue,json=uservalue" json:"uservalue,omitempty"` - Referencevalue *PropertyValue_ReferenceValue `protobuf:"group,12,opt,name=ReferenceValue,json=referencevalue" json:"referencevalue,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PropertyValue) Reset() { *m = PropertyValue{} } -func (m *PropertyValue) String() string { return proto.CompactTextString(m) } -func (*PropertyValue) ProtoMessage() {} -func (*PropertyValue) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1} -} -func (m *PropertyValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PropertyValue.Unmarshal(m, b) -} -func (m *PropertyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PropertyValue.Marshal(b, m, deterministic) -} -func (dst *PropertyValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_PropertyValue.Merge(dst, src) -} -func (m *PropertyValue) XXX_Size() int { - return xxx_messageInfo_PropertyValue.Size(m) -} -func (m *PropertyValue) XXX_DiscardUnknown() { - xxx_messageInfo_PropertyValue.DiscardUnknown(m) -} - -var xxx_messageInfo_PropertyValue proto.InternalMessageInfo - -func (m *PropertyValue) GetInt64Value() int64 { - if m != nil && m.Int64Value != nil { - return *m.Int64Value - } - return 0 -} - -func (m *PropertyValue) GetBooleanValue() bool { - if m != nil && m.BooleanValue != nil { - return *m.BooleanValue - } - return false -} - -func (m *PropertyValue) GetStringValue() string { - if m != nil && m.StringValue != nil { - return *m.StringValue - } - return "" -} - -func (m *PropertyValue) GetDoubleValue() float64 { - if m != nil && m.DoubleValue != nil { - return *m.DoubleValue - } - return 0 -} - -func (m *PropertyValue) GetPointvalue() *PropertyValue_PointValue { - if m != nil { - return m.Pointvalue - } - return nil -} - -func (m *PropertyValue) GetUservalue() *PropertyValue_UserValue { - if m != nil { - return m.Uservalue - } - return nil -} - -func (m *PropertyValue) GetReferencevalue() *PropertyValue_ReferenceValue { - if m != nil { - return m.Referencevalue - } - return nil -} - -type PropertyValue_PointValue struct { - X *float64 `protobuf:"fixed64,6,req,name=x" json:"x,omitempty"` - Y *float64 `protobuf:"fixed64,7,req,name=y" json:"y,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PropertyValue_PointValue) Reset() { *m = PropertyValue_PointValue{} } -func (m *PropertyValue_PointValue) String() string { return proto.CompactTextString(m) } -func (*PropertyValue_PointValue) ProtoMessage() {} -func (*PropertyValue_PointValue) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1, 0} -} -func (m *PropertyValue_PointValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PropertyValue_PointValue.Unmarshal(m, b) -} -func (m *PropertyValue_PointValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PropertyValue_PointValue.Marshal(b, m, deterministic) -} -func (dst *PropertyValue_PointValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_PropertyValue_PointValue.Merge(dst, src) -} -func (m *PropertyValue_PointValue) XXX_Size() int { - return xxx_messageInfo_PropertyValue_PointValue.Size(m) -} -func (m *PropertyValue_PointValue) XXX_DiscardUnknown() { - xxx_messageInfo_PropertyValue_PointValue.DiscardUnknown(m) -} - -var xxx_messageInfo_PropertyValue_PointValue proto.InternalMessageInfo - -func (m *PropertyValue_PointValue) GetX() float64 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - -func (m *PropertyValue_PointValue) GetY() float64 { - if m != nil && m.Y != nil { - return *m.Y - } - return 0 -} - -type PropertyValue_UserValue struct { - Email *string `protobuf:"bytes,9,req,name=email" json:"email,omitempty"` - AuthDomain *string `protobuf:"bytes,10,req,name=auth_domain,json=authDomain" json:"auth_domain,omitempty"` - Nickname *string `protobuf:"bytes,11,opt,name=nickname" json:"nickname,omitempty"` - FederatedIdentity *string `protobuf:"bytes,21,opt,name=federated_identity,json=federatedIdentity" json:"federated_identity,omitempty"` - FederatedProvider *string `protobuf:"bytes,22,opt,name=federated_provider,json=federatedProvider" json:"federated_provider,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PropertyValue_UserValue) Reset() { *m = PropertyValue_UserValue{} } -func (m *PropertyValue_UserValue) String() string { return proto.CompactTextString(m) } -func (*PropertyValue_UserValue) ProtoMessage() {} -func (*PropertyValue_UserValue) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1, 1} -} -func (m *PropertyValue_UserValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PropertyValue_UserValue.Unmarshal(m, b) -} -func (m *PropertyValue_UserValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PropertyValue_UserValue.Marshal(b, m, deterministic) -} -func (dst *PropertyValue_UserValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_PropertyValue_UserValue.Merge(dst, src) -} -func (m *PropertyValue_UserValue) XXX_Size() int { - return xxx_messageInfo_PropertyValue_UserValue.Size(m) -} -func (m *PropertyValue_UserValue) XXX_DiscardUnknown() { - xxx_messageInfo_PropertyValue_UserValue.DiscardUnknown(m) -} - -var xxx_messageInfo_PropertyValue_UserValue proto.InternalMessageInfo - -func (m *PropertyValue_UserValue) GetEmail() string { - if m != nil && m.Email != nil { - return *m.Email - } - return "" -} - -func (m *PropertyValue_UserValue) GetAuthDomain() string { - if m != nil && m.AuthDomain != nil { - return *m.AuthDomain - } - return "" -} - -func (m *PropertyValue_UserValue) GetNickname() string { - if m != nil && m.Nickname != nil { - return *m.Nickname - } - return "" -} - -func (m *PropertyValue_UserValue) GetFederatedIdentity() string { - if m != nil && m.FederatedIdentity != nil { - return *m.FederatedIdentity - } - return "" -} - -func (m *PropertyValue_UserValue) GetFederatedProvider() string { - if m != nil && m.FederatedProvider != nil { - return *m.FederatedProvider - } - return "" -} - -type PropertyValue_ReferenceValue struct { - App *string `protobuf:"bytes,13,req,name=app" json:"app,omitempty"` - NameSpace *string `protobuf:"bytes,20,opt,name=name_space,json=nameSpace" json:"name_space,omitempty"` - Pathelement []*PropertyValue_ReferenceValue_PathElement `protobuf:"group,14,rep,name=PathElement,json=pathelement" json:"pathelement,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PropertyValue_ReferenceValue) Reset() { *m = PropertyValue_ReferenceValue{} } -func (m *PropertyValue_ReferenceValue) String() string { return proto.CompactTextString(m) } -func (*PropertyValue_ReferenceValue) ProtoMessage() {} -func (*PropertyValue_ReferenceValue) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1, 2} -} -func (m *PropertyValue_ReferenceValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PropertyValue_ReferenceValue.Unmarshal(m, b) -} -func (m *PropertyValue_ReferenceValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PropertyValue_ReferenceValue.Marshal(b, m, deterministic) -} -func (dst *PropertyValue_ReferenceValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_PropertyValue_ReferenceValue.Merge(dst, src) -} -func (m *PropertyValue_ReferenceValue) XXX_Size() int { - return xxx_messageInfo_PropertyValue_ReferenceValue.Size(m) -} -func (m *PropertyValue_ReferenceValue) XXX_DiscardUnknown() { - xxx_messageInfo_PropertyValue_ReferenceValue.DiscardUnknown(m) -} - -var xxx_messageInfo_PropertyValue_ReferenceValue proto.InternalMessageInfo - -func (m *PropertyValue_ReferenceValue) GetApp() string { - if m != nil && m.App != nil { - return *m.App - } - return "" -} - -func (m *PropertyValue_ReferenceValue) GetNameSpace() string { - if m != nil && m.NameSpace != nil { - return *m.NameSpace - } - return "" -} - -func (m *PropertyValue_ReferenceValue) GetPathelement() []*PropertyValue_ReferenceValue_PathElement { - if m != nil { - return m.Pathelement - } - return nil -} - -type PropertyValue_ReferenceValue_PathElement struct { - Type *string `protobuf:"bytes,15,req,name=type" json:"type,omitempty"` - Id *int64 `protobuf:"varint,16,opt,name=id" json:"id,omitempty"` - Name *string `protobuf:"bytes,17,opt,name=name" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PropertyValue_ReferenceValue_PathElement) Reset() { - *m = PropertyValue_ReferenceValue_PathElement{} -} -func (m *PropertyValue_ReferenceValue_PathElement) String() string { return proto.CompactTextString(m) } -func (*PropertyValue_ReferenceValue_PathElement) ProtoMessage() {} -func (*PropertyValue_ReferenceValue_PathElement) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1, 2, 0} -} -func (m *PropertyValue_ReferenceValue_PathElement) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.Unmarshal(m, b) -} -func (m *PropertyValue_ReferenceValue_PathElement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.Marshal(b, m, deterministic) -} -func (dst *PropertyValue_ReferenceValue_PathElement) XXX_Merge(src proto.Message) { - xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.Merge(dst, src) -} -func (m *PropertyValue_ReferenceValue_PathElement) XXX_Size() int { - return xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.Size(m) -} -func (m *PropertyValue_ReferenceValue_PathElement) XXX_DiscardUnknown() { - xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.DiscardUnknown(m) -} - -var xxx_messageInfo_PropertyValue_ReferenceValue_PathElement proto.InternalMessageInfo - -func (m *PropertyValue_ReferenceValue_PathElement) GetType() string { - if m != nil && m.Type != nil { - return *m.Type - } - return "" -} - -func (m *PropertyValue_ReferenceValue_PathElement) GetId() int64 { - if m != nil && m.Id != nil { - return *m.Id - } - return 0 -} - -func (m *PropertyValue_ReferenceValue_PathElement) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -type Property struct { - Meaning *Property_Meaning `protobuf:"varint,1,opt,name=meaning,enum=appengine.Property_Meaning,def=0" json:"meaning,omitempty"` - MeaningUri *string `protobuf:"bytes,2,opt,name=meaning_uri,json=meaningUri" json:"meaning_uri,omitempty"` - Name *string `protobuf:"bytes,3,req,name=name" json:"name,omitempty"` - Value *PropertyValue `protobuf:"bytes,5,req,name=value" json:"value,omitempty"` - Multiple *bool `protobuf:"varint,4,req,name=multiple" json:"multiple,omitempty"` - Searchable *bool `protobuf:"varint,6,opt,name=searchable,def=0" json:"searchable,omitempty"` - FtsTokenizationOption *Property_FtsTokenizationOption `protobuf:"varint,8,opt,name=fts_tokenization_option,json=ftsTokenizationOption,enum=appengine.Property_FtsTokenizationOption" json:"fts_tokenization_option,omitempty"` - Locale *string `protobuf:"bytes,9,opt,name=locale,def=en" json:"locale,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Property) Reset() { *m = Property{} } -func (m *Property) String() string { return proto.CompactTextString(m) } -func (*Property) ProtoMessage() {} -func (*Property) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{2} -} -func (m *Property) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Property.Unmarshal(m, b) -} -func (m *Property) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Property.Marshal(b, m, deterministic) -} -func (dst *Property) XXX_Merge(src proto.Message) { - xxx_messageInfo_Property.Merge(dst, src) -} -func (m *Property) XXX_Size() int { - return xxx_messageInfo_Property.Size(m) -} -func (m *Property) XXX_DiscardUnknown() { - xxx_messageInfo_Property.DiscardUnknown(m) -} - -var xxx_messageInfo_Property proto.InternalMessageInfo - -const Default_Property_Meaning Property_Meaning = Property_NO_MEANING -const Default_Property_Searchable bool = false -const Default_Property_Locale string = "en" - -func (m *Property) GetMeaning() Property_Meaning { - if m != nil && m.Meaning != nil { - return *m.Meaning - } - return Default_Property_Meaning -} - -func (m *Property) GetMeaningUri() string { - if m != nil && m.MeaningUri != nil { - return *m.MeaningUri - } - return "" -} - -func (m *Property) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *Property) GetValue() *PropertyValue { - if m != nil { - return m.Value - } - return nil -} - -func (m *Property) GetMultiple() bool { - if m != nil && m.Multiple != nil { - return *m.Multiple - } - return false -} - -func (m *Property) GetSearchable() bool { - if m != nil && m.Searchable != nil { - return *m.Searchable - } - return Default_Property_Searchable -} - -func (m *Property) GetFtsTokenizationOption() Property_FtsTokenizationOption { - if m != nil && m.FtsTokenizationOption != nil { - return *m.FtsTokenizationOption - } - return Property_HTML -} - -func (m *Property) GetLocale() string { - if m != nil && m.Locale != nil { - return *m.Locale - } - return Default_Property_Locale -} - -type Path struct { - Element []*Path_Element `protobuf:"group,1,rep,name=Element,json=element" json:"element,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Path) Reset() { *m = Path{} } -func (m *Path) String() string { return proto.CompactTextString(m) } -func (*Path) ProtoMessage() {} -func (*Path) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{3} -} -func (m *Path) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Path.Unmarshal(m, b) -} -func (m *Path) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Path.Marshal(b, m, deterministic) -} -func (dst *Path) XXX_Merge(src proto.Message) { - xxx_messageInfo_Path.Merge(dst, src) -} -func (m *Path) XXX_Size() int { - return xxx_messageInfo_Path.Size(m) -} -func (m *Path) XXX_DiscardUnknown() { - xxx_messageInfo_Path.DiscardUnknown(m) -} - -var xxx_messageInfo_Path proto.InternalMessageInfo - -func (m *Path) GetElement() []*Path_Element { - if m != nil { - return m.Element - } - return nil -} - -type Path_Element struct { - Type *string `protobuf:"bytes,2,req,name=type" json:"type,omitempty"` - Id *int64 `protobuf:"varint,3,opt,name=id" json:"id,omitempty"` - Name *string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Path_Element) Reset() { *m = Path_Element{} } -func (m *Path_Element) String() string { return proto.CompactTextString(m) } -func (*Path_Element) ProtoMessage() {} -func (*Path_Element) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{3, 0} -} -func (m *Path_Element) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Path_Element.Unmarshal(m, b) -} -func (m *Path_Element) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Path_Element.Marshal(b, m, deterministic) -} -func (dst *Path_Element) XXX_Merge(src proto.Message) { - xxx_messageInfo_Path_Element.Merge(dst, src) -} -func (m *Path_Element) XXX_Size() int { - return xxx_messageInfo_Path_Element.Size(m) -} -func (m *Path_Element) XXX_DiscardUnknown() { - xxx_messageInfo_Path_Element.DiscardUnknown(m) -} - -var xxx_messageInfo_Path_Element proto.InternalMessageInfo - -func (m *Path_Element) GetType() string { - if m != nil && m.Type != nil { - return *m.Type - } - return "" -} - -func (m *Path_Element) GetId() int64 { - if m != nil && m.Id != nil { - return *m.Id - } - return 0 -} - -func (m *Path_Element) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -type Reference struct { - App *string `protobuf:"bytes,13,req,name=app" json:"app,omitempty"` - NameSpace *string `protobuf:"bytes,20,opt,name=name_space,json=nameSpace" json:"name_space,omitempty"` - Path *Path `protobuf:"bytes,14,req,name=path" json:"path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Reference) Reset() { *m = Reference{} } -func (m *Reference) String() string { return proto.CompactTextString(m) } -func (*Reference) ProtoMessage() {} -func (*Reference) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{4} -} -func (m *Reference) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Reference.Unmarshal(m, b) -} -func (m *Reference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Reference.Marshal(b, m, deterministic) -} -func (dst *Reference) XXX_Merge(src proto.Message) { - xxx_messageInfo_Reference.Merge(dst, src) -} -func (m *Reference) XXX_Size() int { - return xxx_messageInfo_Reference.Size(m) -} -func (m *Reference) XXX_DiscardUnknown() { - xxx_messageInfo_Reference.DiscardUnknown(m) -} - -var xxx_messageInfo_Reference proto.InternalMessageInfo - -func (m *Reference) GetApp() string { - if m != nil && m.App != nil { - return *m.App - } - return "" -} - -func (m *Reference) GetNameSpace() string { - if m != nil && m.NameSpace != nil { - return *m.NameSpace - } - return "" -} - -func (m *Reference) GetPath() *Path { - if m != nil { - return m.Path - } - return nil -} - -type User struct { - Email *string `protobuf:"bytes,1,req,name=email" json:"email,omitempty"` - AuthDomain *string `protobuf:"bytes,2,req,name=auth_domain,json=authDomain" json:"auth_domain,omitempty"` - Nickname *string `protobuf:"bytes,3,opt,name=nickname" json:"nickname,omitempty"` - FederatedIdentity *string `protobuf:"bytes,6,opt,name=federated_identity,json=federatedIdentity" json:"federated_identity,omitempty"` - FederatedProvider *string `protobuf:"bytes,7,opt,name=federated_provider,json=federatedProvider" json:"federated_provider,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *User) Reset() { *m = User{} } -func (m *User) String() string { return proto.CompactTextString(m) } -func (*User) ProtoMessage() {} -func (*User) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{5} -} -func (m *User) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_User.Unmarshal(m, b) -} -func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_User.Marshal(b, m, deterministic) -} -func (dst *User) XXX_Merge(src proto.Message) { - xxx_messageInfo_User.Merge(dst, src) -} -func (m *User) XXX_Size() int { - return xxx_messageInfo_User.Size(m) -} -func (m *User) XXX_DiscardUnknown() { - xxx_messageInfo_User.DiscardUnknown(m) -} - -var xxx_messageInfo_User proto.InternalMessageInfo - -func (m *User) GetEmail() string { - if m != nil && m.Email != nil { - return *m.Email - } - return "" -} - -func (m *User) GetAuthDomain() string { - if m != nil && m.AuthDomain != nil { - return *m.AuthDomain - } - return "" -} - -func (m *User) GetNickname() string { - if m != nil && m.Nickname != nil { - return *m.Nickname - } - return "" -} - -func (m *User) GetFederatedIdentity() string { - if m != nil && m.FederatedIdentity != nil { - return *m.FederatedIdentity - } - return "" -} - -func (m *User) GetFederatedProvider() string { - if m != nil && m.FederatedProvider != nil { - return *m.FederatedProvider - } - return "" -} - -type EntityProto struct { - Key *Reference `protobuf:"bytes,13,req,name=key" json:"key,omitempty"` - EntityGroup *Path `protobuf:"bytes,16,req,name=entity_group,json=entityGroup" json:"entity_group,omitempty"` - Owner *User `protobuf:"bytes,17,opt,name=owner" json:"owner,omitempty"` - Kind *EntityProto_Kind `protobuf:"varint,4,opt,name=kind,enum=appengine.EntityProto_Kind" json:"kind,omitempty"` - KindUri *string `protobuf:"bytes,5,opt,name=kind_uri,json=kindUri" json:"kind_uri,omitempty"` - Property []*Property `protobuf:"bytes,14,rep,name=property" json:"property,omitempty"` - RawProperty []*Property `protobuf:"bytes,15,rep,name=raw_property,json=rawProperty" json:"raw_property,omitempty"` - Rank *int32 `protobuf:"varint,18,opt,name=rank" json:"rank,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EntityProto) Reset() { *m = EntityProto{} } -func (m *EntityProto) String() string { return proto.CompactTextString(m) } -func (*EntityProto) ProtoMessage() {} -func (*EntityProto) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{6} -} -func (m *EntityProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EntityProto.Unmarshal(m, b) -} -func (m *EntityProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EntityProto.Marshal(b, m, deterministic) -} -func (dst *EntityProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_EntityProto.Merge(dst, src) -} -func (m *EntityProto) XXX_Size() int { - return xxx_messageInfo_EntityProto.Size(m) -} -func (m *EntityProto) XXX_DiscardUnknown() { - xxx_messageInfo_EntityProto.DiscardUnknown(m) -} - -var xxx_messageInfo_EntityProto proto.InternalMessageInfo - -func (m *EntityProto) GetKey() *Reference { - if m != nil { - return m.Key - } - return nil -} - -func (m *EntityProto) GetEntityGroup() *Path { - if m != nil { - return m.EntityGroup - } - return nil -} - -func (m *EntityProto) GetOwner() *User { - if m != nil { - return m.Owner - } - return nil -} - -func (m *EntityProto) GetKind() EntityProto_Kind { - if m != nil && m.Kind != nil { - return *m.Kind - } - return EntityProto_GD_CONTACT -} - -func (m *EntityProto) GetKindUri() string { - if m != nil && m.KindUri != nil { - return *m.KindUri - } - return "" -} - -func (m *EntityProto) GetProperty() []*Property { - if m != nil { - return m.Property - } - return nil -} - -func (m *EntityProto) GetRawProperty() []*Property { - if m != nil { - return m.RawProperty - } - return nil -} - -func (m *EntityProto) GetRank() int32 { - if m != nil && m.Rank != nil { - return *m.Rank - } - return 0 -} - -type CompositeProperty struct { - IndexId *int64 `protobuf:"varint,1,req,name=index_id,json=indexId" json:"index_id,omitempty"` - Value []string `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompositeProperty) Reset() { *m = CompositeProperty{} } -func (m *CompositeProperty) String() string { return proto.CompactTextString(m) } -func (*CompositeProperty) ProtoMessage() {} -func (*CompositeProperty) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{7} -} -func (m *CompositeProperty) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompositeProperty.Unmarshal(m, b) -} -func (m *CompositeProperty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompositeProperty.Marshal(b, m, deterministic) -} -func (dst *CompositeProperty) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompositeProperty.Merge(dst, src) -} -func (m *CompositeProperty) XXX_Size() int { - return xxx_messageInfo_CompositeProperty.Size(m) -} -func (m *CompositeProperty) XXX_DiscardUnknown() { - xxx_messageInfo_CompositeProperty.DiscardUnknown(m) -} - -var xxx_messageInfo_CompositeProperty proto.InternalMessageInfo - -func (m *CompositeProperty) GetIndexId() int64 { - if m != nil && m.IndexId != nil { - return *m.IndexId - } - return 0 -} - -func (m *CompositeProperty) GetValue() []string { - if m != nil { - return m.Value - } - return nil -} - -type Index struct { - EntityType *string `protobuf:"bytes,1,req,name=entity_type,json=entityType" json:"entity_type,omitempty"` - Ancestor *bool `protobuf:"varint,5,req,name=ancestor" json:"ancestor,omitempty"` - Property []*Index_Property `protobuf:"group,2,rep,name=Property,json=property" json:"property,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Index) Reset() { *m = Index{} } -func (m *Index) String() string { return proto.CompactTextString(m) } -func (*Index) ProtoMessage() {} -func (*Index) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{8} -} -func (m *Index) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Index.Unmarshal(m, b) -} -func (m *Index) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Index.Marshal(b, m, deterministic) -} -func (dst *Index) XXX_Merge(src proto.Message) { - xxx_messageInfo_Index.Merge(dst, src) -} -func (m *Index) XXX_Size() int { - return xxx_messageInfo_Index.Size(m) -} -func (m *Index) XXX_DiscardUnknown() { - xxx_messageInfo_Index.DiscardUnknown(m) -} - -var xxx_messageInfo_Index proto.InternalMessageInfo - -func (m *Index) GetEntityType() string { - if m != nil && m.EntityType != nil { - return *m.EntityType - } - return "" -} - -func (m *Index) GetAncestor() bool { - if m != nil && m.Ancestor != nil { - return *m.Ancestor - } - return false -} - -func (m *Index) GetProperty() []*Index_Property { - if m != nil { - return m.Property - } - return nil -} - -type Index_Property struct { - Name *string `protobuf:"bytes,3,req,name=name" json:"name,omitempty"` - Direction *Index_Property_Direction `protobuf:"varint,4,opt,name=direction,enum=appengine.Index_Property_Direction,def=1" json:"direction,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Index_Property) Reset() { *m = Index_Property{} } -func (m *Index_Property) String() string { return proto.CompactTextString(m) } -func (*Index_Property) ProtoMessage() {} -func (*Index_Property) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{8, 0} -} -func (m *Index_Property) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Index_Property.Unmarshal(m, b) -} -func (m *Index_Property) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Index_Property.Marshal(b, m, deterministic) -} -func (dst *Index_Property) XXX_Merge(src proto.Message) { - xxx_messageInfo_Index_Property.Merge(dst, src) -} -func (m *Index_Property) XXX_Size() int { - return xxx_messageInfo_Index_Property.Size(m) -} -func (m *Index_Property) XXX_DiscardUnknown() { - xxx_messageInfo_Index_Property.DiscardUnknown(m) -} - -var xxx_messageInfo_Index_Property proto.InternalMessageInfo - -const Default_Index_Property_Direction Index_Property_Direction = Index_Property_ASCENDING - -func (m *Index_Property) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *Index_Property) GetDirection() Index_Property_Direction { - if m != nil && m.Direction != nil { - return *m.Direction - } - return Default_Index_Property_Direction -} - -type CompositeIndex struct { - AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` - Id *int64 `protobuf:"varint,2,req,name=id" json:"id,omitempty"` - Definition *Index `protobuf:"bytes,3,req,name=definition" json:"definition,omitempty"` - State *CompositeIndex_State `protobuf:"varint,4,req,name=state,enum=appengine.CompositeIndex_State" json:"state,omitempty"` - OnlyUseIfRequired *bool `protobuf:"varint,6,opt,name=only_use_if_required,json=onlyUseIfRequired,def=0" json:"only_use_if_required,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompositeIndex) Reset() { *m = CompositeIndex{} } -func (m *CompositeIndex) String() string { return proto.CompactTextString(m) } -func (*CompositeIndex) ProtoMessage() {} -func (*CompositeIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{9} -} -func (m *CompositeIndex) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompositeIndex.Unmarshal(m, b) -} -func (m *CompositeIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompositeIndex.Marshal(b, m, deterministic) -} -func (dst *CompositeIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompositeIndex.Merge(dst, src) -} -func (m *CompositeIndex) XXX_Size() int { - return xxx_messageInfo_CompositeIndex.Size(m) -} -func (m *CompositeIndex) XXX_DiscardUnknown() { - xxx_messageInfo_CompositeIndex.DiscardUnknown(m) -} - -var xxx_messageInfo_CompositeIndex proto.InternalMessageInfo - -const Default_CompositeIndex_OnlyUseIfRequired bool = false - -func (m *CompositeIndex) GetAppId() string { - if m != nil && m.AppId != nil { - return *m.AppId - } - return "" -} - -func (m *CompositeIndex) GetId() int64 { - if m != nil && m.Id != nil { - return *m.Id - } - return 0 -} - -func (m *CompositeIndex) GetDefinition() *Index { - if m != nil { - return m.Definition - } - return nil -} - -func (m *CompositeIndex) GetState() CompositeIndex_State { - if m != nil && m.State != nil { - return *m.State - } - return CompositeIndex_WRITE_ONLY -} - -func (m *CompositeIndex) GetOnlyUseIfRequired() bool { - if m != nil && m.OnlyUseIfRequired != nil { - return *m.OnlyUseIfRequired - } - return Default_CompositeIndex_OnlyUseIfRequired -} - -type IndexPostfix struct { - IndexValue []*IndexPostfix_IndexValue `protobuf:"bytes,1,rep,name=index_value,json=indexValue" json:"index_value,omitempty"` - Key *Reference `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` - Before *bool `protobuf:"varint,3,opt,name=before,def=1" json:"before,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IndexPostfix) Reset() { *m = IndexPostfix{} } -func (m *IndexPostfix) String() string { return proto.CompactTextString(m) } -func (*IndexPostfix) ProtoMessage() {} -func (*IndexPostfix) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{10} -} -func (m *IndexPostfix) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IndexPostfix.Unmarshal(m, b) -} -func (m *IndexPostfix) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IndexPostfix.Marshal(b, m, deterministic) -} -func (dst *IndexPostfix) XXX_Merge(src proto.Message) { - xxx_messageInfo_IndexPostfix.Merge(dst, src) -} -func (m *IndexPostfix) XXX_Size() int { - return xxx_messageInfo_IndexPostfix.Size(m) -} -func (m *IndexPostfix) XXX_DiscardUnknown() { - xxx_messageInfo_IndexPostfix.DiscardUnknown(m) -} - -var xxx_messageInfo_IndexPostfix proto.InternalMessageInfo - -const Default_IndexPostfix_Before bool = true - -func (m *IndexPostfix) GetIndexValue() []*IndexPostfix_IndexValue { - if m != nil { - return m.IndexValue - } - return nil -} - -func (m *IndexPostfix) GetKey() *Reference { - if m != nil { - return m.Key - } - return nil -} - -func (m *IndexPostfix) GetBefore() bool { - if m != nil && m.Before != nil { - return *m.Before - } - return Default_IndexPostfix_Before -} - -type IndexPostfix_IndexValue struct { - PropertyName *string `protobuf:"bytes,1,req,name=property_name,json=propertyName" json:"property_name,omitempty"` - Value *PropertyValue `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IndexPostfix_IndexValue) Reset() { *m = IndexPostfix_IndexValue{} } -func (m *IndexPostfix_IndexValue) String() string { return proto.CompactTextString(m) } -func (*IndexPostfix_IndexValue) ProtoMessage() {} -func (*IndexPostfix_IndexValue) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{10, 0} -} -func (m *IndexPostfix_IndexValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IndexPostfix_IndexValue.Unmarshal(m, b) -} -func (m *IndexPostfix_IndexValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IndexPostfix_IndexValue.Marshal(b, m, deterministic) -} -func (dst *IndexPostfix_IndexValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_IndexPostfix_IndexValue.Merge(dst, src) -} -func (m *IndexPostfix_IndexValue) XXX_Size() int { - return xxx_messageInfo_IndexPostfix_IndexValue.Size(m) -} -func (m *IndexPostfix_IndexValue) XXX_DiscardUnknown() { - xxx_messageInfo_IndexPostfix_IndexValue.DiscardUnknown(m) -} - -var xxx_messageInfo_IndexPostfix_IndexValue proto.InternalMessageInfo - -func (m *IndexPostfix_IndexValue) GetPropertyName() string { - if m != nil && m.PropertyName != nil { - return *m.PropertyName - } - return "" -} - -func (m *IndexPostfix_IndexValue) GetValue() *PropertyValue { - if m != nil { - return m.Value - } - return nil -} - -type IndexPosition struct { - Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` - Before *bool `protobuf:"varint,2,opt,name=before,def=1" json:"before,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IndexPosition) Reset() { *m = IndexPosition{} } -func (m *IndexPosition) String() string { return proto.CompactTextString(m) } -func (*IndexPosition) ProtoMessage() {} -func (*IndexPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{11} -} -func (m *IndexPosition) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IndexPosition.Unmarshal(m, b) -} -func (m *IndexPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IndexPosition.Marshal(b, m, deterministic) -} -func (dst *IndexPosition) XXX_Merge(src proto.Message) { - xxx_messageInfo_IndexPosition.Merge(dst, src) -} -func (m *IndexPosition) XXX_Size() int { - return xxx_messageInfo_IndexPosition.Size(m) -} -func (m *IndexPosition) XXX_DiscardUnknown() { - xxx_messageInfo_IndexPosition.DiscardUnknown(m) -} - -var xxx_messageInfo_IndexPosition proto.InternalMessageInfo - -const Default_IndexPosition_Before bool = true - -func (m *IndexPosition) GetKey() string { - if m != nil && m.Key != nil { - return *m.Key - } - return "" -} - -func (m *IndexPosition) GetBefore() bool { - if m != nil && m.Before != nil { - return *m.Before - } - return Default_IndexPosition_Before -} - -type Snapshot struct { - Ts *int64 `protobuf:"varint,1,req,name=ts" json:"ts,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Snapshot) Reset() { *m = Snapshot{} } -func (m *Snapshot) String() string { return proto.CompactTextString(m) } -func (*Snapshot) ProtoMessage() {} -func (*Snapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{12} -} -func (m *Snapshot) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Snapshot.Unmarshal(m, b) -} -func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic) -} -func (dst *Snapshot) XXX_Merge(src proto.Message) { - xxx_messageInfo_Snapshot.Merge(dst, src) -} -func (m *Snapshot) XXX_Size() int { - return xxx_messageInfo_Snapshot.Size(m) -} -func (m *Snapshot) XXX_DiscardUnknown() { - xxx_messageInfo_Snapshot.DiscardUnknown(m) -} - -var xxx_messageInfo_Snapshot proto.InternalMessageInfo - -func (m *Snapshot) GetTs() int64 { - if m != nil && m.Ts != nil { - return *m.Ts - } - return 0 -} - -type InternalHeader struct { - Qos *string `protobuf:"bytes,1,opt,name=qos" json:"qos,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *InternalHeader) Reset() { *m = InternalHeader{} } -func (m *InternalHeader) String() string { return proto.CompactTextString(m) } -func (*InternalHeader) ProtoMessage() {} -func (*InternalHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{13} -} -func (m *InternalHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_InternalHeader.Unmarshal(m, b) -} -func (m *InternalHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_InternalHeader.Marshal(b, m, deterministic) -} -func (dst *InternalHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_InternalHeader.Merge(dst, src) -} -func (m *InternalHeader) XXX_Size() int { - return xxx_messageInfo_InternalHeader.Size(m) -} -func (m *InternalHeader) XXX_DiscardUnknown() { - xxx_messageInfo_InternalHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_InternalHeader proto.InternalMessageInfo - -func (m *InternalHeader) GetQos() string { - if m != nil && m.Qos != nil { - return *m.Qos - } - return "" -} - -type Transaction struct { - Header *InternalHeader `protobuf:"bytes,4,opt,name=header" json:"header,omitempty"` - Handle *uint64 `protobuf:"fixed64,1,req,name=handle" json:"handle,omitempty"` - App *string `protobuf:"bytes,2,req,name=app" json:"app,omitempty"` - MarkChanges *bool `protobuf:"varint,3,opt,name=mark_changes,json=markChanges,def=0" json:"mark_changes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Transaction) Reset() { *m = Transaction{} } -func (m *Transaction) String() string { return proto.CompactTextString(m) } -func (*Transaction) ProtoMessage() {} -func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{14} -} -func (m *Transaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Transaction.Unmarshal(m, b) -} -func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) -} -func (dst *Transaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_Transaction.Merge(dst, src) -} -func (m *Transaction) XXX_Size() int { - return xxx_messageInfo_Transaction.Size(m) -} -func (m *Transaction) XXX_DiscardUnknown() { - xxx_messageInfo_Transaction.DiscardUnknown(m) -} - -var xxx_messageInfo_Transaction proto.InternalMessageInfo - -const Default_Transaction_MarkChanges bool = false - -func (m *Transaction) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *Transaction) GetHandle() uint64 { - if m != nil && m.Handle != nil { - return *m.Handle - } - return 0 -} - -func (m *Transaction) GetApp() string { - if m != nil && m.App != nil { - return *m.App - } - return "" -} - -func (m *Transaction) GetMarkChanges() bool { - if m != nil && m.MarkChanges != nil { - return *m.MarkChanges - } - return Default_Transaction_MarkChanges -} - -type Query struct { - Header *InternalHeader `protobuf:"bytes,39,opt,name=header" json:"header,omitempty"` - App *string `protobuf:"bytes,1,req,name=app" json:"app,omitempty"` - NameSpace *string `protobuf:"bytes,29,opt,name=name_space,json=nameSpace" json:"name_space,omitempty"` - Kind *string `protobuf:"bytes,3,opt,name=kind" json:"kind,omitempty"` - Ancestor *Reference `protobuf:"bytes,17,opt,name=ancestor" json:"ancestor,omitempty"` - Filter []*Query_Filter `protobuf:"group,4,rep,name=Filter,json=filter" json:"filter,omitempty"` - SearchQuery *string `protobuf:"bytes,8,opt,name=search_query,json=searchQuery" json:"search_query,omitempty"` - Order []*Query_Order `protobuf:"group,9,rep,name=Order,json=order" json:"order,omitempty"` - Hint *Query_Hint `protobuf:"varint,18,opt,name=hint,enum=appengine.Query_Hint" json:"hint,omitempty"` - Count *int32 `protobuf:"varint,23,opt,name=count" json:"count,omitempty"` - Offset *int32 `protobuf:"varint,12,opt,name=offset,def=0" json:"offset,omitempty"` - Limit *int32 `protobuf:"varint,16,opt,name=limit" json:"limit,omitempty"` - CompiledCursor *CompiledCursor `protobuf:"bytes,30,opt,name=compiled_cursor,json=compiledCursor" json:"compiled_cursor,omitempty"` - EndCompiledCursor *CompiledCursor `protobuf:"bytes,31,opt,name=end_compiled_cursor,json=endCompiledCursor" json:"end_compiled_cursor,omitempty"` - CompositeIndex []*CompositeIndex `protobuf:"bytes,19,rep,name=composite_index,json=compositeIndex" json:"composite_index,omitempty"` - RequirePerfectPlan *bool `protobuf:"varint,20,opt,name=require_perfect_plan,json=requirePerfectPlan,def=0" json:"require_perfect_plan,omitempty"` - KeysOnly *bool `protobuf:"varint,21,opt,name=keys_only,json=keysOnly,def=0" json:"keys_only,omitempty"` - Transaction *Transaction `protobuf:"bytes,22,opt,name=transaction" json:"transaction,omitempty"` - Compile *bool `protobuf:"varint,25,opt,name=compile,def=0" json:"compile,omitempty"` - FailoverMs *int64 `protobuf:"varint,26,opt,name=failover_ms,json=failoverMs" json:"failover_ms,omitempty"` - Strong *bool `protobuf:"varint,32,opt,name=strong" json:"strong,omitempty"` - PropertyName []string `protobuf:"bytes,33,rep,name=property_name,json=propertyName" json:"property_name,omitempty"` - GroupByPropertyName []string `protobuf:"bytes,34,rep,name=group_by_property_name,json=groupByPropertyName" json:"group_by_property_name,omitempty"` - Distinct *bool `protobuf:"varint,24,opt,name=distinct" json:"distinct,omitempty"` - MinSafeTimeSeconds *int64 `protobuf:"varint,35,opt,name=min_safe_time_seconds,json=minSafeTimeSeconds" json:"min_safe_time_seconds,omitempty"` - SafeReplicaName []string `protobuf:"bytes,36,rep,name=safe_replica_name,json=safeReplicaName" json:"safe_replica_name,omitempty"` - PersistOffset *bool `protobuf:"varint,37,opt,name=persist_offset,json=persistOffset,def=0" json:"persist_offset,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Query) Reset() { *m = Query{} } -func (m *Query) String() string { return proto.CompactTextString(m) } -func (*Query) ProtoMessage() {} -func (*Query) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15} -} -func (m *Query) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Query.Unmarshal(m, b) -} -func (m *Query) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Query.Marshal(b, m, deterministic) -} -func (dst *Query) XXX_Merge(src proto.Message) { - xxx_messageInfo_Query.Merge(dst, src) -} -func (m *Query) XXX_Size() int { - return xxx_messageInfo_Query.Size(m) -} -func (m *Query) XXX_DiscardUnknown() { - xxx_messageInfo_Query.DiscardUnknown(m) -} - -var xxx_messageInfo_Query proto.InternalMessageInfo - -const Default_Query_Offset int32 = 0 -const Default_Query_RequirePerfectPlan bool = false -const Default_Query_KeysOnly bool = false -const Default_Query_Compile bool = false -const Default_Query_PersistOffset bool = false - -func (m *Query) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *Query) GetApp() string { - if m != nil && m.App != nil { - return *m.App - } - return "" -} - -func (m *Query) GetNameSpace() string { - if m != nil && m.NameSpace != nil { - return *m.NameSpace - } - return "" -} - -func (m *Query) GetKind() string { - if m != nil && m.Kind != nil { - return *m.Kind - } - return "" -} - -func (m *Query) GetAncestor() *Reference { - if m != nil { - return m.Ancestor - } - return nil -} - -func (m *Query) GetFilter() []*Query_Filter { - if m != nil { - return m.Filter - } - return nil -} - -func (m *Query) GetSearchQuery() string { - if m != nil && m.SearchQuery != nil { - return *m.SearchQuery - } - return "" -} - -func (m *Query) GetOrder() []*Query_Order { - if m != nil { - return m.Order - } - return nil -} - -func (m *Query) GetHint() Query_Hint { - if m != nil && m.Hint != nil { - return *m.Hint - } - return Query_ORDER_FIRST -} - -func (m *Query) GetCount() int32 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -func (m *Query) GetOffset() int32 { - if m != nil && m.Offset != nil { - return *m.Offset - } - return Default_Query_Offset -} - -func (m *Query) GetLimit() int32 { - if m != nil && m.Limit != nil { - return *m.Limit - } - return 0 -} - -func (m *Query) GetCompiledCursor() *CompiledCursor { - if m != nil { - return m.CompiledCursor - } - return nil -} - -func (m *Query) GetEndCompiledCursor() *CompiledCursor { - if m != nil { - return m.EndCompiledCursor - } - return nil -} - -func (m *Query) GetCompositeIndex() []*CompositeIndex { - if m != nil { - return m.CompositeIndex - } - return nil -} - -func (m *Query) GetRequirePerfectPlan() bool { - if m != nil && m.RequirePerfectPlan != nil { - return *m.RequirePerfectPlan - } - return Default_Query_RequirePerfectPlan -} - -func (m *Query) GetKeysOnly() bool { - if m != nil && m.KeysOnly != nil { - return *m.KeysOnly - } - return Default_Query_KeysOnly -} - -func (m *Query) GetTransaction() *Transaction { - if m != nil { - return m.Transaction - } - return nil -} - -func (m *Query) GetCompile() bool { - if m != nil && m.Compile != nil { - return *m.Compile - } - return Default_Query_Compile -} - -func (m *Query) GetFailoverMs() int64 { - if m != nil && m.FailoverMs != nil { - return *m.FailoverMs - } - return 0 -} - -func (m *Query) GetStrong() bool { - if m != nil && m.Strong != nil { - return *m.Strong - } - return false -} - -func (m *Query) GetPropertyName() []string { - if m != nil { - return m.PropertyName - } - return nil -} - -func (m *Query) GetGroupByPropertyName() []string { - if m != nil { - return m.GroupByPropertyName - } - return nil -} - -func (m *Query) GetDistinct() bool { - if m != nil && m.Distinct != nil { - return *m.Distinct - } - return false -} - -func (m *Query) GetMinSafeTimeSeconds() int64 { - if m != nil && m.MinSafeTimeSeconds != nil { - return *m.MinSafeTimeSeconds - } - return 0 -} - -func (m *Query) GetSafeReplicaName() []string { - if m != nil { - return m.SafeReplicaName - } - return nil -} - -func (m *Query) GetPersistOffset() bool { - if m != nil && m.PersistOffset != nil { - return *m.PersistOffset - } - return Default_Query_PersistOffset -} - -type Query_Filter struct { - Op *Query_Filter_Operator `protobuf:"varint,6,req,name=op,enum=appengine.Query_Filter_Operator" json:"op,omitempty"` - Property []*Property `protobuf:"bytes,14,rep,name=property" json:"property,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Query_Filter) Reset() { *m = Query_Filter{} } -func (m *Query_Filter) String() string { return proto.CompactTextString(m) } -func (*Query_Filter) ProtoMessage() {} -func (*Query_Filter) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 0} -} -func (m *Query_Filter) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Query_Filter.Unmarshal(m, b) -} -func (m *Query_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Query_Filter.Marshal(b, m, deterministic) -} -func (dst *Query_Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_Query_Filter.Merge(dst, src) -} -func (m *Query_Filter) XXX_Size() int { - return xxx_messageInfo_Query_Filter.Size(m) -} -func (m *Query_Filter) XXX_DiscardUnknown() { - xxx_messageInfo_Query_Filter.DiscardUnknown(m) -} - -var xxx_messageInfo_Query_Filter proto.InternalMessageInfo - -func (m *Query_Filter) GetOp() Query_Filter_Operator { - if m != nil && m.Op != nil { - return *m.Op - } - return Query_Filter_LESS_THAN -} - -func (m *Query_Filter) GetProperty() []*Property { - if m != nil { - return m.Property - } - return nil -} - -type Query_Order struct { - Property *string `protobuf:"bytes,10,req,name=property" json:"property,omitempty"` - Direction *Query_Order_Direction `protobuf:"varint,11,opt,name=direction,enum=appengine.Query_Order_Direction,def=1" json:"direction,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Query_Order) Reset() { *m = Query_Order{} } -func (m *Query_Order) String() string { return proto.CompactTextString(m) } -func (*Query_Order) ProtoMessage() {} -func (*Query_Order) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 1} -} -func (m *Query_Order) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Query_Order.Unmarshal(m, b) -} -func (m *Query_Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Query_Order.Marshal(b, m, deterministic) -} -func (dst *Query_Order) XXX_Merge(src proto.Message) { - xxx_messageInfo_Query_Order.Merge(dst, src) -} -func (m *Query_Order) XXX_Size() int { - return xxx_messageInfo_Query_Order.Size(m) -} -func (m *Query_Order) XXX_DiscardUnknown() { - xxx_messageInfo_Query_Order.DiscardUnknown(m) -} - -var xxx_messageInfo_Query_Order proto.InternalMessageInfo - -const Default_Query_Order_Direction Query_Order_Direction = Query_Order_ASCENDING - -func (m *Query_Order) GetProperty() string { - if m != nil && m.Property != nil { - return *m.Property - } - return "" -} - -func (m *Query_Order) GetDirection() Query_Order_Direction { - if m != nil && m.Direction != nil { - return *m.Direction - } - return Default_Query_Order_Direction -} - -type CompiledQuery struct { - Primaryscan *CompiledQuery_PrimaryScan `protobuf:"group,1,req,name=PrimaryScan,json=primaryscan" json:"primaryscan,omitempty"` - Mergejoinscan []*CompiledQuery_MergeJoinScan `protobuf:"group,7,rep,name=MergeJoinScan,json=mergejoinscan" json:"mergejoinscan,omitempty"` - IndexDef *Index `protobuf:"bytes,21,opt,name=index_def,json=indexDef" json:"index_def,omitempty"` - Offset *int32 `protobuf:"varint,10,opt,name=offset,def=0" json:"offset,omitempty"` - Limit *int32 `protobuf:"varint,11,opt,name=limit" json:"limit,omitempty"` - KeysOnly *bool `protobuf:"varint,12,req,name=keys_only,json=keysOnly" json:"keys_only,omitempty"` - PropertyName []string `protobuf:"bytes,24,rep,name=property_name,json=propertyName" json:"property_name,omitempty"` - DistinctInfixSize *int32 `protobuf:"varint,25,opt,name=distinct_infix_size,json=distinctInfixSize" json:"distinct_infix_size,omitempty"` - Entityfilter *CompiledQuery_EntityFilter `protobuf:"group,13,opt,name=EntityFilter,json=entityfilter" json:"entityfilter,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompiledQuery) Reset() { *m = CompiledQuery{} } -func (m *CompiledQuery) String() string { return proto.CompactTextString(m) } -func (*CompiledQuery) ProtoMessage() {} -func (*CompiledQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{16} -} -func (m *CompiledQuery) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompiledQuery.Unmarshal(m, b) -} -func (m *CompiledQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompiledQuery.Marshal(b, m, deterministic) -} -func (dst *CompiledQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompiledQuery.Merge(dst, src) -} -func (m *CompiledQuery) XXX_Size() int { - return xxx_messageInfo_CompiledQuery.Size(m) -} -func (m *CompiledQuery) XXX_DiscardUnknown() { - xxx_messageInfo_CompiledQuery.DiscardUnknown(m) -} - -var xxx_messageInfo_CompiledQuery proto.InternalMessageInfo - -const Default_CompiledQuery_Offset int32 = 0 - -func (m *CompiledQuery) GetPrimaryscan() *CompiledQuery_PrimaryScan { - if m != nil { - return m.Primaryscan - } - return nil -} - -func (m *CompiledQuery) GetMergejoinscan() []*CompiledQuery_MergeJoinScan { - if m != nil { - return m.Mergejoinscan - } - return nil -} - -func (m *CompiledQuery) GetIndexDef() *Index { - if m != nil { - return m.IndexDef - } - return nil -} - -func (m *CompiledQuery) GetOffset() int32 { - if m != nil && m.Offset != nil { - return *m.Offset - } - return Default_CompiledQuery_Offset -} - -func (m *CompiledQuery) GetLimit() int32 { - if m != nil && m.Limit != nil { - return *m.Limit - } - return 0 -} - -func (m *CompiledQuery) GetKeysOnly() bool { - if m != nil && m.KeysOnly != nil { - return *m.KeysOnly - } - return false -} - -func (m *CompiledQuery) GetPropertyName() []string { - if m != nil { - return m.PropertyName - } - return nil -} - -func (m *CompiledQuery) GetDistinctInfixSize() int32 { - if m != nil && m.DistinctInfixSize != nil { - return *m.DistinctInfixSize - } - return 0 -} - -func (m *CompiledQuery) GetEntityfilter() *CompiledQuery_EntityFilter { - if m != nil { - return m.Entityfilter - } - return nil -} - -type CompiledQuery_PrimaryScan struct { - IndexName *string `protobuf:"bytes,2,opt,name=index_name,json=indexName" json:"index_name,omitempty"` - StartKey *string `protobuf:"bytes,3,opt,name=start_key,json=startKey" json:"start_key,omitempty"` - StartInclusive *bool `protobuf:"varint,4,opt,name=start_inclusive,json=startInclusive" json:"start_inclusive,omitempty"` - EndKey *string `protobuf:"bytes,5,opt,name=end_key,json=endKey" json:"end_key,omitempty"` - EndInclusive *bool `protobuf:"varint,6,opt,name=end_inclusive,json=endInclusive" json:"end_inclusive,omitempty"` - StartPostfixValue []string `protobuf:"bytes,22,rep,name=start_postfix_value,json=startPostfixValue" json:"start_postfix_value,omitempty"` - EndPostfixValue []string `protobuf:"bytes,23,rep,name=end_postfix_value,json=endPostfixValue" json:"end_postfix_value,omitempty"` - EndUnappliedLogTimestampUs *int64 `protobuf:"varint,19,opt,name=end_unapplied_log_timestamp_us,json=endUnappliedLogTimestampUs" json:"end_unapplied_log_timestamp_us,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompiledQuery_PrimaryScan) Reset() { *m = CompiledQuery_PrimaryScan{} } -func (m *CompiledQuery_PrimaryScan) String() string { return proto.CompactTextString(m) } -func (*CompiledQuery_PrimaryScan) ProtoMessage() {} -func (*CompiledQuery_PrimaryScan) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{16, 0} -} -func (m *CompiledQuery_PrimaryScan) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompiledQuery_PrimaryScan.Unmarshal(m, b) -} -func (m *CompiledQuery_PrimaryScan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompiledQuery_PrimaryScan.Marshal(b, m, deterministic) -} -func (dst *CompiledQuery_PrimaryScan) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompiledQuery_PrimaryScan.Merge(dst, src) -} -func (m *CompiledQuery_PrimaryScan) XXX_Size() int { - return xxx_messageInfo_CompiledQuery_PrimaryScan.Size(m) -} -func (m *CompiledQuery_PrimaryScan) XXX_DiscardUnknown() { - xxx_messageInfo_CompiledQuery_PrimaryScan.DiscardUnknown(m) -} - -var xxx_messageInfo_CompiledQuery_PrimaryScan proto.InternalMessageInfo - -func (m *CompiledQuery_PrimaryScan) GetIndexName() string { - if m != nil && m.IndexName != nil { - return *m.IndexName - } - return "" -} - -func (m *CompiledQuery_PrimaryScan) GetStartKey() string { - if m != nil && m.StartKey != nil { - return *m.StartKey - } - return "" -} - -func (m *CompiledQuery_PrimaryScan) GetStartInclusive() bool { - if m != nil && m.StartInclusive != nil { - return *m.StartInclusive - } - return false -} - -func (m *CompiledQuery_PrimaryScan) GetEndKey() string { - if m != nil && m.EndKey != nil { - return *m.EndKey - } - return "" -} - -func (m *CompiledQuery_PrimaryScan) GetEndInclusive() bool { - if m != nil && m.EndInclusive != nil { - return *m.EndInclusive - } - return false -} - -func (m *CompiledQuery_PrimaryScan) GetStartPostfixValue() []string { - if m != nil { - return m.StartPostfixValue - } - return nil -} - -func (m *CompiledQuery_PrimaryScan) GetEndPostfixValue() []string { - if m != nil { - return m.EndPostfixValue - } - return nil -} - -func (m *CompiledQuery_PrimaryScan) GetEndUnappliedLogTimestampUs() int64 { - if m != nil && m.EndUnappliedLogTimestampUs != nil { - return *m.EndUnappliedLogTimestampUs - } - return 0 -} - -type CompiledQuery_MergeJoinScan struct { - IndexName *string `protobuf:"bytes,8,req,name=index_name,json=indexName" json:"index_name,omitempty"` - PrefixValue []string `protobuf:"bytes,9,rep,name=prefix_value,json=prefixValue" json:"prefix_value,omitempty"` - ValuePrefix *bool `protobuf:"varint,20,opt,name=value_prefix,json=valuePrefix,def=0" json:"value_prefix,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompiledQuery_MergeJoinScan) Reset() { *m = CompiledQuery_MergeJoinScan{} } -func (m *CompiledQuery_MergeJoinScan) String() string { return proto.CompactTextString(m) } -func (*CompiledQuery_MergeJoinScan) ProtoMessage() {} -func (*CompiledQuery_MergeJoinScan) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{16, 1} -} -func (m *CompiledQuery_MergeJoinScan) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompiledQuery_MergeJoinScan.Unmarshal(m, b) -} -func (m *CompiledQuery_MergeJoinScan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompiledQuery_MergeJoinScan.Marshal(b, m, deterministic) -} -func (dst *CompiledQuery_MergeJoinScan) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompiledQuery_MergeJoinScan.Merge(dst, src) -} -func (m *CompiledQuery_MergeJoinScan) XXX_Size() int { - return xxx_messageInfo_CompiledQuery_MergeJoinScan.Size(m) -} -func (m *CompiledQuery_MergeJoinScan) XXX_DiscardUnknown() { - xxx_messageInfo_CompiledQuery_MergeJoinScan.DiscardUnknown(m) -} - -var xxx_messageInfo_CompiledQuery_MergeJoinScan proto.InternalMessageInfo - -const Default_CompiledQuery_MergeJoinScan_ValuePrefix bool = false - -func (m *CompiledQuery_MergeJoinScan) GetIndexName() string { - if m != nil && m.IndexName != nil { - return *m.IndexName - } - return "" -} - -func (m *CompiledQuery_MergeJoinScan) GetPrefixValue() []string { - if m != nil { - return m.PrefixValue - } - return nil -} - -func (m *CompiledQuery_MergeJoinScan) GetValuePrefix() bool { - if m != nil && m.ValuePrefix != nil { - return *m.ValuePrefix - } - return Default_CompiledQuery_MergeJoinScan_ValuePrefix -} - -type CompiledQuery_EntityFilter struct { - Distinct *bool `protobuf:"varint,14,opt,name=distinct,def=0" json:"distinct,omitempty"` - Kind *string `protobuf:"bytes,17,opt,name=kind" json:"kind,omitempty"` - Ancestor *Reference `protobuf:"bytes,18,opt,name=ancestor" json:"ancestor,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompiledQuery_EntityFilter) Reset() { *m = CompiledQuery_EntityFilter{} } -func (m *CompiledQuery_EntityFilter) String() string { return proto.CompactTextString(m) } -func (*CompiledQuery_EntityFilter) ProtoMessage() {} -func (*CompiledQuery_EntityFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{16, 2} -} -func (m *CompiledQuery_EntityFilter) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompiledQuery_EntityFilter.Unmarshal(m, b) -} -func (m *CompiledQuery_EntityFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompiledQuery_EntityFilter.Marshal(b, m, deterministic) -} -func (dst *CompiledQuery_EntityFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompiledQuery_EntityFilter.Merge(dst, src) -} -func (m *CompiledQuery_EntityFilter) XXX_Size() int { - return xxx_messageInfo_CompiledQuery_EntityFilter.Size(m) -} -func (m *CompiledQuery_EntityFilter) XXX_DiscardUnknown() { - xxx_messageInfo_CompiledQuery_EntityFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_CompiledQuery_EntityFilter proto.InternalMessageInfo - -const Default_CompiledQuery_EntityFilter_Distinct bool = false - -func (m *CompiledQuery_EntityFilter) GetDistinct() bool { - if m != nil && m.Distinct != nil { - return *m.Distinct - } - return Default_CompiledQuery_EntityFilter_Distinct -} - -func (m *CompiledQuery_EntityFilter) GetKind() string { - if m != nil && m.Kind != nil { - return *m.Kind - } - return "" -} - -func (m *CompiledQuery_EntityFilter) GetAncestor() *Reference { - if m != nil { - return m.Ancestor - } - return nil -} - -type CompiledCursor struct { - Position *CompiledCursor_Position `protobuf:"group,2,opt,name=Position,json=position" json:"position,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompiledCursor) Reset() { *m = CompiledCursor{} } -func (m *CompiledCursor) String() string { return proto.CompactTextString(m) } -func (*CompiledCursor) ProtoMessage() {} -func (*CompiledCursor) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{17} -} -func (m *CompiledCursor) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompiledCursor.Unmarshal(m, b) -} -func (m *CompiledCursor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompiledCursor.Marshal(b, m, deterministic) -} -func (dst *CompiledCursor) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompiledCursor.Merge(dst, src) -} -func (m *CompiledCursor) XXX_Size() int { - return xxx_messageInfo_CompiledCursor.Size(m) -} -func (m *CompiledCursor) XXX_DiscardUnknown() { - xxx_messageInfo_CompiledCursor.DiscardUnknown(m) -} - -var xxx_messageInfo_CompiledCursor proto.InternalMessageInfo - -func (m *CompiledCursor) GetPosition() *CompiledCursor_Position { - if m != nil { - return m.Position - } - return nil -} - -type CompiledCursor_Position struct { - StartKey *string `protobuf:"bytes,27,opt,name=start_key,json=startKey" json:"start_key,omitempty"` - Indexvalue []*CompiledCursor_Position_IndexValue `protobuf:"group,29,rep,name=IndexValue,json=indexvalue" json:"indexvalue,omitempty"` - Key *Reference `protobuf:"bytes,32,opt,name=key" json:"key,omitempty"` - StartInclusive *bool `protobuf:"varint,28,opt,name=start_inclusive,json=startInclusive,def=1" json:"start_inclusive,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompiledCursor_Position) Reset() { *m = CompiledCursor_Position{} } -func (m *CompiledCursor_Position) String() string { return proto.CompactTextString(m) } -func (*CompiledCursor_Position) ProtoMessage() {} -func (*CompiledCursor_Position) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{17, 0} -} -func (m *CompiledCursor_Position) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompiledCursor_Position.Unmarshal(m, b) -} -func (m *CompiledCursor_Position) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompiledCursor_Position.Marshal(b, m, deterministic) -} -func (dst *CompiledCursor_Position) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompiledCursor_Position.Merge(dst, src) -} -func (m *CompiledCursor_Position) XXX_Size() int { - return xxx_messageInfo_CompiledCursor_Position.Size(m) -} -func (m *CompiledCursor_Position) XXX_DiscardUnknown() { - xxx_messageInfo_CompiledCursor_Position.DiscardUnknown(m) -} - -var xxx_messageInfo_CompiledCursor_Position proto.InternalMessageInfo - -const Default_CompiledCursor_Position_StartInclusive bool = true - -func (m *CompiledCursor_Position) GetStartKey() string { - if m != nil && m.StartKey != nil { - return *m.StartKey - } - return "" -} - -func (m *CompiledCursor_Position) GetIndexvalue() []*CompiledCursor_Position_IndexValue { - if m != nil { - return m.Indexvalue - } - return nil -} - -func (m *CompiledCursor_Position) GetKey() *Reference { - if m != nil { - return m.Key - } - return nil -} - -func (m *CompiledCursor_Position) GetStartInclusive() bool { - if m != nil && m.StartInclusive != nil { - return *m.StartInclusive - } - return Default_CompiledCursor_Position_StartInclusive -} - -type CompiledCursor_Position_IndexValue struct { - Property *string `protobuf:"bytes,30,opt,name=property" json:"property,omitempty"` - Value *PropertyValue `protobuf:"bytes,31,req,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompiledCursor_Position_IndexValue) Reset() { *m = CompiledCursor_Position_IndexValue{} } -func (m *CompiledCursor_Position_IndexValue) String() string { return proto.CompactTextString(m) } -func (*CompiledCursor_Position_IndexValue) ProtoMessage() {} -func (*CompiledCursor_Position_IndexValue) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{17, 0, 0} -} -func (m *CompiledCursor_Position_IndexValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompiledCursor_Position_IndexValue.Unmarshal(m, b) -} -func (m *CompiledCursor_Position_IndexValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompiledCursor_Position_IndexValue.Marshal(b, m, deterministic) -} -func (dst *CompiledCursor_Position_IndexValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompiledCursor_Position_IndexValue.Merge(dst, src) -} -func (m *CompiledCursor_Position_IndexValue) XXX_Size() int { - return xxx_messageInfo_CompiledCursor_Position_IndexValue.Size(m) -} -func (m *CompiledCursor_Position_IndexValue) XXX_DiscardUnknown() { - xxx_messageInfo_CompiledCursor_Position_IndexValue.DiscardUnknown(m) -} - -var xxx_messageInfo_CompiledCursor_Position_IndexValue proto.InternalMessageInfo - -func (m *CompiledCursor_Position_IndexValue) GetProperty() string { - if m != nil && m.Property != nil { - return *m.Property - } - return "" -} - -func (m *CompiledCursor_Position_IndexValue) GetValue() *PropertyValue { - if m != nil { - return m.Value - } - return nil -} - -type Cursor struct { - Cursor *uint64 `protobuf:"fixed64,1,req,name=cursor" json:"cursor,omitempty"` - App *string `protobuf:"bytes,2,opt,name=app" json:"app,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cursor) Reset() { *m = Cursor{} } -func (m *Cursor) String() string { return proto.CompactTextString(m) } -func (*Cursor) ProtoMessage() {} -func (*Cursor) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{18} -} -func (m *Cursor) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cursor.Unmarshal(m, b) -} -func (m *Cursor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cursor.Marshal(b, m, deterministic) -} -func (dst *Cursor) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cursor.Merge(dst, src) -} -func (m *Cursor) XXX_Size() int { - return xxx_messageInfo_Cursor.Size(m) -} -func (m *Cursor) XXX_DiscardUnknown() { - xxx_messageInfo_Cursor.DiscardUnknown(m) -} - -var xxx_messageInfo_Cursor proto.InternalMessageInfo - -func (m *Cursor) GetCursor() uint64 { - if m != nil && m.Cursor != nil { - return *m.Cursor - } - return 0 -} - -func (m *Cursor) GetApp() string { - if m != nil && m.App != nil { - return *m.App - } - return "" -} - -type Error struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Error) Reset() { *m = Error{} } -func (m *Error) String() string { return proto.CompactTextString(m) } -func (*Error) ProtoMessage() {} -func (*Error) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{19} -} -func (m *Error) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Error.Unmarshal(m, b) -} -func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Error.Marshal(b, m, deterministic) -} -func (dst *Error) XXX_Merge(src proto.Message) { - xxx_messageInfo_Error.Merge(dst, src) -} -func (m *Error) XXX_Size() int { - return xxx_messageInfo_Error.Size(m) -} -func (m *Error) XXX_DiscardUnknown() { - xxx_messageInfo_Error.DiscardUnknown(m) -} - -var xxx_messageInfo_Error proto.InternalMessageInfo - -type Cost struct { - IndexWrites *int32 `protobuf:"varint,1,opt,name=index_writes,json=indexWrites" json:"index_writes,omitempty"` - IndexWriteBytes *int32 `protobuf:"varint,2,opt,name=index_write_bytes,json=indexWriteBytes" json:"index_write_bytes,omitempty"` - EntityWrites *int32 `protobuf:"varint,3,opt,name=entity_writes,json=entityWrites" json:"entity_writes,omitempty"` - EntityWriteBytes *int32 `protobuf:"varint,4,opt,name=entity_write_bytes,json=entityWriteBytes" json:"entity_write_bytes,omitempty"` - Commitcost *Cost_CommitCost `protobuf:"group,5,opt,name=CommitCost,json=commitcost" json:"commitcost,omitempty"` - ApproximateStorageDelta *int32 `protobuf:"varint,8,opt,name=approximate_storage_delta,json=approximateStorageDelta" json:"approximate_storage_delta,omitempty"` - IdSequenceUpdates *int32 `protobuf:"varint,9,opt,name=id_sequence_updates,json=idSequenceUpdates" json:"id_sequence_updates,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cost) Reset() { *m = Cost{} } -func (m *Cost) String() string { return proto.CompactTextString(m) } -func (*Cost) ProtoMessage() {} -func (*Cost) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{20} -} -func (m *Cost) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cost.Unmarshal(m, b) -} -func (m *Cost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cost.Marshal(b, m, deterministic) -} -func (dst *Cost) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cost.Merge(dst, src) -} -func (m *Cost) XXX_Size() int { - return xxx_messageInfo_Cost.Size(m) -} -func (m *Cost) XXX_DiscardUnknown() { - xxx_messageInfo_Cost.DiscardUnknown(m) -} - -var xxx_messageInfo_Cost proto.InternalMessageInfo - -func (m *Cost) GetIndexWrites() int32 { - if m != nil && m.IndexWrites != nil { - return *m.IndexWrites - } - return 0 -} - -func (m *Cost) GetIndexWriteBytes() int32 { - if m != nil && m.IndexWriteBytes != nil { - return *m.IndexWriteBytes - } - return 0 -} - -func (m *Cost) GetEntityWrites() int32 { - if m != nil && m.EntityWrites != nil { - return *m.EntityWrites - } - return 0 -} - -func (m *Cost) GetEntityWriteBytes() int32 { - if m != nil && m.EntityWriteBytes != nil { - return *m.EntityWriteBytes - } - return 0 -} - -func (m *Cost) GetCommitcost() *Cost_CommitCost { - if m != nil { - return m.Commitcost - } - return nil -} - -func (m *Cost) GetApproximateStorageDelta() int32 { - if m != nil && m.ApproximateStorageDelta != nil { - return *m.ApproximateStorageDelta - } - return 0 -} - -func (m *Cost) GetIdSequenceUpdates() int32 { - if m != nil && m.IdSequenceUpdates != nil { - return *m.IdSequenceUpdates - } - return 0 -} - -type Cost_CommitCost struct { - RequestedEntityPuts *int32 `protobuf:"varint,6,opt,name=requested_entity_puts,json=requestedEntityPuts" json:"requested_entity_puts,omitempty"` - RequestedEntityDeletes *int32 `protobuf:"varint,7,opt,name=requested_entity_deletes,json=requestedEntityDeletes" json:"requested_entity_deletes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cost_CommitCost) Reset() { *m = Cost_CommitCost{} } -func (m *Cost_CommitCost) String() string { return proto.CompactTextString(m) } -func (*Cost_CommitCost) ProtoMessage() {} -func (*Cost_CommitCost) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{20, 0} -} -func (m *Cost_CommitCost) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cost_CommitCost.Unmarshal(m, b) -} -func (m *Cost_CommitCost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cost_CommitCost.Marshal(b, m, deterministic) -} -func (dst *Cost_CommitCost) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cost_CommitCost.Merge(dst, src) -} -func (m *Cost_CommitCost) XXX_Size() int { - return xxx_messageInfo_Cost_CommitCost.Size(m) -} -func (m *Cost_CommitCost) XXX_DiscardUnknown() { - xxx_messageInfo_Cost_CommitCost.DiscardUnknown(m) -} - -var xxx_messageInfo_Cost_CommitCost proto.InternalMessageInfo - -func (m *Cost_CommitCost) GetRequestedEntityPuts() int32 { - if m != nil && m.RequestedEntityPuts != nil { - return *m.RequestedEntityPuts - } - return 0 -} - -func (m *Cost_CommitCost) GetRequestedEntityDeletes() int32 { - if m != nil && m.RequestedEntityDeletes != nil { - return *m.RequestedEntityDeletes - } - return 0 -} - -type GetRequest struct { - Header *InternalHeader `protobuf:"bytes,6,opt,name=header" json:"header,omitempty"` - Key []*Reference `protobuf:"bytes,1,rep,name=key" json:"key,omitempty"` - Transaction *Transaction `protobuf:"bytes,2,opt,name=transaction" json:"transaction,omitempty"` - FailoverMs *int64 `protobuf:"varint,3,opt,name=failover_ms,json=failoverMs" json:"failover_ms,omitempty"` - Strong *bool `protobuf:"varint,4,opt,name=strong" json:"strong,omitempty"` - AllowDeferred *bool `protobuf:"varint,5,opt,name=allow_deferred,json=allowDeferred,def=0" json:"allow_deferred,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{21} -} -func (m *GetRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetRequest.Unmarshal(m, b) -} -func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) -} -func (dst *GetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest.Merge(dst, src) -} -func (m *GetRequest) XXX_Size() int { - return xxx_messageInfo_GetRequest.Size(m) -} -func (m *GetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRequest proto.InternalMessageInfo - -const Default_GetRequest_AllowDeferred bool = false - -func (m *GetRequest) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *GetRequest) GetKey() []*Reference { - if m != nil { - return m.Key - } - return nil -} - -func (m *GetRequest) GetTransaction() *Transaction { - if m != nil { - return m.Transaction - } - return nil -} - -func (m *GetRequest) GetFailoverMs() int64 { - if m != nil && m.FailoverMs != nil { - return *m.FailoverMs - } - return 0 -} - -func (m *GetRequest) GetStrong() bool { - if m != nil && m.Strong != nil { - return *m.Strong - } - return false -} - -func (m *GetRequest) GetAllowDeferred() bool { - if m != nil && m.AllowDeferred != nil { - return *m.AllowDeferred - } - return Default_GetRequest_AllowDeferred -} - -type GetResponse struct { - Entity []*GetResponse_Entity `protobuf:"group,1,rep,name=Entity,json=entity" json:"entity,omitempty"` - Deferred []*Reference `protobuf:"bytes,5,rep,name=deferred" json:"deferred,omitempty"` - InOrder *bool `protobuf:"varint,6,opt,name=in_order,json=inOrder,def=1" json:"in_order,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} -func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{22} -} -func (m *GetResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetResponse.Unmarshal(m, b) -} -func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) -} -func (dst *GetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse.Merge(dst, src) -} -func (m *GetResponse) XXX_Size() int { - return xxx_messageInfo_GetResponse.Size(m) -} -func (m *GetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse proto.InternalMessageInfo - -const Default_GetResponse_InOrder bool = true - -func (m *GetResponse) GetEntity() []*GetResponse_Entity { - if m != nil { - return m.Entity - } - return nil -} - -func (m *GetResponse) GetDeferred() []*Reference { - if m != nil { - return m.Deferred - } - return nil -} - -func (m *GetResponse) GetInOrder() bool { - if m != nil && m.InOrder != nil { - return *m.InOrder - } - return Default_GetResponse_InOrder -} - -type GetResponse_Entity struct { - Entity *EntityProto `protobuf:"bytes,2,opt,name=entity" json:"entity,omitempty"` - Key *Reference `protobuf:"bytes,4,opt,name=key" json:"key,omitempty"` - Version *int64 `protobuf:"varint,3,opt,name=version" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetResponse_Entity) Reset() { *m = GetResponse_Entity{} } -func (m *GetResponse_Entity) String() string { return proto.CompactTextString(m) } -func (*GetResponse_Entity) ProtoMessage() {} -func (*GetResponse_Entity) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{22, 0} -} -func (m *GetResponse_Entity) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetResponse_Entity.Unmarshal(m, b) -} -func (m *GetResponse_Entity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetResponse_Entity.Marshal(b, m, deterministic) -} -func (dst *GetResponse_Entity) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse_Entity.Merge(dst, src) -} -func (m *GetResponse_Entity) XXX_Size() int { - return xxx_messageInfo_GetResponse_Entity.Size(m) -} -func (m *GetResponse_Entity) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse_Entity.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse_Entity proto.InternalMessageInfo - -func (m *GetResponse_Entity) GetEntity() *EntityProto { - if m != nil { - return m.Entity - } - return nil -} - -func (m *GetResponse_Entity) GetKey() *Reference { - if m != nil { - return m.Key - } - return nil -} - -func (m *GetResponse_Entity) GetVersion() int64 { - if m != nil && m.Version != nil { - return *m.Version - } - return 0 -} - -type PutRequest struct { - Header *InternalHeader `protobuf:"bytes,11,opt,name=header" json:"header,omitempty"` - Entity []*EntityProto `protobuf:"bytes,1,rep,name=entity" json:"entity,omitempty"` - Transaction *Transaction `protobuf:"bytes,2,opt,name=transaction" json:"transaction,omitempty"` - CompositeIndex []*CompositeIndex `protobuf:"bytes,3,rep,name=composite_index,json=compositeIndex" json:"composite_index,omitempty"` - Trusted *bool `protobuf:"varint,4,opt,name=trusted,def=0" json:"trusted,omitempty"` - Force *bool `protobuf:"varint,7,opt,name=force,def=0" json:"force,omitempty"` - MarkChanges *bool `protobuf:"varint,8,opt,name=mark_changes,json=markChanges,def=0" json:"mark_changes,omitempty"` - Snapshot []*Snapshot `protobuf:"bytes,9,rep,name=snapshot" json:"snapshot,omitempty"` - AutoIdPolicy *PutRequest_AutoIdPolicy `protobuf:"varint,10,opt,name=auto_id_policy,json=autoIdPolicy,enum=appengine.PutRequest_AutoIdPolicy,def=0" json:"auto_id_policy,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{23} -} -func (m *PutRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PutRequest.Unmarshal(m, b) -} -func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PutRequest.Marshal(b, m, deterministic) -} -func (dst *PutRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutRequest.Merge(dst, src) -} -func (m *PutRequest) XXX_Size() int { - return xxx_messageInfo_PutRequest.Size(m) -} -func (m *PutRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PutRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PutRequest proto.InternalMessageInfo - -const Default_PutRequest_Trusted bool = false -const Default_PutRequest_Force bool = false -const Default_PutRequest_MarkChanges bool = false -const Default_PutRequest_AutoIdPolicy PutRequest_AutoIdPolicy = PutRequest_CURRENT - -func (m *PutRequest) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *PutRequest) GetEntity() []*EntityProto { - if m != nil { - return m.Entity - } - return nil -} - -func (m *PutRequest) GetTransaction() *Transaction { - if m != nil { - return m.Transaction - } - return nil -} - -func (m *PutRequest) GetCompositeIndex() []*CompositeIndex { - if m != nil { - return m.CompositeIndex - } - return nil -} - -func (m *PutRequest) GetTrusted() bool { - if m != nil && m.Trusted != nil { - return *m.Trusted - } - return Default_PutRequest_Trusted -} - -func (m *PutRequest) GetForce() bool { - if m != nil && m.Force != nil { - return *m.Force - } - return Default_PutRequest_Force -} - -func (m *PutRequest) GetMarkChanges() bool { - if m != nil && m.MarkChanges != nil { - return *m.MarkChanges - } - return Default_PutRequest_MarkChanges -} - -func (m *PutRequest) GetSnapshot() []*Snapshot { - if m != nil { - return m.Snapshot - } - return nil -} - -func (m *PutRequest) GetAutoIdPolicy() PutRequest_AutoIdPolicy { - if m != nil && m.AutoIdPolicy != nil { - return *m.AutoIdPolicy - } - return Default_PutRequest_AutoIdPolicy -} - -type PutResponse struct { - Key []*Reference `protobuf:"bytes,1,rep,name=key" json:"key,omitempty"` - Cost *Cost `protobuf:"bytes,2,opt,name=cost" json:"cost,omitempty"` - Version []int64 `protobuf:"varint,3,rep,name=version" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} -func (*PutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{24} -} -func (m *PutResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PutResponse.Unmarshal(m, b) -} -func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PutResponse.Marshal(b, m, deterministic) -} -func (dst *PutResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PutResponse.Merge(dst, src) -} -func (m *PutResponse) XXX_Size() int { - return xxx_messageInfo_PutResponse.Size(m) -} -func (m *PutResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PutResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PutResponse proto.InternalMessageInfo - -func (m *PutResponse) GetKey() []*Reference { - if m != nil { - return m.Key - } - return nil -} - -func (m *PutResponse) GetCost() *Cost { - if m != nil { - return m.Cost - } - return nil -} - -func (m *PutResponse) GetVersion() []int64 { - if m != nil { - return m.Version - } - return nil -} - -type TouchRequest struct { - Header *InternalHeader `protobuf:"bytes,10,opt,name=header" json:"header,omitempty"` - Key []*Reference `protobuf:"bytes,1,rep,name=key" json:"key,omitempty"` - CompositeIndex []*CompositeIndex `protobuf:"bytes,2,rep,name=composite_index,json=compositeIndex" json:"composite_index,omitempty"` - Force *bool `protobuf:"varint,3,opt,name=force,def=0" json:"force,omitempty"` - Snapshot []*Snapshot `protobuf:"bytes,9,rep,name=snapshot" json:"snapshot,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TouchRequest) Reset() { *m = TouchRequest{} } -func (m *TouchRequest) String() string { return proto.CompactTextString(m) } -func (*TouchRequest) ProtoMessage() {} -func (*TouchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{25} -} -func (m *TouchRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TouchRequest.Unmarshal(m, b) -} -func (m *TouchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TouchRequest.Marshal(b, m, deterministic) -} -func (dst *TouchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_TouchRequest.Merge(dst, src) -} -func (m *TouchRequest) XXX_Size() int { - return xxx_messageInfo_TouchRequest.Size(m) -} -func (m *TouchRequest) XXX_DiscardUnknown() { - xxx_messageInfo_TouchRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_TouchRequest proto.InternalMessageInfo - -const Default_TouchRequest_Force bool = false - -func (m *TouchRequest) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *TouchRequest) GetKey() []*Reference { - if m != nil { - return m.Key - } - return nil -} - -func (m *TouchRequest) GetCompositeIndex() []*CompositeIndex { - if m != nil { - return m.CompositeIndex - } - return nil -} - -func (m *TouchRequest) GetForce() bool { - if m != nil && m.Force != nil { - return *m.Force - } - return Default_TouchRequest_Force -} - -func (m *TouchRequest) GetSnapshot() []*Snapshot { - if m != nil { - return m.Snapshot - } - return nil -} - -type TouchResponse struct { - Cost *Cost `protobuf:"bytes,1,opt,name=cost" json:"cost,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TouchResponse) Reset() { *m = TouchResponse{} } -func (m *TouchResponse) String() string { return proto.CompactTextString(m) } -func (*TouchResponse) ProtoMessage() {} -func (*TouchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{26} -} -func (m *TouchResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TouchResponse.Unmarshal(m, b) -} -func (m *TouchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TouchResponse.Marshal(b, m, deterministic) -} -func (dst *TouchResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_TouchResponse.Merge(dst, src) -} -func (m *TouchResponse) XXX_Size() int { - return xxx_messageInfo_TouchResponse.Size(m) -} -func (m *TouchResponse) XXX_DiscardUnknown() { - xxx_messageInfo_TouchResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_TouchResponse proto.InternalMessageInfo - -func (m *TouchResponse) GetCost() *Cost { - if m != nil { - return m.Cost - } - return nil -} - -type DeleteRequest struct { - Header *InternalHeader `protobuf:"bytes,10,opt,name=header" json:"header,omitempty"` - Key []*Reference `protobuf:"bytes,6,rep,name=key" json:"key,omitempty"` - Transaction *Transaction `protobuf:"bytes,5,opt,name=transaction" json:"transaction,omitempty"` - Trusted *bool `protobuf:"varint,4,opt,name=trusted,def=0" json:"trusted,omitempty"` - Force *bool `protobuf:"varint,7,opt,name=force,def=0" json:"force,omitempty"` - MarkChanges *bool `protobuf:"varint,8,opt,name=mark_changes,json=markChanges,def=0" json:"mark_changes,omitempty"` - Snapshot []*Snapshot `protobuf:"bytes,9,rep,name=snapshot" json:"snapshot,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{27} -} -func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteRequest.Unmarshal(m, b) -} -func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic) -} -func (dst *DeleteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRequest.Merge(dst, src) -} -func (m *DeleteRequest) XXX_Size() int { - return xxx_messageInfo_DeleteRequest.Size(m) -} -func (m *DeleteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo - -const Default_DeleteRequest_Trusted bool = false -const Default_DeleteRequest_Force bool = false -const Default_DeleteRequest_MarkChanges bool = false - -func (m *DeleteRequest) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *DeleteRequest) GetKey() []*Reference { - if m != nil { - return m.Key - } - return nil -} - -func (m *DeleteRequest) GetTransaction() *Transaction { - if m != nil { - return m.Transaction - } - return nil -} - -func (m *DeleteRequest) GetTrusted() bool { - if m != nil && m.Trusted != nil { - return *m.Trusted - } - return Default_DeleteRequest_Trusted -} - -func (m *DeleteRequest) GetForce() bool { - if m != nil && m.Force != nil { - return *m.Force - } - return Default_DeleteRequest_Force -} - -func (m *DeleteRequest) GetMarkChanges() bool { - if m != nil && m.MarkChanges != nil { - return *m.MarkChanges - } - return Default_DeleteRequest_MarkChanges -} - -func (m *DeleteRequest) GetSnapshot() []*Snapshot { - if m != nil { - return m.Snapshot - } - return nil -} - -type DeleteResponse struct { - Cost *Cost `protobuf:"bytes,1,opt,name=cost" json:"cost,omitempty"` - Version []int64 `protobuf:"varint,3,rep,name=version" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } -func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{28} -} -func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteResponse.Unmarshal(m, b) -} -func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic) -} -func (dst *DeleteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteResponse.Merge(dst, src) -} -func (m *DeleteResponse) XXX_Size() int { - return xxx_messageInfo_DeleteResponse.Size(m) -} -func (m *DeleteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo - -func (m *DeleteResponse) GetCost() *Cost { - if m != nil { - return m.Cost - } - return nil -} - -func (m *DeleteResponse) GetVersion() []int64 { - if m != nil { - return m.Version - } - return nil -} - -type NextRequest struct { - Header *InternalHeader `protobuf:"bytes,5,opt,name=header" json:"header,omitempty"` - Cursor *Cursor `protobuf:"bytes,1,req,name=cursor" json:"cursor,omitempty"` - Count *int32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` - Offset *int32 `protobuf:"varint,4,opt,name=offset,def=0" json:"offset,omitempty"` - Compile *bool `protobuf:"varint,3,opt,name=compile,def=0" json:"compile,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NextRequest) Reset() { *m = NextRequest{} } -func (m *NextRequest) String() string { return proto.CompactTextString(m) } -func (*NextRequest) ProtoMessage() {} -func (*NextRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{29} -} -func (m *NextRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NextRequest.Unmarshal(m, b) -} -func (m *NextRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NextRequest.Marshal(b, m, deterministic) -} -func (dst *NextRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_NextRequest.Merge(dst, src) -} -func (m *NextRequest) XXX_Size() int { - return xxx_messageInfo_NextRequest.Size(m) -} -func (m *NextRequest) XXX_DiscardUnknown() { - xxx_messageInfo_NextRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_NextRequest proto.InternalMessageInfo - -const Default_NextRequest_Offset int32 = 0 -const Default_NextRequest_Compile bool = false - -func (m *NextRequest) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *NextRequest) GetCursor() *Cursor { - if m != nil { - return m.Cursor - } - return nil -} - -func (m *NextRequest) GetCount() int32 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -func (m *NextRequest) GetOffset() int32 { - if m != nil && m.Offset != nil { - return *m.Offset - } - return Default_NextRequest_Offset -} - -func (m *NextRequest) GetCompile() bool { - if m != nil && m.Compile != nil { - return *m.Compile - } - return Default_NextRequest_Compile -} - -type QueryResult struct { - Cursor *Cursor `protobuf:"bytes,1,opt,name=cursor" json:"cursor,omitempty"` - Result []*EntityProto `protobuf:"bytes,2,rep,name=result" json:"result,omitempty"` - SkippedResults *int32 `protobuf:"varint,7,opt,name=skipped_results,json=skippedResults" json:"skipped_results,omitempty"` - MoreResults *bool `protobuf:"varint,3,req,name=more_results,json=moreResults" json:"more_results,omitempty"` - KeysOnly *bool `protobuf:"varint,4,opt,name=keys_only,json=keysOnly" json:"keys_only,omitempty"` - IndexOnly *bool `protobuf:"varint,9,opt,name=index_only,json=indexOnly" json:"index_only,omitempty"` - SmallOps *bool `protobuf:"varint,10,opt,name=small_ops,json=smallOps" json:"small_ops,omitempty"` - CompiledQuery *CompiledQuery `protobuf:"bytes,5,opt,name=compiled_query,json=compiledQuery" json:"compiled_query,omitempty"` - CompiledCursor *CompiledCursor `protobuf:"bytes,6,opt,name=compiled_cursor,json=compiledCursor" json:"compiled_cursor,omitempty"` - Index []*CompositeIndex `protobuf:"bytes,8,rep,name=index" json:"index,omitempty"` - Version []int64 `protobuf:"varint,11,rep,name=version" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *QueryResult) Reset() { *m = QueryResult{} } -func (m *QueryResult) String() string { return proto.CompactTextString(m) } -func (*QueryResult) ProtoMessage() {} -func (*QueryResult) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{30} -} -func (m *QueryResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_QueryResult.Unmarshal(m, b) -} -func (m *QueryResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_QueryResult.Marshal(b, m, deterministic) -} -func (dst *QueryResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryResult.Merge(dst, src) -} -func (m *QueryResult) XXX_Size() int { - return xxx_messageInfo_QueryResult.Size(m) -} -func (m *QueryResult) XXX_DiscardUnknown() { - xxx_messageInfo_QueryResult.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryResult proto.InternalMessageInfo - -func (m *QueryResult) GetCursor() *Cursor { - if m != nil { - return m.Cursor - } - return nil -} - -func (m *QueryResult) GetResult() []*EntityProto { - if m != nil { - return m.Result - } - return nil -} - -func (m *QueryResult) GetSkippedResults() int32 { - if m != nil && m.SkippedResults != nil { - return *m.SkippedResults - } - return 0 -} - -func (m *QueryResult) GetMoreResults() bool { - if m != nil && m.MoreResults != nil { - return *m.MoreResults - } - return false -} - -func (m *QueryResult) GetKeysOnly() bool { - if m != nil && m.KeysOnly != nil { - return *m.KeysOnly - } - return false -} - -func (m *QueryResult) GetIndexOnly() bool { - if m != nil && m.IndexOnly != nil { - return *m.IndexOnly - } - return false -} - -func (m *QueryResult) GetSmallOps() bool { - if m != nil && m.SmallOps != nil { - return *m.SmallOps - } - return false -} - -func (m *QueryResult) GetCompiledQuery() *CompiledQuery { - if m != nil { - return m.CompiledQuery - } - return nil -} - -func (m *QueryResult) GetCompiledCursor() *CompiledCursor { - if m != nil { - return m.CompiledCursor - } - return nil -} - -func (m *QueryResult) GetIndex() []*CompositeIndex { - if m != nil { - return m.Index - } - return nil -} - -func (m *QueryResult) GetVersion() []int64 { - if m != nil { - return m.Version - } - return nil -} - -type AllocateIdsRequest struct { - Header *InternalHeader `protobuf:"bytes,4,opt,name=header" json:"header,omitempty"` - ModelKey *Reference `protobuf:"bytes,1,opt,name=model_key,json=modelKey" json:"model_key,omitempty"` - Size *int64 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"` - Max *int64 `protobuf:"varint,3,opt,name=max" json:"max,omitempty"` - Reserve []*Reference `protobuf:"bytes,5,rep,name=reserve" json:"reserve,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AllocateIdsRequest) Reset() { *m = AllocateIdsRequest{} } -func (m *AllocateIdsRequest) String() string { return proto.CompactTextString(m) } -func (*AllocateIdsRequest) ProtoMessage() {} -func (*AllocateIdsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{31} -} -func (m *AllocateIdsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AllocateIdsRequest.Unmarshal(m, b) -} -func (m *AllocateIdsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AllocateIdsRequest.Marshal(b, m, deterministic) -} -func (dst *AllocateIdsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AllocateIdsRequest.Merge(dst, src) -} -func (m *AllocateIdsRequest) XXX_Size() int { - return xxx_messageInfo_AllocateIdsRequest.Size(m) -} -func (m *AllocateIdsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AllocateIdsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AllocateIdsRequest proto.InternalMessageInfo - -func (m *AllocateIdsRequest) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *AllocateIdsRequest) GetModelKey() *Reference { - if m != nil { - return m.ModelKey - } - return nil -} - -func (m *AllocateIdsRequest) GetSize() int64 { - if m != nil && m.Size != nil { - return *m.Size - } - return 0 -} - -func (m *AllocateIdsRequest) GetMax() int64 { - if m != nil && m.Max != nil { - return *m.Max - } - return 0 -} - -func (m *AllocateIdsRequest) GetReserve() []*Reference { - if m != nil { - return m.Reserve - } - return nil -} - -type AllocateIdsResponse struct { - Start *int64 `protobuf:"varint,1,req,name=start" json:"start,omitempty"` - End *int64 `protobuf:"varint,2,req,name=end" json:"end,omitempty"` - Cost *Cost `protobuf:"bytes,3,opt,name=cost" json:"cost,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AllocateIdsResponse) Reset() { *m = AllocateIdsResponse{} } -func (m *AllocateIdsResponse) String() string { return proto.CompactTextString(m) } -func (*AllocateIdsResponse) ProtoMessage() {} -func (*AllocateIdsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{32} -} -func (m *AllocateIdsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AllocateIdsResponse.Unmarshal(m, b) -} -func (m *AllocateIdsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AllocateIdsResponse.Marshal(b, m, deterministic) -} -func (dst *AllocateIdsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AllocateIdsResponse.Merge(dst, src) -} -func (m *AllocateIdsResponse) XXX_Size() int { - return xxx_messageInfo_AllocateIdsResponse.Size(m) -} -func (m *AllocateIdsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AllocateIdsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AllocateIdsResponse proto.InternalMessageInfo - -func (m *AllocateIdsResponse) GetStart() int64 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *AllocateIdsResponse) GetEnd() int64 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func (m *AllocateIdsResponse) GetCost() *Cost { - if m != nil { - return m.Cost - } - return nil -} - -type CompositeIndices struct { - Index []*CompositeIndex `protobuf:"bytes,1,rep,name=index" json:"index,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CompositeIndices) Reset() { *m = CompositeIndices{} } -func (m *CompositeIndices) String() string { return proto.CompactTextString(m) } -func (*CompositeIndices) ProtoMessage() {} -func (*CompositeIndices) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{33} -} -func (m *CompositeIndices) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CompositeIndices.Unmarshal(m, b) -} -func (m *CompositeIndices) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CompositeIndices.Marshal(b, m, deterministic) -} -func (dst *CompositeIndices) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompositeIndices.Merge(dst, src) -} -func (m *CompositeIndices) XXX_Size() int { - return xxx_messageInfo_CompositeIndices.Size(m) -} -func (m *CompositeIndices) XXX_DiscardUnknown() { - xxx_messageInfo_CompositeIndices.DiscardUnknown(m) -} - -var xxx_messageInfo_CompositeIndices proto.InternalMessageInfo - -func (m *CompositeIndices) GetIndex() []*CompositeIndex { - if m != nil { - return m.Index - } - return nil -} - -type AddActionsRequest struct { - Header *InternalHeader `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` - Transaction *Transaction `protobuf:"bytes,1,req,name=transaction" json:"transaction,omitempty"` - Action []*Action `protobuf:"bytes,2,rep,name=action" json:"action,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AddActionsRequest) Reset() { *m = AddActionsRequest{} } -func (m *AddActionsRequest) String() string { return proto.CompactTextString(m) } -func (*AddActionsRequest) ProtoMessage() {} -func (*AddActionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{34} -} -func (m *AddActionsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AddActionsRequest.Unmarshal(m, b) -} -func (m *AddActionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AddActionsRequest.Marshal(b, m, deterministic) -} -func (dst *AddActionsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddActionsRequest.Merge(dst, src) -} -func (m *AddActionsRequest) XXX_Size() int { - return xxx_messageInfo_AddActionsRequest.Size(m) -} -func (m *AddActionsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AddActionsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AddActionsRequest proto.InternalMessageInfo - -func (m *AddActionsRequest) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *AddActionsRequest) GetTransaction() *Transaction { - if m != nil { - return m.Transaction - } - return nil -} - -func (m *AddActionsRequest) GetAction() []*Action { - if m != nil { - return m.Action - } - return nil -} - -type AddActionsResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AddActionsResponse) Reset() { *m = AddActionsResponse{} } -func (m *AddActionsResponse) String() string { return proto.CompactTextString(m) } -func (*AddActionsResponse) ProtoMessage() {} -func (*AddActionsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{35} -} -func (m *AddActionsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AddActionsResponse.Unmarshal(m, b) -} -func (m *AddActionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AddActionsResponse.Marshal(b, m, deterministic) -} -func (dst *AddActionsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddActionsResponse.Merge(dst, src) -} -func (m *AddActionsResponse) XXX_Size() int { - return xxx_messageInfo_AddActionsResponse.Size(m) -} -func (m *AddActionsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AddActionsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AddActionsResponse proto.InternalMessageInfo - -type BeginTransactionRequest struct { - Header *InternalHeader `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` - App *string `protobuf:"bytes,1,req,name=app" json:"app,omitempty"` - AllowMultipleEg *bool `protobuf:"varint,2,opt,name=allow_multiple_eg,json=allowMultipleEg,def=0" json:"allow_multiple_eg,omitempty"` - DatabaseId *string `protobuf:"bytes,4,opt,name=database_id,json=databaseId" json:"database_id,omitempty"` - Mode *BeginTransactionRequest_TransactionMode `protobuf:"varint,5,opt,name=mode,enum=appengine.BeginTransactionRequest_TransactionMode,def=0" json:"mode,omitempty"` - PreviousTransaction *Transaction `protobuf:"bytes,7,opt,name=previous_transaction,json=previousTransaction" json:"previous_transaction,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BeginTransactionRequest) Reset() { *m = BeginTransactionRequest{} } -func (m *BeginTransactionRequest) String() string { return proto.CompactTextString(m) } -func (*BeginTransactionRequest) ProtoMessage() {} -func (*BeginTransactionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{36} -} -func (m *BeginTransactionRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BeginTransactionRequest.Unmarshal(m, b) -} -func (m *BeginTransactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BeginTransactionRequest.Marshal(b, m, deterministic) -} -func (dst *BeginTransactionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BeginTransactionRequest.Merge(dst, src) -} -func (m *BeginTransactionRequest) XXX_Size() int { - return xxx_messageInfo_BeginTransactionRequest.Size(m) -} -func (m *BeginTransactionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BeginTransactionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BeginTransactionRequest proto.InternalMessageInfo - -const Default_BeginTransactionRequest_AllowMultipleEg bool = false -const Default_BeginTransactionRequest_Mode BeginTransactionRequest_TransactionMode = BeginTransactionRequest_UNKNOWN - -func (m *BeginTransactionRequest) GetHeader() *InternalHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *BeginTransactionRequest) GetApp() string { - if m != nil && m.App != nil { - return *m.App - } - return "" -} - -func (m *BeginTransactionRequest) GetAllowMultipleEg() bool { - if m != nil && m.AllowMultipleEg != nil { - return *m.AllowMultipleEg - } - return Default_BeginTransactionRequest_AllowMultipleEg -} - -func (m *BeginTransactionRequest) GetDatabaseId() string { - if m != nil && m.DatabaseId != nil { - return *m.DatabaseId - } - return "" -} - -func (m *BeginTransactionRequest) GetMode() BeginTransactionRequest_TransactionMode { - if m != nil && m.Mode != nil { - return *m.Mode - } - return Default_BeginTransactionRequest_Mode -} - -func (m *BeginTransactionRequest) GetPreviousTransaction() *Transaction { - if m != nil { - return m.PreviousTransaction - } - return nil -} - -type CommitResponse struct { - Cost *Cost `protobuf:"bytes,1,opt,name=cost" json:"cost,omitempty"` - Version []*CommitResponse_Version `protobuf:"group,3,rep,name=Version,json=version" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CommitResponse) Reset() { *m = CommitResponse{} } -func (m *CommitResponse) String() string { return proto.CompactTextString(m) } -func (*CommitResponse) ProtoMessage() {} -func (*CommitResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{37} -} -func (m *CommitResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CommitResponse.Unmarshal(m, b) -} -func (m *CommitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CommitResponse.Marshal(b, m, deterministic) -} -func (dst *CommitResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommitResponse.Merge(dst, src) -} -func (m *CommitResponse) XXX_Size() int { - return xxx_messageInfo_CommitResponse.Size(m) -} -func (m *CommitResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CommitResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CommitResponse proto.InternalMessageInfo - -func (m *CommitResponse) GetCost() *Cost { - if m != nil { - return m.Cost - } - return nil -} - -func (m *CommitResponse) GetVersion() []*CommitResponse_Version { - if m != nil { - return m.Version - } - return nil -} - -type CommitResponse_Version struct { - RootEntityKey *Reference `protobuf:"bytes,4,req,name=root_entity_key,json=rootEntityKey" json:"root_entity_key,omitempty"` - Version *int64 `protobuf:"varint,5,req,name=version" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CommitResponse_Version) Reset() { *m = CommitResponse_Version{} } -func (m *CommitResponse_Version) String() string { return proto.CompactTextString(m) } -func (*CommitResponse_Version) ProtoMessage() {} -func (*CommitResponse_Version) Descriptor() ([]byte, []int) { - return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{37, 0} -} -func (m *CommitResponse_Version) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CommitResponse_Version.Unmarshal(m, b) -} -func (m *CommitResponse_Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CommitResponse_Version.Marshal(b, m, deterministic) -} -func (dst *CommitResponse_Version) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommitResponse_Version.Merge(dst, src) -} -func (m *CommitResponse_Version) XXX_Size() int { - return xxx_messageInfo_CommitResponse_Version.Size(m) -} -func (m *CommitResponse_Version) XXX_DiscardUnknown() { - xxx_messageInfo_CommitResponse_Version.DiscardUnknown(m) -} - -var xxx_messageInfo_CommitResponse_Version proto.InternalMessageInfo - -func (m *CommitResponse_Version) GetRootEntityKey() *Reference { - if m != nil { - return m.RootEntityKey - } - return nil -} - -func (m *CommitResponse_Version) GetVersion() int64 { - if m != nil && m.Version != nil { - return *m.Version - } - return 0 -} - -func init() { - proto.RegisterType((*Action)(nil), "appengine.Action") - proto.RegisterType((*PropertyValue)(nil), "appengine.PropertyValue") - proto.RegisterType((*PropertyValue_PointValue)(nil), "appengine.PropertyValue.PointValue") - proto.RegisterType((*PropertyValue_UserValue)(nil), "appengine.PropertyValue.UserValue") - proto.RegisterType((*PropertyValue_ReferenceValue)(nil), "appengine.PropertyValue.ReferenceValue") - proto.RegisterType((*PropertyValue_ReferenceValue_PathElement)(nil), "appengine.PropertyValue.ReferenceValue.PathElement") - proto.RegisterType((*Property)(nil), "appengine.Property") - proto.RegisterType((*Path)(nil), "appengine.Path") - proto.RegisterType((*Path_Element)(nil), "appengine.Path.Element") - proto.RegisterType((*Reference)(nil), "appengine.Reference") - proto.RegisterType((*User)(nil), "appengine.User") - proto.RegisterType((*EntityProto)(nil), "appengine.EntityProto") - proto.RegisterType((*CompositeProperty)(nil), "appengine.CompositeProperty") - proto.RegisterType((*Index)(nil), "appengine.Index") - proto.RegisterType((*Index_Property)(nil), "appengine.Index.Property") - proto.RegisterType((*CompositeIndex)(nil), "appengine.CompositeIndex") - proto.RegisterType((*IndexPostfix)(nil), "appengine.IndexPostfix") - proto.RegisterType((*IndexPostfix_IndexValue)(nil), "appengine.IndexPostfix.IndexValue") - proto.RegisterType((*IndexPosition)(nil), "appengine.IndexPosition") - proto.RegisterType((*Snapshot)(nil), "appengine.Snapshot") - proto.RegisterType((*InternalHeader)(nil), "appengine.InternalHeader") - proto.RegisterType((*Transaction)(nil), "appengine.Transaction") - proto.RegisterType((*Query)(nil), "appengine.Query") - proto.RegisterType((*Query_Filter)(nil), "appengine.Query.Filter") - proto.RegisterType((*Query_Order)(nil), "appengine.Query.Order") - proto.RegisterType((*CompiledQuery)(nil), "appengine.CompiledQuery") - proto.RegisterType((*CompiledQuery_PrimaryScan)(nil), "appengine.CompiledQuery.PrimaryScan") - proto.RegisterType((*CompiledQuery_MergeJoinScan)(nil), "appengine.CompiledQuery.MergeJoinScan") - proto.RegisterType((*CompiledQuery_EntityFilter)(nil), "appengine.CompiledQuery.EntityFilter") - proto.RegisterType((*CompiledCursor)(nil), "appengine.CompiledCursor") - proto.RegisterType((*CompiledCursor_Position)(nil), "appengine.CompiledCursor.Position") - proto.RegisterType((*CompiledCursor_Position_IndexValue)(nil), "appengine.CompiledCursor.Position.IndexValue") - proto.RegisterType((*Cursor)(nil), "appengine.Cursor") - proto.RegisterType((*Error)(nil), "appengine.Error") - proto.RegisterType((*Cost)(nil), "appengine.Cost") - proto.RegisterType((*Cost_CommitCost)(nil), "appengine.Cost.CommitCost") - proto.RegisterType((*GetRequest)(nil), "appengine.GetRequest") - proto.RegisterType((*GetResponse)(nil), "appengine.GetResponse") - proto.RegisterType((*GetResponse_Entity)(nil), "appengine.GetResponse.Entity") - proto.RegisterType((*PutRequest)(nil), "appengine.PutRequest") - proto.RegisterType((*PutResponse)(nil), "appengine.PutResponse") - proto.RegisterType((*TouchRequest)(nil), "appengine.TouchRequest") - proto.RegisterType((*TouchResponse)(nil), "appengine.TouchResponse") - proto.RegisterType((*DeleteRequest)(nil), "appengine.DeleteRequest") - proto.RegisterType((*DeleteResponse)(nil), "appengine.DeleteResponse") - proto.RegisterType((*NextRequest)(nil), "appengine.NextRequest") - proto.RegisterType((*QueryResult)(nil), "appengine.QueryResult") - proto.RegisterType((*AllocateIdsRequest)(nil), "appengine.AllocateIdsRequest") - proto.RegisterType((*AllocateIdsResponse)(nil), "appengine.AllocateIdsResponse") - proto.RegisterType((*CompositeIndices)(nil), "appengine.CompositeIndices") - proto.RegisterType((*AddActionsRequest)(nil), "appengine.AddActionsRequest") - proto.RegisterType((*AddActionsResponse)(nil), "appengine.AddActionsResponse") - proto.RegisterType((*BeginTransactionRequest)(nil), "appengine.BeginTransactionRequest") - proto.RegisterType((*CommitResponse)(nil), "appengine.CommitResponse") - proto.RegisterType((*CommitResponse_Version)(nil), "appengine.CommitResponse.Version") -} - -func init() { - proto.RegisterFile("google.golang.org/appengine/internal/datastore/datastore_v3.proto", fileDescriptor_datastore_v3_83b17b80c34f6179) -} - -var fileDescriptor_datastore_v3_83b17b80c34f6179 = []byte{ - // 4156 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xcd, 0x73, 0xe3, 0x46, - 0x76, 0x37, 0xc1, 0xef, 0x47, 0x89, 0x82, 0x5a, 0xf3, 0xc1, 0xa1, 0x3f, 0x46, 0xc6, 0xac, 0x6d, - 0xd9, 0x6b, 0x73, 0x6c, 0xf9, 0x23, 0x5b, 0x4a, 0x76, 0x1d, 0x4a, 0xc4, 0x68, 0x90, 0xa1, 0x48, - 0xb9, 0x09, 0xd9, 0x9e, 0x5c, 0x50, 0x18, 0xa2, 0x29, 0x21, 0x43, 0x02, 0x30, 0x00, 0x6a, 0x46, - 0x93, 0xe4, 0x90, 0x4b, 0x2a, 0x55, 0x5b, 0xa9, 0x1c, 0x92, 0x4a, 0x25, 0xf9, 0x07, 0x72, 0xc8, - 0x39, 0x95, 0xaa, 0x54, 0xf6, 0x98, 0x5b, 0x0e, 0x7b, 0xc9, 0x31, 0x95, 0x73, 0xf2, 0x27, 0x24, - 0x39, 0xa4, 0xfa, 0x75, 0x03, 0x02, 0x28, 0x4a, 0x23, 0x6d, 0xf6, 0x90, 0x13, 0xd1, 0xef, 0xfd, - 0xba, 0xf1, 0xfa, 0xf5, 0xfb, 0x6c, 0x10, 0xba, 0xc7, 0xbe, 0x7f, 0x3c, 0x65, 0x9d, 0x63, 0x7f, - 0x6a, 0x7b, 0xc7, 0x1d, 0x3f, 0x3c, 0x7e, 0x68, 0x07, 0x01, 0xf3, 0x8e, 0x5d, 0x8f, 0x3d, 0x74, - 0xbd, 0x98, 0x85, 0x9e, 0x3d, 0x7d, 0xe8, 0xd8, 0xb1, 0x1d, 0xc5, 0x7e, 0xc8, 0xce, 0x9f, 0xac, - 0xd3, 0xcf, 0x3b, 0x41, 0xe8, 0xc7, 0x3e, 0xa9, 0xa7, 0x13, 0xb4, 0x1a, 0x54, 0xba, 0xe3, 0xd8, - 0xf5, 0x3d, 0xed, 0x1f, 0x2b, 0xb0, 0x7a, 0x18, 0xfa, 0x01, 0x0b, 0xe3, 0xb3, 0x6f, 0xed, 0xe9, - 0x9c, 0x91, 0x77, 0x00, 0x5c, 0x2f, 0xfe, 0xea, 0x0b, 0x1c, 0xb5, 0x0a, 0x9b, 0x85, 0xad, 0x22, - 0xcd, 0x50, 0x88, 0x06, 0x2b, 0xcf, 0x7c, 0x7f, 0xca, 0x6c, 0x4f, 0x20, 0x94, 0xcd, 0xc2, 0x56, - 0x8d, 0xe6, 0x68, 0x64, 0x13, 0x1a, 0x51, 0x1c, 0xba, 0xde, 0xb1, 0x80, 0x14, 0x37, 0x0b, 0x5b, - 0x75, 0x9a, 0x25, 0x71, 0x84, 0xe3, 0xcf, 0x9f, 0x4d, 0x99, 0x40, 0x94, 0x36, 0x0b, 0x5b, 0x05, - 0x9a, 0x25, 0x91, 0x3d, 0x80, 0xc0, 0x77, 0xbd, 0xf8, 0x14, 0x01, 0xe5, 0xcd, 0xc2, 0x16, 0x6c, - 0x3f, 0xe8, 0xa4, 0x7b, 0xe8, 0xe4, 0xa4, 0xee, 0x1c, 0x72, 0x28, 0x3e, 0xd2, 0xcc, 0x34, 0xf2, - 0xdb, 0x50, 0x9f, 0x47, 0x2c, 0x14, 0x6b, 0xd4, 0x70, 0x0d, 0xed, 0xd2, 0x35, 0x8e, 0x22, 0x16, - 0x8a, 0x25, 0xce, 0x27, 0x91, 0x21, 0x34, 0x43, 0x36, 0x61, 0x21, 0xf3, 0xc6, 0x4c, 0x2c, 0xb3, - 0x82, 0xcb, 0x7c, 0x70, 0xe9, 0x32, 0x34, 0x81, 0x8b, 0xb5, 0x16, 0xa6, 0xb7, 0xb7, 0x00, 0xce, - 0x85, 0x25, 0x2b, 0x50, 0x78, 0xd9, 0xaa, 0x6c, 0x2a, 0x5b, 0x05, 0x5a, 0x78, 0xc9, 0x47, 0x67, - 0xad, 0xaa, 0x18, 0x9d, 0xb5, 0xff, 0xa9, 0x00, 0xf5, 0x54, 0x26, 0x72, 0x0b, 0xca, 0x6c, 0x66, - 0xbb, 0xd3, 0x56, 0x7d, 0x53, 0xd9, 0xaa, 0x53, 0x31, 0x20, 0xf7, 0xa1, 0x61, 0xcf, 0xe3, 0x13, - 0xcb, 0xf1, 0x67, 0xb6, 0xeb, 0xb5, 0x00, 0x79, 0xc0, 0x49, 0x3d, 0xa4, 0x90, 0x36, 0xd4, 0x3c, - 0x77, 0xfc, 0xdc, 0xb3, 0x67, 0xac, 0xd5, 0xc0, 0x73, 0x48, 0xc7, 0xe4, 0x13, 0x20, 0x13, 0xe6, - 0xb0, 0xd0, 0x8e, 0x99, 0x63, 0xb9, 0x0e, 0xf3, 0x62, 0x37, 0x3e, 0x6b, 0xdd, 0x46, 0xd4, 0x7a, - 0xca, 0x31, 0x24, 0x23, 0x0f, 0x0f, 0x42, 0xff, 0xd4, 0x75, 0x58, 0xd8, 0xba, 0xb3, 0x00, 0x3f, - 0x94, 0x8c, 0xf6, 0xbf, 0x17, 0xa0, 0x99, 0xd7, 0x05, 0x51, 0xa1, 0x68, 0x07, 0x41, 0x6b, 0x15, - 0xa5, 0xe4, 0x8f, 0xe4, 0x6d, 0x00, 0x2e, 0x8a, 0x15, 0x05, 0xf6, 0x98, 0xb5, 0x6e, 0xe1, 0x5a, - 0x75, 0x4e, 0x19, 0x71, 0x02, 0x39, 0x82, 0x46, 0x60, 0xc7, 0x27, 0x6c, 0xca, 0x66, 0xcc, 0x8b, - 0x5b, 0xcd, 0xcd, 0xe2, 0x16, 0x6c, 0x7f, 0x7e, 0x4d, 0xd5, 0x77, 0x0e, 0xed, 0xf8, 0x44, 0x17, - 0x53, 0x69, 0x76, 0x9d, 0xb6, 0x0e, 0x8d, 0x0c, 0x8f, 0x10, 0x28, 0xc5, 0x67, 0x01, 0x6b, 0xad, - 0xa1, 0x5c, 0xf8, 0x4c, 0x9a, 0xa0, 0xb8, 0x4e, 0x4b, 0x45, 0xf3, 0x57, 0x5c, 0x87, 0x63, 0x50, - 0x87, 0xeb, 0x28, 0x22, 0x3e, 0x6b, 0xff, 0x51, 0x86, 0x5a, 0x22, 0x00, 0xe9, 0x42, 0x75, 0xc6, - 0x6c, 0xcf, 0xf5, 0x8e, 0xd1, 0x69, 0x9a, 0xdb, 0x6f, 0x2e, 0x11, 0xb3, 0x73, 0x20, 0x20, 0x3b, - 0x30, 0x18, 0x5a, 0x07, 0x7a, 0x77, 0x60, 0x0c, 0xf6, 0x69, 0x32, 0x8f, 0x1f, 0xa6, 0x7c, 0xb4, - 0xe6, 0xa1, 0x8b, 0x9e, 0x55, 0xa7, 0x20, 0x49, 0x47, 0xa1, 0x9b, 0x0a, 0x51, 0x14, 0x82, 0xe2, - 0x21, 0x76, 0xa0, 0x9c, 0xb8, 0x88, 0xb2, 0xd5, 0xd8, 0x6e, 0x5d, 0xa6, 0x1c, 0x2a, 0x60, 0xdc, - 0x20, 0x66, 0xf3, 0x69, 0xec, 0x06, 0x53, 0xee, 0x76, 0xca, 0x56, 0x8d, 0xa6, 0x63, 0xf2, 0x1e, - 0x40, 0xc4, 0xec, 0x70, 0x7c, 0x62, 0x3f, 0x9b, 0xb2, 0x56, 0x85, 0x7b, 0xf6, 0x4e, 0x79, 0x62, - 0x4f, 0x23, 0x46, 0x33, 0x0c, 0x62, 0xc3, 0xdd, 0x49, 0x1c, 0x59, 0xb1, 0xff, 0x9c, 0x79, 0xee, - 0x2b, 0x9b, 0x07, 0x12, 0xcb, 0x0f, 0xf8, 0x0f, 0xfa, 0x58, 0x73, 0xfb, 0xc3, 0x65, 0x5b, 0x7f, - 0x14, 0x47, 0x66, 0x66, 0xc6, 0x10, 0x27, 0xd0, 0xdb, 0x93, 0x65, 0x64, 0xd2, 0x86, 0xca, 0xd4, - 0x1f, 0xdb, 0x53, 0xd6, 0xaa, 0x73, 0x2d, 0xec, 0x28, 0xcc, 0xa3, 0x92, 0xa2, 0xfd, 0xb3, 0x02, - 0x55, 0xa9, 0x47, 0xd2, 0x84, 0x8c, 0x26, 0xd5, 0x37, 0x48, 0x0d, 0x4a, 0xbb, 0xfd, 0xe1, 0xae, - 0xda, 0xe4, 0x4f, 0xa6, 0xfe, 0xbd, 0xa9, 0xae, 0x71, 0xcc, 0xee, 0x53, 0x53, 0x1f, 0x99, 0x94, - 0x63, 0x54, 0xb2, 0x0e, 0xab, 0x5d, 0x73, 0x78, 0x60, 0xed, 0x75, 0x4d, 0x7d, 0x7f, 0x48, 0x9f, - 0xaa, 0x05, 0xb2, 0x0a, 0x75, 0x24, 0xf5, 0x8d, 0xc1, 0x13, 0x55, 0xe1, 0x33, 0x70, 0x68, 0x1a, - 0x66, 0x5f, 0x57, 0x8b, 0x44, 0x85, 0x15, 0x31, 0x63, 0x38, 0x30, 0xf5, 0x81, 0xa9, 0x96, 0x52, - 0xca, 0xe8, 0xe8, 0xe0, 0xa0, 0x4b, 0x9f, 0xaa, 0x65, 0xb2, 0x06, 0x0d, 0xa4, 0x74, 0x8f, 0xcc, - 0xc7, 0x43, 0xaa, 0x56, 0x48, 0x03, 0xaa, 0xfb, 0x3d, 0xeb, 0xbb, 0xc7, 0xfa, 0x40, 0xad, 0x92, - 0x15, 0xa8, 0xed, 0xf7, 0x2c, 0xfd, 0xa0, 0x6b, 0xf4, 0xd5, 0x1a, 0x9f, 0xbd, 0xaf, 0x0f, 0xe9, - 0x68, 0x64, 0x1d, 0x0e, 0x8d, 0x81, 0xa9, 0xd6, 0x49, 0x1d, 0xca, 0xfb, 0x3d, 0xcb, 0x38, 0x50, - 0x81, 0x10, 0x68, 0xee, 0xf7, 0xac, 0xc3, 0xc7, 0xc3, 0x81, 0x3e, 0x38, 0x3a, 0xd8, 0xd5, 0xa9, - 0xda, 0x20, 0xb7, 0x40, 0xe5, 0xb4, 0xe1, 0xc8, 0xec, 0xf6, 0xbb, 0xbd, 0x1e, 0xd5, 0x47, 0x23, - 0x75, 0x85, 0x4b, 0xbd, 0xdf, 0xb3, 0x68, 0xd7, 0xe4, 0xfb, 0x5a, 0xe5, 0x2f, 0xe4, 0x7b, 0x7f, - 0xa2, 0x3f, 0x55, 0xd7, 0xf9, 0x2b, 0xf4, 0x81, 0x69, 0x98, 0x4f, 0xad, 0x43, 0x3a, 0x34, 0x87, - 0xea, 0x06, 0x17, 0xd0, 0x18, 0xf4, 0xf4, 0xef, 0xad, 0x6f, 0xbb, 0xfd, 0x23, 0x5d, 0x25, 0xda, - 0x8f, 0xe1, 0xf6, 0xd2, 0x33, 0xe1, 0xaa, 0x7b, 0x6c, 0x1e, 0xf4, 0xd5, 0x02, 0x7f, 0xe2, 0x9b, - 0x52, 0x15, 0xed, 0x0f, 0xa0, 0xc4, 0x5d, 0x86, 0x7c, 0x06, 0xd5, 0xc4, 0x1b, 0x0b, 0xe8, 0x8d, - 0x77, 0xb3, 0x67, 0x6d, 0xc7, 0x27, 0x9d, 0xc4, 0xe3, 0x12, 0x5c, 0xbb, 0x0b, 0xd5, 0x45, 0x4f, - 0x53, 0x2e, 0x78, 0x5a, 0xf1, 0x82, 0xa7, 0x95, 0x32, 0x9e, 0x66, 0x43, 0x3d, 0xf5, 0xed, 0x9b, - 0x47, 0x91, 0x07, 0x50, 0xe2, 0xde, 0xdf, 0x6a, 0xa2, 0x87, 0xac, 0x2d, 0x08, 0x4c, 0x91, 0xa9, - 0xfd, 0x43, 0x01, 0x4a, 0x3c, 0xda, 0x9e, 0x07, 0xda, 0xc2, 0x15, 0x81, 0x56, 0xb9, 0x32, 0xd0, - 0x16, 0xaf, 0x15, 0x68, 0x2b, 0x37, 0x0b, 0xb4, 0xd5, 0x4b, 0x02, 0xad, 0xf6, 0x67, 0x45, 0x68, - 0xe8, 0x38, 0xf3, 0x10, 0x13, 0xfd, 0xfb, 0x50, 0x7c, 0xce, 0xce, 0x50, 0x3f, 0x8d, 0xed, 0x5b, - 0x99, 0xdd, 0xa6, 0x2a, 0xa4, 0x1c, 0x40, 0xb6, 0x61, 0x45, 0xbc, 0xd0, 0x3a, 0x0e, 0xfd, 0x79, - 0xd0, 0x52, 0x97, 0xab, 0xa7, 0x21, 0x40, 0xfb, 0x1c, 0x43, 0xde, 0x83, 0xb2, 0xff, 0xc2, 0x63, - 0x21, 0xc6, 0xc1, 0x3c, 0x98, 0x2b, 0x8f, 0x0a, 0x2e, 0x79, 0x08, 0xa5, 0xe7, 0xae, 0xe7, 0xe0, - 0x19, 0xe6, 0x23, 0x61, 0x46, 0xd0, 0xce, 0x13, 0xd7, 0x73, 0x28, 0x02, 0xc9, 0x3d, 0xa8, 0xf1, - 0x5f, 0x8c, 0x7b, 0x65, 0xdc, 0x68, 0x95, 0x8f, 0x79, 0xd0, 0x7b, 0x08, 0xb5, 0x40, 0xc6, 0x10, - 0x4c, 0x00, 0x8d, 0xed, 0x8d, 0x25, 0xe1, 0x85, 0xa6, 0x20, 0xf2, 0x15, 0xac, 0x84, 0xf6, 0x0b, - 0x2b, 0x9d, 0xb4, 0x76, 0xf9, 0xa4, 0x46, 0x68, 0xbf, 0x48, 0x23, 0x38, 0x81, 0x52, 0x68, 0x7b, - 0xcf, 0x5b, 0x64, 0xb3, 0xb0, 0x55, 0xa6, 0xf8, 0xac, 0x7d, 0x01, 0x25, 0x2e, 0x25, 0x8f, 0x08, - 0xfb, 0x3d, 0xf4, 0xff, 0xee, 0x9e, 0xa9, 0x16, 0x12, 0x7f, 0xfe, 0x96, 0x47, 0x03, 0x45, 0x72, - 0x0f, 0xf4, 0xd1, 0xa8, 0xbb, 0xaf, 0xab, 0x45, 0xad, 0x07, 0xeb, 0x7b, 0xfe, 0x2c, 0xf0, 0x23, - 0x37, 0x66, 0xe9, 0xf2, 0xf7, 0xa0, 0xe6, 0x7a, 0x0e, 0x7b, 0x69, 0xb9, 0x0e, 0x9a, 0x56, 0x91, - 0x56, 0x71, 0x6c, 0x38, 0xdc, 0xe4, 0x4e, 0x65, 0x31, 0x55, 0xe4, 0x26, 0x87, 0x03, 0xed, 0x2f, - 0x15, 0x28, 0x1b, 0x1c, 0xc1, 0x8d, 0x4f, 0x9e, 0x14, 0x7a, 0x8f, 0x30, 0x4c, 0x10, 0x24, 0x93, - 0xfb, 0x50, 0x1b, 0x6a, 0xb6, 0x37, 0x66, 0xbc, 0xe2, 0xc3, 0x3c, 0x50, 0xa3, 0xe9, 0x98, 0x7c, - 0x99, 0xd1, 0x9f, 0x82, 0x2e, 0x7b, 0x2f, 0xa3, 0x0a, 0x7c, 0xc1, 0x12, 0x2d, 0xb6, 0xff, 0xaa, - 0x90, 0x49, 0x6e, 0xcb, 0x12, 0x4f, 0x1f, 0xea, 0x8e, 0x1b, 0x32, 0xac, 0x23, 0xe5, 0x41, 0x3f, - 0xb8, 0x74, 0xe1, 0x4e, 0x2f, 0x81, 0xee, 0xd4, 0xbb, 0xa3, 0x3d, 0x7d, 0xd0, 0xe3, 0x99, 0xef, - 0x7c, 0x01, 0xed, 0x23, 0xa8, 0xa7, 0x10, 0x0c, 0xc7, 0x09, 0x48, 0x2d, 0x70, 0xf5, 0xf6, 0xf4, - 0x74, 0xac, 0x68, 0x7f, 0xad, 0x40, 0x33, 0xd5, 0xaf, 0xd0, 0xd0, 0x6d, 0xa8, 0xd8, 0x41, 0x90, - 0xa8, 0xb6, 0x4e, 0xcb, 0x76, 0x10, 0x18, 0x8e, 0x8c, 0x2d, 0x0a, 0x6a, 0x9b, 0xc7, 0x96, 0x4f, - 0x01, 0x1c, 0x36, 0x71, 0x3d, 0x17, 0x85, 0x2e, 0xa2, 0xc1, 0xab, 0x8b, 0x42, 0xd3, 0x0c, 0x86, - 0x7c, 0x09, 0xe5, 0x28, 0xb6, 0x63, 0x91, 0x2b, 0x9b, 0xdb, 0xf7, 0x33, 0xe0, 0xbc, 0x08, 0x9d, - 0x11, 0x87, 0x51, 0x81, 0x26, 0x5f, 0xc1, 0x2d, 0xdf, 0x9b, 0x9e, 0x59, 0xf3, 0x88, 0x59, 0xee, - 0xc4, 0x0a, 0xd9, 0x0f, 0x73, 0x37, 0x64, 0x4e, 0x3e, 0xa7, 0xae, 0x73, 0xc8, 0x51, 0xc4, 0x8c, - 0x09, 0x95, 0x7c, 0xed, 0x6b, 0x28, 0xe3, 0x3a, 0x7c, 0xcf, 0xdf, 0x51, 0xc3, 0xd4, 0xad, 0xe1, - 0xa0, 0xff, 0x54, 0xe8, 0x80, 0xea, 0xdd, 0x9e, 0x85, 0x44, 0x55, 0xe1, 0xc1, 0xbe, 0xa7, 0xf7, - 0x75, 0x53, 0xef, 0xa9, 0x45, 0x9e, 0x3d, 0x74, 0x4a, 0x87, 0x54, 0x2d, 0x69, 0xff, 0x53, 0x80, - 0x15, 0x94, 0xe7, 0xd0, 0x8f, 0xe2, 0x89, 0xfb, 0x92, 0xec, 0x41, 0x43, 0x98, 0xdd, 0xa9, 0x2c, - 0xe8, 0xb9, 0x33, 0x68, 0x8b, 0x7b, 0x96, 0x68, 0x31, 0x90, 0x75, 0xb4, 0x9b, 0x3e, 0x27, 0x21, - 0x45, 0x41, 0xa7, 0xbf, 0x22, 0xa4, 0xbc, 0x05, 0x95, 0x67, 0x6c, 0xe2, 0x87, 0x22, 0x04, 0xd6, - 0x76, 0x4a, 0x71, 0x38, 0x67, 0x54, 0xd2, 0xda, 0x36, 0xc0, 0xf9, 0xfa, 0xe4, 0x01, 0xac, 0x26, - 0xc6, 0x66, 0xa1, 0x71, 0x89, 0x93, 0x5b, 0x49, 0x88, 0x83, 0x5c, 0x75, 0xa3, 0x5c, 0xab, 0xba, - 0xd1, 0xbe, 0x86, 0xd5, 0x64, 0x3f, 0xe2, 0xfc, 0x54, 0x21, 0x79, 0x01, 0x63, 0xca, 0x82, 0x8c, - 0xca, 0x45, 0x19, 0xb5, 0x9f, 0x41, 0x6d, 0xe4, 0xd9, 0x41, 0x74, 0xe2, 0xc7, 0xdc, 0x7a, 0xe2, - 0x48, 0xfa, 0xaa, 0x12, 0x47, 0x9a, 0x06, 0x15, 0x7e, 0x38, 0xf3, 0x88, 0xbb, 0xbf, 0x31, 0xe8, - 0xee, 0x99, 0xc6, 0xb7, 0xba, 0xfa, 0x06, 0x01, 0xa8, 0xc8, 0xe7, 0x82, 0xa6, 0x41, 0xd3, 0x90, - 0xed, 0xd8, 0x63, 0x66, 0x3b, 0x2c, 0xe4, 0x12, 0xfc, 0xe0, 0x47, 0x89, 0x04, 0x3f, 0xf8, 0x91, - 0xf6, 0x17, 0x05, 0x68, 0x98, 0xa1, 0xed, 0x45, 0xb6, 0x30, 0xf7, 0xcf, 0xa0, 0x72, 0x82, 0x58, - 0x74, 0xa3, 0xc6, 0x82, 0x7f, 0x66, 0x17, 0xa3, 0x12, 0x48, 0xee, 0x40, 0xe5, 0xc4, 0xf6, 0x9c, - 0xa9, 0xd0, 0x5a, 0x85, 0xca, 0x51, 0x92, 0x1b, 0x95, 0xf3, 0xdc, 0xb8, 0x05, 0x2b, 0x33, 0x3b, - 0x7c, 0x6e, 0x8d, 0x4f, 0x6c, 0xef, 0x98, 0x45, 0xf2, 0x60, 0xa4, 0x05, 0x36, 0x38, 0x6b, 0x4f, - 0x70, 0xb4, 0xbf, 0x5f, 0x81, 0xf2, 0x37, 0x73, 0x16, 0x9e, 0x65, 0x04, 0xfa, 0xe0, 0xba, 0x02, - 0xc9, 0x17, 0x17, 0x2e, 0x4b, 0xca, 0x6f, 0x2f, 0x26, 0x65, 0x22, 0x53, 0x84, 0xc8, 0x95, 0x22, - 0x0b, 0x7c, 0x9a, 0x09, 0x63, 0xeb, 0x57, 0xd8, 0xda, 0x79, 0x70, 0x7b, 0x08, 0x95, 0x89, 0x3b, - 0x8d, 0x51, 0x75, 0x8b, 0xd5, 0x08, 0xee, 0xa5, 0xf3, 0x08, 0xd9, 0x54, 0xc2, 0xc8, 0xbb, 0xb0, - 0x22, 0x2a, 0x59, 0xeb, 0x07, 0xce, 0xc6, 0x82, 0x95, 0xf7, 0xa6, 0x48, 0x13, 0xbb, 0xff, 0x18, - 0xca, 0x7e, 0xc8, 0x37, 0x5f, 0xc7, 0x25, 0xef, 0x5c, 0x58, 0x72, 0xc8, 0xb9, 0x54, 0x80, 0xc8, - 0x87, 0x50, 0x3a, 0x71, 0xbd, 0x18, 0xb3, 0x46, 0x73, 0xfb, 0xf6, 0x05, 0xf0, 0x63, 0xd7, 0x8b, - 0x29, 0x42, 0x78, 0x98, 0x1f, 0xfb, 0x73, 0x2f, 0x6e, 0xdd, 0xc5, 0x0c, 0x23, 0x06, 0xe4, 0x1e, - 0x54, 0xfc, 0xc9, 0x24, 0x62, 0x31, 0x76, 0x96, 0xe5, 0x9d, 0xc2, 0xa7, 0x54, 0x12, 0xf8, 0x84, - 0xa9, 0x3b, 0x73, 0x63, 0xec, 0x43, 0xca, 0x54, 0x0c, 0xc8, 0x2e, 0xac, 0x8d, 0xfd, 0x59, 0xe0, - 0x4e, 0x99, 0x63, 0x8d, 0xe7, 0x61, 0xe4, 0x87, 0xad, 0x77, 0x2e, 0x1c, 0xd3, 0x9e, 0x44, 0xec, - 0x21, 0x80, 0x36, 0xc7, 0xb9, 0x31, 0x31, 0x60, 0x83, 0x79, 0x8e, 0xb5, 0xb8, 0xce, 0xfd, 0xd7, - 0xad, 0xb3, 0xce, 0x3c, 0x27, 0x4f, 0x4a, 0xc4, 0xc1, 0x48, 0x68, 0x61, 0xcc, 0x68, 0x6d, 0x60, - 0x90, 0xb9, 0x77, 0x69, 0xac, 0x14, 0xe2, 0x64, 0xc2, 0xf7, 0x6f, 0xc0, 0x2d, 0x19, 0x22, 0xad, - 0x80, 0x85, 0x13, 0x36, 0x8e, 0xad, 0x60, 0x6a, 0x7b, 0x58, 0xca, 0xa5, 0xc6, 0x4a, 0x24, 0xe4, - 0x50, 0x20, 0x0e, 0xa7, 0xb6, 0x47, 0x34, 0xa8, 0x3f, 0x67, 0x67, 0x91, 0xc5, 0x23, 0x29, 0x76, - 0xae, 0x29, 0xba, 0xc6, 0xe9, 0x43, 0x6f, 0x7a, 0x46, 0x7e, 0x02, 0x8d, 0xf8, 0xdc, 0xdb, 0xb0, - 0x61, 0x6d, 0xe4, 0x4e, 0x35, 0xe3, 0x8b, 0x34, 0x0b, 0x25, 0xf7, 0xa1, 0x2a, 0x35, 0xd4, 0xba, - 0x97, 0x5d, 0x3b, 0xa1, 0xf2, 0xc4, 0x3c, 0xb1, 0xdd, 0xa9, 0x7f, 0xca, 0x42, 0x6b, 0x16, 0xb5, - 0xda, 0xe2, 0xb6, 0x24, 0x21, 0x1d, 0x44, 0xdc, 0x4f, 0xa3, 0x38, 0xf4, 0xbd, 0xe3, 0xd6, 0x26, - 0xde, 0x93, 0xc8, 0xd1, 0xc5, 0xe0, 0xf7, 0x2e, 0x66, 0xfe, 0x7c, 0xf0, 0xfb, 0x1c, 0xee, 0x60, - 0x65, 0x66, 0x3d, 0x3b, 0xb3, 0xf2, 0x68, 0x0d, 0xd1, 0x1b, 0xc8, 0xdd, 0x3d, 0x3b, 0xcc, 0x4e, - 0x6a, 0x43, 0xcd, 0x71, 0xa3, 0xd8, 0xf5, 0xc6, 0x71, 0xab, 0x85, 0xef, 0x4c, 0xc7, 0xe4, 0x33, - 0xb8, 0x3d, 0x73, 0x3d, 0x2b, 0xb2, 0x27, 0xcc, 0x8a, 0x5d, 0xee, 0x9b, 0x6c, 0xec, 0x7b, 0x4e, - 0xd4, 0x7a, 0x80, 0x82, 0x93, 0x99, 0xeb, 0x8d, 0xec, 0x09, 0x33, 0xdd, 0x19, 0x1b, 0x09, 0x0e, - 0xf9, 0x08, 0xd6, 0x11, 0x1e, 0xb2, 0x60, 0xea, 0x8e, 0x6d, 0xf1, 0xfa, 0x1f, 0xe1, 0xeb, 0xd7, - 0x38, 0x83, 0x0a, 0x3a, 0xbe, 0xfa, 0x63, 0x68, 0x06, 0x2c, 0x8c, 0xdc, 0x28, 0xb6, 0xa4, 0x45, - 0xbf, 0x97, 0xd5, 0xda, 0xaa, 0x64, 0x0e, 0x91, 0xd7, 0xfe, 0xcf, 0x02, 0x54, 0x84, 0x73, 0x92, - 0x4f, 0x41, 0xf1, 0x03, 0xbc, 0x06, 0x69, 0x6e, 0x6f, 0x5e, 0xe2, 0xc1, 0x9d, 0x61, 0xc0, 0xeb, - 0x5e, 0x3f, 0xa4, 0x8a, 0x1f, 0xdc, 0xb8, 0x28, 0xd4, 0xfe, 0x10, 0x6a, 0xc9, 0x02, 0xbc, 0xbc, - 0xe8, 0xeb, 0xa3, 0x91, 0x65, 0x3e, 0xee, 0x0e, 0xd4, 0x02, 0xb9, 0x03, 0x24, 0x1d, 0x5a, 0x43, - 0x6a, 0xe9, 0xdf, 0x1c, 0x75, 0xfb, 0xaa, 0x82, 0x5d, 0x1a, 0xd5, 0xbb, 0xa6, 0x4e, 0x05, 0xb2, - 0x48, 0xee, 0xc1, 0xed, 0x2c, 0xe5, 0x1c, 0x5c, 0xc2, 0x14, 0x8c, 0x8f, 0x65, 0x52, 0x01, 0xc5, - 0x18, 0xa8, 0x15, 0x9e, 0x16, 0xf4, 0xef, 0x8d, 0x91, 0x39, 0x52, 0xab, 0xed, 0xbf, 0x29, 0x40, - 0x19, 0xc3, 0x06, 0x3f, 0x9f, 0x54, 0x72, 0x71, 0x5d, 0x73, 0x5e, 0xb9, 0x1a, 0xd9, 0x92, 0xaa, - 0x81, 0x01, 0x65, 0x73, 0x79, 0xf4, 0xf9, 0xb5, 0xd6, 0x53, 0x3f, 0x85, 0x12, 0x8f, 0x52, 0xbc, - 0x43, 0x1c, 0xd2, 0x9e, 0x4e, 0xad, 0x47, 0x06, 0x1d, 0xf1, 0x2a, 0x97, 0x40, 0xb3, 0x3b, 0xd8, - 0xd3, 0x47, 0xe6, 0x30, 0xa1, 0xa1, 0x56, 0x1e, 0x19, 0x7d, 0x33, 0x45, 0x15, 0xb5, 0x9f, 0xd7, - 0x60, 0x35, 0x89, 0x09, 0x22, 0x82, 0x3e, 0x82, 0x46, 0x10, 0xba, 0x33, 0x3b, 0x3c, 0x8b, 0xc6, - 0xb6, 0x87, 0x49, 0x01, 0xb6, 0x7f, 0xb4, 0x24, 0xaa, 0x88, 0x1d, 0x1d, 0x0a, 0xec, 0x68, 0x6c, - 0x7b, 0x34, 0x3b, 0x91, 0xf4, 0x61, 0x75, 0xc6, 0xc2, 0x63, 0xf6, 0x7b, 0xbe, 0xeb, 0xe1, 0x4a, - 0x55, 0x8c, 0xc8, 0xef, 0x5f, 0xba, 0xd2, 0x01, 0x47, 0xff, 0x8e, 0xef, 0x7a, 0xb8, 0x56, 0x7e, - 0x32, 0xf9, 0x04, 0xea, 0xa2, 0x12, 0x72, 0xd8, 0x04, 0x63, 0xc5, 0xb2, 0xda, 0x4f, 0xd4, 0xe8, - 0x3d, 0x36, 0xc9, 0xc4, 0x65, 0xb8, 0x34, 0x2e, 0x37, 0xb2, 0x71, 0xf9, 0xcd, 0x6c, 0x2c, 0x5a, - 0x11, 0x55, 0x78, 0x1a, 0x84, 0x2e, 0x38, 0x7c, 0x6b, 0x89, 0xc3, 0x77, 0x60, 0x23, 0xf1, 0x55, - 0xcb, 0xf5, 0x26, 0xee, 0x4b, 0x2b, 0x72, 0x5f, 0x89, 0xd8, 0x53, 0xa6, 0xeb, 0x09, 0xcb, 0xe0, - 0x9c, 0x91, 0xfb, 0x8a, 0x11, 0x23, 0xe9, 0xe0, 0x64, 0x0e, 0x5c, 0xc5, 0xab, 0xc9, 0xf7, 0x2e, - 0x55, 0x8f, 0x68, 0xbe, 0x64, 0x46, 0xcc, 0x4d, 0x6d, 0xff, 0x52, 0x81, 0x46, 0xe6, 0x1c, 0x78, - 0xf6, 0x16, 0xca, 0x42, 0x61, 0xc5, 0x55, 0x94, 0x50, 0x1f, 0x4a, 0xfa, 0x26, 0xd4, 0xa3, 0xd8, - 0x0e, 0x63, 0x8b, 0x17, 0x57, 0xb2, 0xdd, 0x45, 0xc2, 0x13, 0x76, 0x46, 0x3e, 0x80, 0x35, 0xc1, - 0x74, 0xbd, 0xf1, 0x74, 0x1e, 0xb9, 0xa7, 0xa2, 0x99, 0xaf, 0xd1, 0x26, 0x92, 0x8d, 0x84, 0x4a, - 0xee, 0x42, 0x95, 0x67, 0x21, 0xbe, 0x86, 0x68, 0xfa, 0x2a, 0xcc, 0x73, 0xf8, 0x0a, 0x0f, 0x60, - 0x95, 0x33, 0xce, 0xe7, 0x57, 0xc4, 0x2d, 0x33, 0xf3, 0x9c, 0xf3, 0xd9, 0x1d, 0xd8, 0x10, 0xaf, - 0x09, 0x44, 0xf1, 0x2a, 0x2b, 0xdc, 0x3b, 0xa8, 0xd8, 0x75, 0x64, 0xc9, 0xb2, 0x56, 0x14, 0x9c, - 0x1f, 0x01, 0xcf, 0x5e, 0x0b, 0xe8, 0xbb, 0x22, 0x94, 0x31, 0xcf, 0xc9, 0x61, 0x77, 0xe1, 0x1d, - 0x8e, 0x9d, 0x7b, 0x76, 0x10, 0x4c, 0x5d, 0xe6, 0x58, 0x53, 0xff, 0x18, 0x43, 0x66, 0x14, 0xdb, - 0xb3, 0xc0, 0x9a, 0x47, 0xad, 0x0d, 0x0c, 0x99, 0x6d, 0xe6, 0x39, 0x47, 0x09, 0xa8, 0xef, 0x1f, - 0x9b, 0x09, 0xe4, 0x28, 0x6a, 0xff, 0x3e, 0xac, 0xe6, 0xec, 0x71, 0x41, 0xa7, 0x35, 0x74, 0xfe, - 0x8c, 0x4e, 0xdf, 0x85, 0x95, 0x20, 0x64, 0xe7, 0xa2, 0xd5, 0x51, 0xb4, 0x86, 0xa0, 0x09, 0xb1, - 0xb6, 0x60, 0x05, 0x79, 0x96, 0x20, 0xe6, 0xf3, 0x63, 0x03, 0x59, 0x87, 0xc8, 0x69, 0xbf, 0x80, - 0x95, 0xec, 0x69, 0x93, 0x77, 0x33, 0x69, 0xa1, 0x99, 0xcb, 0x93, 0x69, 0x76, 0x48, 0x2a, 0xb2, - 0xf5, 0x4b, 0x2a, 0x32, 0x72, 0x9d, 0x8a, 0x4c, 0xfb, 0x2f, 0xd9, 0x9c, 0x65, 0x2a, 0x84, 0x9f, - 0x41, 0x2d, 0x90, 0xf5, 0x38, 0x5a, 0x52, 0xfe, 0x12, 0x3e, 0x0f, 0xee, 0x24, 0x95, 0x3b, 0x4d, - 0xe7, 0xb4, 0xff, 0x56, 0x81, 0x5a, 0x5a, 0xd0, 0xe7, 0x2c, 0xef, 0xcd, 0x05, 0xcb, 0x3b, 0x90, - 0x1a, 0x16, 0x0a, 0x7c, 0x1b, 0xa3, 0xc5, 0x27, 0xaf, 0x7f, 0xd7, 0xc5, 0xb6, 0xe7, 0x34, 0xdb, - 0xf6, 0x6c, 0xbe, 0xae, 0xed, 0xf9, 0xe4, 0xa2, 0xc1, 0xbf, 0x95, 0xe9, 0x2d, 0x16, 0xcc, 0xbe, - 0xfd, 0x7d, 0xae, 0x0f, 0xca, 0x26, 0x84, 0x77, 0xc4, 0x7e, 0xd2, 0x84, 0x90, 0xb6, 0x3f, 0xf7, - 0xaf, 0xd7, 0xfe, 0x6c, 0x43, 0x45, 0xea, 0xfc, 0x0e, 0x54, 0x64, 0x4d, 0x27, 0x1b, 0x04, 0x31, - 0x3a, 0x6f, 0x10, 0x0a, 0xb2, 0x4e, 0xd7, 0x7e, 0xae, 0x40, 0x59, 0x0f, 0x43, 0x3f, 0xd4, 0xfe, - 0x48, 0x81, 0x3a, 0x3e, 0xed, 0xf9, 0x0e, 0xe3, 0xd9, 0x60, 0xb7, 0xdb, 0xb3, 0xa8, 0xfe, 0xcd, - 0x91, 0x8e, 0xd9, 0xa0, 0x0d, 0x77, 0xf6, 0x86, 0x83, 0xbd, 0x23, 0x4a, 0xf5, 0x81, 0x69, 0x99, - 0xb4, 0x3b, 0x18, 0xf1, 0xb6, 0x67, 0x38, 0x50, 0x15, 0x9e, 0x29, 0x8c, 0x81, 0xa9, 0xd3, 0x41, - 0xb7, 0x6f, 0x89, 0x56, 0xb4, 0x88, 0x77, 0xb3, 0xba, 0xde, 0xb3, 0xf0, 0xd6, 0x51, 0x2d, 0xf1, - 0x96, 0xd5, 0x34, 0x0e, 0xf4, 0xe1, 0x91, 0xa9, 0x96, 0xc9, 0x6d, 0x58, 0x3f, 0xd4, 0xe9, 0x81, - 0x31, 0x1a, 0x19, 0xc3, 0x81, 0xd5, 0xd3, 0x07, 0x86, 0xde, 0x53, 0x2b, 0x7c, 0x9d, 0x5d, 0x63, - 0xdf, 0xec, 0xee, 0xf6, 0x75, 0xb9, 0x4e, 0x95, 0x6c, 0xc2, 0x5b, 0x7b, 0xc3, 0x83, 0x03, 0xc3, - 0x34, 0xf5, 0x9e, 0xb5, 0x7b, 0x64, 0x5a, 0x23, 0xd3, 0xe8, 0xf7, 0xad, 0xee, 0xe1, 0x61, 0xff, - 0x29, 0x4f, 0x60, 0x35, 0x72, 0x17, 0x36, 0xf6, 0xba, 0x87, 0xdd, 0x5d, 0xa3, 0x6f, 0x98, 0x4f, - 0xad, 0x9e, 0x31, 0xe2, 0xf3, 0x7b, 0x6a, 0x9d, 0x27, 0x6c, 0x93, 0x3e, 0xb5, 0xba, 0x7d, 0x14, - 0xcd, 0xd4, 0xad, 0xdd, 0xee, 0xde, 0x13, 0x7d, 0xd0, 0x53, 0x81, 0x0b, 0x30, 0xea, 0x3e, 0xd2, - 0x2d, 0x2e, 0x92, 0x65, 0x0e, 0x87, 0xd6, 0xb0, 0xdf, 0x53, 0x1b, 0xda, 0xbf, 0x14, 0xa1, 0xb4, - 0xe7, 0x47, 0x31, 0xf7, 0x46, 0xe1, 0xac, 0x2f, 0x42, 0x37, 0x66, 0xa2, 0x7f, 0x2b, 0x53, 0xd1, - 0x4b, 0x7f, 0x87, 0x24, 0x1e, 0x50, 0x32, 0x10, 0xeb, 0xd9, 0x19, 0xc7, 0x29, 0x88, 0x5b, 0x3b, - 0xc7, 0xed, 0x72, 0xb2, 0x88, 0x68, 0x78, 0x85, 0x23, 0xd7, 0x2b, 0x22, 0x4e, 0x06, 0x61, 0xb9, - 0xe0, 0xc7, 0x40, 0xb2, 0x20, 0xb9, 0x62, 0x09, 0x91, 0x6a, 0x06, 0x29, 0x96, 0xdc, 0x01, 0x18, - 0xfb, 0xb3, 0x99, 0x1b, 0x8f, 0xfd, 0x28, 0x96, 0x5f, 0xc8, 0xda, 0x39, 0x63, 0x8f, 0x62, 0x6e, - 0xf1, 0x33, 0x37, 0xe6, 0x8f, 0x34, 0x83, 0x26, 0x3b, 0x70, 0xcf, 0x0e, 0x82, 0xd0, 0x7f, 0xe9, - 0xce, 0xec, 0x98, 0x59, 0xdc, 0x73, 0xed, 0x63, 0x66, 0x39, 0x6c, 0x1a, 0xdb, 0xd8, 0x13, 0x95, - 0xe9, 0xdd, 0x0c, 0x60, 0x24, 0xf8, 0x3d, 0xce, 0xe6, 0x71, 0xd7, 0x75, 0xac, 0x88, 0xfd, 0x30, - 0xe7, 0x1e, 0x60, 0xcd, 0x03, 0xc7, 0xe6, 0x62, 0xd6, 0x45, 0x96, 0x72, 0x9d, 0x91, 0xe4, 0x1c, - 0x09, 0x46, 0xfb, 0x15, 0xc0, 0xb9, 0x14, 0x64, 0x1b, 0x6e, 0xf3, 0x3a, 0x9e, 0x45, 0x31, 0x73, - 0x2c, 0xb9, 0xdb, 0x60, 0x1e, 0x47, 0x18, 0xe2, 0xcb, 0x74, 0x23, 0x65, 0xca, 0x9b, 0xc2, 0x79, - 0x1c, 0x91, 0x9f, 0x40, 0xeb, 0xc2, 0x1c, 0x87, 0x4d, 0x19, 0x7f, 0x6d, 0x15, 0xa7, 0xdd, 0x59, - 0x98, 0xd6, 0x13, 0x5c, 0xed, 0x4f, 0x14, 0x80, 0x7d, 0x16, 0x53, 0xc1, 0xcd, 0x34, 0xb6, 0x95, - 0xeb, 0x36, 0xb6, 0xef, 0x27, 0x17, 0x08, 0xc5, 0xab, 0x63, 0xc0, 0x42, 0x97, 0xa1, 0xdc, 0xa4, - 0xcb, 0xc8, 0x35, 0x11, 0xc5, 0x2b, 0x9a, 0x88, 0x52, 0xae, 0x89, 0xf8, 0x18, 0x9a, 0xf6, 0x74, - 0xea, 0xbf, 0xe0, 0x05, 0x0d, 0x0b, 0x43, 0xe6, 0xa0, 0x11, 0x9c, 0xd7, 0xdb, 0xc8, 0xec, 0x49, - 0x9e, 0xf6, 0xe7, 0x0a, 0x34, 0x50, 0x15, 0x51, 0xe0, 0x7b, 0x11, 0x23, 0x5f, 0x42, 0x45, 0x5e, - 0x44, 0x8b, 0x8b, 0xfc, 0xb7, 0x33, 0xb2, 0x66, 0x70, 0xb2, 0x68, 0xa0, 0x12, 0xcc, 0x33, 0x42, - 0xe6, 0x75, 0x97, 0x2b, 0x25, 0x45, 0x91, 0xfb, 0x50, 0x73, 0x3d, 0x4b, 0xb4, 0xd4, 0x95, 0x4c, - 0x58, 0xac, 0xba, 0x1e, 0xd6, 0xb2, 0xed, 0x57, 0x50, 0x11, 0x2f, 0x21, 0x9d, 0x54, 0xa6, 0x8b, - 0xfa, 0xcb, 0xdc, 0x1c, 0xa7, 0xc2, 0xc8, 0xc3, 0x29, 0xbd, 0x2e, 0x40, 0xb7, 0xa0, 0x7a, 0xca, - 0x9b, 0x0f, 0xbc, 0xf4, 0xe3, 0xea, 0x4d, 0x86, 0xda, 0x1f, 0x97, 0x00, 0x0e, 0xe7, 0x4b, 0x0c, - 0xa4, 0x71, 0x5d, 0x03, 0xe9, 0xe4, 0xf4, 0xf8, 0x7a, 0x99, 0x7f, 0x75, 0x43, 0x59, 0xd2, 0x69, - 0x17, 0x6f, 0xda, 0x69, 0xdf, 0x87, 0x6a, 0x1c, 0xce, 0xb9, 0xa3, 0x08, 0x63, 0x4a, 0x5b, 0x5a, - 0x49, 0x25, 0x6f, 0x42, 0x79, 0xe2, 0x87, 0x63, 0x86, 0x8e, 0x95, 0xb2, 0x05, 0xed, 0xc2, 0x65, - 0x52, 0xed, 0xb2, 0xcb, 0x24, 0xde, 0xa0, 0x45, 0xf2, 0x1e, 0x0d, 0x0b, 0x99, 0x7c, 0x83, 0x96, - 0x5c, 0xb1, 0xd1, 0x14, 0x44, 0xbe, 0x81, 0xa6, 0x3d, 0x8f, 0x7d, 0xcb, 0xe5, 0x15, 0xda, 0xd4, - 0x1d, 0x9f, 0x61, 0xd9, 0xdd, 0xcc, 0x7f, 0xaf, 0x4f, 0x0f, 0xaa, 0xd3, 0x9d, 0xc7, 0xbe, 0xe1, - 0x1c, 0x22, 0x72, 0xa7, 0x2a, 0x93, 0x12, 0x5d, 0xb1, 0x33, 0x64, 0xed, 0xc7, 0xb0, 0x92, 0x85, - 0xf1, 0x04, 0x24, 0x81, 0xea, 0x1b, 0x3c, 0x3b, 0x8d, 0x78, 0x6a, 0x1b, 0x98, 0x46, 0xb7, 0xaf, - 0x16, 0xb4, 0x18, 0x1a, 0xb8, 0xbc, 0xf4, 0x8e, 0xeb, 0xba, 0xfd, 0x03, 0x28, 0x61, 0xf8, 0x55, - 0x2e, 0x7c, 0x0f, 0xc1, 0x98, 0x8b, 0xcc, 0xbc, 0xf9, 0x15, 0xb3, 0xe6, 0xf7, 0xdf, 0x05, 0x58, - 0x31, 0xfd, 0xf9, 0xf8, 0xe4, 0xa2, 0x01, 0xc2, 0xaf, 0x3b, 0x42, 0x2d, 0x31, 0x1f, 0xe5, 0xa6, - 0xe6, 0x93, 0x5a, 0x47, 0x71, 0x89, 0x75, 0xdc, 0xf4, 0xcc, 0xb5, 0x2f, 0x60, 0x55, 0x6e, 0x5e, - 0x6a, 0x3d, 0xd1, 0x66, 0xe1, 0x0a, 0x6d, 0x6a, 0xbf, 0x50, 0x60, 0x55, 0xc4, 0xf7, 0xff, 0xbb, - 0xd2, 0x2a, 0x37, 0x0c, 0xeb, 0xe5, 0x1b, 0x5d, 0x1e, 0xfd, 0xbf, 0xf4, 0x34, 0x6d, 0x08, 0xcd, - 0x44, 0x7d, 0x37, 0x50, 0xfb, 0x15, 0x46, 0xfc, 0x8b, 0x02, 0x34, 0x06, 0xec, 0xe5, 0x92, 0x20, - 0x5a, 0xbe, 0xee, 0x71, 0x7c, 0x98, 0x2b, 0x57, 0x1b, 0xdb, 0xeb, 0x59, 0x19, 0xc4, 0xd5, 0x63, - 0x52, 0xc1, 0xa6, 0xb7, 0xa8, 0xca, 0xf2, 0x5b, 0xd4, 0xd2, 0x62, 0xb7, 0x9e, 0xb9, 0xc5, 0x2b, - 0x2e, 0xbb, 0xc5, 0xd3, 0xfe, 0xad, 0x08, 0x0d, 0x6c, 0x90, 0x29, 0x8b, 0xe6, 0xd3, 0x38, 0x27, - 0x4c, 0xe1, 0x6a, 0x61, 0x3a, 0x50, 0x09, 0x71, 0x92, 0x74, 0xa5, 0x4b, 0x83, 0xbf, 0x40, 0x61, - 0x6b, 0xfc, 0xdc, 0x0d, 0x02, 0xe6, 0x58, 0x82, 0x92, 0x14, 0x30, 0x4d, 0x49, 0x16, 0x22, 0x44, - 0xbc, 0xfc, 0x9c, 0xf9, 0x21, 0x4b, 0x51, 0x45, 0xbc, 0x4f, 0x68, 0x70, 0x5a, 0x02, 0xc9, 0xdd, - 0x37, 0x88, 0xca, 0xe0, 0xfc, 0xbe, 0x21, 0xed, 0x35, 0x91, 0x5b, 0x47, 0xae, 0xe8, 0x35, 0x91, - 0xcd, 0xbb, 0xa8, 0x99, 0x3d, 0x9d, 0x5a, 0x7e, 0x10, 0xa1, 0xd3, 0xd4, 0x68, 0x0d, 0x09, 0xc3, - 0x20, 0x22, 0x5f, 0x43, 0x7a, 0x5d, 0x2c, 0x6f, 0xc9, 0xc5, 0x39, 0xb6, 0x2e, 0xbb, 0x58, 0xa0, - 0xab, 0xe3, 0xdc, 0xfd, 0xcf, 0x92, 0x1b, 0xea, 0xca, 0x4d, 0x6f, 0xa8, 0x1f, 0x42, 0x59, 0xc4, - 0xa8, 0xda, 0xeb, 0x62, 0x94, 0xc0, 0x65, 0xed, 0xb3, 0x91, 0xb7, 0xcf, 0x5f, 0x16, 0x80, 0x74, - 0xa7, 0x53, 0x7f, 0x6c, 0xc7, 0xcc, 0x70, 0xa2, 0x8b, 0x66, 0x7a, 0xed, 0xcf, 0x2e, 0x9f, 0x41, - 0x7d, 0xe6, 0x3b, 0x6c, 0x6a, 0x25, 0xdf, 0x94, 0x2e, 0xad, 0x7e, 0x10, 0xc6, 0x5b, 0x52, 0x02, - 0x25, 0xbc, 0xc4, 0x51, 0xb0, 0xee, 0xc0, 0x67, 0xde, 0x84, 0xcd, 0xec, 0x97, 0xb2, 0x14, 0xe1, - 0x8f, 0xa4, 0x03, 0xd5, 0x90, 0x45, 0x2c, 0x3c, 0x65, 0x57, 0x16, 0x55, 0x09, 0x48, 0x7b, 0x06, - 0x1b, 0xb9, 0x1d, 0x49, 0x47, 0xbe, 0x85, 0x5f, 0x2b, 0xc3, 0x58, 0x7e, 0xb4, 0x12, 0x03, 0xfe, - 0x3a, 0xe6, 0x25, 0x9f, 0x41, 0xf9, 0x63, 0xea, 0xf0, 0xc5, 0xab, 0xe2, 0xec, 0x1e, 0xa8, 0x59, - 0x4d, 0xbb, 0x63, 0x0c, 0x36, 0xf2, 0x54, 0x0a, 0xd7, 0x3b, 0x15, 0xed, 0xef, 0x0a, 0xb0, 0xde, - 0x75, 0x1c, 0xf1, 0x77, 0xc3, 0x25, 0xaa, 0x2f, 0x5e, 0x57, 0xf5, 0x0b, 0x81, 0x58, 0x84, 0x89, - 0x6b, 0x05, 0xe2, 0x0f, 0xa1, 0x92, 0xd6, 0x5a, 0xc5, 0x05, 0x77, 0x16, 0x72, 0x51, 0x09, 0xd0, - 0x6e, 0x01, 0xc9, 0x0a, 0x2b, 0xb4, 0xaa, 0xfd, 0x69, 0x11, 0xee, 0xee, 0xb2, 0x63, 0xd7, 0xcb, - 0xbe, 0xe2, 0x57, 0xdf, 0xc9, 0xc5, 0x4f, 0x65, 0x9f, 0xc1, 0xba, 0x28, 0xe4, 0x93, 0x7f, 0x62, - 0x59, 0xec, 0x58, 0x7e, 0x9d, 0x94, 0xb1, 0x6a, 0x0d, 0xf9, 0x07, 0x92, 0xad, 0xe3, 0x7f, 0xc5, - 0x1c, 0x3b, 0xb6, 0x9f, 0xd9, 0x11, 0xb3, 0x5c, 0x47, 0xfe, 0x59, 0x06, 0x12, 0x92, 0xe1, 0x90, - 0x21, 0x94, 0xb8, 0x0d, 0xa2, 0xeb, 0x36, 0xb7, 0xb7, 0x33, 0x62, 0x5d, 0xb2, 0x95, 0xac, 0x02, - 0x0f, 0x7c, 0x87, 0xed, 0x54, 0x8f, 0x06, 0x4f, 0x06, 0xc3, 0xef, 0x06, 0x14, 0x17, 0x22, 0x06, - 0xdc, 0x0a, 0x42, 0x76, 0xea, 0xfa, 0xf3, 0xc8, 0xca, 0x9e, 0x44, 0xf5, 0xca, 0x94, 0xb8, 0x91, - 0xcc, 0xc9, 0x10, 0xb5, 0x9f, 0xc2, 0xda, 0xc2, 0xcb, 0x78, 0x6d, 0x26, 0x5f, 0xa7, 0xbe, 0x41, - 0x56, 0xa1, 0x8e, 0x1f, 0xbb, 0x97, 0x7f, 0xfb, 0xd6, 0xfe, 0xb5, 0x80, 0x57, 0x4c, 0x33, 0x37, - 0xbe, 0x59, 0x06, 0xfb, 0xcd, 0x7c, 0x06, 0x83, 0xed, 0x77, 0xf3, 0xe6, 0x9b, 0x59, 0xb0, 0xf3, - 0xad, 0x00, 0xa6, 0x41, 0xa4, 0x6d, 0x43, 0x55, 0xd2, 0xc8, 0x6f, 0xc1, 0x5a, 0xe8, 0xfb, 0x71, - 0xd2, 0x89, 0x8a, 0x0e, 0xe4, 0xf2, 0x3f, 0xdb, 0xac, 0x72, 0xb0, 0x48, 0x06, 0x4f, 0xf2, 0xbd, - 0x48, 0x59, 0xfc, 0x0d, 0x44, 0x0e, 0x77, 0x1b, 0xbf, 0x5b, 0x4f, 0xff, 0xb7, 0xfb, 0xbf, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x35, 0x9f, 0x30, 0x98, 0xf2, 0x2b, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto b/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto deleted file mode 100644 index 497b4d9a9..000000000 --- a/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto +++ /dev/null @@ -1,551 +0,0 @@ -syntax = "proto2"; -option go_package = "datastore"; - -package appengine; - -message Action{} - -message PropertyValue { - optional int64 int64Value = 1; - optional bool booleanValue = 2; - optional string stringValue = 3; - optional double doubleValue = 4; - - optional group PointValue = 5 { - required double x = 6; - required double y = 7; - } - - optional group UserValue = 8 { - required string email = 9; - required string auth_domain = 10; - optional string nickname = 11; - optional string federated_identity = 21; - optional string federated_provider = 22; - } - - optional group ReferenceValue = 12 { - required string app = 13; - optional string name_space = 20; - repeated group PathElement = 14 { - required string type = 15; - optional int64 id = 16; - optional string name = 17; - } - } -} - -message Property { - enum Meaning { - NO_MEANING = 0; - BLOB = 14; - TEXT = 15; - BYTESTRING = 16; - - ATOM_CATEGORY = 1; - ATOM_LINK = 2; - ATOM_TITLE = 3; - ATOM_CONTENT = 4; - ATOM_SUMMARY = 5; - ATOM_AUTHOR = 6; - - GD_WHEN = 7; - GD_EMAIL = 8; - GEORSS_POINT = 9; - GD_IM = 10; - - GD_PHONENUMBER = 11; - GD_POSTALADDRESS = 12; - - GD_RATING = 13; - - BLOBKEY = 17; - ENTITY_PROTO = 19; - - INDEX_VALUE = 18; - }; - - optional Meaning meaning = 1 [default = NO_MEANING]; - optional string meaning_uri = 2; - - required string name = 3; - - required PropertyValue value = 5; - - required bool multiple = 4; - - optional bool searchable = 6 [default=false]; - - enum FtsTokenizationOption { - HTML = 1; - ATOM = 2; - } - - optional FtsTokenizationOption fts_tokenization_option = 8; - - optional string locale = 9 [default = "en"]; -} - -message Path { - repeated group Element = 1 { - required string type = 2; - optional int64 id = 3; - optional string name = 4; - } -} - -message Reference { - required string app = 13; - optional string name_space = 20; - required Path path = 14; -} - -message User { - required string email = 1; - required string auth_domain = 2; - optional string nickname = 3; - optional string federated_identity = 6; - optional string federated_provider = 7; -} - -message EntityProto { - required Reference key = 13; - required Path entity_group = 16; - optional User owner = 17; - - enum Kind { - GD_CONTACT = 1; - GD_EVENT = 2; - GD_MESSAGE = 3; - } - optional Kind kind = 4; - optional string kind_uri = 5; - - repeated Property property = 14; - repeated Property raw_property = 15; - - optional int32 rank = 18; -} - -message CompositeProperty { - required int64 index_id = 1; - repeated string value = 2; -} - -message Index { - required string entity_type = 1; - required bool ancestor = 5; - repeated group Property = 2 { - required string name = 3; - enum Direction { - ASCENDING = 1; - DESCENDING = 2; - } - optional Direction direction = 4 [default = ASCENDING]; - } -} - -message CompositeIndex { - required string app_id = 1; - required int64 id = 2; - required Index definition = 3; - - enum State { - WRITE_ONLY = 1; - READ_WRITE = 2; - DELETED = 3; - ERROR = 4; - } - required State state = 4; - - optional bool only_use_if_required = 6 [default = false]; -} - -message IndexPostfix { - message IndexValue { - required string property_name = 1; - required PropertyValue value = 2; - } - - repeated IndexValue index_value = 1; - - optional Reference key = 2; - - optional bool before = 3 [default=true]; -} - -message IndexPosition { - optional string key = 1; - - optional bool before = 2 [default=true]; -} - -message Snapshot { - enum Status { - INACTIVE = 0; - ACTIVE = 1; - } - - required int64 ts = 1; -} - -message InternalHeader { - optional string qos = 1; -} - -message Transaction { - optional InternalHeader header = 4; - required fixed64 handle = 1; - required string app = 2; - optional bool mark_changes = 3 [default = false]; -} - -message Query { - optional InternalHeader header = 39; - - required string app = 1; - optional string name_space = 29; - - optional string kind = 3; - optional Reference ancestor = 17; - - repeated group Filter = 4 { - enum Operator { - LESS_THAN = 1; - LESS_THAN_OR_EQUAL = 2; - GREATER_THAN = 3; - GREATER_THAN_OR_EQUAL = 4; - EQUAL = 5; - IN = 6; - EXISTS = 7; - } - - required Operator op = 6; - repeated Property property = 14; - } - - optional string search_query = 8; - - repeated group Order = 9 { - enum Direction { - ASCENDING = 1; - DESCENDING = 2; - } - - required string property = 10; - optional Direction direction = 11 [default = ASCENDING]; - } - - enum Hint { - ORDER_FIRST = 1; - ANCESTOR_FIRST = 2; - FILTER_FIRST = 3; - } - optional Hint hint = 18; - - optional int32 count = 23; - - optional int32 offset = 12 [default = 0]; - - optional int32 limit = 16; - - optional CompiledCursor compiled_cursor = 30; - optional CompiledCursor end_compiled_cursor = 31; - - repeated CompositeIndex composite_index = 19; - - optional bool require_perfect_plan = 20 [default = false]; - - optional bool keys_only = 21 [default = false]; - - optional Transaction transaction = 22; - - optional bool compile = 25 [default = false]; - - optional int64 failover_ms = 26; - - optional bool strong = 32; - - repeated string property_name = 33; - - repeated string group_by_property_name = 34; - - optional bool distinct = 24; - - optional int64 min_safe_time_seconds = 35; - - repeated string safe_replica_name = 36; - - optional bool persist_offset = 37 [default=false]; -} - -message CompiledQuery { - required group PrimaryScan = 1 { - optional string index_name = 2; - - optional string start_key = 3; - optional bool start_inclusive = 4; - optional string end_key = 5; - optional bool end_inclusive = 6; - - repeated string start_postfix_value = 22; - repeated string end_postfix_value = 23; - - optional int64 end_unapplied_log_timestamp_us = 19; - } - - repeated group MergeJoinScan = 7 { - required string index_name = 8; - - repeated string prefix_value = 9; - - optional bool value_prefix = 20 [default=false]; - } - - optional Index index_def = 21; - - optional int32 offset = 10 [default = 0]; - - optional int32 limit = 11; - - required bool keys_only = 12; - - repeated string property_name = 24; - - optional int32 distinct_infix_size = 25; - - optional group EntityFilter = 13 { - optional bool distinct = 14 [default=false]; - - optional string kind = 17; - optional Reference ancestor = 18; - } -} - -message CompiledCursor { - optional group Position = 2 { - optional string start_key = 27; - - repeated group IndexValue = 29 { - optional string property = 30; - required PropertyValue value = 31; - } - - optional Reference key = 32; - - optional bool start_inclusive = 28 [default=true]; - } -} - -message Cursor { - required fixed64 cursor = 1; - - optional string app = 2; -} - -message Error { - enum ErrorCode { - BAD_REQUEST = 1; - CONCURRENT_TRANSACTION = 2; - INTERNAL_ERROR = 3; - NEED_INDEX = 4; - TIMEOUT = 5; - PERMISSION_DENIED = 6; - BIGTABLE_ERROR = 7; - COMMITTED_BUT_STILL_APPLYING = 8; - CAPABILITY_DISABLED = 9; - TRY_ALTERNATE_BACKEND = 10; - SAFE_TIME_TOO_OLD = 11; - } -} - -message Cost { - optional int32 index_writes = 1; - optional int32 index_write_bytes = 2; - optional int32 entity_writes = 3; - optional int32 entity_write_bytes = 4; - optional group CommitCost = 5 { - optional int32 requested_entity_puts = 6; - optional int32 requested_entity_deletes = 7; - }; - optional int32 approximate_storage_delta = 8; - optional int32 id_sequence_updates = 9; -} - -message GetRequest { - optional InternalHeader header = 6; - - repeated Reference key = 1; - optional Transaction transaction = 2; - - optional int64 failover_ms = 3; - - optional bool strong = 4; - - optional bool allow_deferred = 5 [default=false]; -} - -message GetResponse { - repeated group Entity = 1 { - optional EntityProto entity = 2; - optional Reference key = 4; - - optional int64 version = 3; - } - - repeated Reference deferred = 5; - - optional bool in_order = 6 [default=true]; -} - -message PutRequest { - optional InternalHeader header = 11; - - repeated EntityProto entity = 1; - optional Transaction transaction = 2; - repeated CompositeIndex composite_index = 3; - - optional bool trusted = 4 [default = false]; - - optional bool force = 7 [default = false]; - - optional bool mark_changes = 8 [default = false]; - repeated Snapshot snapshot = 9; - - enum AutoIdPolicy { - CURRENT = 0; - SEQUENTIAL = 1; - } - optional AutoIdPolicy auto_id_policy = 10 [default = CURRENT]; -} - -message PutResponse { - repeated Reference key = 1; - optional Cost cost = 2; - repeated int64 version = 3; -} - -message TouchRequest { - optional InternalHeader header = 10; - - repeated Reference key = 1; - repeated CompositeIndex composite_index = 2; - optional bool force = 3 [default = false]; - repeated Snapshot snapshot = 9; -} - -message TouchResponse { - optional Cost cost = 1; -} - -message DeleteRequest { - optional InternalHeader header = 10; - - repeated Reference key = 6; - optional Transaction transaction = 5; - - optional bool trusted = 4 [default = false]; - - optional bool force = 7 [default = false]; - - optional bool mark_changes = 8 [default = false]; - repeated Snapshot snapshot = 9; -} - -message DeleteResponse { - optional Cost cost = 1; - repeated int64 version = 3; -} - -message NextRequest { - optional InternalHeader header = 5; - - required Cursor cursor = 1; - optional int32 count = 2; - - optional int32 offset = 4 [default = 0]; - - optional bool compile = 3 [default = false]; -} - -message QueryResult { - optional Cursor cursor = 1; - - repeated EntityProto result = 2; - - optional int32 skipped_results = 7; - - required bool more_results = 3; - - optional bool keys_only = 4; - - optional bool index_only = 9; - - optional bool small_ops = 10; - - optional CompiledQuery compiled_query = 5; - - optional CompiledCursor compiled_cursor = 6; - - repeated CompositeIndex index = 8; - - repeated int64 version = 11; -} - -message AllocateIdsRequest { - optional InternalHeader header = 4; - - optional Reference model_key = 1; - - optional int64 size = 2; - - optional int64 max = 3; - - repeated Reference reserve = 5; -} - -message AllocateIdsResponse { - required int64 start = 1; - required int64 end = 2; - optional Cost cost = 3; -} - -message CompositeIndices { - repeated CompositeIndex index = 1; -} - -message AddActionsRequest { - optional InternalHeader header = 3; - - required Transaction transaction = 1; - repeated Action action = 2; -} - -message AddActionsResponse { -} - -message BeginTransactionRequest { - optional InternalHeader header = 3; - - required string app = 1; - optional bool allow_multiple_eg = 2 [default = false]; - optional string database_id = 4; - - enum TransactionMode { - UNKNOWN = 0; - READ_ONLY = 1; - READ_WRITE = 2; - } - optional TransactionMode mode = 5 [default = UNKNOWN]; - - optional Transaction previous_transaction = 7; -} - -message CommitResponse { - optional Cost cost = 1; - - repeated group Version = 3 { - required Reference root_entity_key = 4; - required int64 version = 5; - } -} diff --git a/vendor/google.golang.org/appengine/internal/identity.go b/vendor/google.golang.org/appengine/internal/identity.go deleted file mode 100644 index 0f95aa91d..000000000 --- a/vendor/google.golang.org/appengine/internal/identity.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -package internal - -import ( - "context" - "os" -) - -var ( - // This is set to true in identity_classic.go, which is behind the appengine build tag. - // The appengine build tag is set for the first generation runtimes (<= Go 1.9) but not - // the second generation runtimes (>= Go 1.11), so this indicates whether we're on a - // first-gen runtime. See IsStandard below for the second-gen check. - appengineStandard bool - - // This is set to true in identity_flex.go, which is behind the appenginevm build tag. - appengineFlex bool -) - -// AppID is the implementation of the wrapper function of the same name in -// ../identity.go. See that file for commentary. -func AppID(c context.Context) string { - return appID(FullyQualifiedAppID(c)) -} - -// IsStandard is the implementation of the wrapper function of the same name in -// ../appengine.go. See that file for commentary. -func IsStandard() bool { - // appengineStandard will be true for first-gen runtimes (<= Go 1.9) but not - // second-gen (>= Go 1.11). - return appengineStandard || IsSecondGen() -} - -// IsSecondGen is the implementation of the wrapper function of the same name in -// ../appengine.go. See that file for commentary. -func IsSecondGen() bool { - // Second-gen runtimes set $GAE_ENV so we use that to check if we're on a second-gen runtime. - return os.Getenv("GAE_ENV") == "standard" -} - -// IsFlex is the implementation of the wrapper function of the same name in -// ../appengine.go. See that file for commentary. -func IsFlex() bool { - return appengineFlex -} - -// IsAppEngine is the implementation of the wrapper function of the same name in -// ../appengine.go. See that file for commentary. -func IsAppEngine() bool { - return IsStandard() || IsFlex() -} diff --git a/vendor/google.golang.org/appengine/internal/identity_classic.go b/vendor/google.golang.org/appengine/internal/identity_classic.go deleted file mode 100644 index 5ad3548bf..000000000 --- a/vendor/google.golang.org/appengine/internal/identity_classic.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build appengine -// +build appengine - -package internal - -import ( - "context" - - "appengine" -) - -func init() { - appengineStandard = true -} - -func DefaultVersionHostname(ctx context.Context) string { - c := fromContext(ctx) - if c == nil { - panic(errNotAppEngineContext) - } - return appengine.DefaultVersionHostname(c) -} - -func Datacenter(_ context.Context) string { return appengine.Datacenter() } -func ServerSoftware() string { return appengine.ServerSoftware() } -func InstanceID() string { return appengine.InstanceID() } -func IsDevAppServer() bool { return appengine.IsDevAppServer() } - -func RequestID(ctx context.Context) string { - c := fromContext(ctx) - if c == nil { - panic(errNotAppEngineContext) - } - return appengine.RequestID(c) -} - -func ModuleName(ctx context.Context) string { - c := fromContext(ctx) - if c == nil { - panic(errNotAppEngineContext) - } - return appengine.ModuleName(c) -} -func VersionID(ctx context.Context) string { - c := fromContext(ctx) - if c == nil { - panic(errNotAppEngineContext) - } - return appengine.VersionID(c) -} - -func fullyQualifiedAppID(ctx context.Context) string { - c := fromContext(ctx) - if c == nil { - panic(errNotAppEngineContext) - } - return c.FullyQualifiedAppID() -} diff --git a/vendor/google.golang.org/appengine/internal/identity_flex.go b/vendor/google.golang.org/appengine/internal/identity_flex.go deleted file mode 100644 index 4201b6b58..000000000 --- a/vendor/google.golang.org/appengine/internal/identity_flex.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2018 Google LLC. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build appenginevm -// +build appenginevm - -package internal - -func init() { - appengineFlex = true -} diff --git a/vendor/google.golang.org/appengine/internal/identity_vm.go b/vendor/google.golang.org/appengine/internal/identity_vm.go deleted file mode 100644 index 18ddda3a4..000000000 --- a/vendor/google.golang.org/appengine/internal/identity_vm.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build !appengine -// +build !appengine - -package internal - -import ( - "context" - "log" - "net/http" - "os" - "strings" -) - -// These functions are implementations of the wrapper functions -// in ../appengine/identity.go. See that file for commentary. - -const ( - hDefaultVersionHostname = "X-AppEngine-Default-Version-Hostname" - hRequestLogId = "X-AppEngine-Request-Log-Id" - hDatacenter = "X-AppEngine-Datacenter" -) - -func ctxHeaders(ctx context.Context) http.Header { - c := fromContext(ctx) - if c == nil { - return nil - } - return c.Request().Header -} - -func DefaultVersionHostname(ctx context.Context) string { - return ctxHeaders(ctx).Get(hDefaultVersionHostname) -} - -func RequestID(ctx context.Context) string { - return ctxHeaders(ctx).Get(hRequestLogId) -} - -func Datacenter(ctx context.Context) string { - if dc := ctxHeaders(ctx).Get(hDatacenter); dc != "" { - return dc - } - // If the header isn't set, read zone from the metadata service. - // It has the format projects/[NUMERIC_PROJECT_ID]/zones/[ZONE] - zone, err := getMetadata("instance/zone") - if err != nil { - log.Printf("Datacenter: %v", err) - return "" - } - parts := strings.Split(string(zone), "/") - if len(parts) == 0 { - return "" - } - return parts[len(parts)-1] -} - -func ServerSoftware() string { - // TODO(dsymonds): Remove fallback when we've verified this. - if s := os.Getenv("SERVER_SOFTWARE"); s != "" { - return s - } - if s := os.Getenv("GAE_ENV"); s != "" { - return s - } - return "Google App Engine/1.x.x" -} - -// TODO(dsymonds): Remove the metadata fetches. - -func ModuleName(_ context.Context) string { - if s := os.Getenv("GAE_MODULE_NAME"); s != "" { - return s - } - if s := os.Getenv("GAE_SERVICE"); s != "" { - return s - } - return string(mustGetMetadata("instance/attributes/gae_backend_name")) -} - -func VersionID(_ context.Context) string { - if s1, s2 := os.Getenv("GAE_MODULE_VERSION"), os.Getenv("GAE_MINOR_VERSION"); s1 != "" && s2 != "" { - return s1 + "." + s2 - } - if s1, s2 := os.Getenv("GAE_VERSION"), os.Getenv("GAE_DEPLOYMENT_ID"); s1 != "" && s2 != "" { - return s1 + "." + s2 - } - return string(mustGetMetadata("instance/attributes/gae_backend_version")) + "." + string(mustGetMetadata("instance/attributes/gae_backend_minor_version")) -} - -func InstanceID() string { - if s := os.Getenv("GAE_MODULE_INSTANCE"); s != "" { - return s - } - if s := os.Getenv("GAE_INSTANCE"); s != "" { - return s - } - return string(mustGetMetadata("instance/attributes/gae_backend_instance")) -} - -func partitionlessAppID() string { - // gae_project has everything except the partition prefix. - if appID := os.Getenv("GAE_LONG_APP_ID"); appID != "" { - return appID - } - if project := os.Getenv("GOOGLE_CLOUD_PROJECT"); project != "" { - return project - } - return string(mustGetMetadata("instance/attributes/gae_project")) -} - -func fullyQualifiedAppID(_ context.Context) string { - if s := os.Getenv("GAE_APPLICATION"); s != "" { - return s - } - appID := partitionlessAppID() - - part := os.Getenv("GAE_PARTITION") - if part == "" { - part = string(mustGetMetadata("instance/attributes/gae_partition")) - } - - if part != "" { - appID = part + "~" + appID - } - return appID -} - -func IsDevAppServer() bool { - return os.Getenv("RUN_WITH_DEVAPPSERVER") != "" || os.Getenv("GAE_ENV") == "localdev" -} diff --git a/vendor/google.golang.org/appengine/internal/internal.go b/vendor/google.golang.org/appengine/internal/internal.go deleted file mode 100644 index 051ea3980..000000000 --- a/vendor/google.golang.org/appengine/internal/internal.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -// Package internal provides support for package appengine. -// -// Programs should not use this package directly. Its API is not stable. -// Use packages appengine and appengine/* instead. -package internal - -import ( - "fmt" - - "github.com/golang/protobuf/proto" - - remotepb "google.golang.org/appengine/internal/remote_api" -) - -// errorCodeMaps is a map of service name to the error code map for the service. -var errorCodeMaps = make(map[string]map[int32]string) - -// RegisterErrorCodeMap is called from API implementations to register their -// error code map. This should only be called from init functions. -func RegisterErrorCodeMap(service string, m map[int32]string) { - errorCodeMaps[service] = m -} - -type timeoutCodeKey struct { - service string - code int32 -} - -// timeoutCodes is the set of service+code pairs that represent timeouts. -var timeoutCodes = make(map[timeoutCodeKey]bool) - -func RegisterTimeoutErrorCode(service string, code int32) { - timeoutCodes[timeoutCodeKey{service, code}] = true -} - -// APIError is the type returned by appengine.Context's Call method -// when an API call fails in an API-specific way. This may be, for instance, -// a taskqueue API call failing with TaskQueueServiceError::UNKNOWN_QUEUE. -type APIError struct { - Service string - Detail string - Code int32 // API-specific error code -} - -func (e *APIError) Error() string { - if e.Code == 0 { - if e.Detail == "" { - return "APIError " - } - return e.Detail - } - s := fmt.Sprintf("API error %d", e.Code) - if m, ok := errorCodeMaps[e.Service]; ok { - s += " (" + e.Service + ": " + m[e.Code] + ")" - } else { - // Shouldn't happen, but provide a bit more detail if it does. - s = e.Service + " " + s - } - if e.Detail != "" { - s += ": " + e.Detail - } - return s -} - -func (e *APIError) IsTimeout() bool { - return timeoutCodes[timeoutCodeKey{e.Service, e.Code}] -} - -// CallError is the type returned by appengine.Context's Call method when an -// API call fails in a generic way, such as RpcError::CAPABILITY_DISABLED. -type CallError struct { - Detail string - Code int32 - // TODO: Remove this if we get a distinguishable error code. - Timeout bool -} - -func (e *CallError) Error() string { - var msg string - switch remotepb.RpcError_ErrorCode(e.Code) { - case remotepb.RpcError_UNKNOWN: - return e.Detail - case remotepb.RpcError_OVER_QUOTA: - msg = "Over quota" - case remotepb.RpcError_CAPABILITY_DISABLED: - msg = "Capability disabled" - case remotepb.RpcError_CANCELLED: - msg = "Canceled" - default: - msg = fmt.Sprintf("Call error %d", e.Code) - } - s := msg + ": " + e.Detail - if e.Timeout { - s += " (timeout)" - } - return s -} - -func (e *CallError) IsTimeout() bool { - return e.Timeout -} - -// NamespaceMods is a map from API service to a function that will mutate an RPC request to attach a namespace. -// The function should be prepared to be called on the same message more than once; it should only modify the -// RPC request the first time. -var NamespaceMods = make(map[string]func(m proto.Message, namespace string)) diff --git a/vendor/google.golang.org/appengine/internal/log/log_service.pb.go b/vendor/google.golang.org/appengine/internal/log/log_service.pb.go deleted file mode 100644 index 8545ac4ad..000000000 --- a/vendor/google.golang.org/appengine/internal/log/log_service.pb.go +++ /dev/null @@ -1,1313 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google.golang.org/appengine/internal/log/log_service.proto - -package log - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type LogServiceError_ErrorCode int32 - -const ( - LogServiceError_OK LogServiceError_ErrorCode = 0 - LogServiceError_INVALID_REQUEST LogServiceError_ErrorCode = 1 - LogServiceError_STORAGE_ERROR LogServiceError_ErrorCode = 2 -) - -var LogServiceError_ErrorCode_name = map[int32]string{ - 0: "OK", - 1: "INVALID_REQUEST", - 2: "STORAGE_ERROR", -} -var LogServiceError_ErrorCode_value = map[string]int32{ - "OK": 0, - "INVALID_REQUEST": 1, - "STORAGE_ERROR": 2, -} - -func (x LogServiceError_ErrorCode) Enum() *LogServiceError_ErrorCode { - p := new(LogServiceError_ErrorCode) - *p = x - return p -} -func (x LogServiceError_ErrorCode) String() string { - return proto.EnumName(LogServiceError_ErrorCode_name, int32(x)) -} -func (x *LogServiceError_ErrorCode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(LogServiceError_ErrorCode_value, data, "LogServiceError_ErrorCode") - if err != nil { - return err - } - *x = LogServiceError_ErrorCode(value) - return nil -} -func (LogServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{0, 0} -} - -type LogServiceError struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogServiceError) Reset() { *m = LogServiceError{} } -func (m *LogServiceError) String() string { return proto.CompactTextString(m) } -func (*LogServiceError) ProtoMessage() {} -func (*LogServiceError) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{0} -} -func (m *LogServiceError) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogServiceError.Unmarshal(m, b) -} -func (m *LogServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogServiceError.Marshal(b, m, deterministic) -} -func (dst *LogServiceError) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogServiceError.Merge(dst, src) -} -func (m *LogServiceError) XXX_Size() int { - return xxx_messageInfo_LogServiceError.Size(m) -} -func (m *LogServiceError) XXX_DiscardUnknown() { - xxx_messageInfo_LogServiceError.DiscardUnknown(m) -} - -var xxx_messageInfo_LogServiceError proto.InternalMessageInfo - -type UserAppLogLine struct { - TimestampUsec *int64 `protobuf:"varint,1,req,name=timestamp_usec,json=timestampUsec" json:"timestamp_usec,omitempty"` - Level *int64 `protobuf:"varint,2,req,name=level" json:"level,omitempty"` - Message *string `protobuf:"bytes,3,req,name=message" json:"message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserAppLogLine) Reset() { *m = UserAppLogLine{} } -func (m *UserAppLogLine) String() string { return proto.CompactTextString(m) } -func (*UserAppLogLine) ProtoMessage() {} -func (*UserAppLogLine) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{1} -} -func (m *UserAppLogLine) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserAppLogLine.Unmarshal(m, b) -} -func (m *UserAppLogLine) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserAppLogLine.Marshal(b, m, deterministic) -} -func (dst *UserAppLogLine) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserAppLogLine.Merge(dst, src) -} -func (m *UserAppLogLine) XXX_Size() int { - return xxx_messageInfo_UserAppLogLine.Size(m) -} -func (m *UserAppLogLine) XXX_DiscardUnknown() { - xxx_messageInfo_UserAppLogLine.DiscardUnknown(m) -} - -var xxx_messageInfo_UserAppLogLine proto.InternalMessageInfo - -func (m *UserAppLogLine) GetTimestampUsec() int64 { - if m != nil && m.TimestampUsec != nil { - return *m.TimestampUsec - } - return 0 -} - -func (m *UserAppLogLine) GetLevel() int64 { - if m != nil && m.Level != nil { - return *m.Level - } - return 0 -} - -func (m *UserAppLogLine) GetMessage() string { - if m != nil && m.Message != nil { - return *m.Message - } - return "" -} - -type UserAppLogGroup struct { - LogLine []*UserAppLogLine `protobuf:"bytes,2,rep,name=log_line,json=logLine" json:"log_line,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserAppLogGroup) Reset() { *m = UserAppLogGroup{} } -func (m *UserAppLogGroup) String() string { return proto.CompactTextString(m) } -func (*UserAppLogGroup) ProtoMessage() {} -func (*UserAppLogGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{2} -} -func (m *UserAppLogGroup) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserAppLogGroup.Unmarshal(m, b) -} -func (m *UserAppLogGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserAppLogGroup.Marshal(b, m, deterministic) -} -func (dst *UserAppLogGroup) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserAppLogGroup.Merge(dst, src) -} -func (m *UserAppLogGroup) XXX_Size() int { - return xxx_messageInfo_UserAppLogGroup.Size(m) -} -func (m *UserAppLogGroup) XXX_DiscardUnknown() { - xxx_messageInfo_UserAppLogGroup.DiscardUnknown(m) -} - -var xxx_messageInfo_UserAppLogGroup proto.InternalMessageInfo - -func (m *UserAppLogGroup) GetLogLine() []*UserAppLogLine { - if m != nil { - return m.LogLine - } - return nil -} - -type FlushRequest struct { - Logs []byte `protobuf:"bytes,1,opt,name=logs" json:"logs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FlushRequest) Reset() { *m = FlushRequest{} } -func (m *FlushRequest) String() string { return proto.CompactTextString(m) } -func (*FlushRequest) ProtoMessage() {} -func (*FlushRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{3} -} -func (m *FlushRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FlushRequest.Unmarshal(m, b) -} -func (m *FlushRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FlushRequest.Marshal(b, m, deterministic) -} -func (dst *FlushRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_FlushRequest.Merge(dst, src) -} -func (m *FlushRequest) XXX_Size() int { - return xxx_messageInfo_FlushRequest.Size(m) -} -func (m *FlushRequest) XXX_DiscardUnknown() { - xxx_messageInfo_FlushRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_FlushRequest proto.InternalMessageInfo - -func (m *FlushRequest) GetLogs() []byte { - if m != nil { - return m.Logs - } - return nil -} - -type SetStatusRequest struct { - Status *string `protobuf:"bytes,1,req,name=status" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetStatusRequest) Reset() { *m = SetStatusRequest{} } -func (m *SetStatusRequest) String() string { return proto.CompactTextString(m) } -func (*SetStatusRequest) ProtoMessage() {} -func (*SetStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{4} -} -func (m *SetStatusRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetStatusRequest.Unmarshal(m, b) -} -func (m *SetStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetStatusRequest.Marshal(b, m, deterministic) -} -func (dst *SetStatusRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetStatusRequest.Merge(dst, src) -} -func (m *SetStatusRequest) XXX_Size() int { - return xxx_messageInfo_SetStatusRequest.Size(m) -} -func (m *SetStatusRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SetStatusRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SetStatusRequest proto.InternalMessageInfo - -func (m *SetStatusRequest) GetStatus() string { - if m != nil && m.Status != nil { - return *m.Status - } - return "" -} - -type LogOffset struct { - RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId" json:"request_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogOffset) Reset() { *m = LogOffset{} } -func (m *LogOffset) String() string { return proto.CompactTextString(m) } -func (*LogOffset) ProtoMessage() {} -func (*LogOffset) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{5} -} -func (m *LogOffset) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogOffset.Unmarshal(m, b) -} -func (m *LogOffset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogOffset.Marshal(b, m, deterministic) -} -func (dst *LogOffset) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogOffset.Merge(dst, src) -} -func (m *LogOffset) XXX_Size() int { - return xxx_messageInfo_LogOffset.Size(m) -} -func (m *LogOffset) XXX_DiscardUnknown() { - xxx_messageInfo_LogOffset.DiscardUnknown(m) -} - -var xxx_messageInfo_LogOffset proto.InternalMessageInfo - -func (m *LogOffset) GetRequestId() []byte { - if m != nil { - return m.RequestId - } - return nil -} - -type LogLine struct { - Time *int64 `protobuf:"varint,1,req,name=time" json:"time,omitempty"` - Level *int32 `protobuf:"varint,2,req,name=level" json:"level,omitempty"` - LogMessage *string `protobuf:"bytes,3,req,name=log_message,json=logMessage" json:"log_message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogLine) Reset() { *m = LogLine{} } -func (m *LogLine) String() string { return proto.CompactTextString(m) } -func (*LogLine) ProtoMessage() {} -func (*LogLine) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{6} -} -func (m *LogLine) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogLine.Unmarshal(m, b) -} -func (m *LogLine) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogLine.Marshal(b, m, deterministic) -} -func (dst *LogLine) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogLine.Merge(dst, src) -} -func (m *LogLine) XXX_Size() int { - return xxx_messageInfo_LogLine.Size(m) -} -func (m *LogLine) XXX_DiscardUnknown() { - xxx_messageInfo_LogLine.DiscardUnknown(m) -} - -var xxx_messageInfo_LogLine proto.InternalMessageInfo - -func (m *LogLine) GetTime() int64 { - if m != nil && m.Time != nil { - return *m.Time - } - return 0 -} - -func (m *LogLine) GetLevel() int32 { - if m != nil && m.Level != nil { - return *m.Level - } - return 0 -} - -func (m *LogLine) GetLogMessage() string { - if m != nil && m.LogMessage != nil { - return *m.LogMessage - } - return "" -} - -type RequestLog struct { - AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` - ModuleId *string `protobuf:"bytes,37,opt,name=module_id,json=moduleId,def=default" json:"module_id,omitempty"` - VersionId *string `protobuf:"bytes,2,req,name=version_id,json=versionId" json:"version_id,omitempty"` - RequestId []byte `protobuf:"bytes,3,req,name=request_id,json=requestId" json:"request_id,omitempty"` - Offset *LogOffset `protobuf:"bytes,35,opt,name=offset" json:"offset,omitempty"` - Ip *string `protobuf:"bytes,4,req,name=ip" json:"ip,omitempty"` - Nickname *string `protobuf:"bytes,5,opt,name=nickname" json:"nickname,omitempty"` - StartTime *int64 `protobuf:"varint,6,req,name=start_time,json=startTime" json:"start_time,omitempty"` - EndTime *int64 `protobuf:"varint,7,req,name=end_time,json=endTime" json:"end_time,omitempty"` - Latency *int64 `protobuf:"varint,8,req,name=latency" json:"latency,omitempty"` - Mcycles *int64 `protobuf:"varint,9,req,name=mcycles" json:"mcycles,omitempty"` - Method *string `protobuf:"bytes,10,req,name=method" json:"method,omitempty"` - Resource *string `protobuf:"bytes,11,req,name=resource" json:"resource,omitempty"` - HttpVersion *string `protobuf:"bytes,12,req,name=http_version,json=httpVersion" json:"http_version,omitempty"` - Status *int32 `protobuf:"varint,13,req,name=status" json:"status,omitempty"` - ResponseSize *int64 `protobuf:"varint,14,req,name=response_size,json=responseSize" json:"response_size,omitempty"` - Referrer *string `protobuf:"bytes,15,opt,name=referrer" json:"referrer,omitempty"` - UserAgent *string `protobuf:"bytes,16,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"` - UrlMapEntry *string `protobuf:"bytes,17,req,name=url_map_entry,json=urlMapEntry" json:"url_map_entry,omitempty"` - Combined *string `protobuf:"bytes,18,req,name=combined" json:"combined,omitempty"` - ApiMcycles *int64 `protobuf:"varint,19,opt,name=api_mcycles,json=apiMcycles" json:"api_mcycles,omitempty"` - Host *string `protobuf:"bytes,20,opt,name=host" json:"host,omitempty"` - Cost *float64 `protobuf:"fixed64,21,opt,name=cost" json:"cost,omitempty"` - TaskQueueName *string `protobuf:"bytes,22,opt,name=task_queue_name,json=taskQueueName" json:"task_queue_name,omitempty"` - TaskName *string `protobuf:"bytes,23,opt,name=task_name,json=taskName" json:"task_name,omitempty"` - WasLoadingRequest *bool `protobuf:"varint,24,opt,name=was_loading_request,json=wasLoadingRequest" json:"was_loading_request,omitempty"` - PendingTime *int64 `protobuf:"varint,25,opt,name=pending_time,json=pendingTime" json:"pending_time,omitempty"` - ReplicaIndex *int32 `protobuf:"varint,26,opt,name=replica_index,json=replicaIndex,def=-1" json:"replica_index,omitempty"` - Finished *bool `protobuf:"varint,27,opt,name=finished,def=1" json:"finished,omitempty"` - CloneKey []byte `protobuf:"bytes,28,opt,name=clone_key,json=cloneKey" json:"clone_key,omitempty"` - Line []*LogLine `protobuf:"bytes,29,rep,name=line" json:"line,omitempty"` - LinesIncomplete *bool `protobuf:"varint,36,opt,name=lines_incomplete,json=linesIncomplete" json:"lines_incomplete,omitempty"` - AppEngineRelease []byte `protobuf:"bytes,38,opt,name=app_engine_release,json=appEngineRelease" json:"app_engine_release,omitempty"` - ExitReason *int32 `protobuf:"varint,30,opt,name=exit_reason,json=exitReason" json:"exit_reason,omitempty"` - WasThrottledForTime *bool `protobuf:"varint,31,opt,name=was_throttled_for_time,json=wasThrottledForTime" json:"was_throttled_for_time,omitempty"` - WasThrottledForRequests *bool `protobuf:"varint,32,opt,name=was_throttled_for_requests,json=wasThrottledForRequests" json:"was_throttled_for_requests,omitempty"` - ThrottledTime *int64 `protobuf:"varint,33,opt,name=throttled_time,json=throttledTime" json:"throttled_time,omitempty"` - ServerName []byte `protobuf:"bytes,34,opt,name=server_name,json=serverName" json:"server_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestLog) Reset() { *m = RequestLog{} } -func (m *RequestLog) String() string { return proto.CompactTextString(m) } -func (*RequestLog) ProtoMessage() {} -func (*RequestLog) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{7} -} -func (m *RequestLog) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestLog.Unmarshal(m, b) -} -func (m *RequestLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestLog.Marshal(b, m, deterministic) -} -func (dst *RequestLog) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestLog.Merge(dst, src) -} -func (m *RequestLog) XXX_Size() int { - return xxx_messageInfo_RequestLog.Size(m) -} -func (m *RequestLog) XXX_DiscardUnknown() { - xxx_messageInfo_RequestLog.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestLog proto.InternalMessageInfo - -const Default_RequestLog_ModuleId string = "default" -const Default_RequestLog_ReplicaIndex int32 = -1 -const Default_RequestLog_Finished bool = true - -func (m *RequestLog) GetAppId() string { - if m != nil && m.AppId != nil { - return *m.AppId - } - return "" -} - -func (m *RequestLog) GetModuleId() string { - if m != nil && m.ModuleId != nil { - return *m.ModuleId - } - return Default_RequestLog_ModuleId -} - -func (m *RequestLog) GetVersionId() string { - if m != nil && m.VersionId != nil { - return *m.VersionId - } - return "" -} - -func (m *RequestLog) GetRequestId() []byte { - if m != nil { - return m.RequestId - } - return nil -} - -func (m *RequestLog) GetOffset() *LogOffset { - if m != nil { - return m.Offset - } - return nil -} - -func (m *RequestLog) GetIp() string { - if m != nil && m.Ip != nil { - return *m.Ip - } - return "" -} - -func (m *RequestLog) GetNickname() string { - if m != nil && m.Nickname != nil { - return *m.Nickname - } - return "" -} - -func (m *RequestLog) GetStartTime() int64 { - if m != nil && m.StartTime != nil { - return *m.StartTime - } - return 0 -} - -func (m *RequestLog) GetEndTime() int64 { - if m != nil && m.EndTime != nil { - return *m.EndTime - } - return 0 -} - -func (m *RequestLog) GetLatency() int64 { - if m != nil && m.Latency != nil { - return *m.Latency - } - return 0 -} - -func (m *RequestLog) GetMcycles() int64 { - if m != nil && m.Mcycles != nil { - return *m.Mcycles - } - return 0 -} - -func (m *RequestLog) GetMethod() string { - if m != nil && m.Method != nil { - return *m.Method - } - return "" -} - -func (m *RequestLog) GetResource() string { - if m != nil && m.Resource != nil { - return *m.Resource - } - return "" -} - -func (m *RequestLog) GetHttpVersion() string { - if m != nil && m.HttpVersion != nil { - return *m.HttpVersion - } - return "" -} - -func (m *RequestLog) GetStatus() int32 { - if m != nil && m.Status != nil { - return *m.Status - } - return 0 -} - -func (m *RequestLog) GetResponseSize() int64 { - if m != nil && m.ResponseSize != nil { - return *m.ResponseSize - } - return 0 -} - -func (m *RequestLog) GetReferrer() string { - if m != nil && m.Referrer != nil { - return *m.Referrer - } - return "" -} - -func (m *RequestLog) GetUserAgent() string { - if m != nil && m.UserAgent != nil { - return *m.UserAgent - } - return "" -} - -func (m *RequestLog) GetUrlMapEntry() string { - if m != nil && m.UrlMapEntry != nil { - return *m.UrlMapEntry - } - return "" -} - -func (m *RequestLog) GetCombined() string { - if m != nil && m.Combined != nil { - return *m.Combined - } - return "" -} - -func (m *RequestLog) GetApiMcycles() int64 { - if m != nil && m.ApiMcycles != nil { - return *m.ApiMcycles - } - return 0 -} - -func (m *RequestLog) GetHost() string { - if m != nil && m.Host != nil { - return *m.Host - } - return "" -} - -func (m *RequestLog) GetCost() float64 { - if m != nil && m.Cost != nil { - return *m.Cost - } - return 0 -} - -func (m *RequestLog) GetTaskQueueName() string { - if m != nil && m.TaskQueueName != nil { - return *m.TaskQueueName - } - return "" -} - -func (m *RequestLog) GetTaskName() string { - if m != nil && m.TaskName != nil { - return *m.TaskName - } - return "" -} - -func (m *RequestLog) GetWasLoadingRequest() bool { - if m != nil && m.WasLoadingRequest != nil { - return *m.WasLoadingRequest - } - return false -} - -func (m *RequestLog) GetPendingTime() int64 { - if m != nil && m.PendingTime != nil { - return *m.PendingTime - } - return 0 -} - -func (m *RequestLog) GetReplicaIndex() int32 { - if m != nil && m.ReplicaIndex != nil { - return *m.ReplicaIndex - } - return Default_RequestLog_ReplicaIndex -} - -func (m *RequestLog) GetFinished() bool { - if m != nil && m.Finished != nil { - return *m.Finished - } - return Default_RequestLog_Finished -} - -func (m *RequestLog) GetCloneKey() []byte { - if m != nil { - return m.CloneKey - } - return nil -} - -func (m *RequestLog) GetLine() []*LogLine { - if m != nil { - return m.Line - } - return nil -} - -func (m *RequestLog) GetLinesIncomplete() bool { - if m != nil && m.LinesIncomplete != nil { - return *m.LinesIncomplete - } - return false -} - -func (m *RequestLog) GetAppEngineRelease() []byte { - if m != nil { - return m.AppEngineRelease - } - return nil -} - -func (m *RequestLog) GetExitReason() int32 { - if m != nil && m.ExitReason != nil { - return *m.ExitReason - } - return 0 -} - -func (m *RequestLog) GetWasThrottledForTime() bool { - if m != nil && m.WasThrottledForTime != nil { - return *m.WasThrottledForTime - } - return false -} - -func (m *RequestLog) GetWasThrottledForRequests() bool { - if m != nil && m.WasThrottledForRequests != nil { - return *m.WasThrottledForRequests - } - return false -} - -func (m *RequestLog) GetThrottledTime() int64 { - if m != nil && m.ThrottledTime != nil { - return *m.ThrottledTime - } - return 0 -} - -func (m *RequestLog) GetServerName() []byte { - if m != nil { - return m.ServerName - } - return nil -} - -type LogModuleVersion struct { - ModuleId *string `protobuf:"bytes,1,opt,name=module_id,json=moduleId,def=default" json:"module_id,omitempty"` - VersionId *string `protobuf:"bytes,2,opt,name=version_id,json=versionId" json:"version_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogModuleVersion) Reset() { *m = LogModuleVersion{} } -func (m *LogModuleVersion) String() string { return proto.CompactTextString(m) } -func (*LogModuleVersion) ProtoMessage() {} -func (*LogModuleVersion) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{8} -} -func (m *LogModuleVersion) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogModuleVersion.Unmarshal(m, b) -} -func (m *LogModuleVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogModuleVersion.Marshal(b, m, deterministic) -} -func (dst *LogModuleVersion) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogModuleVersion.Merge(dst, src) -} -func (m *LogModuleVersion) XXX_Size() int { - return xxx_messageInfo_LogModuleVersion.Size(m) -} -func (m *LogModuleVersion) XXX_DiscardUnknown() { - xxx_messageInfo_LogModuleVersion.DiscardUnknown(m) -} - -var xxx_messageInfo_LogModuleVersion proto.InternalMessageInfo - -const Default_LogModuleVersion_ModuleId string = "default" - -func (m *LogModuleVersion) GetModuleId() string { - if m != nil && m.ModuleId != nil { - return *m.ModuleId - } - return Default_LogModuleVersion_ModuleId -} - -func (m *LogModuleVersion) GetVersionId() string { - if m != nil && m.VersionId != nil { - return *m.VersionId - } - return "" -} - -type LogReadRequest struct { - AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` - VersionId []string `protobuf:"bytes,2,rep,name=version_id,json=versionId" json:"version_id,omitempty"` - ModuleVersion []*LogModuleVersion `protobuf:"bytes,19,rep,name=module_version,json=moduleVersion" json:"module_version,omitempty"` - StartTime *int64 `protobuf:"varint,3,opt,name=start_time,json=startTime" json:"start_time,omitempty"` - EndTime *int64 `protobuf:"varint,4,opt,name=end_time,json=endTime" json:"end_time,omitempty"` - Offset *LogOffset `protobuf:"bytes,5,opt,name=offset" json:"offset,omitempty"` - RequestId [][]byte `protobuf:"bytes,6,rep,name=request_id,json=requestId" json:"request_id,omitempty"` - MinimumLogLevel *int32 `protobuf:"varint,7,opt,name=minimum_log_level,json=minimumLogLevel" json:"minimum_log_level,omitempty"` - IncludeIncomplete *bool `protobuf:"varint,8,opt,name=include_incomplete,json=includeIncomplete" json:"include_incomplete,omitempty"` - Count *int64 `protobuf:"varint,9,opt,name=count" json:"count,omitempty"` - CombinedLogRegex *string `protobuf:"bytes,14,opt,name=combined_log_regex,json=combinedLogRegex" json:"combined_log_regex,omitempty"` - HostRegex *string `protobuf:"bytes,15,opt,name=host_regex,json=hostRegex" json:"host_regex,omitempty"` - ReplicaIndex *int32 `protobuf:"varint,16,opt,name=replica_index,json=replicaIndex" json:"replica_index,omitempty"` - IncludeAppLogs *bool `protobuf:"varint,10,opt,name=include_app_logs,json=includeAppLogs" json:"include_app_logs,omitempty"` - AppLogsPerRequest *int32 `protobuf:"varint,17,opt,name=app_logs_per_request,json=appLogsPerRequest" json:"app_logs_per_request,omitempty"` - IncludeHost *bool `protobuf:"varint,11,opt,name=include_host,json=includeHost" json:"include_host,omitempty"` - IncludeAll *bool `protobuf:"varint,12,opt,name=include_all,json=includeAll" json:"include_all,omitempty"` - CacheIterator *bool `protobuf:"varint,13,opt,name=cache_iterator,json=cacheIterator" json:"cache_iterator,omitempty"` - NumShards *int32 `protobuf:"varint,18,opt,name=num_shards,json=numShards" json:"num_shards,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogReadRequest) Reset() { *m = LogReadRequest{} } -func (m *LogReadRequest) String() string { return proto.CompactTextString(m) } -func (*LogReadRequest) ProtoMessage() {} -func (*LogReadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{9} -} -func (m *LogReadRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogReadRequest.Unmarshal(m, b) -} -func (m *LogReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogReadRequest.Marshal(b, m, deterministic) -} -func (dst *LogReadRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogReadRequest.Merge(dst, src) -} -func (m *LogReadRequest) XXX_Size() int { - return xxx_messageInfo_LogReadRequest.Size(m) -} -func (m *LogReadRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LogReadRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_LogReadRequest proto.InternalMessageInfo - -func (m *LogReadRequest) GetAppId() string { - if m != nil && m.AppId != nil { - return *m.AppId - } - return "" -} - -func (m *LogReadRequest) GetVersionId() []string { - if m != nil { - return m.VersionId - } - return nil -} - -func (m *LogReadRequest) GetModuleVersion() []*LogModuleVersion { - if m != nil { - return m.ModuleVersion - } - return nil -} - -func (m *LogReadRequest) GetStartTime() int64 { - if m != nil && m.StartTime != nil { - return *m.StartTime - } - return 0 -} - -func (m *LogReadRequest) GetEndTime() int64 { - if m != nil && m.EndTime != nil { - return *m.EndTime - } - return 0 -} - -func (m *LogReadRequest) GetOffset() *LogOffset { - if m != nil { - return m.Offset - } - return nil -} - -func (m *LogReadRequest) GetRequestId() [][]byte { - if m != nil { - return m.RequestId - } - return nil -} - -func (m *LogReadRequest) GetMinimumLogLevel() int32 { - if m != nil && m.MinimumLogLevel != nil { - return *m.MinimumLogLevel - } - return 0 -} - -func (m *LogReadRequest) GetIncludeIncomplete() bool { - if m != nil && m.IncludeIncomplete != nil { - return *m.IncludeIncomplete - } - return false -} - -func (m *LogReadRequest) GetCount() int64 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -func (m *LogReadRequest) GetCombinedLogRegex() string { - if m != nil && m.CombinedLogRegex != nil { - return *m.CombinedLogRegex - } - return "" -} - -func (m *LogReadRequest) GetHostRegex() string { - if m != nil && m.HostRegex != nil { - return *m.HostRegex - } - return "" -} - -func (m *LogReadRequest) GetReplicaIndex() int32 { - if m != nil && m.ReplicaIndex != nil { - return *m.ReplicaIndex - } - return 0 -} - -func (m *LogReadRequest) GetIncludeAppLogs() bool { - if m != nil && m.IncludeAppLogs != nil { - return *m.IncludeAppLogs - } - return false -} - -func (m *LogReadRequest) GetAppLogsPerRequest() int32 { - if m != nil && m.AppLogsPerRequest != nil { - return *m.AppLogsPerRequest - } - return 0 -} - -func (m *LogReadRequest) GetIncludeHost() bool { - if m != nil && m.IncludeHost != nil { - return *m.IncludeHost - } - return false -} - -func (m *LogReadRequest) GetIncludeAll() bool { - if m != nil && m.IncludeAll != nil { - return *m.IncludeAll - } - return false -} - -func (m *LogReadRequest) GetCacheIterator() bool { - if m != nil && m.CacheIterator != nil { - return *m.CacheIterator - } - return false -} - -func (m *LogReadRequest) GetNumShards() int32 { - if m != nil && m.NumShards != nil { - return *m.NumShards - } - return 0 -} - -type LogReadResponse struct { - Log []*RequestLog `protobuf:"bytes,1,rep,name=log" json:"log,omitempty"` - Offset *LogOffset `protobuf:"bytes,2,opt,name=offset" json:"offset,omitempty"` - LastEndTime *int64 `protobuf:"varint,3,opt,name=last_end_time,json=lastEndTime" json:"last_end_time,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogReadResponse) Reset() { *m = LogReadResponse{} } -func (m *LogReadResponse) String() string { return proto.CompactTextString(m) } -func (*LogReadResponse) ProtoMessage() {} -func (*LogReadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{10} -} -func (m *LogReadResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogReadResponse.Unmarshal(m, b) -} -func (m *LogReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogReadResponse.Marshal(b, m, deterministic) -} -func (dst *LogReadResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogReadResponse.Merge(dst, src) -} -func (m *LogReadResponse) XXX_Size() int { - return xxx_messageInfo_LogReadResponse.Size(m) -} -func (m *LogReadResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LogReadResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_LogReadResponse proto.InternalMessageInfo - -func (m *LogReadResponse) GetLog() []*RequestLog { - if m != nil { - return m.Log - } - return nil -} - -func (m *LogReadResponse) GetOffset() *LogOffset { - if m != nil { - return m.Offset - } - return nil -} - -func (m *LogReadResponse) GetLastEndTime() int64 { - if m != nil && m.LastEndTime != nil { - return *m.LastEndTime - } - return 0 -} - -type LogUsageRecord struct { - VersionId *string `protobuf:"bytes,1,opt,name=version_id,json=versionId" json:"version_id,omitempty"` - StartTime *int32 `protobuf:"varint,2,opt,name=start_time,json=startTime" json:"start_time,omitempty"` - EndTime *int32 `protobuf:"varint,3,opt,name=end_time,json=endTime" json:"end_time,omitempty"` - Count *int64 `protobuf:"varint,4,opt,name=count" json:"count,omitempty"` - TotalSize *int64 `protobuf:"varint,5,opt,name=total_size,json=totalSize" json:"total_size,omitempty"` - Records *int32 `protobuf:"varint,6,opt,name=records" json:"records,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogUsageRecord) Reset() { *m = LogUsageRecord{} } -func (m *LogUsageRecord) String() string { return proto.CompactTextString(m) } -func (*LogUsageRecord) ProtoMessage() {} -func (*LogUsageRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{11} -} -func (m *LogUsageRecord) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogUsageRecord.Unmarshal(m, b) -} -func (m *LogUsageRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogUsageRecord.Marshal(b, m, deterministic) -} -func (dst *LogUsageRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogUsageRecord.Merge(dst, src) -} -func (m *LogUsageRecord) XXX_Size() int { - return xxx_messageInfo_LogUsageRecord.Size(m) -} -func (m *LogUsageRecord) XXX_DiscardUnknown() { - xxx_messageInfo_LogUsageRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_LogUsageRecord proto.InternalMessageInfo - -func (m *LogUsageRecord) GetVersionId() string { - if m != nil && m.VersionId != nil { - return *m.VersionId - } - return "" -} - -func (m *LogUsageRecord) GetStartTime() int32 { - if m != nil && m.StartTime != nil { - return *m.StartTime - } - return 0 -} - -func (m *LogUsageRecord) GetEndTime() int32 { - if m != nil && m.EndTime != nil { - return *m.EndTime - } - return 0 -} - -func (m *LogUsageRecord) GetCount() int64 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -func (m *LogUsageRecord) GetTotalSize() int64 { - if m != nil && m.TotalSize != nil { - return *m.TotalSize - } - return 0 -} - -func (m *LogUsageRecord) GetRecords() int32 { - if m != nil && m.Records != nil { - return *m.Records - } - return 0 -} - -type LogUsageRequest struct { - AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` - VersionId []string `protobuf:"bytes,2,rep,name=version_id,json=versionId" json:"version_id,omitempty"` - StartTime *int32 `protobuf:"varint,3,opt,name=start_time,json=startTime" json:"start_time,omitempty"` - EndTime *int32 `protobuf:"varint,4,opt,name=end_time,json=endTime" json:"end_time,omitempty"` - ResolutionHours *uint32 `protobuf:"varint,5,opt,name=resolution_hours,json=resolutionHours,def=1" json:"resolution_hours,omitempty"` - CombineVersions *bool `protobuf:"varint,6,opt,name=combine_versions,json=combineVersions" json:"combine_versions,omitempty"` - UsageVersion *int32 `protobuf:"varint,7,opt,name=usage_version,json=usageVersion" json:"usage_version,omitempty"` - VersionsOnly *bool `protobuf:"varint,8,opt,name=versions_only,json=versionsOnly" json:"versions_only,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogUsageRequest) Reset() { *m = LogUsageRequest{} } -func (m *LogUsageRequest) String() string { return proto.CompactTextString(m) } -func (*LogUsageRequest) ProtoMessage() {} -func (*LogUsageRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{12} -} -func (m *LogUsageRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogUsageRequest.Unmarshal(m, b) -} -func (m *LogUsageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogUsageRequest.Marshal(b, m, deterministic) -} -func (dst *LogUsageRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogUsageRequest.Merge(dst, src) -} -func (m *LogUsageRequest) XXX_Size() int { - return xxx_messageInfo_LogUsageRequest.Size(m) -} -func (m *LogUsageRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LogUsageRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_LogUsageRequest proto.InternalMessageInfo - -const Default_LogUsageRequest_ResolutionHours uint32 = 1 - -func (m *LogUsageRequest) GetAppId() string { - if m != nil && m.AppId != nil { - return *m.AppId - } - return "" -} - -func (m *LogUsageRequest) GetVersionId() []string { - if m != nil { - return m.VersionId - } - return nil -} - -func (m *LogUsageRequest) GetStartTime() int32 { - if m != nil && m.StartTime != nil { - return *m.StartTime - } - return 0 -} - -func (m *LogUsageRequest) GetEndTime() int32 { - if m != nil && m.EndTime != nil { - return *m.EndTime - } - return 0 -} - -func (m *LogUsageRequest) GetResolutionHours() uint32 { - if m != nil && m.ResolutionHours != nil { - return *m.ResolutionHours - } - return Default_LogUsageRequest_ResolutionHours -} - -func (m *LogUsageRequest) GetCombineVersions() bool { - if m != nil && m.CombineVersions != nil { - return *m.CombineVersions - } - return false -} - -func (m *LogUsageRequest) GetUsageVersion() int32 { - if m != nil && m.UsageVersion != nil { - return *m.UsageVersion - } - return 0 -} - -func (m *LogUsageRequest) GetVersionsOnly() bool { - if m != nil && m.VersionsOnly != nil { - return *m.VersionsOnly - } - return false -} - -type LogUsageResponse struct { - Usage []*LogUsageRecord `protobuf:"bytes,1,rep,name=usage" json:"usage,omitempty"` - Summary *LogUsageRecord `protobuf:"bytes,2,opt,name=summary" json:"summary,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogUsageResponse) Reset() { *m = LogUsageResponse{} } -func (m *LogUsageResponse) String() string { return proto.CompactTextString(m) } -func (*LogUsageResponse) ProtoMessage() {} -func (*LogUsageResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_log_service_f054fd4b5012319d, []int{13} -} -func (m *LogUsageResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogUsageResponse.Unmarshal(m, b) -} -func (m *LogUsageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogUsageResponse.Marshal(b, m, deterministic) -} -func (dst *LogUsageResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogUsageResponse.Merge(dst, src) -} -func (m *LogUsageResponse) XXX_Size() int { - return xxx_messageInfo_LogUsageResponse.Size(m) -} -func (m *LogUsageResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LogUsageResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_LogUsageResponse proto.InternalMessageInfo - -func (m *LogUsageResponse) GetUsage() []*LogUsageRecord { - if m != nil { - return m.Usage - } - return nil -} - -func (m *LogUsageResponse) GetSummary() *LogUsageRecord { - if m != nil { - return m.Summary - } - return nil -} - -func init() { - proto.RegisterType((*LogServiceError)(nil), "appengine.LogServiceError") - proto.RegisterType((*UserAppLogLine)(nil), "appengine.UserAppLogLine") - proto.RegisterType((*UserAppLogGroup)(nil), "appengine.UserAppLogGroup") - proto.RegisterType((*FlushRequest)(nil), "appengine.FlushRequest") - proto.RegisterType((*SetStatusRequest)(nil), "appengine.SetStatusRequest") - proto.RegisterType((*LogOffset)(nil), "appengine.LogOffset") - proto.RegisterType((*LogLine)(nil), "appengine.LogLine") - proto.RegisterType((*RequestLog)(nil), "appengine.RequestLog") - proto.RegisterType((*LogModuleVersion)(nil), "appengine.LogModuleVersion") - proto.RegisterType((*LogReadRequest)(nil), "appengine.LogReadRequest") - proto.RegisterType((*LogReadResponse)(nil), "appengine.LogReadResponse") - proto.RegisterType((*LogUsageRecord)(nil), "appengine.LogUsageRecord") - proto.RegisterType((*LogUsageRequest)(nil), "appengine.LogUsageRequest") - proto.RegisterType((*LogUsageResponse)(nil), "appengine.LogUsageResponse") -} - -func init() { - proto.RegisterFile("google.golang.org/appengine/internal/log/log_service.proto", fileDescriptor_log_service_f054fd4b5012319d) -} - -var fileDescriptor_log_service_f054fd4b5012319d = []byte{ - // 1553 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x72, 0xdb, 0xc6, - 0x15, 0x2e, 0x48, 0x51, 0x24, 0x0f, 0x49, 0x91, 0x5a, 0xcb, 0xce, 0xda, 0xae, 0x6b, 0x1a, 0x4e, - 0x1c, 0xd6, 0x93, 0x48, 0x93, 0xa4, 0x57, 0xca, 0x95, 0xd3, 0x2a, 0x8e, 0x26, 0xb4, 0xd5, 0x40, - 0x72, 0x3a, 0xd3, 0x1b, 0x0c, 0x0a, 0x1c, 0x81, 0x18, 0x2f, 0xb1, 0xc8, 0xee, 0xc2, 0x91, 0x72, - 0xdb, 0xdb, 0x3e, 0x46, 0x1f, 0xa2, 0xaf, 0xd2, 0xb7, 0xe9, 0xec, 0xd9, 0x05, 0x44, 0x2a, 0x4d, - 0xc6, 0x33, 0xb9, 0xe0, 0x10, 0xfb, 0x9d, 0x83, 0xdd, 0xf3, 0xf3, 0x9d, 0x6f, 0x01, 0xc7, 0xb9, - 0x94, 0xb9, 0xc0, 0xc3, 0x5c, 0x8a, 0xa4, 0xcc, 0x0f, 0xa5, 0xca, 0x8f, 0x92, 0xaa, 0xc2, 0x32, - 0x2f, 0x4a, 0x3c, 0x2a, 0x4a, 0x83, 0xaa, 0x4c, 0xc4, 0x91, 0x90, 0xb9, 0xfd, 0xc5, 0x1a, 0xd5, - 0xbb, 0x22, 0xc5, 0xc3, 0x4a, 0x49, 0x23, 0xd9, 0xb0, 0xf5, 0x0c, 0x5f, 0xc3, 0x74, 0x29, 0xf3, - 0x73, 0x67, 0x3e, 0x51, 0x4a, 0xaa, 0xf0, 0x4b, 0x18, 0xd2, 0xc3, 0x9f, 0x65, 0x86, 0x6c, 0x17, - 0x3a, 0x67, 0xdf, 0xce, 0x7e, 0xc7, 0xee, 0xc0, 0xf4, 0xf4, 0xf5, 0xf7, 0x2f, 0x96, 0xa7, 0x7f, - 0x89, 0xa3, 0x93, 0xef, 0xde, 0x9c, 0x9c, 0x5f, 0xcc, 0x02, 0xb6, 0x0f, 0x93, 0xf3, 0x8b, 0xb3, - 0xe8, 0xc5, 0xcb, 0x93, 0xf8, 0x24, 0x8a, 0xce, 0xa2, 0x59, 0x27, 0xcc, 0x61, 0xef, 0x8d, 0x46, - 0xf5, 0xa2, 0xaa, 0x96, 0x32, 0x5f, 0x16, 0x25, 0xb2, 0x8f, 0x60, 0xcf, 0x14, 0x6b, 0xd4, 0x26, - 0x59, 0x57, 0x71, 0xad, 0x31, 0xe5, 0xc1, 0xbc, 0xb3, 0xe8, 0x46, 0x93, 0x16, 0x7d, 0xa3, 0x31, - 0x65, 0x07, 0xd0, 0x13, 0xf8, 0x0e, 0x05, 0xef, 0x90, 0xd5, 0x2d, 0x18, 0x87, 0xfe, 0x1a, 0xb5, - 0x4e, 0x72, 0xe4, 0xdd, 0x79, 0x67, 0x31, 0x8c, 0x9a, 0x65, 0xf8, 0x12, 0xa6, 0x37, 0x07, 0xbd, - 0x54, 0xb2, 0xae, 0xd8, 0x9f, 0x60, 0x60, 0x73, 0x15, 0x45, 0x89, 0xbc, 0x33, 0xef, 0x2e, 0x46, - 0x9f, 0xdf, 0x3f, 0x6c, 0x33, 0x3d, 0xdc, 0x0e, 0x2b, 0xea, 0x0b, 0xf7, 0x10, 0x86, 0x30, 0xfe, - 0x5a, 0xd4, 0x7a, 0x15, 0xe1, 0x0f, 0x35, 0x6a, 0xc3, 0x18, 0xec, 0x08, 0x99, 0x6b, 0x1e, 0xcc, - 0x83, 0xc5, 0x38, 0xa2, 0xe7, 0xf0, 0x39, 0xcc, 0xce, 0xd1, 0x9c, 0x9b, 0xc4, 0xd4, 0xba, 0xf1, - 0xbb, 0x07, 0xbb, 0x9a, 0x00, 0xca, 0x67, 0x18, 0xf9, 0x55, 0xf8, 0x1c, 0x86, 0x4b, 0x99, 0x9f, - 0x5d, 0x5e, 0x6a, 0x34, 0xec, 0x11, 0x80, 0x72, 0xfe, 0x71, 0x91, 0xf9, 0x2d, 0x87, 0x1e, 0x39, - 0xcd, 0xc2, 0x0b, 0xe8, 0x37, 0x65, 0x62, 0xb0, 0x63, 0x0b, 0xe2, 0x8b, 0x43, 0xcf, 0xdb, 0x35, - 0xe9, 0x35, 0x35, 0x79, 0x0c, 0x23, 0x9b, 0xe6, 0x76, 0x5d, 0x40, 0xc8, 0xfc, 0x95, 0x2f, 0xcd, - 0x3f, 0x01, 0xc0, 0x47, 0xb9, 0x94, 0x39, 0xbb, 0x0b, 0xbb, 0x49, 0x55, 0xb9, 0xf3, 0xad, 0x6b, - 0x2f, 0xa9, 0xaa, 0xd3, 0x8c, 0x7d, 0x08, 0xc3, 0xb5, 0xcc, 0x6a, 0x81, 0xd6, 0xf2, 0xd1, 0x3c, - 0x58, 0x0c, 0x8f, 0xfb, 0x19, 0x5e, 0x26, 0xb5, 0x30, 0xd1, 0xc0, 0x59, 0x4e, 0x33, 0x9b, 0xc0, - 0x3b, 0x54, 0xba, 0x90, 0xa5, 0x75, 0xeb, 0xd0, 0x06, 0x43, 0x8f, 0x38, 0xf3, 0x46, 0x7e, 0x36, - 0x94, 0xcd, 0xfc, 0xd8, 0x27, 0xb0, 0x2b, 0xa9, 0x10, 0xfc, 0xe9, 0x3c, 0x58, 0x8c, 0x3e, 0x3f, - 0xd8, 0xe8, 0x47, 0x5b, 0xa4, 0xc8, 0xfb, 0xb0, 0x3d, 0xe8, 0x14, 0x15, 0xdf, 0xa1, 0x33, 0x3a, - 0x45, 0xc5, 0x1e, 0xc0, 0xa0, 0x2c, 0xd2, 0xb7, 0x65, 0xb2, 0x46, 0xde, 0xb3, 0x01, 0x46, 0xed, - 0xda, 0x1e, 0xac, 0x4d, 0xa2, 0x4c, 0x4c, 0x45, 0xdb, 0xa5, 0xa2, 0x0d, 0x09, 0xb9, 0xb0, 0x95, - 0xbb, 0x0f, 0x03, 0x2c, 0x33, 0x67, 0xec, 0x93, 0xb1, 0x8f, 0x65, 0x46, 0x26, 0x0e, 0x7d, 0x91, - 0x18, 0x2c, 0xd3, 0x6b, 0x3e, 0x70, 0x16, 0xbf, 0x24, 0xb2, 0xa5, 0xd7, 0xa9, 0x40, 0xcd, 0x87, - 0xce, 0xe2, 0x97, 0xb6, 0xd7, 0x6b, 0x34, 0x2b, 0x99, 0x71, 0x70, 0xbd, 0x76, 0x2b, 0x1b, 0xa1, - 0x42, 0x2d, 0x6b, 0x95, 0x22, 0x1f, 0x91, 0xa5, 0x5d, 0xb3, 0x27, 0x30, 0x5e, 0x19, 0x53, 0xc5, - 0xbe, 0x58, 0x7c, 0x4c, 0xf6, 0x91, 0xc5, 0xbe, 0x77, 0xd0, 0x06, 0x85, 0x26, 0xd4, 0x60, 0xbf, - 0x62, 0x4f, 0x61, 0xa2, 0x50, 0x57, 0xb2, 0xd4, 0x18, 0xeb, 0xe2, 0x27, 0xe4, 0x7b, 0x14, 0xce, - 0xb8, 0x01, 0xcf, 0x8b, 0x9f, 0xd0, 0x9d, 0x7d, 0x89, 0x4a, 0xa1, 0xe2, 0x53, 0x57, 0x9d, 0x66, - 0x6d, 0xab, 0x53, 0x6b, 0x54, 0x71, 0x92, 0x63, 0x69, 0xf8, 0x8c, 0xac, 0x43, 0x8b, 0xbc, 0xb0, - 0x00, 0x0b, 0x61, 0x52, 0x2b, 0x11, 0xaf, 0x93, 0x2a, 0xc6, 0xd2, 0xa8, 0x6b, 0xbe, 0xef, 0x62, - 0xab, 0x95, 0x78, 0x95, 0x54, 0x27, 0x16, 0xb2, 0xdb, 0xa7, 0x72, 0xfd, 0x8f, 0xa2, 0xc4, 0x8c, - 0x33, 0x97, 0x5a, 0xb3, 0xb6, 0x0c, 0x4c, 0xaa, 0x22, 0x6e, 0x8a, 0x75, 0x67, 0x1e, 0x2c, 0xba, - 0x11, 0x24, 0x55, 0xf1, 0xca, 0xd7, 0x8b, 0xc1, 0xce, 0x4a, 0x6a, 0xc3, 0x0f, 0xe8, 0x64, 0x7a, - 0xb6, 0x58, 0x6a, 0xb1, 0xbb, 0xf3, 0x60, 0x11, 0x44, 0xf4, 0xcc, 0x9e, 0xc1, 0xd4, 0x24, 0xfa, - 0x6d, 0xfc, 0x43, 0x8d, 0x35, 0xc6, 0xd4, 0xe8, 0x7b, 0xf4, 0xca, 0xc4, 0xc2, 0xdf, 0x59, 0xf4, - 0xb5, 0xed, 0xf6, 0x43, 0x18, 0x92, 0x1f, 0x79, 0x7c, 0xe0, 0x92, 0xb5, 0x00, 0x19, 0x0f, 0xe1, - 0xce, 0x8f, 0x89, 0x8e, 0x85, 0x4c, 0xb2, 0xa2, 0xcc, 0x63, 0xcf, 0x3e, 0xce, 0xe7, 0xc1, 0x62, - 0x10, 0xed, 0xff, 0x98, 0xe8, 0xa5, 0xb3, 0x34, 0x83, 0xfb, 0x04, 0xc6, 0x15, 0x96, 0xe4, 0x4b, - 0xfc, 0xb8, 0x4f, 0xe1, 0x8f, 0x3c, 0x46, 0x1c, 0xf9, 0xd8, 0x36, 0xa0, 0x12, 0x45, 0x9a, 0xc4, - 0x45, 0x99, 0xe1, 0x15, 0x7f, 0x30, 0x0f, 0x16, 0xbd, 0xe3, 0xce, 0xa7, 0x9f, 0xd9, 0x26, 0x90, - 0xe1, 0xd4, 0xe2, 0x6c, 0x0e, 0x83, 0xcb, 0xa2, 0x2c, 0xf4, 0x0a, 0x33, 0xfe, 0xd0, 0x1e, 0x78, - 0xbc, 0x63, 0x54, 0x8d, 0x51, 0x8b, 0xda, 0xd0, 0x53, 0x21, 0x4b, 0x8c, 0xdf, 0xe2, 0x35, 0xff, - 0x3d, 0x09, 0xc0, 0x80, 0x80, 0x6f, 0xf1, 0x9a, 0x3d, 0x83, 0x1d, 0x52, 0xab, 0x47, 0xa4, 0x56, - 0x6c, 0x7b, 0x3a, 0x48, 0xa6, 0xc8, 0xce, 0xfe, 0x08, 0x33, 0xfb, 0xaf, 0xe3, 0xa2, 0x4c, 0xe5, - 0xba, 0x12, 0x68, 0x90, 0x7f, 0x48, 0xf9, 0x4d, 0x09, 0x3f, 0x6d, 0x61, 0xf6, 0x09, 0x30, 0x3b, - 0xed, 0x6e, 0x9b, 0x58, 0xa1, 0xc0, 0x44, 0x23, 0x7f, 0x46, 0x07, 0xcf, 0x92, 0xaa, 0x3a, 0x21, - 0x43, 0xe4, 0x70, 0xdb, 0x49, 0xbc, 0x2a, 0x4c, 0xac, 0x30, 0xd1, 0xb2, 0xe4, 0x7f, 0xb0, 0x69, - 0x46, 0x60, 0xa1, 0x88, 0x10, 0xf6, 0x05, 0xdc, 0xb3, 0xc5, 0x35, 0x2b, 0x25, 0x8d, 0x11, 0x98, - 0xc5, 0x97, 0x52, 0xb9, 0xb2, 0x3d, 0xa6, 0xf3, 0x6d, 0xe9, 0x2f, 0x1a, 0xe3, 0xd7, 0x52, 0x51, - 0xf9, 0xbe, 0x84, 0x07, 0x3f, 0x7f, 0xc9, 0xf7, 0x45, 0xf3, 0x39, 0xbd, 0xf8, 0xc1, 0xad, 0x17, - 0x7d, 0x77, 0x34, 0xdd, 0x17, 0xed, 0x8b, 0x74, 0xd2, 0x13, 0x6a, 0xd0, 0xa4, 0x45, 0xe9, 0x8c, - 0xc7, 0x30, 0xb2, 0x97, 0x1a, 0x2a, 0x47, 0x8a, 0x90, 0x12, 0x04, 0x07, 0x59, 0x5a, 0x84, 0x7f, - 0x83, 0xd9, 0x52, 0xe6, 0xaf, 0x48, 0xc8, 0x9a, 0x81, 0xdb, 0xd2, 0xbc, 0xe0, 0x7d, 0x35, 0x2f, - 0xd8, 0xd2, 0xbc, 0xf0, 0xbf, 0x3d, 0xd8, 0x5b, 0xca, 0x3c, 0xc2, 0x24, 0x6b, 0x28, 0xf5, 0x0b, - 0x12, 0x7b, 0x7b, 0xa3, 0xee, 0xb6, 0x78, 0x7e, 0x05, 0x7b, 0x3e, 0x9a, 0x46, 0x23, 0xee, 0x10, - 0x0f, 0x1e, 0x6e, 0xf3, 0x60, 0x2b, 0x85, 0x68, 0xb2, 0xde, 0xca, 0x68, 0x5b, 0x07, 0xbb, 0x54, - 0xa9, 0x5f, 0xd0, 0xc1, 0x1d, 0x32, 0xb6, 0x3a, 0x78, 0xa3, 0xcd, 0xbd, 0xf7, 0xd0, 0xe6, 0x6d, - 0xa1, 0xdf, 0x9d, 0x77, 0xb7, 0x85, 0xfe, 0x39, 0xec, 0xaf, 0x8b, 0xb2, 0x58, 0xd7, 0xeb, 0x98, - 0xae, 0x60, 0xba, 0xb5, 0xfa, 0xc4, 0xa6, 0xa9, 0x37, 0x58, 0x46, 0xd3, 0xfd, 0xf5, 0x29, 0xb0, - 0xa2, 0x4c, 0x45, 0x9d, 0xe1, 0x26, 0x9d, 0x07, 0x6e, 0x5c, 0xbd, 0x65, 0x83, 0xd0, 0x07, 0xd0, - 0x4b, 0x65, 0x5d, 0x1a, 0x3e, 0xa4, 0xf8, 0xdd, 0xc2, 0xd2, 0xbc, 0x91, 0x23, 0x3a, 0x51, 0x61, - 0x8e, 0x57, 0x7c, 0x8f, 0x7a, 0x35, 0x6b, 0x2c, 0xd4, 0xa5, 0x1c, 0xaf, 0x6c, 0xf4, 0x56, 0x83, - 0xbc, 0x97, 0x53, 0xcb, 0xa1, 0x45, 0x9c, 0xf9, 0xe9, 0xed, 0x71, 0x9f, 0x51, 0xe4, 0xdb, 0xa3, - 0xbe, 0x80, 0x59, 0x13, 0xb6, 0xed, 0x35, 0x7d, 0x23, 0x00, 0x05, 0xbd, 0xe7, 0x71, 0xf7, 0x75, - 0xa1, 0xd9, 0x11, 0x1c, 0x34, 0x1e, 0x71, 0x85, 0x2d, 0xf3, 0xf9, 0x3e, 0xed, 0xba, 0x9f, 0x38, - 0xb7, 0xbf, 0xa2, 0xda, 0x50, 0xa4, 0x66, 0x6b, 0x92, 0xcd, 0x11, 0x6d, 0x3b, 0xf2, 0xd8, 0x37, - 0x56, 0x29, 0x1f, 0xc3, 0xa8, 0x3d, 0x5d, 0x08, 0x3e, 0x26, 0x0f, 0x68, 0x0e, 0x16, 0xc2, 0x8e, - 0x4d, 0x9a, 0xa4, 0x2b, 0x8c, 0x0b, 0x83, 0x2a, 0x31, 0x52, 0xf1, 0x09, 0xf9, 0x4c, 0x08, 0x3d, - 0xf5, 0xa0, 0xad, 0x44, 0x59, 0xaf, 0x63, 0xbd, 0x4a, 0x54, 0xa6, 0x39, 0xa3, 0x88, 0x86, 0x65, - 0xbd, 0x3e, 0x27, 0x20, 0xfc, 0x57, 0x40, 0xdf, 0x83, 0x8e, 0xdb, 0xee, 0xb2, 0x61, 0x1f, 0x43, - 0x57, 0xc8, 0x9c, 0x07, 0xc4, 0xcd, 0xbb, 0x1b, 0x2c, 0xb9, 0xf9, 0xc6, 0x88, 0xac, 0xc7, 0x06, - 0xa3, 0x3a, 0xef, 0xc1, 0xa8, 0x10, 0x26, 0x22, 0xd1, 0x26, 0x6e, 0xf9, 0xe9, 0xc8, 0x3b, 0xb2, - 0xe0, 0x89, 0xe3, 0x68, 0xf8, 0x9f, 0x80, 0x46, 0xed, 0x8d, 0xfd, 0xac, 0x89, 0x30, 0x95, 0xea, - 0xf6, 0x4c, 0x05, 0xb7, 0x86, 0xf3, 0xd6, 0x3c, 0x74, 0x5c, 0x7e, 0xff, 0x7f, 0x1e, 0xba, 0x64, - 0x6c, 0xe7, 0xa1, 0xe5, 0xd9, 0xce, 0x26, 0xcf, 0x1e, 0x01, 0x18, 0x69, 0x12, 0xe1, 0xee, 0xe1, - 0x9e, 0x9b, 0x2f, 0x42, 0xe8, 0x12, 0xe6, 0xd0, 0x57, 0x14, 0x97, 0xe6, 0xbb, 0x6e, 0x3b, 0xbf, - 0x0c, 0xff, 0xdd, 0xa1, 0x4a, 0xfa, 0xd0, 0x7f, 0x8b, 0x4c, 0xfc, 0x7c, 0xc4, 0x7b, 0xbf, 0x36, - 0xe2, 0xbd, 0xcd, 0x11, 0x9f, 0xd9, 0xcf, 0x11, 0x51, 0x1b, 0xbb, 0xf7, 0x4a, 0xd6, 0x4a, 0x53, - 0x0a, 0x93, 0xe3, 0xe0, 0xb3, 0x68, 0x7a, 0x63, 0xfa, 0xc6, 0x5a, 0xec, 0x25, 0xe3, 0x07, 0xa7, - 0xd1, 0x23, 0x97, 0xd4, 0x20, 0x9a, 0x7a, 0xdc, 0x8b, 0x0e, 0x7d, 0xa0, 0xd4, 0x36, 0xb1, 0x56, - 0xb8, 0xdc, 0xa8, 0x8f, 0x09, 0x6c, 0xa4, 0xe9, 0x29, 0x4c, 0x9a, 0x7d, 0x62, 0x59, 0x8a, 0x6b, - 0x3f, 0xe2, 0xe3, 0x06, 0x3c, 0x2b, 0xc5, 0x75, 0x78, 0x45, 0x2a, 0xed, 0xab, 0xe4, 0x09, 0x77, - 0x04, 0x3d, 0xda, 0xc8, 0x53, 0xee, 0xfe, 0x36, 0x8d, 0x36, 0xc8, 0x10, 0x39, 0x3f, 0xf6, 0x05, - 0xf4, 0x75, 0xbd, 0x5e, 0x27, 0xea, 0xda, 0x33, 0xef, 0x57, 0x5e, 0x69, 0x3c, 0xbf, 0xea, 0xfd, - 0xdd, 0x92, 0xf6, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x70, 0xd9, 0xa0, 0xf8, 0x48, 0x0d, 0x00, - 0x00, -} diff --git a/vendor/google.golang.org/appengine/internal/log/log_service.proto b/vendor/google.golang.org/appengine/internal/log/log_service.proto deleted file mode 100644 index 8981dc475..000000000 --- a/vendor/google.golang.org/appengine/internal/log/log_service.proto +++ /dev/null @@ -1,150 +0,0 @@ -syntax = "proto2"; -option go_package = "log"; - -package appengine; - -message LogServiceError { - enum ErrorCode { - OK = 0; - INVALID_REQUEST = 1; - STORAGE_ERROR = 2; - } -} - -message UserAppLogLine { - required int64 timestamp_usec = 1; - required int64 level = 2; - required string message = 3; -} - -message UserAppLogGroup { - repeated UserAppLogLine log_line = 2; -} - -message FlushRequest { - optional bytes logs = 1; -} - -message SetStatusRequest { - required string status = 1; -} - - -message LogOffset { - optional bytes request_id = 1; -} - -message LogLine { - required int64 time = 1; - required int32 level = 2; - required string log_message = 3; -} - -message RequestLog { - required string app_id = 1; - optional string module_id = 37 [default="default"]; - required string version_id = 2; - required bytes request_id = 3; - optional LogOffset offset = 35; - required string ip = 4; - optional string nickname = 5; - required int64 start_time = 6; - required int64 end_time = 7; - required int64 latency = 8; - required int64 mcycles = 9; - required string method = 10; - required string resource = 11; - required string http_version = 12; - required int32 status = 13; - required int64 response_size = 14; - optional string referrer = 15; - optional string user_agent = 16; - required string url_map_entry = 17; - required string combined = 18; - optional int64 api_mcycles = 19; - optional string host = 20; - optional double cost = 21; - - optional string task_queue_name = 22; - optional string task_name = 23; - - optional bool was_loading_request = 24; - optional int64 pending_time = 25; - optional int32 replica_index = 26 [default = -1]; - optional bool finished = 27 [default = true]; - optional bytes clone_key = 28; - - repeated LogLine line = 29; - - optional bool lines_incomplete = 36; - optional bytes app_engine_release = 38; - - optional int32 exit_reason = 30; - optional bool was_throttled_for_time = 31; - optional bool was_throttled_for_requests = 32; - optional int64 throttled_time = 33; - - optional bytes server_name = 34; -} - -message LogModuleVersion { - optional string module_id = 1 [default="default"]; - optional string version_id = 2; -} - -message LogReadRequest { - required string app_id = 1; - repeated string version_id = 2; - repeated LogModuleVersion module_version = 19; - - optional int64 start_time = 3; - optional int64 end_time = 4; - optional LogOffset offset = 5; - repeated bytes request_id = 6; - - optional int32 minimum_log_level = 7; - optional bool include_incomplete = 8; - optional int64 count = 9; - - optional string combined_log_regex = 14; - optional string host_regex = 15; - optional int32 replica_index = 16; - - optional bool include_app_logs = 10; - optional int32 app_logs_per_request = 17; - optional bool include_host = 11; - optional bool include_all = 12; - optional bool cache_iterator = 13; - optional int32 num_shards = 18; -} - -message LogReadResponse { - repeated RequestLog log = 1; - optional LogOffset offset = 2; - optional int64 last_end_time = 3; -} - -message LogUsageRecord { - optional string version_id = 1; - optional int32 start_time = 2; - optional int32 end_time = 3; - optional int64 count = 4; - optional int64 total_size = 5; - optional int32 records = 6; -} - -message LogUsageRequest { - required string app_id = 1; - repeated string version_id = 2; - optional int32 start_time = 3; - optional int32 end_time = 4; - optional uint32 resolution_hours = 5 [default = 1]; - optional bool combine_versions = 6; - optional int32 usage_version = 7; - optional bool versions_only = 8; -} - -message LogUsageResponse { - repeated LogUsageRecord usage = 1; - optional LogUsageRecord summary = 2; -} diff --git a/vendor/google.golang.org/appengine/internal/main.go b/vendor/google.golang.org/appengine/internal/main.go deleted file mode 100644 index afd0ae84f..000000000 --- a/vendor/google.golang.org/appengine/internal/main.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build appengine -// +build appengine - -package internal - -import ( - "appengine_internal" -) - -func Main() { - MainPath = "" - appengine_internal.Main() -} diff --git a/vendor/google.golang.org/appengine/internal/main_common.go b/vendor/google.golang.org/appengine/internal/main_common.go deleted file mode 100644 index 357dce4dd..000000000 --- a/vendor/google.golang.org/appengine/internal/main_common.go +++ /dev/null @@ -1,7 +0,0 @@ -package internal - -// MainPath stores the file path of the main package. On App Engine Standard -// using Go version 1.9 and below, this will be unset. On App Engine Flex and -// App Engine Standard second-gen (Go 1.11 and above), this will be the -// filepath to package main. -var MainPath string diff --git a/vendor/google.golang.org/appengine/internal/main_vm.go b/vendor/google.golang.org/appengine/internal/main_vm.go deleted file mode 100644 index 86a8caf06..000000000 --- a/vendor/google.golang.org/appengine/internal/main_vm.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -//go:build !appengine -// +build !appengine - -package internal - -import ( - "io" - "log" - "net/http" - "net/url" - "os" - "path/filepath" - "runtime" -) - -func Main() { - MainPath = filepath.Dir(findMainPath()) - installHealthChecker(http.DefaultServeMux) - - port := "8080" - if s := os.Getenv("PORT"); s != "" { - port = s - } - - host := "" - if IsDevAppServer() { - host = "127.0.0.1" - } - if err := http.ListenAndServe(host+":"+port, Middleware(http.DefaultServeMux)); err != nil { - log.Fatalf("http.ListenAndServe: %v", err) - } -} - -// Find the path to package main by looking at the root Caller. -func findMainPath() string { - pc := make([]uintptr, 100) - n := runtime.Callers(2, pc) - frames := runtime.CallersFrames(pc[:n]) - for { - frame, more := frames.Next() - // Tests won't have package main, instead they have testing.tRunner - if frame.Function == "main.main" || frame.Function == "testing.tRunner" { - return frame.File - } - if !more { - break - } - } - return "" -} - -func installHealthChecker(mux *http.ServeMux) { - // If no health check handler has been installed by this point, add a trivial one. - const healthPath = "/_ah/health" - hreq := &http.Request{ - Method: "GET", - URL: &url.URL{ - Path: healthPath, - }, - } - if _, pat := mux.Handler(hreq); pat != healthPath { - mux.HandleFunc(healthPath, func(w http.ResponseWriter, r *http.Request) { - io.WriteString(w, "ok") - }) - } -} diff --git a/vendor/google.golang.org/appengine/internal/metadata.go b/vendor/google.golang.org/appengine/internal/metadata.go deleted file mode 100644 index c4ba63bb4..000000000 --- a/vendor/google.golang.org/appengine/internal/metadata.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -package internal - -// This file has code for accessing metadata. -// -// References: -// https://cloud.google.com/compute/docs/metadata - -import ( - "fmt" - "io/ioutil" - "net/http" - "net/url" -) - -const ( - metadataHost = "metadata" - metadataPath = "/computeMetadata/v1/" -) - -var ( - metadataRequestHeaders = http.Header{ - "Metadata-Flavor": []string{"Google"}, - } -) - -// TODO(dsymonds): Do we need to support default values, like Python? -func mustGetMetadata(key string) []byte { - b, err := getMetadata(key) - if err != nil { - panic(fmt.Sprintf("Metadata fetch failed for '%s': %v", key, err)) - } - return b -} - -func getMetadata(key string) ([]byte, error) { - // TODO(dsymonds): May need to use url.Parse to support keys with query args. - req := &http.Request{ - Method: "GET", - URL: &url.URL{ - Scheme: "http", - Host: metadataHost, - Path: metadataPath + key, - }, - Header: metadataRequestHeaders, - Host: metadataHost, - } - resp, err := http.DefaultClient.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - if resp.StatusCode != 200 { - return nil, fmt.Errorf("metadata server returned HTTP %d", resp.StatusCode) - } - return ioutil.ReadAll(resp.Body) -} diff --git a/vendor/google.golang.org/appengine/internal/net.go b/vendor/google.golang.org/appengine/internal/net.go deleted file mode 100644 index fe429720e..000000000 --- a/vendor/google.golang.org/appengine/internal/net.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2014 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -package internal - -// This file implements a network dialer that limits the number of concurrent connections. -// It is only used for API calls. - -import ( - "log" - "net" - "runtime" - "sync" - "time" -) - -var limitSem = make(chan int, 100) // TODO(dsymonds): Use environment variable. - -func limitRelease() { - // non-blocking - select { - case <-limitSem: - default: - // This should not normally happen. - log.Print("appengine: unbalanced limitSem release!") - } -} - -func limitDial(network, addr string) (net.Conn, error) { - limitSem <- 1 - - // Dial with a timeout in case the API host is MIA. - // The connection should normally be very fast. - conn, err := net.DialTimeout(network, addr, 10*time.Second) - if err != nil { - limitRelease() - return nil, err - } - lc := &limitConn{Conn: conn} - runtime.SetFinalizer(lc, (*limitConn).Close) // shouldn't usually be required - return lc, nil -} - -type limitConn struct { - close sync.Once - net.Conn -} - -func (lc *limitConn) Close() error { - defer lc.close.Do(func() { - limitRelease() - runtime.SetFinalizer(lc, nil) - }) - return lc.Conn.Close() -} diff --git a/vendor/google.golang.org/appengine/internal/regen.sh b/vendor/google.golang.org/appengine/internal/regen.sh deleted file mode 100644 index 2fdb546a6..000000000 --- a/vendor/google.golang.org/appengine/internal/regen.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -e -# -# This script rebuilds the generated code for the protocol buffers. -# To run this you will need protoc and goprotobuf installed; -# see https://github.com/golang/protobuf for instructions. - -PKG=google.golang.org/appengine - -function die() { - echo 1>&2 $* - exit 1 -} - -# Sanity check that the right tools are accessible. -for tool in go protoc protoc-gen-go; do - q=$(which $tool) || die "didn't find $tool" - echo 1>&2 "$tool: $q" -done - -echo -n 1>&2 "finding package dir... " -pkgdir=$(go list -f '{{.Dir}}' $PKG) -echo 1>&2 $pkgdir -base=$(echo $pkgdir | sed "s,/$PKG\$,,") -echo 1>&2 "base: $base" -cd $base - -# Run protoc once per package. -for dir in $(find $PKG/internal -name '*.proto' | xargs dirname | sort | uniq); do - echo 1>&2 "* $dir" - protoc --go_out=. $dir/*.proto -done - -for f in $(find $PKG/internal -name '*.pb.go'); do - # Remove proto.RegisterEnum calls. - # These cause duplicate registration panics when these packages - # are used on classic App Engine. proto.RegisterEnum only affects - # parsing the text format; we don't care about that. - # https://code.google.com/p/googleappengine/issues/detail?id=11670#c17 - sed -i '/proto.RegisterEnum/d' $f -done diff --git a/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go b/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go deleted file mode 100644 index 8d782a38e..000000000 --- a/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go +++ /dev/null @@ -1,361 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google.golang.org/appengine/internal/remote_api/remote_api.proto - -package remote_api - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type RpcError_ErrorCode int32 - -const ( - RpcError_UNKNOWN RpcError_ErrorCode = 0 - RpcError_CALL_NOT_FOUND RpcError_ErrorCode = 1 - RpcError_PARSE_ERROR RpcError_ErrorCode = 2 - RpcError_SECURITY_VIOLATION RpcError_ErrorCode = 3 - RpcError_OVER_QUOTA RpcError_ErrorCode = 4 - RpcError_REQUEST_TOO_LARGE RpcError_ErrorCode = 5 - RpcError_CAPABILITY_DISABLED RpcError_ErrorCode = 6 - RpcError_FEATURE_DISABLED RpcError_ErrorCode = 7 - RpcError_BAD_REQUEST RpcError_ErrorCode = 8 - RpcError_RESPONSE_TOO_LARGE RpcError_ErrorCode = 9 - RpcError_CANCELLED RpcError_ErrorCode = 10 - RpcError_REPLAY_ERROR RpcError_ErrorCode = 11 - RpcError_DEADLINE_EXCEEDED RpcError_ErrorCode = 12 -) - -var RpcError_ErrorCode_name = map[int32]string{ - 0: "UNKNOWN", - 1: "CALL_NOT_FOUND", - 2: "PARSE_ERROR", - 3: "SECURITY_VIOLATION", - 4: "OVER_QUOTA", - 5: "REQUEST_TOO_LARGE", - 6: "CAPABILITY_DISABLED", - 7: "FEATURE_DISABLED", - 8: "BAD_REQUEST", - 9: "RESPONSE_TOO_LARGE", - 10: "CANCELLED", - 11: "REPLAY_ERROR", - 12: "DEADLINE_EXCEEDED", -} -var RpcError_ErrorCode_value = map[string]int32{ - "UNKNOWN": 0, - "CALL_NOT_FOUND": 1, - "PARSE_ERROR": 2, - "SECURITY_VIOLATION": 3, - "OVER_QUOTA": 4, - "REQUEST_TOO_LARGE": 5, - "CAPABILITY_DISABLED": 6, - "FEATURE_DISABLED": 7, - "BAD_REQUEST": 8, - "RESPONSE_TOO_LARGE": 9, - "CANCELLED": 10, - "REPLAY_ERROR": 11, - "DEADLINE_EXCEEDED": 12, -} - -func (x RpcError_ErrorCode) Enum() *RpcError_ErrorCode { - p := new(RpcError_ErrorCode) - *p = x - return p -} -func (x RpcError_ErrorCode) String() string { - return proto.EnumName(RpcError_ErrorCode_name, int32(x)) -} -func (x *RpcError_ErrorCode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(RpcError_ErrorCode_value, data, "RpcError_ErrorCode") - if err != nil { - return err - } - *x = RpcError_ErrorCode(value) - return nil -} -func (RpcError_ErrorCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_remote_api_1978114ec33a273d, []int{2, 0} -} - -type Request struct { - ServiceName *string `protobuf:"bytes,2,req,name=service_name,json=serviceName" json:"service_name,omitempty"` - Method *string `protobuf:"bytes,3,req,name=method" json:"method,omitempty"` - Request []byte `protobuf:"bytes,4,req,name=request" json:"request,omitempty"` - RequestId *string `protobuf:"bytes,5,opt,name=request_id,json=requestId" json:"request_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_remote_api_1978114ec33a273d, []int{0} -} -func (m *Request) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Request.Unmarshal(m, b) -} -func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Request.Marshal(b, m, deterministic) -} -func (dst *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(dst, src) -} -func (m *Request) XXX_Size() int { - return xxx_messageInfo_Request.Size(m) -} -func (m *Request) XXX_DiscardUnknown() { - xxx_messageInfo_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_Request proto.InternalMessageInfo - -func (m *Request) GetServiceName() string { - if m != nil && m.ServiceName != nil { - return *m.ServiceName - } - return "" -} - -func (m *Request) GetMethod() string { - if m != nil && m.Method != nil { - return *m.Method - } - return "" -} - -func (m *Request) GetRequest() []byte { - if m != nil { - return m.Request - } - return nil -} - -func (m *Request) GetRequestId() string { - if m != nil && m.RequestId != nil { - return *m.RequestId - } - return "" -} - -type ApplicationError struct { - Code *int32 `protobuf:"varint,1,req,name=code" json:"code,omitempty"` - Detail *string `protobuf:"bytes,2,req,name=detail" json:"detail,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplicationError) Reset() { *m = ApplicationError{} } -func (m *ApplicationError) String() string { return proto.CompactTextString(m) } -func (*ApplicationError) ProtoMessage() {} -func (*ApplicationError) Descriptor() ([]byte, []int) { - return fileDescriptor_remote_api_1978114ec33a273d, []int{1} -} -func (m *ApplicationError) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplicationError.Unmarshal(m, b) -} -func (m *ApplicationError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplicationError.Marshal(b, m, deterministic) -} -func (dst *ApplicationError) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplicationError.Merge(dst, src) -} -func (m *ApplicationError) XXX_Size() int { - return xxx_messageInfo_ApplicationError.Size(m) -} -func (m *ApplicationError) XXX_DiscardUnknown() { - xxx_messageInfo_ApplicationError.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplicationError proto.InternalMessageInfo - -func (m *ApplicationError) GetCode() int32 { - if m != nil && m.Code != nil { - return *m.Code - } - return 0 -} - -func (m *ApplicationError) GetDetail() string { - if m != nil && m.Detail != nil { - return *m.Detail - } - return "" -} - -type RpcError struct { - Code *int32 `protobuf:"varint,1,req,name=code" json:"code,omitempty"` - Detail *string `protobuf:"bytes,2,opt,name=detail" json:"detail,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RpcError) Reset() { *m = RpcError{} } -func (m *RpcError) String() string { return proto.CompactTextString(m) } -func (*RpcError) ProtoMessage() {} -func (*RpcError) Descriptor() ([]byte, []int) { - return fileDescriptor_remote_api_1978114ec33a273d, []int{2} -} -func (m *RpcError) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RpcError.Unmarshal(m, b) -} -func (m *RpcError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RpcError.Marshal(b, m, deterministic) -} -func (dst *RpcError) XXX_Merge(src proto.Message) { - xxx_messageInfo_RpcError.Merge(dst, src) -} -func (m *RpcError) XXX_Size() int { - return xxx_messageInfo_RpcError.Size(m) -} -func (m *RpcError) XXX_DiscardUnknown() { - xxx_messageInfo_RpcError.DiscardUnknown(m) -} - -var xxx_messageInfo_RpcError proto.InternalMessageInfo - -func (m *RpcError) GetCode() int32 { - if m != nil && m.Code != nil { - return *m.Code - } - return 0 -} - -func (m *RpcError) GetDetail() string { - if m != nil && m.Detail != nil { - return *m.Detail - } - return "" -} - -type Response struct { - Response []byte `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"` - Exception []byte `protobuf:"bytes,2,opt,name=exception" json:"exception,omitempty"` - ApplicationError *ApplicationError `protobuf:"bytes,3,opt,name=application_error,json=applicationError" json:"application_error,omitempty"` - JavaException []byte `protobuf:"bytes,4,opt,name=java_exception,json=javaException" json:"java_exception,omitempty"` - RpcError *RpcError `protobuf:"bytes,5,opt,name=rpc_error,json=rpcError" json:"rpc_error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Response) Reset() { *m = Response{} } -func (m *Response) String() string { return proto.CompactTextString(m) } -func (*Response) ProtoMessage() {} -func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_remote_api_1978114ec33a273d, []int{3} -} -func (m *Response) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Response.Unmarshal(m, b) -} -func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Response.Marshal(b, m, deterministic) -} -func (dst *Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_Response.Merge(dst, src) -} -func (m *Response) XXX_Size() int { - return xxx_messageInfo_Response.Size(m) -} -func (m *Response) XXX_DiscardUnknown() { - xxx_messageInfo_Response.DiscardUnknown(m) -} - -var xxx_messageInfo_Response proto.InternalMessageInfo - -func (m *Response) GetResponse() []byte { - if m != nil { - return m.Response - } - return nil -} - -func (m *Response) GetException() []byte { - if m != nil { - return m.Exception - } - return nil -} - -func (m *Response) GetApplicationError() *ApplicationError { - if m != nil { - return m.ApplicationError - } - return nil -} - -func (m *Response) GetJavaException() []byte { - if m != nil { - return m.JavaException - } - return nil -} - -func (m *Response) GetRpcError() *RpcError { - if m != nil { - return m.RpcError - } - return nil -} - -func init() { - proto.RegisterType((*Request)(nil), "remote_api.Request") - proto.RegisterType((*ApplicationError)(nil), "remote_api.ApplicationError") - proto.RegisterType((*RpcError)(nil), "remote_api.RpcError") - proto.RegisterType((*Response)(nil), "remote_api.Response") -} - -func init() { - proto.RegisterFile("google.golang.org/appengine/internal/remote_api/remote_api.proto", fileDescriptor_remote_api_1978114ec33a273d) -} - -var fileDescriptor_remote_api_1978114ec33a273d = []byte{ - // 531 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x51, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xb1, 0x9b, 0x34, 0xf1, 0xc4, 0x2d, 0xdb, 0xa5, 0x14, 0x0b, 0x15, 0x29, 0x44, 0x42, - 0xca, 0x53, 0x2a, 0x38, 0x00, 0x62, 0x63, 0x6f, 0x91, 0x85, 0x65, 0xa7, 0x6b, 0xbb, 0x50, 0x5e, - 0x56, 0x2b, 0x67, 0x65, 0x8c, 0x12, 0xaf, 0xd9, 0x98, 0x8a, 0x17, 0x6e, 0xc0, 0xb5, 0x38, 0x0c, - 0xb7, 0x40, 0x36, 0x6e, 0x63, 0xf5, 0x89, 0xb7, 0x7f, 0x7e, 0x7b, 0xe6, 0x1b, 0xcd, 0xcc, 0xc2, - 0xbb, 0x5c, 0xa9, 0x7c, 0x23, 0x17, 0xb9, 0xda, 0x88, 0x32, 0x5f, 0x28, 0x9d, 0x5f, 0x88, 0xaa, - 0x92, 0x65, 0x5e, 0x94, 0xf2, 0xa2, 0x28, 0x6b, 0xa9, 0x4b, 0xb1, 0xb9, 0xd0, 0x72, 0xab, 0x6a, - 0xc9, 0x45, 0x55, 0xf4, 0xe4, 0xa2, 0xd2, 0xaa, 0x56, 0x18, 0xf6, 0xce, 0xec, 0x27, 0x8c, 0x98, - 0xfc, 0xf6, 0x5d, 0xee, 0x6a, 0xfc, 0x12, 0xec, 0x9d, 0xd4, 0xb7, 0x45, 0x26, 0x79, 0x29, 0xb6, - 0xd2, 0x31, 0xa7, 0xe6, 0xdc, 0x62, 0x93, 0xce, 0x0b, 0xc5, 0x56, 0xe2, 0x33, 0x38, 0xdc, 0xca, - 0xfa, 0x8b, 0x5a, 0x3b, 0x07, 0xed, 0xc7, 0x2e, 0xc2, 0x0e, 0x8c, 0xf4, 0xbf, 0x2a, 0xce, 0x60, - 0x6a, 0xce, 0x6d, 0x76, 0x17, 0xe2, 0x17, 0x00, 0x9d, 0xe4, 0xc5, 0xda, 0x19, 0x4e, 0x8d, 0xb9, - 0xc5, 0xac, 0xce, 0xf1, 0xd7, 0xb3, 0xb7, 0x80, 0x48, 0x55, 0x6d, 0x8a, 0x4c, 0xd4, 0x85, 0x2a, - 0xa9, 0xd6, 0x4a, 0x63, 0x0c, 0x83, 0x4c, 0xad, 0xa5, 0x63, 0x4c, 0xcd, 0xf9, 0x90, 0xb5, 0xba, - 0x01, 0xaf, 0x65, 0x2d, 0x8a, 0x4d, 0xd7, 0x55, 0x17, 0xcd, 0x7e, 0x9b, 0x30, 0x66, 0x55, 0xf6, - 0x7f, 0x89, 0x46, 0x2f, 0xf1, 0x97, 0x09, 0x56, 0x9b, 0xe5, 0x36, 0x7f, 0x4d, 0x60, 0x94, 0x86, - 0x1f, 0xc2, 0xe8, 0x63, 0x88, 0x1e, 0x61, 0x0c, 0xc7, 0x2e, 0x09, 0x02, 0x1e, 0x46, 0x09, 0xbf, - 0x8c, 0xd2, 0xd0, 0x43, 0x06, 0x7e, 0x0c, 0x93, 0x15, 0x61, 0x31, 0xe5, 0x94, 0xb1, 0x88, 0x21, - 0x13, 0x9f, 0x01, 0x8e, 0xa9, 0x9b, 0x32, 0x3f, 0xb9, 0xe1, 0xd7, 0x7e, 0x14, 0x90, 0xc4, 0x8f, - 0x42, 0x74, 0x80, 0x8f, 0x01, 0xa2, 0x6b, 0xca, 0xf8, 0x55, 0x1a, 0x25, 0x04, 0x0d, 0xf0, 0x53, - 0x38, 0x61, 0xf4, 0x2a, 0xa5, 0x71, 0xc2, 0x93, 0x28, 0xe2, 0x01, 0x61, 0xef, 0x29, 0x1a, 0xe2, - 0x67, 0xf0, 0xc4, 0x25, 0x2b, 0xb2, 0xf4, 0x83, 0xa6, 0x80, 0xe7, 0xc7, 0x64, 0x19, 0x50, 0x0f, - 0x1d, 0xe2, 0x53, 0x40, 0x97, 0x94, 0x24, 0x29, 0xa3, 0x7b, 0x77, 0xd4, 0xe0, 0x97, 0xc4, 0xe3, - 0x5d, 0x25, 0x34, 0x6e, 0xf0, 0x8c, 0xc6, 0xab, 0x28, 0x8c, 0x69, 0xaf, 0xae, 0x85, 0x8f, 0xc0, - 0x72, 0x49, 0xe8, 0xd2, 0xa0, 0xc9, 0x03, 0x8c, 0xc0, 0x66, 0x74, 0x15, 0x90, 0x9b, 0xae, 0xef, - 0x49, 0xd3, 0x8f, 0x47, 0x89, 0x17, 0xf8, 0x21, 0xe5, 0xf4, 0x93, 0x4b, 0xa9, 0x47, 0x3d, 0x64, - 0xcf, 0xfe, 0x18, 0x30, 0x66, 0x72, 0x57, 0xa9, 0x72, 0x27, 0xf1, 0x73, 0x18, 0xeb, 0x4e, 0x3b, - 0xc6, 0xd4, 0x98, 0xdb, 0xec, 0x3e, 0xc6, 0xe7, 0x60, 0xc9, 0x1f, 0x99, 0xac, 0x9a, 0x75, 0xb5, - 0x23, 0xb5, 0xd9, 0xde, 0xc0, 0x3e, 0x9c, 0x88, 0xfd, 0x3a, 0xb9, 0x6c, 0x06, 0xec, 0x1c, 0x4c, - 0x8d, 0xf9, 0xe4, 0xcd, 0xf9, 0xa2, 0x77, 0x87, 0x0f, 0x77, 0xce, 0x90, 0x78, 0x78, 0x05, 0xaf, - 0xe0, 0xf8, 0xab, 0xb8, 0x15, 0x7c, 0x4f, 0x1b, 0xb4, 0xb4, 0xa3, 0xc6, 0xa5, 0xf7, 0xc4, 0xd7, - 0x60, 0xe9, 0x2a, 0xeb, 0x48, 0xc3, 0x96, 0x74, 0xda, 0x27, 0xdd, 0x1d, 0x07, 0x1b, 0xeb, 0x4e, - 0x2d, 0xed, 0xcf, 0xbd, 0x07, 0xf0, 0x37, 0x00, 0x00, 0xff, 0xff, 0x38, 0xd1, 0x0f, 0x22, 0x4f, - 0x03, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto b/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto deleted file mode 100644 index f21763a4e..000000000 --- a/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto +++ /dev/null @@ -1,44 +0,0 @@ -syntax = "proto2"; -option go_package = "remote_api"; - -package remote_api; - -message Request { - required string service_name = 2; - required string method = 3; - required bytes request = 4; - optional string request_id = 5; -} - -message ApplicationError { - required int32 code = 1; - required string detail = 2; -} - -message RpcError { - enum ErrorCode { - UNKNOWN = 0; - CALL_NOT_FOUND = 1; - PARSE_ERROR = 2; - SECURITY_VIOLATION = 3; - OVER_QUOTA = 4; - REQUEST_TOO_LARGE = 5; - CAPABILITY_DISABLED = 6; - FEATURE_DISABLED = 7; - BAD_REQUEST = 8; - RESPONSE_TOO_LARGE = 9; - CANCELLED = 10; - REPLAY_ERROR = 11; - DEADLINE_EXCEEDED = 12; - } - required int32 code = 1; - optional string detail = 2; -} - -message Response { - optional bytes response = 1; - optional bytes exception = 2; - optional ApplicationError application_error = 3; - optional bytes java_exception = 4; - optional RpcError rpc_error = 5; -} diff --git a/vendor/google.golang.org/appengine/internal/transaction.go b/vendor/google.golang.org/appengine/internal/transaction.go deleted file mode 100644 index 2ae8ab9fa..000000000 --- a/vendor/google.golang.org/appengine/internal/transaction.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2014 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -package internal - -// This file implements hooks for applying datastore transactions. - -import ( - "context" - "errors" - "reflect" - - "github.com/golang/protobuf/proto" - - basepb "google.golang.org/appengine/internal/base" - pb "google.golang.org/appengine/internal/datastore" -) - -var transactionSetters = make(map[reflect.Type]reflect.Value) - -// RegisterTransactionSetter registers a function that sets transaction information -// in a protocol buffer message. f should be a function with two arguments, -// the first being a protocol buffer type, and the second being *datastore.Transaction. -func RegisterTransactionSetter(f interface{}) { - v := reflect.ValueOf(f) - transactionSetters[v.Type().In(0)] = v -} - -// applyTransaction applies the transaction t to message pb -// by using the relevant setter passed to RegisterTransactionSetter. -func applyTransaction(pb proto.Message, t *pb.Transaction) { - v := reflect.ValueOf(pb) - if f, ok := transactionSetters[v.Type()]; ok { - f.Call([]reflect.Value{v, reflect.ValueOf(t)}) - } -} - -var transactionKey = "used for *Transaction" - -func transactionFromContext(ctx context.Context) *transaction { - t, _ := ctx.Value(&transactionKey).(*transaction) - return t -} - -func withTransaction(ctx context.Context, t *transaction) context.Context { - return context.WithValue(ctx, &transactionKey, t) -} - -type transaction struct { - transaction pb.Transaction - finished bool -} - -var ErrConcurrentTransaction = errors.New("internal: concurrent transaction") - -func RunTransactionOnce(c context.Context, f func(context.Context) error, xg bool, readOnly bool, previousTransaction *pb.Transaction) (*pb.Transaction, error) { - if transactionFromContext(c) != nil { - return nil, errors.New("nested transactions are not supported") - } - - // Begin the transaction. - t := &transaction{} - req := &pb.BeginTransactionRequest{ - App: proto.String(FullyQualifiedAppID(c)), - } - if xg { - req.AllowMultipleEg = proto.Bool(true) - } - if previousTransaction != nil { - req.PreviousTransaction = previousTransaction - } - if readOnly { - req.Mode = pb.BeginTransactionRequest_READ_ONLY.Enum() - } else { - req.Mode = pb.BeginTransactionRequest_READ_WRITE.Enum() - } - if err := Call(c, "datastore_v3", "BeginTransaction", req, &t.transaction); err != nil { - return nil, err - } - - // Call f, rolling back the transaction if f returns a non-nil error, or panics. - // The panic is not recovered. - defer func() { - if t.finished { - return - } - t.finished = true - // Ignore the error return value, since we are already returning a non-nil - // error (or we're panicking). - Call(c, "datastore_v3", "Rollback", &t.transaction, &basepb.VoidProto{}) - }() - if err := f(withTransaction(c, t)); err != nil { - return &t.transaction, err - } - t.finished = true - - // Commit the transaction. - res := &pb.CommitResponse{} - err := Call(c, "datastore_v3", "Commit", &t.transaction, res) - if ae, ok := err.(*APIError); ok { - /* TODO: restore this conditional - if appengine.IsDevAppServer() { - */ - // The Python Dev AppServer raises an ApplicationError with error code 2 (which is - // Error.CONCURRENT_TRANSACTION) and message "Concurrency exception.". - if ae.Code == int32(pb.Error_BAD_REQUEST) && ae.Detail == "ApplicationError: 2 Concurrency exception." { - return &t.transaction, ErrConcurrentTransaction - } - if ae.Code == int32(pb.Error_CONCURRENT_TRANSACTION) { - return &t.transaction, ErrConcurrentTransaction - } - } - return &t.transaction, err -} diff --git a/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go b/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go deleted file mode 100644 index 5f727750a..000000000 --- a/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go +++ /dev/null @@ -1,527 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto - -package urlfetch - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type URLFetchServiceError_ErrorCode int32 - -const ( - URLFetchServiceError_OK URLFetchServiceError_ErrorCode = 0 - URLFetchServiceError_INVALID_URL URLFetchServiceError_ErrorCode = 1 - URLFetchServiceError_FETCH_ERROR URLFetchServiceError_ErrorCode = 2 - URLFetchServiceError_UNSPECIFIED_ERROR URLFetchServiceError_ErrorCode = 3 - URLFetchServiceError_RESPONSE_TOO_LARGE URLFetchServiceError_ErrorCode = 4 - URLFetchServiceError_DEADLINE_EXCEEDED URLFetchServiceError_ErrorCode = 5 - URLFetchServiceError_SSL_CERTIFICATE_ERROR URLFetchServiceError_ErrorCode = 6 - URLFetchServiceError_DNS_ERROR URLFetchServiceError_ErrorCode = 7 - URLFetchServiceError_CLOSED URLFetchServiceError_ErrorCode = 8 - URLFetchServiceError_INTERNAL_TRANSIENT_ERROR URLFetchServiceError_ErrorCode = 9 - URLFetchServiceError_TOO_MANY_REDIRECTS URLFetchServiceError_ErrorCode = 10 - URLFetchServiceError_MALFORMED_REPLY URLFetchServiceError_ErrorCode = 11 - URLFetchServiceError_CONNECTION_ERROR URLFetchServiceError_ErrorCode = 12 -) - -var URLFetchServiceError_ErrorCode_name = map[int32]string{ - 0: "OK", - 1: "INVALID_URL", - 2: "FETCH_ERROR", - 3: "UNSPECIFIED_ERROR", - 4: "RESPONSE_TOO_LARGE", - 5: "DEADLINE_EXCEEDED", - 6: "SSL_CERTIFICATE_ERROR", - 7: "DNS_ERROR", - 8: "CLOSED", - 9: "INTERNAL_TRANSIENT_ERROR", - 10: "TOO_MANY_REDIRECTS", - 11: "MALFORMED_REPLY", - 12: "CONNECTION_ERROR", -} -var URLFetchServiceError_ErrorCode_value = map[string]int32{ - "OK": 0, - "INVALID_URL": 1, - "FETCH_ERROR": 2, - "UNSPECIFIED_ERROR": 3, - "RESPONSE_TOO_LARGE": 4, - "DEADLINE_EXCEEDED": 5, - "SSL_CERTIFICATE_ERROR": 6, - "DNS_ERROR": 7, - "CLOSED": 8, - "INTERNAL_TRANSIENT_ERROR": 9, - "TOO_MANY_REDIRECTS": 10, - "MALFORMED_REPLY": 11, - "CONNECTION_ERROR": 12, -} - -func (x URLFetchServiceError_ErrorCode) Enum() *URLFetchServiceError_ErrorCode { - p := new(URLFetchServiceError_ErrorCode) - *p = x - return p -} -func (x URLFetchServiceError_ErrorCode) String() string { - return proto.EnumName(URLFetchServiceError_ErrorCode_name, int32(x)) -} -func (x *URLFetchServiceError_ErrorCode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(URLFetchServiceError_ErrorCode_value, data, "URLFetchServiceError_ErrorCode") - if err != nil { - return err - } - *x = URLFetchServiceError_ErrorCode(value) - return nil -} -func (URLFetchServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{0, 0} -} - -type URLFetchRequest_RequestMethod int32 - -const ( - URLFetchRequest_GET URLFetchRequest_RequestMethod = 1 - URLFetchRequest_POST URLFetchRequest_RequestMethod = 2 - URLFetchRequest_HEAD URLFetchRequest_RequestMethod = 3 - URLFetchRequest_PUT URLFetchRequest_RequestMethod = 4 - URLFetchRequest_DELETE URLFetchRequest_RequestMethod = 5 - URLFetchRequest_PATCH URLFetchRequest_RequestMethod = 6 -) - -var URLFetchRequest_RequestMethod_name = map[int32]string{ - 1: "GET", - 2: "POST", - 3: "HEAD", - 4: "PUT", - 5: "DELETE", - 6: "PATCH", -} -var URLFetchRequest_RequestMethod_value = map[string]int32{ - "GET": 1, - "POST": 2, - "HEAD": 3, - "PUT": 4, - "DELETE": 5, - "PATCH": 6, -} - -func (x URLFetchRequest_RequestMethod) Enum() *URLFetchRequest_RequestMethod { - p := new(URLFetchRequest_RequestMethod) - *p = x - return p -} -func (x URLFetchRequest_RequestMethod) String() string { - return proto.EnumName(URLFetchRequest_RequestMethod_name, int32(x)) -} -func (x *URLFetchRequest_RequestMethod) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(URLFetchRequest_RequestMethod_value, data, "URLFetchRequest_RequestMethod") - if err != nil { - return err - } - *x = URLFetchRequest_RequestMethod(value) - return nil -} -func (URLFetchRequest_RequestMethod) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{1, 0} -} - -type URLFetchServiceError struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *URLFetchServiceError) Reset() { *m = URLFetchServiceError{} } -func (m *URLFetchServiceError) String() string { return proto.CompactTextString(m) } -func (*URLFetchServiceError) ProtoMessage() {} -func (*URLFetchServiceError) Descriptor() ([]byte, []int) { - return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{0} -} -func (m *URLFetchServiceError) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_URLFetchServiceError.Unmarshal(m, b) -} -func (m *URLFetchServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_URLFetchServiceError.Marshal(b, m, deterministic) -} -func (dst *URLFetchServiceError) XXX_Merge(src proto.Message) { - xxx_messageInfo_URLFetchServiceError.Merge(dst, src) -} -func (m *URLFetchServiceError) XXX_Size() int { - return xxx_messageInfo_URLFetchServiceError.Size(m) -} -func (m *URLFetchServiceError) XXX_DiscardUnknown() { - xxx_messageInfo_URLFetchServiceError.DiscardUnknown(m) -} - -var xxx_messageInfo_URLFetchServiceError proto.InternalMessageInfo - -type URLFetchRequest struct { - Method *URLFetchRequest_RequestMethod `protobuf:"varint,1,req,name=Method,enum=appengine.URLFetchRequest_RequestMethod" json:"Method,omitempty"` - Url *string `protobuf:"bytes,2,req,name=Url" json:"Url,omitempty"` - Header []*URLFetchRequest_Header `protobuf:"group,3,rep,name=Header,json=header" json:"header,omitempty"` - Payload []byte `protobuf:"bytes,6,opt,name=Payload" json:"Payload,omitempty"` - FollowRedirects *bool `protobuf:"varint,7,opt,name=FollowRedirects,def=1" json:"FollowRedirects,omitempty"` - Deadline *float64 `protobuf:"fixed64,8,opt,name=Deadline" json:"Deadline,omitempty"` - MustValidateServerCertificate *bool `protobuf:"varint,9,opt,name=MustValidateServerCertificate,def=1" json:"MustValidateServerCertificate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *URLFetchRequest) Reset() { *m = URLFetchRequest{} } -func (m *URLFetchRequest) String() string { return proto.CompactTextString(m) } -func (*URLFetchRequest) ProtoMessage() {} -func (*URLFetchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{1} -} -func (m *URLFetchRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_URLFetchRequest.Unmarshal(m, b) -} -func (m *URLFetchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_URLFetchRequest.Marshal(b, m, deterministic) -} -func (dst *URLFetchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_URLFetchRequest.Merge(dst, src) -} -func (m *URLFetchRequest) XXX_Size() int { - return xxx_messageInfo_URLFetchRequest.Size(m) -} -func (m *URLFetchRequest) XXX_DiscardUnknown() { - xxx_messageInfo_URLFetchRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_URLFetchRequest proto.InternalMessageInfo - -const Default_URLFetchRequest_FollowRedirects bool = true -const Default_URLFetchRequest_MustValidateServerCertificate bool = true - -func (m *URLFetchRequest) GetMethod() URLFetchRequest_RequestMethod { - if m != nil && m.Method != nil { - return *m.Method - } - return URLFetchRequest_GET -} - -func (m *URLFetchRequest) GetUrl() string { - if m != nil && m.Url != nil { - return *m.Url - } - return "" -} - -func (m *URLFetchRequest) GetHeader() []*URLFetchRequest_Header { - if m != nil { - return m.Header - } - return nil -} - -func (m *URLFetchRequest) GetPayload() []byte { - if m != nil { - return m.Payload - } - return nil -} - -func (m *URLFetchRequest) GetFollowRedirects() bool { - if m != nil && m.FollowRedirects != nil { - return *m.FollowRedirects - } - return Default_URLFetchRequest_FollowRedirects -} - -func (m *URLFetchRequest) GetDeadline() float64 { - if m != nil && m.Deadline != nil { - return *m.Deadline - } - return 0 -} - -func (m *URLFetchRequest) GetMustValidateServerCertificate() bool { - if m != nil && m.MustValidateServerCertificate != nil { - return *m.MustValidateServerCertificate - } - return Default_URLFetchRequest_MustValidateServerCertificate -} - -type URLFetchRequest_Header struct { - Key *string `protobuf:"bytes,4,req,name=Key" json:"Key,omitempty"` - Value *string `protobuf:"bytes,5,req,name=Value" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *URLFetchRequest_Header) Reset() { *m = URLFetchRequest_Header{} } -func (m *URLFetchRequest_Header) String() string { return proto.CompactTextString(m) } -func (*URLFetchRequest_Header) ProtoMessage() {} -func (*URLFetchRequest_Header) Descriptor() ([]byte, []int) { - return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{1, 0} -} -func (m *URLFetchRequest_Header) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_URLFetchRequest_Header.Unmarshal(m, b) -} -func (m *URLFetchRequest_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_URLFetchRequest_Header.Marshal(b, m, deterministic) -} -func (dst *URLFetchRequest_Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_URLFetchRequest_Header.Merge(dst, src) -} -func (m *URLFetchRequest_Header) XXX_Size() int { - return xxx_messageInfo_URLFetchRequest_Header.Size(m) -} -func (m *URLFetchRequest_Header) XXX_DiscardUnknown() { - xxx_messageInfo_URLFetchRequest_Header.DiscardUnknown(m) -} - -var xxx_messageInfo_URLFetchRequest_Header proto.InternalMessageInfo - -func (m *URLFetchRequest_Header) GetKey() string { - if m != nil && m.Key != nil { - return *m.Key - } - return "" -} - -func (m *URLFetchRequest_Header) GetValue() string { - if m != nil && m.Value != nil { - return *m.Value - } - return "" -} - -type URLFetchResponse struct { - Content []byte `protobuf:"bytes,1,opt,name=Content" json:"Content,omitempty"` - StatusCode *int32 `protobuf:"varint,2,req,name=StatusCode" json:"StatusCode,omitempty"` - Header []*URLFetchResponse_Header `protobuf:"group,3,rep,name=Header,json=header" json:"header,omitempty"` - ContentWasTruncated *bool `protobuf:"varint,6,opt,name=ContentWasTruncated,def=0" json:"ContentWasTruncated,omitempty"` - ExternalBytesSent *int64 `protobuf:"varint,7,opt,name=ExternalBytesSent" json:"ExternalBytesSent,omitempty"` - ExternalBytesReceived *int64 `protobuf:"varint,8,opt,name=ExternalBytesReceived" json:"ExternalBytesReceived,omitempty"` - FinalUrl *string `protobuf:"bytes,9,opt,name=FinalUrl" json:"FinalUrl,omitempty"` - ApiCpuMilliseconds *int64 `protobuf:"varint,10,opt,name=ApiCpuMilliseconds,def=0" json:"ApiCpuMilliseconds,omitempty"` - ApiBytesSent *int64 `protobuf:"varint,11,opt,name=ApiBytesSent,def=0" json:"ApiBytesSent,omitempty"` - ApiBytesReceived *int64 `protobuf:"varint,12,opt,name=ApiBytesReceived,def=0" json:"ApiBytesReceived,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *URLFetchResponse) Reset() { *m = URLFetchResponse{} } -func (m *URLFetchResponse) String() string { return proto.CompactTextString(m) } -func (*URLFetchResponse) ProtoMessage() {} -func (*URLFetchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{2} -} -func (m *URLFetchResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_URLFetchResponse.Unmarshal(m, b) -} -func (m *URLFetchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_URLFetchResponse.Marshal(b, m, deterministic) -} -func (dst *URLFetchResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_URLFetchResponse.Merge(dst, src) -} -func (m *URLFetchResponse) XXX_Size() int { - return xxx_messageInfo_URLFetchResponse.Size(m) -} -func (m *URLFetchResponse) XXX_DiscardUnknown() { - xxx_messageInfo_URLFetchResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_URLFetchResponse proto.InternalMessageInfo - -const Default_URLFetchResponse_ContentWasTruncated bool = false -const Default_URLFetchResponse_ApiCpuMilliseconds int64 = 0 -const Default_URLFetchResponse_ApiBytesSent int64 = 0 -const Default_URLFetchResponse_ApiBytesReceived int64 = 0 - -func (m *URLFetchResponse) GetContent() []byte { - if m != nil { - return m.Content - } - return nil -} - -func (m *URLFetchResponse) GetStatusCode() int32 { - if m != nil && m.StatusCode != nil { - return *m.StatusCode - } - return 0 -} - -func (m *URLFetchResponse) GetHeader() []*URLFetchResponse_Header { - if m != nil { - return m.Header - } - return nil -} - -func (m *URLFetchResponse) GetContentWasTruncated() bool { - if m != nil && m.ContentWasTruncated != nil { - return *m.ContentWasTruncated - } - return Default_URLFetchResponse_ContentWasTruncated -} - -func (m *URLFetchResponse) GetExternalBytesSent() int64 { - if m != nil && m.ExternalBytesSent != nil { - return *m.ExternalBytesSent - } - return 0 -} - -func (m *URLFetchResponse) GetExternalBytesReceived() int64 { - if m != nil && m.ExternalBytesReceived != nil { - return *m.ExternalBytesReceived - } - return 0 -} - -func (m *URLFetchResponse) GetFinalUrl() string { - if m != nil && m.FinalUrl != nil { - return *m.FinalUrl - } - return "" -} - -func (m *URLFetchResponse) GetApiCpuMilliseconds() int64 { - if m != nil && m.ApiCpuMilliseconds != nil { - return *m.ApiCpuMilliseconds - } - return Default_URLFetchResponse_ApiCpuMilliseconds -} - -func (m *URLFetchResponse) GetApiBytesSent() int64 { - if m != nil && m.ApiBytesSent != nil { - return *m.ApiBytesSent - } - return Default_URLFetchResponse_ApiBytesSent -} - -func (m *URLFetchResponse) GetApiBytesReceived() int64 { - if m != nil && m.ApiBytesReceived != nil { - return *m.ApiBytesReceived - } - return Default_URLFetchResponse_ApiBytesReceived -} - -type URLFetchResponse_Header struct { - Key *string `protobuf:"bytes,4,req,name=Key" json:"Key,omitempty"` - Value *string `protobuf:"bytes,5,req,name=Value" json:"Value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *URLFetchResponse_Header) Reset() { *m = URLFetchResponse_Header{} } -func (m *URLFetchResponse_Header) String() string { return proto.CompactTextString(m) } -func (*URLFetchResponse_Header) ProtoMessage() {} -func (*URLFetchResponse_Header) Descriptor() ([]byte, []int) { - return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{2, 0} -} -func (m *URLFetchResponse_Header) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_URLFetchResponse_Header.Unmarshal(m, b) -} -func (m *URLFetchResponse_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_URLFetchResponse_Header.Marshal(b, m, deterministic) -} -func (dst *URLFetchResponse_Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_URLFetchResponse_Header.Merge(dst, src) -} -func (m *URLFetchResponse_Header) XXX_Size() int { - return xxx_messageInfo_URLFetchResponse_Header.Size(m) -} -func (m *URLFetchResponse_Header) XXX_DiscardUnknown() { - xxx_messageInfo_URLFetchResponse_Header.DiscardUnknown(m) -} - -var xxx_messageInfo_URLFetchResponse_Header proto.InternalMessageInfo - -func (m *URLFetchResponse_Header) GetKey() string { - if m != nil && m.Key != nil { - return *m.Key - } - return "" -} - -func (m *URLFetchResponse_Header) GetValue() string { - if m != nil && m.Value != nil { - return *m.Value - } - return "" -} - -func init() { - proto.RegisterType((*URLFetchServiceError)(nil), "appengine.URLFetchServiceError") - proto.RegisterType((*URLFetchRequest)(nil), "appengine.URLFetchRequest") - proto.RegisterType((*URLFetchRequest_Header)(nil), "appengine.URLFetchRequest.Header") - proto.RegisterType((*URLFetchResponse)(nil), "appengine.URLFetchResponse") - proto.RegisterType((*URLFetchResponse_Header)(nil), "appengine.URLFetchResponse.Header") -} - -func init() { - proto.RegisterFile("google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto", fileDescriptor_urlfetch_service_b245a7065f33bced) -} - -var fileDescriptor_urlfetch_service_b245a7065f33bced = []byte{ - // 770 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x6e, 0xe3, 0x54, - 0x10, 0xc6, 0x76, 0x7e, 0xa7, 0x5d, 0x7a, 0x76, 0xb6, 0x45, 0x66, 0xb5, 0xa0, 0x10, 0x09, 0x29, - 0x17, 0x90, 0x2e, 0x2b, 0x24, 0x44, 0xaf, 0x70, 0xed, 0x93, 0xad, 0xa9, 0x63, 0x47, 0xc7, 0x4e, - 0x61, 0xb9, 0xb1, 0xac, 0x78, 0x9a, 0x5a, 0xb2, 0xec, 0x60, 0x9f, 0x2c, 0xf4, 0x35, 0x78, 0x0d, - 0xde, 0x87, 0xa7, 0xe1, 0x02, 0x9d, 0xc4, 0xc9, 0x6e, 0xbb, 0xd1, 0x4a, 0x5c, 0x65, 0xe6, 0x9b, - 0xef, 0xcc, 0x99, 0x7c, 0xdf, 0xf8, 0x80, 0xb3, 0x2c, 0xcb, 0x65, 0x4e, 0xe3, 0x65, 0x99, 0x27, - 0xc5, 0x72, 0x5c, 0x56, 0xcb, 0xf3, 0x64, 0xb5, 0xa2, 0x62, 0x99, 0x15, 0x74, 0x9e, 0x15, 0x92, - 0xaa, 0x22, 0xc9, 0xcf, 0xd7, 0x55, 0x7e, 0x4b, 0x72, 0x71, 0xb7, 0x0f, 0xe2, 0x9a, 0xaa, 0xb7, - 0xd9, 0x82, 0xc6, 0xab, 0xaa, 0x94, 0x25, 0xf6, 0xf7, 0x67, 0x86, 0x7f, 0xeb, 0x70, 0x3a, 0x17, - 0xde, 0x44, 0xb1, 0xc2, 0x2d, 0x89, 0x57, 0x55, 0x59, 0x0d, 0xff, 0xd2, 0xa1, 0xbf, 0x89, 0xec, - 0x32, 0x25, 0xec, 0x80, 0x1e, 0x5c, 0xb3, 0x4f, 0xf0, 0x04, 0x8e, 0x5c, 0xff, 0xc6, 0xf2, 0x5c, - 0x27, 0x9e, 0x0b, 0x8f, 0x69, 0x0a, 0x98, 0xf0, 0xc8, 0xbe, 0x8a, 0xb9, 0x10, 0x81, 0x60, 0x3a, - 0x9e, 0xc1, 0xd3, 0xb9, 0x1f, 0xce, 0xb8, 0xed, 0x4e, 0x5c, 0xee, 0x34, 0xb0, 0x81, 0x9f, 0x01, - 0x0a, 0x1e, 0xce, 0x02, 0x3f, 0xe4, 0x71, 0x14, 0x04, 0xb1, 0x67, 0x89, 0xd7, 0x9c, 0xb5, 0x14, - 0xdd, 0xe1, 0x96, 0xe3, 0xb9, 0x3e, 0x8f, 0xf9, 0xaf, 0x36, 0xe7, 0x0e, 0x77, 0x58, 0x1b, 0x3f, - 0x87, 0xb3, 0x30, 0xf4, 0x62, 0x9b, 0x8b, 0xc8, 0x9d, 0xb8, 0xb6, 0x15, 0xf1, 0xa6, 0x53, 0x07, - 0x9f, 0x40, 0xdf, 0xf1, 0xc3, 0x26, 0xed, 0x22, 0x40, 0xc7, 0xf6, 0x82, 0x90, 0x3b, 0xac, 0x87, - 0x2f, 0xc0, 0x74, 0xfd, 0x88, 0x0b, 0xdf, 0xf2, 0xe2, 0x48, 0x58, 0x7e, 0xe8, 0x72, 0x3f, 0x6a, - 0x98, 0x7d, 0x35, 0x82, 0xba, 0x79, 0x6a, 0xf9, 0x6f, 0x62, 0xc1, 0x1d, 0x57, 0x70, 0x3b, 0x0a, - 0x19, 0xe0, 0x33, 0x38, 0x99, 0x5a, 0xde, 0x24, 0x10, 0x53, 0xee, 0xc4, 0x82, 0xcf, 0xbc, 0x37, - 0xec, 0x08, 0x4f, 0x81, 0xd9, 0x81, 0xef, 0x73, 0x3b, 0x72, 0x03, 0xbf, 0x69, 0x71, 0x3c, 0xfc, - 0xc7, 0x80, 0x93, 0x9d, 0x5a, 0x82, 0x7e, 0x5f, 0x53, 0x2d, 0xf1, 0x27, 0xe8, 0x4c, 0x49, 0xde, - 0x95, 0xa9, 0xa9, 0x0d, 0xf4, 0xd1, 0xa7, 0xaf, 0x46, 0xe3, 0xbd, 0xba, 0xe3, 0x47, 0xdc, 0x71, - 0xf3, 0xbb, 0xe5, 0x8b, 0xe6, 0x1c, 0x32, 0x30, 0xe6, 0x55, 0x6e, 0xea, 0x03, 0x7d, 0xd4, 0x17, - 0x2a, 0xc4, 0x1f, 0xa1, 0x73, 0x47, 0x49, 0x4a, 0x95, 0x69, 0x0c, 0x8c, 0x11, 0xbc, 0xfa, 0xea, - 0x23, 0x3d, 0xaf, 0x36, 0x44, 0xd1, 0x1c, 0xc0, 0x17, 0xd0, 0x9d, 0x25, 0xf7, 0x79, 0x99, 0xa4, - 0x66, 0x67, 0xa0, 0x8d, 0x8e, 0x2f, 0xf5, 0x9e, 0x26, 0x76, 0x10, 0x8e, 0xe1, 0x64, 0x52, 0xe6, - 0x79, 0xf9, 0x87, 0xa0, 0x34, 0xab, 0x68, 0x21, 0x6b, 0xb3, 0x3b, 0xd0, 0x46, 0xbd, 0x8b, 0x96, - 0xac, 0xd6, 0x24, 0x1e, 0x17, 0xf1, 0x39, 0xf4, 0x1c, 0x4a, 0xd2, 0x3c, 0x2b, 0xc8, 0xec, 0x0d, - 0xb4, 0x91, 0x26, 0xf6, 0x39, 0xfe, 0x0c, 0x5f, 0x4c, 0xd7, 0xb5, 0xbc, 0x49, 0xf2, 0x2c, 0x4d, - 0x24, 0xa9, 0xed, 0xa1, 0xca, 0xa6, 0x4a, 0x66, 0xb7, 0xd9, 0x22, 0x91, 0x64, 0xf6, 0xdf, 0xeb, - 0xfc, 0x71, 0xea, 0xf3, 0x97, 0xd0, 0xd9, 0xfe, 0x0f, 0x25, 0xc6, 0x35, 0xdd, 0x9b, 0xad, 0xad, - 0x18, 0xd7, 0x74, 0x8f, 0xa7, 0xd0, 0xbe, 0x49, 0xf2, 0x35, 0x99, 0xed, 0x0d, 0xb6, 0x4d, 0x86, - 0x1e, 0x3c, 0x79, 0xa0, 0x26, 0x76, 0xc1, 0x78, 0xcd, 0x23, 0xa6, 0x61, 0x0f, 0x5a, 0xb3, 0x20, - 0x8c, 0x98, 0xae, 0xa2, 0x2b, 0x6e, 0x39, 0xcc, 0x50, 0xc5, 0xd9, 0x3c, 0x62, 0x2d, 0xb5, 0x2e, - 0x0e, 0xf7, 0x78, 0xc4, 0x59, 0x1b, 0xfb, 0xd0, 0x9e, 0x59, 0x91, 0x7d, 0xc5, 0x3a, 0xc3, 0x7f, - 0x0d, 0x60, 0xef, 0x84, 0xad, 0x57, 0x65, 0x51, 0x13, 0x9a, 0xd0, 0xb5, 0xcb, 0x42, 0x52, 0x21, - 0x4d, 0x4d, 0x49, 0x29, 0x76, 0x29, 0x7e, 0x09, 0x10, 0xca, 0x44, 0xae, 0x6b, 0xf5, 0x71, 0x6c, - 0x8c, 0x6b, 0x8b, 0xf7, 0x10, 0xbc, 0x78, 0xe4, 0xdf, 0xf0, 0xa0, 0x7f, 0xdb, 0x6b, 0x1e, 0x1b, - 0xf8, 0x03, 0x3c, 0x6b, 0xae, 0xf9, 0x25, 0xa9, 0xa3, 0x6a, 0x5d, 0x28, 0x81, 0xb6, 0x66, 0xf6, - 0x2e, 0xda, 0xb7, 0x49, 0x5e, 0x93, 0x38, 0xc4, 0xc0, 0x6f, 0xe0, 0x29, 0xff, 0x73, 0xfb, 0x02, - 0x5c, 0xde, 0x4b, 0xaa, 0x43, 0x35, 0xb8, 0x72, 0xd7, 0x10, 0x1f, 0x16, 0xf0, 0x7b, 0x38, 0x7b, - 0x00, 0x0a, 0x5a, 0x50, 0xf6, 0x96, 0xd2, 0x8d, 0xcd, 0x86, 0x38, 0x5c, 0x54, 0xfb, 0x30, 0xc9, - 0x8a, 0x24, 0x57, 0xfb, 0xaa, 0xec, 0xed, 0x8b, 0x7d, 0x8e, 0xdf, 0x01, 0x5a, 0xab, 0xcc, 0x5e, - 0xad, 0xa7, 0x59, 0x9e, 0x67, 0x35, 0x2d, 0xca, 0x22, 0xad, 0x4d, 0x50, 0xed, 0x2e, 0xb4, 0x97, - 0xe2, 0x40, 0x11, 0xbf, 0x86, 0x63, 0x6b, 0x95, 0xbd, 0x9b, 0xf6, 0x68, 0x47, 0x7e, 0x00, 0xe3, - 0xb7, 0xc0, 0x76, 0xf9, 0x7e, 0xcc, 0xe3, 0x1d, 0xf5, 0x83, 0xd2, 0xff, 0x5f, 0xa6, 0x4b, 0xf8, - 0xad, 0xb7, 0x7b, 0x2a, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x9f, 0x6d, 0x24, 0x63, 0x05, - 0x00, 0x00, -} diff --git a/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto b/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto deleted file mode 100644 index f695edf6a..000000000 --- a/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto +++ /dev/null @@ -1,64 +0,0 @@ -syntax = "proto2"; -option go_package = "urlfetch"; - -package appengine; - -message URLFetchServiceError { - enum ErrorCode { - OK = 0; - INVALID_URL = 1; - FETCH_ERROR = 2; - UNSPECIFIED_ERROR = 3; - RESPONSE_TOO_LARGE = 4; - DEADLINE_EXCEEDED = 5; - SSL_CERTIFICATE_ERROR = 6; - DNS_ERROR = 7; - CLOSED = 8; - INTERNAL_TRANSIENT_ERROR = 9; - TOO_MANY_REDIRECTS = 10; - MALFORMED_REPLY = 11; - CONNECTION_ERROR = 12; - } -} - -message URLFetchRequest { - enum RequestMethod { - GET = 1; - POST = 2; - HEAD = 3; - PUT = 4; - DELETE = 5; - PATCH = 6; - } - required RequestMethod Method = 1; - required string Url = 2; - repeated group Header = 3 { - required string Key = 4; - required string Value = 5; - } - optional bytes Payload = 6 [ctype=CORD]; - - optional bool FollowRedirects = 7 [default=true]; - - optional double Deadline = 8; - - optional bool MustValidateServerCertificate = 9 [default=true]; -} - -message URLFetchResponse { - optional bytes Content = 1; - required int32 StatusCode = 2; - repeated group Header = 3 { - required string Key = 4; - required string Value = 5; - } - optional bool ContentWasTruncated = 6 [default=false]; - optional int64 ExternalBytesSent = 7; - optional int64 ExternalBytesReceived = 8; - - optional string FinalUrl = 9; - - optional int64 ApiCpuMilliseconds = 10 [default=0]; - optional int64 ApiBytesSent = 11 [default=0]; - optional int64 ApiBytesReceived = 12 [default=0]; -} diff --git a/vendor/google.golang.org/appengine/urlfetch/urlfetch.go b/vendor/google.golang.org/appengine/urlfetch/urlfetch.go deleted file mode 100644 index 6c0d72418..000000000 --- a/vendor/google.golang.org/appengine/urlfetch/urlfetch.go +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -// Package urlfetch provides an http.RoundTripper implementation -// for fetching URLs via App Engine's urlfetch service. -package urlfetch // import "google.golang.org/appengine/urlfetch" - -import ( - "context" - "errors" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "strings" - "time" - - "github.com/golang/protobuf/proto" - - "google.golang.org/appengine/internal" - pb "google.golang.org/appengine/internal/urlfetch" -) - -// Transport is an implementation of http.RoundTripper for -// App Engine. Users should generally create an http.Client using -// this transport and use the Client rather than using this transport -// directly. -type Transport struct { - Context context.Context - - // Controls whether the application checks the validity of SSL certificates - // over HTTPS connections. A value of false (the default) instructs the - // application to send a request to the server only if the certificate is - // valid and signed by a trusted certificate authority (CA), and also - // includes a hostname that matches the certificate. A value of true - // instructs the application to perform no certificate validation. - AllowInvalidServerCertificate bool -} - -// Verify statically that *Transport implements http.RoundTripper. -var _ http.RoundTripper = (*Transport)(nil) - -// Client returns an *http.Client using a default urlfetch Transport. This -// client will check the validity of SSL certificates. -// -// Any deadline of the provided context will be used for requests through this client. -// If the client does not have a deadline, then an App Engine default of 60 second is used. -func Client(ctx context.Context) *http.Client { - return &http.Client{ - Transport: &Transport{ - Context: ctx, - }, - } -} - -type bodyReader struct { - content []byte - truncated bool - closed bool -} - -// ErrTruncatedBody is the error returned after the final Read() from a -// response's Body if the body has been truncated by App Engine's proxy. -var ErrTruncatedBody = errors.New("urlfetch: truncated body") - -func statusCodeToText(code int) string { - if t := http.StatusText(code); t != "" { - return t - } - return strconv.Itoa(code) -} - -func (br *bodyReader) Read(p []byte) (n int, err error) { - if br.closed { - if br.truncated { - return 0, ErrTruncatedBody - } - return 0, io.EOF - } - n = copy(p, br.content) - if n > 0 { - br.content = br.content[n:] - return - } - if br.truncated { - br.closed = true - return 0, ErrTruncatedBody - } - return 0, io.EOF -} - -func (br *bodyReader) Close() error { - br.closed = true - br.content = nil - return nil -} - -// A map of the URL Fetch-accepted methods that take a request body. -var methodAcceptsRequestBody = map[string]bool{ - "POST": true, - "PUT": true, - "PATCH": true, -} - -// urlString returns a valid string given a URL. This function is necessary because -// the String method of URL doesn't correctly handle URLs with non-empty Opaque values. -// See http://code.google.com/p/go/issues/detail?id=4860. -func urlString(u *url.URL) string { - if u.Opaque == "" || strings.HasPrefix(u.Opaque, "//") { - return u.String() - } - aux := *u - aux.Opaque = "//" + aux.Host + aux.Opaque - return aux.String() -} - -// RoundTrip issues a single HTTP request and returns its response. Per the -// http.RoundTripper interface, RoundTrip only returns an error if there -// was an unsupported request or the URL Fetch proxy fails. -// Note that HTTP response codes such as 5xx, 403, 404, etc are not -// errors as far as the transport is concerned and will be returned -// with err set to nil. -func (t *Transport) RoundTrip(req *http.Request) (res *http.Response, err error) { - methNum, ok := pb.URLFetchRequest_RequestMethod_value[req.Method] - if !ok { - return nil, fmt.Errorf("urlfetch: unsupported HTTP method %q", req.Method) - } - - method := pb.URLFetchRequest_RequestMethod(methNum) - - freq := &pb.URLFetchRequest{ - Method: &method, - Url: proto.String(urlString(req.URL)), - FollowRedirects: proto.Bool(false), // http.Client's responsibility - MustValidateServerCertificate: proto.Bool(!t.AllowInvalidServerCertificate), - } - if deadline, ok := t.Context.Deadline(); ok { - freq.Deadline = proto.Float64(deadline.Sub(time.Now()).Seconds()) - } - - for k, vals := range req.Header { - for _, val := range vals { - freq.Header = append(freq.Header, &pb.URLFetchRequest_Header{ - Key: proto.String(k), - Value: proto.String(val), - }) - } - } - if methodAcceptsRequestBody[req.Method] && req.Body != nil { - // Avoid a []byte copy if req.Body has a Bytes method. - switch b := req.Body.(type) { - case interface { - Bytes() []byte - }: - freq.Payload = b.Bytes() - default: - freq.Payload, err = ioutil.ReadAll(req.Body) - if err != nil { - return nil, err - } - } - } - - fres := &pb.URLFetchResponse{} - if err := internal.Call(t.Context, "urlfetch", "Fetch", freq, fres); err != nil { - return nil, err - } - - res = &http.Response{} - res.StatusCode = int(*fres.StatusCode) - res.Status = fmt.Sprintf("%d %s", res.StatusCode, statusCodeToText(res.StatusCode)) - res.Header = make(http.Header) - res.Request = req - - // Faked: - res.ProtoMajor = 1 - res.ProtoMinor = 1 - res.Proto = "HTTP/1.1" - res.Close = true - - for _, h := range fres.Header { - hkey := http.CanonicalHeaderKey(*h.Key) - hval := *h.Value - if hkey == "Content-Length" { - // Will get filled in below for all but HEAD requests. - if req.Method == "HEAD" { - res.ContentLength, _ = strconv.ParseInt(hval, 10, 64) - } - continue - } - res.Header.Add(hkey, hval) - } - - if req.Method != "HEAD" { - res.ContentLength = int64(len(fres.Content)) - } - - truncated := fres.GetContentWasTruncated() - res.Body = &bodyReader{content: fres.Content, truncated: truncated} - return -} - -func init() { - internal.RegisterErrorCodeMap("urlfetch", pb.URLFetchServiceError_ErrorCode_name) - internal.RegisterTimeoutErrorCode("urlfetch", int32(pb.URLFetchServiceError_DEADLINE_EXCEEDED)) -} diff --git a/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go b/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go index 3543268f8..e7d3805e3 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.21.9 +// protoc v4.24.4 // source: google/api/httpbody.proto package httpbody diff --git a/vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go b/vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go index 7bd161e48..3e5621827 100644 --- a/vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/rpc/errdetails/error_details.pb.go @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.21.9 +// protoc v4.24.4 // source: google/rpc/error_details.proto package errdetails diff --git a/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go b/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go index a6b508188..6ad1b1c1d 100644 --- a/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.21.9 +// protoc v4.24.4 // source: google/rpc/status.proto package status diff --git a/vendor/google.golang.org/grpc/CONTRIBUTING.md b/vendor/google.golang.org/grpc/CONTRIBUTING.md index 608aa6e1a..0854d298e 100644 --- a/vendor/google.golang.org/grpc/CONTRIBUTING.md +++ b/vendor/google.golang.org/grpc/CONTRIBUTING.md @@ -66,7 +66,7 @@ How to get your contributions merged smoothly and quickly. - **All tests need to be passing** before your change can be merged. We recommend you **run tests locally** before creating your PR to catch breakages early on. - - `VET_SKIP_PROTO=1 ./vet.sh` to catch vet errors + - `./scripts/vet.sh` to catch vet errors - `go test -cpu 1,4 -timeout 7m ./...` to run the tests - `go test -race -cpu 1,4 -timeout 7m ./...` to run tests in race mode diff --git a/vendor/google.golang.org/grpc/MAINTAINERS.md b/vendor/google.golang.org/grpc/MAINTAINERS.md index c6672c0a3..6a8a07781 100644 --- a/vendor/google.golang.org/grpc/MAINTAINERS.md +++ b/vendor/google.golang.org/grpc/MAINTAINERS.md @@ -9,6 +9,7 @@ for general contribution guidelines. ## Maintainers (in alphabetical order) +- [atollena](https://github.com/atollena), Datadog, Inc. - [cesarghali](https://github.com/cesarghali), Google LLC - [dfawley](https://github.com/dfawley), Google LLC - [easwars](https://github.com/easwars), Google LLC diff --git a/vendor/google.golang.org/grpc/Makefile b/vendor/google.golang.org/grpc/Makefile index 1f8960922..be38384ff 100644 --- a/vendor/google.golang.org/grpc/Makefile +++ b/vendor/google.golang.org/grpc/Makefile @@ -30,17 +30,20 @@ testdeps: GO111MODULE=on go get -d -v -t google.golang.org/grpc/... vet: vetdeps - ./vet.sh + ./scripts/vet.sh vetdeps: - ./vet.sh -install + ./scripts/vet.sh -install .PHONY: \ all \ build \ clean \ + deps \ proto \ test \ + testsubmodule \ testrace \ + testdeps \ vet \ vetdeps diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md index ab0fbb79b..b572707c6 100644 --- a/vendor/google.golang.org/grpc/README.md +++ b/vendor/google.golang.org/grpc/README.md @@ -10,7 +10,7 @@ RPC framework that puts mobile and HTTP/2 first. For more information see the ## Prerequisites -- **[Go][]**: any one of the **three latest major** [releases][go-releases]. +- **[Go][]**: any one of the **two latest major** [releases][go-releases]. ## Installation diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index d79560a2e..f391744f7 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -54,13 +54,14 @@ var ( // an init() function), and is not thread-safe. If multiple Balancers are // registered with the same name, the one registered last will take effect. func Register(b Builder) { - if strings.ToLower(b.Name()) != b.Name() { + name := strings.ToLower(b.Name()) + if name != b.Name() { // TODO: Skip the use of strings.ToLower() to index the map after v1.59 // is released to switch to case sensitive balancer registry. Also, // remove this warning and update the docstrings for Register and Get. logger.Warningf("Balancer registered with name %q. grpc-go will be switching to case sensitive balancer registries soon", b.Name()) } - m[strings.ToLower(b.Name())] = b + m[name] = b } // unregisterForTesting deletes the balancer with the given name from the @@ -232,8 +233,8 @@ type BuildOptions struct { // implementations which do not communicate with a remote load balancer // server can ignore this field. Authority string - // ChannelzParentID is the parent ClientConn's channelz ID. - ChannelzParentID *channelz.Identifier + // ChannelzParent is the parent ClientConn's channelz channel. + ChannelzParent channelz.Identifier // CustomUserAgent is the custom user agent set on the parent ClientConn. // The balancer should set the same custom user agent if it creates a // ClientConn. diff --git a/vendor/google.golang.org/grpc/pickfirst.go b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go similarity index 71% rename from vendor/google.golang.org/grpc/pickfirst.go rename to vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go index 2e9cf66b4..07527603f 100644 --- a/vendor/google.golang.org/grpc/pickfirst.go +++ b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go @@ -16,68 +16,60 @@ * */ -package grpc +// Package pickfirst contains the pick_first load balancing policy. +package pickfirst import ( "encoding/json" "errors" "fmt" + "math/rand" "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/internal/envconfig" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" internalgrpclog "google.golang.org/grpc/internal/grpclog" - "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/internal/pretty" "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" ) +func init() { + balancer.Register(pickfirstBuilder{}) + internal.ShuffleAddressListForTesting = func(n int, swap func(i, j int)) { rand.Shuffle(n, swap) } +} + +var logger = grpclog.Component("pick-first-lb") + const ( - // PickFirstBalancerName is the name of the pick_first balancer. - PickFirstBalancerName = "pick_first" - logPrefix = "[pick-first-lb %p] " + // Name is the name of the pick_first balancer. + Name = "pick_first" + logPrefix = "[pick-first-lb %p] " ) -func newPickfirstBuilder() balancer.Builder { - return &pickfirstBuilder{} -} - type pickfirstBuilder struct{} -func (*pickfirstBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { +func (pickfirstBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { b := &pickfirstBalancer{cc: cc} b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b)) return b } -func (*pickfirstBuilder) Name() string { - return PickFirstBalancerName +func (pickfirstBuilder) Name() string { + return Name } type pfConfig struct { serviceconfig.LoadBalancingConfig `json:"-"` // If set to true, instructs the LB policy to shuffle the order of the list - // of addresses received from the name resolver before attempting to + // of endpoints received from the name resolver before attempting to // connect to them. ShuffleAddressList bool `json:"shuffleAddressList"` } -func (*pickfirstBuilder) ParseConfig(js json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { - if !envconfig.PickFirstLBConfig { - // Prior to supporting loadbalancing configuration, the pick_first LB - // policy did not implement the balancer.ConfigParser interface. This - // meant that if a non-empty configuration was passed to it, the service - // config unmarshaling code would throw a warning log, but would - // continue using the pick_first LB policy. The code below ensures the - // same behavior is retained if the env var is not set. - if string(js) != "{}" { - logger.Warningf("Ignoring non-empty balancer configuration %q for the pick_first LB policy", string(js)) - } - return nil, nil - } - +func (pickfirstBuilder) ParseConfig(js json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { var cfg pfConfig if err := json.Unmarshal(js, &cfg); err != nil { return nil, fmt.Errorf("pickfirst: unable to unmarshal LB policy config: %s, error: %v", string(js), err) @@ -111,9 +103,14 @@ func (b *pickfirstBalancer) ResolverError(err error) { }) } +type Shuffler interface { + ShuffleAddressListForTesting(n int, swap func(i, j int)) +} + +func ShuffleAddressListForTesting(n int, swap func(i, j int)) { rand.Shuffle(n, swap) } + func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState) error { - addrs := state.ResolverState.Addresses - if len(addrs) == 0 { + if len(state.ResolverState.Addresses) == 0 && len(state.ResolverState.Endpoints) == 0 { // The resolver reported an empty address list. Treat it like an error by // calling b.ResolverError. if b.subConn != nil { @@ -125,22 +122,49 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState b.ResolverError(errors.New("produced zero addresses")) return balancer.ErrBadResolverState } - // We don't have to guard this block with the env var because ParseConfig // already does so. cfg, ok := state.BalancerConfig.(pfConfig) if state.BalancerConfig != nil && !ok { return fmt.Errorf("pickfirst: received illegal BalancerConfig (type %T): %v", state.BalancerConfig, state.BalancerConfig) } - if cfg.ShuffleAddressList { - addrs = append([]resolver.Address{}, addrs...) - grpcrand.Shuffle(len(addrs), func(i, j int) { addrs[i], addrs[j] = addrs[j], addrs[i] }) - } if b.logger.V(2) { b.logger.Infof("Received new config %s, resolver state %s", pretty.ToJSON(cfg), pretty.ToJSON(state.ResolverState)) } + var addrs []resolver.Address + if endpoints := state.ResolverState.Endpoints; len(endpoints) != 0 { + // Perform the optional shuffling described in gRFC A62. The shuffling will + // change the order of endpoints but not touch the order of the addresses + // within each endpoint. - A61 + if cfg.ShuffleAddressList { + endpoints = append([]resolver.Endpoint{}, endpoints...) + internal.ShuffleAddressListForTesting.(func(int, func(int, int)))(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) + } + + // "Flatten the list by concatenating the ordered list of addresses for each + // of the endpoints, in order." - A61 + for _, endpoint := range endpoints { + // "In the flattened list, interleave addresses from the two address + // families, as per RFC-8304 section 4." - A61 + // TODO: support the above language. + addrs = append(addrs, endpoint.Addresses...) + } + } else { + // Endpoints not set, process addresses until we migrate resolver + // emissions fully to Endpoints. The top channel does wrap emitted + // addresses with endpoints, however some balancers such as weighted + // target do not forwarrd the corresponding correct endpoints down/split + // endpoints properly. Once all balancers correctly forward endpoints + // down, can delete this else conditional. + addrs = state.ResolverState.Addresses + if cfg.ShuffleAddressList { + addrs = append([]resolver.Address{}, addrs...) + rand.Shuffle(len(addrs), func(i, j int) { addrs[i], addrs[j] = addrs[j], addrs[i] }) + } + } + if b.subConn != nil { b.cc.UpdateAddresses(b.subConn, addrs) return nil @@ -257,7 +281,3 @@ func (i *idlePicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { i.subConn.Connect() return balancer.PickResult{}, balancer.ErrNoSubConnAvailable } - -func init() { - balancer.Register(newPickfirstBuilder()) -} diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go index f7031ad22..260255d31 100644 --- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go +++ b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go @@ -22,12 +22,12 @@ package roundrobin import ( + "math/rand" "sync/atomic" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal/grpcrand" ) // Name is the name of round_robin balancer. @@ -60,7 +60,7 @@ func (*rrPickerBuilder) Build(info base.PickerBuildInfo) balancer.Picker { // Start at a random index, as the same RR balancer rebuilds a new // picker when SubConn states change, and we don't want to apply excess // load to the first server in the list. - next: uint32(grpcrand.Intn(len(scs))), + next: uint32(rand.Intn(len(scs))), } } diff --git a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go deleted file mode 100644 index a4411c22b..000000000 --- a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go +++ /dev/null @@ -1,454 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "context" - "fmt" - "strings" - "sync" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/internal/balancer/gracefulswitch" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcsync" - "google.golang.org/grpc/resolver" -) - -type ccbMode int - -const ( - ccbModeActive = iota - ccbModeIdle - ccbModeClosed - ccbModeExitingIdle -) - -// ccBalancerWrapper sits between the ClientConn and the Balancer. -// -// ccBalancerWrapper implements methods corresponding to the ones on the -// balancer.Balancer interface. The ClientConn is free to call these methods -// concurrently and the ccBalancerWrapper ensures that calls from the ClientConn -// to the Balancer happen synchronously and in order. -// -// ccBalancerWrapper also implements the balancer.ClientConn interface and is -// passed to the Balancer implementations. It invokes unexported methods on the -// ClientConn to handle these calls from the Balancer. -// -// It uses the gracefulswitch.Balancer internally to ensure that balancer -// switches happen in a graceful manner. -type ccBalancerWrapper struct { - // The following fields are initialized when the wrapper is created and are - // read-only afterwards, and therefore can be accessed without a mutex. - cc *ClientConn - opts balancer.BuildOptions - - // Outgoing (gRPC --> balancer) calls are guaranteed to execute in a - // mutually exclusive manner as they are scheduled in the serializer. Fields - // accessed *only* in these serializer callbacks, can therefore be accessed - // without a mutex. - balancer *gracefulswitch.Balancer - curBalancerName string - - // mu guards access to the below fields. Access to the serializer and its - // cancel function needs to be mutex protected because they are overwritten - // when the wrapper exits idle mode. - mu sync.Mutex - serializer *grpcsync.CallbackSerializer // To serialize all outoing calls. - serializerCancel context.CancelFunc // To close the seralizer at close/enterIdle time. - mode ccbMode // Tracks the current mode of the wrapper. -} - -// newCCBalancerWrapper creates a new balancer wrapper. The underlying balancer -// is not created until the switchTo() method is invoked. -func newCCBalancerWrapper(cc *ClientConn, bopts balancer.BuildOptions) *ccBalancerWrapper { - ctx, cancel := context.WithCancel(context.Background()) - ccb := &ccBalancerWrapper{ - cc: cc, - opts: bopts, - serializer: grpcsync.NewCallbackSerializer(ctx), - serializerCancel: cancel, - } - ccb.balancer = gracefulswitch.NewBalancer(ccb, bopts) - return ccb -} - -// updateClientConnState is invoked by grpc to push a ClientConnState update to -// the underlying balancer. -func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error { - ccb.mu.Lock() - errCh := make(chan error, 1) - // Here and everywhere else where Schedule() is called, it is done with the - // lock held. But the lock guards only the scheduling part. The actual - // callback is called asynchronously without the lock being held. - ok := ccb.serializer.Schedule(func(_ context.Context) { - errCh <- ccb.balancer.UpdateClientConnState(*ccs) - }) - if !ok { - // If we are unable to schedule a function with the serializer, it - // indicates that it has been closed. A serializer is only closed when - // the wrapper is closed or is in idle. - ccb.mu.Unlock() - return fmt.Errorf("grpc: cannot send state update to a closed or idle balancer") - } - ccb.mu.Unlock() - - // We get here only if the above call to Schedule succeeds, in which case it - // is guaranteed that the scheduled function will run. Therefore it is safe - // to block on this channel. - err := <-errCh - if logger.V(2) && err != nil { - logger.Infof("error from balancer.UpdateClientConnState: %v", err) - } - return err -} - -// updateSubConnState is invoked by grpc to push a subConn state update to the -// underlying balancer. -func (ccb *ccBalancerWrapper) updateSubConnState(sc balancer.SubConn, s connectivity.State, err error) { - ccb.mu.Lock() - ccb.serializer.Schedule(func(_ context.Context) { - // Even though it is optional for balancers, gracefulswitch ensures - // opts.StateListener is set, so this cannot ever be nil. - sc.(*acBalancerWrapper).stateListener(balancer.SubConnState{ConnectivityState: s, ConnectionError: err}) - }) - ccb.mu.Unlock() -} - -func (ccb *ccBalancerWrapper) resolverError(err error) { - ccb.mu.Lock() - ccb.serializer.Schedule(func(_ context.Context) { - ccb.balancer.ResolverError(err) - }) - ccb.mu.Unlock() -} - -// switchTo is invoked by grpc to instruct the balancer wrapper to switch to the -// LB policy identified by name. -// -// ClientConn calls newCCBalancerWrapper() at creation time. Upon receipt of the -// first good update from the name resolver, it determines the LB policy to use -// and invokes the switchTo() method. Upon receipt of every subsequent update -// from the name resolver, it invokes this method. -// -// the ccBalancerWrapper keeps track of the current LB policy name, and skips -// the graceful balancer switching process if the name does not change. -func (ccb *ccBalancerWrapper) switchTo(name string) { - ccb.mu.Lock() - ccb.serializer.Schedule(func(_ context.Context) { - // TODO: Other languages use case-sensitive balancer registries. We should - // switch as well. See: https://github.com/grpc/grpc-go/issues/5288. - if strings.EqualFold(ccb.curBalancerName, name) { - return - } - ccb.buildLoadBalancingPolicy(name) - }) - ccb.mu.Unlock() -} - -// buildLoadBalancingPolicy performs the following: -// - retrieve a balancer builder for the given name. Use the default LB -// policy, pick_first, if no LB policy with name is found in the registry. -// - instruct the gracefulswitch balancer to switch to the above builder. This -// will actually build the new balancer. -// - update the `curBalancerName` field -// -// Must be called from a serializer callback. -func (ccb *ccBalancerWrapper) buildLoadBalancingPolicy(name string) { - builder := balancer.Get(name) - if builder == nil { - channelz.Warningf(logger, ccb.cc.channelzID, "Channel switches to new LB policy %q, since the specified LB policy %q was not registered", PickFirstBalancerName, name) - builder = newPickfirstBuilder() - } else { - channelz.Infof(logger, ccb.cc.channelzID, "Channel switches to new LB policy %q", name) - } - - if err := ccb.balancer.SwitchTo(builder); err != nil { - channelz.Errorf(logger, ccb.cc.channelzID, "Channel failed to build new LB policy %q: %v", name, err) - return - } - ccb.curBalancerName = builder.Name() -} - -func (ccb *ccBalancerWrapper) close() { - channelz.Info(logger, ccb.cc.channelzID, "ccBalancerWrapper: closing") - ccb.closeBalancer(ccbModeClosed) -} - -// enterIdleMode is invoked by grpc when the channel enters idle mode upon -// expiry of idle_timeout. This call blocks until the balancer is closed. -func (ccb *ccBalancerWrapper) enterIdleMode() { - channelz.Info(logger, ccb.cc.channelzID, "ccBalancerWrapper: entering idle mode") - ccb.closeBalancer(ccbModeIdle) -} - -// closeBalancer is invoked when the channel is being closed or when it enters -// idle mode upon expiry of idle_timeout. -func (ccb *ccBalancerWrapper) closeBalancer(m ccbMode) { - ccb.mu.Lock() - if ccb.mode == ccbModeClosed || ccb.mode == ccbModeIdle { - ccb.mu.Unlock() - return - } - - ccb.mode = m - done := ccb.serializer.Done() - b := ccb.balancer - ok := ccb.serializer.Schedule(func(_ context.Context) { - // Close the serializer to ensure that no more calls from gRPC are sent - // to the balancer. - ccb.serializerCancel() - // Empty the current balancer name because we don't have a balancer - // anymore and also so that we act on the next call to switchTo by - // creating a new balancer specified by the new resolver. - ccb.curBalancerName = "" - }) - if !ok { - ccb.mu.Unlock() - return - } - ccb.mu.Unlock() - - // Give enqueued callbacks a chance to finish before closing the balancer. - <-done - b.Close() -} - -// exitIdleMode is invoked by grpc when the channel exits idle mode either -// because of an RPC or because of an invocation of the Connect() API. This -// recreates the balancer that was closed previously when entering idle mode. -// -// If the channel is not in idle mode, we know for a fact that we are here as a -// result of the user calling the Connect() method on the ClientConn. In this -// case, we can simply forward the call to the underlying balancer, instructing -// it to reconnect to the backends. -func (ccb *ccBalancerWrapper) exitIdleMode() { - ccb.mu.Lock() - if ccb.mode == ccbModeClosed { - // Request to exit idle is a no-op when wrapper is already closed. - ccb.mu.Unlock() - return - } - - if ccb.mode == ccbModeIdle { - // Recreate the serializer which was closed when we entered idle. - ctx, cancel := context.WithCancel(context.Background()) - ccb.serializer = grpcsync.NewCallbackSerializer(ctx) - ccb.serializerCancel = cancel - } - - // The ClientConn guarantees that mutual exclusion between close() and - // exitIdleMode(), and since we just created a new serializer, we can be - // sure that the below function will be scheduled. - done := make(chan struct{}) - ccb.serializer.Schedule(func(_ context.Context) { - defer close(done) - - ccb.mu.Lock() - defer ccb.mu.Unlock() - - if ccb.mode != ccbModeIdle { - ccb.balancer.ExitIdle() - return - } - - // Gracefulswitch balancer does not support a switchTo operation after - // being closed. Hence we need to create a new one here. - ccb.balancer = gracefulswitch.NewBalancer(ccb, ccb.opts) - ccb.mode = ccbModeActive - channelz.Info(logger, ccb.cc.channelzID, "ccBalancerWrapper: exiting idle mode") - - }) - ccb.mu.Unlock() - - <-done -} - -func (ccb *ccBalancerWrapper) isIdleOrClosed() bool { - ccb.mu.Lock() - defer ccb.mu.Unlock() - return ccb.mode == ccbModeIdle || ccb.mode == ccbModeClosed -} - -func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { - if ccb.isIdleOrClosed() { - return nil, fmt.Errorf("grpc: cannot create SubConn when balancer is closed or idle") - } - - if len(addrs) == 0 { - return nil, fmt.Errorf("grpc: cannot create SubConn with empty address list") - } - ac, err := ccb.cc.newAddrConn(addrs, opts) - if err != nil { - channelz.Warningf(logger, ccb.cc.channelzID, "acBalancerWrapper: NewSubConn: failed to newAddrConn: %v", err) - return nil, err - } - acbw := &acBalancerWrapper{ - ccb: ccb, - ac: ac, - producers: make(map[balancer.ProducerBuilder]*refCountedProducer), - stateListener: opts.StateListener, - } - ac.acbw = acbw - return acbw, nil -} - -func (ccb *ccBalancerWrapper) RemoveSubConn(sc balancer.SubConn) { - // The graceful switch balancer will never call this. - logger.Errorf("ccb RemoveSubConn(%v) called unexpectedly, sc") -} - -func (ccb *ccBalancerWrapper) UpdateAddresses(sc balancer.SubConn, addrs []resolver.Address) { - if ccb.isIdleOrClosed() { - return - } - - acbw, ok := sc.(*acBalancerWrapper) - if !ok { - return - } - acbw.UpdateAddresses(addrs) -} - -func (ccb *ccBalancerWrapper) UpdateState(s balancer.State) { - if ccb.isIdleOrClosed() { - return - } - - // Update picker before updating state. Even though the ordering here does - // not matter, it can lead to multiple calls of Pick in the common start-up - // case where we wait for ready and then perform an RPC. If the picker is - // updated later, we could call the "connecting" picker when the state is - // updated, and then call the "ready" picker after the picker gets updated. - ccb.cc.blockingpicker.updatePicker(s.Picker) - ccb.cc.csMgr.updateState(s.ConnectivityState) -} - -func (ccb *ccBalancerWrapper) ResolveNow(o resolver.ResolveNowOptions) { - if ccb.isIdleOrClosed() { - return - } - - ccb.cc.resolveNow(o) -} - -func (ccb *ccBalancerWrapper) Target() string { - return ccb.cc.target -} - -// acBalancerWrapper is a wrapper on top of ac for balancers. -// It implements balancer.SubConn interface. -type acBalancerWrapper struct { - ac *addrConn // read-only - ccb *ccBalancerWrapper // read-only - stateListener func(balancer.SubConnState) - - mu sync.Mutex - producers map[balancer.ProducerBuilder]*refCountedProducer -} - -func (acbw *acBalancerWrapper) String() string { - return fmt.Sprintf("SubConn(id:%d)", acbw.ac.channelzID.Int()) -} - -func (acbw *acBalancerWrapper) UpdateAddresses(addrs []resolver.Address) { - acbw.ac.updateAddrs(addrs) -} - -func (acbw *acBalancerWrapper) Connect() { - go acbw.ac.connect() -} - -func (acbw *acBalancerWrapper) Shutdown() { - ccb := acbw.ccb - if ccb.isIdleOrClosed() { - // It it safe to ignore this call when the balancer is closed or in idle - // because the ClientConn takes care of closing the connections. - // - // Not returning early from here when the balancer is closed or in idle - // leads to a deadlock though, because of the following sequence of - // calls when holding cc.mu: - // cc.exitIdleMode --> ccb.enterIdleMode --> gsw.Close --> - // ccb.RemoveAddrConn --> cc.removeAddrConn - return - } - - ccb.cc.removeAddrConn(acbw.ac, errConnDrain) -} - -// NewStream begins a streaming RPC on the addrConn. If the addrConn is not -// ready, blocks until it is or ctx expires. Returns an error when the context -// expires or the addrConn is shut down. -func (acbw *acBalancerWrapper) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { - transport, err := acbw.ac.getTransport(ctx) - if err != nil { - return nil, err - } - return newNonRetryClientStream(ctx, desc, method, transport, acbw.ac, opts...) -} - -// Invoke performs a unary RPC. If the addrConn is not ready, returns -// errSubConnNotReady. -func (acbw *acBalancerWrapper) Invoke(ctx context.Context, method string, args any, reply any, opts ...CallOption) error { - cs, err := acbw.NewStream(ctx, unaryStreamDesc, method, opts...) - if err != nil { - return err - } - if err := cs.SendMsg(args); err != nil { - return err - } - return cs.RecvMsg(reply) -} - -type refCountedProducer struct { - producer balancer.Producer - refs int // number of current refs to the producer - close func() // underlying producer's close function -} - -func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) (balancer.Producer, func()) { - acbw.mu.Lock() - defer acbw.mu.Unlock() - - // Look up existing producer from this builder. - pData := acbw.producers[pb] - if pData == nil { - // Not found; create a new one and add it to the producers map. - p, close := pb.Build(acbw) - pData = &refCountedProducer{producer: p, close: close} - acbw.producers[pb] = pData - } - // Account for this new reference. - pData.refs++ - - // Return a cleanup function wrapped in a OnceFunc to remove this reference - // and delete the refCountedProducer from the map if the total reference - // count goes to zero. - unref := func() { - acbw.mu.Lock() - pData.refs-- - if pData.refs == 0 { - defer pData.close() // Run outside the acbw mutex - delete(acbw.producers, pb) - } - acbw.mu.Unlock() - } - return pData.producer, grpcsync.OnceFunc(unref) -} diff --git a/vendor/google.golang.org/grpc/balancer_wrapper.go b/vendor/google.golang.org/grpc/balancer_wrapper.go new file mode 100644 index 000000000..4161fdf47 --- /dev/null +++ b/vendor/google.golang.org/grpc/balancer_wrapper.go @@ -0,0 +1,341 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +import ( + "context" + "fmt" + "sync" + + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/internal/balancer/gracefulswitch" + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcsync" + "google.golang.org/grpc/resolver" +) + +// ccBalancerWrapper sits between the ClientConn and the Balancer. +// +// ccBalancerWrapper implements methods corresponding to the ones on the +// balancer.Balancer interface. The ClientConn is free to call these methods +// concurrently and the ccBalancerWrapper ensures that calls from the ClientConn +// to the Balancer happen in order by performing them in the serializer, without +// any mutexes held. +// +// ccBalancerWrapper also implements the balancer.ClientConn interface and is +// passed to the Balancer implementations. It invokes unexported methods on the +// ClientConn to handle these calls from the Balancer. +// +// It uses the gracefulswitch.Balancer internally to ensure that balancer +// switches happen in a graceful manner. +type ccBalancerWrapper struct { + // The following fields are initialized when the wrapper is created and are + // read-only afterwards, and therefore can be accessed without a mutex. + cc *ClientConn + opts balancer.BuildOptions + serializer *grpcsync.CallbackSerializer + serializerCancel context.CancelFunc + + // The following fields are only accessed within the serializer or during + // initialization. + curBalancerName string + balancer *gracefulswitch.Balancer + + // The following field is protected by mu. Caller must take cc.mu before + // taking mu. + mu sync.Mutex + closed bool +} + +// newCCBalancerWrapper creates a new balancer wrapper in idle state. The +// underlying balancer is not created until the updateClientConnState() method +// is invoked. +func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper { + ctx, cancel := context.WithCancel(cc.ctx) + ccb := &ccBalancerWrapper{ + cc: cc, + opts: balancer.BuildOptions{ + DialCreds: cc.dopts.copts.TransportCredentials, + CredsBundle: cc.dopts.copts.CredsBundle, + Dialer: cc.dopts.copts.Dialer, + Authority: cc.authority, + CustomUserAgent: cc.dopts.copts.UserAgent, + ChannelzParent: cc.channelz, + Target: cc.parsedTarget, + }, + serializer: grpcsync.NewCallbackSerializer(ctx), + serializerCancel: cancel, + } + ccb.balancer = gracefulswitch.NewBalancer(ccb, ccb.opts) + return ccb +} + +// updateClientConnState is invoked by grpc to push a ClientConnState update to +// the underlying balancer. This is always executed from the serializer, so +// it is safe to call into the balancer here. +func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error { + errCh := make(chan error) + ok := ccb.serializer.Schedule(func(ctx context.Context) { + defer close(errCh) + if ctx.Err() != nil || ccb.balancer == nil { + return + } + name := gracefulswitch.ChildName(ccs.BalancerConfig) + if ccb.curBalancerName != name { + ccb.curBalancerName = name + channelz.Infof(logger, ccb.cc.channelz, "Channel switches to new LB policy %q", name) + } + err := ccb.balancer.UpdateClientConnState(*ccs) + if logger.V(2) && err != nil { + logger.Infof("error from balancer.UpdateClientConnState: %v", err) + } + errCh <- err + }) + if !ok { + return nil + } + return <-errCh +} + +// resolverError is invoked by grpc to push a resolver error to the underlying +// balancer. The call to the balancer is executed from the serializer. +func (ccb *ccBalancerWrapper) resolverError(err error) { + ccb.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || ccb.balancer == nil { + return + } + ccb.balancer.ResolverError(err) + }) +} + +// close initiates async shutdown of the wrapper. cc.mu must be held when +// calling this function. To determine the wrapper has finished shutting down, +// the channel should block on ccb.serializer.Done() without cc.mu held. +func (ccb *ccBalancerWrapper) close() { + ccb.mu.Lock() + ccb.closed = true + ccb.mu.Unlock() + channelz.Info(logger, ccb.cc.channelz, "ccBalancerWrapper: closing") + ccb.serializer.Schedule(func(context.Context) { + if ccb.balancer == nil { + return + } + ccb.balancer.Close() + ccb.balancer = nil + }) + ccb.serializerCancel() +} + +// exitIdle invokes the balancer's exitIdle method in the serializer. +func (ccb *ccBalancerWrapper) exitIdle() { + ccb.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || ccb.balancer == nil { + return + } + ccb.balancer.ExitIdle() + }) +} + +func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { + ccb.cc.mu.Lock() + defer ccb.cc.mu.Unlock() + + ccb.mu.Lock() + if ccb.closed { + ccb.mu.Unlock() + return nil, fmt.Errorf("balancer is being closed; no new SubConns allowed") + } + ccb.mu.Unlock() + + if len(addrs) == 0 { + return nil, fmt.Errorf("grpc: cannot create SubConn with empty address list") + } + ac, err := ccb.cc.newAddrConnLocked(addrs, opts) + if err != nil { + channelz.Warningf(logger, ccb.cc.channelz, "acBalancerWrapper: NewSubConn: failed to newAddrConn: %v", err) + return nil, err + } + acbw := &acBalancerWrapper{ + ccb: ccb, + ac: ac, + producers: make(map[balancer.ProducerBuilder]*refCountedProducer), + stateListener: opts.StateListener, + } + ac.acbw = acbw + return acbw, nil +} + +func (ccb *ccBalancerWrapper) RemoveSubConn(sc balancer.SubConn) { + // The graceful switch balancer will never call this. + logger.Errorf("ccb RemoveSubConn(%v) called unexpectedly, sc") +} + +func (ccb *ccBalancerWrapper) UpdateAddresses(sc balancer.SubConn, addrs []resolver.Address) { + acbw, ok := sc.(*acBalancerWrapper) + if !ok { + return + } + acbw.UpdateAddresses(addrs) +} + +func (ccb *ccBalancerWrapper) UpdateState(s balancer.State) { + ccb.cc.mu.Lock() + defer ccb.cc.mu.Unlock() + if ccb.cc.conns == nil { + // The CC has been closed; ignore this update. + return + } + + ccb.mu.Lock() + if ccb.closed { + ccb.mu.Unlock() + return + } + ccb.mu.Unlock() + // Update picker before updating state. Even though the ordering here does + // not matter, it can lead to multiple calls of Pick in the common start-up + // case where we wait for ready and then perform an RPC. If the picker is + // updated later, we could call the "connecting" picker when the state is + // updated, and then call the "ready" picker after the picker gets updated. + + // Note that there is no need to check if the balancer wrapper was closed, + // as we know the graceful switch LB policy will not call cc if it has been + // closed. + ccb.cc.pickerWrapper.updatePicker(s.Picker) + ccb.cc.csMgr.updateState(s.ConnectivityState) +} + +func (ccb *ccBalancerWrapper) ResolveNow(o resolver.ResolveNowOptions) { + ccb.cc.mu.RLock() + defer ccb.cc.mu.RUnlock() + + ccb.mu.Lock() + if ccb.closed { + ccb.mu.Unlock() + return + } + ccb.mu.Unlock() + ccb.cc.resolveNowLocked(o) +} + +func (ccb *ccBalancerWrapper) Target() string { + return ccb.cc.target +} + +// acBalancerWrapper is a wrapper on top of ac for balancers. +// It implements balancer.SubConn interface. +type acBalancerWrapper struct { + ac *addrConn // read-only + ccb *ccBalancerWrapper // read-only + stateListener func(balancer.SubConnState) + + mu sync.Mutex + producers map[balancer.ProducerBuilder]*refCountedProducer +} + +// updateState is invoked by grpc to push a subConn state update to the +// underlying balancer. +func (acbw *acBalancerWrapper) updateState(s connectivity.State, err error) { + acbw.ccb.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || acbw.ccb.balancer == nil { + return + } + // Even though it is optional for balancers, gracefulswitch ensures + // opts.StateListener is set, so this cannot ever be nil. + // TODO: delete this comment when UpdateSubConnState is removed. + acbw.stateListener(balancer.SubConnState{ConnectivityState: s, ConnectionError: err}) + }) +} + +func (acbw *acBalancerWrapper) String() string { + return fmt.Sprintf("SubConn(id:%d)", acbw.ac.channelz.ID) +} + +func (acbw *acBalancerWrapper) UpdateAddresses(addrs []resolver.Address) { + acbw.ac.updateAddrs(addrs) +} + +func (acbw *acBalancerWrapper) Connect() { + go acbw.ac.connect() +} + +func (acbw *acBalancerWrapper) Shutdown() { + acbw.ccb.cc.removeAddrConn(acbw.ac, errConnDrain) +} + +// NewStream begins a streaming RPC on the addrConn. If the addrConn is not +// ready, blocks until it is or ctx expires. Returns an error when the context +// expires or the addrConn is shut down. +func (acbw *acBalancerWrapper) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) { + transport, err := acbw.ac.getTransport(ctx) + if err != nil { + return nil, err + } + return newNonRetryClientStream(ctx, desc, method, transport, acbw.ac, opts...) +} + +// Invoke performs a unary RPC. If the addrConn is not ready, returns +// errSubConnNotReady. +func (acbw *acBalancerWrapper) Invoke(ctx context.Context, method string, args any, reply any, opts ...CallOption) error { + cs, err := acbw.NewStream(ctx, unaryStreamDesc, method, opts...) + if err != nil { + return err + } + if err := cs.SendMsg(args); err != nil { + return err + } + return cs.RecvMsg(reply) +} + +type refCountedProducer struct { + producer balancer.Producer + refs int // number of current refs to the producer + close func() // underlying producer's close function +} + +func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) (balancer.Producer, func()) { + acbw.mu.Lock() + defer acbw.mu.Unlock() + + // Look up existing producer from this builder. + pData := acbw.producers[pb] + if pData == nil { + // Not found; create a new one and add it to the producers map. + p, close := pb.Build(acbw) + pData = &refCountedProducer{producer: p, close: close} + acbw.producers[pb] = pData + } + // Account for this new reference. + pData.refs++ + + // Return a cleanup function wrapped in a OnceFunc to remove this reference + // and delete the refCountedProducer from the map if the total reference + // count goes to zero. + unref := func() { + acbw.mu.Lock() + pData.refs-- + if pData.refs == 0 { + defer pData.close() // Run outside the acbw mutex + delete(acbw.producers, pb) + } + acbw.mu.Unlock() + } + return pData.producer, grpcsync.OnceFunc(unref) +} diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index 595480112..63c639e4f 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -18,8 +18,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.22.0 +// protoc-gen-go v1.34.1 +// protoc v4.25.2 // source: grpc/binlog/v1/binarylog.proto package grpc_binarylog_v1 @@ -430,7 +430,7 @@ type ClientHeader struct { MethodName string `protobuf:"bytes,2,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` // A single process may be used to run multiple virtual // servers with different identities. - // The authority is the name of such a server identitiy. + // The authority is the name of such a server identity. // It is typically a portion of the URI in the form of // or : . Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index 429c389e4..423be7b43 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -31,15 +31,13 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" + "google.golang.org/grpc/balancer/pickfirst" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/credentials" "google.golang.org/grpc/internal" - "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/idle" - "google.golang.org/grpc/internal/pretty" iresolver "google.golang.org/grpc/internal/resolver" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" @@ -48,9 +46,9 @@ import ( "google.golang.org/grpc/status" _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. - _ "google.golang.org/grpc/internal/resolver/dns" // To register dns resolver. _ "google.golang.org/grpc/internal/resolver/passthrough" // To register passthrough resolver. _ "google.golang.org/grpc/internal/resolver/unix" // To register unix resolver. + _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. ) const ( @@ -69,12 +67,14 @@ var ( errConnDrain = errors.New("grpc: the connection is drained") // errConnClosing indicates that the connection is closing. errConnClosing = errors.New("grpc: the connection is closing") - // errConnIdling indicates the the connection is being closed as the channel + // errConnIdling indicates the connection is being closed as the channel // is moving to an idle mode due to inactivity. errConnIdling = errors.New("grpc: the connection is closing due to channel idleness") // invalidDefaultServiceConfigErrPrefix is used to prefix the json parsing error for the default // service config. invalidDefaultServiceConfigErrPrefix = "grpc: the provided default service config is invalid" + // PickFirstBalancerName is the name of the pick_first balancer. + PickFirstBalancerName = pickfirst.Name ) // The following errors are returned from Dial and DialContext @@ -103,11 +103,6 @@ const ( defaultReadBufSize = 32 * 1024 ) -// Dial creates a client connection to the given target. -func Dial(target string, opts ...DialOption) (*ClientConn, error) { - return DialContext(context.Background(), target, opts...) -} - type defaultConfigSelector struct { sc *ServiceConfig } @@ -119,47 +114,30 @@ func (dcs *defaultConfigSelector) SelectConfig(rpcInfo iresolver.RPCInfo) (*ires }, nil } -// DialContext creates a client connection to the given target. By default, it's -// a non-blocking dial (the function won't wait for connections to be -// established, and connecting happens in the background). To make it a blocking -// dial, use WithBlock() dial option. -// -// In the non-blocking case, the ctx does not act against the connection. It -// only controls the setup steps. -// -// In the blocking case, ctx can be used to cancel or expire the pending -// connection. Once this function returns, the cancellation and expiration of -// ctx will be noop. Users should call ClientConn.Close to terminate all the -// pending operations after this function returns. +// NewClient creates a new gRPC "channel" for the target URI provided. No I/O +// is performed. Use of the ClientConn for RPCs will automatically cause it to +// connect. Connect may be used to manually create a connection, but for most +// users this is unnecessary. // // The target name syntax is defined in -// https://github.com/grpc/grpc/blob/master/doc/naming.md. -// e.g. to use dns resolver, a "dns:///" prefix should be applied to the target. -func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { +// https://github.com/grpc/grpc/blob/master/doc/naming.md. e.g. to use dns +// resolver, a "dns:///" prefix should be applied to the target. +// +// The DialOptions returned by WithBlock, WithTimeout, +// WithReturnConnectionError, and FailOnNonTempDialError are ignored by this +// function. +func NewClient(target string, opts ...DialOption) (conn *ClientConn, err error) { cc := &ClientConn{ target: target, conns: make(map[*addrConn]struct{}), dopts: defaultDialOptions(), - czData: new(channelzData), } - // We start the channel off in idle mode, but kick it out of idle at the end - // of this method, instead of waiting for the first RPC. Other gRPC - // implementations do wait for the first RPC to kick the channel out of - // idle. But doing so would be a major behavior change for our users who are - // used to seeing the channel active after Dial. - // - // Taking this approach of kicking it out of idle at the end of this method - // allows us to share the code between channel creation and exiting idle - // mode. This will also make it easy for us to switch to starting the - // channel off in idle, if at all we ever get to do that. - cc.idlenessState = ccIdlenessStateIdle - cc.retryThrottler.Store((*retryThrottler)(nil)) cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{nil}) cc.ctx, cc.cancel = context.WithCancel(context.Background()) - cc.exitIdleCond = sync.NewCond(&cc.mu) + // Apply dial options. disableGlobalOpts := false for _, opt := range opts { if _, ok := opt.(*disableGlobalDialOptions); ok { @@ -178,26 +156,24 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * opt.apply(&cc.dopts) } - chainUnaryClientInterceptors(cc) - chainStreamClientInterceptors(cc) - - defer func() { - if err != nil { - cc.Close() - } - }() + // Determine the resolver to use. + if err := cc.initParsedTargetAndResolverBuilder(); err != nil { + return nil, err + } - // Register ClientConn with channelz. - cc.channelzRegistration(target) + for _, opt := range globalPerTargetDialOptions { + opt.DialOptionForTarget(cc.parsedTarget.URL).apply(&cc.dopts) + } - cc.csMgr = newConnectivityStateManager(cc.ctx, cc.channelzID) + chainUnaryClientInterceptors(cc) + chainStreamClientInterceptors(cc) if err := cc.validateTransportCredentials(); err != nil { return nil, err } if cc.dopts.defaultServiceConfigRawJSON != nil { - scpr := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON) + scpr := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON, cc.dopts.maxCallAttempts) if scpr.Err != nil { return nil, fmt.Errorf("%s: %v", invalidDefaultServiceConfigErrPrefix, scpr.Err) } @@ -205,10 +181,68 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } cc.mkp = cc.dopts.copts.KeepaliveParams - if cc.dopts.copts.UserAgent != "" { - cc.dopts.copts.UserAgent += " " + grpcUA - } else { - cc.dopts.copts.UserAgent = grpcUA + if err = cc.initAuthority(); err != nil { + return nil, err + } + + // Register ClientConn with channelz. Note that this is only done after + // channel creation cannot fail. + cc.channelzRegistration(target) + channelz.Infof(logger, cc.channelz, "parsed dial target is: %#v", cc.parsedTarget) + channelz.Infof(logger, cc.channelz, "Channel authority set to %q", cc.authority) + + cc.csMgr = newConnectivityStateManager(cc.ctx, cc.channelz) + cc.pickerWrapper = newPickerWrapper(cc.dopts.copts.StatsHandlers) + + cc.initIdleStateLocked() // Safe to call without the lock, since nothing else has a reference to cc. + cc.idlenessMgr = idle.NewManager((*idler)(cc), cc.dopts.idleTimeout) + return cc, nil +} + +// Dial calls DialContext(context.Background(), target, opts...). +// +// Deprecated: use NewClient instead. Will be supported throughout 1.x. +func Dial(target string, opts ...DialOption) (*ClientConn, error) { + return DialContext(context.Background(), target, opts...) +} + +// DialContext calls NewClient and then exits idle mode. If WithBlock(true) is +// used, it calls Connect and WaitForStateChange until either the context +// expires or the state of the ClientConn is Ready. +// +// One subtle difference between NewClient and Dial and DialContext is that the +// former uses "dns" as the default name resolver, while the latter use +// "passthrough" for backward compatibility. This distinction should not matter +// to most users, but could matter to legacy users that specify a custom dialer +// and expect it to receive the target string directly. +// +// Deprecated: use NewClient instead. Will be supported throughout 1.x. +func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { + // At the end of this method, we kick the channel out of idle, rather than + // waiting for the first rpc. + opts = append([]DialOption{withDefaultScheme("passthrough")}, opts...) + cc, err := NewClient(target, opts...) + if err != nil { + return nil, err + } + + // We start the channel off in idle mode, but kick it out of idle now, + // instead of waiting for the first RPC. This is the legacy behavior of + // Dial. + defer func() { + if err != nil { + cc.Close() + } + }() + + // This creates the name resolver, load balancer, etc. + if err := cc.idlenessMgr.ExitIdleMode(); err != nil { + return nil, err + } + + // Return now for non-blocking dials. + if !cc.dopts.block { + return cc, nil } if cc.dopts.timeout > 0 { @@ -231,49 +265,6 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } }() - if cc.dopts.bs == nil { - cc.dopts.bs = backoff.DefaultExponential - } - - // Determine the resolver to use. - if err := cc.parseTargetAndFindResolver(); err != nil { - return nil, err - } - if err = cc.determineAuthority(); err != nil { - return nil, err - } - - if cc.dopts.scChan != nil { - // Blocking wait for the initial service config. - select { - case sc, ok := <-cc.dopts.scChan: - if ok { - cc.sc = &sc - cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{&sc}) - } - case <-ctx.Done(): - return nil, ctx.Err() - } - } - if cc.dopts.scChan != nil { - go cc.scWatcher() - } - - // This creates the name resolver, load balancer, blocking picker etc. - if err := cc.exitIdleMode(); err != nil { - return nil, err - } - - // Configure idleness support with configured idle timeout or default idle - // timeout duration. Idleness can be explicitly disabled by the user, by - // setting the dial option to 0. - cc.idlenessMgr = idle.NewManager(idle.ManagerOptions{Enforcer: (*idler)(cc), Timeout: cc.dopts.idleTimeout, Logger: logger}) - - // Return early for non-blocking dials. - if !cc.dopts.block { - return cc, nil - } - // A blocking dial blocks until the clientConn is ready. for { s := cc.GetState() @@ -305,23 +296,23 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * // addTraceEvent is a helper method to add a trace event on the channel. If the // channel is a nested one, the same event is also added on the parent channel. func (cc *ClientConn) addTraceEvent(msg string) { - ted := &channelz.TraceEventDesc{ + ted := &channelz.TraceEvent{ Desc: fmt.Sprintf("Channel %s", msg), Severity: channelz.CtInfo, } - if cc.dopts.channelzParentID != nil { - ted.Parent = &channelz.TraceEventDesc{ - Desc: fmt.Sprintf("Nested channel(id:%d) %s", cc.channelzID.Int(), msg), + if cc.dopts.channelzParent != nil { + ted.Parent = &channelz.TraceEvent{ + Desc: fmt.Sprintf("Nested channel(id:%d) %s", cc.channelz.ID, msg), Severity: channelz.CtInfo, } } - channelz.AddTraceEvent(logger, cc.channelzID, 0, ted) + channelz.AddTraceEvent(logger, cc.channelz, 0, ted) } type idler ClientConn -func (i *idler) EnterIdleMode() error { - return (*ClientConn)(i).enterIdleMode() +func (i *idler) EnterIdleMode() { + (*ClientConn)(i).enterIdleMode() } func (i *idler) ExitIdleMode() error { @@ -329,117 +320,71 @@ func (i *idler) ExitIdleMode() error { } // exitIdleMode moves the channel out of idle mode by recreating the name -// resolver and load balancer. -func (cc *ClientConn) exitIdleMode() error { +// resolver and load balancer. This should never be called directly; use +// cc.idlenessMgr.ExitIdleMode instead. +func (cc *ClientConn) exitIdleMode() (err error) { cc.mu.Lock() if cc.conns == nil { cc.mu.Unlock() return errConnClosing } - if cc.idlenessState != ccIdlenessStateIdle { - channelz.Infof(logger, cc.channelzID, "ClientConn asked to exit idle mode, current mode is %v", cc.idlenessState) - cc.mu.Unlock() - return nil - } - - defer func() { - // When Close() and exitIdleMode() race against each other, one of the - // following two can happen: - // - Close() wins the race and runs first. exitIdleMode() runs after, and - // sees that the ClientConn is already closed and hence returns early. - // - exitIdleMode() wins the race and runs first and recreates the balancer - // and releases the lock before recreating the resolver. If Close() runs - // in this window, it will wait for exitIdleMode to complete. - // - // We achieve this synchronization using the below condition variable. - cc.mu.Lock() - cc.idlenessState = ccIdlenessStateActive - cc.exitIdleCond.Signal() - cc.mu.Unlock() - }() - - cc.idlenessState = ccIdlenessStateExitingIdle - exitedIdle := false - if cc.blockingpicker == nil { - cc.blockingpicker = newPickerWrapper(cc.dopts.copts.StatsHandlers) - } else { - cc.blockingpicker.exitIdleMode() - exitedIdle = true - } - - var credsClone credentials.TransportCredentials - if creds := cc.dopts.copts.TransportCredentials; creds != nil { - credsClone = creds.Clone() - } - if cc.balancerWrapper == nil { - cc.balancerWrapper = newCCBalancerWrapper(cc, balancer.BuildOptions{ - DialCreds: credsClone, - CredsBundle: cc.dopts.copts.CredsBundle, - Dialer: cc.dopts.copts.Dialer, - Authority: cc.authority, - CustomUserAgent: cc.dopts.copts.UserAgent, - ChannelzParentID: cc.channelzID, - Target: cc.parsedTarget, - }) - } else { - cc.balancerWrapper.exitIdleMode() - } - cc.firstResolveEvent = grpcsync.NewEvent() cc.mu.Unlock() // This needs to be called without cc.mu because this builds a new resolver - // which might update state or report error inline which needs to be handled - // by cc.updateResolverState() which also grabs cc.mu. - if err := cc.initResolverWrapper(credsClone); err != nil { + // which might update state or report error inline, which would then need to + // acquire cc.mu. + if err := cc.resolverWrapper.start(); err != nil { return err } - if exitedIdle { - cc.addTraceEvent("exiting idle mode") - } + cc.addTraceEvent("exiting idle mode") return nil } +// initIdleStateLocked initializes common state to how it should be while idle. +func (cc *ClientConn) initIdleStateLocked() { + cc.resolverWrapper = newCCResolverWrapper(cc) + cc.balancerWrapper = newCCBalancerWrapper(cc) + cc.firstResolveEvent = grpcsync.NewEvent() + // cc.conns == nil is a proxy for the ClientConn being closed. So, instead + // of setting it to nil here, we recreate the map. This also means that we + // don't have to do this when exiting idle mode. + cc.conns = make(map[*addrConn]struct{}) +} + // enterIdleMode puts the channel in idle mode, and as part of it shuts down the -// name resolver, load balancer and any subchannels. -func (cc *ClientConn) enterIdleMode() error { +// name resolver, load balancer, and any subchannels. This should never be +// called directly; use cc.idlenessMgr.EnterIdleMode instead. +func (cc *ClientConn) enterIdleMode() { cc.mu.Lock() - defer cc.mu.Unlock() if cc.conns == nil { - return ErrClientConnClosing - } - if cc.idlenessState != ccIdlenessStateActive { - channelz.Warningf(logger, cc.channelzID, "ClientConn asked to enter idle mode, current mode is %v", cc.idlenessState) - return nil + cc.mu.Unlock() + return } - // cc.conns == nil is a proxy for the ClientConn being closed. So, instead - // of setting it to nil here, we recreate the map. This also means that we - // don't have to do this when exiting idle mode. conns := cc.conns - cc.conns = make(map[*addrConn]struct{}) - // TODO: Currently, we close the resolver wrapper upon entering idle mode - // and create a new one upon exiting idle mode. This means that the - // `cc.resolverWrapper` field would be overwritten everytime we exit idle - // mode. While this means that we need to hold `cc.mu` when accessing - // `cc.resolverWrapper`, it makes the code simpler in the wrapper. We should - // try to do the same for the balancer and picker wrappers too. - cc.resolverWrapper.close() - cc.blockingpicker.enterIdleMode() - cc.balancerWrapper.enterIdleMode() + rWrapper := cc.resolverWrapper + rWrapper.close() + cc.pickerWrapper.reset() + bWrapper := cc.balancerWrapper + bWrapper.close() cc.csMgr.updateState(connectivity.Idle) - cc.idlenessState = ccIdlenessStateIdle cc.addTraceEvent("entering idle mode") - go func() { - for ac := range conns { - ac.tearDown(errConnIdling) - } - }() + cc.initIdleStateLocked() - return nil + cc.mu.Unlock() + + // Block until the name resolver and LB policy are closed. + <-rWrapper.serializer.Done() + <-bWrapper.serializer.Done() + + // Close all subchannels after the LB policy is closed. + for ac := range conns { + ac.tearDown(errConnIdling) + } } // validateTransportCredentials performs a series of checks on the configured @@ -478,14 +423,15 @@ func (cc *ClientConn) validateTransportCredentials() error { } // channelzRegistration registers the newly created ClientConn with channelz and -// stores the returned identifier in `cc.channelzID` and `cc.csMgr.channelzID`. -// A channelz trace event is emitted for ClientConn creation. If the newly -// created ClientConn is a nested one, i.e a valid parent ClientConn ID is -// specified via a dial option, the trace event is also added to the parent. +// stores the returned identifier in `cc.channelz`. A channelz trace event is +// emitted for ClientConn creation. If the newly created ClientConn is a nested +// one, i.e a valid parent ClientConn ID is specified via a dial option, the +// trace event is also added to the parent. // // Doesn't grab cc.mu as this method is expected to be called only at Dial time. func (cc *ClientConn) channelzRegistration(target string) { - cc.channelzID = channelz.RegisterChannel(&channelzChannel{cc}, cc.dopts.channelzParentID, target) + parentChannel, _ := cc.dopts.channelzParent.(*channelz.Channel) + cc.channelz = channelz.RegisterChannel(parentChannel, target) cc.addTraceEvent("created") } @@ -552,11 +498,11 @@ func getChainStreamer(interceptors []StreamClientInterceptor, curr int, finalStr } // newConnectivityStateManager creates an connectivityStateManager with -// the specified id. -func newConnectivityStateManager(ctx context.Context, id *channelz.Identifier) *connectivityStateManager { +// the specified channel. +func newConnectivityStateManager(ctx context.Context, channel *channelz.Channel) *connectivityStateManager { return &connectivityStateManager{ - channelzID: id, - pubSub: grpcsync.NewPubSub(ctx), + channelz: channel, + pubSub: grpcsync.NewPubSub(ctx), } } @@ -570,7 +516,7 @@ type connectivityStateManager struct { mu sync.Mutex state connectivity.State notifyChan chan struct{} - channelzID *channelz.Identifier + channelz *channelz.Channel pubSub *grpcsync.PubSub } @@ -587,9 +533,10 @@ func (csm *connectivityStateManager) updateState(state connectivity.State) { return } csm.state = state + csm.channelz.ChannelMetrics.State.Store(&state) csm.pubSub.Publish(state) - channelz.Infof(logger, csm.channelzID, "Channel Connectivity change to %v", state) + channelz.Infof(logger, csm.channelz, "Channel Connectivity change to %v", state) if csm.notifyChan != nil { // There are other goroutines waiting on this channel. close(csm.notifyChan) @@ -643,72 +590,40 @@ type ClientConn struct { cancel context.CancelFunc // Cancelled on close. // The following are initialized at dial time, and are read-only after that. - target string // User's dial target. - parsedTarget resolver.Target // See parseTargetAndFindResolver(). - authority string // See determineAuthority(). - dopts dialOptions // Default and user specified dial options. - channelzID *channelz.Identifier // Channelz identifier for the channel. - resolverBuilder resolver.Builder // See parseTargetAndFindResolver(). - balancerWrapper *ccBalancerWrapper // Uses gracefulswitch.balancer underneath. - idlenessMgr idle.Manager + target string // User's dial target. + parsedTarget resolver.Target // See initParsedTargetAndResolverBuilder(). + authority string // See initAuthority(). + dopts dialOptions // Default and user specified dial options. + channelz *channelz.Channel // Channelz object. + resolverBuilder resolver.Builder // See initParsedTargetAndResolverBuilder(). + idlenessMgr *idle.Manager // The following provide their own synchronization, and therefore don't // require cc.mu to be held to access them. csMgr *connectivityStateManager - blockingpicker *pickerWrapper + pickerWrapper *pickerWrapper safeConfigSelector iresolver.SafeConfigSelector - czData *channelzData retryThrottler atomic.Value // Updated from service config. - // firstResolveEvent is used to track whether the name resolver sent us at - // least one update. RPCs block on this event. - firstResolveEvent *grpcsync.Event - // mu protects the following fields. // TODO: split mu so the same mutex isn't used for everything. mu sync.RWMutex - resolverWrapper *ccResolverWrapper // Initialized in Dial; cleared in Close. + resolverWrapper *ccResolverWrapper // Always recreated whenever entering idle to simplify Close. + balancerWrapper *ccBalancerWrapper // Always recreated whenever entering idle to simplify Close. sc *ServiceConfig // Latest service config received from the resolver. conns map[*addrConn]struct{} // Set to nil on close. mkp keepalive.ClientParameters // May be updated upon receipt of a GoAway. - idlenessState ccIdlenessState // Tracks idleness state of the channel. - exitIdleCond *sync.Cond // Signalled when channel exits idle. + // firstResolveEvent is used to track whether the name resolver sent us at + // least one update. RPCs block on this event. May be accessed without mu + // if we know we cannot be asked to enter idle mode while accessing it (e.g. + // when the idle manager has already been closed, or if we are already + // entering idle mode). + firstResolveEvent *grpcsync.Event lceMu sync.Mutex // protects lastConnectionError lastConnectionError error } -// ccIdlenessState tracks the idleness state of the channel. -// -// Channels start off in `active` and move to `idle` after a period of -// inactivity. When moving back to `active` upon an incoming RPC, they -// transition through `exiting_idle`. This state is useful for synchronization -// with Close(). -// -// This state tracking is mostly for self-protection. The idlenessManager is -// expected to keep track of the state as well, and is expected not to call into -// the ClientConn unnecessarily. -type ccIdlenessState int8 - -const ( - ccIdlenessStateActive ccIdlenessState = iota - ccIdlenessStateIdle - ccIdlenessStateExitingIdle -) - -func (s ccIdlenessState) String() string { - switch s { - case ccIdlenessStateActive: - return "active" - case ccIdlenessStateIdle: - return "idle" - case ccIdlenessStateExitingIdle: - return "exitingIdle" - default: - return "unknown" - } -} - // WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or // ctx expires. A true value is returned in former case and false in latter. // @@ -748,29 +663,15 @@ func (cc *ClientConn) GetState() connectivity.State { // Notice: This API is EXPERIMENTAL and may be changed or removed in a later // release. func (cc *ClientConn) Connect() { - cc.exitIdleMode() + if err := cc.idlenessMgr.ExitIdleMode(); err != nil { + cc.addTraceEvent(err.Error()) + return + } // If the ClientConn was not in idle mode, we need to call ExitIdle on the // LB policy so that connections can be created. - cc.balancerWrapper.exitIdleMode() -} - -func (cc *ClientConn) scWatcher() { - for { - select { - case sc, ok := <-cc.dopts.scChan: - if !ok { - return - } - cc.mu.Lock() - // TODO: load balance policy runtime change is ignored. - // We may revisit this decision in the future. - cc.sc = &sc - cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{&sc}) - cc.mu.Unlock() - case <-cc.ctx.Done(): - return - } - } + cc.mu.Lock() + cc.balancerWrapper.exitIdle() + cc.mu.Unlock() } // waitForResolvedAddrs blocks until the resolver has provided addresses or the @@ -795,7 +696,7 @@ func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) error { var emptyServiceConfig *ServiceConfig func init() { - cfg := parseServiceConfig("{}") + cfg := parseServiceConfig("{}", defaultMaxCallAttempts) if cfg.Err != nil { panic(fmt.Sprintf("impossible error parsing empty service config: %v", cfg.Err)) } @@ -804,29 +705,28 @@ func init() { internal.SubscribeToConnectivityStateChanges = func(cc *ClientConn, s grpcsync.Subscriber) func() { return cc.csMgr.pubSub.Subscribe(s) } - internal.EnterIdleModeForTesting = func(cc *ClientConn) error { - return cc.enterIdleMode() + internal.EnterIdleModeForTesting = func(cc *ClientConn) { + cc.idlenessMgr.EnterIdleModeForTesting() } internal.ExitIdleModeForTesting = func(cc *ClientConn) error { - return cc.exitIdleMode() + return cc.idlenessMgr.ExitIdleMode() } } -func (cc *ClientConn) maybeApplyDefaultServiceConfig(addrs []resolver.Address) { +func (cc *ClientConn) maybeApplyDefaultServiceConfig() { if cc.sc != nil { - cc.applyServiceConfigAndBalancer(cc.sc, nil, addrs) + cc.applyServiceConfigAndBalancer(cc.sc, nil) return } if cc.dopts.defaultServiceConfig != nil { - cc.applyServiceConfigAndBalancer(cc.dopts.defaultServiceConfig, &defaultConfigSelector{cc.dopts.defaultServiceConfig}, addrs) + cc.applyServiceConfigAndBalancer(cc.dopts.defaultServiceConfig, &defaultConfigSelector{cc.dopts.defaultServiceConfig}) } else { - cc.applyServiceConfigAndBalancer(emptyServiceConfig, &defaultConfigSelector{emptyServiceConfig}, addrs) + cc.applyServiceConfigAndBalancer(emptyServiceConfig, &defaultConfigSelector{emptyServiceConfig}) } } -func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { +func (cc *ClientConn) updateResolverStateAndUnlock(s resolver.State, err error) error { defer cc.firstResolveEvent.Fire() - cc.mu.Lock() // Check if the ClientConn is already closed. Some fields (e.g. // balancerWrapper) are set to nil when closing the ClientConn, and could // cause nil pointer panic if we don't have this check. @@ -839,7 +739,7 @@ func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { // May need to apply the initial service config in case the resolver // doesn't support service configs, or doesn't provide a service config // with the new addresses. - cc.maybeApplyDefaultServiceConfig(nil) + cc.maybeApplyDefaultServiceConfig() cc.balancerWrapper.resolverError(err) @@ -850,10 +750,10 @@ func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { var ret error if cc.dopts.disableServiceConfig { - channelz.Infof(logger, cc.channelzID, "ignoring service config from resolver (%v) and applying the default because service config is disabled", s.ServiceConfig) - cc.maybeApplyDefaultServiceConfig(s.Addresses) + channelz.Infof(logger, cc.channelz, "ignoring service config from resolver (%v) and applying the default because service config is disabled", s.ServiceConfig) + cc.maybeApplyDefaultServiceConfig() } else if s.ServiceConfig == nil { - cc.maybeApplyDefaultServiceConfig(s.Addresses) + cc.maybeApplyDefaultServiceConfig() // TODO: do we need to apply a failing LB policy if there is no // default, per the error handling design? } else { @@ -861,18 +761,18 @@ func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { configSelector := iresolver.GetConfigSelector(s) if configSelector != nil { if len(s.ServiceConfig.Config.(*ServiceConfig).Methods) != 0 { - channelz.Infof(logger, cc.channelzID, "method configs in service config will be ignored due to presence of config selector") + channelz.Infof(logger, cc.channelz, "method configs in service config will be ignored due to presence of config selector") } } else { configSelector = &defaultConfigSelector{sc} } - cc.applyServiceConfigAndBalancer(sc, configSelector, s.Addresses) + cc.applyServiceConfigAndBalancer(sc, configSelector) } else { ret = balancer.ErrBadResolverState if cc.sc == nil { // Apply the failing LB only if we haven't received valid service config // from the name resolver in the past. - cc.applyFailingLB(s.ServiceConfig) + cc.applyFailingLBLocked(s.ServiceConfig) cc.mu.Unlock() return ret } @@ -881,7 +781,7 @@ func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { var balCfg serviceconfig.LoadBalancingConfig if cc.sc != nil && cc.sc.lbConfig != nil { - balCfg = cc.sc.lbConfig.cfg + balCfg = cc.sc.lbConfig } bw := cc.balancerWrapper cc.mu.Unlock() @@ -894,15 +794,13 @@ func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { return ret } -// applyFailingLB is akin to configuring an LB policy on the channel which +// applyFailingLBLocked is akin to configuring an LB policy on the channel which // always fails RPCs. Here, an actual LB policy is not configured, but an always // erroring picker is configured, which returns errors with information about // what was invalid in the received service config. A config selector with no // service config is configured, and the connectivity state of the channel is // set to TransientFailure. -// -// Caller must hold cc.mu. -func (cc *ClientConn) applyFailingLB(sc *serviceconfig.ParseResult) { +func (cc *ClientConn) applyFailingLBLocked(sc *serviceconfig.ParseResult) { var err error if sc.Err != nil { err = status.Errorf(codes.Unavailable, "error parsing service config: %v", sc.Err) @@ -910,14 +808,10 @@ func (cc *ClientConn) applyFailingLB(sc *serviceconfig.ParseResult) { err = status.Errorf(codes.Unavailable, "illegal service config type: %T", sc.Config) } cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{nil}) - cc.blockingpicker.updatePicker(base.NewErrPicker(err)) + cc.pickerWrapper.updatePicker(base.NewErrPicker(err)) cc.csMgr.updateState(connectivity.TransientFailure) } -func (cc *ClientConn) handleSubConnStateChange(sc balancer.SubConn, s connectivity.State, err error) { - cc.balancerWrapper.updateSubConnState(sc, s, err) -} - // Makes a copy of the input addresses slice and clears out the balancer // attributes field. Addresses are passed during subconn creation and address // update operations. In both cases, we will clear the balancer attributes by @@ -932,42 +826,39 @@ func copyAddressesWithoutBalancerAttributes(in []resolver.Address) []resolver.Ad return out } -// newAddrConn creates an addrConn for addrs and adds it to cc.conns. +// newAddrConnLocked creates an addrConn for addrs and adds it to cc.conns. // // Caller needs to make sure len(addrs) > 0. -func (cc *ClientConn) newAddrConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (*addrConn, error) { +func (cc *ClientConn) newAddrConnLocked(addrs []resolver.Address, opts balancer.NewSubConnOptions) (*addrConn, error) { + if cc.conns == nil { + return nil, ErrClientConnClosing + } + ac := &addrConn{ state: connectivity.Idle, cc: cc, addrs: copyAddressesWithoutBalancerAttributes(addrs), scopts: opts, dopts: cc.dopts, - czData: new(channelzData), + channelz: channelz.RegisterSubChannel(cc.channelz, ""), resetBackoff: make(chan struct{}), stateChan: make(chan struct{}), } ac.ctx, ac.cancel = context.WithCancel(cc.ctx) - // Track ac in cc. This needs to be done before any getTransport(...) is called. - cc.mu.Lock() - defer cc.mu.Unlock() - if cc.conns == nil { - return nil, ErrClientConnClosing - } + // Start with our address set to the first address; this may be updated if + // we connect to different addresses. + ac.channelz.ChannelMetrics.Target.Store(&addrs[0].Addr) - var err error - ac.channelzID, err = channelz.RegisterSubChannel(ac, cc.channelzID, "") - if err != nil { - return nil, err - } - channelz.AddTraceEvent(logger, ac.channelzID, 0, &channelz.TraceEventDesc{ + channelz.AddTraceEvent(logger, ac.channelz, 0, &channelz.TraceEvent{ Desc: "Subchannel created", Severity: channelz.CtInfo, - Parent: &channelz.TraceEventDesc{ - Desc: fmt.Sprintf("Subchannel(id:%d) created", ac.channelzID.Int()), + Parent: &channelz.TraceEvent{ + Desc: fmt.Sprintf("Subchannel(id:%d) created", ac.channelz.ID), Severity: channelz.CtInfo, }, }) + // Track ac in cc. This needs to be done before any getTransport(...) is called. cc.conns[ac] = struct{}{} return ac, nil } @@ -985,38 +876,27 @@ func (cc *ClientConn) removeAddrConn(ac *addrConn, err error) { ac.tearDown(err) } -func (cc *ClientConn) channelzMetric() *channelz.ChannelInternalMetric { - return &channelz.ChannelInternalMetric{ - State: cc.GetState(), - Target: cc.target, - CallsStarted: atomic.LoadInt64(&cc.czData.callsStarted), - CallsSucceeded: atomic.LoadInt64(&cc.czData.callsSucceeded), - CallsFailed: atomic.LoadInt64(&cc.czData.callsFailed), - LastCallStartedTimestamp: time.Unix(0, atomic.LoadInt64(&cc.czData.lastCallStartedTime)), - } -} - // Target returns the target string of the ClientConn. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. func (cc *ClientConn) Target() string { return cc.target } +// CanonicalTarget returns the canonical target string of the ClientConn. +func (cc *ClientConn) CanonicalTarget() string { + return cc.parsedTarget.String() +} + func (cc *ClientConn) incrCallsStarted() { - atomic.AddInt64(&cc.czData.callsStarted, 1) - atomic.StoreInt64(&cc.czData.lastCallStartedTime, time.Now().UnixNano()) + cc.channelz.ChannelMetrics.CallsStarted.Add(1) + cc.channelz.ChannelMetrics.LastCallStartedTimestamp.Store(time.Now().UnixNano()) } func (cc *ClientConn) incrCallsSucceeded() { - atomic.AddInt64(&cc.czData.callsSucceeded, 1) + cc.channelz.ChannelMetrics.CallsSucceeded.Add(1) } func (cc *ClientConn) incrCallsFailed() { - atomic.AddInt64(&cc.czData.callsFailed, 1) + cc.channelz.ChannelMetrics.CallsFailed.Add(1) } // connect starts creating a transport. @@ -1059,10 +939,14 @@ func equalAddresses(a, b []resolver.Address) bool { // updateAddrs updates ac.addrs with the new addresses list and handles active // connections or connection attempts. func (ac *addrConn) updateAddrs(addrs []resolver.Address) { - ac.mu.Lock() - channelz.Infof(logger, ac.channelzID, "addrConn: updateAddrs curAddr: %v, addrs: %v", pretty.ToJSON(ac.curAddr), pretty.ToJSON(addrs)) - addrs = copyAddressesWithoutBalancerAttributes(addrs) + limit := len(addrs) + if limit > 5 { + limit = 5 + } + channelz.Infof(logger, ac.channelz, "addrConn: updateAddrs addrs (%d of %d): %v", limit, len(addrs), addrs[:limit]) + + ac.mu.Lock() if equalAddresses(ac.addrs, addrs) { ac.mu.Unlock() return @@ -1174,13 +1058,13 @@ func (cc *ClientConn) healthCheckConfig() *healthCheckConfig { } func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, balancer.PickResult, error) { - return cc.blockingpicker.pick(ctx, failfast, balancer.PickInfo{ + return cc.pickerWrapper.pick(ctx, failfast, balancer.PickInfo{ Ctx: ctx, FullMethodName: method, }) } -func (cc *ClientConn) applyServiceConfigAndBalancer(sc *ServiceConfig, configSelector iresolver.ConfigSelector, addrs []resolver.Address) { +func (cc *ClientConn) applyServiceConfigAndBalancer(sc *ServiceConfig, configSelector iresolver.ConfigSelector) { if sc == nil { // should never reach here. return @@ -1201,27 +1085,16 @@ func (cc *ClientConn) applyServiceConfigAndBalancer(sc *ServiceConfig, configSel } else { cc.retryThrottler.Store((*retryThrottler)(nil)) } - - var newBalancerName string - if cc.sc == nil || (cc.sc.lbConfig == nil && cc.sc.LB == nil) { - // No service config or no LB policy specified in config. - newBalancerName = PickFirstBalancerName - } else if cc.sc.lbConfig != nil { - newBalancerName = cc.sc.lbConfig.name - } else { // cc.sc.LB != nil - newBalancerName = *cc.sc.LB - } - cc.balancerWrapper.switchTo(newBalancerName) } func (cc *ClientConn) resolveNow(o resolver.ResolveNowOptions) { cc.mu.RLock() - r := cc.resolverWrapper + cc.resolverWrapper.resolveNow(o) cc.mu.RUnlock() - if r == nil { - return - } - go r.resolveNow(o) +} + +func (cc *ClientConn) resolveNowLocked(o resolver.ResolveNowOptions) { + cc.resolverWrapper.resolveNow(o) } // ResetConnectBackoff wakes up all subchannels in transient failure and causes @@ -1253,40 +1126,32 @@ func (cc *ClientConn) Close() error { <-cc.csMgr.pubSub.Done() }() + // Prevent calls to enter/exit idle immediately, and ensure we are not + // currently entering/exiting idle mode. + cc.idlenessMgr.Close() + cc.mu.Lock() if cc.conns == nil { cc.mu.Unlock() return ErrClientConnClosing } - for cc.idlenessState == ccIdlenessStateExitingIdle { - cc.exitIdleCond.Wait() - } - conns := cc.conns cc.conns = nil cc.csMgr.updateState(connectivity.Shutdown) - pWrapper := cc.blockingpicker - rWrapper := cc.resolverWrapper - bWrapper := cc.balancerWrapper - idlenessMgr := cc.idlenessMgr + // We can safely unlock and continue to access all fields now as + // cc.conns==nil, preventing any further operations on cc. cc.mu.Unlock() + cc.resolverWrapper.close() // The order of closing matters here since the balancer wrapper assumes the // picker is closed before it is closed. - if pWrapper != nil { - pWrapper.close() - } - if bWrapper != nil { - bWrapper.close() - } - if rWrapper != nil { - rWrapper.close() - } - if idlenessMgr != nil { - idlenessMgr.Close() - } + cc.pickerWrapper.close() + cc.balancerWrapper.close() + + <-cc.resolverWrapper.serializer.Done() + <-cc.balancerWrapper.serializer.Done() for ac := range conns { ac.tearDown(ErrClientConnClosing) @@ -1295,7 +1160,7 @@ func (cc *ClientConn) Close() error { // TraceEvent needs to be called before RemoveEntry, as TraceEvent may add // trace reference to the entity being deleted, and thus prevent it from being // deleted right away. - channelz.RemoveEntry(cc.channelzID) + channelz.RemoveEntry(cc.channelz.ID) return nil } @@ -1307,7 +1172,7 @@ type addrConn struct { cc *ClientConn dopts dialOptions - acbw balancer.SubConn + acbw *acBalancerWrapper scopts balancer.NewSubConnOptions // transport is set when there's a viable transport (note: ac state may not be READY as LB channel @@ -1316,6 +1181,10 @@ type addrConn struct { // is received, transport is closed, ac has been torn down). transport transport.ClientTransport // The current transport. + // This mutex is used on the RPC path, so its usage should be minimized as + // much as possible. + // TODO: Find a lock-free way to retrieve the transport and state from the + // addrConn. mu sync.Mutex curAddr resolver.Address // The current address. addrs []resolver.Address // All addresses that the resolver resolved to. @@ -1327,8 +1196,7 @@ type addrConn struct { backoffIdx int // Needs to be stateful for resetConnectBackoff. resetBackoff chan struct{} - channelzID *channelz.Identifier - czData *channelzData + channelz *channelz.SubChannel } // Note: this requires a lock on ac.mu. @@ -1340,12 +1208,13 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) close(ac.stateChan) ac.stateChan = make(chan struct{}) ac.state = s + ac.channelz.ChannelMetrics.State.Store(&s) if lastErr == nil { - channelz.Infof(logger, ac.channelzID, "Subchannel Connectivity change to %v", s) + channelz.Infof(logger, ac.channelz, "Subchannel Connectivity change to %v", s) } else { - channelz.Infof(logger, ac.channelzID, "Subchannel Connectivity change to %v, last error: %s", s, lastErr) + channelz.Infof(logger, ac.channelz, "Subchannel Connectivity change to %v, last error: %s", s, lastErr) } - ac.cc.handleSubConnStateChange(ac.acbw, s, lastErr) + ac.acbw.updateState(s, lastErr) } // adjustParams updates parameters used to create transports upon @@ -1441,6 +1310,7 @@ func (ac *addrConn) resetTransport() { func (ac *addrConn) tryAllAddrs(ctx context.Context, addrs []resolver.Address, connectDeadline time.Time) error { var firstConnErr error for _, addr := range addrs { + ac.channelz.ChannelMetrics.Target.Store(&addr.Addr) if ctx.Err() != nil { return errConnClosing } @@ -1456,7 +1326,7 @@ func (ac *addrConn) tryAllAddrs(ctx context.Context, addrs []resolver.Address, c } ac.mu.Unlock() - channelz.Infof(logger, ac.channelzID, "Subchannel picks a new address %q to connect", addr.Addr) + channelz.Infof(logger, ac.channelz, "Subchannel picks a new address %q to connect", addr.Addr) err := ac.createTransport(ctx, addr, copts, connectDeadline) if err == nil { @@ -1509,7 +1379,7 @@ func (ac *addrConn) createTransport(ctx context.Context, addr resolver.Address, connectCtx, cancel := context.WithDeadline(ctx, connectDeadline) defer cancel() - copts.ChannelzParentID = ac.channelzID + copts.ChannelzParent = ac.channelz newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, addr, copts, onClose) if err != nil { @@ -1518,7 +1388,7 @@ func (ac *addrConn) createTransport(ctx context.Context, addr resolver.Address, } // newTr is either nil, or closed. hcancel() - channelz.Warningf(logger, ac.channelzID, "grpc: addrConn.createTransport failed to connect to %s. Err: %v", addr, err) + channelz.Warningf(logger, ac.channelz, "grpc: addrConn.createTransport failed to connect to %s. Err: %v", addr, err) return err } @@ -1590,7 +1460,7 @@ func (ac *addrConn) startHealthCheck(ctx context.Context) { // The health package is not imported to set health check function. // // TODO: add a link to the health check doc in the error message. - channelz.Error(logger, ac.channelzID, "Health check is requested but health check function is not set.") + channelz.Error(logger, ac.channelz, "Health check is requested but health check function is not set.") return } @@ -1620,9 +1490,9 @@ func (ac *addrConn) startHealthCheck(ctx context.Context) { err := ac.cc.dopts.healthCheckFunc(ctx, newStream, setConnectivityState, healthCheckConfig.ServiceName) if err != nil { if status.Code(err) == codes.Unimplemented { - channelz.Error(logger, ac.channelzID, "Subchannel health check is unimplemented at server side, thus health check is disabled") + channelz.Error(logger, ac.channelz, "Subchannel health check is unimplemented at server side, thus health check is disabled") } else { - channelz.Errorf(logger, ac.channelzID, "Health checking failed: %v", err) + channelz.Errorf(logger, ac.channelz, "Health checking failed: %v", err) } } }() @@ -1687,18 +1557,18 @@ func (ac *addrConn) tearDown(err error) { ac.cancel() ac.curAddr = resolver.Address{} - channelz.AddTraceEvent(logger, ac.channelzID, 0, &channelz.TraceEventDesc{ + channelz.AddTraceEvent(logger, ac.channelz, 0, &channelz.TraceEvent{ Desc: "Subchannel deleted", Severity: channelz.CtInfo, - Parent: &channelz.TraceEventDesc{ - Desc: fmt.Sprintf("Subchannel(id:%d) deleted", ac.channelzID.Int()), + Parent: &channelz.TraceEvent{ + Desc: fmt.Sprintf("Subchannel(id:%d) deleted", ac.channelz.ID), Severity: channelz.CtInfo, }, }) // TraceEvent needs to be called before RemoveEntry, as TraceEvent may add // trace reference to the entity being deleted, and thus prevent it from // being deleted right away. - channelz.RemoveEntry(ac.channelzID) + channelz.RemoveEntry(ac.channelz.ID) ac.mu.Unlock() // We have to release the lock before the call to GracefulClose/Close here @@ -1725,39 +1595,6 @@ func (ac *addrConn) tearDown(err error) { } } -func (ac *addrConn) getState() connectivity.State { - ac.mu.Lock() - defer ac.mu.Unlock() - return ac.state -} - -func (ac *addrConn) ChannelzMetric() *channelz.ChannelInternalMetric { - ac.mu.Lock() - addr := ac.curAddr.Addr - ac.mu.Unlock() - return &channelz.ChannelInternalMetric{ - State: ac.getState(), - Target: addr, - CallsStarted: atomic.LoadInt64(&ac.czData.callsStarted), - CallsSucceeded: atomic.LoadInt64(&ac.czData.callsSucceeded), - CallsFailed: atomic.LoadInt64(&ac.czData.callsFailed), - LastCallStartedTimestamp: time.Unix(0, atomic.LoadInt64(&ac.czData.lastCallStartedTime)), - } -} - -func (ac *addrConn) incrCallsStarted() { - atomic.AddInt64(&ac.czData.callsStarted, 1) - atomic.StoreInt64(&ac.czData.lastCallStartedTime, time.Now().UnixNano()) -} - -func (ac *addrConn) incrCallsSucceeded() { - atomic.AddInt64(&ac.czData.callsSucceeded, 1) -} - -func (ac *addrConn) incrCallsFailed() { - atomic.AddInt64(&ac.czData.callsFailed, 1) -} - type retryThrottler struct { max float64 thresh float64 @@ -1795,12 +1632,17 @@ func (rt *retryThrottler) successfulRPC() { } } -type channelzChannel struct { - cc *ClientConn +func (ac *addrConn) incrCallsStarted() { + ac.channelz.ChannelMetrics.CallsStarted.Add(1) + ac.channelz.ChannelMetrics.LastCallStartedTimestamp.Store(time.Now().UnixNano()) } -func (c *channelzChannel) ChannelzMetric() *channelz.ChannelInternalMetric { - return c.cc.channelzMetric() +func (ac *addrConn) incrCallsSucceeded() { + ac.channelz.ChannelMetrics.CallsSucceeded.Add(1) +} + +func (ac *addrConn) incrCallsFailed() { + ac.channelz.ChannelMetrics.CallsFailed.Add(1) } // ErrClientConnTimeout indicates that the ClientConn cannot establish the @@ -1834,22 +1676,19 @@ func (cc *ClientConn) connectionError() error { return cc.lastConnectionError } -// parseTargetAndFindResolver parses the user's dial target and stores the -// parsed target in `cc.parsedTarget`. +// initParsedTargetAndResolverBuilder parses the user's dial target and stores +// the parsed target in `cc.parsedTarget`. // // The resolver to use is determined based on the scheme in the parsed target // and the same is stored in `cc.resolverBuilder`. // // Doesn't grab cc.mu as this method is expected to be called only at Dial time. -func (cc *ClientConn) parseTargetAndFindResolver() error { - channelz.Infof(logger, cc.channelzID, "original dial target is: %q", cc.target) +func (cc *ClientConn) initParsedTargetAndResolverBuilder() error { + logger.Infof("original dial target is: %q", cc.target) var rb resolver.Builder parsedTarget, err := parseTarget(cc.target) - if err != nil { - channelz.Infof(logger, cc.channelzID, "dial target %q parse failed: %v", cc.target, err) - } else { - channelz.Infof(logger, cc.channelzID, "parsed dial target is: %+v", parsedTarget) + if err == nil { rb = cc.getResolver(parsedTarget.URL.Scheme) if rb != nil { cc.parsedTarget = parsedTarget @@ -1861,17 +1700,19 @@ func (cc *ClientConn) parseTargetAndFindResolver() error { // We are here because the user's dial target did not contain a scheme or // specified an unregistered scheme. We should fallback to the default // scheme, except when a custom dialer is specified in which case, we should - // always use passthrough scheme. - defScheme := resolver.GetDefaultScheme() - channelz.Infof(logger, cc.channelzID, "fallback to scheme %q", defScheme) + // always use passthrough scheme. For either case, we need to respect any overridden + // global defaults set by the user. + defScheme := cc.dopts.defaultScheme + if internal.UserSetDefaultScheme { + defScheme = resolver.GetDefaultScheme() + } + canonicalTarget := defScheme + ":///" + cc.target parsedTarget, err = parseTarget(canonicalTarget) if err != nil { - channelz.Infof(logger, cc.channelzID, "dial target %q parse failed: %v", canonicalTarget, err) return err } - channelz.Infof(logger, cc.channelzID, "parsed dial target is: %+v", parsedTarget) rb = cc.getResolver(parsedTarget.URL.Scheme) if rb == nil { return fmt.Errorf("could not get resolver for default scheme: %q", parsedTarget.URL.Scheme) @@ -1893,6 +1734,8 @@ func parseTarget(target string) (resolver.Target, error) { return resolver.Target{URL: *u}, nil } +// encodeAuthority escapes the authority string based on valid chars defined in +// https://datatracker.ietf.org/doc/html/rfc3986#section-3.2. func encodeAuthority(authority string) string { const upperhex = "0123456789ABCDEF" @@ -1909,7 +1752,7 @@ func encodeAuthority(authority string) string { return false case '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': // Subdelim characters return false - case ':', '[', ']', '@': // Authority related delimeters + case ':', '[', ']', '@': // Authority related delimiters return false } // Everything else must be escaped. @@ -1959,7 +1802,7 @@ func encodeAuthority(authority string) string { // credentials do not match the authority configured through the dial option. // // Doesn't grab cc.mu as this method is expected to be called only at Dial time. -func (cc *ClientConn) determineAuthority() error { +func (cc *ClientConn) initAuthority() error { dopts := cc.dopts // Historically, we had two options for users to specify the serverName or // authority for a channel. One was through the transport credentials @@ -1981,58 +1824,16 @@ func (cc *ClientConn) determineAuthority() error { } endpoint := cc.parsedTarget.Endpoint() - target := cc.target - switch { - case authorityFromDialOption != "": + if authorityFromDialOption != "" { cc.authority = authorityFromDialOption - case authorityFromCreds != "": + } else if authorityFromCreds != "" { cc.authority = authorityFromCreds - case strings.HasPrefix(target, "unix:") || strings.HasPrefix(target, "unix-abstract:"): - // TODO: remove when the unix resolver implements optional interface to - // return channel authority. - cc.authority = "localhost" - case strings.HasPrefix(endpoint, ":"): + } else if auth, ok := cc.resolverBuilder.(resolver.AuthorityOverrider); ok { + cc.authority = auth.OverrideAuthority(cc.parsedTarget) + } else if strings.HasPrefix(endpoint, ":") { cc.authority = "localhost" + endpoint - default: - // TODO: Define an optional interface on the resolver builder to return - // the channel authority given the user's dial target. For resolvers - // which don't implement this interface, we will use the endpoint from - // "scheme://authority/endpoint" as the default authority. - // Escape the endpoint to handle use cases where the endpoint - // might not be a valid authority by default. - // For example an endpoint which has multiple paths like - // 'a/b/c', which is not a valid authority by default. + } else { cc.authority = encodeAuthority(endpoint) } - channelz.Infof(logger, cc.channelzID, "Channel authority set to %q", cc.authority) - return nil -} - -// initResolverWrapper creates a ccResolverWrapper, which builds the name -// resolver. This method grabs the lock to assign the newly built resolver -// wrapper to the cc.resolverWrapper field. -func (cc *ClientConn) initResolverWrapper(creds credentials.TransportCredentials) error { - rw, err := newCCResolverWrapper(cc, ccResolverWrapperOpts{ - target: cc.parsedTarget, - builder: cc.resolverBuilder, - bOpts: resolver.BuildOptions{ - DisableServiceConfig: cc.dopts.disableServiceConfig, - DialCreds: creds, - CredsBundle: cc.dopts.copts.CredsBundle, - Dialer: cc.dopts.copts.Dialer, - }, - channelzID: cc.channelzID, - }) - if err != nil { - return fmt.Errorf("failed to build resolver: %v", err) - } - // Resolver implementations may report state update or error inline when - // built (or right after), and this is handled in cc.updateResolverState. - // Also, an error from the resolver might lead to a re-resolution request - // from the balancer, which is handled in resolveNow() where - // `cc.resolverWrapper` is accessed. Hence, we need to hold the lock here. - cc.mu.Lock() - cc.resolverWrapper = rw - cc.mu.Unlock() return nil } diff --git a/vendor/google.golang.org/grpc/codegen.sh b/vendor/google.golang.org/grpc/codegen.sh deleted file mode 100644 index 4cdc6ba7c..000000000 --- a/vendor/google.golang.org/grpc/codegen.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# This script serves as an example to demonstrate how to generate the gRPC-Go -# interface and the related messages from .proto file. -# -# It assumes the installation of i) Google proto buffer compiler at -# https://github.com/google/protobuf (after v2.6.1) and ii) the Go codegen -# plugin at https://github.com/golang/protobuf (after 2015-02-20). If you have -# not, please install them first. -# -# We recommend running this script at $GOPATH/src. -# -# If this is not what you need, feel free to make your own scripts. Again, this -# script is for demonstration purpose. -# -proto=$1 -protoc --go_out=plugins=grpc:. $proto diff --git a/vendor/google.golang.org/grpc/codes/codes.go b/vendor/google.golang.org/grpc/codes/codes.go index 11b106182..0b42c302b 100644 --- a/vendor/google.golang.org/grpc/codes/codes.go +++ b/vendor/google.golang.org/grpc/codes/codes.go @@ -25,7 +25,13 @@ import ( "strconv" ) -// A Code is an unsigned 32-bit error code as defined in the gRPC spec. +// A Code is a status code defined according to the [gRPC documentation]. +// +// Only the codes defined as consts in this package are valid codes. Do not use +// other code values. Behavior of other codes is implementation-specific and +// interoperability between implementations is not guaranteed. +// +// [gRPC documentation]: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md type Code uint32 const ( @@ -229,7 +235,7 @@ func (c *Code) UnmarshalJSON(b []byte) error { if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { if ci >= _maxCode { - return fmt.Errorf("invalid code: %q", ci) + return fmt.Errorf("invalid code: %d", ci) } *c = Code(ci) diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 5feac3aa0..665e790bb 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -28,9 +28,9 @@ import ( "fmt" "net" - "github.com/golang/protobuf/proto" "google.golang.org/grpc/attributes" icredentials "google.golang.org/grpc/internal/credentials" + "google.golang.org/protobuf/proto" ) // PerRPCCredentials defines the common interface for the credentials which need to @@ -237,7 +237,7 @@ func ClientHandshakeInfoFromContext(ctx context.Context) ClientHandshakeInfo { } // CheckSecurityLevel checks if a connection's security level is greater than or equal to the specified one. -// It returns success if 1) the condition is satisified or 2) AuthInfo struct does not implement GetCommonAuthInfo() method +// It returns success if 1) the condition is satisfied or 2) AuthInfo struct does not implement GetCommonAuthInfo() method // or 3) CommonAuthInfo.SecurityLevel has an invalid zero value. For 2) and 3), it is for the purpose of backward-compatibility. // // This API is experimental. diff --git a/vendor/google.golang.org/grpc/credentials/tls.go b/vendor/google.golang.org/grpc/credentials/tls.go index 877b7cd21..411435854 100644 --- a/vendor/google.golang.org/grpc/credentials/tls.go +++ b/vendor/google.golang.org/grpc/credentials/tls.go @@ -27,9 +27,13 @@ import ( "net/url" "os" + "google.golang.org/grpc/grpclog" credinternal "google.golang.org/grpc/internal/credentials" + "google.golang.org/grpc/internal/envconfig" ) +var logger = grpclog.Component("credentials") + // TLSInfo contains the auth information for a TLS authenticated connection. // It implements the AuthInfo interface. type TLSInfo struct { @@ -44,10 +48,25 @@ func (t TLSInfo) AuthType() string { return "tls" } +// cipherSuiteLookup returns the string version of a TLS cipher suite ID. +func cipherSuiteLookup(cipherSuiteID uint16) string { + for _, s := range tls.CipherSuites() { + if s.ID == cipherSuiteID { + return s.Name + } + } + for _, s := range tls.InsecureCipherSuites() { + if s.ID == cipherSuiteID { + return s.Name + } + } + return fmt.Sprintf("unknown ID: %v", cipherSuiteID) +} + // GetSecurityValue returns security info requested by channelz. func (t TLSInfo) GetSecurityValue() ChannelzSecurityValue { v := &TLSChannelzSecurityValue{ - StandardName: cipherSuiteLookup[t.State.CipherSuite], + StandardName: cipherSuiteLookup(t.State.CipherSuite), } // Currently there's no way to get LocalCertificate info from tls package. if len(t.State.PeerCertificates) > 0 { @@ -97,6 +116,22 @@ func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawCon conn.Close() return nil, nil, ctx.Err() } + + // The negotiated protocol can be either of the following: + // 1. h2: When the server supports ALPN. Only HTTP/2 can be negotiated since + // it is the only protocol advertised by the client during the handshake. + // The tls library ensures that the server chooses a protocol advertised + // by the client. + // 2. "" (empty string): If the server doesn't support ALPN. ALPN is a requirement + // for using HTTP/2 over TLS. We can terminate the connection immediately. + np := conn.ConnectionState().NegotiatedProtocol + if np == "" { + if envconfig.EnforceALPNEnabled { + conn.Close() + return nil, nil, fmt.Errorf("credentials: cannot check peer: missing selected ALPN property") + } + logger.Warningf("Allowing TLS connection to server %q with ALPN disabled. TLS connections to servers with ALPN disabled will be disallowed in future grpc-go releases", cfg.ServerName) + } tlsInfo := TLSInfo{ State: conn.ConnectionState(), CommonAuthInfo: CommonAuthInfo{ @@ -116,8 +151,20 @@ func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) conn.Close() return nil, nil, err } + cs := conn.ConnectionState() + // The negotiated application protocol can be empty only if the client doesn't + // support ALPN. In such cases, we can close the connection since ALPN is required + // for using HTTP/2 over TLS. + if cs.NegotiatedProtocol == "" { + if envconfig.EnforceALPNEnabled { + conn.Close() + return nil, nil, fmt.Errorf("credentials: cannot check peer: missing selected ALPN property") + } else if logger.V(2) { + logger.Info("Allowing TLS connection from client with ALPN disabled. TLS connections with ALPN disabled will be disallowed in future grpc-go releases") + } + } tlsInfo := TLSInfo{ - State: conn.ConnectionState(), + State: cs, CommonAuthInfo: CommonAuthInfo{ SecurityLevel: PrivacyAndIntegrity, }, @@ -138,10 +185,39 @@ func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { return nil } +// The following cipher suites are forbidden for use with HTTP/2 by +// https://datatracker.ietf.org/doc/html/rfc7540#appendix-A +var tls12ForbiddenCipherSuites = map[uint16]struct{}{ + tls.TLS_RSA_WITH_AES_128_CBC_SHA: {}, + tls.TLS_RSA_WITH_AES_256_CBC_SHA: {}, + tls.TLS_RSA_WITH_AES_128_GCM_SHA256: {}, + tls.TLS_RSA_WITH_AES_256_GCM_SHA384: {}, + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: {}, + tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: {}, + tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: {}, + tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: {}, +} + // NewTLS uses c to construct a TransportCredentials based on TLS. func NewTLS(c *tls.Config) TransportCredentials { tc := &tlsCreds{credinternal.CloneTLSConfig(c)} tc.config.NextProtos = credinternal.AppendH2ToNextProtos(tc.config.NextProtos) + // If the user did not configure a MinVersion and did not configure a + // MaxVersion < 1.2, use MinVersion=1.2, which is required by + // https://datatracker.ietf.org/doc/html/rfc7540#section-9.2 + if tc.config.MinVersion == 0 && (tc.config.MaxVersion == 0 || tc.config.MaxVersion >= tls.VersionTLS12) { + tc.config.MinVersion = tls.VersionTLS12 + } + // If the user did not configure CipherSuites, use all "secure" cipher + // suites reported by the TLS package, but remove some explicitly forbidden + // by https://datatracker.ietf.org/doc/html/rfc7540#appendix-A + if tc.config.CipherSuites == nil { + for _, cs := range tls.CipherSuites() { + if _, ok := tls12ForbiddenCipherSuites[cs.ID]; !ok { + tc.config.CipherSuites = append(tc.config.CipherSuites, cs.ID) + } + } + } return tc } @@ -205,32 +281,3 @@ type TLSChannelzSecurityValue struct { LocalCertificate []byte RemoteCertificate []byte } - -var cipherSuiteLookup = map[uint16]string{ - tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", - tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", - tls.TLS_RSA_WITH_AES_128_CBC_SHA: "TLS_RSA_WITH_AES_128_CBC_SHA", - tls.TLS_RSA_WITH_AES_256_CBC_SHA: "TLS_RSA_WITH_AES_256_CBC_SHA", - tls.TLS_RSA_WITH_AES_128_GCM_SHA256: "TLS_RSA_WITH_AES_128_GCM_SHA256", - tls.TLS_RSA_WITH_AES_256_GCM_SHA384: "TLS_RSA_WITH_AES_256_GCM_SHA384", - tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", - tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: "TLS_ECDHE_RSA_WITH_RC4_128_SHA", - tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", - tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", - tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", - tls.TLS_FALLBACK_SCSV: "TLS_FALLBACK_SCSV", - tls.TLS_RSA_WITH_AES_128_CBC_SHA256: "TLS_RSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305: "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", - tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305: "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", - tls.TLS_AES_128_GCM_SHA256: "TLS_AES_128_GCM_SHA256", - tls.TLS_AES_256_GCM_SHA384: "TLS_AES_256_GCM_SHA384", - tls.TLS_CHACHA20_POLY1305_SHA256: "TLS_CHACHA20_POLY1305_SHA256", -} diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index cfc9fd85e..f5453d48a 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -21,6 +21,7 @@ package grpc import ( "context" "net" + "net/url" "time" "google.golang.org/grpc/backoff" @@ -36,6 +37,11 @@ import ( "google.golang.org/grpc/stats" ) +const ( + // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#limits-on-retries-and-hedges + defaultMaxCallAttempts = 5 +) + func init() { internal.AddGlobalDialOptions = func(opt ...DialOption) { globalDialOptions = append(globalDialOptions, opt...) @@ -43,9 +49,18 @@ func init() { internal.ClearGlobalDialOptions = func() { globalDialOptions = nil } + internal.AddGlobalPerTargetDialOptions = func(opt any) { + if ptdo, ok := opt.(perTargetDialOption); ok { + globalPerTargetDialOptions = append(globalPerTargetDialOptions, ptdo) + } + } + internal.ClearGlobalPerTargetDialOptions = func() { + globalPerTargetDialOptions = nil + } internal.WithBinaryLogger = withBinaryLogger internal.JoinDialOptions = newJoinDialOption internal.DisableGlobalDialOptions = newDisableGlobalDialOptions + internal.WithRecvBufferPool = withRecvBufferPool } // dialOptions configure a Dial call. dialOptions are set by the DialOption @@ -63,12 +78,11 @@ type dialOptions struct { block bool returnLastError bool timeout time.Duration - scChan <-chan ServiceConfig authority string binaryLogger binarylog.Logger copts transport.ConnectOptions callOptions []CallOption - channelzParentID *channelz.Identifier + channelzParent channelz.Identifier disableServiceConfig bool disableRetry bool disableHealthCheck bool @@ -79,6 +93,8 @@ type dialOptions struct { resolvers []resolver.Builder idleTimeout time.Duration recvBufferPool SharedBufferPool + defaultScheme string + maxCallAttempts int } // DialOption configures how we set up the connection. @@ -88,6 +104,19 @@ type DialOption interface { var globalDialOptions []DialOption +// perTargetDialOption takes a parsed target and returns a dial option to apply. +// +// This gets called after NewClient() parses the target, and allows per target +// configuration set through a returned DialOption. The DialOption will not take +// effect if specifies a resolver builder, as that Dial Option is factored in +// while parsing target. +type perTargetDialOption interface { + // DialOption returns a Dial Option to apply. + DialOptionForTarget(parsedTarget url.URL) DialOption +} + +var globalPerTargetDialOptions []perTargetDialOption + // EmptyDialOption does not alter the dial configuration. It can be embedded in // another structure to build custom dial options. // @@ -154,9 +183,7 @@ func WithSharedWriteBuffer(val bool) DialOption { } // WithWriteBufferSize determines how much data can be batched before doing a -// write on the wire. The corresponding memory allocation for this buffer will -// be twice the size to keep syscalls low. The default value for this buffer is -// 32KB. +// write on the wire. The default value for this buffer is 32KB. // // Zero or negative values will disable the write buffer such that each write // will be on underlying connection. Note: A Send call may not directly @@ -250,19 +277,6 @@ func WithDecompressor(dc Decompressor) DialOption { }) } -// WithServiceConfig returns a DialOption which has a channel to read the -// service configuration. -// -// Deprecated: service config should be received through name resolver or via -// WithDefaultServiceConfig, as specified at -// https://github.com/grpc/grpc/blob/master/doc/service_config.md. Will be -// removed in a future 1.x release. -func WithServiceConfig(c <-chan ServiceConfig) DialOption { - return newFuncDialOption(func(o *dialOptions) { - o.scChan = c - }) -} - // WithConnectParams configures the ClientConn to use the provided ConnectParams // for creating and maintaining connections to servers. // @@ -314,6 +328,9 @@ func withBackoff(bs internalbackoff.Strategy) DialOption { // // Use of this feature is not recommended. For more information, please see: // https://github.com/grpc/grpc-go/blob/master/Documentation/anti-patterns.md +// +// Deprecated: this DialOption is not supported by NewClient. +// Will be supported throughout 1.x. func WithBlock() DialOption { return newFuncDialOption(func(o *dialOptions) { o.block = true @@ -328,10 +345,8 @@ func WithBlock() DialOption { // Use of this feature is not recommended. For more information, please see: // https://github.com/grpc/grpc-go/blob/master/Documentation/anti-patterns.md // -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. +// Deprecated: this DialOption is not supported by NewClient. +// Will be supported throughout 1.x. func WithReturnConnectionError() DialOption { return newFuncDialOption(func(o *dialOptions) { o.block = true @@ -401,8 +416,8 @@ func WithCredentialsBundle(b credentials.Bundle) DialOption { // WithTimeout returns a DialOption that configures a timeout for dialing a // ClientConn initially. This is valid if and only if WithBlock() is present. // -// Deprecated: use DialContext instead of Dial and context.WithTimeout -// instead. Will be supported throughout 1.x. +// Deprecated: this DialOption is not supported by NewClient. +// Will be supported throughout 1.x. func WithTimeout(d time.Duration) DialOption { return newFuncDialOption(func(o *dialOptions) { o.timeout = d @@ -413,6 +428,17 @@ func WithTimeout(d time.Duration) DialOption { // connections. If FailOnNonTempDialError() is set to true, and an error is // returned by f, gRPC checks the error's Temporary() method to decide if it // should try to reconnect to the network address. +// +// Note: All supported releases of Go (as of December 2023) override the OS +// defaults for TCP keepalive time and interval to 15s. To enable TCP keepalive +// with OS defaults for keepalive time and interval, use a net.Dialer that sets +// the KeepAlive field to a negative value, and sets the SO_KEEPALIVE socket +// option to true from the Control field. For a concrete example of how to do +// this, see internal.NetDialerWithTCPKeepalive(). +// +// For more information, please see [issue 23459] in the Go github repo. +// +// [issue 23459]: https://github.com/golang/go/issues/23459 func WithContextDialer(f func(context.Context, string) (net.Conn, error)) DialOption { return newFuncDialOption(func(o *dialOptions) { o.copts.Dialer = f @@ -473,9 +499,8 @@ func withBinaryLogger(bl binarylog.Logger) DialOption { // Use of this feature is not recommended. For more information, please see: // https://github.com/grpc/grpc-go/blob/master/Documentation/anti-patterns.md // -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// Deprecated: this DialOption is not supported by NewClient. +// This API may be changed or removed in a // later release. func FailOnNonTempDialError(f bool) DialOption { return newFuncDialOption(func(o *dialOptions) { @@ -487,7 +512,7 @@ func FailOnNonTempDialError(f bool) DialOption { // the RPCs. func WithUserAgent(s string) DialOption { return newFuncDialOption(func(o *dialOptions) { - o.copts.UserAgent = s + o.copts.UserAgent = s + " " + grpcUA }) } @@ -557,9 +582,9 @@ func WithAuthority(a string) DialOption { // // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. -func WithChannelzParentID(id *channelz.Identifier) DialOption { +func WithChannelzParentID(c channelz.Identifier) DialOption { return newFuncDialOption(func(o *dialOptions) { - o.channelzParentID = id + o.channelzParent = c }) } @@ -604,12 +629,22 @@ func WithDisableRetry() DialOption { }) } +// MaxHeaderListSizeDialOption is a DialOption that specifies the maximum +// (uncompressed) size of header list that the client is prepared to accept. +type MaxHeaderListSizeDialOption struct { + MaxHeaderListSize uint32 +} + +func (o MaxHeaderListSizeDialOption) apply(do *dialOptions) { + do.copts.MaxHeaderListSize = &o.MaxHeaderListSize +} + // WithMaxHeaderListSize returns a DialOption that specifies the maximum // (uncompressed) size of header list that the client is prepared to accept. func WithMaxHeaderListSize(s uint32) DialOption { - return newFuncDialOption(func(o *dialOptions) { - o.copts.MaxHeaderListSize = &s - }) + return MaxHeaderListSizeDialOption{ + MaxHeaderListSize: s, + } } // WithDisableHealthCheck disables the LB channel health checking for all @@ -637,18 +672,22 @@ func withHealthCheckFunc(f internal.HealthChecker) DialOption { func defaultDialOptions() dialOptions { return dialOptions{ - healthCheckFunc: internal.HealthCheckFunc, copts: transport.ConnectOptions{ - WriteBufferSize: defaultWriteBufSize, ReadBufferSize: defaultReadBufSize, + WriteBufferSize: defaultWriteBufSize, UseProxy: true, + UserAgent: grpcUA, }, - recvBufferPool: nopBufferPool{}, - idleTimeout: 30 * time.Minute, + bs: internalbackoff.DefaultExponential, + healthCheckFunc: internal.HealthCheckFunc, + idleTimeout: 30 * time.Minute, + recvBufferPool: nopBufferPool{}, + defaultScheme: "dns", + maxCallAttempts: defaultMaxCallAttempts, } } -// withGetMinConnectDeadline specifies the function that clientconn uses to +// withMinConnectDeadline specifies the function that clientconn uses to // get minConnectDeadline. This can be used to make connection attempts happen // faster/slower. // @@ -659,6 +698,14 @@ func withMinConnectDeadline(f func() time.Duration) DialOption { }) } +// withDefaultScheme is used to allow Dial to use "passthrough" as the default +// name resolver, while NewClient uses "dns" otherwise. +func withDefaultScheme(s string) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.defaultScheme = s + }) +} + // WithResolvers allows a list of resolver implementations to be registered // locally with the ClientConn without needing to be globally registered via // resolver.Register. They will be matched against the scheme used for the @@ -694,6 +741,23 @@ func WithIdleTimeout(d time.Duration) DialOption { }) } +// WithMaxCallAttempts returns a DialOption that configures the maximum number +// of attempts per call (including retries and hedging) using the channel. +// Service owners may specify a higher value for these parameters, but higher +// values will be treated as equal to the maximum value by the client +// implementation. This mitigates security concerns related to the service +// config being transferred to the client via DNS. +// +// A value of 5 will be used if this dial option is not set or n < 2. +func WithMaxCallAttempts(n int) DialOption { + return newFuncDialOption(func(o *dialOptions) { + if n < 2 { + n = defaultMaxCallAttempts + } + o.maxCallAttempts = n + }) +} + // WithRecvBufferPool returns a DialOption that configures the ClientConn // to use the provided shared buffer pool for parsing incoming messages. Depending // on the application's workload, this could result in reduced memory allocation. @@ -705,11 +769,13 @@ func WithIdleTimeout(d time.Duration) DialOption { // options are used: WithStatsHandler, EnableTracing, or binary logging. In such // cases, the shared buffer pool will be ignored. // -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. +// Deprecated: use experimental.WithRecvBufferPool instead. Will be deleted in +// v1.60.0 or later. func WithRecvBufferPool(bufferPool SharedBufferPool) DialOption { + return withRecvBufferPool(bufferPool) +} + +func withRecvBufferPool(bufferPool SharedBufferPool) DialOption { return newFuncDialOption(func(o *dialOptions) { o.recvBufferPool = bufferPool }) diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto.go b/vendor/google.golang.org/grpc/encoding/proto/proto.go index 0ee3d3bae..66d5cdf03 100644 --- a/vendor/google.golang.org/grpc/encoding/proto/proto.go +++ b/vendor/google.golang.org/grpc/encoding/proto/proto.go @@ -23,8 +23,9 @@ package proto import ( "fmt" - "github.com/golang/protobuf/proto" "google.golang.org/grpc/encoding" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" ) // Name is the name registered for the proto compressor. @@ -38,21 +39,34 @@ func init() { type codec struct{} func (codec) Marshal(v any) ([]byte, error) { - vv, ok := v.(proto.Message) - if !ok { + vv := messageV2Of(v) + if vv == nil { return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) } + return proto.Marshal(vv) } func (codec) Unmarshal(data []byte, v any) error { - vv, ok := v.(proto.Message) - if !ok { + vv := messageV2Of(v) + if vv == nil { return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) } + return proto.Unmarshal(data, vv) } +func messageV2Of(v any) proto.Message { + switch v := v.(type) { + case protoadapt.MessageV1: + return protoadapt.MessageV2Of(v) + case protoadapt.MessageV2: + return v + } + + return nil +} + func (codec) Name() string { return Name } diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go index 24299efd6..38b883507 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -17,8 +17,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.22.0 +// protoc-gen-go v1.34.1 +// protoc v4.25.2 // source: grpc/health/v1/health.proto package grpc_health_v1 diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go index 4439cda0f..51b736ba0 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go @@ -17,8 +17,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.22.0 +// - protoc-gen-go-grpc v1.4.0 +// - protoc v4.25.2 // source: grpc/health/v1/health.proto package grpc_health_v1 @@ -32,8 +32,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 const ( Health_Check_FullMethodName = "/grpc.health.v1.Health/Check" @@ -43,6 +43,10 @@ const ( // HealthClient is the client API for Health service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Health is gRPC's mechanism for checking whether a server is able to handle +// RPCs. Its semantics are documented in +// https://github.com/grpc/grpc/blob/master/doc/health-checking.md. type HealthClient interface { // Check gets the health of the specified service. If the requested service // is unknown, the call will fail with status NOT_FOUND. If the caller does @@ -81,8 +85,9 @@ func NewHealthClient(cc grpc.ClientConnInterface) HealthClient { } func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(HealthCheckResponse) - err := c.cc.Invoke(ctx, Health_Check_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Health_Check_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -90,11 +95,12 @@ func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts . } func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) { - stream, err := c.cc.NewStream(ctx, &Health_ServiceDesc.Streams[0], Health_Watch_FullMethodName, opts...) + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Health_ServiceDesc.Streams[0], Health_Watch_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &healthWatchClient{stream} + x := &healthWatchClient{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -124,6 +130,10 @@ func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) { // HealthServer is the server API for Health service. // All implementations should embed UnimplementedHealthServer // for forward compatibility +// +// Health is gRPC's mechanism for checking whether a server is able to handle +// RPCs. Its semantics are documented in +// https://github.com/grpc/grpc/blob/master/doc/health-checking.md. type HealthServer interface { // Check gets the health of the specified service. If the requested service // is unknown, the call will fail with status NOT_FOUND. If the caller does @@ -198,7 +208,7 @@ func _Health_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(HealthServer).Watch(m, &healthWatchServer{stream}) + return srv.(HealthServer).Watch(m, &healthWatchServer{ServerStream: stream}) } type Health_WatchServer interface { diff --git a/vendor/google.golang.org/grpc/internal/backoff/backoff.go b/vendor/google.golang.org/grpc/internal/backoff/backoff.go index fed1c011a..b15cf482d 100644 --- a/vendor/google.golang.org/grpc/internal/backoff/backoff.go +++ b/vendor/google.golang.org/grpc/internal/backoff/backoff.go @@ -25,10 +25,10 @@ package backoff import ( "context" "errors" + "math/rand" "time" grpcbackoff "google.golang.org/grpc/backoff" - "google.golang.org/grpc/internal/grpcrand" ) // Strategy defines the methodology for backing off after a grpc connection @@ -67,7 +67,7 @@ func (bc Exponential) Backoff(retries int) time.Duration { } // Randomize backoff delays so that if a cluster of requests start at // the same time, they won't operate in lockstep. - backoff *= 1 + bc.Config.Jitter*(grpcrand.Float64()*2-1) + backoff *= 1 + bc.Config.Jitter*(rand.Float64()*2-1) if backoff < 0 { return 0 } diff --git a/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/config.go b/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/config.go new file mode 100644 index 000000000..13821a926 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/config.go @@ -0,0 +1,82 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package gracefulswitch + +import ( + "encoding/json" + "fmt" + + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/serviceconfig" +) + +type lbConfig struct { + serviceconfig.LoadBalancingConfig + + childBuilder balancer.Builder + childConfig serviceconfig.LoadBalancingConfig +} + +func ChildName(l serviceconfig.LoadBalancingConfig) string { + return l.(*lbConfig).childBuilder.Name() +} + +// ParseConfig parses a child config list and returns a LB config for the +// gracefulswitch Balancer. +// +// cfg is expected to be a json.RawMessage containing a JSON array of LB policy +// names + configs as the format of the "loadBalancingConfig" field in +// ServiceConfig. It returns a type that should be passed to +// UpdateClientConnState in the BalancerConfig field. +func ParseConfig(cfg json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { + var lbCfg []map[string]json.RawMessage + if err := json.Unmarshal(cfg, &lbCfg); err != nil { + return nil, err + } + for i, e := range lbCfg { + if len(e) != 1 { + return nil, fmt.Errorf("expected a JSON struct with one entry; received entry %v at index %d", e, i) + } + + var name string + var jsonCfg json.RawMessage + for name, jsonCfg = range e { + } + + builder := balancer.Get(name) + if builder == nil { + // Skip unregistered balancer names. + continue + } + + parser, ok := builder.(balancer.ConfigParser) + if !ok { + // This is a valid child with no config. + return &lbConfig{childBuilder: builder}, nil + } + + cfg, err := parser.ParseConfig(jsonCfg) + if err != nil { + return nil, fmt.Errorf("error parsing config for policy %q: %v", name, err) + } + return &lbConfig{childBuilder: builder, childConfig: cfg}, nil + } + + return nil, fmt.Errorf("no supported policies found in config: %v", string(cfg)) +} diff --git a/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go b/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go index 3c594e6e4..73bb4c4ee 100644 --- a/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go +++ b/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go @@ -94,14 +94,23 @@ func (gsb *Balancer) balancerCurrentOrPending(bw *balancerWrapper) bool { // process is not complete when this method returns. This method must be called // synchronously alongside the rest of the balancer.Balancer methods this // Graceful Switch Balancer implements. +// +// Deprecated: use ParseConfig and pass a parsed config to UpdateClientConnState +// to cause the Balancer to automatically change to the new child when necessary. func (gsb *Balancer) SwitchTo(builder balancer.Builder) error { + _, err := gsb.switchTo(builder) + return err +} + +func (gsb *Balancer) switchTo(builder balancer.Builder) (*balancerWrapper, error) { gsb.mu.Lock() if gsb.closed { gsb.mu.Unlock() - return errBalancerClosed + return nil, errBalancerClosed } bw := &balancerWrapper{ - gsb: gsb, + builder: builder, + gsb: gsb, lastState: balancer.State{ ConnectivityState: connectivity.Connecting, Picker: base.NewErrPicker(balancer.ErrNoSubConnAvailable), @@ -129,7 +138,7 @@ func (gsb *Balancer) SwitchTo(builder balancer.Builder) error { gsb.balancerCurrent = nil } gsb.mu.Unlock() - return balancer.ErrBadResolverState + return nil, balancer.ErrBadResolverState } // This write doesn't need to take gsb.mu because this field never gets read @@ -138,7 +147,7 @@ func (gsb *Balancer) SwitchTo(builder balancer.Builder) error { // bw.Balancer field will never be forwarded to until this SwitchTo() // function returns. bw.Balancer = newBalancer - return nil + return bw, nil } // Returns nil if the graceful switch balancer is closed. @@ -152,12 +161,32 @@ func (gsb *Balancer) latestBalancer() *balancerWrapper { } // UpdateClientConnState forwards the update to the latest balancer created. +// +// If the state's BalancerConfig is the config returned by a call to +// gracefulswitch.ParseConfig, then this function will automatically SwitchTo +// the balancer indicated by the config before forwarding its config to it, if +// necessary. func (gsb *Balancer) UpdateClientConnState(state balancer.ClientConnState) error { // The resolver data is only relevant to the most recent LB Policy. balToUpdate := gsb.latestBalancer() + gsbCfg, ok := state.BalancerConfig.(*lbConfig) + if ok { + // Switch to the child in the config unless it is already active. + if balToUpdate == nil || gsbCfg.childBuilder.Name() != balToUpdate.builder.Name() { + var err error + balToUpdate, err = gsb.switchTo(gsbCfg.childBuilder) + if err != nil { + return fmt.Errorf("could not switch to new child balancer: %w", err) + } + } + // Unwrap the child balancer's config. + state.BalancerConfig = gsbCfg.childConfig + } + if balToUpdate == nil { return errBalancerClosed } + // Perform this call without gsb.mu to prevent deadlocks if the child calls // back into the channel. The latest balancer can never be closed during a // call from the channel, even without gsb.mu held. @@ -169,6 +198,10 @@ func (gsb *Balancer) ResolverError(err error) { // The resolver data is only relevant to the most recent LB Policy. balToUpdate := gsb.latestBalancer() if balToUpdate == nil { + gsb.cc.UpdateState(balancer.State{ + ConnectivityState: connectivity.TransientFailure, + Picker: base.NewErrPicker(err), + }) return } // Perform this call without gsb.mu to prevent deadlocks if the child calls @@ -261,7 +294,8 @@ func (gsb *Balancer) Close() { // graceful switch logic. type balancerWrapper struct { balancer.Balancer - gsb *Balancer + gsb *Balancer + builder balancer.Builder lastState balancer.State subconns map[balancer.SubConn]bool // subconns created by this balancer diff --git a/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go b/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go index 0f31274a3..aa4505a87 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go @@ -25,11 +25,12 @@ import ( "sync/atomic" "time" - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/timestamppb" ) type callIDGenerator struct { @@ -64,7 +65,7 @@ type TruncatingMethodLogger struct { callID uint64 idWithinCallGen *callIDGenerator - sink Sink // TODO(blog): make this plugable. + sink Sink // TODO(blog): make this pluggable. } // NewTruncatingMethodLogger returns a new truncating method logger. @@ -79,7 +80,7 @@ func NewTruncatingMethodLogger(h, m uint64) *TruncatingMethodLogger { callID: idGen.next(), idWithinCallGen: &callIDGenerator{}, - sink: DefaultSink, // TODO(blog): make it plugable. + sink: DefaultSink, // TODO(blog): make it pluggable. } } @@ -88,7 +89,7 @@ func NewTruncatingMethodLogger(h, m uint64) *TruncatingMethodLogger { // in TruncatingMethodLogger as possible. func (ml *TruncatingMethodLogger) Build(c LogEntryConfig) *binlogpb.GrpcLogEntry { m := c.toProto() - timestamp, _ := ptypes.TimestampProto(time.Now()) + timestamp := timestamppb.Now() m.Timestamp = timestamp m.CallId = ml.callID m.SequenceIdWithinCall = ml.idWithinCallGen.next() @@ -178,7 +179,7 @@ func (c *ClientHeader) toProto() *binlogpb.GrpcLogEntry { Authority: c.Authority, } if c.Timeout > 0 { - clientHeader.Timeout = ptypes.DurationProto(c.Timeout) + clientHeader.Timeout = durationpb.New(c.Timeout) } ret := &binlogpb.GrpcLogEntry{ Type: binlogpb.GrpcLogEntry_EVENT_TYPE_CLIENT_HEADER, @@ -396,7 +397,7 @@ func metadataKeyOmit(key string) bool { switch key { case "lb-token", ":path", ":authority", "content-encoding", "content-type", "user-agent", "te": return true - case "grpc-trace-bin": // grpc-trace-bin is special because it's visiable to users. + case "grpc-trace-bin": // grpc-trace-bin is special because it's visible to users. return false } return strings.HasPrefix(key, "grpc-") diff --git a/vendor/google.golang.org/grpc/internal/binarylog/sink.go b/vendor/google.golang.org/grpc/internal/binarylog/sink.go index 264de387c..9ea598b14 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/sink.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/sink.go @@ -25,8 +25,8 @@ import ( "sync" "time" - "github.com/golang/protobuf/proto" binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" + "google.golang.org/protobuf/proto" ) var ( diff --git a/vendor/google.golang.org/grpc/internal/buffer/unbounded.go b/vendor/google.golang.org/grpc/internal/buffer/unbounded.go index 4399c3df4..11f91668a 100644 --- a/vendor/google.golang.org/grpc/internal/buffer/unbounded.go +++ b/vendor/google.golang.org/grpc/internal/buffer/unbounded.go @@ -18,7 +18,10 @@ // Package buffer provides an implementation of an unbounded buffer. package buffer -import "sync" +import ( + "errors" + "sync" +) // Unbounded is an implementation of an unbounded buffer which does not use // extra goroutines. This is typically used for passing updates from one entity @@ -36,6 +39,7 @@ import "sync" type Unbounded struct { c chan any closed bool + closing bool mu sync.Mutex backlog []any } @@ -45,32 +49,32 @@ func NewUnbounded() *Unbounded { return &Unbounded{c: make(chan any, 1)} } +var errBufferClosed = errors.New("Put called on closed buffer.Unbounded") + // Put adds t to the unbounded buffer. -func (b *Unbounded) Put(t any) { +func (b *Unbounded) Put(t any) error { b.mu.Lock() defer b.mu.Unlock() - if b.closed { - return + if b.closing { + return errBufferClosed } if len(b.backlog) == 0 { select { case b.c <- t: - return + return nil default: } } b.backlog = append(b.backlog, t) + return nil } -// Load sends the earliest buffered data, if any, onto the read channel -// returned by Get(). Users are expected to call this every time they read a +// Load sends the earliest buffered data, if any, onto the read channel returned +// by Get(). Users are expected to call this every time they successfully read a // value from the read channel. func (b *Unbounded) Load() { b.mu.Lock() defer b.mu.Unlock() - if b.closed { - return - } if len(b.backlog) > 0 { select { case b.c <- b.backlog[0]: @@ -78,6 +82,8 @@ func (b *Unbounded) Load() { b.backlog = b.backlog[1:] default: } + } else if b.closing && !b.closed { + close(b.c) } } @@ -88,18 +94,23 @@ func (b *Unbounded) Load() { // send the next buffered value onto the channel if there is any. // // If the unbounded buffer is closed, the read channel returned by this method -// is closed. +// is closed after all data is drained. func (b *Unbounded) Get() <-chan any { return b.c } -// Close closes the unbounded buffer. +// Close closes the unbounded buffer. No subsequent data may be Put(), and the +// channel returned from Get() will be closed after all the data is read and +// Load() is called for the final time. func (b *Unbounded) Close() { b.mu.Lock() defer b.mu.Unlock() - if b.closed { + if b.closing { return } - b.closed = true - close(b.c) + b.closing = true + if len(b.backlog) == 0 { + b.closed = true + close(b.c) + } } diff --git a/vendor/google.golang.org/grpc/internal/channelz/channel.go b/vendor/google.golang.org/grpc/internal/channelz/channel.go new file mode 100644 index 000000000..d7e9e1d54 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/channel.go @@ -0,0 +1,255 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "fmt" + "sync/atomic" + + "google.golang.org/grpc/connectivity" +) + +// Channel represents a channel within channelz, which includes metrics and +// internal channelz data, such as channelz id, child list, etc. +type Channel struct { + Entity + // ID is the channelz id of this channel. + ID int64 + // RefName is the human readable reference string of this channel. + RefName string + + closeCalled bool + nestedChans map[int64]string + subChans map[int64]string + Parent *Channel + trace *ChannelTrace + // traceRefCount is the number of trace events that reference this channel. + // Non-zero traceRefCount means the trace of this channel cannot be deleted. + traceRefCount int32 + + ChannelMetrics ChannelMetrics +} + +// Implemented to make Channel implement the Identifier interface used for +// nesting. +func (c *Channel) channelzIdentifier() {} + +func (c *Channel) String() string { + if c.Parent == nil { + return fmt.Sprintf("Channel #%d", c.ID) + } + return fmt.Sprintf("%s Channel #%d", c.Parent, c.ID) +} + +func (c *Channel) id() int64 { + return c.ID +} + +func (c *Channel) SubChans() map[int64]string { + db.mu.RLock() + defer db.mu.RUnlock() + return copyMap(c.subChans) +} + +func (c *Channel) NestedChans() map[int64]string { + db.mu.RLock() + defer db.mu.RUnlock() + return copyMap(c.nestedChans) +} + +func (c *Channel) Trace() *ChannelTrace { + db.mu.RLock() + defer db.mu.RUnlock() + return c.trace.copy() +} + +type ChannelMetrics struct { + // The current connectivity state of the channel. + State atomic.Pointer[connectivity.State] + // The target this channel originally tried to connect to. May be absent + Target atomic.Pointer[string] + // The number of calls started on the channel. + CallsStarted atomic.Int64 + // The number of calls that have completed with an OK status. + CallsSucceeded atomic.Int64 + // The number of calls that have a completed with a non-OK status. + CallsFailed atomic.Int64 + // The last time a call was started on the channel. + LastCallStartedTimestamp atomic.Int64 +} + +// CopyFrom copies the metrics in o to c. For testing only. +func (c *ChannelMetrics) CopyFrom(o *ChannelMetrics) { + c.State.Store(o.State.Load()) + c.Target.Store(o.Target.Load()) + c.CallsStarted.Store(o.CallsStarted.Load()) + c.CallsSucceeded.Store(o.CallsSucceeded.Load()) + c.CallsFailed.Store(o.CallsFailed.Load()) + c.LastCallStartedTimestamp.Store(o.LastCallStartedTimestamp.Load()) +} + +// Equal returns true iff the metrics of c are the same as the metrics of o. +// For testing only. +func (c *ChannelMetrics) Equal(o any) bool { + oc, ok := o.(*ChannelMetrics) + if !ok { + return false + } + if (c.State.Load() == nil) != (oc.State.Load() == nil) { + return false + } + if c.State.Load() != nil && *c.State.Load() != *oc.State.Load() { + return false + } + if (c.Target.Load() == nil) != (oc.Target.Load() == nil) { + return false + } + if c.Target.Load() != nil && *c.Target.Load() != *oc.Target.Load() { + return false + } + return c.CallsStarted.Load() == oc.CallsStarted.Load() && + c.CallsFailed.Load() == oc.CallsFailed.Load() && + c.CallsSucceeded.Load() == oc.CallsSucceeded.Load() && + c.LastCallStartedTimestamp.Load() == oc.LastCallStartedTimestamp.Load() +} + +func strFromPointer(s *string) string { + if s == nil { + return "" + } + return *s +} + +func (c *ChannelMetrics) String() string { + return fmt.Sprintf("State: %v, Target: %s, CallsStarted: %v, CallsSucceeded: %v, CallsFailed: %v, LastCallStartedTimestamp: %v", + c.State.Load(), strFromPointer(c.Target.Load()), c.CallsStarted.Load(), c.CallsSucceeded.Load(), c.CallsFailed.Load(), c.LastCallStartedTimestamp.Load(), + ) +} + +func NewChannelMetricForTesting(state connectivity.State, target string, started, succeeded, failed, timestamp int64) *ChannelMetrics { + c := &ChannelMetrics{} + c.State.Store(&state) + c.Target.Store(&target) + c.CallsStarted.Store(started) + c.CallsSucceeded.Store(succeeded) + c.CallsFailed.Store(failed) + c.LastCallStartedTimestamp.Store(timestamp) + return c +} + +func (c *Channel) addChild(id int64, e entry) { + switch v := e.(type) { + case *SubChannel: + c.subChans[id] = v.RefName + case *Channel: + c.nestedChans[id] = v.RefName + default: + logger.Errorf("cannot add a child (id = %d) of type %T to a channel", id, e) + } +} + +func (c *Channel) deleteChild(id int64) { + delete(c.subChans, id) + delete(c.nestedChans, id) + c.deleteSelfIfReady() +} + +func (c *Channel) triggerDelete() { + c.closeCalled = true + c.deleteSelfIfReady() +} + +func (c *Channel) getParentID() int64 { + if c.Parent == nil { + return -1 + } + return c.Parent.ID +} + +// deleteSelfFromTree tries to delete the channel from the channelz entry relation tree, which means +// deleting the channel reference from its parent's child list. +// +// In order for a channel to be deleted from the tree, it must meet the criteria that, removal of the +// corresponding grpc object has been invoked, and the channel does not have any children left. +// +// The returned boolean value indicates whether the channel has been successfully deleted from tree. +func (c *Channel) deleteSelfFromTree() (deleted bool) { + if !c.closeCalled || len(c.subChans)+len(c.nestedChans) != 0 { + return false + } + // not top channel + if c.Parent != nil { + c.Parent.deleteChild(c.ID) + } + return true +} + +// deleteSelfFromMap checks whether it is valid to delete the channel from the map, which means +// deleting the channel from channelz's tracking entirely. Users can no longer use id to query the +// channel, and its memory will be garbage collected. +// +// The trace reference count of the channel must be 0 in order to be deleted from the map. This is +// specified in the channel tracing gRFC that as long as some other trace has reference to an entity, +// the trace of the referenced entity must not be deleted. In order to release the resource allocated +// by grpc, the reference to the grpc object is reset to a dummy object. +// +// deleteSelfFromMap must be called after deleteSelfFromTree returns true. +// +// It returns a bool to indicate whether the channel can be safely deleted from map. +func (c *Channel) deleteSelfFromMap() (delete bool) { + return c.getTraceRefCount() == 0 +} + +// deleteSelfIfReady tries to delete the channel itself from the channelz database. +// The delete process includes two steps: +// 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its +// parent's child list. +// 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id +// will return entry not found error. +func (c *Channel) deleteSelfIfReady() { + if !c.deleteSelfFromTree() { + return + } + if !c.deleteSelfFromMap() { + return + } + db.deleteEntry(c.ID) + c.trace.clear() +} + +func (c *Channel) getChannelTrace() *ChannelTrace { + return c.trace +} + +func (c *Channel) incrTraceRefCount() { + atomic.AddInt32(&c.traceRefCount, 1) +} + +func (c *Channel) decrTraceRefCount() { + atomic.AddInt32(&c.traceRefCount, -1) +} + +func (c *Channel) getTraceRefCount() int { + i := atomic.LoadInt32(&c.traceRefCount) + return int(i) +} + +func (c *Channel) getRefName() string { + return c.RefName +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/channelmap.go b/vendor/google.golang.org/grpc/internal/channelz/channelmap.go new file mode 100644 index 000000000..dfe18b089 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/channelmap.go @@ -0,0 +1,402 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "fmt" + "sort" + "sync" + "time" +) + +// entry represents a node in the channelz database. +type entry interface { + // addChild adds a child e, whose channelz id is id to child list + addChild(id int64, e entry) + // deleteChild deletes a child with channelz id to be id from child list + deleteChild(id int64) + // triggerDelete tries to delete self from channelz database. However, if + // child list is not empty, then deletion from the database is on hold until + // the last child is deleted from database. + triggerDelete() + // deleteSelfIfReady check whether triggerDelete() has been called before, + // and whether child list is now empty. If both conditions are met, then + // delete self from database. + deleteSelfIfReady() + // getParentID returns parent ID of the entry. 0 value parent ID means no parent. + getParentID() int64 + Entity +} + +// channelMap is the storage data structure for channelz. +// +// Methods of channelMap can be divided in two two categories with respect to +// locking. +// +// 1. Methods acquire the global lock. +// 2. Methods that can only be called when global lock is held. +// +// A second type of method need always to be called inside a first type of method. +type channelMap struct { + mu sync.RWMutex + topLevelChannels map[int64]struct{} + channels map[int64]*Channel + subChannels map[int64]*SubChannel + sockets map[int64]*Socket + servers map[int64]*Server +} + +func newChannelMap() *channelMap { + return &channelMap{ + topLevelChannels: make(map[int64]struct{}), + channels: make(map[int64]*Channel), + subChannels: make(map[int64]*SubChannel), + sockets: make(map[int64]*Socket), + servers: make(map[int64]*Server), + } +} + +func (c *channelMap) addServer(id int64, s *Server) { + c.mu.Lock() + defer c.mu.Unlock() + s.cm = c + c.servers[id] = s +} + +func (c *channelMap) addChannel(id int64, cn *Channel, isTopChannel bool, pid int64) { + c.mu.Lock() + defer c.mu.Unlock() + cn.trace.cm = c + c.channels[id] = cn + if isTopChannel { + c.topLevelChannels[id] = struct{}{} + } else if p := c.channels[pid]; p != nil { + p.addChild(id, cn) + } else { + logger.Infof("channel %d references invalid parent ID %d", id, pid) + } +} + +func (c *channelMap) addSubChannel(id int64, sc *SubChannel, pid int64) { + c.mu.Lock() + defer c.mu.Unlock() + sc.trace.cm = c + c.subChannels[id] = sc + if p := c.channels[pid]; p != nil { + p.addChild(id, sc) + } else { + logger.Infof("subchannel %d references invalid parent ID %d", id, pid) + } +} + +func (c *channelMap) addSocket(s *Socket) { + c.mu.Lock() + defer c.mu.Unlock() + s.cm = c + c.sockets[s.ID] = s + if s.Parent == nil { + logger.Infof("normal socket %d has no parent", s.ID) + } + s.Parent.(entry).addChild(s.ID, s) +} + +// removeEntry triggers the removal of an entry, which may not indeed delete the +// entry, if it has to wait on the deletion of its children and until no other +// entity's channel trace references it. It may lead to a chain of entry +// deletion. For example, deleting the last socket of a gracefully shutting down +// server will lead to the server being also deleted. +func (c *channelMap) removeEntry(id int64) { + c.mu.Lock() + defer c.mu.Unlock() + c.findEntry(id).triggerDelete() +} + +// tracedChannel represents tracing operations which are present on both +// channels and subChannels. +type tracedChannel interface { + getChannelTrace() *ChannelTrace + incrTraceRefCount() + decrTraceRefCount() + getRefName() string +} + +// c.mu must be held by the caller +func (c *channelMap) decrTraceRefCount(id int64) { + e := c.findEntry(id) + if v, ok := e.(tracedChannel); ok { + v.decrTraceRefCount() + e.deleteSelfIfReady() + } +} + +// c.mu must be held by the caller. +func (c *channelMap) findEntry(id int64) entry { + if v, ok := c.channels[id]; ok { + return v + } + if v, ok := c.subChannels[id]; ok { + return v + } + if v, ok := c.servers[id]; ok { + return v + } + if v, ok := c.sockets[id]; ok { + return v + } + return &dummyEntry{idNotFound: id} +} + +// c.mu must be held by the caller +// +// deleteEntry deletes an entry from the channelMap. Before calling this method, +// caller must check this entry is ready to be deleted, i.e removeEntry() has +// been called on it, and no children still exist. +func (c *channelMap) deleteEntry(id int64) entry { + if v, ok := c.sockets[id]; ok { + delete(c.sockets, id) + return v + } + if v, ok := c.subChannels[id]; ok { + delete(c.subChannels, id) + return v + } + if v, ok := c.channels[id]; ok { + delete(c.channels, id) + delete(c.topLevelChannels, id) + return v + } + if v, ok := c.servers[id]; ok { + delete(c.servers, id) + return v + } + return &dummyEntry{idNotFound: id} +} + +func (c *channelMap) traceEvent(id int64, desc *TraceEvent) { + c.mu.Lock() + defer c.mu.Unlock() + child := c.findEntry(id) + childTC, ok := child.(tracedChannel) + if !ok { + return + } + childTC.getChannelTrace().append(&traceEvent{Desc: desc.Desc, Severity: desc.Severity, Timestamp: time.Now()}) + if desc.Parent != nil { + parent := c.findEntry(child.getParentID()) + var chanType RefChannelType + switch child.(type) { + case *Channel: + chanType = RefChannel + case *SubChannel: + chanType = RefSubChannel + } + if parentTC, ok := parent.(tracedChannel); ok { + parentTC.getChannelTrace().append(&traceEvent{ + Desc: desc.Parent.Desc, + Severity: desc.Parent.Severity, + Timestamp: time.Now(), + RefID: id, + RefName: childTC.getRefName(), + RefType: chanType, + }) + childTC.incrTraceRefCount() + } + } +} + +type int64Slice []int64 + +func (s int64Slice) Len() int { return len(s) } +func (s int64Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s int64Slice) Less(i, j int) bool { return s[i] < s[j] } + +func copyMap(m map[int64]string) map[int64]string { + n := make(map[int64]string) + for k, v := range m { + n[k] = v + } + return n +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func (c *channelMap) getTopChannels(id int64, maxResults int) ([]*Channel, bool) { + if maxResults <= 0 { + maxResults = EntriesPerPage + } + c.mu.RLock() + defer c.mu.RUnlock() + l := int64(len(c.topLevelChannels)) + ids := make([]int64, 0, l) + + for k := range c.topLevelChannels { + ids = append(ids, k) + } + sort.Sort(int64Slice(ids)) + idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= id }) + end := true + var t []*Channel + for _, v := range ids[idx:] { + if len(t) == maxResults { + end = false + break + } + if cn, ok := c.channels[v]; ok { + t = append(t, cn) + } + } + return t, end +} + +func (c *channelMap) getServers(id int64, maxResults int) ([]*Server, bool) { + if maxResults <= 0 { + maxResults = EntriesPerPage + } + c.mu.RLock() + defer c.mu.RUnlock() + ids := make([]int64, 0, len(c.servers)) + for k := range c.servers { + ids = append(ids, k) + } + sort.Sort(int64Slice(ids)) + idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= id }) + end := true + var s []*Server + for _, v := range ids[idx:] { + if len(s) == maxResults { + end = false + break + } + if svr, ok := c.servers[v]; ok { + s = append(s, svr) + } + } + return s, end +} + +func (c *channelMap) getServerSockets(id int64, startID int64, maxResults int) ([]*Socket, bool) { + if maxResults <= 0 { + maxResults = EntriesPerPage + } + c.mu.RLock() + defer c.mu.RUnlock() + svr, ok := c.servers[id] + if !ok { + // server with id doesn't exist. + return nil, true + } + svrskts := svr.sockets + ids := make([]int64, 0, len(svrskts)) + sks := make([]*Socket, 0, min(len(svrskts), maxResults)) + for k := range svrskts { + ids = append(ids, k) + } + sort.Sort(int64Slice(ids)) + idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= startID }) + end := true + for _, v := range ids[idx:] { + if len(sks) == maxResults { + end = false + break + } + if ns, ok := c.sockets[v]; ok { + sks = append(sks, ns) + } + } + return sks, end +} + +func (c *channelMap) getChannel(id int64) *Channel { + c.mu.RLock() + defer c.mu.RUnlock() + return c.channels[id] +} + +func (c *channelMap) getSubChannel(id int64) *SubChannel { + c.mu.RLock() + defer c.mu.RUnlock() + return c.subChannels[id] +} + +func (c *channelMap) getSocket(id int64) *Socket { + c.mu.RLock() + defer c.mu.RUnlock() + return c.sockets[id] +} + +func (c *channelMap) getServer(id int64) *Server { + c.mu.RLock() + defer c.mu.RUnlock() + return c.servers[id] +} + +type dummyEntry struct { + // dummyEntry is a fake entry to handle entry not found case. + idNotFound int64 + Entity +} + +func (d *dummyEntry) String() string { + return fmt.Sprintf("non-existent entity #%d", d.idNotFound) +} + +func (d *dummyEntry) ID() int64 { return d.idNotFound } + +func (d *dummyEntry) addChild(id int64, e entry) { + // Note: It is possible for a normal program to reach here under race + // condition. For example, there could be a race between ClientConn.Close() + // info being propagated to addrConn and http2Client. ClientConn.Close() + // cancel the context and result in http2Client to error. The error info is + // then caught by transport monitor and before addrConn.tearDown() is called + // in side ClientConn.Close(). Therefore, the addrConn will create a new + // transport. And when registering the new transport in channelz, its parent + // addrConn could have already been torn down and deleted from channelz + // tracking, and thus reach the code here. + logger.Infof("attempt to add child of type %T with id %d to a parent (id=%d) that doesn't currently exist", e, id, d.idNotFound) +} + +func (d *dummyEntry) deleteChild(id int64) { + // It is possible for a normal program to reach here under race condition. + // Refer to the example described in addChild(). + logger.Infof("attempt to delete child with id %d from a parent (id=%d) that doesn't currently exist", id, d.idNotFound) +} + +func (d *dummyEntry) triggerDelete() { + logger.Warningf("attempt to delete an entry (id=%d) that doesn't currently exist", d.idNotFound) +} + +func (*dummyEntry) deleteSelfIfReady() { + // code should not reach here. deleteSelfIfReady is always called on an existing entry. +} + +func (*dummyEntry) getParentID() int64 { + return 0 +} + +// Entity is implemented by all channelz types. +type Entity interface { + isEntity() + fmt.Stringer + id() int64 +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/funcs.go b/vendor/google.golang.org/grpc/internal/channelz/funcs.go index 5395e7752..03e24e150 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/funcs.go +++ b/vendor/google.golang.org/grpc/internal/channelz/funcs.go @@ -16,25 +16,16 @@ * */ -// Package channelz defines APIs for enabling channelz service, entry +// Package channelz defines internal APIs for enabling channelz service, entry // registration/deletion, and accessing channelz data. It also defines channelz // metric struct formats. -// -// All APIs in this package are experimental. package channelz import ( - "errors" - "sort" - "sync" "sync/atomic" "time" - "google.golang.org/grpc/grpclog" -) - -const ( - defaultMaxTraceEntry int32 = 30 + "google.golang.org/grpc/internal" ) var ( @@ -42,19 +33,20 @@ var ( // outside this package except by tests. IDGen IDGenerator - db dbWrapper - // EntryPerPage defines the number of channelz entries to be shown on a web page. - EntryPerPage = int64(50) - curState int32 - maxTraceEntry = defaultMaxTraceEntry + db *channelMap = newChannelMap() + // EntriesPerPage defines the number of channelz entries to be shown on a web page. + EntriesPerPage = 50 + curState int32 ) // TurnOn turns on channelz data collection. func TurnOn() { - if !IsOn() { - db.set(newChannelMap()) - IDGen.Reset() - atomic.StoreInt32(&curState, 1) + atomic.StoreInt32(&curState, 1) +} + +func init() { + internal.ChannelzTurnOffForTesting = func() { + atomic.StoreInt32(&curState, 0) } } @@ -63,49 +55,15 @@ func IsOn() bool { return atomic.LoadInt32(&curState) == 1 } -// SetMaxTraceEntry sets maximum number of trace entry per entity (i.e. channel/subchannel). -// Setting it to 0 will disable channel tracing. -func SetMaxTraceEntry(i int32) { - atomic.StoreInt32(&maxTraceEntry, i) -} - -// ResetMaxTraceEntryToDefault resets the maximum number of trace entry per entity to default. -func ResetMaxTraceEntryToDefault() { - atomic.StoreInt32(&maxTraceEntry, defaultMaxTraceEntry) -} - -func getMaxTraceEntry() int { - i := atomic.LoadInt32(&maxTraceEntry) - return int(i) -} - -// dbWarpper wraps around a reference to internal channelz data storage, and -// provide synchronized functionality to set and get the reference. -type dbWrapper struct { - mu sync.RWMutex - DB *channelMap -} - -func (d *dbWrapper) set(db *channelMap) { - d.mu.Lock() - d.DB = db - d.mu.Unlock() -} - -func (d *dbWrapper) get() *channelMap { - d.mu.RLock() - defer d.mu.RUnlock() - return d.DB -} - // GetTopChannels returns a slice of top channel's ChannelMetric, along with a // boolean indicating whether there's more top channels to be queried for. // -// The arg id specifies that only top channel with id at or above it will be included -// in the result. The returned slice is up to a length of the arg maxResults or -// EntryPerPage if maxResults is zero, and is sorted in ascending id order. -func GetTopChannels(id int64, maxResults int64) ([]*ChannelMetric, bool) { - return db.get().GetTopChannels(id, maxResults) +// The arg id specifies that only top channel with id at or above it will be +// included in the result. The returned slice is up to a length of the arg +// maxResults or EntriesPerPage if maxResults is zero, and is sorted in ascending +// id order. +func GetTopChannels(id int64, maxResults int) ([]*Channel, bool) { + return db.getTopChannels(id, maxResults) } // GetServers returns a slice of server's ServerMetric, along with a @@ -113,73 +71,69 @@ func GetTopChannels(id int64, maxResults int64) ([]*ChannelMetric, bool) { // // The arg id specifies that only server with id at or above it will be included // in the result. The returned slice is up to a length of the arg maxResults or -// EntryPerPage if maxResults is zero, and is sorted in ascending id order. -func GetServers(id int64, maxResults int64) ([]*ServerMetric, bool) { - return db.get().GetServers(id, maxResults) +// EntriesPerPage if maxResults is zero, and is sorted in ascending id order. +func GetServers(id int64, maxResults int) ([]*Server, bool) { + return db.getServers(id, maxResults) } // GetServerSockets returns a slice of server's (identified by id) normal socket's -// SocketMetric, along with a boolean indicating whether there's more sockets to +// SocketMetrics, along with a boolean indicating whether there's more sockets to // be queried for. // // The arg startID specifies that only sockets with id at or above it will be // included in the result. The returned slice is up to a length of the arg maxResults -// or EntryPerPage if maxResults is zero, and is sorted in ascending id order. -func GetServerSockets(id int64, startID int64, maxResults int64) ([]*SocketMetric, bool) { - return db.get().GetServerSockets(id, startID, maxResults) +// or EntriesPerPage if maxResults is zero, and is sorted in ascending id order. +func GetServerSockets(id int64, startID int64, maxResults int) ([]*Socket, bool) { + return db.getServerSockets(id, startID, maxResults) } -// GetChannel returns the ChannelMetric for the channel (identified by id). -func GetChannel(id int64) *ChannelMetric { - return db.get().GetChannel(id) +// GetChannel returns the Channel for the channel (identified by id). +func GetChannel(id int64) *Channel { + return db.getChannel(id) } -// GetSubChannel returns the SubChannelMetric for the subchannel (identified by id). -func GetSubChannel(id int64) *SubChannelMetric { - return db.get().GetSubChannel(id) +// GetSubChannel returns the SubChannel for the subchannel (identified by id). +func GetSubChannel(id int64) *SubChannel { + return db.getSubChannel(id) } -// GetSocket returns the SocketInternalMetric for the socket (identified by id). -func GetSocket(id int64) *SocketMetric { - return db.get().GetSocket(id) +// GetSocket returns the Socket for the socket (identified by id). +func GetSocket(id int64) *Socket { + return db.getSocket(id) } // GetServer returns the ServerMetric for the server (identified by id). -func GetServer(id int64) *ServerMetric { - return db.get().GetServer(id) +func GetServer(id int64) *Server { + return db.getServer(id) } // RegisterChannel registers the given channel c in the channelz database with -// ref as its reference name, and adds it to the child list of its parent -// (identified by pid). pid == nil means no parent. +// target as its target and reference name, and adds it to the child list of its +// parent. parent == nil means no parent. // // Returns a unique channelz identifier assigned to this channel. // // If channelz is not turned ON, the channelz database is not mutated. -func RegisterChannel(c Channel, pid *Identifier, ref string) *Identifier { +func RegisterChannel(parent *Channel, target string) *Channel { id := IDGen.genID() - var parent int64 - isTopChannel := true - if pid != nil { - isTopChannel = false - parent = pid.Int() - } if !IsOn() { - return newIdentifer(RefChannel, id, pid) + return &Channel{ID: id} } - cn := &channel{ - refName: ref, - c: c, - subChans: make(map[int64]string), + isTopChannel := parent == nil + + cn := &Channel{ + ID: id, + RefName: target, nestedChans: make(map[int64]string), - id: id, - pid: parent, - trace: &channelTrace{createdTime: time.Now(), events: make([]*TraceEvent, 0, getMaxTraceEntry())}, + subChans: make(map[int64]string), + Parent: parent, + trace: &ChannelTrace{CreationTime: time.Now(), Events: make([]*traceEvent, 0, getMaxTraceEntry())}, } - db.get().addChannel(id, cn, isTopChannel, parent) - return newIdentifer(RefChannel, id, pid) + cn.ChannelMetrics.Target.Store(&target) + db.addChannel(id, cn, isTopChannel, cn.getParentID()) + return cn } // RegisterSubChannel registers the given subChannel c in the channelz database @@ -189,555 +143,67 @@ func RegisterChannel(c Channel, pid *Identifier, ref string) *Identifier { // Returns a unique channelz identifier assigned to this subChannel. // // If channelz is not turned ON, the channelz database is not mutated. -func RegisterSubChannel(c Channel, pid *Identifier, ref string) (*Identifier, error) { - if pid == nil { - return nil, errors.New("a SubChannel's parent id cannot be nil") - } +func RegisterSubChannel(parent *Channel, ref string) *SubChannel { id := IDGen.genID() - if !IsOn() { - return newIdentifer(RefSubChannel, id, pid), nil + sc := &SubChannel{ + ID: id, + RefName: ref, + parent: parent, } - sc := &subChannel{ - refName: ref, - c: c, - sockets: make(map[int64]string), - id: id, - pid: pid.Int(), - trace: &channelTrace{createdTime: time.Now(), events: make([]*TraceEvent, 0, getMaxTraceEntry())}, + if !IsOn() { + return sc } - db.get().addSubChannel(id, sc, pid.Int()) - return newIdentifer(RefSubChannel, id, pid), nil + + sc.sockets = make(map[int64]string) + sc.trace = &ChannelTrace{CreationTime: time.Now(), Events: make([]*traceEvent, 0, getMaxTraceEntry())} + db.addSubChannel(id, sc, parent.ID) + return sc } // RegisterServer registers the given server s in channelz database. It returns // the unique channelz tracking id assigned to this server. // // If channelz is not turned ON, the channelz database is not mutated. -func RegisterServer(s Server, ref string) *Identifier { +func RegisterServer(ref string) *Server { id := IDGen.genID() if !IsOn() { - return newIdentifer(RefServer, id, nil) + return &Server{ID: id} } - svr := &server{ - refName: ref, - s: s, + svr := &Server{ + RefName: ref, sockets: make(map[int64]string), listenSockets: make(map[int64]string), - id: id, - } - db.get().addServer(id, svr) - return newIdentifer(RefServer, id, nil) -} - -// RegisterListenSocket registers the given listen socket s in channelz database -// with ref as its reference name, and add it to the child list of its parent -// (identified by pid). It returns the unique channelz tracking id assigned to -// this listen socket. -// -// If channelz is not turned ON, the channelz database is not mutated. -func RegisterListenSocket(s Socket, pid *Identifier, ref string) (*Identifier, error) { - if pid == nil { - return nil, errors.New("a ListenSocket's parent id cannot be 0") + ID: id, } - id := IDGen.genID() - if !IsOn() { - return newIdentifer(RefListenSocket, id, pid), nil - } - - ls := &listenSocket{refName: ref, s: s, id: id, pid: pid.Int()} - db.get().addListenSocket(id, ls, pid.Int()) - return newIdentifer(RefListenSocket, id, pid), nil + db.addServer(id, svr) + return svr } -// RegisterNormalSocket registers the given normal socket s in channelz database +// RegisterSocket registers the given normal socket s in channelz database // with ref as its reference name, and adds it to the child list of its parent -// (identified by pid). It returns the unique channelz tracking id assigned to -// this normal socket. +// (identified by skt.Parent, which must be set). It returns the unique channelz +// tracking id assigned to this normal socket. // // If channelz is not turned ON, the channelz database is not mutated. -func RegisterNormalSocket(s Socket, pid *Identifier, ref string) (*Identifier, error) { - if pid == nil { - return nil, errors.New("a NormalSocket's parent id cannot be 0") - } - id := IDGen.genID() - if !IsOn() { - return newIdentifer(RefNormalSocket, id, pid), nil +func RegisterSocket(skt *Socket) *Socket { + skt.ID = IDGen.genID() + if IsOn() { + db.addSocket(skt) } - - ns := &normalSocket{refName: ref, s: s, id: id, pid: pid.Int()} - db.get().addNormalSocket(id, ns, pid.Int()) - return newIdentifer(RefNormalSocket, id, pid), nil + return skt } // RemoveEntry removes an entry with unique channelz tracking id to be id from // channelz database. // // If channelz is not turned ON, this function is a no-op. -func RemoveEntry(id *Identifier) { +func RemoveEntry(id int64) { if !IsOn() { return } - db.get().removeEntry(id.Int()) -} - -// TraceEventDesc is what the caller of AddTraceEvent should provide to describe -// the event to be added to the channel trace. -// -// The Parent field is optional. It is used for an event that will be recorded -// in the entity's parent trace. -type TraceEventDesc struct { - Desc string - Severity Severity - Parent *TraceEventDesc -} - -// AddTraceEvent adds trace related to the entity with specified id, using the -// provided TraceEventDesc. -// -// If channelz is not turned ON, this will simply log the event descriptions. -func AddTraceEvent(l grpclog.DepthLoggerV2, id *Identifier, depth int, desc *TraceEventDesc) { - // Log only the trace description associated with the bottom most entity. - switch desc.Severity { - case CtUnknown, CtInfo: - l.InfoDepth(depth+1, withParens(id)+desc.Desc) - case CtWarning: - l.WarningDepth(depth+1, withParens(id)+desc.Desc) - case CtError: - l.ErrorDepth(depth+1, withParens(id)+desc.Desc) - } - - if getMaxTraceEntry() == 0 { - return - } - if IsOn() { - db.get().traceEvent(id.Int(), desc) - } -} - -// channelMap is the storage data structure for channelz. -// Methods of channelMap can be divided in two two categories with respect to locking. -// 1. Methods acquire the global lock. -// 2. Methods that can only be called when global lock is held. -// A second type of method need always to be called inside a first type of method. -type channelMap struct { - mu sync.RWMutex - topLevelChannels map[int64]struct{} - servers map[int64]*server - channels map[int64]*channel - subChannels map[int64]*subChannel - listenSockets map[int64]*listenSocket - normalSockets map[int64]*normalSocket -} - -func newChannelMap() *channelMap { - return &channelMap{ - topLevelChannels: make(map[int64]struct{}), - channels: make(map[int64]*channel), - listenSockets: make(map[int64]*listenSocket), - normalSockets: make(map[int64]*normalSocket), - servers: make(map[int64]*server), - subChannels: make(map[int64]*subChannel), - } -} - -func (c *channelMap) addServer(id int64, s *server) { - c.mu.Lock() - s.cm = c - c.servers[id] = s - c.mu.Unlock() -} - -func (c *channelMap) addChannel(id int64, cn *channel, isTopChannel bool, pid int64) { - c.mu.Lock() - cn.cm = c - cn.trace.cm = c - c.channels[id] = cn - if isTopChannel { - c.topLevelChannels[id] = struct{}{} - } else { - c.findEntry(pid).addChild(id, cn) - } - c.mu.Unlock() -} - -func (c *channelMap) addSubChannel(id int64, sc *subChannel, pid int64) { - c.mu.Lock() - sc.cm = c - sc.trace.cm = c - c.subChannels[id] = sc - c.findEntry(pid).addChild(id, sc) - c.mu.Unlock() -} - -func (c *channelMap) addListenSocket(id int64, ls *listenSocket, pid int64) { - c.mu.Lock() - ls.cm = c - c.listenSockets[id] = ls - c.findEntry(pid).addChild(id, ls) - c.mu.Unlock() -} - -func (c *channelMap) addNormalSocket(id int64, ns *normalSocket, pid int64) { - c.mu.Lock() - ns.cm = c - c.normalSockets[id] = ns - c.findEntry(pid).addChild(id, ns) - c.mu.Unlock() -} - -// removeEntry triggers the removal of an entry, which may not indeed delete the entry, if it has to -// wait on the deletion of its children and until no other entity's channel trace references it. -// It may lead to a chain of entry deletion. For example, deleting the last socket of a gracefully -// shutting down server will lead to the server being also deleted. -func (c *channelMap) removeEntry(id int64) { - c.mu.Lock() - c.findEntry(id).triggerDelete() - c.mu.Unlock() -} - -// c.mu must be held by the caller -func (c *channelMap) decrTraceRefCount(id int64) { - e := c.findEntry(id) - if v, ok := e.(tracedChannel); ok { - v.decrTraceRefCount() - e.deleteSelfIfReady() - } -} - -// c.mu must be held by the caller. -func (c *channelMap) findEntry(id int64) entry { - var v entry - var ok bool - if v, ok = c.channels[id]; ok { - return v - } - if v, ok = c.subChannels[id]; ok { - return v - } - if v, ok = c.servers[id]; ok { - return v - } - if v, ok = c.listenSockets[id]; ok { - return v - } - if v, ok = c.normalSockets[id]; ok { - return v - } - return &dummyEntry{idNotFound: id} -} - -// c.mu must be held by the caller -// deleteEntry simply deletes an entry from the channelMap. Before calling this -// method, caller must check this entry is ready to be deleted, i.e removeEntry() -// has been called on it, and no children still exist. -// Conditionals are ordered by the expected frequency of deletion of each entity -// type, in order to optimize performance. -func (c *channelMap) deleteEntry(id int64) { - var ok bool - if _, ok = c.normalSockets[id]; ok { - delete(c.normalSockets, id) - return - } - if _, ok = c.subChannels[id]; ok { - delete(c.subChannels, id) - return - } - if _, ok = c.channels[id]; ok { - delete(c.channels, id) - delete(c.topLevelChannels, id) - return - } - if _, ok = c.listenSockets[id]; ok { - delete(c.listenSockets, id) - return - } - if _, ok = c.servers[id]; ok { - delete(c.servers, id) - return - } -} - -func (c *channelMap) traceEvent(id int64, desc *TraceEventDesc) { - c.mu.Lock() - child := c.findEntry(id) - childTC, ok := child.(tracedChannel) - if !ok { - c.mu.Unlock() - return - } - childTC.getChannelTrace().append(&TraceEvent{Desc: desc.Desc, Severity: desc.Severity, Timestamp: time.Now()}) - if desc.Parent != nil { - parent := c.findEntry(child.getParentID()) - var chanType RefChannelType - switch child.(type) { - case *channel: - chanType = RefChannel - case *subChannel: - chanType = RefSubChannel - } - if parentTC, ok := parent.(tracedChannel); ok { - parentTC.getChannelTrace().append(&TraceEvent{ - Desc: desc.Parent.Desc, - Severity: desc.Parent.Severity, - Timestamp: time.Now(), - RefID: id, - RefName: childTC.getRefName(), - RefType: chanType, - }) - childTC.incrTraceRefCount() - } - } - c.mu.Unlock() -} - -type int64Slice []int64 - -func (s int64Slice) Len() int { return len(s) } -func (s int64Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s int64Slice) Less(i, j int) bool { return s[i] < s[j] } - -func copyMap(m map[int64]string) map[int64]string { - n := make(map[int64]string) - for k, v := range m { - n[k] = v - } - return n -} - -func min(a, b int64) int64 { - if a < b { - return a - } - return b -} - -func (c *channelMap) GetTopChannels(id int64, maxResults int64) ([]*ChannelMetric, bool) { - if maxResults <= 0 { - maxResults = EntryPerPage - } - c.mu.RLock() - l := int64(len(c.topLevelChannels)) - ids := make([]int64, 0, l) - cns := make([]*channel, 0, min(l, maxResults)) - - for k := range c.topLevelChannels { - ids = append(ids, k) - } - sort.Sort(int64Slice(ids)) - idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= id }) - count := int64(0) - var end bool - var t []*ChannelMetric - for i, v := range ids[idx:] { - if count == maxResults { - break - } - if cn, ok := c.channels[v]; ok { - cns = append(cns, cn) - t = append(t, &ChannelMetric{ - NestedChans: copyMap(cn.nestedChans), - SubChans: copyMap(cn.subChans), - }) - count++ - } - if i == len(ids[idx:])-1 { - end = true - break - } - } - c.mu.RUnlock() - if count == 0 { - end = true - } - - for i, cn := range cns { - t[i].ChannelData = cn.c.ChannelzMetric() - t[i].ID = cn.id - t[i].RefName = cn.refName - t[i].Trace = cn.trace.dumpData() - } - return t, end -} - -func (c *channelMap) GetServers(id, maxResults int64) ([]*ServerMetric, bool) { - if maxResults <= 0 { - maxResults = EntryPerPage - } - c.mu.RLock() - l := int64(len(c.servers)) - ids := make([]int64, 0, l) - ss := make([]*server, 0, min(l, maxResults)) - for k := range c.servers { - ids = append(ids, k) - } - sort.Sort(int64Slice(ids)) - idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= id }) - count := int64(0) - var end bool - var s []*ServerMetric - for i, v := range ids[idx:] { - if count == maxResults { - break - } - if svr, ok := c.servers[v]; ok { - ss = append(ss, svr) - s = append(s, &ServerMetric{ - ListenSockets: copyMap(svr.listenSockets), - }) - count++ - } - if i == len(ids[idx:])-1 { - end = true - break - } - } - c.mu.RUnlock() - if count == 0 { - end = true - } - - for i, svr := range ss { - s[i].ServerData = svr.s.ChannelzMetric() - s[i].ID = svr.id - s[i].RefName = svr.refName - } - return s, end -} - -func (c *channelMap) GetServerSockets(id int64, startID int64, maxResults int64) ([]*SocketMetric, bool) { - if maxResults <= 0 { - maxResults = EntryPerPage - } - var svr *server - var ok bool - c.mu.RLock() - if svr, ok = c.servers[id]; !ok { - // server with id doesn't exist. - c.mu.RUnlock() - return nil, true - } - svrskts := svr.sockets - l := int64(len(svrskts)) - ids := make([]int64, 0, l) - sks := make([]*normalSocket, 0, min(l, maxResults)) - for k := range svrskts { - ids = append(ids, k) - } - sort.Sort(int64Slice(ids)) - idx := sort.Search(len(ids), func(i int) bool { return ids[i] >= startID }) - count := int64(0) - var end bool - for i, v := range ids[idx:] { - if count == maxResults { - break - } - if ns, ok := c.normalSockets[v]; ok { - sks = append(sks, ns) - count++ - } - if i == len(ids[idx:])-1 { - end = true - break - } - } - c.mu.RUnlock() - if count == 0 { - end = true - } - s := make([]*SocketMetric, 0, len(sks)) - for _, ns := range sks { - sm := &SocketMetric{} - sm.SocketData = ns.s.ChannelzMetric() - sm.ID = ns.id - sm.RefName = ns.refName - s = append(s, sm) - } - return s, end -} - -func (c *channelMap) GetChannel(id int64) *ChannelMetric { - cm := &ChannelMetric{} - var cn *channel - var ok bool - c.mu.RLock() - if cn, ok = c.channels[id]; !ok { - // channel with id doesn't exist. - c.mu.RUnlock() - return nil - } - cm.NestedChans = copyMap(cn.nestedChans) - cm.SubChans = copyMap(cn.subChans) - // cn.c can be set to &dummyChannel{} when deleteSelfFromMap is called. Save a copy of cn.c when - // holding the lock to prevent potential data race. - chanCopy := cn.c - c.mu.RUnlock() - cm.ChannelData = chanCopy.ChannelzMetric() - cm.ID = cn.id - cm.RefName = cn.refName - cm.Trace = cn.trace.dumpData() - return cm -} - -func (c *channelMap) GetSubChannel(id int64) *SubChannelMetric { - cm := &SubChannelMetric{} - var sc *subChannel - var ok bool - c.mu.RLock() - if sc, ok = c.subChannels[id]; !ok { - // subchannel with id doesn't exist. - c.mu.RUnlock() - return nil - } - cm.Sockets = copyMap(sc.sockets) - // sc.c can be set to &dummyChannel{} when deleteSelfFromMap is called. Save a copy of sc.c when - // holding the lock to prevent potential data race. - chanCopy := sc.c - c.mu.RUnlock() - cm.ChannelData = chanCopy.ChannelzMetric() - cm.ID = sc.id - cm.RefName = sc.refName - cm.Trace = sc.trace.dumpData() - return cm -} - -func (c *channelMap) GetSocket(id int64) *SocketMetric { - sm := &SocketMetric{} - c.mu.RLock() - if ls, ok := c.listenSockets[id]; ok { - c.mu.RUnlock() - sm.SocketData = ls.s.ChannelzMetric() - sm.ID = ls.id - sm.RefName = ls.refName - return sm - } - if ns, ok := c.normalSockets[id]; ok { - c.mu.RUnlock() - sm.SocketData = ns.s.ChannelzMetric() - sm.ID = ns.id - sm.RefName = ns.refName - return sm - } - c.mu.RUnlock() - return nil -} - -func (c *channelMap) GetServer(id int64) *ServerMetric { - sm := &ServerMetric{} - var svr *server - var ok bool - c.mu.RLock() - if svr, ok = c.servers[id]; !ok { - c.mu.RUnlock() - return nil - } - sm.ListenSockets = copyMap(svr.listenSockets) - c.mu.RUnlock() - sm.ID = svr.id - sm.RefName = svr.refName - sm.ServerData = svr.s.ChannelzMetric() - return sm + db.removeEntry(id) } // IDGenerator is an incrementing atomic that tracks IDs for channelz entities. @@ -754,3 +220,11 @@ func (i *IDGenerator) Reset() { func (i *IDGenerator) genID() int64 { return atomic.AddInt64(&i.id, 1) } + +// Identifier is an opaque channelz identifier used to expose channelz symbols +// outside of grpc. Currently only implemented by Channel since no other +// types require exposure outside grpc. +type Identifier interface { + Entity + channelzIdentifier() +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/id.go b/vendor/google.golang.org/grpc/internal/channelz/id.go deleted file mode 100644 index c9a27acd3..000000000 --- a/vendor/google.golang.org/grpc/internal/channelz/id.go +++ /dev/null @@ -1,75 +0,0 @@ -/* - * - * Copyright 2022 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package channelz - -import "fmt" - -// Identifier is an opaque identifier which uniquely identifies an entity in the -// channelz database. -type Identifier struct { - typ RefChannelType - id int64 - str string - pid *Identifier -} - -// Type returns the entity type corresponding to id. -func (id *Identifier) Type() RefChannelType { - return id.typ -} - -// Int returns the integer identifier corresponding to id. -func (id *Identifier) Int() int64 { - return id.id -} - -// String returns a string representation of the entity corresponding to id. -// -// This includes some information about the parent as well. Examples: -// Top-level channel: [Channel #channel-number] -// Nested channel: [Channel #parent-channel-number Channel #channel-number] -// Sub channel: [Channel #parent-channel SubChannel #subchannel-number] -func (id *Identifier) String() string { - return id.str -} - -// Equal returns true if other is the same as id. -func (id *Identifier) Equal(other *Identifier) bool { - if (id != nil) != (other != nil) { - return false - } - if id == nil && other == nil { - return true - } - return id.typ == other.typ && id.id == other.id && id.pid == other.pid -} - -// NewIdentifierForTesting returns a new opaque identifier to be used only for -// testing purposes. -func NewIdentifierForTesting(typ RefChannelType, id int64, pid *Identifier) *Identifier { - return newIdentifer(typ, id, pid) -} - -func newIdentifer(typ RefChannelType, id int64, pid *Identifier) *Identifier { - str := fmt.Sprintf("%s #%d", typ, id) - if pid != nil { - str = fmt.Sprintf("%s %s", pid, str) - } - return &Identifier{typ: typ, id: id, str: str, pid: pid} -} diff --git a/vendor/google.golang.org/grpc/internal/channelz/logging.go b/vendor/google.golang.org/grpc/internal/channelz/logging.go index f89e6f77b..ee4d72125 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/logging.go +++ b/vendor/google.golang.org/grpc/internal/channelz/logging.go @@ -26,53 +26,49 @@ import ( var logger = grpclog.Component("channelz") -func withParens(id *Identifier) string { - return "[" + id.String() + "] " -} - // Info logs and adds a trace event if channelz is on. -func Info(l grpclog.DepthLoggerV2, id *Identifier, args ...any) { - AddTraceEvent(l, id, 1, &TraceEventDesc{ +func Info(l grpclog.DepthLoggerV2, e Entity, args ...any) { + AddTraceEvent(l, e, 1, &TraceEvent{ Desc: fmt.Sprint(args...), Severity: CtInfo, }) } // Infof logs and adds a trace event if channelz is on. -func Infof(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...any) { - AddTraceEvent(l, id, 1, &TraceEventDesc{ +func Infof(l grpclog.DepthLoggerV2, e Entity, format string, args ...any) { + AddTraceEvent(l, e, 1, &TraceEvent{ Desc: fmt.Sprintf(format, args...), Severity: CtInfo, }) } // Warning logs and adds a trace event if channelz is on. -func Warning(l grpclog.DepthLoggerV2, id *Identifier, args ...any) { - AddTraceEvent(l, id, 1, &TraceEventDesc{ +func Warning(l grpclog.DepthLoggerV2, e Entity, args ...any) { + AddTraceEvent(l, e, 1, &TraceEvent{ Desc: fmt.Sprint(args...), Severity: CtWarning, }) } // Warningf logs and adds a trace event if channelz is on. -func Warningf(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...any) { - AddTraceEvent(l, id, 1, &TraceEventDesc{ +func Warningf(l grpclog.DepthLoggerV2, e Entity, format string, args ...any) { + AddTraceEvent(l, e, 1, &TraceEvent{ Desc: fmt.Sprintf(format, args...), Severity: CtWarning, }) } // Error logs and adds a trace event if channelz is on. -func Error(l grpclog.DepthLoggerV2, id *Identifier, args ...any) { - AddTraceEvent(l, id, 1, &TraceEventDesc{ +func Error(l grpclog.DepthLoggerV2, e Entity, args ...any) { + AddTraceEvent(l, e, 1, &TraceEvent{ Desc: fmt.Sprint(args...), Severity: CtError, }) } // Errorf logs and adds a trace event if channelz is on. -func Errorf(l grpclog.DepthLoggerV2, id *Identifier, format string, args ...any) { - AddTraceEvent(l, id, 1, &TraceEventDesc{ +func Errorf(l grpclog.DepthLoggerV2, e Entity, format string, args ...any) { + AddTraceEvent(l, e, 1, &TraceEvent{ Desc: fmt.Sprintf(format, args...), Severity: CtError, }) diff --git a/vendor/google.golang.org/grpc/internal/channelz/server.go b/vendor/google.golang.org/grpc/internal/channelz/server.go new file mode 100644 index 000000000..cdfc49d6e --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/server.go @@ -0,0 +1,119 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "fmt" + "sync/atomic" +) + +// Server is the channelz representation of a server. +type Server struct { + Entity + ID int64 + RefName string + + ServerMetrics ServerMetrics + + closeCalled bool + sockets map[int64]string + listenSockets map[int64]string + cm *channelMap +} + +// ServerMetrics defines a struct containing metrics for servers. +type ServerMetrics struct { + // The number of incoming calls started on the server. + CallsStarted atomic.Int64 + // The number of incoming calls that have completed with an OK status. + CallsSucceeded atomic.Int64 + // The number of incoming calls that have a completed with a non-OK status. + CallsFailed atomic.Int64 + // The last time a call was started on the server. + LastCallStartedTimestamp atomic.Int64 +} + +// NewServerMetricsForTesting returns an initialized ServerMetrics. +func NewServerMetricsForTesting(started, succeeded, failed, timestamp int64) *ServerMetrics { + sm := &ServerMetrics{} + sm.CallsStarted.Store(started) + sm.CallsSucceeded.Store(succeeded) + sm.CallsFailed.Store(failed) + sm.LastCallStartedTimestamp.Store(timestamp) + return sm +} + +func (sm *ServerMetrics) CopyFrom(o *ServerMetrics) { + sm.CallsStarted.Store(o.CallsStarted.Load()) + sm.CallsSucceeded.Store(o.CallsSucceeded.Load()) + sm.CallsFailed.Store(o.CallsFailed.Load()) + sm.LastCallStartedTimestamp.Store(o.LastCallStartedTimestamp.Load()) +} + +// ListenSockets returns the listening sockets for s. +func (s *Server) ListenSockets() map[int64]string { + db.mu.RLock() + defer db.mu.RUnlock() + return copyMap(s.listenSockets) +} + +// String returns a printable description of s. +func (s *Server) String() string { + return fmt.Sprintf("Server #%d", s.ID) +} + +func (s *Server) id() int64 { + return s.ID +} + +func (s *Server) addChild(id int64, e entry) { + switch v := e.(type) { + case *Socket: + switch v.SocketType { + case SocketTypeNormal: + s.sockets[id] = v.RefName + case SocketTypeListen: + s.listenSockets[id] = v.RefName + } + default: + logger.Errorf("cannot add a child (id = %d) of type %T to a server", id, e) + } +} + +func (s *Server) deleteChild(id int64) { + delete(s.sockets, id) + delete(s.listenSockets, id) + s.deleteSelfIfReady() +} + +func (s *Server) triggerDelete() { + s.closeCalled = true + s.deleteSelfIfReady() +} + +func (s *Server) deleteSelfIfReady() { + if !s.closeCalled || len(s.sockets)+len(s.listenSockets) != 0 { + return + } + s.cm.deleteEntry(s.ID) +} + +func (s *Server) getParentID() int64 { + return 0 +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/socket.go b/vendor/google.golang.org/grpc/internal/channelz/socket.go new file mode 100644 index 000000000..fa64834b2 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/socket.go @@ -0,0 +1,130 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "fmt" + "net" + "sync/atomic" + + "google.golang.org/grpc/credentials" +) + +// SocketMetrics defines the struct that the implementor of Socket interface +// should return from ChannelzMetric(). +type SocketMetrics struct { + // The number of streams that have been started. + StreamsStarted atomic.Int64 + // The number of streams that have ended successfully: + // On client side, receiving frame with eos bit set. + // On server side, sending frame with eos bit set. + StreamsSucceeded atomic.Int64 + // The number of streams that have ended unsuccessfully: + // On client side, termination without receiving frame with eos bit set. + // On server side, termination without sending frame with eos bit set. + StreamsFailed atomic.Int64 + // The number of messages successfully sent on this socket. + MessagesSent atomic.Int64 + MessagesReceived atomic.Int64 + // The number of keep alives sent. This is typically implemented with HTTP/2 + // ping messages. + KeepAlivesSent atomic.Int64 + // The last time a stream was created by this endpoint. Usually unset for + // servers. + LastLocalStreamCreatedTimestamp atomic.Int64 + // The last time a stream was created by the remote endpoint. Usually unset + // for clients. + LastRemoteStreamCreatedTimestamp atomic.Int64 + // The last time a message was sent by this endpoint. + LastMessageSentTimestamp atomic.Int64 + // The last time a message was received by this endpoint. + LastMessageReceivedTimestamp atomic.Int64 +} + +// EphemeralSocketMetrics are metrics that change rapidly and are tracked +// outside of channelz. +type EphemeralSocketMetrics struct { + // The amount of window, granted to the local endpoint by the remote endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + LocalFlowControlWindow int64 + // The amount of window, granted to the remote endpoint by the local endpoint. + // This may be slightly out of date due to network latency. This does NOT + // include stream level or TCP level flow control info. + RemoteFlowControlWindow int64 +} + +type SocketType string + +const ( + SocketTypeNormal = "NormalSocket" + SocketTypeListen = "ListenSocket" +) + +type Socket struct { + Entity + SocketType SocketType + ID int64 + Parent Entity + cm *channelMap + SocketMetrics SocketMetrics + EphemeralMetrics func() *EphemeralSocketMetrics + + RefName string + // The locally bound address. Immutable. + LocalAddr net.Addr + // The remote bound address. May be absent. Immutable. + RemoteAddr net.Addr + // Optional, represents the name of the remote endpoint, if different than + // the original target name. Immutable. + RemoteName string + // Immutable. + SocketOptions *SocketOptionData + // Immutable. + Security credentials.ChannelzSecurityValue +} + +func (ls *Socket) String() string { + return fmt.Sprintf("%s %s #%d", ls.Parent, ls.SocketType, ls.ID) +} + +func (ls *Socket) id() int64 { + return ls.ID +} + +func (ls *Socket) addChild(id int64, e entry) { + logger.Errorf("cannot add a child (id = %d) of type %T to a listen socket", id, e) +} + +func (ls *Socket) deleteChild(id int64) { + logger.Errorf("cannot delete a child (id = %d) from a listen socket", id) +} + +func (ls *Socket) triggerDelete() { + ls.cm.deleteEntry(ls.ID) + ls.Parent.(entry).deleteChild(ls.ID) +} + +func (ls *Socket) deleteSelfIfReady() { + logger.Errorf("cannot call deleteSelfIfReady on a listen socket") +} + +func (ls *Socket) getParentID() int64 { + return ls.Parent.id() +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/subchannel.go b/vendor/google.golang.org/grpc/internal/channelz/subchannel.go new file mode 100644 index 000000000..3b88e4cba --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/subchannel.go @@ -0,0 +1,151 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "fmt" + "sync/atomic" +) + +// SubChannel is the channelz representation of a subchannel. +type SubChannel struct { + Entity + // ID is the channelz id of this subchannel. + ID int64 + // RefName is the human readable reference string of this subchannel. + RefName string + closeCalled bool + sockets map[int64]string + parent *Channel + trace *ChannelTrace + traceRefCount int32 + + ChannelMetrics ChannelMetrics +} + +func (sc *SubChannel) String() string { + return fmt.Sprintf("%s SubChannel #%d", sc.parent, sc.ID) +} + +func (sc *SubChannel) id() int64 { + return sc.ID +} + +func (sc *SubChannel) Sockets() map[int64]string { + db.mu.RLock() + defer db.mu.RUnlock() + return copyMap(sc.sockets) +} + +func (sc *SubChannel) Trace() *ChannelTrace { + db.mu.RLock() + defer db.mu.RUnlock() + return sc.trace.copy() +} + +func (sc *SubChannel) addChild(id int64, e entry) { + if v, ok := e.(*Socket); ok && v.SocketType == SocketTypeNormal { + sc.sockets[id] = v.RefName + } else { + logger.Errorf("cannot add a child (id = %d) of type %T to a subChannel", id, e) + } +} + +func (sc *SubChannel) deleteChild(id int64) { + delete(sc.sockets, id) + sc.deleteSelfIfReady() +} + +func (sc *SubChannel) triggerDelete() { + sc.closeCalled = true + sc.deleteSelfIfReady() +} + +func (sc *SubChannel) getParentID() int64 { + return sc.parent.ID +} + +// deleteSelfFromTree tries to delete the subchannel from the channelz entry relation tree, which +// means deleting the subchannel reference from its parent's child list. +// +// In order for a subchannel to be deleted from the tree, it must meet the criteria that, removal of +// the corresponding grpc object has been invoked, and the subchannel does not have any children left. +// +// The returned boolean value indicates whether the channel has been successfully deleted from tree. +func (sc *SubChannel) deleteSelfFromTree() (deleted bool) { + if !sc.closeCalled || len(sc.sockets) != 0 { + return false + } + sc.parent.deleteChild(sc.ID) + return true +} + +// deleteSelfFromMap checks whether it is valid to delete the subchannel from the map, which means +// deleting the subchannel from channelz's tracking entirely. Users can no longer use id to query +// the subchannel, and its memory will be garbage collected. +// +// The trace reference count of the subchannel must be 0 in order to be deleted from the map. This is +// specified in the channel tracing gRFC that as long as some other trace has reference to an entity, +// the trace of the referenced entity must not be deleted. In order to release the resource allocated +// by grpc, the reference to the grpc object is reset to a dummy object. +// +// deleteSelfFromMap must be called after deleteSelfFromTree returns true. +// +// It returns a bool to indicate whether the channel can be safely deleted from map. +func (sc *SubChannel) deleteSelfFromMap() (delete bool) { + return sc.getTraceRefCount() == 0 +} + +// deleteSelfIfReady tries to delete the subchannel itself from the channelz database. +// The delete process includes two steps: +// 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from +// its parent's child list. +// 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup +// by id will return entry not found error. +func (sc *SubChannel) deleteSelfIfReady() { + if !sc.deleteSelfFromTree() { + return + } + if !sc.deleteSelfFromMap() { + return + } + db.deleteEntry(sc.ID) + sc.trace.clear() +} + +func (sc *SubChannel) getChannelTrace() *ChannelTrace { + return sc.trace +} + +func (sc *SubChannel) incrTraceRefCount() { + atomic.AddInt32(&sc.traceRefCount, 1) +} + +func (sc *SubChannel) decrTraceRefCount() { + atomic.AddInt32(&sc.traceRefCount, -1) +} + +func (sc *SubChannel) getTraceRefCount() int { + i := atomic.LoadInt32(&sc.traceRefCount) + return int(i) +} + +func (sc *SubChannel) getRefName() string { + return sc.RefName +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types_linux.go b/vendor/google.golang.org/grpc/internal/channelz/syscall_linux.go similarity index 83% rename from vendor/google.golang.org/grpc/internal/channelz/types_linux.go rename to vendor/google.golang.org/grpc/internal/channelz/syscall_linux.go index 1b1c4cce3..5ac73ff83 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/types_linux.go +++ b/vendor/google.golang.org/grpc/internal/channelz/syscall_linux.go @@ -49,3 +49,17 @@ func (s *SocketOptionData) Getsockopt(fd uintptr) { s.TCPInfo = v } } + +// GetSocketOption gets the socket option info of the conn. +func GetSocketOption(socket any) *SocketOptionData { + c, ok := socket.(syscall.Conn) + if !ok { + return nil + } + data := &SocketOptionData{} + if rawConn, err := c.SyscallConn(); err == nil { + rawConn.Control(data.Getsockopt) + return data + } + return nil +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go b/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go similarity index 90% rename from vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go rename to vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go index 8b06eed1a..d1ed8df6a 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/types_nonlinux.go +++ b/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux /* * @@ -41,3 +40,8 @@ func (s *SocketOptionData) Getsockopt(fd uintptr) { logger.Warning("Channelz: socket options are not supported on non-linux environments") }) } + +// GetSocketOption gets the socket option info of the conn. +func GetSocketOption(c any) *SocketOptionData { + return nil +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/trace.go b/vendor/google.golang.org/grpc/internal/channelz/trace.go new file mode 100644 index 000000000..36b867403 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/channelz/trace.go @@ -0,0 +1,204 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package channelz + +import ( + "fmt" + "sync" + "sync/atomic" + "time" + + "google.golang.org/grpc/grpclog" +) + +const ( + defaultMaxTraceEntry int32 = 30 +) + +var maxTraceEntry = defaultMaxTraceEntry + +// SetMaxTraceEntry sets maximum number of trace entries per entity (i.e. +// channel/subchannel). Setting it to 0 will disable channel tracing. +func SetMaxTraceEntry(i int32) { + atomic.StoreInt32(&maxTraceEntry, i) +} + +// ResetMaxTraceEntryToDefault resets the maximum number of trace entries per +// entity to default. +func ResetMaxTraceEntryToDefault() { + atomic.StoreInt32(&maxTraceEntry, defaultMaxTraceEntry) +} + +func getMaxTraceEntry() int { + i := atomic.LoadInt32(&maxTraceEntry) + return int(i) +} + +// traceEvent is an internal representation of a single trace event +type traceEvent struct { + // Desc is a simple description of the trace event. + Desc string + // Severity states the severity of this trace event. + Severity Severity + // Timestamp is the event time. + Timestamp time.Time + // RefID is the id of the entity that gets referenced in the event. RefID is 0 if no other entity is + // involved in this event. + // e.g. SubChannel (id: 4[]) Created. --> RefID = 4, RefName = "" (inside []) + RefID int64 + // RefName is the reference name for the entity that gets referenced in the event. + RefName string + // RefType indicates the referenced entity type, i.e Channel or SubChannel. + RefType RefChannelType +} + +// TraceEvent is what the caller of AddTraceEvent should provide to describe the +// event to be added to the channel trace. +// +// The Parent field is optional. It is used for an event that will be recorded +// in the entity's parent trace. +type TraceEvent struct { + Desc string + Severity Severity + Parent *TraceEvent +} + +type ChannelTrace struct { + cm *channelMap + clearCalled bool + CreationTime time.Time + EventNum int64 + mu sync.Mutex + Events []*traceEvent +} + +func (c *ChannelTrace) copy() *ChannelTrace { + return &ChannelTrace{ + CreationTime: c.CreationTime, + EventNum: c.EventNum, + Events: append(([]*traceEvent)(nil), c.Events...), + } +} + +func (c *ChannelTrace) append(e *traceEvent) { + c.mu.Lock() + if len(c.Events) == getMaxTraceEntry() { + del := c.Events[0] + c.Events = c.Events[1:] + if del.RefID != 0 { + // start recursive cleanup in a goroutine to not block the call originated from grpc. + go func() { + // need to acquire c.cm.mu lock to call the unlocked attemptCleanup func. + c.cm.mu.Lock() + c.cm.decrTraceRefCount(del.RefID) + c.cm.mu.Unlock() + }() + } + } + e.Timestamp = time.Now() + c.Events = append(c.Events, e) + c.EventNum++ + c.mu.Unlock() +} + +func (c *ChannelTrace) clear() { + if c.clearCalled { + return + } + c.clearCalled = true + c.mu.Lock() + for _, e := range c.Events { + if e.RefID != 0 { + // caller should have already held the c.cm.mu lock. + c.cm.decrTraceRefCount(e.RefID) + } + } + c.mu.Unlock() +} + +// Severity is the severity level of a trace event. +// The canonical enumeration of all valid values is here: +// https://github.com/grpc/grpc-proto/blob/9b13d199cc0d4703c7ea26c9c330ba695866eb23/grpc/channelz/v1/channelz.proto#L126. +type Severity int + +const ( + // CtUnknown indicates unknown severity of a trace event. + CtUnknown Severity = iota + // CtInfo indicates info level severity of a trace event. + CtInfo + // CtWarning indicates warning level severity of a trace event. + CtWarning + // CtError indicates error level severity of a trace event. + CtError +) + +// RefChannelType is the type of the entity being referenced in a trace event. +type RefChannelType int + +const ( + // RefUnknown indicates an unknown entity type, the zero value for this type. + RefUnknown RefChannelType = iota + // RefChannel indicates the referenced entity is a Channel. + RefChannel + // RefSubChannel indicates the referenced entity is a SubChannel. + RefSubChannel + // RefServer indicates the referenced entity is a Server. + RefServer + // RefListenSocket indicates the referenced entity is a ListenSocket. + RefListenSocket + // RefNormalSocket indicates the referenced entity is a NormalSocket. + RefNormalSocket +) + +var refChannelTypeToString = map[RefChannelType]string{ + RefUnknown: "Unknown", + RefChannel: "Channel", + RefSubChannel: "SubChannel", + RefServer: "Server", + RefListenSocket: "ListenSocket", + RefNormalSocket: "NormalSocket", +} + +func (r RefChannelType) String() string { + return refChannelTypeToString[r] +} + +// AddTraceEvent adds trace related to the entity with specified id, using the +// provided TraceEventDesc. +// +// If channelz is not turned ON, this will simply log the event descriptions. +func AddTraceEvent(l grpclog.DepthLoggerV2, e Entity, depth int, desc *TraceEvent) { + // Log only the trace description associated with the bottom most entity. + d := fmt.Sprintf("[%s]%s", e, desc.Desc) + switch desc.Severity { + case CtUnknown, CtInfo: + l.InfoDepth(depth+1, d) + case CtWarning: + l.WarningDepth(depth+1, d) + case CtError: + l.ErrorDepth(depth+1, d) + } + + if getMaxTraceEntry() == 0 { + return + } + if IsOn() { + db.traceEvent(e.id(), desc) + } +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/types.go b/vendor/google.golang.org/grpc/internal/channelz/types.go deleted file mode 100644 index 1d4020f53..000000000 --- a/vendor/google.golang.org/grpc/internal/channelz/types.go +++ /dev/null @@ -1,727 +0,0 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package channelz - -import ( - "net" - "sync" - "sync/atomic" - "time" - - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/credentials" -) - -// entry represents a node in the channelz database. -type entry interface { - // addChild adds a child e, whose channelz id is id to child list - addChild(id int64, e entry) - // deleteChild deletes a child with channelz id to be id from child list - deleteChild(id int64) - // triggerDelete tries to delete self from channelz database. However, if child - // list is not empty, then deletion from the database is on hold until the last - // child is deleted from database. - triggerDelete() - // deleteSelfIfReady check whether triggerDelete() has been called before, and whether child - // list is now empty. If both conditions are met, then delete self from database. - deleteSelfIfReady() - // getParentID returns parent ID of the entry. 0 value parent ID means no parent. - getParentID() int64 -} - -// dummyEntry is a fake entry to handle entry not found case. -type dummyEntry struct { - idNotFound int64 -} - -func (d *dummyEntry) addChild(id int64, e entry) { - // Note: It is possible for a normal program to reach here under race condition. - // For example, there could be a race between ClientConn.Close() info being propagated - // to addrConn and http2Client. ClientConn.Close() cancel the context and result - // in http2Client to error. The error info is then caught by transport monitor - // and before addrConn.tearDown() is called in side ClientConn.Close(). Therefore, - // the addrConn will create a new transport. And when registering the new transport in - // channelz, its parent addrConn could have already been torn down and deleted - // from channelz tracking, and thus reach the code here. - logger.Infof("attempt to add child of type %T with id %d to a parent (id=%d) that doesn't currently exist", e, id, d.idNotFound) -} - -func (d *dummyEntry) deleteChild(id int64) { - // It is possible for a normal program to reach here under race condition. - // Refer to the example described in addChild(). - logger.Infof("attempt to delete child with id %d from a parent (id=%d) that doesn't currently exist", id, d.idNotFound) -} - -func (d *dummyEntry) triggerDelete() { - logger.Warningf("attempt to delete an entry (id=%d) that doesn't currently exist", d.idNotFound) -} - -func (*dummyEntry) deleteSelfIfReady() { - // code should not reach here. deleteSelfIfReady is always called on an existing entry. -} - -func (*dummyEntry) getParentID() int64 { - return 0 -} - -// ChannelMetric defines the info channelz provides for a specific Channel, which -// includes ChannelInternalMetric and channelz-specific data, such as channelz id, -// child list, etc. -type ChannelMetric struct { - // ID is the channelz id of this channel. - ID int64 - // RefName is the human readable reference string of this channel. - RefName string - // ChannelData contains channel internal metric reported by the channel through - // ChannelzMetric(). - ChannelData *ChannelInternalMetric - // NestedChans tracks the nested channel type children of this channel in the format of - // a map from nested channel channelz id to corresponding reference string. - NestedChans map[int64]string - // SubChans tracks the subchannel type children of this channel in the format of a - // map from subchannel channelz id to corresponding reference string. - SubChans map[int64]string - // Sockets tracks the socket type children of this channel in the format of a map - // from socket channelz id to corresponding reference string. - // Note current grpc implementation doesn't allow channel having sockets directly, - // therefore, this is field is unused. - Sockets map[int64]string - // Trace contains the most recent traced events. - Trace *ChannelTrace -} - -// SubChannelMetric defines the info channelz provides for a specific SubChannel, -// which includes ChannelInternalMetric and channelz-specific data, such as -// channelz id, child list, etc. -type SubChannelMetric struct { - // ID is the channelz id of this subchannel. - ID int64 - // RefName is the human readable reference string of this subchannel. - RefName string - // ChannelData contains subchannel internal metric reported by the subchannel - // through ChannelzMetric(). - ChannelData *ChannelInternalMetric - // NestedChans tracks the nested channel type children of this subchannel in the format of - // a map from nested channel channelz id to corresponding reference string. - // Note current grpc implementation doesn't allow subchannel to have nested channels - // as children, therefore, this field is unused. - NestedChans map[int64]string - // SubChans tracks the subchannel type children of this subchannel in the format of a - // map from subchannel channelz id to corresponding reference string. - // Note current grpc implementation doesn't allow subchannel to have subchannels - // as children, therefore, this field is unused. - SubChans map[int64]string - // Sockets tracks the socket type children of this subchannel in the format of a map - // from socket channelz id to corresponding reference string. - Sockets map[int64]string - // Trace contains the most recent traced events. - Trace *ChannelTrace -} - -// ChannelInternalMetric defines the struct that the implementor of Channel interface -// should return from ChannelzMetric(). -type ChannelInternalMetric struct { - // current connectivity state of the channel. - State connectivity.State - // The target this channel originally tried to connect to. May be absent - Target string - // The number of calls started on the channel. - CallsStarted int64 - // The number of calls that have completed with an OK status. - CallsSucceeded int64 - // The number of calls that have a completed with a non-OK status. - CallsFailed int64 - // The last time a call was started on the channel. - LastCallStartedTimestamp time.Time -} - -// ChannelTrace stores traced events on a channel/subchannel and related info. -type ChannelTrace struct { - // EventNum is the number of events that ever got traced (i.e. including those that have been deleted) - EventNum int64 - // CreationTime is the creation time of the trace. - CreationTime time.Time - // Events stores the most recent trace events (up to $maxTraceEntry, newer event will overwrite the - // oldest one) - Events []*TraceEvent -} - -// TraceEvent represent a single trace event -type TraceEvent struct { - // Desc is a simple description of the trace event. - Desc string - // Severity states the severity of this trace event. - Severity Severity - // Timestamp is the event time. - Timestamp time.Time - // RefID is the id of the entity that gets referenced in the event. RefID is 0 if no other entity is - // involved in this event. - // e.g. SubChannel (id: 4[]) Created. --> RefID = 4, RefName = "" (inside []) - RefID int64 - // RefName is the reference name for the entity that gets referenced in the event. - RefName string - // RefType indicates the referenced entity type, i.e Channel or SubChannel. - RefType RefChannelType -} - -// Channel is the interface that should be satisfied in order to be tracked by -// channelz as Channel or SubChannel. -type Channel interface { - ChannelzMetric() *ChannelInternalMetric -} - -type dummyChannel struct{} - -func (d *dummyChannel) ChannelzMetric() *ChannelInternalMetric { - return &ChannelInternalMetric{} -} - -type channel struct { - refName string - c Channel - closeCalled bool - nestedChans map[int64]string - subChans map[int64]string - id int64 - pid int64 - cm *channelMap - trace *channelTrace - // traceRefCount is the number of trace events that reference this channel. - // Non-zero traceRefCount means the trace of this channel cannot be deleted. - traceRefCount int32 -} - -func (c *channel) addChild(id int64, e entry) { - switch v := e.(type) { - case *subChannel: - c.subChans[id] = v.refName - case *channel: - c.nestedChans[id] = v.refName - default: - logger.Errorf("cannot add a child (id = %d) of type %T to a channel", id, e) - } -} - -func (c *channel) deleteChild(id int64) { - delete(c.subChans, id) - delete(c.nestedChans, id) - c.deleteSelfIfReady() -} - -func (c *channel) triggerDelete() { - c.closeCalled = true - c.deleteSelfIfReady() -} - -func (c *channel) getParentID() int64 { - return c.pid -} - -// deleteSelfFromTree tries to delete the channel from the channelz entry relation tree, which means -// deleting the channel reference from its parent's child list. -// -// In order for a channel to be deleted from the tree, it must meet the criteria that, removal of the -// corresponding grpc object has been invoked, and the channel does not have any children left. -// -// The returned boolean value indicates whether the channel has been successfully deleted from tree. -func (c *channel) deleteSelfFromTree() (deleted bool) { - if !c.closeCalled || len(c.subChans)+len(c.nestedChans) != 0 { - return false - } - // not top channel - if c.pid != 0 { - c.cm.findEntry(c.pid).deleteChild(c.id) - } - return true -} - -// deleteSelfFromMap checks whether it is valid to delete the channel from the map, which means -// deleting the channel from channelz's tracking entirely. Users can no longer use id to query the -// channel, and its memory will be garbage collected. -// -// The trace reference count of the channel must be 0 in order to be deleted from the map. This is -// specified in the channel tracing gRFC that as long as some other trace has reference to an entity, -// the trace of the referenced entity must not be deleted. In order to release the resource allocated -// by grpc, the reference to the grpc object is reset to a dummy object. -// -// deleteSelfFromMap must be called after deleteSelfFromTree returns true. -// -// It returns a bool to indicate whether the channel can be safely deleted from map. -func (c *channel) deleteSelfFromMap() (delete bool) { - if c.getTraceRefCount() != 0 { - c.c = &dummyChannel{} - return false - } - return true -} - -// deleteSelfIfReady tries to delete the channel itself from the channelz database. -// The delete process includes two steps: -// 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its -// parent's child list. -// 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id -// will return entry not found error. -func (c *channel) deleteSelfIfReady() { - if !c.deleteSelfFromTree() { - return - } - if !c.deleteSelfFromMap() { - return - } - c.cm.deleteEntry(c.id) - c.trace.clear() -} - -func (c *channel) getChannelTrace() *channelTrace { - return c.trace -} - -func (c *channel) incrTraceRefCount() { - atomic.AddInt32(&c.traceRefCount, 1) -} - -func (c *channel) decrTraceRefCount() { - atomic.AddInt32(&c.traceRefCount, -1) -} - -func (c *channel) getTraceRefCount() int { - i := atomic.LoadInt32(&c.traceRefCount) - return int(i) -} - -func (c *channel) getRefName() string { - return c.refName -} - -type subChannel struct { - refName string - c Channel - closeCalled bool - sockets map[int64]string - id int64 - pid int64 - cm *channelMap - trace *channelTrace - traceRefCount int32 -} - -func (sc *subChannel) addChild(id int64, e entry) { - if v, ok := e.(*normalSocket); ok { - sc.sockets[id] = v.refName - } else { - logger.Errorf("cannot add a child (id = %d) of type %T to a subChannel", id, e) - } -} - -func (sc *subChannel) deleteChild(id int64) { - delete(sc.sockets, id) - sc.deleteSelfIfReady() -} - -func (sc *subChannel) triggerDelete() { - sc.closeCalled = true - sc.deleteSelfIfReady() -} - -func (sc *subChannel) getParentID() int64 { - return sc.pid -} - -// deleteSelfFromTree tries to delete the subchannel from the channelz entry relation tree, which -// means deleting the subchannel reference from its parent's child list. -// -// In order for a subchannel to be deleted from the tree, it must meet the criteria that, removal of -// the corresponding grpc object has been invoked, and the subchannel does not have any children left. -// -// The returned boolean value indicates whether the channel has been successfully deleted from tree. -func (sc *subChannel) deleteSelfFromTree() (deleted bool) { - if !sc.closeCalled || len(sc.sockets) != 0 { - return false - } - sc.cm.findEntry(sc.pid).deleteChild(sc.id) - return true -} - -// deleteSelfFromMap checks whether it is valid to delete the subchannel from the map, which means -// deleting the subchannel from channelz's tracking entirely. Users can no longer use id to query -// the subchannel, and its memory will be garbage collected. -// -// The trace reference count of the subchannel must be 0 in order to be deleted from the map. This is -// specified in the channel tracing gRFC that as long as some other trace has reference to an entity, -// the trace of the referenced entity must not be deleted. In order to release the resource allocated -// by grpc, the reference to the grpc object is reset to a dummy object. -// -// deleteSelfFromMap must be called after deleteSelfFromTree returns true. -// -// It returns a bool to indicate whether the channel can be safely deleted from map. -func (sc *subChannel) deleteSelfFromMap() (delete bool) { - if sc.getTraceRefCount() != 0 { - // free the grpc struct (i.e. addrConn) - sc.c = &dummyChannel{} - return false - } - return true -} - -// deleteSelfIfReady tries to delete the subchannel itself from the channelz database. -// The delete process includes two steps: -// 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from -// its parent's child list. -// 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup -// by id will return entry not found error. -func (sc *subChannel) deleteSelfIfReady() { - if !sc.deleteSelfFromTree() { - return - } - if !sc.deleteSelfFromMap() { - return - } - sc.cm.deleteEntry(sc.id) - sc.trace.clear() -} - -func (sc *subChannel) getChannelTrace() *channelTrace { - return sc.trace -} - -func (sc *subChannel) incrTraceRefCount() { - atomic.AddInt32(&sc.traceRefCount, 1) -} - -func (sc *subChannel) decrTraceRefCount() { - atomic.AddInt32(&sc.traceRefCount, -1) -} - -func (sc *subChannel) getTraceRefCount() int { - i := atomic.LoadInt32(&sc.traceRefCount) - return int(i) -} - -func (sc *subChannel) getRefName() string { - return sc.refName -} - -// SocketMetric defines the info channelz provides for a specific Socket, which -// includes SocketInternalMetric and channelz-specific data, such as channelz id, etc. -type SocketMetric struct { - // ID is the channelz id of this socket. - ID int64 - // RefName is the human readable reference string of this socket. - RefName string - // SocketData contains socket internal metric reported by the socket through - // ChannelzMetric(). - SocketData *SocketInternalMetric -} - -// SocketInternalMetric defines the struct that the implementor of Socket interface -// should return from ChannelzMetric(). -type SocketInternalMetric struct { - // The number of streams that have been started. - StreamsStarted int64 - // The number of streams that have ended successfully: - // On client side, receiving frame with eos bit set. - // On server side, sending frame with eos bit set. - StreamsSucceeded int64 - // The number of streams that have ended unsuccessfully: - // On client side, termination without receiving frame with eos bit set. - // On server side, termination without sending frame with eos bit set. - StreamsFailed int64 - // The number of messages successfully sent on this socket. - MessagesSent int64 - MessagesReceived int64 - // The number of keep alives sent. This is typically implemented with HTTP/2 - // ping messages. - KeepAlivesSent int64 - // The last time a stream was created by this endpoint. Usually unset for - // servers. - LastLocalStreamCreatedTimestamp time.Time - // The last time a stream was created by the remote endpoint. Usually unset - // for clients. - LastRemoteStreamCreatedTimestamp time.Time - // The last time a message was sent by this endpoint. - LastMessageSentTimestamp time.Time - // The last time a message was received by this endpoint. - LastMessageReceivedTimestamp time.Time - // The amount of window, granted to the local endpoint by the remote endpoint. - // This may be slightly out of date due to network latency. This does NOT - // include stream level or TCP level flow control info. - LocalFlowControlWindow int64 - // The amount of window, granted to the remote endpoint by the local endpoint. - // This may be slightly out of date due to network latency. This does NOT - // include stream level or TCP level flow control info. - RemoteFlowControlWindow int64 - // The locally bound address. - LocalAddr net.Addr - // The remote bound address. May be absent. - RemoteAddr net.Addr - // Optional, represents the name of the remote endpoint, if different than - // the original target name. - RemoteName string - SocketOptions *SocketOptionData - Security credentials.ChannelzSecurityValue -} - -// Socket is the interface that should be satisfied in order to be tracked by -// channelz as Socket. -type Socket interface { - ChannelzMetric() *SocketInternalMetric -} - -type listenSocket struct { - refName string - s Socket - id int64 - pid int64 - cm *channelMap -} - -func (ls *listenSocket) addChild(id int64, e entry) { - logger.Errorf("cannot add a child (id = %d) of type %T to a listen socket", id, e) -} - -func (ls *listenSocket) deleteChild(id int64) { - logger.Errorf("cannot delete a child (id = %d) from a listen socket", id) -} - -func (ls *listenSocket) triggerDelete() { - ls.cm.deleteEntry(ls.id) - ls.cm.findEntry(ls.pid).deleteChild(ls.id) -} - -func (ls *listenSocket) deleteSelfIfReady() { - logger.Errorf("cannot call deleteSelfIfReady on a listen socket") -} - -func (ls *listenSocket) getParentID() int64 { - return ls.pid -} - -type normalSocket struct { - refName string - s Socket - id int64 - pid int64 - cm *channelMap -} - -func (ns *normalSocket) addChild(id int64, e entry) { - logger.Errorf("cannot add a child (id = %d) of type %T to a normal socket", id, e) -} - -func (ns *normalSocket) deleteChild(id int64) { - logger.Errorf("cannot delete a child (id = %d) from a normal socket", id) -} - -func (ns *normalSocket) triggerDelete() { - ns.cm.deleteEntry(ns.id) - ns.cm.findEntry(ns.pid).deleteChild(ns.id) -} - -func (ns *normalSocket) deleteSelfIfReady() { - logger.Errorf("cannot call deleteSelfIfReady on a normal socket") -} - -func (ns *normalSocket) getParentID() int64 { - return ns.pid -} - -// ServerMetric defines the info channelz provides for a specific Server, which -// includes ServerInternalMetric and channelz-specific data, such as channelz id, -// child list, etc. -type ServerMetric struct { - // ID is the channelz id of this server. - ID int64 - // RefName is the human readable reference string of this server. - RefName string - // ServerData contains server internal metric reported by the server through - // ChannelzMetric(). - ServerData *ServerInternalMetric - // ListenSockets tracks the listener socket type children of this server in the - // format of a map from socket channelz id to corresponding reference string. - ListenSockets map[int64]string -} - -// ServerInternalMetric defines the struct that the implementor of Server interface -// should return from ChannelzMetric(). -type ServerInternalMetric struct { - // The number of incoming calls started on the server. - CallsStarted int64 - // The number of incoming calls that have completed with an OK status. - CallsSucceeded int64 - // The number of incoming calls that have a completed with a non-OK status. - CallsFailed int64 - // The last time a call was started on the server. - LastCallStartedTimestamp time.Time -} - -// Server is the interface to be satisfied in order to be tracked by channelz as -// Server. -type Server interface { - ChannelzMetric() *ServerInternalMetric -} - -type server struct { - refName string - s Server - closeCalled bool - sockets map[int64]string - listenSockets map[int64]string - id int64 - cm *channelMap -} - -func (s *server) addChild(id int64, e entry) { - switch v := e.(type) { - case *normalSocket: - s.sockets[id] = v.refName - case *listenSocket: - s.listenSockets[id] = v.refName - default: - logger.Errorf("cannot add a child (id = %d) of type %T to a server", id, e) - } -} - -func (s *server) deleteChild(id int64) { - delete(s.sockets, id) - delete(s.listenSockets, id) - s.deleteSelfIfReady() -} - -func (s *server) triggerDelete() { - s.closeCalled = true - s.deleteSelfIfReady() -} - -func (s *server) deleteSelfIfReady() { - if !s.closeCalled || len(s.sockets)+len(s.listenSockets) != 0 { - return - } - s.cm.deleteEntry(s.id) -} - -func (s *server) getParentID() int64 { - return 0 -} - -type tracedChannel interface { - getChannelTrace() *channelTrace - incrTraceRefCount() - decrTraceRefCount() - getRefName() string -} - -type channelTrace struct { - cm *channelMap - clearCalled bool - createdTime time.Time - eventCount int64 - mu sync.Mutex - events []*TraceEvent -} - -func (c *channelTrace) append(e *TraceEvent) { - c.mu.Lock() - if len(c.events) == getMaxTraceEntry() { - del := c.events[0] - c.events = c.events[1:] - if del.RefID != 0 { - // start recursive cleanup in a goroutine to not block the call originated from grpc. - go func() { - // need to acquire c.cm.mu lock to call the unlocked attemptCleanup func. - c.cm.mu.Lock() - c.cm.decrTraceRefCount(del.RefID) - c.cm.mu.Unlock() - }() - } - } - e.Timestamp = time.Now() - c.events = append(c.events, e) - c.eventCount++ - c.mu.Unlock() -} - -func (c *channelTrace) clear() { - if c.clearCalled { - return - } - c.clearCalled = true - c.mu.Lock() - for _, e := range c.events { - if e.RefID != 0 { - // caller should have already held the c.cm.mu lock. - c.cm.decrTraceRefCount(e.RefID) - } - } - c.mu.Unlock() -} - -// Severity is the severity level of a trace event. -// The canonical enumeration of all valid values is here: -// https://github.com/grpc/grpc-proto/blob/9b13d199cc0d4703c7ea26c9c330ba695866eb23/grpc/channelz/v1/channelz.proto#L126. -type Severity int - -const ( - // CtUnknown indicates unknown severity of a trace event. - CtUnknown Severity = iota - // CtInfo indicates info level severity of a trace event. - CtInfo - // CtWarning indicates warning level severity of a trace event. - CtWarning - // CtError indicates error level severity of a trace event. - CtError -) - -// RefChannelType is the type of the entity being referenced in a trace event. -type RefChannelType int - -const ( - // RefUnknown indicates an unknown entity type, the zero value for this type. - RefUnknown RefChannelType = iota - // RefChannel indicates the referenced entity is a Channel. - RefChannel - // RefSubChannel indicates the referenced entity is a SubChannel. - RefSubChannel - // RefServer indicates the referenced entity is a Server. - RefServer - // RefListenSocket indicates the referenced entity is a ListenSocket. - RefListenSocket - // RefNormalSocket indicates the referenced entity is a NormalSocket. - RefNormalSocket -) - -var refChannelTypeToString = map[RefChannelType]string{ - RefUnknown: "Unknown", - RefChannel: "Channel", - RefSubChannel: "SubChannel", - RefServer: "Server", - RefListenSocket: "ListenSocket", - RefNormalSocket: "NormalSocket", -} - -func (r RefChannelType) String() string { - return refChannelTypeToString[r] -} - -func (c *channelTrace) dumpData() *ChannelTrace { - c.mu.Lock() - ct := &ChannelTrace{EventNum: c.eventCount, CreationTime: c.createdTime} - ct.Events = c.events[:len(c.events)] - c.mu.Unlock() - return ct -} diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index 3cf10ddfb..d90648713 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -28,17 +28,11 @@ import ( var ( // TXTErrIgnore is set if TXT errors should be ignored ("GRPC_GO_IGNORE_TXT_ERRORS" is not "false"). TXTErrIgnore = boolFromEnv("GRPC_GO_IGNORE_TXT_ERRORS", true) - // AdvertiseCompressors is set if registered compressor should be advertised - // ("GRPC_GO_ADVERTISE_COMPRESSORS" is not "false"). - AdvertiseCompressors = boolFromEnv("GRPC_GO_ADVERTISE_COMPRESSORS", true) // RingHashCap indicates the maximum ring size which defaults to 4096 // entries but may be overridden by setting the environment variable // "GRPC_RING_HASH_CAP". This does not override the default bounds // checking which NACKs configs specifying ring sizes > 8*1024*1024 (~8M). RingHashCap = uint64FromEnv("GRPC_RING_HASH_CAP", 4096, 1, 8*1024*1024) - // PickFirstLBConfig is set if we should support configuration of the - // pick_first LB policy. - PickFirstLBConfig = boolFromEnv("GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG", true) // LeastRequestLB is set if we should support the least_request_experimental // LB policy, which can be enabled by setting the environment variable // "GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST" to "true". @@ -46,6 +40,12 @@ var ( // ALTSMaxConcurrentHandshakes is the maximum number of concurrent ALTS // handshakes that can be performed. ALTSMaxConcurrentHandshakes = uint64FromEnv("GRPC_ALTS_MAX_CONCURRENT_HANDSHAKES", 100, 1, 100) + // EnforceALPNEnabled is set if TLS connections to servers with ALPN disabled + // should be rejected. The HTTP/2 protocol requires ALPN to be enabled, this + // option is present for backward compatibility. This option may be overridden + // by setting the environment variable "GRPC_ENFORCE_ALPN_ENABLED" to "true" + // or "false". + EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", false) ) func boolFromEnv(envVar string, def bool) bool { diff --git a/vendor/google.golang.org/grpc/internal/envconfig/xds.go b/vendor/google.golang.org/grpc/internal/envconfig/xds.go index 02b4b6a1c..29f234acb 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/xds.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/xds.go @@ -50,46 +50,7 @@ var ( // // When both bootstrap FileName and FileContent are set, FileName is used. XDSBootstrapFileContent = os.Getenv(XDSBootstrapFileContentEnv) - // XDSRingHash indicates whether ring hash support is enabled, which can be - // disabled by setting the environment variable - // "GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH" to "false". - XDSRingHash = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH", true) - // XDSClientSideSecurity is used to control processing of security - // configuration on the client-side. - // - // Note that there is no env var protection for the server-side because we - // have a brand new API on the server-side and users explicitly need to use - // the new API to get security integration on the server. - XDSClientSideSecurity = boolFromEnv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT", true) - // XDSAggregateAndDNS indicates whether processing of aggregated cluster and - // DNS cluster is enabled, which can be disabled by setting the environment - // variable "GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER" - // to "false". - XDSAggregateAndDNS = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER", true) - - // XDSRBAC indicates whether xDS configured RBAC HTTP Filter is enabled, - // which can be disabled by setting the environment variable - // "GRPC_XDS_EXPERIMENTAL_RBAC" to "false". - XDSRBAC = boolFromEnv("GRPC_XDS_EXPERIMENTAL_RBAC", true) - // XDSOutlierDetection indicates whether outlier detection support is - // enabled, which can be disabled by setting the environment variable - // "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "false". - XDSOutlierDetection = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION", true) - // XDSFederation indicates whether federation support is enabled, which can - // be enabled by setting the environment variable - // "GRPC_EXPERIMENTAL_XDS_FEDERATION" to "true". - XDSFederation = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FEDERATION", true) - - // XDSRLS indicates whether processing of Cluster Specifier plugins and - // support for the RLS CLuster Specifier is enabled, which can be disabled by - // setting the environment variable "GRPC_EXPERIMENTAL_XDS_RLS_LB" to - // "false". - XDSRLS = boolFromEnv("GRPC_EXPERIMENTAL_XDS_RLS_LB", true) // C2PResolverTestOnlyTrafficDirectorURI is the TD URI for testing. C2PResolverTestOnlyTrafficDirectorURI = os.Getenv("GRPC_TEST_ONLY_GOOGLE_C2P_RESOLVER_TRAFFIC_DIRECTOR_URI") - // XDSCustomLBPolicy indicates whether Custom LB Policies are enabled, which - // can be disabled by setting the environment variable - // "GRPC_EXPERIMENTAL_XDS_CUSTOM_LB_CONFIG" to "false". - XDSCustomLBPolicy = boolFromEnv("GRPC_EXPERIMENTAL_XDS_CUSTOM_LB_CONFIG", true) ) diff --git a/vendor/google.golang.org/grpc/internal/experimental.go b/vendor/google.golang.org/grpc/internal/experimental.go new file mode 100644 index 000000000..7f7044e17 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/experimental.go @@ -0,0 +1,28 @@ +/* + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package internal + +var ( + // WithRecvBufferPool is implemented by the grpc package and returns a dial + // option to configure a shared buffer pool for a grpc.ClientConn. + WithRecvBufferPool any // func (grpc.SharedBufferPool) grpc.DialOption + + // RecvBufferPool is implemented by the grpc package and returns a server + // option to configure a shared buffer pool for a grpc.Server. + RecvBufferPool any // func (grpc.SharedBufferPool) grpc.ServerOption +) diff --git a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go b/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go deleted file mode 100644 index aa97273e7..000000000 --- a/vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go +++ /dev/null @@ -1,95 +0,0 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// Package grpcrand implements math/rand functions in a concurrent-safe way -// with a global random source, independent of math/rand's global source. -package grpcrand - -import ( - "math/rand" - "sync" - "time" -) - -var ( - r = rand.New(rand.NewSource(time.Now().UnixNano())) - mu sync.Mutex -) - -// Int implements rand.Int on the grpcrand global source. -func Int() int { - mu.Lock() - defer mu.Unlock() - return r.Int() -} - -// Int63n implements rand.Int63n on the grpcrand global source. -func Int63n(n int64) int64 { - mu.Lock() - defer mu.Unlock() - return r.Int63n(n) -} - -// Intn implements rand.Intn on the grpcrand global source. -func Intn(n int) int { - mu.Lock() - defer mu.Unlock() - return r.Intn(n) -} - -// Int31n implements rand.Int31n on the grpcrand global source. -func Int31n(n int32) int32 { - mu.Lock() - defer mu.Unlock() - return r.Int31n(n) -} - -// Float64 implements rand.Float64 on the grpcrand global source. -func Float64() float64 { - mu.Lock() - defer mu.Unlock() - return r.Float64() -} - -// Uint64 implements rand.Uint64 on the grpcrand global source. -func Uint64() uint64 { - mu.Lock() - defer mu.Unlock() - return r.Uint64() -} - -// Uint32 implements rand.Uint32 on the grpcrand global source. -func Uint32() uint32 { - mu.Lock() - defer mu.Unlock() - return r.Uint32() -} - -// ExpFloat64 implements rand.ExpFloat64 on the grpcrand global source. -func ExpFloat64() float64 { - mu.Lock() - defer mu.Unlock() - return r.ExpFloat64() -} - -// Shuffle implements rand.Shuffle on the grpcrand global source. -var Shuffle = func(n int, f func(int, int)) { - mu.Lock() - defer mu.Unlock() - r.Shuffle(n, f) -} diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go index 900917dbe..f7f40a16a 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go @@ -20,7 +20,6 @@ package grpcsync import ( "context" - "sync" "google.golang.org/grpc/internal/buffer" ) @@ -38,8 +37,6 @@ type CallbackSerializer struct { done chan struct{} callbacks *buffer.Unbounded - closedMu sync.Mutex - closed bool } // NewCallbackSerializer returns a new CallbackSerializer instance. The provided @@ -65,56 +62,34 @@ func NewCallbackSerializer(ctx context.Context) *CallbackSerializer { // callbacks to be executed by the serializer. It is not possible to add // callbacks once the context passed to NewCallbackSerializer is cancelled. func (cs *CallbackSerializer) Schedule(f func(ctx context.Context)) bool { - cs.closedMu.Lock() - defer cs.closedMu.Unlock() - - if cs.closed { - return false - } - cs.callbacks.Put(f) - return true + return cs.callbacks.Put(f) == nil } func (cs *CallbackSerializer) run(ctx context.Context) { - var backlog []func(context.Context) - defer close(cs.done) + + // TODO: when Go 1.21 is the oldest supported version, this loop and Close + // can be replaced with: + // + // context.AfterFunc(ctx, cs.callbacks.Close) for ctx.Err() == nil { select { case <-ctx.Done(): // Do nothing here. Next iteration of the for loop will not happen, // since ctx.Err() would be non-nil. - case callback, ok := <-cs.callbacks.Get(): - if !ok { - return - } + case cb := <-cs.callbacks.Get(): cs.callbacks.Load() - callback.(func(ctx context.Context))(ctx) + cb.(func(context.Context))(ctx) } } - // Fetch pending callbacks if any, and execute them before returning from - // this method and closing cs.done. - cs.closedMu.Lock() - cs.closed = true - backlog = cs.fetchPendingCallbacks() + // Close the buffer to prevent new callbacks from being added. cs.callbacks.Close() - cs.closedMu.Unlock() - for _, b := range backlog { - b(ctx) - } -} -func (cs *CallbackSerializer) fetchPendingCallbacks() []func(context.Context) { - var backlog []func(context.Context) - for { - select { - case b := <-cs.callbacks.Get(): - backlog = append(backlog, b.(func(context.Context))) - cs.callbacks.Load() - default: - return backlog - } + // Run all pending callbacks. + for cb := range cs.callbacks.Get() { + cs.callbacks.Load() + cb.(func(context.Context))(ctx) } } diff --git a/vendor/google.golang.org/grpc/internal/grpcutil/compressor.go b/vendor/google.golang.org/grpc/internal/grpcutil/compressor.go index 9f4090967..e8d866984 100644 --- a/vendor/google.golang.org/grpc/internal/grpcutil/compressor.go +++ b/vendor/google.golang.org/grpc/internal/grpcutil/compressor.go @@ -20,8 +20,6 @@ package grpcutil import ( "strings" - - "google.golang.org/grpc/internal/envconfig" ) // RegisteredCompressorNames holds names of the registered compressors. @@ -40,8 +38,5 @@ func IsCompressorNameRegistered(name string) bool { // RegisteredCompressors returns a string of registered compressor names // separated by comma. func RegisteredCompressors() string { - if !envconfig.AdvertiseCompressors { - return "" - } return strings.Join(RegisteredCompressorNames, ",") } diff --git a/vendor/google.golang.org/grpc/internal/idle/idle.go b/vendor/google.golang.org/grpc/internal/idle/idle.go index 6c272476e..fe49cb74c 100644 --- a/vendor/google.golang.org/grpc/internal/idle/idle.go +++ b/vendor/google.golang.org/grpc/internal/idle/idle.go @@ -26,8 +26,6 @@ import ( "sync" "sync/atomic" "time" - - "google.golang.org/grpc/grpclog" ) // For overriding in unit tests. @@ -39,27 +37,12 @@ var timeAfterFunc = func(d time.Duration, f func()) *time.Timer { // and exit from idle mode. type Enforcer interface { ExitIdleMode() error - EnterIdleMode() error -} - -// Manager defines the functionality required to track RPC activity on a -// channel. -type Manager interface { - OnCallBegin() error - OnCallEnd() - Close() + EnterIdleMode() } -type noopManager struct{} - -func (noopManager) OnCallBegin() error { return nil } -func (noopManager) OnCallEnd() {} -func (noopManager) Close() {} - -// manager implements the Manager interface. It uses atomic operations to -// synchronize access to shared state and a mutex to guarantee mutual exclusion -// in a critical section. -type manager struct { +// Manager implements idleness detection and calls the configured Enforcer to +// enter/exit idle mode when appropriate. Must be created by NewManager. +type Manager struct { // State accessed atomically. lastCallEndTime int64 // Unix timestamp in nanos; time when the most recent RPC completed. activeCallsCount int32 // Count of active RPCs; -math.MaxInt32 means channel is idle or is trying to get there. @@ -69,8 +52,7 @@ type manager struct { // Can be accessed without atomics or mutex since these are set at creation // time and read-only after that. enforcer Enforcer // Functionality provided by grpc.ClientConn. - timeout int64 // Idle timeout duration nanos stored as an int64. - logger grpclog.LoggerV2 + timeout time.Duration // idleMu is used to guarantee mutual exclusion in two scenarios: // - Opposing intentions: @@ -88,57 +70,48 @@ type manager struct { timer *time.Timer } -// ManagerOptions is a collection of options used by -// NewManager. -type ManagerOptions struct { - Enforcer Enforcer - Timeout time.Duration - Logger grpclog.LoggerV2 +// NewManager creates a new idleness manager implementation for the +// given idle timeout. It begins in idle mode. +func NewManager(enforcer Enforcer, timeout time.Duration) *Manager { + return &Manager{ + enforcer: enforcer, + timeout: timeout, + actuallyIdle: true, + activeCallsCount: -math.MaxInt32, + } } -// NewManager creates a new idleness manager implementation for the -// given idle timeout. -func NewManager(opts ManagerOptions) Manager { - if opts.Timeout == 0 { - return noopManager{} +// resetIdleTimerLocked resets the idle timer to the given duration. Called +// when exiting idle mode or when the timer fires and we need to reset it. +func (m *Manager) resetIdleTimerLocked(d time.Duration) { + if m.isClosed() || m.timeout == 0 || m.actuallyIdle { + return } - m := &manager{ - enforcer: opts.Enforcer, - timeout: int64(opts.Timeout), - logger: opts.Logger, + // It is safe to ignore the return value from Reset() because this method is + // only ever called from the timer callback or when exiting idle mode. + if m.timer != nil { + m.timer.Stop() } - m.timer = timeAfterFunc(opts.Timeout, m.handleIdleTimeout) - return m + m.timer = timeAfterFunc(d, m.handleIdleTimeout) } -// resetIdleTimer resets the idle timer to the given duration. This method -// should only be called from the timer callback. -func (m *manager) resetIdleTimer(d time.Duration) { +func (m *Manager) resetIdleTimer(d time.Duration) { m.idleMu.Lock() defer m.idleMu.Unlock() - - if m.timer == nil { - // Only close sets timer to nil. We are done. - return - } - - // It is safe to ignore the return value from Reset() because this method is - // only ever called from the timer callback, which means the timer has - // already fired. - m.timer.Reset(d) + m.resetIdleTimerLocked(d) } // handleIdleTimeout is the timer callback that is invoked upon expiry of the // configured idle timeout. The channel is considered inactive if there are no // ongoing calls and no RPC activity since the last time the timer fired. -func (m *manager) handleIdleTimeout() { +func (m *Manager) handleIdleTimeout() { if m.isClosed() { return } if atomic.LoadInt32(&m.activeCallsCount) > 0 { - m.resetIdleTimer(time.Duration(m.timeout)) + m.resetIdleTimer(m.timeout) return } @@ -148,24 +121,12 @@ func (m *manager) handleIdleTimeout() { // Set the timer to fire after a duration of idle timeout, calculated // from the time the most recent RPC completed. atomic.StoreInt32(&m.activeSinceLastTimerCheck, 0) - m.resetIdleTimer(time.Duration(atomic.LoadInt64(&m.lastCallEndTime) + m.timeout - time.Now().UnixNano())) + m.resetIdleTimer(time.Duration(atomic.LoadInt64(&m.lastCallEndTime)-time.Now().UnixNano()) + m.timeout) return } - // This CAS operation is extremely likely to succeed given that there has - // been no activity since the last time we were here. Setting the - // activeCallsCount to -math.MaxInt32 indicates to OnCallBegin() that the - // channel is either in idle mode or is trying to get there. - if !atomic.CompareAndSwapInt32(&m.activeCallsCount, 0, -math.MaxInt32) { - // This CAS operation can fail if an RPC started after we checked for - // activity at the top of this method, or one was ongoing from before - // the last time we were here. In both case, reset the timer and return. - m.resetIdleTimer(time.Duration(m.timeout)) - return - } - - // Now that we've set the active calls count to -math.MaxInt32, it's time to - // actually move to idle mode. + // Now that we've checked that there has been no activity, attempt to enter + // idle mode, which is very likely to succeed. if m.tryEnterIdleMode() { // Successfully entered idle mode. No timer needed until we exit idle. return @@ -174,8 +135,7 @@ func (m *manager) handleIdleTimeout() { // Failed to enter idle mode due to a concurrent RPC that kept the channel // active, or because of an error from the channel. Undo the attempt to // enter idle, and reset the timer to try again later. - atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) - m.resetIdleTimer(time.Duration(m.timeout)) + m.resetIdleTimer(m.timeout) } // tryEnterIdleMode instructs the channel to enter idle mode. But before @@ -185,36 +145,49 @@ func (m *manager) handleIdleTimeout() { // Return value indicates whether or not the channel moved to idle mode. // // Holds idleMu which ensures mutual exclusion with exitIdleMode. -func (m *manager) tryEnterIdleMode() bool { +func (m *Manager) tryEnterIdleMode() bool { + // Setting the activeCallsCount to -math.MaxInt32 indicates to OnCallBegin() + // that the channel is either in idle mode or is trying to get there. + if !atomic.CompareAndSwapInt32(&m.activeCallsCount, 0, -math.MaxInt32) { + // This CAS operation can fail if an RPC started after we checked for + // activity in the timer handler, or one was ongoing from before the + // last time the timer fired, or if a test is attempting to enter idle + // mode without checking. In all cases, abort going into idle mode. + return false + } + // N.B. if we fail to enter idle mode after this, we must re-add + // math.MaxInt32 to m.activeCallsCount. + m.idleMu.Lock() defer m.idleMu.Unlock() if atomic.LoadInt32(&m.activeCallsCount) != -math.MaxInt32 { // We raced and lost to a new RPC. Very rare, but stop entering idle. + atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) return false } if atomic.LoadInt32(&m.activeSinceLastTimerCheck) == 1 { - // An very short RPC could have come in (and also finished) after we + // A very short RPC could have come in (and also finished) after we // checked for calls count and activity in handleIdleTimeout(), but // before the CAS operation. So, we need to check for activity again. + atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) return false } - // No new RPCs have come in since we last set the active calls count value - // -math.MaxInt32 in the timer callback. And since we have the lock, it is - // safe to enter idle mode now. - if err := m.enforcer.EnterIdleMode(); err != nil { - m.logger.Errorf("Failed to enter idle mode: %v", err) - return false - } - - // Successfully entered idle mode. + // No new RPCs have come in since we set the active calls count value to + // -math.MaxInt32. And since we have the lock, it is safe to enter idle mode + // unconditionally now. + m.enforcer.EnterIdleMode() m.actuallyIdle = true return true } +func (m *Manager) EnterIdleModeForTesting() { + m.tryEnterIdleMode() +} + // OnCallBegin is invoked at the start of every RPC. -func (m *manager) OnCallBegin() error { +func (m *Manager) OnCallBegin() error { if m.isClosed() { return nil } @@ -227,7 +200,7 @@ func (m *manager) OnCallBegin() error { // Channel is either in idle mode or is in the process of moving to idle // mode. Attempt to exit idle mode to allow this RPC. - if err := m.exitIdleMode(); err != nil { + if err := m.ExitIdleMode(); err != nil { // Undo the increment to calls count, and return an error causing the // RPC to fail. atomic.AddInt32(&m.activeCallsCount, -1) @@ -238,28 +211,30 @@ func (m *manager) OnCallBegin() error { return nil } -// exitIdleMode instructs the channel to exit idle mode. -// -// Holds idleMu which ensures mutual exclusion with tryEnterIdleMode. -func (m *manager) exitIdleMode() error { +// ExitIdleMode instructs m to call the enforcer's ExitIdleMode and update m's +// internal state. +func (m *Manager) ExitIdleMode() error { + // Holds idleMu which ensures mutual exclusion with tryEnterIdleMode. m.idleMu.Lock() defer m.idleMu.Unlock() - if !m.actuallyIdle { - // This can happen in two scenarios: + if m.isClosed() || !m.actuallyIdle { + // This can happen in three scenarios: // - handleIdleTimeout() set the calls count to -math.MaxInt32 and called // tryEnterIdleMode(). But before the latter could grab the lock, an RPC // came in and OnCallBegin() noticed that the calls count is negative. // - Channel is in idle mode, and multiple new RPCs come in at the same // time, all of them notice a negative calls count in OnCallBegin and get // here. The first one to get the lock would got the channel to exit idle. + // - Channel is not in idle mode, and the user calls Connect which calls + // m.ExitIdleMode. // - // Either way, nothing to do here. + // In any case, there is nothing to do here. return nil } if err := m.enforcer.ExitIdleMode(); err != nil { - return fmt.Errorf("channel failed to exit idle mode: %v", err) + return fmt.Errorf("failed to exit idle mode: %w", err) } // Undo the idle entry process. This also respects any new RPC attempts. @@ -267,12 +242,12 @@ func (m *manager) exitIdleMode() error { m.actuallyIdle = false // Start a new timer to fire after the configured idle timeout. - m.timer = timeAfterFunc(time.Duration(m.timeout), m.handleIdleTimeout) + m.resetIdleTimerLocked(m.timeout) return nil } // OnCallEnd is invoked at the end of every RPC. -func (m *manager) OnCallEnd() { +func (m *Manager) OnCallEnd() { if m.isClosed() { return } @@ -287,15 +262,17 @@ func (m *manager) OnCallEnd() { atomic.AddInt32(&m.activeCallsCount, -1) } -func (m *manager) isClosed() bool { +func (m *Manager) isClosed() bool { return atomic.LoadInt32(&m.closed) == 1 } -func (m *manager) Close() { +func (m *Manager) Close() { atomic.StoreInt32(&m.closed, 1) m.idleMu.Lock() - m.timer.Stop() - m.timer = nil + if m.timer != nil { + m.timer.Stop() + m.timer = nil + } m.idleMu.Unlock() } diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 0d94c63e0..5d6653986 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -57,7 +57,7 @@ var ( // GetXDSHandshakeInfoForTesting returns a pointer to the xds.HandshakeInfo // stored in the passed in attributes. This is set by // credentials/xds/xds.go. - GetXDSHandshakeInfoForTesting any // func (*attributes.Attributes) *xds.HandshakeInfo + GetXDSHandshakeInfoForTesting any // func (*attributes.Attributes) *unsafe.Pointer // GetServerCredentials returns the transport credentials configured on a // gRPC server. An xDS-enabled server needs to know what type of credentials // is configured on the underlying gRPC server. This is set by server.go. @@ -68,11 +68,11 @@ var ( // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. CanonicalString any // func (codes.Code) string - // DrainServerTransports initiates a graceful close of existing connections - // on a gRPC server accepted on the provided listener address. An - // xDS-enabled server invokes this method on a grpc.Server when a particular - // listener moves to "not-serving" mode. - DrainServerTransports any // func(*grpc.Server, string) + // IsRegisteredMethod returns whether the passed in method is registered as + // a method on the server. + IsRegisteredMethod any // func(*grpc.Server, string) bool + // ServerFromContext returns the server from the context. + ServerFromContext any // func(context.Context) *grpc.Server // AddGlobalServerOptions adds an array of ServerOption that will be // effective globally for newly created servers. The priority will be: 1. // user-provided; 2. this method; 3. default values. @@ -106,6 +106,14 @@ var ( // This is used in the 1.0 release of gcp/observability, and thus must not be // deleted or changed. ClearGlobalDialOptions func() + + // AddGlobalPerTargetDialOptions adds a PerTargetDialOption that will be + // configured for newly created ClientConns. + AddGlobalPerTargetDialOptions any // func (opt any) + // ClearGlobalPerTargetDialOptions clears the slice of global late apply + // dial options. + ClearGlobalPerTargetDialOptions func() + // JoinDialOptions combines the dial options passed as arguments into a // single dial option. JoinDialOptions any // func(...grpc.DialOption) grpc.DialOption @@ -126,7 +134,8 @@ var ( // deleted or changed. BinaryLogger any // func(binarylog.Logger) grpc.ServerOption - // SubscribeToConnectivityStateChanges adds a grpcsync.Subscriber to a provided grpc.ClientConn + // SubscribeToConnectivityStateChanges adds a grpcsync.Subscriber to a + // provided grpc.ClientConn. SubscribeToConnectivityStateChanges any // func(*grpc.ClientConn, grpcsync.Subscriber) // NewXDSResolverWithConfigForTesting creates a new xds resolver builder using @@ -177,13 +186,32 @@ var ( GRPCResolverSchemeExtraMetadata string = "xds" // EnterIdleModeForTesting gets the ClientConn to enter IDLE mode. - EnterIdleModeForTesting any // func(*grpc.ClientConn) error + EnterIdleModeForTesting any // func(*grpc.ClientConn) // ExitIdleModeForTesting gets the ClientConn to exit IDLE mode. ExitIdleModeForTesting any // func(*grpc.ClientConn) error + + ChannelzTurnOffForTesting func() + + // TriggerXDSResourceNotFoundForTesting causes the provided xDS Client to + // invoke resource-not-found error for the given resource type and name. + TriggerXDSResourceNotFoundForTesting any // func(xdsclient.XDSClient, xdsresource.Type, string) error + + // FromOutgoingContextRaw returns the un-merged, intermediary contents of + // metadata.rawMD. + FromOutgoingContextRaw any // func(context.Context) (metadata.MD, [][]string, bool) + + // UserSetDefaultScheme is set to true if the user has overridden the + // default resolver scheme. + UserSetDefaultScheme bool = false + + // ShuffleAddressListForTesting pseudo-randomizes the order of addresses. n + // is the number of elements. swap swaps the elements with indexes i and j. + ShuffleAddressListForTesting any // func(n int, swap func(i, j int)) ) -// HealthChecker defines the signature of the client-side LB channel health checking function. +// HealthChecker defines the signature of the client-side LB channel health +// checking function. // // The implementation is expected to create a health checking RPC stream by // calling newStream(), watch for the health status of serviceName, and report diff --git a/vendor/google.golang.org/grpc/internal/pretty/pretty.go b/vendor/google.golang.org/grpc/internal/pretty/pretty.go index 703319137..dbee7a60d 100644 --- a/vendor/google.golang.org/grpc/internal/pretty/pretty.go +++ b/vendor/google.golang.org/grpc/internal/pretty/pretty.go @@ -24,10 +24,8 @@ import ( "encoding/json" "fmt" - "github.com/golang/protobuf/jsonpb" - protov1 "github.com/golang/protobuf/proto" "google.golang.org/protobuf/encoding/protojson" - protov2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" ) const jsonIndent = " " @@ -36,21 +34,14 @@ const jsonIndent = " " // // If marshal fails, it falls back to fmt.Sprintf("%+v"). func ToJSON(e any) string { - switch ee := e.(type) { - case protov1.Message: - mm := jsonpb.Marshaler{Indent: jsonIndent} - ret, err := mm.MarshalToString(ee) - if err != nil { - // This may fail for proto.Anys, e.g. for xDS v2, LDS, the v2 - // messages are not imported, and this will fail because the message - // is not found. - return fmt.Sprintf("%+v", ee) - } - return ret - case protov2.Message: + if ee, ok := e.(protoadapt.MessageV1); ok { + e = protoadapt.MessageV2Of(ee) + } + + if ee, ok := e.(protoadapt.MessageV2); ok { mm := protojson.MarshalOptions{ - Multiline: true, Indent: jsonIndent, + Multiline: true, } ret, err := mm.Marshal(ee) if err != nil { @@ -60,13 +51,13 @@ func ToJSON(e any) string { return fmt.Sprintf("%+v", ee) } return string(ret) - default: - ret, err := json.MarshalIndent(ee, "", jsonIndent) - if err != nil { - return fmt.Sprintf("%+v", ee) - } - return string(ret) } + + ret, err := json.MarshalIndent(e, "", jsonIndent) + if err != nil { + return fmt.Sprintf("%+v", e) + } + return string(ret) } // FormatJSON formats the input json bytes with indentation. diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go index 99e1e5b36..4552db16b 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go @@ -23,8 +23,8 @@ package dns import ( "context" "encoding/json" - "errors" "fmt" + "math/rand" "net" "os" "strconv" @@ -36,26 +36,37 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/envconfig" - "google.golang.org/grpc/internal/grpcrand" + "google.golang.org/grpc/internal/resolver/dns/internal" "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" ) -// EnableSRVLookups controls whether the DNS resolver attempts to fetch gRPCLB -// addresses from SRV records. Must not be changed after init time. -var EnableSRVLookups = false - -var logger = grpclog.Component("dns") - -// Globals to stub out in tests. TODO: Perhaps these two can be combined into a -// single variable for testing the resolver? var ( - newTimer = time.NewTimer - newTimerDNSResRate = time.NewTimer + // EnableSRVLookups controls whether the DNS resolver attempts to fetch gRPCLB + // addresses from SRV records. Must not be changed after init time. + EnableSRVLookups = false + + // MinResolutionInterval is the minimum interval at which re-resolutions are + // allowed. This helps to prevent excessive re-resolution. + MinResolutionInterval = 30 * time.Second + + // ResolvingTimeout specifies the maximum duration for a DNS resolution request. + // If the timeout expires before a response is received, the request will be canceled. + // + // It is recommended to set this value at application startup. Avoid modifying this variable + // after initialization as it's not thread-safe for concurrent modification. + ResolvingTimeout = 30 * time.Second + + logger = grpclog.Component("dns") ) func init() { resolver.Register(NewBuilder()) + internal.TimeAfterFunc = time.After + internal.TimeNowFunc = time.Now + internal.TimeUntilFunc = time.Until + internal.NewNetResolver = newNetResolver + internal.AddressDialer = addressDialer } const ( @@ -70,23 +81,6 @@ const ( txtAttribute = "grpc_config=" ) -var ( - errMissingAddr = errors.New("dns resolver: missing address") - - // Addresses ending with a colon that is supposed to be the separator - // between host and port is not allowed. E.g. "::" is a valid address as - // it is an IPv6 address (host only) and "[::]:" is invalid as it ends with - // a colon as the host and port separator - errEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") -) - -var ( - defaultResolver netResolver = net.DefaultResolver - // To prevent excessive re-resolution, we enforce a rate limit on DNS - // resolution requests. - minDNSResRate = 30 * time.Second -) - var addressDialer = func(address string) func(context.Context, string, string) (net.Conn, error) { return func(ctx context.Context, network, _ string) (net.Conn, error) { var dialer net.Dialer @@ -94,7 +88,11 @@ var addressDialer = func(address string) func(context.Context, string, string) ( } } -var newNetResolver = func(authority string) (netResolver, error) { +var newNetResolver = func(authority string) (internal.NetResolver, error) { + if authority == "" { + return net.DefaultResolver, nil + } + host, port, err := parseTarget(authority, defaultDNSSvrPort) if err != nil { return nil, err @@ -104,7 +102,7 @@ var newNetResolver = func(authority string) (netResolver, error) { return &net.Resolver{ PreferGo: true, - Dial: addressDialer(authorityWithPort), + Dial: internal.AddressDialer(authorityWithPort), }, nil } @@ -142,13 +140,9 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts disableServiceConfig: opts.DisableServiceConfig, } - if target.URL.Host == "" { - d.resolver = defaultResolver - } else { - d.resolver, err = newNetResolver(target.URL.Host) - if err != nil { - return nil, err - } + d.resolver, err = internal.NewNetResolver(target.URL.Host) + if err != nil { + return nil, err } d.wg.Add(1) @@ -161,12 +155,6 @@ func (b *dnsBuilder) Scheme() string { return "dns" } -type netResolver interface { - LookupHost(ctx context.Context, host string) (addrs []string, err error) - LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) - LookupTXT(ctx context.Context, name string) (txts []string, err error) -} - // deadResolver is a resolver that does nothing. type deadResolver struct{} @@ -178,7 +166,7 @@ func (deadResolver) Close() {} type dnsResolver struct { host string port string - resolver netResolver + resolver internal.NetResolver ctx context.Context cancel context.CancelFunc cc resolver.ClientConn @@ -223,45 +211,43 @@ func (d *dnsResolver) watcher() { err = d.cc.UpdateState(*state) } - var timer *time.Timer + var nextResolutionTime time.Time if err == nil { // Success resolving, wait for the next ResolveNow. However, also wait 30 // seconds at the very least to prevent constantly re-resolving. backoffIndex = 1 - timer = newTimerDNSResRate(minDNSResRate) + nextResolutionTime = internal.TimeNowFunc().Add(MinResolutionInterval) select { case <-d.ctx.Done(): - timer.Stop() return case <-d.rn: } } else { // Poll on an error found in DNS Resolver or an error received from // ClientConn. - timer = newTimer(backoff.DefaultExponential.Backoff(backoffIndex)) + nextResolutionTime = internal.TimeNowFunc().Add(backoff.DefaultExponential.Backoff(backoffIndex)) backoffIndex++ } select { case <-d.ctx.Done(): - timer.Stop() return - case <-timer.C: + case <-internal.TimeAfterFunc(internal.TimeUntilFunc(nextResolutionTime)): } } } -func (d *dnsResolver) lookupSRV() ([]resolver.Address, error) { +func (d *dnsResolver) lookupSRV(ctx context.Context) ([]resolver.Address, error) { if !EnableSRVLookups { return nil, nil } var newAddrs []resolver.Address - _, srvs, err := d.resolver.LookupSRV(d.ctx, "grpclb", "tcp", d.host) + _, srvs, err := d.resolver.LookupSRV(ctx, "grpclb", "tcp", d.host) if err != nil { err = handleDNSError(err, "SRV") // may become nil return nil, err } for _, s := range srvs { - lbAddrs, err := d.resolver.LookupHost(d.ctx, s.Target) + lbAddrs, err := d.resolver.LookupHost(ctx, s.Target) if err != nil { err = handleDNSError(err, "A") // may become nil if err == nil { @@ -298,8 +284,8 @@ func handleDNSError(err error, lookupType string) error { return err } -func (d *dnsResolver) lookupTXT() *serviceconfig.ParseResult { - ss, err := d.resolver.LookupTXT(d.ctx, txtPrefix+d.host) +func (d *dnsResolver) lookupTXT(ctx context.Context) *serviceconfig.ParseResult { + ss, err := d.resolver.LookupTXT(ctx, txtPrefix+d.host) if err != nil { if envconfig.TXTErrIgnore { return nil @@ -326,8 +312,8 @@ func (d *dnsResolver) lookupTXT() *serviceconfig.ParseResult { return d.cc.ParseServiceConfig(sc) } -func (d *dnsResolver) lookupHost() ([]resolver.Address, error) { - addrs, err := d.resolver.LookupHost(d.ctx, d.host) +func (d *dnsResolver) lookupHost(ctx context.Context) ([]resolver.Address, error) { + addrs, err := d.resolver.LookupHost(ctx, d.host) if err != nil { err = handleDNSError(err, "A") return nil, err @@ -345,8 +331,10 @@ func (d *dnsResolver) lookupHost() ([]resolver.Address, error) { } func (d *dnsResolver) lookup() (*resolver.State, error) { - srv, srvErr := d.lookupSRV() - addrs, hostErr := d.lookupHost() + ctx, cancel := context.WithTimeout(d.ctx, ResolvingTimeout) + defer cancel() + srv, srvErr := d.lookupSRV(ctx) + addrs, hostErr := d.lookupHost(ctx) if hostErr != nil && (srvErr != nil || len(srv) == 0) { return nil, hostErr } @@ -356,7 +344,7 @@ func (d *dnsResolver) lookup() (*resolver.State, error) { state = grpclbstate.Set(state, &grpclbstate.State{BalancerAddresses: srv}) } if !d.disableServiceConfig { - state.ServiceConfig = d.lookupTXT() + state.ServiceConfig = d.lookupTXT(ctx) } return &state, nil } @@ -387,7 +375,7 @@ func formatIP(addr string) (addrIP string, ok bool) { // target: ":80" defaultPort: "443" returns host: "localhost", port: "80" func parseTarget(target, defaultPort string) (host, port string, err error) { if target == "" { - return "", "", errMissingAddr + return "", "", internal.ErrMissingAddr } if ip := net.ParseIP(target); ip != nil { // target is an IPv4 or IPv6(without brackets) address @@ -397,7 +385,7 @@ func parseTarget(target, defaultPort string) (host, port string, err error) { if port == "" { // If the port field is empty (target ends with colon), e.g. "[::1]:", // this is an error. - return "", "", errEndsWithColon + return "", "", internal.ErrEndsWithColon } // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port if host == "" { @@ -437,7 +425,7 @@ func chosenByPercentage(a *int) bool { if a == nil { return true } - return grpcrand.Intn(100)+1 <= *a + return rand.Intn(100)+1 <= *a } func canaryingSC(js string) string { diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go b/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go new file mode 100644 index 000000000..c0eae4f5f --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/internal/internal.go @@ -0,0 +1,77 @@ +/* + * + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package internal contains functionality internal to the dns resolver package. +package internal + +import ( + "context" + "errors" + "net" + "time" +) + +// NetResolver groups the methods on net.Resolver that are used by the DNS +// resolver implementation. This allows the default net.Resolver instance to be +// overridden from tests. +type NetResolver interface { + LookupHost(ctx context.Context, host string) (addrs []string, err error) + LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) + LookupTXT(ctx context.Context, name string) (txts []string, err error) +} + +var ( + // ErrMissingAddr is the error returned when building a DNS resolver when + // the provided target name is empty. + ErrMissingAddr = errors.New("dns resolver: missing address") + + // ErrEndsWithColon is the error returned when building a DNS resolver when + // the provided target name ends with a colon that is supposed to be the + // separator between host and port. E.g. "::" is a valid address as it is + // an IPv6 address (host only) and "[::]:" is invalid as it ends with a + // colon as the host and port separator + ErrEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") +) + +// The following vars are overridden from tests. +var ( + // TimeAfterFunc is used by the DNS resolver to wait for the given duration + // to elapse. In non-test code, this is implemented by time.After. In test + // code, this can be used to control the amount of time the resolver is + // blocked waiting for the duration to elapse. + TimeAfterFunc func(time.Duration) <-chan time.Time + + // TimeNowFunc is used by the DNS resolver to get the current time. + // In non-test code, this is implemented by time.Now. In test code, + // this can be used to control the current time for the resolver. + TimeNowFunc func() time.Time + + // TimeUntilFunc is used by the DNS resolver to calculate the remaining + // wait time for re-resolution. In non-test code, this is implemented by + // time.Until. In test code, this can be used to control the remaining + // time for resolver to wait for re-resolution. + TimeUntilFunc func(time.Time) time.Duration + + // NewNetResolver returns the net.Resolver instance for the given target. + NewNetResolver func(string) (NetResolver, error) + + // AddressDialer is the dialer used to dial the DNS server. It accepts the + // Host portion of the URL corresponding to the user's dial target and + // returns a dial function. + AddressDialer func(address string) func(context.Context, string, string) (net.Conn, error) +) diff --git a/vendor/google.golang.org/grpc/internal/resolver/unix/unix.go b/vendor/google.golang.org/grpc/internal/resolver/unix/unix.go index 160911687..27cd81af9 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/unix/unix.go +++ b/vendor/google.golang.org/grpc/internal/resolver/unix/unix.go @@ -61,6 +61,10 @@ func (b *builder) Scheme() string { return b.scheme } +func (b *builder) OverrideAuthority(resolver.Target) string { + return "localhost" +} + type nopResolver struct { } diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go index 03ef2fedd..c7dbc8205 100644 --- a/vendor/google.golang.org/grpc/internal/status/status.go +++ b/vendor/google.golang.org/grpc/internal/status/status.go @@ -31,10 +31,11 @@ import ( "errors" "fmt" - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" spb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/codes" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" + "google.golang.org/protobuf/types/known/anypb" ) // Status represents an RPC status code, message, and details. It is immutable @@ -130,14 +131,14 @@ func (s *Status) Err() error { // WithDetails returns a new status with the provided details messages appended to the status. // If any errors are encountered, it returns nil and the first error encountered. -func (s *Status) WithDetails(details ...proto.Message) (*Status, error) { +func (s *Status) WithDetails(details ...protoadapt.MessageV1) (*Status, error) { if s.Code() == codes.OK { return nil, errors.New("no error details for status with code OK") } // s.Code() != OK implies that s.Proto() != nil. p := s.Proto() for _, detail := range details { - any, err := ptypes.MarshalAny(detail) + any, err := anypb.New(protoadapt.MessageV2Of(detail)) if err != nil { return nil, err } @@ -154,12 +155,12 @@ func (s *Status) Details() []any { } details := make([]any, 0, len(s.s.Details)) for _, any := range s.s.Details { - detail := &ptypes.DynamicAny{} - if err := ptypes.UnmarshalAny(any, detail); err != nil { + detail, err := any.UnmarshalNew() + if err != nil { details = append(details, err) continue } - details = append(details, detail.Message) + details = append(details, detail) } return details } diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_others.go similarity index 69% rename from vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go rename to vendor/google.golang.org/grpc/internal/tcp_keepalive_others.go index b5568b22e..4f347edd4 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/util_nonlinux.go +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_others.go @@ -1,9 +1,7 @@ -//go:build !linux -// +build !linux +//go:build !unix && !windows /* - * - * Copyright 2018 gRPC authors. + * Copyright 2023 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +17,13 @@ * */ -package channelz +package internal + +import ( + "net" +) -// GetSocketOption gets the socket option info of the conn. -func GetSocketOption(c any) *SocketOptionData { - return nil +// NetDialerWithTCPKeepalive returns a vanilla net.Dialer on non-unix platforms. +func NetDialerWithTCPKeepalive() *net.Dialer { + return &net.Dialer{} } diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go new file mode 100644 index 000000000..078137b7f --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go @@ -0,0 +1,54 @@ +//go:build unix + +/* + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package internal + +import ( + "net" + "syscall" + "time" + + "golang.org/x/sys/unix" +) + +// NetDialerWithTCPKeepalive returns a net.Dialer that enables TCP keepalives on +// the underlying connection with OS default values for keepalive parameters. +// +// TODO: Once https://github.com/golang/go/issues/62254 lands, and the +// appropriate Go version becomes less than our least supported Go version, we +// should look into using the new API to make things more straightforward. +func NetDialerWithTCPKeepalive() *net.Dialer { + return &net.Dialer{ + // Setting a negative value here prevents the Go stdlib from overriding + // the values of TCP keepalive time and interval. It also prevents the + // Go stdlib from enabling TCP keepalives by default. + KeepAlive: time.Duration(-1), + // This method is called after the underlying network socket is created, + // but before dialing the socket (or calling its connect() method). The + // combination of unconditionally enabling TCP keepalives here, and + // disabling the overriding of TCP keepalive parameters by setting the + // KeepAlive field to a negative value above, results in OS defaults for + // the TCP keealive interval and time parameters. + Control: func(_, _ string, c syscall.RawConn) error { + return c.Control(func(fd uintptr) { + unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_KEEPALIVE, 1) + }) + }, + } +} diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go new file mode 100644 index 000000000..fd7d43a89 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go @@ -0,0 +1,54 @@ +//go:build windows + +/* + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package internal + +import ( + "net" + "syscall" + "time" + + "golang.org/x/sys/windows" +) + +// NetDialerWithTCPKeepalive returns a net.Dialer that enables TCP keepalives on +// the underlying connection with OS default values for keepalive parameters. +// +// TODO: Once https://github.com/golang/go/issues/62254 lands, and the +// appropriate Go version becomes less than our least supported Go version, we +// should look into using the new API to make things more straightforward. +func NetDialerWithTCPKeepalive() *net.Dialer { + return &net.Dialer{ + // Setting a negative value here prevents the Go stdlib from overriding + // the values of TCP keepalive time and interval. It also prevents the + // Go stdlib from enabling TCP keepalives by default. + KeepAlive: time.Duration(-1), + // This method is called after the underlying network socket is created, + // but before dialing the socket (or calling its connect() method). The + // combination of unconditionally enabling TCP keepalives here, and + // disabling the overriding of TCP keepalive parameters by setting the + // KeepAlive field to a negative value above, results in OS defaults for + // the TCP keealive interval and time parameters. + Control: func(_, _ string, c syscall.RawConn) error { + return c.Control(func(fd uintptr) { + windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_KEEPALIVE, 1) + }) + }, + } +} diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go index b330ccedc..3deadfb4a 100644 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -193,7 +193,7 @@ type goAway struct { code http2.ErrCode debugData []byte headsUp bool - closeConn error // if set, loopyWriter will exit, resulting in conn closure + closeConn error // if set, loopyWriter will exit with this error } func (*goAway) isTransportResponseFrame() bool { return false } @@ -336,7 +336,7 @@ func (c *controlBuffer) put(it cbItem) error { return err } -func (c *controlBuffer) executeAndPut(f func(it any) bool, it cbItem) (bool, error) { +func (c *controlBuffer) executeAndPut(f func() bool, it cbItem) (bool, error) { var wakeUp bool c.mu.Lock() if c.err != nil { @@ -344,7 +344,7 @@ func (c *controlBuffer) executeAndPut(f func(it any) bool, it cbItem) (bool, err return false, c.err } if f != nil { - if !f(it) { // f wasn't successful + if !f() { // f wasn't successful c.mu.Unlock() return false, nil } @@ -495,21 +495,22 @@ type loopyWriter struct { ssGoAwayHandler func(*goAway) (bool, error) } -func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator, conn net.Conn, logger *grpclog.PrefixLogger) *loopyWriter { +func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator, conn net.Conn, logger *grpclog.PrefixLogger, goAwayHandler func(*goAway) (bool, error)) *loopyWriter { var buf bytes.Buffer l := &loopyWriter{ - side: s, - cbuf: cbuf, - sendQuota: defaultWindowSize, - oiws: defaultWindowSize, - estdStreams: make(map[uint32]*outStream), - activeStreams: newOutStreamList(), - framer: fr, - hBuf: &buf, - hEnc: hpack.NewEncoder(&buf), - bdpEst: bdpEst, - conn: conn, - logger: logger, + side: s, + cbuf: cbuf, + sendQuota: defaultWindowSize, + oiws: defaultWindowSize, + estdStreams: make(map[uint32]*outStream), + activeStreams: newOutStreamList(), + framer: fr, + hBuf: &buf, + hEnc: hpack.NewEncoder(&buf), + bdpEst: bdpEst, + conn: conn, + logger: logger, + ssGoAwayHandler: goAwayHandler, } return l } @@ -535,8 +536,8 @@ const minBatchSize = 1000 // size is too low to give stream goroutines a chance to fill it up. // // Upon exiting, if the error causing the exit is not an I/O error, run() -// flushes and closes the underlying connection. Otherwise, the connection is -// left open to allow the I/O error to be encountered by the reader instead. +// flushes the underlying connection. The connection is always left open to +// allow different closing behavior on the client and server. func (l *loopyWriter) run() (err error) { defer func() { if l.logger.V(logLevel) { @@ -544,7 +545,6 @@ func (l *loopyWriter) run() (err error) { } if !isIOError(err) { l.framer.writer.Flush() - l.conn.Close() } l.cbuf.finish() }() diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 17f7a21b5..4a3ddce29 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -35,7 +35,6 @@ import ( "sync" "time" - "github.com/golang/protobuf/proto" "golang.org/x/net/http2" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" @@ -45,20 +44,17 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" ) // NewServerHandlerTransport returns a ServerTransport handling gRPC from // inside an http.Handler, or writes an HTTP error to w and returns an error. // It requires that the http Server supports HTTP/2. func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler) (ServerTransport, error) { - if r.ProtoMajor != 2 { - msg := "gRPC requires HTTP/2" - http.Error(w, msg, http.StatusBadRequest) - return nil, errors.New(msg) - } - if r.Method != "POST" { + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) msg := fmt.Sprintf("invalid gRPC request method %q", r.Method) - http.Error(w, msg, http.StatusBadRequest) + http.Error(w, msg, http.StatusMethodNotAllowed) return nil, errors.New(msg) } contentType := r.Header.Get("Content-Type") @@ -69,17 +65,36 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []s http.Error(w, msg, http.StatusUnsupportedMediaType) return nil, errors.New(msg) } + if r.ProtoMajor != 2 { + msg := "gRPC requires HTTP/2" + http.Error(w, msg, http.StatusHTTPVersionNotSupported) + return nil, errors.New(msg) + } if _, ok := w.(http.Flusher); !ok { msg := "gRPC requires a ResponseWriter supporting http.Flusher" http.Error(w, msg, http.StatusInternalServerError) return nil, errors.New(msg) } + var localAddr net.Addr + if la := r.Context().Value(http.LocalAddrContextKey); la != nil { + localAddr, _ = la.(net.Addr) + } + var authInfo credentials.AuthInfo + if r.TLS != nil { + authInfo = credentials.TLSInfo{State: *r.TLS, CommonAuthInfo: credentials.CommonAuthInfo{SecurityLevel: credentials.PrivacyAndIntegrity}} + } + p := peer.Peer{ + Addr: strAddr(r.RemoteAddr), + LocalAddr: localAddr, + AuthInfo: authInfo, + } st := &serverHandlerTransport{ rw: w, req: r, closedCh: make(chan struct{}), writes: make(chan func()), + peer: p, contentType: contentType, contentSubtype: contentSubtype, stats: stats, @@ -134,6 +149,8 @@ type serverHandlerTransport struct { headerMD metadata.MD + peer peer.Peer + closeOnce sync.Once closedCh chan struct{} // closed on Close @@ -165,7 +182,13 @@ func (ht *serverHandlerTransport) Close(err error) { }) } -func (ht *serverHandlerTransport) RemoteAddr() net.Addr { return strAddr(ht.req.RemoteAddr) } +func (ht *serverHandlerTransport) Peer() *peer.Peer { + return &peer.Peer{ + Addr: ht.peer.Addr, + LocalAddr: ht.peer.LocalAddr, + AuthInfo: ht.peer.AuthInfo, + } +} // strAddr is a net.Addr backed by either a TCP "ip:port" string, or // the empty string if unknown. @@ -347,10 +370,8 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { return err } -func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream)) { +func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream func(*Stream)) { // With this transport type there will be exactly 1 stream: this HTTP request. - - ctx := ht.req.Context() var cancel context.CancelFunc if ht.timeoutSet { ctx, cancel = context.WithTimeout(ctx, ht.timeout) @@ -370,34 +391,19 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream)) { ht.Close(errors.New("request is done processing")) }() + ctx = metadata.NewIncomingContext(ctx, ht.headerMD) req := ht.req - s := &Stream{ - id: 0, // irrelevant - requestRead: func(int) {}, - cancel: cancel, - buf: newRecvBuffer(), - st: ht, - method: req.URL.Path, - recvCompress: req.Header.Get("grpc-encoding"), - contentSubtype: ht.contentSubtype, - } - pr := &peer.Peer{ - Addr: ht.RemoteAddr(), - } - if req.TLS != nil { - pr.AuthInfo = credentials.TLSInfo{State: *req.TLS, CommonAuthInfo: credentials.CommonAuthInfo{SecurityLevel: credentials.PrivacyAndIntegrity}} - } - ctx = metadata.NewIncomingContext(ctx, ht.headerMD) - s.ctx = peer.NewContext(ctx, pr) - for _, sh := range ht.stats { - s.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: ht.RemoteAddr(), - Compression: s.recvCompress, - } - sh.HandleRPC(s.ctx, inHeader) + id: 0, // irrelevant + ctx: ctx, + requestRead: func(int) {}, + cancel: cancel, + buf: newRecvBuffer(), + st: ht, + method: req.URL.Path, + recvCompress: req.Header.Get("grpc-encoding"), + contentSubtype: ht.contentSubtype, + headerWireLength: 0, // won't have access to header wire length until golang/go#18997. } s.trReader = &transportReader{ reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}}, diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index d6f5c4935..3c63c7069 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -36,6 +36,7 @@ import ( "golang.org/x/net/http2/hpack" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/channelz" icredentials "google.golang.org/grpc/internal/credentials" "google.golang.org/grpc/internal/grpclog" @@ -43,7 +44,7 @@ import ( "google.golang.org/grpc/internal/grpcutil" imetadata "google.golang.org/grpc/internal/metadata" istatus "google.golang.org/grpc/internal/status" - "google.golang.org/grpc/internal/syscall" + isyscall "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/internal/transport/networktype" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" @@ -58,6 +59,8 @@ import ( // atomically. var clientConnectionCounter uint64 +var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool)) + // http2Client implements the ClientTransport interface with HTTP2. type http2Client struct { lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. @@ -111,11 +114,11 @@ type http2Client struct { streamQuota int64 streamsQuotaAvailable chan struct{} waitingStreams uint32 - nextID uint32 registeredCompressors string // Do not access controlBuf with mu held. mu sync.Mutex // guard the following variables + nextID uint32 state transportState activeStreams map[uint32]*Stream // prevGoAway ID records the Last-Stream-ID in the previous GOAway frame. @@ -137,9 +140,7 @@ type http2Client struct { // variable. kpDormant bool - // Fields below are for channelz metric collection. - channelzID *channelz.Identifier - czData *channelzData + channelz *channelz.Socket onClose func(GoAwayReason) @@ -176,7 +177,7 @@ func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error if networkType == "tcp" && useProxy { return proxyDial(ctx, address, grpcUA) } - return (&net.Dialer{}).DialContext(ctx, networkType, address) + return internal.NetDialerWithTCPKeepalive().DialContext(ctx, networkType, address) } func isTemporary(err error) bool { @@ -262,7 +263,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts } keepaliveEnabled := false if kp.Time != infinity { - if err = syscall.SetTCPUserTimeout(conn, kp.Timeout); err != nil { + if err = isyscall.SetTCPUserTimeout(conn, kp.Timeout); err != nil { return nil, connectionErrorf(false, err, "transport: failed to set TCP_USER_TIMEOUT: %v", err) } keepaliveEnabled = true @@ -316,6 +317,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts if opts.MaxHeaderListSize != nil { maxHeaderListSize = *opts.MaxHeaderListSize } + t := &http2Client{ ctx: ctx, ctxDone: ctx.Done(), // Cache Done chan. @@ -343,11 +345,25 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts maxConcurrentStreams: defaultMaxStreamsClient, streamQuota: defaultMaxStreamsClient, streamsQuotaAvailable: make(chan struct{}, 1), - czData: new(channelzData), keepaliveEnabled: keepaliveEnabled, bufferPool: newBufferPool(), onClose: onClose, } + var czSecurity credentials.ChannelzSecurityValue + if au, ok := authInfo.(credentials.ChannelzSecurityInfo); ok { + czSecurity = au.GetSecurityValue() + } + t.channelz = channelz.RegisterSocket( + &channelz.Socket{ + SocketType: channelz.SocketTypeNormal, + Parent: opts.ChannelzParent, + SocketMetrics: channelz.SocketMetrics{}, + EphemeralMetrics: t.socketMetrics, + LocalAddr: t.localAddr, + RemoteAddr: t.remoteAddr, + SocketOptions: channelz.GetSocketOption(t.conn), + Security: czSecurity, + }) t.logger = prefixLoggerForClientTransport(t) // Add peer information to the http2client context. t.ctx = peer.NewContext(t.ctx, t.getPeer()) @@ -378,10 +394,6 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts } sh.HandleConn(t.ctx, connBegin) } - t.channelzID, err = channelz.RegisterNormalSocket(t, opts.ChannelzParentID, fmt.Sprintf("%s -> %s", t.localAddr, t.remoteAddr)) - if err != nil { - return nil, err - } if t.keepaliveEnabled { t.kpDormancyCond = sync.NewCond(&t.mu) go t.keepalive() @@ -396,10 +408,10 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts readerErrCh := make(chan error, 1) go t.reader(readerErrCh) defer func() { - if err == nil { - err = <-readerErrCh - } if err != nil { + // writerDone should be closed since the loopy goroutine + // wouldn't have started in the case this function returns an error. + close(t.writerDone) t.Close(err) } }() @@ -446,9 +458,19 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts if err := t.framer.writer.Flush(); err != nil { return nil, err } + // Block until the server preface is received successfully or an error occurs. + if err = <-readerErrCh; err != nil { + return nil, err + } go func() { - t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger) - t.loopy.run() + t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler) + if err := t.loopy.run(); !isIOError(err) { + // Immediately close the connection, as the loopy writer returns + // when there are no more active streams and we were draining (the + // server sent a GOAWAY). For I/O errors, the reader will hit it + // after draining any remaining incoming data. + t.conn.Close() + } close(t.writerDone) }() return t, nil @@ -493,9 +515,21 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { func (t *http2Client) getPeer() *peer.Peer { return &peer.Peer{ - Addr: t.remoteAddr, - AuthInfo: t.authInfo, // Can be nil + Addr: t.remoteAddr, + AuthInfo: t.authInfo, // Can be nil + LocalAddr: t.localAddr, + } +} + +// OutgoingGoAwayHandler writes a GOAWAY to the connection. Always returns (false, err) as we want the GoAway +// to be the last frame loopy writes to the transport. +func (t *http2Client) outgoingGoAwayHandler(g *goAway) (bool, error) { + t.mu.Lock() + defer t.mu.Unlock() + if err := t.framer.fr.WriteGoAway(t.nextID-2, http2.ErrCodeNo, g.debugData); err != nil { + return false, err } + return false, g.closeConn } func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) ([]hpack.HeaderField, error) { @@ -566,7 +600,7 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-trace-bin", Value: encodeBinHeader(b)}) } - if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { + if md, added, ok := metadataFromOutgoingContextRaw(ctx); ok { var k string for k, vv := range md { // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. @@ -746,8 +780,8 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, return ErrConnClosing } if channelz.IsOn() { - atomic.AddInt64(&t.czData.streamsStarted, 1) - atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano()) + t.channelz.SocketMetrics.StreamsStarted.Add(1) + t.channelz.SocketMetrics.LastLocalStreamCreatedTimestamp.Store(time.Now().UnixNano()) } // If the keepalive goroutine has gone dormant, wake it up. if t.kpDormant { @@ -762,7 +796,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, firstTry := true var ch chan struct{} transportDrainRequired := false - checkForStreamQuota := func(it any) bool { + checkForStreamQuota := func() bool { if t.streamQuota <= 0 { // Can go negative if server decreases it. if firstTry { t.waitingStreams++ @@ -774,23 +808,24 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, t.waitingStreams-- } t.streamQuota-- - h := it.(*headerFrame) - h.streamID = t.nextID - t.nextID += 2 - // Drain client transport if nextID > MaxStreamID which signals gRPC that - // the connection is closed and a new one must be created for subsequent RPCs. - transportDrainRequired = t.nextID > MaxStreamID - - s.id = h.streamID - s.fc = &inFlow{limit: uint32(t.initialWindowSize)} t.mu.Lock() if t.state == draining || t.activeStreams == nil { // Can be niled from Close(). t.mu.Unlock() return false // Don't create a stream if the transport is already closed. } + + hdr.streamID = t.nextID + t.nextID += 2 + // Drain client transport if nextID > MaxStreamID which signals gRPC that + // the connection is closed and a new one must be created for subsequent RPCs. + transportDrainRequired = t.nextID > MaxStreamID + + s.id = hdr.streamID + s.fc = &inFlow{limit: uint32(t.initialWindowSize)} t.activeStreams[s.id] = s t.mu.Unlock() + if t.streamQuota > 0 && t.waitingStreams > 0 { select { case t.streamsQuotaAvailable <- struct{}{}: @@ -800,13 +835,12 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, return true } var hdrListSizeErr error - checkForHeaderListSize := func(it any) bool { + checkForHeaderListSize := func() bool { if t.maxSendHeaderListSize == nil { return true } - hdrFrame := it.(*headerFrame) var sz int64 - for _, f := range hdrFrame.hf { + for _, f := range hdr.hf { if sz += int64(f.Size()); sz > int64(*t.maxSendHeaderListSize) { hdrListSizeErr = status.Errorf(codes.Internal, "header list size to send violates the maximum size (%d bytes) set by server", *t.maxSendHeaderListSize) return false @@ -815,8 +849,8 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, return true } for { - success, err := t.controlBuf.executeAndPut(func(it any) bool { - return checkForHeaderListSize(it) && checkForStreamQuota(it) + success, err := t.controlBuf.executeAndPut(func() bool { + return checkForHeaderListSize() && checkForStreamQuota() }, hdr) if err != nil { // Connection closed. @@ -918,16 +952,16 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2. t.mu.Unlock() if channelz.IsOn() { if eosReceived { - atomic.AddInt64(&t.czData.streamsSucceeded, 1) + t.channelz.SocketMetrics.StreamsSucceeded.Add(1) } else { - atomic.AddInt64(&t.czData.streamsFailed, 1) + t.channelz.SocketMetrics.StreamsFailed.Add(1) } } }, rst: rst, rstCode: rstCode, } - addBackStreamQuota := func(any) bool { + addBackStreamQuota := func() bool { t.streamQuota++ if t.streamQuota > 0 && t.waitingStreams > 0 { select { @@ -947,7 +981,7 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2. // Close kicks off the shutdown process of the transport. This should be called // only once on a transport. Once it is called, the transport should not be -// accessed any more. +// accessed anymore. func (t *http2Client) Close(err error) { t.mu.Lock() // Make sure we only close once. @@ -972,10 +1006,13 @@ func (t *http2Client) Close(err error) { t.kpDormancyCond.Signal() } t.mu.Unlock() - t.controlBuf.finish() + // Per HTTP/2 spec, a GOAWAY frame must be sent before closing the + // connection. See https://httpwg.org/specs/rfc7540.html#GOAWAY. + t.controlBuf.put(&goAway{code: http2.ErrCodeNo, debugData: []byte("client transport shutdown"), closeConn: err}) + <-t.writerDone t.cancel() t.conn.Close() - channelz.RemoveEntry(t.channelzID) + channelz.RemoveEntry(t.channelz.ID) // Append info about previous goaways if there were any, since this may be important // for understanding the root cause for this connection to be closed. _, goAwayDebugMessage := t.GetGoAwayReason() @@ -1080,7 +1117,7 @@ func (t *http2Client) updateWindow(s *Stream, n uint32) { // for the transport and the stream based on the current bdp // estimation. func (t *http2Client) updateFlowControl(n uint32) { - updateIWS := func(any) bool { + updateIWS := func() bool { t.initialWindowSize = int32(n) t.mu.Lock() for _, s := range t.activeStreams { @@ -1233,7 +1270,7 @@ func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) { } updateFuncs = append(updateFuncs, updateStreamQuota) } - t.controlBuf.executeAndPut(func(any) bool { + t.controlBuf.executeAndPut(func() bool { for _, f := range updateFuncs { f() } @@ -1321,10 +1358,8 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { for streamID, stream := range t.activeStreams { if streamID > id && streamID <= upperLimit { // The stream was unprocessed by the server. - if streamID > id && streamID <= upperLimit { - atomic.StoreUint32(&stream.unprocessed, 1) - streamsToClose = append(streamsToClose, stream) - } + atomic.StoreUint32(&stream.unprocessed, 1) + streamsToClose = append(streamsToClose, stream) } } t.mu.Unlock() @@ -1700,7 +1735,7 @@ func (t *http2Client) keepalive() { // keepalive timer expired. In both cases, we need to send a ping. if !outstandingPing { if channelz.IsOn() { - atomic.AddInt64(&t.czData.kpCount, 1) + t.channelz.SocketMetrics.KeepAlivesSent.Add(1) } t.controlBuf.put(p) timeoutLeft = t.kp.Timeout @@ -1730,40 +1765,23 @@ func (t *http2Client) GoAway() <-chan struct{} { return t.goAway } -func (t *http2Client) ChannelzMetric() *channelz.SocketInternalMetric { - s := channelz.SocketInternalMetric{ - StreamsStarted: atomic.LoadInt64(&t.czData.streamsStarted), - StreamsSucceeded: atomic.LoadInt64(&t.czData.streamsSucceeded), - StreamsFailed: atomic.LoadInt64(&t.czData.streamsFailed), - MessagesSent: atomic.LoadInt64(&t.czData.msgSent), - MessagesReceived: atomic.LoadInt64(&t.czData.msgRecv), - KeepAlivesSent: atomic.LoadInt64(&t.czData.kpCount), - LastLocalStreamCreatedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastStreamCreatedTime)), - LastMessageSentTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgSentTime)), - LastMessageReceivedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgRecvTime)), - LocalFlowControlWindow: int64(t.fc.getSize()), - SocketOptions: channelz.GetSocketOption(t.conn), - LocalAddr: t.localAddr, - RemoteAddr: t.remoteAddr, - // RemoteName : - } - if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { - s.Security = au.GetSecurityValue() - } - s.RemoteFlowControlWindow = t.getOutFlowWindow() - return &s +func (t *http2Client) socketMetrics() *channelz.EphemeralSocketMetrics { + return &channelz.EphemeralSocketMetrics{ + LocalFlowControlWindow: int64(t.fc.getSize()), + RemoteFlowControlWindow: t.getOutFlowWindow(), + } } func (t *http2Client) RemoteAddr() net.Addr { return t.remoteAddr } func (t *http2Client) IncrMsgSent() { - atomic.AddInt64(&t.czData.msgSent, 1) - atomic.StoreInt64(&t.czData.lastMsgSentTime, time.Now().UnixNano()) + t.channelz.SocketMetrics.MessagesSent.Add(1) + t.channelz.SocketMetrics.LastMessageSentTimestamp.Store(time.Now().UnixNano()) } func (t *http2Client) IncrMsgRecv() { - atomic.AddInt64(&t.czData.msgRecv, 1) - atomic.StoreInt64(&t.czData.lastMsgRecvTime, time.Now().UnixNano()) + t.channelz.SocketMetrics.MessagesReceived.Add(1) + t.channelz.SocketMetrics.LastMessageReceivedTimestamp.Store(time.Now().UnixNano()) } func (t *http2Client) getOutFlowWindow() int64 { diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index 6fa1eb419..b7091165b 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -25,6 +25,7 @@ import ( "fmt" "io" "math" + "math/rand" "net" "net/http" "strconv" @@ -32,18 +33,17 @@ import ( "sync/atomic" "time" - "github.com/golang/protobuf/proto" "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/grpcutil" "google.golang.org/grpc/internal/pretty" "google.golang.org/grpc/internal/syscall" + "google.golang.org/protobuf/proto" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" @@ -68,18 +68,15 @@ var serverConnectionCounter uint64 // http2Server implements the ServerTransport interface with HTTP2. type http2Server struct { - lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. - ctx context.Context - done chan struct{} - conn net.Conn - loopy *loopyWriter - readerDone chan struct{} // sync point to enable testing. - writerDone chan struct{} // sync point to enable testing. - remoteAddr net.Addr - localAddr net.Addr - authInfo credentials.AuthInfo // auth info about the connection - inTapHandle tap.ServerInHandle - framer *framer + lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. + done chan struct{} + conn net.Conn + loopy *loopyWriter + readerDone chan struct{} // sync point to enable testing. + loopyWriterDone chan struct{} + peer peer.Peer + inTapHandle tap.ServerInHandle + framer *framer // The max number of concurrent streams. maxStreams uint32 // controlBuf delivers all the control related tasks (e.g., window @@ -121,8 +118,7 @@ type http2Server struct { idle time.Time // Fields below are for channelz metric collection. - channelzID *channelz.Identifier - czData *channelzData + channelz *channelz.Socket bufferPool *bufferPool connectionID uint64 @@ -243,16 +239,18 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, } done := make(chan struct{}) + peer := peer.Peer{ + Addr: conn.RemoteAddr(), + LocalAddr: conn.LocalAddr(), + AuthInfo: authInfo, + } t := &http2Server{ - ctx: setConnection(context.Background(), rawConn), done: done, conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: authInfo, + peer: peer, framer: framer, readerDone: make(chan struct{}), - writerDone: make(chan struct{}), + loopyWriterDone: make(chan struct{}), maxStreams: config.MaxStreams, inTapHandle: config.InTapHandle, fc: &trInFlow{limit: uint32(icwz)}, @@ -263,12 +261,25 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, idle: time.Now(), kep: kep, initialWindowSize: iwz, - czData: new(channelzData), bufferPool: newBufferPool(), } + var czSecurity credentials.ChannelzSecurityValue + if au, ok := authInfo.(credentials.ChannelzSecurityInfo); ok { + czSecurity = au.GetSecurityValue() + } + t.channelz = channelz.RegisterSocket( + &channelz.Socket{ + SocketType: channelz.SocketTypeNormal, + Parent: config.ChannelzParent, + SocketMetrics: channelz.SocketMetrics{}, + EphemeralMetrics: t.socketMetrics, + LocalAddr: t.peer.LocalAddr, + RemoteAddr: t.peer.Addr, + SocketOptions: channelz.GetSocketOption(t.conn), + Security: czSecurity, + }, + ) t.logger = prefixLoggerForServerTransport(t) - // Add peer information to the http2server context. - t.ctx = peer.NewContext(t.ctx, t.getPeer()) t.controlBuf = newControlBuffer(t.done) if dynamicWindow { @@ -277,18 +288,6 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, updateFlowControl: t.updateFlowControl, } } - for _, sh := range t.stats { - t.ctx = sh.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{} - sh.HandleConn(t.ctx, connBegin) - } - t.channelzID, err = channelz.RegisterNormalSocket(t, config.ChannelzParentID, fmt.Sprintf("%s -> %s", t.remoteAddr, t.localAddr)) - if err != nil { - return nil, err - } t.connectionID = atomic.AddUint64(&serverConnectionCounter, 1) t.framer.writer.Flush() @@ -331,10 +330,27 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, t.handleSettings(sf) go func() { - t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger) - t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler - t.loopy.run() - close(t.writerDone) + t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler) + err := t.loopy.run() + close(t.loopyWriterDone) + if !isIOError(err) { + // Close the connection if a non-I/O error occurs (for I/O errors + // the reader will also encounter the error and close). Wait 1 + // second before closing the connection, or when the reader is done + // (i.e. the client already closed the connection or a connection + // error occurred). This avoids the potential problem where there + // is unread data on the receive side of the connection, which, if + // closed, would lead to a TCP RST instead of FIN, and the client + // encountering errors. For more info: + // https://github.com/grpc/grpc-go/issues/5358 + timer := time.NewTimer(time.Second) + defer timer.Stop() + select { + case <-t.readerDone: + case <-timer.C: + } + t.conn.Close() + } }() go t.keepalive() return t, nil @@ -342,7 +358,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, // operateHeaders takes action on the decoded headers. Returns an error if fatal // error encountered and transport needs to close, otherwise returns nil. -func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream)) error { +func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeadersFrame, handle func(*Stream)) error { // Acquire max stream ID lock for entire duration t.maxStreamMu.Lock() defer t.maxStreamMu.Unlock() @@ -369,10 +385,11 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( buf := newRecvBuffer() s := &Stream{ - id: streamID, - st: t, - buf: buf, - fc: &inFlow{limit: uint32(t.initialWindowSize)}, + id: streamID, + st: t, + buf: buf, + fc: &inFlow{limit: uint32(t.initialWindowSize)}, + headerWireLength: int(frame.Header().Length), } var ( // if false, content-type was missing or invalid @@ -511,9 +528,9 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( s.state = streamReadDone } if timeoutSet { - s.ctx, s.cancel = context.WithTimeout(t.ctx, timeout) + s.ctx, s.cancel = context.WithTimeout(ctx, timeout) } else { - s.ctx, s.cancel = context.WithCancel(t.ctx) + s.ctx, s.cancel = context.WithCancel(ctx) } // Attach the received metadata to the context. @@ -586,24 +603,12 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( } t.mu.Unlock() if channelz.IsOn() { - atomic.AddInt64(&t.czData.streamsStarted, 1) - atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano()) + t.channelz.SocketMetrics.StreamsStarted.Add(1) + t.channelz.SocketMetrics.LastRemoteStreamCreatedTimestamp.Store(time.Now().UnixNano()) } s.requestRead = func(n int) { t.adjustWindow(s, uint32(n)) } - for _, sh := range t.stats { - s.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: s.recvCompress, - WireLength: int(frame.Header().Length), - Header: mdata.Copy(), - } - sh.HandleRPC(s.ctx, inHeader) - } s.ctxDone = s.ctx.Done() s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) s.trReader = &transportReader{ @@ -629,8 +634,11 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( // HandleStreams receives incoming streams using the given handler. This is // typically run in a separate goroutine. // traceCtx attaches trace to ctx and returns the new context. -func (t *http2Server) HandleStreams(handle func(*Stream)) { - defer close(t.readerDone) +func (t *http2Server) HandleStreams(ctx context.Context, handle func(*Stream)) { + defer func() { + close(t.readerDone) + <-t.loopyWriterDone + }() for { t.controlBuf.throttle() frame, err := t.framer.fr.ReadFrame() @@ -655,18 +663,20 @@ func (t *http2Server) HandleStreams(handle func(*Stream)) { } continue } - if err == io.EOF || err == io.ErrUnexpectedEOF { - t.Close(err) - return - } t.Close(err) return } switch frame := frame.(type) { case *http2.MetaHeadersFrame: - if err := t.operateHeaders(frame, handle); err != nil { - t.Close(err) - break + if err := t.operateHeaders(ctx, frame, handle); err != nil { + // Any error processing client headers, e.g. invalid stream ID, + // is considered a protocol violation. + t.controlBuf.put(&goAway{ + code: http2.ErrCodeProtocol, + debugData: []byte(err.Error()), + closeConn: err, + }) + continue } case *http2.DataFrame: t.handleData(frame) @@ -849,7 +859,7 @@ func (t *http2Server) handleSettings(f *http2.SettingsFrame) { } return nil }) - t.controlBuf.executeAndPut(func(any) bool { + t.controlBuf.executeAndPut(func() bool { for _, f := range updateFuncs { f() } @@ -979,7 +989,12 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { } } if err := t.writeHeaderLocked(s); err != nil { - return status.Convert(err).Err() + switch e := err.(type) { + case ConnectionError: + return status.Error(codes.Unavailable, e.Desc) + default: + return status.Convert(err).Err() + } } return nil } @@ -998,12 +1013,13 @@ func (t *http2Server) writeHeaderLocked(s *Stream) error { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: s.sendCompress}) } headerFields = appendHeaderFieldsFromMD(headerFields, s.header) - success, err := t.controlBuf.executeAndPut(t.checkForHeaderListSize, &headerFrame{ + hf := &headerFrame{ streamID: s.id, hf: headerFields, endStream: false, onWrite: t.setResetPingStrikes, - }) + } + success, err := t.controlBuf.executeAndPut(func() bool { return t.checkForHeaderListSize(hf) }, hf) if !success { if err != nil { return err @@ -1192,12 +1208,12 @@ func (t *http2Server) keepalive() { continue } if outstandingPing && kpTimeoutLeft <= 0 { - t.Close(fmt.Errorf("keepalive ping not acked within timeout %s", t.kp.Time)) + t.Close(fmt.Errorf("keepalive ping not acked within timeout %s", t.kp.Timeout)) return } if !outstandingPing { if channelz.IsOn() { - atomic.AddInt64(&t.czData.kpCount, 1) + t.channelz.SocketMetrics.KeepAlivesSent.Add(1) } t.controlBuf.put(p) kpTimeoutLeft = t.kp.Timeout @@ -1237,15 +1253,11 @@ func (t *http2Server) Close(err error) { if err := t.conn.Close(); err != nil && t.logger.V(logLevel) { t.logger.Infof("Error closing underlying net.Conn during Close: %v", err) } - channelz.RemoveEntry(t.channelzID) + channelz.RemoveEntry(t.channelz.ID) // Cancel all active streams. for _, s := range streams { s.cancel() } - for _, sh := range t.stats { - connEnd := &stats.ConnEnd{} - sh.HandleConn(t.ctx, connEnd) - } } // deleteStream deletes the stream s from transport's active streams. @@ -1262,9 +1274,9 @@ func (t *http2Server) deleteStream(s *Stream, eosReceived bool) { if channelz.IsOn() { if eosReceived { - atomic.AddInt64(&t.czData.streamsSucceeded, 1) + t.channelz.SocketMetrics.StreamsSucceeded.Add(1) } else { - atomic.AddInt64(&t.czData.streamsFailed, 1) + t.channelz.SocketMetrics.StreamsFailed.Add(1) } } } @@ -1311,10 +1323,6 @@ func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, eo }) } -func (t *http2Server) RemoteAddr() net.Addr { - return t.remoteAddr -} - func (t *http2Server) Drain(debugData string) { t.mu.Lock() defer t.mu.Unlock() @@ -1351,6 +1359,7 @@ func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) { if err := t.framer.fr.WriteGoAway(sid, g.code, g.debugData); err != nil { return false, err } + t.framer.writer.Flush() if retErr != nil { return false, retErr } @@ -1371,7 +1380,7 @@ func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) { return false, err } go func() { - timer := time.NewTimer(time.Minute) + timer := time.NewTimer(5 * time.Second) defer timer.Stop() select { case <-t.drainEvent.Done(): @@ -1384,38 +1393,21 @@ func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) { return false, nil } -func (t *http2Server) ChannelzMetric() *channelz.SocketInternalMetric { - s := channelz.SocketInternalMetric{ - StreamsStarted: atomic.LoadInt64(&t.czData.streamsStarted), - StreamsSucceeded: atomic.LoadInt64(&t.czData.streamsSucceeded), - StreamsFailed: atomic.LoadInt64(&t.czData.streamsFailed), - MessagesSent: atomic.LoadInt64(&t.czData.msgSent), - MessagesReceived: atomic.LoadInt64(&t.czData.msgRecv), - KeepAlivesSent: atomic.LoadInt64(&t.czData.kpCount), - LastRemoteStreamCreatedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastStreamCreatedTime)), - LastMessageSentTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgSentTime)), - LastMessageReceivedTimestamp: time.Unix(0, atomic.LoadInt64(&t.czData.lastMsgRecvTime)), - LocalFlowControlWindow: int64(t.fc.getSize()), - SocketOptions: channelz.GetSocketOption(t.conn), - LocalAddr: t.localAddr, - RemoteAddr: t.remoteAddr, - // RemoteName : - } - if au, ok := t.authInfo.(credentials.ChannelzSecurityInfo); ok { - s.Security = au.GetSecurityValue() - } - s.RemoteFlowControlWindow = t.getOutFlowWindow() - return &s +func (t *http2Server) socketMetrics() *channelz.EphemeralSocketMetrics { + return &channelz.EphemeralSocketMetrics{ + LocalFlowControlWindow: int64(t.fc.getSize()), + RemoteFlowControlWindow: t.getOutFlowWindow(), + } } func (t *http2Server) IncrMsgSent() { - atomic.AddInt64(&t.czData.msgSent, 1) - atomic.StoreInt64(&t.czData.lastMsgSentTime, time.Now().UnixNano()) + t.channelz.SocketMetrics.MessagesSent.Add(1) + t.channelz.SocketMetrics.LastMessageSentTimestamp.Add(1) } func (t *http2Server) IncrMsgRecv() { - atomic.AddInt64(&t.czData.msgRecv, 1) - atomic.StoreInt64(&t.czData.lastMsgRecvTime, time.Now().UnixNano()) + t.channelz.SocketMetrics.MessagesReceived.Add(1) + t.channelz.SocketMetrics.LastMessageReceivedTimestamp.Add(1) } func (t *http2Server) getOutFlowWindow() int64 { @@ -1433,10 +1425,12 @@ func (t *http2Server) getOutFlowWindow() int64 { } } -func (t *http2Server) getPeer() *peer.Peer { +// Peer returns the peer of the transport. +func (t *http2Server) Peer() *peer.Peer { return &peer.Peer{ - Addr: t.remoteAddr, - AuthInfo: t.authInfo, // Can be nil + Addr: t.peer.Addr, + LocalAddr: t.peer.LocalAddr, + AuthInfo: t.peer.AuthInfo, // Can be nil } } @@ -1446,7 +1440,7 @@ func getJitter(v time.Duration) time.Duration { } // Generate a jitter between +/- 10% of the value. r := int64(v / 10) - j := grpcrand.Int63n(2*r) - r + j := rand.Int63n(2*r) - r return time.Duration(j) } @@ -1461,6 +1455,6 @@ func GetConnection(ctx context.Context) net.Conn { // SetConnection adds the connection to the context to be able to get // information about the destination ip and port for an incoming RPC. This also // allows any unary or streaming interceptors to see the connection. -func setConnection(ctx context.Context, conn net.Conn) context.Context { +func SetConnection(ctx context.Context, conn net.Conn) context.Context { return context.WithValue(ctx, connectionKey{}, conn) } diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index dc29d590e..39cef3bd4 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -418,10 +418,9 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBu return f } -func getWriteBufferPool(writeBufferSize int) *sync.Pool { +func getWriteBufferPool(size int) *sync.Pool { writeBufferMutex.Lock() defer writeBufferMutex.Unlock() - size := writeBufferSize * 2 pool, ok := writeBufferPoolMap[size] if ok { return pool diff --git a/vendor/google.golang.org/grpc/internal/transport/proxy.go b/vendor/google.golang.org/grpc/internal/transport/proxy.go index 415961987..24fa10325 100644 --- a/vendor/google.golang.org/grpc/internal/transport/proxy.go +++ b/vendor/google.golang.org/grpc/internal/transport/proxy.go @@ -28,6 +28,8 @@ import ( "net/http" "net/http/httputil" "net/url" + + "google.golang.org/grpc/internal" ) const proxyAuthHeaderKey = "Proxy-Authorization" @@ -112,7 +114,7 @@ func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr stri // proxyDial dials, connecting to a proxy first if necessary. Checks if a proxy // is necessary, dials, does the HTTP CONNECT handshake, and returns the // connection. -func proxyDial(ctx context.Context, addr string, grpcUA string) (conn net.Conn, err error) { +func proxyDial(ctx context.Context, addr string, grpcUA string) (net.Conn, error) { newAddr := addr proxyURL, err := mapAddress(addr) if err != nil { @@ -122,15 +124,15 @@ func proxyDial(ctx context.Context, addr string, grpcUA string) (conn net.Conn, newAddr = proxyURL.Host } - conn, err = (&net.Dialer{}).DialContext(ctx, "tcp", newAddr) + conn, err := internal.NetDialerWithTCPKeepalive().DialContext(ctx, "tcp", newAddr) if err != nil { - return + return nil, err } - if proxyURL != nil { + if proxyURL == nil { // proxy is disabled if proxyURL is nil. - conn, err = doHTTPConnectHandshake(ctx, conn, addr, proxyURL, grpcUA) + return conn, err } - return + return doHTTPConnectHandshake(ctx, conn, addr, proxyURL, grpcUA) } func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) error { diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index aac056e72..4b39c0ade 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -28,6 +28,7 @@ import ( "fmt" "io" "net" + "strings" "sync" "sync/atomic" "time" @@ -37,6 +38,7 @@ import ( "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" @@ -265,7 +267,8 @@ type Stream struct { // headerValid indicates whether a valid header was received. Only // meaningful after headerChan is closed (always call waitOnHeader() before // reading its value). Not valid on server side. - headerValid bool + headerValid bool + headerWireLength int // Only set on server side. // hdrMu protects header and trailer metadata on the server-side. hdrMu sync.Mutex @@ -301,7 +304,7 @@ func (s *Stream) isHeaderSent() bool { } // updateHeaderSent updates headerSent and returns true -// if it was alreay set. It is valid only on server-side. +// if it was already set. It is valid only on server-side. func (s *Stream) updateHeaderSent() bool { return atomic.SwapUint32(&s.headerSent, 1) == 1 } @@ -360,8 +363,12 @@ func (s *Stream) SendCompress() string { // ClientAdvertisedCompressors returns the compressor names advertised by the // client via grpc-accept-encoding header. -func (s *Stream) ClientAdvertisedCompressors() string { - return s.clientAdvertisedCompressors +func (s *Stream) ClientAdvertisedCompressors() []string { + values := strings.Split(s.clientAdvertisedCompressors, ",") + for i, v := range values { + values[i] = strings.TrimSpace(v) + } + return values } // Done returns a channel which is closed when it receives the final status @@ -425,6 +432,12 @@ func (s *Stream) Context() context.Context { return s.ctx } +// SetContext sets the context of the stream. This will be deleted once the +// stats handler callouts all move to gRPC layer. +func (s *Stream) SetContext(ctx context.Context) { + s.ctx = ctx +} + // Method returns the method for the stream. func (s *Stream) Method() string { return s.method @@ -437,6 +450,12 @@ func (s *Stream) Status() *status.Status { return s.status } +// HeaderWireLength returns the size of the headers of the stream as received +// from the wire. Valid only on the server. +func (s *Stream) HeaderWireLength() int { + return s.headerWireLength +} + // SetHeader sets the header metadata. This can be called multiple times. // Server side only. // This should not be called in parallel to other data writes. @@ -552,7 +571,7 @@ type ServerConfig struct { WriteBufferSize int ReadBufferSize int SharedWriteBuffer bool - ChannelzParentID *channelz.Identifier + ChannelzParent *channelz.Server MaxHeaderListSize *uint32 HeaderTableSize *uint32 } @@ -587,8 +606,8 @@ type ConnectOptions struct { ReadBufferSize int // SharedWriteBuffer indicates whether connections should reuse write buffer SharedWriteBuffer bool - // ChannelzParentID sets the addrConn id which initiate the creation of this client transport. - ChannelzParentID *channelz.Identifier + // ChannelzParent sets the addrConn id which initiated the creation of this client transport. + ChannelzParent *channelz.SubChannel // MaxHeaderListSize sets the max (uncompressed) size of header list that is prepared to be received. MaxHeaderListSize *uint32 // UseProxy specifies if a proxy should be used. @@ -698,7 +717,7 @@ type ClientTransport interface { // Write methods for a given Stream will be called serially. type ServerTransport interface { // HandleStreams receives incoming streams using the given handler. - HandleStreams(func(*Stream)) + HandleStreams(context.Context, func(*Stream)) // WriteHeader sends the header metadata for the given stream. // WriteHeader may not be called on all streams. @@ -717,8 +736,8 @@ type ServerTransport interface { // handlers will be terminated asynchronously. Close(err error) - // RemoteAddr returns the remote network address. - RemoteAddr() net.Addr + // Peer returns the peer of the server transport. + Peer() *peer.Peer // Drain notifies the client this ServerTransport stops accepting new RPCs. Drain(debugData string) @@ -801,30 +820,6 @@ const ( GoAwayTooManyPings GoAwayReason = 2 ) -// channelzData is used to store channelz related data for http2Client and http2Server. -// These fields cannot be embedded in the original structs (e.g. http2Client), since to do atomic -// operation on int64 variable on 32-bit machine, user is responsible to enforce memory alignment. -// Here, by grouping those int64 fields inside a struct, we are enforcing the alignment. -type channelzData struct { - kpCount int64 - // The number of streams that have started, including already finished ones. - streamsStarted int64 - // Client side: The number of streams that have ended successfully by receiving - // EoS bit set frame from server. - // Server side: The number of streams that have ended successfully by sending - // frame with EoS bit set. - streamsSucceeded int64 - streamsFailed int64 - // lastStreamCreatedTime stores the timestamp that the last stream gets created. It is of int64 type - // instead of time.Time since it's more costly to atomically update time.Time variable than int64 - // variable. The same goes for lastMsgSentTime and lastMsgRecvTime. - lastStreamCreatedTime int64 - msgSent int64 - msgRecv int64 - lastMsgSentTime int64 - lastMsgRecvTime int64 -} - // ContextErr converts the error from context package into a status error. func ContextErr(err error) error { switch err { diff --git a/vendor/google.golang.org/grpc/internal/xds_handshake_cluster.go b/vendor/google.golang.org/grpc/internal/xds_handshake_cluster.go deleted file mode 100644 index e8b492774..000000000 --- a/vendor/google.golang.org/grpc/internal/xds_handshake_cluster.go +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2021 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package internal - -import ( - "google.golang.org/grpc/attributes" - "google.golang.org/grpc/resolver" -) - -// handshakeClusterNameKey is the type used as the key to store cluster name in -// the Attributes field of resolver.Address. -type handshakeClusterNameKey struct{} - -// SetXDSHandshakeClusterName returns a copy of addr in which the Attributes field -// is updated with the cluster name. -func SetXDSHandshakeClusterName(addr resolver.Address, clusterName string) resolver.Address { - addr.Attributes = addr.Attributes.WithValue(handshakeClusterNameKey{}, clusterName) - return addr -} - -// GetXDSHandshakeClusterName returns cluster name stored in attr. -func GetXDSHandshakeClusterName(attr *attributes.Attributes) (string, bool) { - v := attr.Value(handshakeClusterNameKey{}) - name, ok := v.(string) - return name, ok -} diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index a2cdcaf12..1e9485fd6 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -25,8 +25,14 @@ import ( "context" "fmt" "strings" + + "google.golang.org/grpc/internal" ) +func init() { + internal.FromOutgoingContextRaw = fromOutgoingContextRaw +} + // DecodeKeyValue returns k, v, nil. // // Deprecated: use k and v directly instead. @@ -153,14 +159,16 @@ func Join(mds ...MD) MD { type mdIncomingKey struct{} type mdOutgoingKey struct{} -// NewIncomingContext creates a new context with incoming md attached. +// NewIncomingContext creates a new context with incoming md attached. md must +// not be modified after calling this function. func NewIncomingContext(ctx context.Context, md MD) context.Context { return context.WithValue(ctx, mdIncomingKey{}, md) } // NewOutgoingContext creates a new context with outgoing md attached. If used // in conjunction with AppendToOutgoingContext, NewOutgoingContext will -// overwrite any previously-appended metadata. +// overwrite any previously-appended metadata. md must not be modified after +// calling this function. func NewOutgoingContext(ctx context.Context, md MD) context.Context { return context.WithValue(ctx, mdOutgoingKey{}, rawMD{md: md}) } @@ -203,7 +211,8 @@ func FromIncomingContext(ctx context.Context) (MD, bool) { } // ValueFromIncomingContext returns the metadata value corresponding to the metadata -// key from the incoming metadata if it exists. Key must be lower-case. +// key from the incoming metadata if it exists. Keys are matched in a case insensitive +// manner. // // # Experimental // @@ -219,33 +228,29 @@ func ValueFromIncomingContext(ctx context.Context, key string) []string { return copyOf(v) } for k, v := range md { - // We need to manually convert all keys to lower case, because MD is a - // map, and there's no guarantee that the MD attached to the context is - // created using our helper functions. - if strings.ToLower(k) == key { + // Case insenitive comparison: MD is a map, and there's no guarantee + // that the MD attached to the context is created using our helper + // functions. + if strings.EqualFold(k, key) { return copyOf(v) } } return nil } -// the returned slice must not be modified in place func copyOf(v []string) []string { vals := make([]string, len(v)) copy(vals, v) return vals } -// FromOutgoingContextRaw returns the un-merged, intermediary contents of rawMD. +// fromOutgoingContextRaw returns the un-merged, intermediary contents of rawMD. // // Remember to perform strings.ToLower on the keys, for both the returned MD (MD // is a map, there's no guarantee it's created using our helper functions) and // the extra kv pairs (AppendToOutgoingContext doesn't turn them into // lowercase). -// -// This is intended for gRPC-internal use ONLY. Users should use -// FromOutgoingContext instead. -func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) { +func fromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) { raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) if !ok { return nil, nil, false diff --git a/vendor/google.golang.org/grpc/peer/peer.go b/vendor/google.golang.org/grpc/peer/peer.go index e01d219ff..499a49c8c 100644 --- a/vendor/google.golang.org/grpc/peer/peer.go +++ b/vendor/google.golang.org/grpc/peer/peer.go @@ -22,7 +22,9 @@ package peer import ( "context" + "fmt" "net" + "strings" "google.golang.org/grpc/credentials" ) @@ -32,11 +34,41 @@ import ( type Peer struct { // Addr is the peer address. Addr net.Addr + // LocalAddr is the local address. + LocalAddr net.Addr // AuthInfo is the authentication information of the transport. // It is nil if there is no transport security being used. AuthInfo credentials.AuthInfo } +// String ensures the Peer types implements the Stringer interface in order to +// allow to print a context with a peerKey value effectively. +func (p *Peer) String() string { + if p == nil { + return "Peer" + } + sb := &strings.Builder{} + sb.WriteString("Peer{") + if p.Addr != nil { + fmt.Fprintf(sb, "Addr: '%s', ", p.Addr.String()) + } else { + fmt.Fprintf(sb, "Addr: , ") + } + if p.LocalAddr != nil { + fmt.Fprintf(sb, "LocalAddr: '%s', ", p.LocalAddr.String()) + } else { + fmt.Fprintf(sb, "LocalAddr: , ") + } + if p.AuthInfo != nil { + fmt.Fprintf(sb, "AuthInfo: '%s'", p.AuthInfo.AuthType()) + } else { + fmt.Fprintf(sb, "AuthInfo: ") + } + sb.WriteString("}") + + return sb.String() +} + type peerKey struct{} // NewContext creates a new context with peer information attached. diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index 236837f41..bdaa2130e 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -20,8 +20,9 @@ package grpc import ( "context" + "fmt" "io" - "sync" + "sync/atomic" "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" @@ -32,40 +33,43 @@ import ( "google.golang.org/grpc/status" ) +// pickerGeneration stores a picker and a channel used to signal that a picker +// newer than this one is available. +type pickerGeneration struct { + // picker is the picker produced by the LB policy. May be nil if a picker + // has never been produced. + picker balancer.Picker + // blockingCh is closed when the picker has been invalidated because there + // is a new one available. + blockingCh chan struct{} +} + // pickerWrapper is a wrapper of balancer.Picker. It blocks on certain pick // actions and unblock when there's a picker update. type pickerWrapper struct { - mu sync.Mutex - done bool - idle bool - blockingCh chan struct{} - picker balancer.Picker + // If pickerGen holds a nil pointer, the pickerWrapper is closed. + pickerGen atomic.Pointer[pickerGeneration] statsHandlers []stats.Handler // to record blocking picker calls } func newPickerWrapper(statsHandlers []stats.Handler) *pickerWrapper { - return &pickerWrapper{ - blockingCh: make(chan struct{}), + pw := &pickerWrapper{ statsHandlers: statsHandlers, } + pw.pickerGen.Store(&pickerGeneration{ + blockingCh: make(chan struct{}), + }) + return pw } -// updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. +// updatePicker is called by UpdateState calls from the LB policy. It +// unblocks all blocked pick. func (pw *pickerWrapper) updatePicker(p balancer.Picker) { - pw.mu.Lock() - if pw.done || pw.idle { - // There is a small window where a picker update from the LB policy can - // race with the channel going to idle mode. If the picker is idle here, - // it is because the channel asked it to do so, and therefore it is sage - // to ignore the update from the LB policy. - pw.mu.Unlock() - return - } - pw.picker = p - // pw.blockingCh should never be nil. - close(pw.blockingCh) - pw.blockingCh = make(chan struct{}) - pw.mu.Unlock() + old := pw.pickerGen.Swap(&pickerGeneration{ + picker: p, + blockingCh: make(chan struct{}), + }) + close(old.blockingCh) } // doneChannelzWrapper performs the following: @@ -102,27 +106,24 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. var lastPickErr error for { - pw.mu.Lock() - if pw.done { - pw.mu.Unlock() + pg := pw.pickerGen.Load() + if pg == nil { return nil, balancer.PickResult{}, ErrClientConnClosing } - - if pw.picker == nil { - ch = pw.blockingCh + if pg.picker == nil { + ch = pg.blockingCh } - if ch == pw.blockingCh { + if ch == pg.blockingCh { // This could happen when either: // - pw.picker is nil (the previous if condition), or - // - has called pick on the current picker. - pw.mu.Unlock() + // - we have already called pick on the current picker. select { case <-ctx.Done(): var errStr string if lastPickErr != nil { errStr = "latest balancer error: " + lastPickErr.Error() } else { - errStr = ctx.Err().Error() + errStr = fmt.Sprintf("received context error while waiting for new LB policy update: %s", ctx.Err().Error()) } switch ctx.Err() { case context.DeadlineExceeded: @@ -149,9 +150,8 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. } } - ch = pw.blockingCh - p := pw.picker - pw.mu.Unlock() + ch = pg.blockingCh + p := pg.picker pickResult, err := p.Pick(info) if err != nil { @@ -201,32 +201,15 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. } func (pw *pickerWrapper) close() { - pw.mu.Lock() - defer pw.mu.Unlock() - if pw.done { - return - } - pw.done = true - close(pw.blockingCh) + old := pw.pickerGen.Swap(nil) + close(old.blockingCh) } -func (pw *pickerWrapper) enterIdleMode() { - pw.mu.Lock() - defer pw.mu.Unlock() - if pw.done { - return - } - pw.idle = true -} - -func (pw *pickerWrapper) exitIdleMode() { - pw.mu.Lock() - defer pw.mu.Unlock() - if pw.done { - return - } - pw.blockingCh = make(chan struct{}) - pw.idle = false +// reset clears the pickerWrapper and prepares it for being used again when idle +// mode is exited. +func (pw *pickerWrapper) reset() { + old := pw.pickerGen.Swap(&pickerGeneration{blockingCh: make(chan struct{})}) + close(old.blockingCh) } // dropError is a wrapper error that indicates the LB policy wishes to drop the diff --git a/vendor/google.golang.org/grpc/regenerate.sh b/vendor/google.golang.org/grpc/regenerate.sh index a6f26c8ab..3edca296c 100644 --- a/vendor/google.golang.org/grpc/regenerate.sh +++ b/vendor/google.golang.org/grpc/regenerate.sh @@ -63,7 +63,7 @@ LEGACY_SOURCES=( # Generates only the new gRPC Service symbols SOURCES=( - $(git ls-files --exclude-standard --cached --others "*.proto" | grep -v '^\(profiling/proto/service.proto\|reflection/grpc_reflection_v1alpha/reflection.proto\)$') + $(git ls-files --exclude-standard --cached --others "*.proto" | grep -v '^profiling/proto/service.proto$') ${WORKDIR}/grpc-proto/grpc/gcp/altscontext.proto ${WORKDIR}/grpc-proto/grpc/gcp/handshaker.proto ${WORKDIR}/grpc-proto/grpc/gcp/transport_security_common.proto @@ -93,7 +93,7 @@ Mgrpc/testing/empty.proto=google.golang.org/grpc/interop/grpc_testing for src in ${SOURCES[@]}; do echo "protoc ${src}" - protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS}:${WORKDIR}/out \ + protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},use_generic_streams_experimental=true:${WORKDIR}/out \ -I"." \ -I${WORKDIR}/grpc-proto \ -I${WORKDIR}/googleapis \ @@ -118,6 +118,6 @@ mv ${WORKDIR}/out/google.golang.org/grpc/lookup/grpc_lookup_v1/* ${WORKDIR}/out/ # grpc_testing_not_regenerate/*.pb.go are not re-generated, # see grpc_testing_not_regenerate/README.md for details. -rm ${WORKDIR}/out/google.golang.org/grpc/reflection/grpc_testing_not_regenerate/*.pb.go +rm ${WORKDIR}/out/google.golang.org/grpc/reflection/test/grpc_testing_not_regenerate/*.pb.go cp -R ${WORKDIR}/out/google.golang.org/grpc/* . diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go new file mode 100644 index 000000000..ef3d6ed6c --- /dev/null +++ b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go @@ -0,0 +1,60 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package dns implements a dns resolver to be installed as the default resolver +// in grpc. +package dns + +import ( + "time" + + "google.golang.org/grpc/internal/resolver/dns" + "google.golang.org/grpc/resolver" +) + +// SetResolvingTimeout sets the maximum duration for DNS resolution requests. +// +// This function affects the global timeout used by all channels using the DNS +// name resolver scheme. +// +// It must be called only at application startup, before any gRPC calls are +// made. Modifying this value after initialization is not thread-safe. +// +// The default value is 30 seconds. Setting the timeout too low may result in +// premature timeouts during resolution, while setting it too high may lead to +// unnecessary delays in service discovery. Choose a value appropriate for your +// specific needs and network environment. +func SetResolvingTimeout(timeout time.Duration) { + dns.ResolvingTimeout = timeout +} + +// NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. +// +// Deprecated: import grpc and use resolver.Get("dns") instead. +func NewBuilder() resolver.Builder { + return dns.NewBuilder() +} + +// SetMinResolutionInterval sets the default minimum interval at which DNS +// re-resolutions are allowed. This helps to prevent excessive re-resolution. +// +// It must be called only at application startup, before any gRPC calls are +// made. Modifying this value after initialization is not thread-safe. +func SetMinResolutionInterval(d time.Duration) { + dns.MinResolutionInterval = d +} diff --git a/vendor/google.golang.org/grpc/resolver/map.go b/vendor/google.golang.org/grpc/resolver/map.go index 804be887d..ada5b9bb7 100644 --- a/vendor/google.golang.org/grpc/resolver/map.go +++ b/vendor/google.golang.org/grpc/resolver/map.go @@ -136,3 +136,116 @@ func (a *AddressMap) Values() []any { } return ret } + +type endpointNode struct { + addrs map[string]struct{} +} + +// Equal returns whether the unordered set of addrs are the same between the +// endpoint nodes. +func (en *endpointNode) Equal(en2 *endpointNode) bool { + if len(en.addrs) != len(en2.addrs) { + return false + } + for addr := range en.addrs { + if _, ok := en2.addrs[addr]; !ok { + return false + } + } + return true +} + +func toEndpointNode(endpoint Endpoint) endpointNode { + en := make(map[string]struct{}) + for _, addr := range endpoint.Addresses { + en[addr.Addr] = struct{}{} + } + return endpointNode{ + addrs: en, + } +} + +// EndpointMap is a map of endpoints to arbitrary values keyed on only the +// unordered set of address strings within an endpoint. This map is not thread +// safe, thus it is unsafe to access concurrently. Must be created via +// NewEndpointMap; do not construct directly. +type EndpointMap struct { + endpoints map[*endpointNode]any +} + +// NewEndpointMap creates a new EndpointMap. +func NewEndpointMap() *EndpointMap { + return &EndpointMap{ + endpoints: make(map[*endpointNode]any), + } +} + +// Get returns the value for the address in the map, if present. +func (em *EndpointMap) Get(e Endpoint) (value any, ok bool) { + en := toEndpointNode(e) + if endpoint := em.find(en); endpoint != nil { + return em.endpoints[endpoint], true + } + return nil, false +} + +// Set updates or adds the value to the address in the map. +func (em *EndpointMap) Set(e Endpoint, value any) { + en := toEndpointNode(e) + if endpoint := em.find(en); endpoint != nil { + em.endpoints[endpoint] = value + return + } + em.endpoints[&en] = value +} + +// Len returns the number of entries in the map. +func (em *EndpointMap) Len() int { + return len(em.endpoints) +} + +// Keys returns a slice of all current map keys, as endpoints specifying the +// addresses present in the endpoint keys, in which uniqueness is determined by +// the unordered set of addresses. Thus, endpoint information returned is not +// the full endpoint data (drops duplicated addresses and attributes) but can be +// used for EndpointMap accesses. +func (em *EndpointMap) Keys() []Endpoint { + ret := make([]Endpoint, 0, len(em.endpoints)) + for en := range em.endpoints { + var endpoint Endpoint + for addr := range en.addrs { + endpoint.Addresses = append(endpoint.Addresses, Address{Addr: addr}) + } + ret = append(ret, endpoint) + } + return ret +} + +// Values returns a slice of all current map values. +func (em *EndpointMap) Values() []any { + ret := make([]any, 0, len(em.endpoints)) + for _, val := range em.endpoints { + ret = append(ret, val) + } + return ret +} + +// find returns a pointer to the endpoint node in em if the endpoint node is +// already present. If not found, nil is returned. The comparisons are done on +// the unordered set of addresses within an endpoint. +func (em EndpointMap) find(e endpointNode) *endpointNode { + for endpoint := range em.endpoints { + if e.Equal(endpoint) { + return endpoint + } + } + return nil +} + +// Delete removes the specified endpoint from the map. +func (em *EndpointMap) Delete(e Endpoint) { + en := toEndpointNode(e) + if entry := em.find(en); entry != nil { + delete(em.endpoints, entry) + } +} diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index 11384e228..202854511 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -29,6 +29,7 @@ import ( "google.golang.org/grpc/attributes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/internal" "google.golang.org/grpc/serviceconfig" ) @@ -63,16 +64,18 @@ func Get(scheme string) Builder { } // SetDefaultScheme sets the default scheme that will be used. The default -// default scheme is "passthrough". +// scheme is initially set to "passthrough". // // NOTE: this function must only be called during initialization time (i.e. in // an init() function), and is not thread-safe. The scheme set last overrides // previously set values. func SetDefaultScheme(scheme string) { defaultScheme = scheme + internal.UserSetDefaultScheme = true } -// GetDefaultScheme gets the default scheme that will be used. +// GetDefaultScheme gets the default scheme that will be used by grpc.Dial. If +// SetDefaultScheme is never called, the default scheme used by grpc.NewClient is "dns" instead. func GetDefaultScheme() string { return defaultScheme } @@ -168,6 +171,9 @@ type BuildOptions struct { // field. In most cases though, it is not appropriate, and this field may // be ignored. Dialer func(context.Context, string) (net.Conn, error) + // Authority is the effective authority of the clientconn for which the + // resolver is built. + Authority string } // An Endpoint is one network endpoint, or server, which may have multiple @@ -240,11 +246,6 @@ type ClientConn interface { // // Deprecated: Use UpdateState instead. NewAddress(addresses []Address) - // NewServiceConfig is called by resolver to notify ClientConn a new - // service config. The service config should be provided as a json string. - // - // Deprecated: Use UpdateState instead. - NewServiceConfig(serviceConfig string) // ParseServiceConfig parses the provided service config and returns an // object that provides the parsed config. ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult @@ -286,6 +287,11 @@ func (t Target) Endpoint() string { return strings.TrimPrefix(endpoint, "/") } +// String returns the canonical string representation of Target. +func (t Target) String() string { + return t.URL.Scheme + "://" + t.URL.Host + "/" + t.Endpoint() +} + // Builder creates a resolver that will be used to watch name resolution updates. type Builder interface { // Build creates a new resolver for the given target. @@ -314,3 +320,13 @@ type Resolver interface { // Close closes the resolver. Close() } + +// AuthorityOverrider is implemented by Builders that wish to override the +// default authority for the ClientConn. +// By default, the authority used is target.Endpoint(). +type AuthorityOverrider interface { + // OverrideAuthority returns the authority to use for a ClientConn with the + // given target. The implementation must generate it without blocking, + // typically in line, and must keep it unchanged. + OverrideAuthority(Target) string +} diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go deleted file mode 100644 index d68330560..000000000 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ /dev/null @@ -1,247 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "context" - "strings" - "sync" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcsync" - "google.golang.org/grpc/internal/pretty" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) - -// resolverStateUpdater wraps the single method used by ccResolverWrapper to -// report a state update from the actual resolver implementation. -type resolverStateUpdater interface { - updateResolverState(s resolver.State, err error) error -} - -// ccResolverWrapper is a wrapper on top of cc for resolvers. -// It implements resolver.ClientConn interface. -type ccResolverWrapper struct { - // The following fields are initialized when the wrapper is created and are - // read-only afterwards, and therefore can be accessed without a mutex. - cc resolverStateUpdater - channelzID *channelz.Identifier - ignoreServiceConfig bool - opts ccResolverWrapperOpts - serializer *grpcsync.CallbackSerializer // To serialize all incoming calls. - serializerCancel context.CancelFunc // To close the serializer, accessed only from close(). - - // All incoming (resolver --> gRPC) calls are guaranteed to execute in a - // mutually exclusive manner as they are scheduled on the serializer. - // Fields accessed *only* in these serializer callbacks, can therefore be - // accessed without a mutex. - curState resolver.State - - // mu guards access to the below fields. - mu sync.Mutex - closed bool - resolver resolver.Resolver // Accessed only from outgoing calls. -} - -// ccResolverWrapperOpts wraps the arguments to be passed when creating a new -// ccResolverWrapper. -type ccResolverWrapperOpts struct { - target resolver.Target // User specified dial target to resolve. - builder resolver.Builder // Resolver builder to use. - bOpts resolver.BuildOptions // Resolver build options to use. - channelzID *channelz.Identifier // Channelz identifier for the channel. -} - -// newCCResolverWrapper uses the resolver.Builder to build a Resolver and -// returns a ccResolverWrapper object which wraps the newly built resolver. -func newCCResolverWrapper(cc resolverStateUpdater, opts ccResolverWrapperOpts) (*ccResolverWrapper, error) { - ctx, cancel := context.WithCancel(context.Background()) - ccr := &ccResolverWrapper{ - cc: cc, - channelzID: opts.channelzID, - ignoreServiceConfig: opts.bOpts.DisableServiceConfig, - opts: opts, - serializer: grpcsync.NewCallbackSerializer(ctx), - serializerCancel: cancel, - } - - // Cannot hold the lock at build time because the resolver can send an - // update or error inline and these incoming calls grab the lock to schedule - // a callback in the serializer. - r, err := opts.builder.Build(opts.target, ccr, opts.bOpts) - if err != nil { - cancel() - return nil, err - } - - // Any error reported by the resolver at build time that leads to a - // re-resolution request from the balancer is dropped by grpc until we - // return from this function. So, we don't have to handle pending resolveNow - // requests here. - ccr.mu.Lock() - ccr.resolver = r - ccr.mu.Unlock() - - return ccr, nil -} - -func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOptions) { - ccr.mu.Lock() - defer ccr.mu.Unlock() - - // ccr.resolver field is set only after the call to Build() returns. But in - // the process of building, the resolver may send an error update which when - // propagated to the balancer may result in a re-resolution request. - if ccr.closed || ccr.resolver == nil { - return - } - ccr.resolver.ResolveNow(o) -} - -func (ccr *ccResolverWrapper) close() { - ccr.mu.Lock() - if ccr.closed { - ccr.mu.Unlock() - return - } - - channelz.Info(logger, ccr.channelzID, "Closing the name resolver") - - // Close the serializer to ensure that no more calls from the resolver are - // handled, before actually closing the resolver. - ccr.serializerCancel() - ccr.closed = true - r := ccr.resolver - ccr.mu.Unlock() - - // Give enqueued callbacks a chance to finish. - <-ccr.serializer.Done() - - // Spawn a goroutine to close the resolver (since it may block trying to - // cleanup all allocated resources) and return early. - go r.Close() -} - -// serializerScheduleLocked is a convenience method to schedule a function to be -// run on the serializer while holding ccr.mu. -func (ccr *ccResolverWrapper) serializerScheduleLocked(f func(context.Context)) { - ccr.mu.Lock() - ccr.serializer.Schedule(f) - ccr.mu.Unlock() -} - -// UpdateState is called by resolver implementations to report new state to gRPC -// which includes addresses and service config. -func (ccr *ccResolverWrapper) UpdateState(s resolver.State) error { - errCh := make(chan error, 1) - if s.Endpoints == nil { - s.Endpoints = make([]resolver.Endpoint, 0, len(s.Addresses)) - for _, a := range s.Addresses { - ep := resolver.Endpoint{Addresses: []resolver.Address{a}, Attributes: a.BalancerAttributes} - ep.Addresses[0].BalancerAttributes = nil - s.Endpoints = append(s.Endpoints, ep) - } - } - ok := ccr.serializer.Schedule(func(context.Context) { - ccr.addChannelzTraceEvent(s) - ccr.curState = s - if err := ccr.cc.updateResolverState(ccr.curState, nil); err == balancer.ErrBadResolverState { - errCh <- balancer.ErrBadResolverState - return - } - errCh <- nil - }) - if !ok { - // The only time when Schedule() fail to add the callback to the - // serializer is when the serializer is closed, and this happens only - // when the resolver wrapper is closed. - return nil - } - return <-errCh -} - -// ReportError is called by resolver implementations to report errors -// encountered during name resolution to gRPC. -func (ccr *ccResolverWrapper) ReportError(err error) { - ccr.serializerScheduleLocked(func(_ context.Context) { - channelz.Warningf(logger, ccr.channelzID, "ccResolverWrapper: reporting error to cc: %v", err) - ccr.cc.updateResolverState(resolver.State{}, err) - }) -} - -// NewAddress is called by the resolver implementation to send addresses to -// gRPC. -func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { - ccr.serializerScheduleLocked(func(_ context.Context) { - ccr.addChannelzTraceEvent(resolver.State{Addresses: addrs, ServiceConfig: ccr.curState.ServiceConfig}) - ccr.curState.Addresses = addrs - ccr.cc.updateResolverState(ccr.curState, nil) - }) -} - -// NewServiceConfig is called by the resolver implementation to send service -// configs to gRPC. -func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { - ccr.serializerScheduleLocked(func(_ context.Context) { - channelz.Infof(logger, ccr.channelzID, "ccResolverWrapper: got new service config: %s", sc) - if ccr.ignoreServiceConfig { - channelz.Info(logger, ccr.channelzID, "Service config lookups disabled; ignoring config") - return - } - scpr := parseServiceConfig(sc) - if scpr.Err != nil { - channelz.Warningf(logger, ccr.channelzID, "ccResolverWrapper: error parsing service config: %v", scpr.Err) - return - } - ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: scpr}) - ccr.curState.ServiceConfig = scpr - ccr.cc.updateResolverState(ccr.curState, nil) - }) -} - -// ParseServiceConfig is called by resolver implementations to parse a JSON -// representation of the service config. -func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.ParseResult { - return parseServiceConfig(scJSON) -} - -// addChannelzTraceEvent adds a channelz trace event containing the new -// state received from resolver implementations. -func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { - var updates []string - var oldSC, newSC *ServiceConfig - var oldOK, newOK bool - if ccr.curState.ServiceConfig != nil { - oldSC, oldOK = ccr.curState.ServiceConfig.Config.(*ServiceConfig) - } - if s.ServiceConfig != nil { - newSC, newOK = s.ServiceConfig.Config.(*ServiceConfig) - } - if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) { - updates = append(updates, "service config updated") - } - if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 { - updates = append(updates, "resolver returned an empty address list") - } else if len(ccr.curState.Addresses) == 0 && len(s.Addresses) > 0 { - updates = append(updates, "resolver returned new addresses") - } - channelz.Infof(logger, ccr.channelzID, "Resolver state updated: %s (%v)", pretty.ToJSON(s), strings.Join(updates, "; ")) -} diff --git a/vendor/google.golang.org/grpc/resolver_wrapper.go b/vendor/google.golang.org/grpc/resolver_wrapper.go new file mode 100644 index 000000000..c5fb45236 --- /dev/null +++ b/vendor/google.golang.org/grpc/resolver_wrapper.go @@ -0,0 +1,198 @@ +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +import ( + "context" + "strings" + "sync" + + "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcsync" + "google.golang.org/grpc/internal/pretty" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" +) + +// ccResolverWrapper is a wrapper on top of cc for resolvers. +// It implements resolver.ClientConn interface. +type ccResolverWrapper struct { + // The following fields are initialized when the wrapper is created and are + // read-only afterwards, and therefore can be accessed without a mutex. + cc *ClientConn + ignoreServiceConfig bool + serializer *grpcsync.CallbackSerializer + serializerCancel context.CancelFunc + + resolver resolver.Resolver // only accessed within the serializer + + // The following fields are protected by mu. Caller must take cc.mu before + // taking mu. + mu sync.Mutex + curState resolver.State + closed bool +} + +// newCCResolverWrapper initializes the ccResolverWrapper. It can only be used +// after calling start, which builds the resolver. +func newCCResolverWrapper(cc *ClientConn) *ccResolverWrapper { + ctx, cancel := context.WithCancel(cc.ctx) + return &ccResolverWrapper{ + cc: cc, + ignoreServiceConfig: cc.dopts.disableServiceConfig, + serializer: grpcsync.NewCallbackSerializer(ctx), + serializerCancel: cancel, + } +} + +// start builds the name resolver using the resolver.Builder in cc and returns +// any error encountered. It must always be the first operation performed on +// any newly created ccResolverWrapper, except that close may be called instead. +func (ccr *ccResolverWrapper) start() error { + errCh := make(chan error) + ccr.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil { + return + } + opts := resolver.BuildOptions{ + DisableServiceConfig: ccr.cc.dopts.disableServiceConfig, + DialCreds: ccr.cc.dopts.copts.TransportCredentials, + CredsBundle: ccr.cc.dopts.copts.CredsBundle, + Dialer: ccr.cc.dopts.copts.Dialer, + Authority: ccr.cc.authority, + } + var err error + ccr.resolver, err = ccr.cc.resolverBuilder.Build(ccr.cc.parsedTarget, ccr, opts) + errCh <- err + }) + return <-errCh +} + +func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOptions) { + ccr.serializer.Schedule(func(ctx context.Context) { + if ctx.Err() != nil || ccr.resolver == nil { + return + } + ccr.resolver.ResolveNow(o) + }) +} + +// close initiates async shutdown of the wrapper. To determine the wrapper has +// finished shutting down, the channel should block on ccr.serializer.Done() +// without cc.mu held. +func (ccr *ccResolverWrapper) close() { + channelz.Info(logger, ccr.cc.channelz, "Closing the name resolver") + ccr.mu.Lock() + ccr.closed = true + ccr.mu.Unlock() + + ccr.serializer.Schedule(func(context.Context) { + if ccr.resolver == nil { + return + } + ccr.resolver.Close() + ccr.resolver = nil + }) + ccr.serializerCancel() +} + +// UpdateState is called by resolver implementations to report new state to gRPC +// which includes addresses and service config. +func (ccr *ccResolverWrapper) UpdateState(s resolver.State) error { + ccr.cc.mu.Lock() + ccr.mu.Lock() + if ccr.closed { + ccr.mu.Unlock() + ccr.cc.mu.Unlock() + return nil + } + if s.Endpoints == nil { + s.Endpoints = make([]resolver.Endpoint, 0, len(s.Addresses)) + for _, a := range s.Addresses { + ep := resolver.Endpoint{Addresses: []resolver.Address{a}, Attributes: a.BalancerAttributes} + ep.Addresses[0].BalancerAttributes = nil + s.Endpoints = append(s.Endpoints, ep) + } + } + ccr.addChannelzTraceEvent(s) + ccr.curState = s + ccr.mu.Unlock() + return ccr.cc.updateResolverStateAndUnlock(s, nil) +} + +// ReportError is called by resolver implementations to report errors +// encountered during name resolution to gRPC. +func (ccr *ccResolverWrapper) ReportError(err error) { + ccr.cc.mu.Lock() + ccr.mu.Lock() + if ccr.closed { + ccr.mu.Unlock() + ccr.cc.mu.Unlock() + return + } + ccr.mu.Unlock() + channelz.Warningf(logger, ccr.cc.channelz, "ccResolverWrapper: reporting error to cc: %v", err) + ccr.cc.updateResolverStateAndUnlock(resolver.State{}, err) +} + +// NewAddress is called by the resolver implementation to send addresses to +// gRPC. +func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { + ccr.cc.mu.Lock() + ccr.mu.Lock() + if ccr.closed { + ccr.mu.Unlock() + ccr.cc.mu.Unlock() + return + } + s := resolver.State{Addresses: addrs, ServiceConfig: ccr.curState.ServiceConfig} + ccr.addChannelzTraceEvent(s) + ccr.curState = s + ccr.mu.Unlock() + ccr.cc.updateResolverStateAndUnlock(s, nil) +} + +// ParseServiceConfig is called by resolver implementations to parse a JSON +// representation of the service config. +func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.ParseResult { + return parseServiceConfig(scJSON, ccr.cc.dopts.maxCallAttempts) +} + +// addChannelzTraceEvent adds a channelz trace event containing the new +// state received from resolver implementations. +func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { + var updates []string + var oldSC, newSC *ServiceConfig + var oldOK, newOK bool + if ccr.curState.ServiceConfig != nil { + oldSC, oldOK = ccr.curState.ServiceConfig.Config.(*ServiceConfig) + } + if s.ServiceConfig != nil { + newSC, newOK = s.ServiceConfig.Config.(*ServiceConfig) + } + if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) { + updates = append(updates, "service config updated") + } + if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 { + updates = append(updates, "resolver returned an empty address list") + } else if len(ccr.curState.Addresses) == 0 && len(s.Addresses) > 0 { + updates = append(updates, "resolver returned new addresses") + } + channelz.Infof(logger, ccr.cc.channelz, "Resolver state updated: %s (%v)", pretty.ToJSON(s), strings.Join(updates, "; ")) +} diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index b7723aa09..fdd49e6e9 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -189,6 +189,20 @@ type EmptyCallOption struct{} func (EmptyCallOption) before(*callInfo) error { return nil } func (EmptyCallOption) after(*callInfo, *csAttempt) {} +// StaticMethod returns a CallOption which specifies that a call is being made +// to a method that is static, which means the method is known at compile time +// and doesn't change at runtime. This can be used as a signal to stats plugins +// that this method is safe to include as a key to a measurement. +func StaticMethod() CallOption { + return StaticMethodCallOption{} +} + +// StaticMethodCallOption is a CallOption that specifies that a call comes +// from a static method. +type StaticMethodCallOption struct { + EmptyCallOption +} + // Header returns a CallOptions that retrieves the header metadata // for a unary RPC. func Header(md *metadata.MD) CallOption { @@ -640,14 +654,18 @@ func encode(c baseCodec, msg any) ([]byte, error) { return b, nil } -// compress returns the input bytes compressed by compressor or cp. If both -// compressors are nil, returns nil. +// compress returns the input bytes compressed by compressor or cp. +// If both compressors are nil, or if the message has zero length, returns nil, +// indicating no compression was done. // // TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor. func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) { if compressor == nil && cp == nil { return nil, nil } + if len(in) == 0 { + return nil, nil + } wrapErr := func(err error) error { return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) } @@ -726,17 +744,19 @@ type payloadInfo struct { uncompressedBytes []byte } -func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) ([]byte, error) { - pf, buf, err := p.recvMsg(maxReceiveMessageSize) +// recvAndDecompress reads a message from the stream, decompressing it if necessary. +// +// Cancelling the returned cancel function releases the buffer back to the pool. So the caller should cancel as soon as +// the buffer is no longer needed. +func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, +) (uncompressedBuf []byte, cancel func(), err error) { + pf, compressedBuf, err := p.recvMsg(maxReceiveMessageSize) if err != nil { - return nil, err - } - if payInfo != nil { - payInfo.compressedLength = len(buf) + return nil, nil, err } if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil); st != nil { - return nil, st.Err() + return nil, nil, st.Err() } var size int @@ -744,21 +764,35 @@ func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxRecei // To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor, // use this decompressor as the default. if dc != nil { - buf, err = dc.Do(bytes.NewReader(buf)) - size = len(buf) + uncompressedBuf, err = dc.Do(bytes.NewReader(compressedBuf)) + size = len(uncompressedBuf) } else { - buf, size, err = decompress(compressor, buf, maxReceiveMessageSize) + uncompressedBuf, size, err = decompress(compressor, compressedBuf, maxReceiveMessageSize) } if err != nil { - return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err) + return nil, nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err) } if size > maxReceiveMessageSize { // TODO: Revisit the error code. Currently keep it consistent with java // implementation. - return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize) + return nil, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize) } + } else { + uncompressedBuf = compressedBuf } - return buf, nil + + if payInfo != nil { + payInfo.compressedLength = len(compressedBuf) + payInfo.uncompressedBytes = uncompressedBuf + + cancel = func() {} + } else { + cancel = func() { + p.recvBufferPool.Put(&compressedBuf) + } + } + + return uncompressedBuf, cancel, nil } // Using compressor, decompress d, returning data and size. @@ -778,6 +812,9 @@ func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize // size is used as an estimate to size the buffer, but we // will read more data if available. // +MinRead so ReadFrom will not reallocate if size is correct. + // + // TODO: If we ensure that the buffer size is the same as the DecompressedSize, + // we can also utilize the recv buffer pool here. buf := bytes.NewBuffer(make([]byte, 0, size+bytes.MinRead)) bytesRead, err := buf.ReadFrom(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) return buf.Bytes(), int(bytesRead), err @@ -793,18 +830,15 @@ func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize // dc takes precedence over compressor. // TODO(dfawley): wrap the old compressor/decompressor using the new API? func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m any, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) error { - buf, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor) + buf, cancel, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor) if err != nil { return err } + defer cancel() + if err := c.Unmarshal(buf, m); err != nil { return status.Errorf(codes.Internal, "grpc: failed to unmarshal the received message: %v", err) } - if payInfo != nil { - payInfo.uncompressedBytes = buf - } else { - p.recvBufferPool.Put(&buf) - } return nil } @@ -928,22 +962,9 @@ func setCallInfoCodec(c *callInfo) error { return nil } -// channelzData is used to store channelz related data for ClientConn, addrConn and Server. -// These fields cannot be embedded in the original structs (e.g. ClientConn), since to do atomic -// operation on int64 variable on 32-bit machine, user is responsible to enforce memory alignment. -// Here, by grouping those int64 fields inside a struct, we are enforcing the alignment. -type channelzData struct { - callsStarted int64 - callsFailed int64 - callsSucceeded int64 - // lastCallStartedTime stores the timestamp that last call starts. It is of int64 type instead of - // time.Time since it's more costly to atomically update time.Time variable than int64 variable. - lastCallStartedTime int64 -} - // The SupportPackageIsVersion variables are referenced from generated protocol // buffer files to ensure compatibility with the gRPC version used. The latest -// support package version is 7. +// support package version is 9. // // Older versions are kept for compatibility. // @@ -954,6 +975,8 @@ const ( SupportPackageIsVersion5 = true SupportPackageIsVersion6 = true SupportPackageIsVersion7 = true + SupportPackageIsVersion8 = true + SupportPackageIsVersion9 = true ) const grpcUA = "grpc-go/" + Version diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 8f60d4214..89f8e4792 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -33,8 +33,6 @@ import ( "sync/atomic" "time" - "golang.org/x/net/trace" - "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/encoding" @@ -70,9 +68,10 @@ func init() { internal.GetServerCredentials = func(srv *Server) credentials.TransportCredentials { return srv.opts.creds } - internal.DrainServerTransports = func(srv *Server, addr string) { - srv.drainServerTransports(addr) + internal.IsRegisteredMethod = func(srv *Server, method string) bool { + return srv.isRegisteredMethod(method) } + internal.ServerFromContext = serverFromContext internal.AddGlobalServerOptions = func(opt ...ServerOption) { globalServerOptions = append(globalServerOptions, opt...) } @@ -81,6 +80,7 @@ func init() { } internal.BinaryLogger = binaryLogger internal.JoinServerOptions = newJoinServerOption + internal.RecvBufferPool = recvBufferPool } var statusOK = status.New(codes.OK, "") @@ -129,17 +129,18 @@ type Server struct { drain bool cv *sync.Cond // signaled when connections close for GracefulStop services map[string]*serviceInfo // service name -> service info - events trace.EventLog + events traceEventLog quit *grpcsync.Event done *grpcsync.Event channelzRemoveOnce sync.Once - serveWG sync.WaitGroup // counts active Serve goroutines for GracefulStop + serveWG sync.WaitGroup // counts active Serve goroutines for Stop/GracefulStop + handlersWG sync.WaitGroup // counts active method handler goroutines - channelzID *channelz.Identifier - czData *channelzData + channelz *channelz.Server - serverWorkerChannel chan func() + serverWorkerChannel chan func() + serverWorkerChannelClose func() } type serverOptions struct { @@ -170,6 +171,7 @@ type serverOptions struct { headerTableSize *uint32 numServerWorkers uint32 recvBufferPool SharedBufferPool + waitForHandlers bool } var defaultServerOptions = serverOptions{ @@ -246,11 +248,9 @@ func SharedWriteBuffer(val bool) ServerOption { } // WriteBufferSize determines how much data can be batched before doing a write -// on the wire. The corresponding memory allocation for this buffer will be -// twice the size to keep syscalls low. The default value for this buffer is -// 32KB. Zero or negative values will disable the write buffer such that each -// write will be on underlying connection. -// Note: A Send call may not directly translate to a write. +// on the wire. The default value for this buffer is 32KB. Zero or negative +// values will disable the write buffer such that each write will be on underlying +// connection. Note: A Send call may not directly translate to a write. func WriteBufferSize(s int) ServerOption { return newFuncServerOption(func(o *serverOptions) { o.writeBufferSize = s @@ -527,12 +527,22 @@ func ConnectionTimeout(d time.Duration) ServerOption { }) } +// MaxHeaderListSizeServerOption is a ServerOption that sets the max +// (uncompressed) size of header list that the server is prepared to accept. +type MaxHeaderListSizeServerOption struct { + MaxHeaderListSize uint32 +} + +func (o MaxHeaderListSizeServerOption) apply(so *serverOptions) { + so.maxHeaderListSize = &o.MaxHeaderListSize +} + // MaxHeaderListSize returns a ServerOption that sets the max (uncompressed) size // of header list that the server is prepared to accept. func MaxHeaderListSize(s uint32) ServerOption { - return newFuncServerOption(func(o *serverOptions) { - o.maxHeaderListSize = &s - }) + return MaxHeaderListSizeServerOption{ + MaxHeaderListSize: s, + } } // HeaderTableSize returns a ServerOption that sets the size of dynamic @@ -567,6 +577,21 @@ func NumStreamWorkers(numServerWorkers uint32) ServerOption { }) } +// WaitForHandlers cause Stop to wait until all outstanding method handlers have +// exited before returning. If false, Stop will return as soon as all +// connections have closed, but method handlers may still be running. By +// default, Stop does not wait for method handlers to return. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func WaitForHandlers(w bool) ServerOption { + return newFuncServerOption(func(o *serverOptions) { + o.waitForHandlers = w + }) +} + // RecvBufferPool returns a ServerOption that configures the server // to use the provided shared buffer pool for parsing incoming messages. Depending // on the application's workload, this could result in reduced memory allocation. @@ -578,11 +603,13 @@ func NumStreamWorkers(numServerWorkers uint32) ServerOption { // options are used: StatsHandler, EnableTracing, or binary logging. In such // cases, the shared buffer pool will be ignored. // -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. +// Deprecated: use experimental.WithRecvBufferPool instead. Will be deleted in +// v1.60.0 or later. func RecvBufferPool(bufferPool SharedBufferPool) ServerOption { + return recvBufferPool(bufferPool) +} + +func recvBufferPool(bufferPool SharedBufferPool) ServerOption { return newFuncServerOption(func(o *serverOptions) { o.recvBufferPool = bufferPool }) @@ -616,15 +643,14 @@ func (s *Server) serverWorker() { // connections to reduce the time spent overall on runtime.morestack. func (s *Server) initServerWorkers() { s.serverWorkerChannel = make(chan func()) + s.serverWorkerChannelClose = grpcsync.OnceFunc(func() { + close(s.serverWorkerChannel) + }) for i := uint32(0); i < s.opts.numServerWorkers; i++ { go s.serverWorker() } } -func (s *Server) stopServerWorkers() { - close(s.serverWorkerChannel) -} - // NewServer creates a gRPC server which has no service registered and has not // started to accept requests yet. func NewServer(opt ...ServerOption) *Server { @@ -642,22 +668,21 @@ func NewServer(opt ...ServerOption) *Server { services: make(map[string]*serviceInfo), quit: grpcsync.NewEvent(), done: grpcsync.NewEvent(), - czData: new(channelzData), + channelz: channelz.RegisterServer(""), } chainUnaryServerInterceptors(s) chainStreamServerInterceptors(s) s.cv = sync.NewCond(&s.mu) if EnableTracing { _, file, line, _ := runtime.Caller(1) - s.events = trace.NewEventLog("grpc.Server", fmt.Sprintf("%s:%d", file, line)) + s.events = newTraceEventLog("grpc.Server", fmt.Sprintf("%s:%d", file, line)) } if s.opts.numServerWorkers > 0 { s.initServerWorkers() } - s.channelzID = channelz.RegisterServer(&channelzServer{s}, "") - channelz.Info(logger, s.channelzID, "Server created") + channelz.Info(logger, s.channelz, "Server created") return s } @@ -783,20 +808,13 @@ var ErrServerStopped = errors.New("grpc: the server has been stopped") type listenSocket struct { net.Listener - channelzID *channelz.Identifier -} - -func (l *listenSocket) ChannelzMetric() *channelz.SocketInternalMetric { - return &channelz.SocketInternalMetric{ - SocketOptions: channelz.GetSocketOption(l.Listener), - LocalAddr: l.Listener.Addr(), - } + channelz *channelz.Socket } func (l *listenSocket) Close() error { err := l.Listener.Close() - channelz.RemoveEntry(l.channelzID) - channelz.Info(logger, l.channelzID, "ListenSocket deleted") + channelz.RemoveEntry(l.channelz.ID) + channelz.Info(logger, l.channelz, "ListenSocket deleted") return err } @@ -806,6 +824,18 @@ func (l *listenSocket) Close() error { // Serve returns when lis.Accept fails with fatal errors. lis will be closed when // this method returns. // Serve will return a non-nil error unless Stop or GracefulStop is called. +// +// Note: All supported releases of Go (as of December 2023) override the OS +// defaults for TCP keepalive time and interval to 15s. To enable TCP keepalive +// with OS defaults for keepalive time and interval, callers need to do the +// following two things: +// - pass a net.Listener created by calling the Listen method on a +// net.ListenConfig with the `KeepAlive` field set to a negative value. This +// will result in the Go standard library not overriding OS defaults for TCP +// keepalive interval and time. But this will also result in the Go standard +// library not enabling TCP keepalives by default. +// - override the Accept method on the passed in net.Listener and set the +// SO_KEEPALIVE socket option to enable TCP keepalives, with OS defaults. func (s *Server) Serve(lis net.Listener) error { s.mu.Lock() s.printf("serving") @@ -826,7 +856,16 @@ func (s *Server) Serve(lis net.Listener) error { } }() - ls := &listenSocket{Listener: lis} + ls := &listenSocket{ + Listener: lis, + channelz: channelz.RegisterSocket(&channelz.Socket{ + SocketType: channelz.SocketTypeListen, + Parent: s.channelz, + RefName: lis.Addr().String(), + LocalAddr: lis.Addr(), + SocketOptions: channelz.GetSocketOption(lis)}, + ), + } s.lis[ls] = true defer func() { @@ -838,14 +877,8 @@ func (s *Server) Serve(lis net.Listener) error { s.mu.Unlock() }() - var err error - ls.channelzID, err = channelz.RegisterListenSocket(ls, s.channelzID, lis.Addr().String()) - if err != nil { - s.mu.Unlock() - return err - } s.mu.Unlock() - channelz.Info(logger, ls.channelzID, "ListenSocket created") + channelz.Info(logger, ls.channelz, "ListenSocket created") var tempDelay time.Duration // how long to sleep on accept failure for { @@ -913,24 +946,21 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) { return } + if cc, ok := rawConn.(interface { + PassServerTransport(transport.ServerTransport) + }); ok { + cc.PassServerTransport(st) + } + if !s.addConn(lisAddr, st) { return } go func() { - s.serveStreams(st) + s.serveStreams(context.Background(), st, rawConn) s.removeConn(lisAddr, st) }() } -func (s *Server) drainServerTransports(addr string) { - s.mu.Lock() - conns := s.conns[addr] - for st := range conns { - st.Drain("") - } - s.mu.Unlock() -} - // newHTTP2Transport sets up a http/2 transport (using the // gRPC http2 server transport in transport/http2_server.go). func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { @@ -947,7 +977,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { WriteBufferSize: s.opts.writeBufferSize, ReadBufferSize: s.opts.readBufferSize, SharedWriteBuffer: s.opts.sharedWriteBuffer, - ChannelzParentID: s.channelzID, + ChannelzParent: s.channelz, MaxHeaderListSize: s.opts.maxHeaderListSize, HeaderTableSize: s.opts.headerTableSize, } @@ -961,7 +991,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { if err != credentials.ErrConnDispatched { // Don't log on ErrConnDispatched and io.EOF to prevent log spam. if err != io.EOF { - channelz.Info(logger, s.channelzID, "grpc: Server.Serve failed to create ServerTransport: ", err) + channelz.Info(logger, s.channelz, "grpc: Server.Serve failed to create ServerTransport: ", err) } c.Close() } @@ -971,18 +1001,31 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { return st } -func (s *Server) serveStreams(st transport.ServerTransport) { - defer st.Close(errors.New("finished serving streams for the server transport")) - var wg sync.WaitGroup +func (s *Server) serveStreams(ctx context.Context, st transport.ServerTransport, rawConn net.Conn) { + ctx = transport.SetConnection(ctx, rawConn) + ctx = peer.NewContext(ctx, st.Peer()) + for _, sh := range s.opts.statsHandlers { + ctx = sh.TagConn(ctx, &stats.ConnTagInfo{ + RemoteAddr: st.Peer().Addr, + LocalAddr: st.Peer().LocalAddr, + }) + sh.HandleConn(ctx, &stats.ConnBegin{}) + } - streamQuota := newHandlerQuota(s.opts.maxConcurrentStreams) - st.HandleStreams(func(stream *transport.Stream) { - wg.Add(1) + defer func() { + st.Close(errors.New("finished serving streams for the server transport")) + for _, sh := range s.opts.statsHandlers { + sh.HandleConn(ctx, &stats.ConnEnd{}) + } + }() + streamQuota := newHandlerQuota(s.opts.maxConcurrentStreams) + st.HandleStreams(ctx, func(stream *transport.Stream) { + s.handlersWG.Add(1) streamQuota.acquire() f := func() { defer streamQuota.release() - defer wg.Done() + defer s.handlersWG.Done() s.handleStream(st, stream) } @@ -996,7 +1039,6 @@ func (s *Server) serveStreams(st transport.ServerTransport) { } go f() }) - wg.Wait() } var _ http.Handler = (*Server)(nil) @@ -1040,7 +1082,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } defer s.removeConn(listenerAddressForServeHTTP, st) - s.serveStreams(st) + s.serveStreams(r.Context(), st, nil) } func (s *Server) addConn(addr string, st transport.ServerTransport) bool { @@ -1081,37 +1123,28 @@ func (s *Server) removeConn(addr string, st transport.ServerTransport) { } } -func (s *Server) channelzMetric() *channelz.ServerInternalMetric { - return &channelz.ServerInternalMetric{ - CallsStarted: atomic.LoadInt64(&s.czData.callsStarted), - CallsSucceeded: atomic.LoadInt64(&s.czData.callsSucceeded), - CallsFailed: atomic.LoadInt64(&s.czData.callsFailed), - LastCallStartedTimestamp: time.Unix(0, atomic.LoadInt64(&s.czData.lastCallStartedTime)), - } -} - func (s *Server) incrCallsStarted() { - atomic.AddInt64(&s.czData.callsStarted, 1) - atomic.StoreInt64(&s.czData.lastCallStartedTime, time.Now().UnixNano()) + s.channelz.ServerMetrics.CallsStarted.Add(1) + s.channelz.ServerMetrics.LastCallStartedTimestamp.Store(time.Now().UnixNano()) } func (s *Server) incrCallsSucceeded() { - atomic.AddInt64(&s.czData.callsSucceeded, 1) + s.channelz.ServerMetrics.CallsSucceeded.Add(1) } func (s *Server) incrCallsFailed() { - atomic.AddInt64(&s.czData.callsFailed, 1) + s.channelz.ServerMetrics.CallsFailed.Add(1) } func (s *Server) sendResponse(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, msg any, cp Compressor, opts *transport.Options, comp encoding.Compressor) error { data, err := encode(s.getCodec(stream.ContentSubtype()), msg) if err != nil { - channelz.Error(logger, s.channelzID, "grpc: server failed to encode response: ", err) + channelz.Error(logger, s.channelz, "grpc: server failed to encode response: ", err) return err } compData, err := compress(data, cp, comp) if err != nil { - channelz.Error(logger, s.channelzID, "grpc: server failed to compress response: ", err) + channelz.Error(logger, s.channelz, "grpc: server failed to compress response: ", err) return err } hdr, payload := msgHeader(data, compData) @@ -1302,10 +1335,11 @@ func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTranspor if len(shs) != 0 || len(binlogs) != 0 { payInfo = &payloadInfo{} } - d, err := recvAndDecompress(&parser{r: stream, recvBufferPool: s.opts.recvBufferPool}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp) + + d, cancel, err := recvAndDecompress(&parser{r: stream, recvBufferPool: s.opts.recvBufferPool}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp) if err != nil { if e := t.WriteStatus(stream, status.Convert(err)); e != nil { - channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e) + channelz.Warningf(logger, s.channelz, "grpc: Server.processUnaryRPC failed to write status: %v", e) } return err } @@ -1313,6 +1347,8 @@ func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTranspor t.IncrMsgRecv() } df := func(v any) error { + defer cancel() + if err := s.getCodec(stream.ContentSubtype()).Unmarshal(d, v); err != nil { return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) } @@ -1354,7 +1390,7 @@ func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTranspor trInfo.tr.SetError() } if e := t.WriteStatus(stream, appStatus); e != nil { - channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e) + channelz.Warningf(logger, s.channelz, "grpc: Server.processUnaryRPC failed to write status: %v", e) } if len(binlogs) != 0 { if h, _ := stream.Header(); h.Len() > 0 { @@ -1394,7 +1430,7 @@ func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTranspor } if sts, ok := status.FromError(err); ok { if e := t.WriteStatus(stream, sts); e != nil { - channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e) + channelz.Warningf(logger, s.channelz, "grpc: Server.processUnaryRPC failed to write status: %v", e) } } else { switch st := err.(type) { @@ -1689,15 +1725,16 @@ func (s *Server) processStreamingRPC(ctx context.Context, t transport.ServerTran func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream) { ctx := stream.Context() + ctx = contextWithServer(ctx, s) var ti *traceInfo if EnableTracing { - tr := trace.New("grpc.Recv."+methodFamily(stream.Method()), stream.Method()) - ctx = trace.NewContext(ctx, tr) + tr := newTrace("grpc.Recv."+methodFamily(stream.Method()), stream.Method()) + ctx = newTraceContext(ctx, tr) ti = &traceInfo{ tr: tr, firstLine: firstLine{ client: false, - remoteAddr: t.RemoteAddr(), + remoteAddr: t.Peer().Addr, }, } if dl, ok := ctx.Deadline(); ok { @@ -1721,7 +1758,7 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) ti.tr.SetError() } - channelz.Warningf(logger, s.channelzID, "grpc: Server.handleStream failed to write status: %v", err) + channelz.Warningf(logger, s.channelz, "grpc: Server.handleStream failed to write status: %v", err) } if ti != nil { ti.tr.Finish() @@ -1731,6 +1768,22 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str service := sm[:pos] method := sm[pos+1:] + md, _ := metadata.FromIncomingContext(ctx) + for _, sh := range s.opts.statsHandlers { + ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: stream.Method()}) + sh.HandleRPC(ctx, &stats.InHeader{ + FullMethod: stream.Method(), + RemoteAddr: t.Peer().Addr, + LocalAddr: t.Peer().LocalAddr, + Compression: stream.RecvCompress(), + WireLength: stream.HeaderWireLength(), + Header: md, + }) + } + // To have calls in stream callouts work. Will delete once all stats handler + // calls come from the gRPC layer. + stream.SetContext(ctx) + srv, knownService := s.services[service] if knownService { if md, ok := srv.methods[method]; ok { @@ -1762,7 +1815,7 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) ti.tr.SetError() } - channelz.Warningf(logger, s.channelzID, "grpc: Server.handleStream failed to write status: %v", err) + channelz.Warningf(logger, s.channelz, "grpc: Server.handleStream failed to write status: %v", err) } if ti != nil { ti.tr.Finish() @@ -1820,62 +1873,71 @@ func ServerTransportStreamFromContext(ctx context.Context) ServerTransportStream // pending RPCs on the client side will get notified by connection // errors. func (s *Server) Stop() { - s.quit.Fire() + s.stop(false) +} - defer func() { - s.serveWG.Wait() - s.done.Fire() - }() +// GracefulStop stops the gRPC server gracefully. It stops the server from +// accepting new connections and RPCs and blocks until all the pending RPCs are +// finished. +func (s *Server) GracefulStop() { + s.stop(true) +} - s.channelzRemoveOnce.Do(func() { channelz.RemoveEntry(s.channelzID) }) +func (s *Server) stop(graceful bool) { + s.quit.Fire() + defer s.done.Fire() + s.channelzRemoveOnce.Do(func() { channelz.RemoveEntry(s.channelz.ID) }) s.mu.Lock() - listeners := s.lis - s.lis = nil - conns := s.conns - s.conns = nil - // interrupt GracefulStop if Stop and GracefulStop are called concurrently. - s.cv.Broadcast() + s.closeListenersLocked() + // Wait for serving threads to be ready to exit. Only then can we be sure no + // new conns will be created. s.mu.Unlock() + s.serveWG.Wait() - for lis := range listeners { - lis.Close() + s.mu.Lock() + defer s.mu.Unlock() + + if graceful { + s.drainAllServerTransportsLocked() + } else { + s.closeServerTransportsLocked() } - for _, cs := range conns { - for st := range cs { - st.Close(errors.New("Server.Stop called")) - } + + for len(s.conns) != 0 { + s.cv.Wait() } + s.conns = nil + if s.opts.numServerWorkers > 0 { - s.stopServerWorkers() + // Closing the channel (only once, via grpcsync.OnceFunc) after all the + // connections have been closed above ensures that there are no + // goroutines executing the callback passed to st.HandleStreams (where + // the channel is written to). + s.serverWorkerChannelClose() + } + + if graceful || s.opts.waitForHandlers { + s.handlersWG.Wait() } - s.mu.Lock() if s.events != nil { s.events.Finish() s.events = nil } - s.mu.Unlock() } -// GracefulStop stops the gRPC server gracefully. It stops the server from -// accepting new connections and RPCs and blocks until all the pending RPCs are -// finished. -func (s *Server) GracefulStop() { - s.quit.Fire() - defer s.done.Fire() - - s.channelzRemoveOnce.Do(func() { channelz.RemoveEntry(s.channelzID) }) - s.mu.Lock() - if s.conns == nil { - s.mu.Unlock() - return +// s.mu must be held by the caller. +func (s *Server) closeServerTransportsLocked() { + for _, conns := range s.conns { + for st := range conns { + st.Close(errors.New("Server.Stop called")) + } } +} - for lis := range s.lis { - lis.Close() - } - s.lis = nil +// s.mu must be held by the caller. +func (s *Server) drainAllServerTransportsLocked() { if !s.drain { for _, conns := range s.conns { for st := range conns { @@ -1884,22 +1946,14 @@ func (s *Server) GracefulStop() { } s.drain = true } +} - // Wait for serving threads to be ready to exit. Only then can we be sure no - // new conns will be created. - s.mu.Unlock() - s.serveWG.Wait() - s.mu.Lock() - - for len(s.conns) != 0 { - s.cv.Wait() - } - s.conns = nil - if s.events != nil { - s.events.Finish() - s.events = nil +// s.mu must be held by the caller. +func (s *Server) closeListenersLocked() { + for lis := range s.lis { + lis.Close() } - s.mu.Unlock() + s.lis = nil } // contentSubtype must be lowercase @@ -1913,11 +1967,50 @@ func (s *Server) getCodec(contentSubtype string) baseCodec { } codec := encoding.GetCodec(contentSubtype) if codec == nil { + logger.Warningf("Unsupported codec %q. Defaulting to %q for now. This will start to fail in future releases.", contentSubtype, proto.Name) return encoding.GetCodec(proto.Name) } return codec } +type serverKey struct{} + +// serverFromContext gets the Server from the context. +func serverFromContext(ctx context.Context) *Server { + s, _ := ctx.Value(serverKey{}).(*Server) + return s +} + +// contextWithServer sets the Server in the context. +func contextWithServer(ctx context.Context, server *Server) context.Context { + return context.WithValue(ctx, serverKey{}, server) +} + +// isRegisteredMethod returns whether the passed in method is registered as a +// method on the server. /service/method and service/method will match if the +// service and method are registered on the server. +func (s *Server) isRegisteredMethod(serviceMethod string) bool { + if serviceMethod != "" && serviceMethod[0] == '/' { + serviceMethod = serviceMethod[1:] + } + pos := strings.LastIndex(serviceMethod, "/") + if pos == -1 { // Invalid method name syntax. + return false + } + service := serviceMethod[:pos] + method := serviceMethod[pos+1:] + srv, knownService := s.services[service] + if knownService { + if _, ok := srv.methods[method]; ok { + return true + } + if _, ok := srv.streams[method]; ok { + return true + } + } + return false +} + // SetHeader sets the header metadata to be sent from the server to the client. // The context provided must be the context passed to the server's handler. // @@ -2019,7 +2112,7 @@ func ClientSupportedCompressors(ctx context.Context) ([]string, error) { return nil, fmt.Errorf("failed to fetch the stream from the given context %v", ctx) } - return strings.Split(stream.ClientAdvertisedCompressors(), ","), nil + return stream.ClientAdvertisedCompressors(), nil } // SetTrailer sets the trailer metadata that will be sent when an RPC returns. @@ -2049,17 +2142,9 @@ func Method(ctx context.Context) (string, bool) { return s.Method(), true } -type channelzServer struct { - s *Server -} - -func (c *channelzServer) ChannelzMetric() *channelz.ServerInternalMetric { - return c.s.channelzMetric() -} - // validateSendCompressor returns an error when given compressor name cannot be // handled by the server or the client based on the advertised compressors. -func validateSendCompressor(name, clientCompressors string) error { +func validateSendCompressor(name string, clientCompressors []string) error { if name == encoding.Identity { return nil } @@ -2068,7 +2153,7 @@ func validateSendCompressor(name, clientCompressors string) error { return fmt.Errorf("compressor not registered %q", name) } - for _, c := range strings.Split(clientCompressors, ",") { + for _, c := range clientCompressors { if c == name { return nil // found match } diff --git a/vendor/google.golang.org/grpc/service_config.go b/vendor/google.golang.org/grpc/service_config.go index 0df11fc09..2671c5ef6 100644 --- a/vendor/google.golang.org/grpc/service_config.go +++ b/vendor/google.golang.org/grpc/service_config.go @@ -25,8 +25,11 @@ import ( "reflect" "time" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/balancer/pickfirst" "google.golang.org/grpc/codes" "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/balancer/gracefulswitch" internalserviceconfig "google.golang.org/grpc/internal/serviceconfig" "google.golang.org/grpc/serviceconfig" ) @@ -41,11 +44,6 @@ const maxInt = int(^uint(0) >> 1) // https://github.com/grpc/grpc/blob/master/doc/service_config.md type MethodConfig = internalserviceconfig.MethodConfig -type lbConfig struct { - name string - cfg serviceconfig.LoadBalancingConfig -} - // ServiceConfig is provided by the service provider and contains parameters for how // clients that connect to the service should behave. // @@ -55,14 +53,9 @@ type lbConfig struct { type ServiceConfig struct { serviceconfig.Config - // LB is the load balancer the service providers recommends. This is - // deprecated; lbConfigs is preferred. If lbConfig and LB are both present, - // lbConfig will be used. - LB *string - // lbConfig is the service config's load balancing configuration. If // lbConfig and LB are both present, lbConfig will be used. - lbConfig *lbConfig + lbConfig serviceconfig.LoadBalancingConfig // Methods contains a map for the methods in this service. If there is an // exact match for a method (i.e. /service/method) in the map, use the @@ -164,38 +157,55 @@ type jsonMC struct { // TODO(lyuxuan): delete this struct after cleaning up old service config implementation. type jsonSC struct { LoadBalancingPolicy *string - LoadBalancingConfig *internalserviceconfig.BalancerConfig + LoadBalancingConfig *json.RawMessage MethodConfig *[]jsonMC RetryThrottling *retryThrottlingPolicy HealthCheckConfig *healthCheckConfig } func init() { - internal.ParseServiceConfig = parseServiceConfig + internal.ParseServiceConfig = func(js string) *serviceconfig.ParseResult { + return parseServiceConfig(js, defaultMaxCallAttempts) + } } -func parseServiceConfig(js string) *serviceconfig.ParseResult { +func parseServiceConfig(js string, maxAttempts int) *serviceconfig.ParseResult { if len(js) == 0 { return &serviceconfig.ParseResult{Err: fmt.Errorf("no JSON service config provided")} } var rsc jsonSC err := json.Unmarshal([]byte(js), &rsc) if err != nil { - logger.Warningf("grpc: unmarshaling service config %s: %v", js, err) + logger.Warningf("grpc: unmarshalling service config %s: %v", js, err) return &serviceconfig.ParseResult{Err: err} } sc := ServiceConfig{ - LB: rsc.LoadBalancingPolicy, Methods: make(map[string]MethodConfig), retryThrottling: rsc.RetryThrottling, healthCheckConfig: rsc.HealthCheckConfig, rawJSONString: js, } - if c := rsc.LoadBalancingConfig; c != nil { - sc.lbConfig = &lbConfig{ - name: c.Name, - cfg: c.Config, + c := rsc.LoadBalancingConfig + if c == nil { + name := pickfirst.Name + if rsc.LoadBalancingPolicy != nil { + name = *rsc.LoadBalancingPolicy + } + if balancer.Get(name) == nil { + name = pickfirst.Name + } + cfg := []map[string]any{{name: struct{}{}}} + strCfg, err := json.Marshal(cfg) + if err != nil { + return &serviceconfig.ParseResult{Err: fmt.Errorf("unexpected error marshaling simple LB config: %w", err)} } + r := json.RawMessage(strCfg) + c = &r } + cfg, err := gracefulswitch.ParseConfig(*c) + if err != nil { + return &serviceconfig.ParseResult{Err: err} + } + sc.lbConfig = cfg if rsc.MethodConfig == nil { return &serviceconfig.ParseResult{Config: &sc} @@ -211,8 +221,8 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { WaitForReady: m.WaitForReady, Timeout: (*time.Duration)(m.Timeout), } - if mc.RetryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { - logger.Warningf("grpc: unmarshaling service config %s: %v", js, err) + if mc.RetryPolicy, err = convertRetryPolicy(m.RetryPolicy, maxAttempts); err != nil { + logger.Warningf("grpc: unmarshalling service config %s: %v", js, err) return &serviceconfig.ParseResult{Err: err} } if m.MaxRequestMessageBytes != nil { @@ -232,13 +242,13 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { for i, n := range *m.Name { path, err := n.generatePath() if err != nil { - logger.Warningf("grpc: error unmarshaling service config %s due to methodConfig[%d]: %v", js, i, err) + logger.Warningf("grpc: error unmarshalling service config %s due to methodConfig[%d]: %v", js, i, err) return &serviceconfig.ParseResult{Err: err} } if _, ok := paths[path]; ok { err = errDuplicatedName - logger.Warningf("grpc: error unmarshaling service config %s due to methodConfig[%d]: %v", js, i, err) + logger.Warningf("grpc: error unmarshalling service config %s due to methodConfig[%d]: %v", js, i, err) return &serviceconfig.ParseResult{Err: err} } paths[path] = struct{}{} @@ -257,7 +267,7 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { return &serviceconfig.ParseResult{Config: &sc} } -func convertRetryPolicy(jrp *jsonRetryPolicy) (p *internalserviceconfig.RetryPolicy, err error) { +func convertRetryPolicy(jrp *jsonRetryPolicy, maxAttempts int) (p *internalserviceconfig.RetryPolicy, err error) { if jrp == nil { return nil, nil } @@ -271,17 +281,16 @@ func convertRetryPolicy(jrp *jsonRetryPolicy) (p *internalserviceconfig.RetryPol return nil, nil } + if jrp.MaxAttempts < maxAttempts { + maxAttempts = jrp.MaxAttempts + } rp := &internalserviceconfig.RetryPolicy{ - MaxAttempts: jrp.MaxAttempts, + MaxAttempts: maxAttempts, InitialBackoff: time.Duration(jrp.InitialBackoff), MaxBackoff: time.Duration(jrp.MaxBackoff), BackoffMultiplier: jrp.BackoffMultiplier, RetryableStatusCodes: make(map[codes.Code]bool), } - if rp.MaxAttempts > 5 { - // TODO(retry): Make the max maxAttempts configurable. - rp.MaxAttempts = 5 - } for _, code := range jrp.RetryableStatusCodes { rp.RetryableStatusCodes[code] = true } diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go index 4ab70e2d4..fdb0bd651 100644 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ b/vendor/google.golang.org/grpc/stats/stats.go @@ -73,9 +73,12 @@ func (*PickerUpdated) isRPCStats() {} type InPayload struct { // Client is true if this InPayload is from client side. Client bool - // Payload is the payload with original type. + // Payload is the payload with original type. This may be modified after + // the call to HandleRPC which provides the InPayload returns and must be + // copied if needed later. Payload any // Data is the serialized message payload. + // Deprecated: Data will be removed in the next release. Data []byte // Length is the size of the uncompressed payload data. Does not include any @@ -143,9 +146,12 @@ func (s *InTrailer) isRPCStats() {} type OutPayload struct { // Client is true if this OutPayload is from client side. Client bool - // Payload is the payload with original type. + // Payload is the payload with original type. This may be modified after + // the call to HandleRPC which provides the OutPayload returns and must be + // copied if needed later. Payload any // Data is the serialized message payload. + // Deprecated: Data will be removed in the next release. Data []byte // Length is the size of the uncompressed payload data. Does not include any // framing (gRPC or HTTP/2). diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index b14b2fbea..8051ef5b5 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -23,11 +23,11 @@ import ( "errors" "io" "math" + "math/rand" "strconv" "sync" "time" - "golang.org/x/net/trace" "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" "google.golang.org/grpc/encoding" @@ -35,7 +35,6 @@ import ( "google.golang.org/grpc/internal/balancerload" "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/internal/grpcutil" imetadata "google.golang.org/grpc/internal/metadata" iresolver "google.golang.org/grpc/internal/resolver" @@ -48,6 +47,8 @@ import ( "google.golang.org/grpc/status" ) +var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool)) + // StreamHandler defines the handler called by gRPC server to complete the // execution of a streaming RPC. // @@ -184,7 +185,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth // when the RPC completes. opts = append([]CallOption{OnFinish(func(error) { cc.idlenessMgr.OnCallEnd() })}, opts...) - if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { + if md, added, ok := metadataFromOutgoingContextRaw(ctx); ok { // validate md if err := imetadata.Validate(md); err != nil { return nil, status.Error(codes.Internal, err.Error()) @@ -429,7 +430,7 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error) var trInfo *traceInfo if EnableTracing { trInfo = &traceInfo{ - tr: trace.New("grpc.Sent."+methodFamily(method), method), + tr: newTrace("grpc.Sent."+methodFamily(method), method), firstLine: firstLine{ client: true, }, @@ -438,7 +439,7 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error) trInfo.firstLine.deadline = time.Until(deadline) } trInfo.tr.LazyLog(&trInfo.firstLine, false) - ctx = trace.NewContext(ctx, trInfo.tr) + ctx = newTraceContext(ctx, trInfo.tr) } if cs.cc.parsedTarget.URL.Scheme == internal.GRPCResolverSchemeExtraMetadata { @@ -515,6 +516,7 @@ func (a *csAttempt) newStream() error { return toRPCErr(nse.Err) } a.s = s + a.ctx = s.Context() a.p = &parser{r: s, recvBufferPool: a.cs.cc.dopts.recvBufferPool} return nil } @@ -654,13 +656,13 @@ func (a *csAttempt) shouldRetry(err error) (bool, error) { if len(sps) == 1 { var e error if pushback, e = strconv.Atoi(sps[0]); e != nil || pushback < 0 { - channelz.Infof(logger, cs.cc.channelzID, "Server retry pushback specified to abort (%q).", sps[0]) + channelz.Infof(logger, cs.cc.channelz, "Server retry pushback specified to abort (%q).", sps[0]) cs.retryThrottler.throttle() // This counts as a failure for throttling. return false, err } hasPushback = true } else if len(sps) > 1 { - channelz.Warningf(logger, cs.cc.channelzID, "Server retry pushback specified multiple values (%q); not retrying.", sps) + channelz.Warningf(logger, cs.cc.channelz, "Server retry pushback specified multiple values (%q); not retrying.", sps) cs.retryThrottler.throttle() // This counts as a failure for throttling. return false, err } @@ -697,7 +699,7 @@ func (a *csAttempt) shouldRetry(err error) (bool, error) { if max := float64(rp.MaxBackoff); cur > max { cur = max } - dur = time.Duration(grpcrand.Int63n(int64(cur))) + dur = time.Duration(rand.Int63n(int64(cur))) cs.numRetriesSincePushback++ } diff --git a/vendor/google.golang.org/grpc/stream_interfaces.go b/vendor/google.golang.org/grpc/stream_interfaces.go new file mode 100644 index 000000000..8b813529c --- /dev/null +++ b/vendor/google.golang.org/grpc/stream_interfaces.go @@ -0,0 +1,152 @@ +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +// ServerStreamingClient represents the client side of a server-streaming (one +// request, many responses) RPC. It is generic over the type of the response +// message. It is used in generated code. +type ServerStreamingClient[Res any] interface { + Recv() (*Res, error) + ClientStream +} + +// ServerStreamingServer represents the server side of a server-streaming (one +// request, many responses) RPC. It is generic over the type of the response +// message. It is used in generated code. +type ServerStreamingServer[Res any] interface { + Send(*Res) error + ServerStream +} + +// ClientStreamingClient represents the client side of a client-streaming (many +// requests, one response) RPC. It is generic over both the type of the request +// message stream and the type of the unary response message. It is used in +// generated code. +type ClientStreamingClient[Req any, Res any] interface { + Send(*Req) error + CloseAndRecv() (*Res, error) + ClientStream +} + +// ClientStreamingServer represents the server side of a client-streaming (many +// requests, one response) RPC. It is generic over both the type of the request +// message stream and the type of the unary response message. It is used in +// generated code. +type ClientStreamingServer[Req any, Res any] interface { + Recv() (*Req, error) + SendAndClose(*Res) error + ServerStream +} + +// BidiStreamingClient represents the client side of a bidirectional-streaming +// (many requests, many responses) RPC. It is generic over both the type of the +// request message stream and the type of the response message stream. It is +// used in generated code. +type BidiStreamingClient[Req any, Res any] interface { + Send(*Req) error + Recv() (*Res, error) + ClientStream +} + +// BidiStreamingServer represents the server side of a bidirectional-streaming +// (many requests, many responses) RPC. It is generic over both the type of the +// request message stream and the type of the response message stream. It is +// used in generated code. +type BidiStreamingServer[Req any, Res any] interface { + Recv() (*Req, error) + Send(*Res) error + ServerStream +} + +// GenericClientStream implements the ServerStreamingClient, ClientStreamingClient, +// and BidiStreamingClient interfaces. It is used in generated code. +type GenericClientStream[Req any, Res any] struct { + ClientStream +} + +var _ ServerStreamingClient[string] = (*GenericClientStream[int, string])(nil) +var _ ClientStreamingClient[int, string] = (*GenericClientStream[int, string])(nil) +var _ BidiStreamingClient[int, string] = (*GenericClientStream[int, string])(nil) + +// Send pushes one message into the stream of requests to be consumed by the +// server. The type of message which can be sent is determined by the Req type +// parameter of the GenericClientStream receiver. +func (x *GenericClientStream[Req, Res]) Send(m *Req) error { + return x.ClientStream.SendMsg(m) +} + +// Recv reads one message from the stream of responses generated by the server. +// The type of the message returned is determined by the Res type parameter +// of the GenericClientStream receiver. +func (x *GenericClientStream[Req, Res]) Recv() (*Res, error) { + m := new(Res) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// CloseAndRecv closes the sending side of the stream, then receives the unary +// response from the server. The type of message which it returns is determined +// by the Res type parameter of the GenericClientStream receiver. +func (x *GenericClientStream[Req, Res]) CloseAndRecv() (*Res, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(Res) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// GenericServerStream implements the ServerStreamingServer, ClientStreamingServer, +// and BidiStreamingServer interfaces. It is used in generated code. +type GenericServerStream[Req any, Res any] struct { + ServerStream +} + +var _ ServerStreamingServer[string] = (*GenericServerStream[int, string])(nil) +var _ ClientStreamingServer[int, string] = (*GenericServerStream[int, string])(nil) +var _ BidiStreamingServer[int, string] = (*GenericServerStream[int, string])(nil) + +// Send pushes one message into the stream of responses to be consumed by the +// client. The type of message which can be sent is determined by the Res +// type parameter of the serverStreamServer receiver. +func (x *GenericServerStream[Req, Res]) Send(m *Res) error { + return x.ServerStream.SendMsg(m) +} + +// SendAndClose pushes the unary response to the client. The type of message +// which can be sent is determined by the Res type parameter of the +// clientStreamServer receiver. +func (x *GenericServerStream[Req, Res]) SendAndClose(m *Res) error { + return x.ServerStream.SendMsg(m) +} + +// Recv reads one message from the stream of requests generated by the client. +// The type of the message returned is determined by the Req type parameter +// of the clientStreamServer receiver. +func (x *GenericServerStream[Req, Res]) Recv() (*Req, error) { + m := new(Req) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} diff --git a/vendor/google.golang.org/grpc/trace.go b/vendor/google.golang.org/grpc/trace.go index 9ded79321..10f4f798f 100644 --- a/vendor/google.golang.org/grpc/trace.go +++ b/vendor/google.golang.org/grpc/trace.go @@ -26,8 +26,6 @@ import ( "strings" "sync" "time" - - "golang.org/x/net/trace" ) // EnableTracing controls whether to trace RPCs using the golang.org/x/net/trace package. @@ -44,9 +42,31 @@ func methodFamily(m string) string { return m } +// traceEventLog mirrors golang.org/x/net/trace.EventLog. +// +// It exists in order to avoid importing x/net/trace on grpcnotrace builds. +type traceEventLog interface { + Printf(format string, a ...any) + Errorf(format string, a ...any) + Finish() +} + +// traceLog mirrors golang.org/x/net/trace.Trace. +// +// It exists in order to avoid importing x/net/trace on grpcnotrace builds. +type traceLog interface { + LazyLog(x fmt.Stringer, sensitive bool) + LazyPrintf(format string, a ...any) + SetError() + SetRecycler(f func(any)) + SetTraceInfo(traceID, spanID uint64) + SetMaxEvents(m int) + Finish() +} + // traceInfo contains tracing information for an RPC. type traceInfo struct { - tr trace.Trace + tr traceLog firstLine firstLine } diff --git a/vendor/google.golang.org/grpc/trace_notrace.go b/vendor/google.golang.org/grpc/trace_notrace.go new file mode 100644 index 000000000..1da3a2308 --- /dev/null +++ b/vendor/google.golang.org/grpc/trace_notrace.go @@ -0,0 +1,52 @@ +//go:build grpcnotrace + +/* + * + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package grpc + +// grpcnotrace can be used to avoid importing golang.org/x/net/trace, which in +// turn enables binaries using gRPC-Go for dead code elimination, which can +// yield 10-15% improvements in binary size when tracing is not needed. + +import ( + "context" + "fmt" +) + +type notrace struct{} + +func (notrace) LazyLog(x fmt.Stringer, sensitive bool) {} +func (notrace) LazyPrintf(format string, a ...any) {} +func (notrace) SetError() {} +func (notrace) SetRecycler(f func(any)) {} +func (notrace) SetTraceInfo(traceID, spanID uint64) {} +func (notrace) SetMaxEvents(m int) {} +func (notrace) Finish() {} + +func newTrace(family, title string) traceLog { + return notrace{} +} + +func newTraceContext(ctx context.Context, tr traceLog) context.Context { + return ctx +} + +func newTraceEventLog(family, title string) traceEventLog { + return nil +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/util_linux.go b/vendor/google.golang.org/grpc/trace_withtrace.go similarity index 59% rename from vendor/google.golang.org/grpc/internal/channelz/util_linux.go rename to vendor/google.golang.org/grpc/trace_withtrace.go index 98288c3f8..88d6e8571 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/util_linux.go +++ b/vendor/google.golang.org/grpc/trace_withtrace.go @@ -1,6 +1,8 @@ +//go:build !grpcnotrace + /* * - * Copyright 2018 gRPC authors. + * Copyright 2024 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,22 +18,22 @@ * */ -package channelz +package grpc import ( - "syscall" + "context" + + t "golang.org/x/net/trace" ) -// GetSocketOption gets the socket option info of the conn. -func GetSocketOption(socket any) *SocketOptionData { - c, ok := socket.(syscall.Conn) - if !ok { - return nil - } - data := &SocketOptionData{} - if rawConn, err := c.SyscallConn(); err == nil { - rawConn.Control(data.Getsockopt) - return data - } - return nil +func newTrace(family, title string) traceLog { + return t.New(family, title) +} + +func newTraceContext(ctx context.Context, tr traceLog) context.Context { + return t.NewContext(ctx, tr) +} + +func newTraceEventLog(family, title string) traceEventLog { + return t.NewEventLog(family, title) } diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 6d2cadd79..bafaef99b 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.59.0" +const Version = "1.65.0" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh deleted file mode 100644 index bb480f1f9..000000000 --- a/vendor/google.golang.org/grpc/vet.sh +++ /dev/null @@ -1,212 +0,0 @@ -#!/bin/bash - -set -ex # Exit on error; debugging enabled. -set -o pipefail # Fail a pipe if any sub-command fails. - -# not makes sure the command passed to it does not exit with a return code of 0. -not() { - # This is required instead of the earlier (! $COMMAND) because subshells and - # pipefail don't work the same on Darwin as in Linux. - ! "$@" -} - -die() { - echo "$@" >&2 - exit 1 -} - -fail_on_output() { - tee /dev/stderr | not read -} - -# Check to make sure it's safe to modify the user's git repo. -git status --porcelain | fail_on_output - -# Undo any edits made by this script. -cleanup() { - git reset --hard HEAD -} -trap cleanup EXIT - -PATH="${HOME}/go/bin:${GOROOT}/bin:${PATH}" -go version - -if [[ "$1" = "-install" ]]; then - # Install the pinned versions as defined in module tools. - pushd ./test/tools - go install \ - golang.org/x/lint/golint \ - golang.org/x/tools/cmd/goimports \ - honnef.co/go/tools/cmd/staticcheck \ - github.com/client9/misspell/cmd/misspell - popd - if [[ -z "${VET_SKIP_PROTO}" ]]; then - if [[ "${GITHUB_ACTIONS}" = "true" ]]; then - PROTOBUF_VERSION=22.0 # a.k.a v4.22.0 in pb.go files. - PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip - pushd /home/runner/go - wget https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME} - unzip ${PROTOC_FILENAME} - bin/protoc --version - popd - elif not which protoc > /dev/null; then - die "Please install protoc into your path" - fi - fi - exit 0 -elif [[ "$#" -ne 0 ]]; then - die "Unknown argument(s): $*" -fi - -# - Check that generated proto files are up to date. -if [[ -z "${VET_SKIP_PROTO}" ]]; then - make proto && git status --porcelain 2>&1 | fail_on_output || \ - (git status; git --no-pager diff; exit 1) -fi - -if [[ -n "${VET_ONLY_PROTO}" ]]; then - exit 0 -fi - -# - Ensure all source files contain a copyright message. -# (Done in two parts because Darwin "git grep" has broken support for compound -# exclusion matches.) -(grep -L "DO NOT EDIT" $(git grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)" -- '*.go') || true) | fail_on_output - -# - Make sure all tests in grpc and grpc/test use leakcheck via Teardown. -not grep 'func Test[^(]' *_test.go -not grep 'func Test[^(]' test/*.go - -# - Do not import x/net/context. -not git grep -l 'x/net/context' -- "*.go" - -# - Do not import math/rand for real library code. Use internal/grpcrand for -# thread safety. -git grep -l '"math/rand"' -- "*.go" 2>&1 | not grep -v '^examples\|^stress\|grpcrand\|^benchmark\|wrr_test' - -# - Do not use "interface{}"; use "any" instead. -git grep -l 'interface{}' -- "*.go" 2>&1 | not grep -v '\.pb\.go\|protoc-gen-go-grpc' - -# - Do not call grpclog directly. Use grpclog.Component instead. -git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpclog.F' --or -e 'grpclog.V' -- "*.go" | not grep -v '^grpclog/component.go\|^internal/grpctest/tlogger_test.go' - -# - Ensure all ptypes proto packages are renamed when importing. -not git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go" - -# - Ensure all usages of grpc_testing package are renamed when importing. -not git grep "\(import \|^\s*\)\"google.golang.org/grpc/interop/grpc_testing" -- "*.go" - -# - Ensure all xds proto imports are renamed to *pb or *grpc. -git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*.pb.go' | not grep -v 'pb "\|grpc "' - -misspell -error . - -# - gofmt, goimports, golint (with exceptions for generated code), go vet, -# go mod tidy. -# Perform these checks on each module inside gRPC. -for MOD_FILE in $(find . -name 'go.mod'); do - MOD_DIR=$(dirname ${MOD_FILE}) - pushd ${MOD_DIR} - go vet -all ./... | fail_on_output - gofmt -s -d -l . 2>&1 | fail_on_output - goimports -l . 2>&1 | not grep -vE "\.pb\.go" - golint ./... 2>&1 | not grep -vE "/grpc_testing_not_regenerate/.*\.pb\.go:" - - go mod tidy -compat=1.19 - git status --porcelain 2>&1 | fail_on_output || \ - (git status; git --no-pager diff; exit 1) - popd -done - -# - Collection of static analysis checks -# -# TODO(dfawley): don't use deprecated functions in examples or first-party -# plugins. -# TODO(dfawley): enable ST1019 (duplicate imports) but allow for protobufs. -SC_OUT="$(mktemp)" -staticcheck -go 1.19 -checks 'inherit,-ST1015,-ST1019,-SA1019' ./... > "${SC_OUT}" || true -# Error if anything other than deprecation warnings are printed. -not grep -v "is deprecated:.*SA1019" "${SC_OUT}" -# Only ignore the following deprecated types/fields/functions. -not grep -Fv '.CredsBundle -.HeaderMap -.Metadata is deprecated: use Attributes -.NewAddress -.NewServiceConfig -.Type is deprecated: use Attributes -BuildVersion is deprecated -balancer.ErrTransientFailure -balancer.Picker -extDesc.Filename is deprecated -github.com/golang/protobuf/jsonpb is deprecated -grpc.CallCustomCodec -grpc.Code -grpc.Compressor -grpc.CustomCodec -grpc.Decompressor -grpc.MaxMsgSize -grpc.MethodConfig -grpc.NewGZIPCompressor -grpc.NewGZIPDecompressor -grpc.RPCCompressor -grpc.RPCDecompressor -grpc.ServiceConfig -grpc.WithCompressor -grpc.WithDecompressor -grpc.WithDialer -grpc.WithMaxMsgSize -grpc.WithServiceConfig -grpc.WithTimeout -http.CloseNotifier -info.SecurityVersion -proto is deprecated -proto.InternalMessageInfo is deprecated -proto.EnumName is deprecated -proto.ErrInternalBadWireType is deprecated -proto.FileDescriptor is deprecated -proto.Marshaler is deprecated -proto.MessageType is deprecated -proto.RegisterEnum is deprecated -proto.RegisterFile is deprecated -proto.RegisterType is deprecated -proto.RegisterExtension is deprecated -proto.RegisteredExtension is deprecated -proto.RegisteredExtensions is deprecated -proto.RegisterMapType is deprecated -proto.Unmarshaler is deprecated -Target is deprecated: Use the Target field in the BuildOptions instead. -xxx_messageInfo_ -' "${SC_OUT}" - -# - special golint on package comments. -lint_package_comment_per_package() { - # Number of files in this go package. - fileCount=$(go list -f '{{len .GoFiles}}' $1) - if [ ${fileCount} -eq 0 ]; then - return 0 - fi - # Number of package errors generated by golint. - lintPackageCommentErrorsCount=$(golint --min_confidence 0 $1 | grep -c "should have a package comment") - # golint complains about every file that's missing the package comment. If the - # number of files for this package is greater than the number of errors, there's - # at least one file with package comment, good. Otherwise, fail. - if [ ${fileCount} -le ${lintPackageCommentErrorsCount} ]; then - echo "Package $1 (with ${fileCount} files) is missing package comment" - return 1 - fi -} -lint_package_comment() { - set +ex - - count=0 - for i in $(go list ./...); do - lint_package_comment_per_package "$i" - ((count += $?)) - done - - set -ex - return $count -} -lint_package_comment - -echo SUCCESS diff --git a/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go b/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go new file mode 100644 index 000000000..2ef36bbcf --- /dev/null +++ b/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go @@ -0,0 +1,160 @@ +// Copyright 2022 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 protodelim marshals and unmarshals varint size-delimited messages. +package protodelim + +import ( + "bufio" + "encoding/binary" + "fmt" + "io" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/internal/errors" + "google.golang.org/protobuf/proto" +) + +// MarshalOptions is a configurable varint size-delimited marshaler. +type MarshalOptions struct{ proto.MarshalOptions } + +// MarshalTo writes a varint size-delimited wire-format message to w. +// If w returns an error, MarshalTo returns it unchanged. +func (o MarshalOptions) MarshalTo(w io.Writer, m proto.Message) (int, error) { + msgBytes, err := o.MarshalOptions.Marshal(m) + if err != nil { + return 0, err + } + + sizeBytes := protowire.AppendVarint(nil, uint64(len(msgBytes))) + sizeWritten, err := w.Write(sizeBytes) + if err != nil { + return sizeWritten, err + } + msgWritten, err := w.Write(msgBytes) + if err != nil { + return sizeWritten + msgWritten, err + } + return sizeWritten + msgWritten, nil +} + +// MarshalTo writes a varint size-delimited wire-format message to w +// with the default options. +// +// See the documentation for [MarshalOptions.MarshalTo]. +func MarshalTo(w io.Writer, m proto.Message) (int, error) { + return MarshalOptions{}.MarshalTo(w, m) +} + +// UnmarshalOptions is a configurable varint size-delimited unmarshaler. +type UnmarshalOptions struct { + proto.UnmarshalOptions + + // MaxSize is the maximum size in wire-format bytes of a single message. + // Unmarshaling a message larger than MaxSize will return an error. + // A zero MaxSize will default to 4 MiB. + // Setting MaxSize to -1 disables the limit. + MaxSize int64 +} + +const defaultMaxSize = 4 << 20 // 4 MiB, corresponds to the default gRPC max request/response size + +// SizeTooLargeError is an error that is returned when the unmarshaler encounters a message size +// that is larger than its configured [UnmarshalOptions.MaxSize]. +type SizeTooLargeError struct { + // Size is the varint size of the message encountered + // that was larger than the provided MaxSize. + Size uint64 + + // MaxSize is the MaxSize limit configured in UnmarshalOptions, which Size exceeded. + MaxSize uint64 +} + +func (e *SizeTooLargeError) Error() string { + return fmt.Sprintf("message size %d exceeded unmarshaler's maximum configured size %d", e.Size, e.MaxSize) +} + +// Reader is the interface expected by [UnmarshalFrom]. +// It is implemented by *[bufio.Reader]. +type Reader interface { + io.Reader + io.ByteReader +} + +// UnmarshalFrom parses and consumes a varint size-delimited wire-format message +// from r. +// The provided message must be mutable (e.g., a non-nil pointer to a message). +// +// The error is [io.EOF] error only if no bytes are read. +// If an EOF happens after reading some but not all the bytes, +// UnmarshalFrom returns a non-io.EOF error. +// In particular if r returns a non-io.EOF error, UnmarshalFrom returns it unchanged, +// and if only a size is read with no subsequent message, [io.ErrUnexpectedEOF] is returned. +func (o UnmarshalOptions) UnmarshalFrom(r Reader, m proto.Message) error { + var sizeArr [binary.MaxVarintLen64]byte + sizeBuf := sizeArr[:0] + for i := range sizeArr { + b, err := r.ReadByte() + if err != nil { + // Immediate EOF is unexpected. + if err == io.EOF && i != 0 { + break + } + return err + } + sizeBuf = append(sizeBuf, b) + if b < 0x80 { + break + } + } + size, n := protowire.ConsumeVarint(sizeBuf) + if n < 0 { + return protowire.ParseError(n) + } + + maxSize := o.MaxSize + if maxSize == 0 { + maxSize = defaultMaxSize + } + if maxSize != -1 && size > uint64(maxSize) { + return errors.Wrap(&SizeTooLargeError{Size: size, MaxSize: uint64(maxSize)}, "") + } + + var b []byte + var err error + if br, ok := r.(*bufio.Reader); ok { + // Use the []byte from the bufio.Reader instead of having to allocate one. + // This reduces CPU usage and allocated bytes. + b, err = br.Peek(int(size)) + if err == nil { + defer br.Discard(int(size)) + } else { + b = nil + } + } + if b == nil { + b = make([]byte, size) + _, err = io.ReadFull(r, b) + } + + if err == io.EOF { + return io.ErrUnexpectedEOF + } + if err != nil { + return err + } + if err := o.Unmarshal(b, m); err != nil { + return err + } + return nil +} + +// UnmarshalFrom parses and consumes a varint size-delimited wire-format message +// from r with the default options. +// The provided message must be mutable (e.g., a non-nil pointer to a message). +// +// See the documentation for [UnmarshalOptions.UnmarshalFrom]. +func UnmarshalFrom(r Reader, m proto.Message) error { + return UnmarshalOptions{}.UnmarshalFrom(r, m) +} diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/decode.go b/vendor/google.golang.org/protobuf/encoding/protojson/decode.go index f47902371..8f9e592f8 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/decode.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/decode.go @@ -102,7 +102,7 @@ type decoder struct { } // newError returns an error object with position info. -func (d decoder) newError(pos int, f string, x ...interface{}) error { +func (d decoder) newError(pos int, f string, x ...any) error { line, column := d.Position(pos) head := fmt.Sprintf("(line %d:%d): ", line, column) return errors.New(head+f, x...) @@ -114,7 +114,7 @@ func (d decoder) unexpectedTokenError(tok json.Token) error { } // syntaxError returns a syntax error for given position. -func (d decoder) syntaxError(pos int, f string, x ...interface{}) error { +func (d decoder) syntaxError(pos int, f string, x ...any) error { line, column := d.Position(pos) head := fmt.Sprintf("syntax error (line %d:%d): ", line, column) return errors.New(head+f, x...) @@ -351,7 +351,7 @@ func (d decoder) unmarshalScalar(fd protoreflect.FieldDescriptor) (protoreflect. panic(fmt.Sprintf("unmarshalScalar: invalid scalar kind %v", kind)) } - return protoreflect.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString()) + return protoreflect.Value{}, d.newError(tok.Pos(), "invalid value for %v field %v: %v", kind, fd.JSONName(), tok.RawString()) } func unmarshalInt(tok json.Token, bitSize int) (protoreflect.Value, bool) { diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/encode.go b/vendor/google.golang.org/protobuf/encoding/protojson/encode.go index 3f75098b6..0e72d8537 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/encode.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/encode.go @@ -25,15 +25,17 @@ const defaultIndent = " " // Format formats the message as a multiline string. // This function is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module. func Format(m proto.Message) string { return MarshalOptions{Multiline: true}.Format(m) } // Marshal writes the given [proto.Message] in JSON format using default options. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module. func Marshal(m proto.Message) ([]byte, error) { return MarshalOptions{}.Marshal(m) } @@ -110,8 +112,9 @@ type MarshalOptions struct { // Format formats the message as a string. // This method is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module. func (o MarshalOptions) Format(m proto.Message) string { if m == nil || !m.ProtoReflect().IsValid() { return "" // invalid syntax, but okay since this is for debugging @@ -122,8 +125,9 @@ func (o MarshalOptions) Format(m proto.Message) string { } // Marshal marshals the given [proto.Message] in the JSON format using options in -// MarshalOptions. Do not depend on the output being stable. It may change over -// time across different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module. func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) { return o.marshal(nil, m) } @@ -212,9 +216,7 @@ func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, proto } v := m.Get(fd) - isProto2Scalar := fd.Syntax() == protoreflect.Proto2 && fd.Default().IsValid() - isSingularMessage := fd.Cardinality() != protoreflect.Repeated && fd.Message() != nil - if isProto2Scalar || isSingularMessage { + if fd.HasPresence() { if m.skipNull { continue } diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go index a45f112bc..24bc98ac4 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go @@ -84,7 +84,7 @@ type decoder struct { } // newError returns an error object with position info. -func (d decoder) newError(pos int, f string, x ...interface{}) error { +func (d decoder) newError(pos int, f string, x ...any) error { line, column := d.Position(pos) head := fmt.Sprintf("(line %d:%d): ", line, column) return errors.New(head+f, x...) @@ -96,7 +96,7 @@ func (d decoder) unexpectedTokenError(tok text.Token) error { } // syntaxError returns a syntax error for given position. -func (d decoder) syntaxError(pos int, f string, x ...interface{}) error { +func (d decoder) syntaxError(pos int, f string, x ...any) error { line, column := d.Position(pos) head := fmt.Sprintf("syntax error (line %d:%d): ", line, column) return errors.New(head+f, x...) diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go index 95967e811..1f57e6610 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go @@ -27,15 +27,17 @@ const defaultIndent = " " // Format formats the message as a multiline string. // This function is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module. func Format(m proto.Message) string { return MarshalOptions{Multiline: true}.Format(m) } // Marshal writes the given [proto.Message] in textproto format using default -// options. Do not depend on the output being stable. It may change over time -// across different versions of the program. +// options. Do not depend on the output being stable. Its output will change +// across different builds of your program, even when using the same version of +// the protobuf module. func Marshal(m proto.Message) ([]byte, error) { return MarshalOptions{}.Marshal(m) } @@ -84,8 +86,9 @@ type MarshalOptions struct { // Format formats the message as a string. // This method is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module. func (o MarshalOptions) Format(m proto.Message) string { if m == nil || !m.ProtoReflect().IsValid() { return "" // invalid syntax, but okay since this is for debugging @@ -98,8 +101,9 @@ func (o MarshalOptions) Format(m proto.Message) string { } // Marshal writes the given [proto.Message] in textproto format using options in -// MarshalOptions object. Do not depend on the output being stable. It may -// change over time across different versions of the program. +// MarshalOptions object. Do not depend on the output being stable. Its output +// will change across different builds of your program, even when using the +// same version of the protobuf module. func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) { return o.marshal(nil, m) } diff --git a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go index a45625c8d..87e46bd4d 100644 --- a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +++ b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go @@ -252,6 +252,7 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record fu {rv.MethodByName("Values"), "Values"}, {rv.MethodByName("ReservedNames"), "ReservedNames"}, {rv.MethodByName("ReservedRanges"), "ReservedRanges"}, + {rv.MethodByName("IsClosed"), "IsClosed"}, }...) case protoreflect.EnumValueDescriptor: diff --git a/vendor/google.golang.org/protobuf/internal/descopts/options.go b/vendor/google.golang.org/protobuf/internal/descopts/options.go index 8401be8c8..024ffebd3 100644 --- a/vendor/google.golang.org/protobuf/internal/descopts/options.go +++ b/vendor/google.golang.org/protobuf/internal/descopts/options.go @@ -9,7 +9,7 @@ // dependency on the descriptor proto package). package descopts -import pref "google.golang.org/protobuf/reflect/protoreflect" +import "google.golang.org/protobuf/reflect/protoreflect" // These variables are set by the init function in descriptor.pb.go via logic // in internal/filetype. In other words, so long as the descriptor proto package @@ -17,13 +17,13 @@ import pref "google.golang.org/protobuf/reflect/protoreflect" // // Each variable is populated with a nil pointer to the options struct. var ( - File pref.ProtoMessage - Enum pref.ProtoMessage - EnumValue pref.ProtoMessage - Message pref.ProtoMessage - Field pref.ProtoMessage - Oneof pref.ProtoMessage - ExtensionRange pref.ProtoMessage - Service pref.ProtoMessage - Method pref.ProtoMessage + File protoreflect.ProtoMessage + Enum protoreflect.ProtoMessage + EnumValue protoreflect.ProtoMessage + Message protoreflect.ProtoMessage + Field protoreflect.ProtoMessage + Oneof protoreflect.ProtoMessage + ExtensionRange protoreflect.ProtoMessage + Service protoreflect.ProtoMessage + Method protoreflect.ProtoMessage ) diff --git a/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb b/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb index 18f0756874367adcdb790ffde125b6a7388b4eaa..ff6a38360add36f53d48bb0863b701696e0d7b2d 100644 GIT binary patch literal 93 zcmd;*mUzal#C*w)K}(Q>QGiK;Nr72|(SYfa9TNv5m$bxlxFnMRqXeS@6Ht;7B*_4j Ve8H{+(u69m1u{(G8N0>{b^xZ!4_5#H literal 63 zcmd-Q6yo7v6kw8IQef6#G+>f=#?A#2ViI7KU{qiN3NcDNhX^qu3B6!fc*d^rf*k<7 Cln3+x diff --git a/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go b/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go new file mode 100644 index 000000000..08dad7692 --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go @@ -0,0 +1,13 @@ +// Copyright 2024 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 editionssupport defines constants for editions that are supported. +package editionssupport + +import "google.golang.org/protobuf/types/descriptorpb" + +const ( + Minimum = descriptorpb.Edition_EDITION_PROTO2 + Maximum = descriptorpb.Edition_EDITION_2023 +) diff --git a/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go index d2b3ac031..ea1d3e65a 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/json/decode.go @@ -214,7 +214,7 @@ func (d *Decoder) parseNext() (Token, error) { // newSyntaxError returns an error with line and column information useful for // syntax errors. -func (d *Decoder) newSyntaxError(pos int, f string, x ...interface{}) error { +func (d *Decoder) newSyntaxError(pos int, f string, x ...any) error { e := errors.New(f, x...) line, column := d.Position(pos) return errors.New("syntax error (line %d:%d): %v", line, column, e) diff --git a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go index 373d20837..7e87c7604 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go @@ -32,6 +32,7 @@ var byteType = reflect.TypeOf(byte(0)) func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor { f := new(filedesc.Field) f.L0.ParentFile = filedesc.SurrogateProto2 + f.L1.EditionFeatures = f.L0.ParentFile.L1.EditionFeatures for len(tag) > 0 { i := strings.IndexByte(tag, ',') if i < 0 { @@ -107,8 +108,7 @@ func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescri f.L1.StringName.InitJSON(jsonName) } case s == "packed": - f.L1.HasPacked = true - f.L1.IsPacked = true + f.L1.EditionFeatures.IsPacked = true case strings.HasPrefix(s, "weak="): f.L1.IsWeak = true f.L1.Message = filedesc.PlaceholderMessage(protoreflect.FullName(s[len("weak="):])) diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go index 87853e786..099b2bf45 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go @@ -601,7 +601,7 @@ func (d *Decoder) consumeToken(kind Kind, size int, attrs uint8) Token { // newSyntaxError returns a syntax error with line and column information for // current position. -func (d *Decoder) newSyntaxError(f string, x ...interface{}) error { +func (d *Decoder) newSyntaxError(f string, x ...any) error { e := errors.New(f, x...) line, column := d.Position(len(d.orig) - len(d.in)) return errors.New("syntax error (line %d:%d): %v", line, column, e) diff --git a/vendor/google.golang.org/protobuf/internal/errors/errors.go b/vendor/google.golang.org/protobuf/internal/errors/errors.go index 20c17b35e..c2d6bd526 100644 --- a/vendor/google.golang.org/protobuf/internal/errors/errors.go +++ b/vendor/google.golang.org/protobuf/internal/errors/errors.go @@ -17,7 +17,7 @@ var Error = errors.New("protobuf error") // New formats a string according to the format specifier and arguments and // returns an error that has a "proto" prefix. -func New(f string, x ...interface{}) error { +func New(f string, x ...any) error { return &prefixError{s: format(f, x...)} } @@ -43,7 +43,7 @@ func (e *prefixError) Unwrap() error { // Wrap returns an error that has a "proto" prefix, the formatted string described // by the format specifier and arguments, and a suffix of err. The error wraps err. -func Wrap(err error, f string, x ...interface{}) error { +func Wrap(err error, f string, x ...any) error { return &wrapError{ s: format(f, x...), err: err, @@ -67,7 +67,7 @@ func (e *wrapError) Is(target error) bool { return target == Error } -func format(f string, x ...interface{}) string { +func format(f string, x ...any) string { // avoid "proto: " prefix when chaining for i := 0; i < len(x); i++ { switch e := x[i].(type) { @@ -87,3 +87,18 @@ func InvalidUTF8(name string) error { func RequiredNotSet(name string) error { return New("required field %v not set", name) } + +type SizeMismatchError struct { + Calculated, Measured int +} + +func (e *SizeMismatchError) Error() string { + return fmt.Sprintf("size mismatch (see https://github.com/golang/protobuf/issues/1609): calculated=%d, measured=%d", e.Calculated, e.Measured) +} + +func MismatchedSizeCalculation(calculated, measured int) error { + return &SizeMismatchError{ + Calculated: calculated, + Measured: measured, + } +} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go index 8826bcf40..fa790e0ff 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go @@ -7,6 +7,7 @@ package filedesc import ( "bytes" "fmt" + "strings" "sync" "sync/atomic" @@ -108,9 +109,12 @@ func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd } func (fd *File) Parent() protoreflect.Descriptor { return nil } func (fd *File) Index() int { return 0 } func (fd *File) Syntax() protoreflect.Syntax { return fd.L1.Syntax } -func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() } -func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package } -func (fd *File) IsPlaceholder() bool { return false } + +// Not exported and just used to reconstruct the original FileDescriptor proto +func (fd *File) Edition() int32 { return int32(fd.L1.Edition) } +func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() } +func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package } +func (fd *File) IsPlaceholder() bool { return false } func (fd *File) Options() protoreflect.ProtoMessage { if f := fd.lazyInit().Options; f != nil { return f() @@ -202,6 +206,9 @@ func (ed *Enum) lazyInit() *EnumL2 { ed.L0.ParentFile.lazyInit() // implicitly initializes L2 return ed.L2 } +func (ed *Enum) IsClosed() bool { + return !ed.L1.EditionFeatures.IsOpenEnum +} func (ed *EnumValue) Options() protoreflect.ProtoMessage { if f := ed.L1.Options; f != nil { @@ -251,10 +258,7 @@ type ( StringName stringName IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto IsWeak bool // promoted from google.protobuf.FieldOptions - HasPacked bool // promoted from google.protobuf.FieldOptions - IsPacked bool // promoted from google.protobuf.FieldOptions - HasEnforceUTF8 bool // promoted from google.protobuf.FieldOptions - EnforceUTF8 bool // promoted from google.protobuf.FieldOptions + IsLazy bool // promoted from google.protobuf.FieldOptions Default defaultValue ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields Enum protoreflect.EnumDescriptor @@ -331,8 +335,7 @@ func (fd *Field) HasPresence() bool { if fd.L1.Cardinality == protoreflect.Repeated { return false } - explicitFieldPresence := fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsFieldPresence - return fd.Syntax() == protoreflect.Proto2 || explicitFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil + return fd.IsExtension() || fd.L1.EditionFeatures.IsFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil } func (fd *Field) HasOptionalKeyword() bool { return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional @@ -345,17 +348,11 @@ func (fd *Field) IsPacked() bool { case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind: return false } - if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions { - return fd.L1.EditionFeatures.IsPacked - } - if fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3 { - // proto3 repeated fields are packed by default. - return !fd.L1.HasPacked || fd.L1.IsPacked - } - return fd.L1.IsPacked + return fd.L1.EditionFeatures.IsPacked } func (fd *Field) IsExtension() bool { return false } func (fd *Field) IsWeak() bool { return fd.L1.IsWeak } +func (fd *Field) IsLazy() bool { return fd.L1.IsLazy } func (fd *Field) IsList() bool { return fd.Cardinality() == protoreflect.Repeated && !fd.IsMap() } func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() } func (fd *Field) MapKey() protoreflect.FieldDescriptor { @@ -388,6 +385,10 @@ func (fd *Field) Message() protoreflect.MessageDescriptor { } return fd.L1.Message } +func (fd *Field) IsMapEntry() bool { + parent, ok := fd.L0.Parent.(protoreflect.MessageDescriptor) + return ok && parent.IsMapEntry() +} func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) } func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {} @@ -399,13 +400,7 @@ func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {} // WARNING: This method is exempt from the compatibility promise and may be // removed in the future without warning. func (fd *Field) EnforceUTF8() bool { - if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions { - return fd.L1.EditionFeatures.IsUTF8Validated - } - if fd.L1.HasEnforceUTF8 { - return fd.L1.EnforceUTF8 - } - return fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3 + return fd.L1.EditionFeatures.IsUTF8Validated } func (od *Oneof) IsSynthetic() bool { @@ -432,13 +427,13 @@ type ( Extendee protoreflect.MessageDescriptor Cardinality protoreflect.Cardinality Kind protoreflect.Kind + IsLazy bool EditionFeatures EditionFeatures } ExtensionL2 struct { Options func() protoreflect.ProtoMessage StringName stringName IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto - IsPacked bool // promoted from google.protobuf.FieldOptions Default defaultValue Enum protoreflect.EnumDescriptor Message protoreflect.MessageDescriptor @@ -461,9 +456,19 @@ func (xd *Extension) HasPresence() bool { return xd.L1.Cardi func (xd *Extension) HasOptionalKeyword() bool { return (xd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && xd.L1.Cardinality == protoreflect.Optional) || xd.lazyInit().IsProto3Optional } -func (xd *Extension) IsPacked() bool { return xd.lazyInit().IsPacked } +func (xd *Extension) IsPacked() bool { + if xd.L1.Cardinality != protoreflect.Repeated { + return false + } + switch xd.L1.Kind { + case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind: + return false + } + return xd.L1.EditionFeatures.IsPacked +} func (xd *Extension) IsExtension() bool { return true } func (xd *Extension) IsWeak() bool { return false } +func (xd *Extension) IsLazy() bool { return xd.L1.IsLazy } func (xd *Extension) IsList() bool { return xd.Cardinality() == protoreflect.Repeated } func (xd *Extension) IsMap() bool { return false } func (xd *Extension) MapKey() protoreflect.FieldDescriptor { return nil } @@ -542,8 +547,9 @@ func (md *Method) ProtoInternal(pragma.DoNotImplement) {} // Surrogate files are can be used to create standalone descriptors // where the syntax is only information derived from the parent file. var ( - SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}} - SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}} + SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}} + SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}} + SurrogateEdition2023 = &File{L1: FileL1{Syntax: protoreflect.Editions, Edition: Edition2023}, L2: &FileL2{}} ) type ( @@ -585,6 +591,34 @@ func (s *stringName) InitJSON(name string) { s.nameJSON = name } +// Returns true if this field is structured like the synthetic field of a proto2 +// group. This allows us to expand our treatment of delimited fields without +// breaking proto2 files that have been upgraded to editions. +func isGroupLike(fd protoreflect.FieldDescriptor) bool { + // Groups are always group types. + if fd.Kind() != protoreflect.GroupKind { + return false + } + + // Group fields are always the lowercase type name. + if strings.ToLower(string(fd.Message().Name())) != string(fd.Name()) { + return false + } + + // Groups could only be defined in the same file they're used. + if fd.Message().ParentFile() != fd.ParentFile() { + return false + } + + // Group messages are always defined in the same scope as the field. File + // level extensions will compare NULL == NULL here, which is why the file + // comparison above is necessary to ensure both come from the same file. + if fd.IsExtension() { + return fd.Parent() == fd.Message().Parent() + } + return fd.ContainingMessage() == fd.Message().Parent() +} + func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName { s.once.Do(func() { if fd.IsExtension() { @@ -605,7 +639,7 @@ func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName { // Format the text name. s.nameText = string(fd.Name()) - if fd.Kind() == protoreflect.GroupKind { + if isGroupLike(fd) { s.nameText = string(fd.Message().Name()) } } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go index 237e64fd2..d2f549497 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go @@ -113,8 +113,10 @@ func (fd *File) unmarshalSeed(b []byte) { switch string(v) { case "proto2": fd.L1.Syntax = protoreflect.Proto2 + fd.L1.Edition = EditionProto2 case "proto3": fd.L1.Syntax = protoreflect.Proto3 + fd.L1.Edition = EditionProto3 case "editions": fd.L1.Syntax = protoreflect.Editions default: @@ -177,11 +179,10 @@ func (fd *File) unmarshalSeed(b []byte) { // If syntax is missing, it is assumed to be proto2. if fd.L1.Syntax == 0 { fd.L1.Syntax = protoreflect.Proto2 + fd.L1.Edition = EditionProto2 } - if fd.L1.Syntax == protoreflect.Editions { - fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition) - } + fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition) // Parse editions features from options if any if options != nil { @@ -267,6 +268,7 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protorefl ed.L0.ParentFile = pf ed.L0.Parent = pd ed.L0.Index = i + ed.L1.EditionFeatures = featuresFromParentDesc(ed.Parent()) var numValues int for b := b; len(b) > 0; { @@ -443,6 +445,7 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd prot xd.L0.ParentFile = pf xd.L0.Parent = pd xd.L0.Index = i + xd.L1.EditionFeatures = featuresFromParentDesc(pd) for len(b) > 0 { num, typ, n := protowire.ConsumeTag(b) @@ -467,6 +470,40 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd prot xd.L0.FullName = appendFullName(sb, pd.FullName(), v) case genid.FieldDescriptorProto_Extendee_field_number: xd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v)) + case genid.FieldDescriptorProto_Options_field_number: + xd.unmarshalOptions(v) + } + default: + m := protowire.ConsumeFieldValue(num, typ, b) + b = b[m:] + } + } + + if xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded { + xd.L1.Kind = protoreflect.GroupKind + } +} + +func (xd *Extension) unmarshalOptions(b []byte) { + for len(b) > 0 { + num, typ, n := protowire.ConsumeTag(b) + b = b[n:] + switch typ { + case protowire.VarintType: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + switch num { + case genid.FieldOptions_Packed_field_number: + xd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v) + case genid.FieldOptions_Lazy_field_number: + xd.L1.IsLazy = protowire.DecodeBool(v) + } + case protowire.BytesType: + v, m := protowire.ConsumeBytes(b) + b = b[m:] + switch num { + case genid.FieldOptions_Features_field_number: + xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures) } default: m := protowire.ConsumeFieldValue(num, typ, b) @@ -499,7 +536,7 @@ func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protor } var nameBuilderPool = sync.Pool{ - New: func() interface{} { return new(strs.Builder) }, + New: func() any { return new(strs.Builder) }, } func getBuilder() *strs.Builder { diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go index 482a61cc1..67a51b327 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go @@ -45,6 +45,11 @@ func (file *File) resolveMessages() { case protoreflect.MessageKind, protoreflect.GroupKind: fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx) depIdx++ + if fd.L1.Kind == protoreflect.GroupKind && (fd.IsMap() || fd.IsMapEntry()) { + // A map field might inherit delimited encoding from a file-wide default feature. + // But maps never actually use delimited encoding. (At least for now...) + fd.L1.Kind = protoreflect.MessageKind + } } // Default is resolved here since it depends on Enum being resolved. @@ -466,10 +471,10 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref b = b[m:] } } - if fd.Syntax() == protoreflect.Editions && fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded { + if fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded { fd.L1.Kind = protoreflect.GroupKind } - if fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsLegacyRequired { + if fd.L1.EditionFeatures.IsLegacyRequired { fd.L1.Cardinality = protoreflect.Required } if rawTypeName != nil { @@ -496,13 +501,13 @@ func (fd *Field) unmarshalOptions(b []byte) { b = b[m:] switch num { case genid.FieldOptions_Packed_field_number: - fd.L1.HasPacked = true - fd.L1.IsPacked = protowire.DecodeBool(v) + fd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v) case genid.FieldOptions_Weak_field_number: fd.L1.IsWeak = protowire.DecodeBool(v) + case genid.FieldOptions_Lazy_field_number: + fd.L1.IsLazy = protowire.DecodeBool(v) case FieldOptions_EnforceUTF8: - fd.L1.HasEnforceUTF8 = true - fd.L1.EnforceUTF8 = protowire.DecodeBool(v) + fd.L1.EditionFeatures.IsUTF8Validated = protowire.DecodeBool(v) } case protowire.BytesType: v, m := protowire.ConsumeBytes(b) @@ -548,7 +553,6 @@ func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) { var rawTypeName []byte var rawOptions []byte - xd.L1.EditionFeatures = featuresFromParentDesc(xd.L1.Extendee) xd.L2 = new(ExtensionL2) for len(b) > 0 { num, typ, n := protowire.ConsumeTag(b) @@ -572,7 +576,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) { case genid.FieldDescriptorProto_TypeName_field_number: rawTypeName = v case genid.FieldDescriptorProto_Options_field_number: - xd.unmarshalOptions(v) rawOptions = appendOptions(rawOptions, v) } default: @@ -580,12 +583,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) { b = b[m:] } } - if xd.Syntax() == protoreflect.Editions && xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded { - xd.L1.Kind = protoreflect.GroupKind - } - if xd.Syntax() == protoreflect.Editions && xd.L1.EditionFeatures.IsLegacyRequired { - xd.L1.Cardinality = protoreflect.Required - } if rawTypeName != nil { name := makeFullName(sb, rawTypeName) switch xd.L1.Kind { @@ -598,32 +595,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) { xd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions) } -func (xd *Extension) unmarshalOptions(b []byte) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.FieldOptions_Packed_field_number: - xd.L2.IsPacked = protowire.DecodeBool(v) - } - case protowire.BytesType: - v, m := protowire.ConsumeBytes(b) - b = b[m:] - switch num { - case genid.FieldOptions_Features_field_number: - xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) { var rawMethods [][]byte var rawOptions []byte diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go index 30db19fdc..f4107c05f 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go @@ -8,6 +8,7 @@ package filedesc import ( "fmt" + "strings" "sync" "google.golang.org/protobuf/internal/descfmt" @@ -198,6 +199,16 @@ func (p *Fields) lazyInit() *Fields { if _, ok := p.byText[d.TextName()]; !ok { p.byText[d.TextName()] = d } + if isGroupLike(d) { + lowerJSONName := strings.ToLower(d.JSONName()) + if _, ok := p.byJSON[lowerJSONName]; !ok { + p.byJSON[lowerJSONName] = d + } + lowerTextName := strings.ToLower(d.TextName()) + if _, ok := p.byText[lowerTextName]; !ok { + p.byText[lowerTextName] = d + } + } if _, ok := p.byNum[d.Number()]; !ok { p.byNum[d.Number()] = d } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go index 0375a49d4..fd4d0c83d 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go @@ -14,9 +14,13 @@ import ( ) var defaultsCache = make(map[Edition]EditionFeatures) +var defaultsKeys = []Edition{} func init() { unmarshalEditionDefaults(editiondefaults.Defaults) + SurrogateProto2.L1.EditionFeatures = getFeaturesFor(EditionProto2) + SurrogateProto3.L1.EditionFeatures = getFeaturesFor(EditionProto3) + SurrogateEdition2023.L1.EditionFeatures = getFeaturesFor(Edition2023) } func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures { @@ -64,7 +68,7 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures { v, m := protowire.ConsumeBytes(b) b = b[m:] switch num { - case genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number: + case genid.FeatureSet_Go_ext_number: parent = unmarshalGoFeature(v, parent) } } @@ -104,12 +108,15 @@ func unmarshalEditionDefault(b []byte) { v, m := protowire.ConsumeBytes(b) b = b[m:] switch num { - case genid.FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number: + case genid.FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_number: + fs = unmarshalFeatureSet(v, fs) + case genid.FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_number: fs = unmarshalFeatureSet(v, fs) } } } defaultsCache[ed] = fs + defaultsKeys = append(defaultsKeys, ed) } func unmarshalEditionDefaults(b []byte) { @@ -135,8 +142,15 @@ func unmarshalEditionDefaults(b []byte) { } func getFeaturesFor(ed Edition) EditionFeatures { - if def, ok := defaultsCache[ed]; ok { - return def + match := EditionUnknown + for _, key := range defaultsKeys { + if key > ed { + break + } + match = key + } + if match == EditionUnknown { + panic(fmt.Sprintf("unsupported edition: %v", ed)) } - panic(fmt.Sprintf("unsupported edition: %v", ed)) + return defaultsCache[match] } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go b/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go index 28240ebc5..bfb3b8417 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go @@ -63,6 +63,7 @@ func (e PlaceholderEnum) Options() protoreflect.ProtoMessage { return des func (e PlaceholderEnum) Values() protoreflect.EnumValueDescriptors { return emptyEnumValues } func (e PlaceholderEnum) ReservedNames() protoreflect.Names { return emptyNames } func (e PlaceholderEnum) ReservedRanges() protoreflect.EnumRanges { return emptyEnumRanges } +func (e PlaceholderEnum) IsClosed() bool { return false } func (e PlaceholderEnum) ProtoType(protoreflect.EnumDescriptor) { return } func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return } diff --git a/vendor/google.golang.org/protobuf/internal/filetype/build.go b/vendor/google.golang.org/protobuf/internal/filetype/build.go index f0e38c4ef..ba83fea44 100644 --- a/vendor/google.golang.org/protobuf/internal/filetype/build.go +++ b/vendor/google.golang.org/protobuf/internal/filetype/build.go @@ -68,7 +68,7 @@ type Builder struct { // and for input and output messages referenced by service methods. // Dependencies must come after declarations, but the ordering of // dependencies themselves is unspecified. - GoTypes []interface{} + GoTypes []any // DependencyIndexes is an ordered list of indexes into GoTypes for the // dependencies of messages, extensions, or services. @@ -268,7 +268,7 @@ func (x depIdxs) Get(i, j int32) int32 { type ( resolverByIndex struct { - goTypes []interface{} + goTypes []any depIdxs depIdxs fileRegistry } diff --git a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go index 40272c893..f30ab6b58 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go @@ -21,6 +21,7 @@ const ( // Enum values for google.protobuf.Edition. const ( Edition_EDITION_UNKNOWN_enum_value = 0 + Edition_EDITION_LEGACY_enum_value = 900 Edition_EDITION_PROTO2_enum_value = 998 Edition_EDITION_PROTO3_enum_value = 999 Edition_EDITION_2023_enum_value = 1000 @@ -653,6 +654,7 @@ const ( FieldOptions_Targets_field_name protoreflect.Name = "targets" FieldOptions_EditionDefaults_field_name protoreflect.Name = "edition_defaults" FieldOptions_Features_field_name protoreflect.Name = "features" + FieldOptions_FeatureSupport_field_name protoreflect.Name = "feature_support" FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype" @@ -667,6 +669,7 @@ const ( FieldOptions_Targets_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.targets" FieldOptions_EditionDefaults_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.edition_defaults" FieldOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.features" + FieldOptions_FeatureSupport_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.feature_support" FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option" ) @@ -684,6 +687,7 @@ const ( FieldOptions_Targets_field_number protoreflect.FieldNumber = 19 FieldOptions_EditionDefaults_field_number protoreflect.FieldNumber = 20 FieldOptions_Features_field_number protoreflect.FieldNumber = 21 + FieldOptions_FeatureSupport_field_number protoreflect.FieldNumber = 22 FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -767,6 +771,33 @@ const ( FieldOptions_EditionDefault_Value_field_number protoreflect.FieldNumber = 2 ) +// Names for google.protobuf.FieldOptions.FeatureSupport. +const ( + FieldOptions_FeatureSupport_message_name protoreflect.Name = "FeatureSupport" + FieldOptions_FeatureSupport_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport" +) + +// Field names for google.protobuf.FieldOptions.FeatureSupport. +const ( + FieldOptions_FeatureSupport_EditionIntroduced_field_name protoreflect.Name = "edition_introduced" + FieldOptions_FeatureSupport_EditionDeprecated_field_name protoreflect.Name = "edition_deprecated" + FieldOptions_FeatureSupport_DeprecationWarning_field_name protoreflect.Name = "deprecation_warning" + FieldOptions_FeatureSupport_EditionRemoved_field_name protoreflect.Name = "edition_removed" + + FieldOptions_FeatureSupport_EditionIntroduced_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_introduced" + FieldOptions_FeatureSupport_EditionDeprecated_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_deprecated" + FieldOptions_FeatureSupport_DeprecationWarning_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.deprecation_warning" + FieldOptions_FeatureSupport_EditionRemoved_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.FeatureSupport.edition_removed" +) + +// Field numbers for google.protobuf.FieldOptions.FeatureSupport. +const ( + FieldOptions_FeatureSupport_EditionIntroduced_field_number protoreflect.FieldNumber = 1 + FieldOptions_FeatureSupport_EditionDeprecated_field_number protoreflect.FieldNumber = 2 + FieldOptions_FeatureSupport_DeprecationWarning_field_number protoreflect.FieldNumber = 3 + FieldOptions_FeatureSupport_EditionRemoved_field_number protoreflect.FieldNumber = 4 +) + // Names for google.protobuf.OneofOptions. const ( OneofOptions_message_name protoreflect.Name = "OneofOptions" @@ -829,11 +860,13 @@ const ( EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated" EnumValueOptions_Features_field_name protoreflect.Name = "features" EnumValueOptions_DebugRedact_field_name protoreflect.Name = "debug_redact" + EnumValueOptions_FeatureSupport_field_name protoreflect.Name = "feature_support" EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option" EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated" EnumValueOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.features" EnumValueOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.debug_redact" + EnumValueOptions_FeatureSupport_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.feature_support" EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option" ) @@ -842,6 +875,7 @@ const ( EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1 EnumValueOptions_Features_field_number protoreflect.FieldNumber = 2 EnumValueOptions_DebugRedact_field_number protoreflect.FieldNumber = 3 + EnumValueOptions_FeatureSupport_field_number protoreflect.FieldNumber = 4 EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999 ) @@ -1110,17 +1144,20 @@ const ( // Field names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault. const ( - FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_name protoreflect.Name = "edition" - FeatureSetDefaults_FeatureSetEditionDefault_Features_field_name protoreflect.Name = "features" + FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_name protoreflect.Name = "edition" + FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_name protoreflect.Name = "overridable_features" + FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_name protoreflect.Name = "fixed_features" - FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition" - FeatureSetDefaults_FeatureSetEditionDefault_Features_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features" + FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition" + FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features" + FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features" ) // Field numbers for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault. const ( - FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number protoreflect.FieldNumber = 3 - FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number protoreflect.FieldNumber = 2 + FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number protoreflect.FieldNumber = 3 + FeatureSetDefaults_FeatureSetEditionDefault_OverridableFeatures_field_number protoreflect.FieldNumber = 4 + FeatureSetDefaults_FeatureSetEditionDefault_FixedFeatures_field_number protoreflect.FieldNumber = 5 ) // Names for google.protobuf.SourceCodeInfo. diff --git a/vendor/google.golang.org/protobuf/internal/genid/doc.go b/vendor/google.golang.org/protobuf/internal/genid/doc.go index 45ccd0121..d9b9d916a 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/doc.go +++ b/vendor/google.golang.org/protobuf/internal/genid/doc.go @@ -6,6 +6,6 @@ // and the well-known types. package genid -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" +import "google.golang.org/protobuf/reflect/protoreflect" const GoogleProtobuf_package protoreflect.FullName = "google.protobuf" diff --git a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go index fd9015e8e..7f67cbb6e 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go @@ -10,22 +10,27 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" ) -const File_reflect_protodesc_proto_go_features_proto = "reflect/protodesc/proto/go_features.proto" +const File_google_protobuf_go_features_proto = "google/protobuf/go_features.proto" -// Names for google.protobuf.GoFeatures. +// Names for pb.GoFeatures. const ( GoFeatures_message_name protoreflect.Name = "GoFeatures" - GoFeatures_message_fullname protoreflect.FullName = "google.protobuf.GoFeatures" + GoFeatures_message_fullname protoreflect.FullName = "pb.GoFeatures" ) -// Field names for google.protobuf.GoFeatures. +// Field names for pb.GoFeatures. const ( GoFeatures_LegacyUnmarshalJsonEnum_field_name protoreflect.Name = "legacy_unmarshal_json_enum" - GoFeatures_LegacyUnmarshalJsonEnum_field_fullname protoreflect.FullName = "google.protobuf.GoFeatures.legacy_unmarshal_json_enum" + GoFeatures_LegacyUnmarshalJsonEnum_field_fullname protoreflect.FullName = "pb.GoFeatures.legacy_unmarshal_json_enum" ) -// Field numbers for google.protobuf.GoFeatures. +// Field numbers for pb.GoFeatures. const ( GoFeatures_LegacyUnmarshalJsonEnum_field_number protoreflect.FieldNumber = 1 ) + +// Extension numbers +const ( + FeatureSet_Go_ext_number protoreflect.FieldNumber = 1002 +) diff --git a/vendor/google.golang.org/protobuf/internal/genid/map_entry.go b/vendor/google.golang.org/protobuf/internal/genid/map_entry.go index 8f9ea02ff..bef5a25fb 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/map_entry.go +++ b/vendor/google.golang.org/protobuf/internal/genid/map_entry.go @@ -4,7 +4,7 @@ package genid -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" +import "google.golang.org/protobuf/reflect/protoreflect" // Generic field names and numbers for synthetic map entry messages. const ( diff --git a/vendor/google.golang.org/protobuf/internal/genid/wrappers.go b/vendor/google.golang.org/protobuf/internal/genid/wrappers.go index 429384b85..9404270de 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/wrappers.go +++ b/vendor/google.golang.org/protobuf/internal/genid/wrappers.go @@ -4,7 +4,7 @@ package genid -import protoreflect "google.golang.org/protobuf/reflect/protoreflect" +import "google.golang.org/protobuf/reflect/protoreflect" // Generic field name and number for messages in wrappers.proto. const ( diff --git a/vendor/google.golang.org/protobuf/internal/impl/api_export.go b/vendor/google.golang.org/protobuf/internal/impl/api_export.go index a371f98de..5d5771c2e 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/api_export.go +++ b/vendor/google.golang.org/protobuf/internal/impl/api_export.go @@ -22,13 +22,13 @@ type Export struct{} // NewError formats a string according to the format specifier and arguments and // returns an error that has a "proto" prefix. -func (Export) NewError(f string, x ...interface{}) error { +func (Export) NewError(f string, x ...any) error { return errors.New(f, x...) } // enum is any enum type generated by protoc-gen-go // and must be a named int32 type. -type enum = interface{} +type enum = any // EnumOf returns the protoreflect.Enum interface over e. // It returns nil if e is nil. @@ -81,7 +81,7 @@ func (Export) EnumStringOf(ed protoreflect.EnumDescriptor, n protoreflect.EnumNu // message is any message type generated by protoc-gen-go // and must be a pointer to a named struct type. -type message = interface{} +type message = any // legacyMessageWrapper wraps a v2 message as a v1 message. type legacyMessageWrapper struct{ m protoreflect.ProtoMessage } diff --git a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go b/vendor/google.golang.org/protobuf/internal/impl/checkinit.go index bff041edc..f29e6a8fa 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go +++ b/vendor/google.golang.org/protobuf/internal/impl/checkinit.go @@ -68,7 +68,7 @@ func (mi *MessageInfo) isInitExtensions(ext *map[int32]ExtensionField) error { } for _, x := range *ext { ei := getExtensionFieldInfo(x.Type()) - if ei.funcs.isInit == nil { + if ei.funcs.isInit == nil || x.isUnexpandedLazy() { continue } v := x.Value() diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go index 2b8f122c2..0d5b546e0 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go @@ -67,7 +67,6 @@ type lazyExtensionValue struct { xi *extensionFieldInfo value protoreflect.Value b []byte - fn func() protoreflect.Value } type ExtensionField struct { @@ -99,6 +98,28 @@ func (f *ExtensionField) canLazy(xt protoreflect.ExtensionType) bool { return false } +// isUnexpandedLazy returns true if the ExensionField is lazy and not +// yet expanded, which means it's present and already checked for +// initialized required fields. +func (f *ExtensionField) isUnexpandedLazy() bool { + return f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0 +} + +// lazyBuffer retrieves the buffer for a lazy extension if it's not yet expanded. +// +// The returned buffer has to be kept over whatever operation we're planning, +// as re-retrieving it will fail after the message is lazily decoded. +func (f *ExtensionField) lazyBuffer() []byte { + // This function might be in the critical path, so check the atomic without + // taking a look first, then only take the lock if needed. + if !f.isUnexpandedLazy() { + return nil + } + f.lazy.mu.Lock() + defer f.lazy.mu.Unlock() + return f.lazy.b +} + func (f *ExtensionField) lazyInit() { f.lazy.mu.Lock() defer f.lazy.mu.Unlock() @@ -136,10 +157,9 @@ func (f *ExtensionField) lazyInit() { } f.lazy.value = val } else { - f.lazy.value = f.lazy.fn() + panic("No support for lazy fns for ExtensionField") } f.lazy.xi = nil - f.lazy.fn = nil f.lazy.b = nil atomic.StoreUint32(&f.lazy.atomicOnce, 1) } @@ -152,13 +172,6 @@ func (f *ExtensionField) Set(t protoreflect.ExtensionType, v protoreflect.Value) f.lazy = nil } -// SetLazy sets the type and a value that is to be lazily evaluated upon first use. -// This must not be called concurrently. -func (f *ExtensionField) SetLazy(t protoreflect.ExtensionType, fn func() protoreflect.Value) { - f.typ = t - f.lazy = &lazyExtensionValue{fn: fn} -} - // Value returns the value of the extension field. // This may be called concurrently. func (f *ExtensionField) Value() protoreflect.Value { diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go index 3fadd241e..7c1f66c8c 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go @@ -65,6 +65,9 @@ func (mi *MessageInfo) initOneofFieldCoders(od protoreflect.OneofDescriptor, si if err != nil { return out, err } + if cf.funcs.isInit == nil { + out.initialized = true + } vi.Set(vw) return out, nil } @@ -233,9 +236,15 @@ func sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int { } func appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { + calculatedSize := f.mi.sizePointer(p.Elem(), opts) b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts))) - return f.mi.marshalAppendPointer(b, p.Elem(), opts) + b = protowire.AppendVarint(b, uint64(calculatedSize)) + before := len(b) + b, err := f.mi.marshalAppendPointer(b, p.Elem(), opts) + if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil { + return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize) + } + return b, err } func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { @@ -262,14 +271,21 @@ func isInitMessageInfo(p pointer, f *coderFieldInfo) error { return f.mi.checkInitializedPointer(p.Elem()) } -func sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int { - return protowire.SizeBytes(proto.Size(m)) + tagsize +func sizeMessage(m proto.Message, tagsize int, opts marshalOptions) int { + return protowire.SizeBytes(opts.Options().Size(m)) + tagsize } func appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) { + mopts := opts.Options() + calculatedSize := mopts.Size(m) b = protowire.AppendVarint(b, wiretag) - b = protowire.AppendVarint(b, uint64(proto.Size(m))) - return opts.Options().MarshalAppend(b, m) + b = protowire.AppendVarint(b, uint64(calculatedSize)) + before := len(b) + b, err := mopts.MarshalAppend(b, m) + if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil { + return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize) + } + return b, err } func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) { @@ -405,8 +421,8 @@ func consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf return f.mi.unmarshalPointer(b, p.Elem(), f.num, opts) } -func sizeGroup(m proto.Message, tagsize int, _ marshalOptions) int { - return 2*tagsize + proto.Size(m) +func sizeGroup(m proto.Message, tagsize int, opts marshalOptions) int { + return 2*tagsize + opts.Options().Size(m) } func appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) { @@ -482,10 +498,14 @@ func appendMessageSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshal b = protowire.AppendVarint(b, f.wiretag) siz := f.mi.sizePointer(v, opts) b = protowire.AppendVarint(b, uint64(siz)) + before := len(b) b, err = f.mi.marshalAppendPointer(b, v, opts) if err != nil { return b, err } + if measuredSize := len(b) - before; siz != measuredSize { + return nil, errors.MismatchedSizeCalculation(siz, measuredSize) + } } return b, nil } @@ -520,28 +540,34 @@ func isInitMessageSliceInfo(p pointer, f *coderFieldInfo) error { return nil } -func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, _ marshalOptions) int { +func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, opts marshalOptions) int { + mopts := opts.Options() s := p.PointerSlice() n := 0 for _, v := range s { m := asMessage(v.AsValueOf(goType.Elem())) - n += protowire.SizeBytes(proto.Size(m)) + tagsize + n += protowire.SizeBytes(mopts.Size(m)) + tagsize } return n } func appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) { + mopts := opts.Options() s := p.PointerSlice() var err error for _, v := range s { m := asMessage(v.AsValueOf(goType.Elem())) b = protowire.AppendVarint(b, wiretag) - siz := proto.Size(m) + siz := mopts.Size(m) b = protowire.AppendVarint(b, uint64(siz)) - b, err = opts.Options().MarshalAppend(b, m) + before := len(b) + b, err = mopts.MarshalAppend(b, m) if err != nil { return b, err } + if measuredSize := len(b) - before; siz != measuredSize { + return nil, errors.MismatchedSizeCalculation(siz, measuredSize) + } } return b, nil } @@ -582,11 +608,12 @@ func isInitMessageSlice(p pointer, goType reflect.Type) error { // Slices of messages func sizeMessageSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int { + mopts := opts.Options() list := listv.List() n := 0 for i, llen := 0, list.Len(); i < llen; i++ { m := list.Get(i).Message().Interface() - n += protowire.SizeBytes(proto.Size(m)) + tagsize + n += protowire.SizeBytes(mopts.Size(m)) + tagsize } return n } @@ -597,13 +624,17 @@ func appendMessageSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, for i, llen := 0, list.Len(); i < llen; i++ { m := list.Get(i).Message().Interface() b = protowire.AppendVarint(b, wiretag) - siz := proto.Size(m) + siz := mopts.Size(m) b = protowire.AppendVarint(b, uint64(siz)) + before := len(b) var err error b, err = mopts.MarshalAppend(b, m) if err != nil { return b, err } + if measuredSize := len(b) - before; siz != measuredSize { + return nil, errors.MismatchedSizeCalculation(siz, measuredSize) + } } return b, nil } @@ -651,11 +682,12 @@ var coderMessageSliceValue = valueCoderFuncs{ } func sizeGroupSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int { + mopts := opts.Options() list := listv.List() n := 0 for i, llen := 0, list.Len(); i < llen; i++ { m := list.Get(i).Message().Interface() - n += 2*tagsize + proto.Size(m) + n += 2*tagsize + mopts.Size(m) } return n } @@ -738,12 +770,13 @@ func makeGroupSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) } } -func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, _ marshalOptions) int { +func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, opts marshalOptions) int { + mopts := opts.Options() s := p.PointerSlice() n := 0 for _, v := range s { m := asMessage(v.AsValueOf(messageType.Elem())) - n += 2*tagsize + proto.Size(m) + n += 2*tagsize + mopts.Size(m) } return n } diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go index 111b9d16f..fb35f0bae 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go @@ -9,6 +9,7 @@ import ( "sort" "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/internal/genid" "google.golang.org/protobuf/reflect/protoreflect" ) @@ -240,11 +241,16 @@ func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coder size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts) size += mapi.valFuncs.size(val, mapValTagSize, opts) b = protowire.AppendVarint(b, uint64(size)) + before := len(b) b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts) if err != nil { return nil, err } - return mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts) + b, err = mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts) + if measuredSize := len(b) - before; size != measuredSize && err == nil { + return nil, errors.MismatchedSizeCalculation(size, measuredSize) + } + return b, err } else { key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey() val := pointerOfValue(valrv) @@ -259,7 +265,12 @@ func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coder } b = protowire.AppendVarint(b, mapi.valWiretag) b = protowire.AppendVarint(b, uint64(valSize)) - return f.mi.marshalAppendPointer(b, val, opts) + before := len(b) + b, err = f.mi.marshalAppendPointer(b, val, opts) + if measuredSize := len(b) - before; valSize != measuredSize && err == nil { + return nil, errors.MismatchedSizeCalculation(valSize, measuredSize) + } + return b, err } } diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go index 6b2fdbb73..78be9df34 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go @@ -189,6 +189,9 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { if mi.methods.Merge == nil { mi.methods.Merge = mi.merge } + if mi.methods.Equal == nil { + mi.methods.Equal = equal + } } // getUnknownBytes returns a *[]byte for the unknown fields. diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go b/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go index b7a23faf1..7a16ec13d 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go @@ -26,6 +26,15 @@ func sizeMessageSet(mi *MessageInfo, p pointer, opts marshalOptions) (size int) } num, _ := protowire.DecodeTag(xi.wiretag) size += messageset.SizeField(num) + if fullyLazyExtensions(opts) { + // Don't expand the extension, instead use the buffer to calculate size + if lb := x.lazyBuffer(); lb != nil { + // We got hold of the buffer, so it's still lazy. + // Don't count the tag size in the extension buffer, it's already added. + size += protowire.SizeTag(messageset.FieldMessage) + len(lb) - xi.tagsize + continue + } + } size += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts) } @@ -85,6 +94,19 @@ func marshalMessageSetField(mi *MessageInfo, b []byte, x ExtensionField, opts ma xi := getExtensionFieldInfo(x.Type()) num, _ := protowire.DecodeTag(xi.wiretag) b = messageset.AppendFieldStart(b, num) + + if fullyLazyExtensions(opts) { + // Don't expand the extension if it's still in wire format, instead use the buffer content. + if lb := x.lazyBuffer(); lb != nil { + // The tag inside the lazy buffer is a different tag (the extension + // number), but what we need here is the tag for FieldMessage: + b = protowire.AppendVarint(b, protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType)) + b = append(b, lb[xi.tagsize:]...) + b = messageset.AppendFieldEnd(b) + return b, nil + } + } + b, err := xi.funcs.marshal(b, x.Value(), protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType), opts) if err != nil { return b, err diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go deleted file mode 100644 index 145c577bd..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go +++ /dev/null @@ -1,210 +0,0 @@ -// 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:build purego || appengine -// +build purego appengine - -package impl - -import ( - "reflect" - - "google.golang.org/protobuf/encoding/protowire" -) - -func sizeEnum(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { - v := p.v.Elem().Int() - return f.tagsize + protowire.SizeVarint(uint64(v)) -} - -func appendEnum(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - v := p.v.Elem().Int() - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(v)) - return b, nil -} - -func consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, errDecode - } - p.v.Elem().SetInt(int64(v)) - out.n = n - return out, nil -} - -func mergeEnum(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - dst.v.Elem().Set(src.v.Elem()) -} - -var coderEnum = pointerCoderFuncs{ - size: sizeEnum, - marshal: appendEnum, - unmarshal: consumeEnum, - merge: mergeEnum, -} - -func sizeEnumNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - if p.v.Elem().Int() == 0 { - return 0 - } - return sizeEnum(p, f, opts) -} - -func appendEnumNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - if p.v.Elem().Int() == 0 { - return b, nil - } - return appendEnum(b, p, f, opts) -} - -func mergeEnumNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - if src.v.Elem().Int() != 0 { - dst.v.Elem().Set(src.v.Elem()) - } -} - -var coderEnumNoZero = pointerCoderFuncs{ - size: sizeEnumNoZero, - marshal: appendEnumNoZero, - unmarshal: consumeEnum, - merge: mergeEnumNoZero, -} - -func sizeEnumPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - return sizeEnum(pointer{p.v.Elem()}, f, opts) -} - -func appendEnumPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - return appendEnum(b, pointer{p.v.Elem()}, f, opts) -} - -func consumeEnumPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - if wtyp != protowire.VarintType { - return out, errUnknown - } - if p.v.Elem().IsNil() { - p.v.Elem().Set(reflect.New(p.v.Elem().Type().Elem())) - } - return consumeEnum(b, pointer{p.v.Elem()}, wtyp, f, opts) -} - -func mergeEnumPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - if !src.v.Elem().IsNil() { - v := reflect.New(dst.v.Type().Elem().Elem()) - v.Elem().Set(src.v.Elem().Elem()) - dst.v.Elem().Set(v) - } -} - -var coderEnumPtr = pointerCoderFuncs{ - size: sizeEnumPtr, - marshal: appendEnumPtr, - unmarshal: consumeEnumPtr, - merge: mergeEnumPtr, -} - -func sizeEnumSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - s := p.v.Elem() - for i, llen := 0, s.Len(); i < llen; i++ { - size += protowire.SizeVarint(uint64(s.Index(i).Int())) + f.tagsize - } - return size -} - -func appendEnumSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - s := p.v.Elem() - for i, llen := 0, s.Len(); i < llen; i++ { - b = protowire.AppendVarint(b, f.wiretag) - b = protowire.AppendVarint(b, uint64(s.Index(i).Int())) - } - return b, nil -} - -func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { - s := p.v.Elem() - if wtyp == protowire.BytesType { - b, n := protowire.ConsumeBytes(b) - if n < 0 { - return out, errDecode - } - for len(b) > 0 { - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, errDecode - } - rv := reflect.New(s.Type().Elem()).Elem() - rv.SetInt(int64(v)) - s.Set(reflect.Append(s, rv)) - b = b[n:] - } - out.n = n - return out, nil - } - if wtyp != protowire.VarintType { - return out, errUnknown - } - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return out, errDecode - } - rv := reflect.New(s.Type().Elem()).Elem() - rv.SetInt(int64(v)) - s.Set(reflect.Append(s, rv)) - out.n = n - return out, nil -} - -func mergeEnumSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) { - dst.v.Elem().Set(reflect.AppendSlice(dst.v.Elem(), src.v.Elem())) -} - -var coderEnumSlice = pointerCoderFuncs{ - size: sizeEnumSlice, - marshal: appendEnumSlice, - unmarshal: consumeEnumSlice, - merge: mergeEnumSlice, -} - -func sizeEnumPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { - s := p.v.Elem() - llen := s.Len() - if llen == 0 { - return 0 - } - n := 0 - for i := 0; i < llen; i++ { - n += protowire.SizeVarint(uint64(s.Index(i).Int())) - } - return f.tagsize + protowire.SizeBytes(n) -} - -func appendEnumPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { - s := p.v.Elem() - llen := s.Len() - if llen == 0 { - return b, nil - } - b = protowire.AppendVarint(b, f.wiretag) - n := 0 - for i := 0; i < llen; i++ { - n += protowire.SizeVarint(uint64(s.Index(i).Int())) - } - b = protowire.AppendVarint(b, uint64(n)) - for i := 0; i < llen; i++ { - b = protowire.AppendVarint(b, uint64(s.Index(i).Int())) - } - return b, nil -} - -var coderEnumPackedSlice = pointerCoderFuncs{ - size: sizeEnumPackedSlice, - marshal: appendEnumPackedSlice, - unmarshal: consumeEnumSlice, - merge: mergeEnumSlice, -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go index 757642e23..077712c2c 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine -// +build !purego,!appengine - package impl // When using unsafe pointers, we can just treat enum values as int32s. diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert.go b/vendor/google.golang.org/protobuf/internal/impl/convert.go index 185ef2efa..f72ddd882 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/convert.go +++ b/vendor/google.golang.org/protobuf/internal/impl/convert.go @@ -14,7 +14,7 @@ import ( // unwrapper unwraps the value to the underlying value. // This is implemented by List and Map. type unwrapper interface { - protoUnwrap() interface{} + protoUnwrap() any } // A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types. @@ -322,7 +322,7 @@ func (c *stringConverter) PBValueOf(v reflect.Value) protoreflect.Value { return protoreflect.ValueOfString(v.Convert(stringType).String()) } func (c *stringConverter) GoValueOf(v protoreflect.Value) reflect.Value { - // pref.Value.String never panics, so we go through an interface + // protoreflect.Value.String never panics, so we go through an interface // conversion here to check the type. s := v.Interface().(string) if c.goType.Kind() == reflect.Slice && s == "" { diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert_list.go b/vendor/google.golang.org/protobuf/internal/impl/convert_list.go index f89136516..18cb96fd7 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/convert_list.go +++ b/vendor/google.golang.org/protobuf/internal/impl/convert_list.go @@ -136,6 +136,6 @@ func (ls *listReflect) NewElement() protoreflect.Value { func (ls *listReflect) IsValid() bool { return !ls.v.IsNil() } -func (ls *listReflect) protoUnwrap() interface{} { +func (ls *listReflect) protoUnwrap() any { return ls.v.Interface() } diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go b/vendor/google.golang.org/protobuf/internal/impl/convert_map.go index f30b0a057..304244a65 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go +++ b/vendor/google.golang.org/protobuf/internal/impl/convert_map.go @@ -116,6 +116,6 @@ func (ms *mapReflect) NewValue() protoreflect.Value { func (ms *mapReflect) IsValid() bool { return !ms.v.IsNil() } -func (ms *mapReflect) protoUnwrap() interface{} { +func (ms *mapReflect) protoUnwrap() any { return ms.v.Interface() } diff --git a/vendor/google.golang.org/protobuf/internal/impl/encode.go b/vendor/google.golang.org/protobuf/internal/impl/encode.go index 845c67d6e..6254f5de4 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/encode.go +++ b/vendor/google.golang.org/protobuf/internal/impl/encode.go @@ -10,7 +10,7 @@ import ( "sync/atomic" "google.golang.org/protobuf/internal/flags" - proto "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/proto" piface "google.golang.org/protobuf/runtime/protoiface" ) @@ -49,8 +49,11 @@ func (mi *MessageInfo) sizePointer(p pointer, opts marshalOptions) (size int) { return 0 } if opts.UseCachedSize() && mi.sizecacheOffset.IsValid() { - if size := atomic.LoadInt32(p.Apply(mi.sizecacheOffset).Int32()); size >= 0 { - return int(size) + // The size cache contains the size + 1, to allow the + // zero value to be invalid, while also allowing for a + // 0 size to be cached. + if size := atomic.LoadInt32(p.Apply(mi.sizecacheOffset).Int32()); size > 0 { + return int(size - 1) } } return mi.sizePointerSlow(p, opts) @@ -60,7 +63,7 @@ func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int if flags.ProtoLegacy && mi.isMessageSet { size = sizeMessageSet(mi, p, opts) if mi.sizecacheOffset.IsValid() { - atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size)) + atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size+1)) } return size } @@ -84,13 +87,16 @@ func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int } } if mi.sizecacheOffset.IsValid() { - if size > math.MaxInt32 { + if size > (math.MaxInt32 - 1) { // The size is too large for the int32 sizecache field. // We will need to recompute the size when encoding; // unfortunately expensive, but better than invalid output. - atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), -1) + atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), 0) } else { - atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size)) + // The size cache contains the size + 1, to allow the + // zero value to be invalid, while also allowing for a + // 0 size to be cached. + atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size+1)) } } return size @@ -149,6 +155,14 @@ func (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOpt return b, nil } +// fullyLazyExtensions returns true if we should attempt to keep extensions lazy over size and marshal. +func fullyLazyExtensions(opts marshalOptions) bool { + // When deterministic marshaling is requested, force an unmarshal for lazy + // extensions to produce a deterministic result, instead of passing through + // bytes lazily that may or may not match what Go Protobuf would produce. + return opts.flags&piface.MarshalDeterministic == 0 +} + func (mi *MessageInfo) sizeExtensions(ext *map[int32]ExtensionField, opts marshalOptions) (n int) { if ext == nil { return 0 @@ -158,6 +172,14 @@ func (mi *MessageInfo) sizeExtensions(ext *map[int32]ExtensionField, opts marsha if xi.funcs.size == nil { continue } + if fullyLazyExtensions(opts) { + // Don't expand the extension, instead use the buffer to calculate size + if lb := x.lazyBuffer(); lb != nil { + // We got hold of the buffer, so it's still lazy. + n += len(lb) + continue + } + } n += xi.funcs.size(x.Value(), xi.tagsize, opts) } return n @@ -176,6 +198,13 @@ func (mi *MessageInfo) appendExtensions(b []byte, ext *map[int32]ExtensionField, var err error for _, x := range *ext { xi := getExtensionFieldInfo(x.Type()) + if fullyLazyExtensions(opts) { + // Don't expand the extension if it's still in wire format, instead use the buffer content. + if lb := x.lazyBuffer(); lb != nil { + b = append(b, lb...) + continue + } + } b, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts) } return b, err @@ -191,6 +220,13 @@ func (mi *MessageInfo) appendExtensions(b []byte, ext *map[int32]ExtensionField, for _, k := range keys { x := (*ext)[int32(k)] xi := getExtensionFieldInfo(x.Type()) + if fullyLazyExtensions(opts) { + // Don't expand the extension if it's still in wire format, instead use the buffer content. + if lb := x.lazyBuffer(); lb != nil { + b = append(b, lb...) + continue + } + } b, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts) if err != nil { return b, err diff --git a/vendor/google.golang.org/protobuf/internal/impl/equal.go b/vendor/google.golang.org/protobuf/internal/impl/equal.go new file mode 100644 index 000000000..9f6c32a7d --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/impl/equal.go @@ -0,0 +1,224 @@ +// Copyright 2024 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 impl + +import ( + "bytes" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoiface" +) + +func equal(in protoiface.EqualInput) protoiface.EqualOutput { + return protoiface.EqualOutput{Equal: equalMessage(in.MessageA, in.MessageB)} +} + +// equalMessage is a fast-path variant of protoreflect.equalMessage. +// It takes advantage of the internal messageState type to avoid +// unnecessary allocations, type assertions. +func equalMessage(mx, my protoreflect.Message) bool { + if mx == nil || my == nil { + return mx == my + } + if mx.Descriptor() != my.Descriptor() { + return false + } + + msx, ok := mx.(*messageState) + if !ok { + return protoreflect.ValueOfMessage(mx).Equal(protoreflect.ValueOfMessage(my)) + } + msy, ok := my.(*messageState) + if !ok { + return protoreflect.ValueOfMessage(mx).Equal(protoreflect.ValueOfMessage(my)) + } + + mi := msx.messageInfo() + miy := msy.messageInfo() + if mi != miy { + return protoreflect.ValueOfMessage(mx).Equal(protoreflect.ValueOfMessage(my)) + } + mi.init() + // Compares regular fields + // Modified Message.Range code that compares two messages of the same type + // while going over the fields. + for _, ri := range mi.rangeInfos { + var fd protoreflect.FieldDescriptor + var vx, vy protoreflect.Value + + switch ri := ri.(type) { + case *fieldInfo: + hx := ri.has(msx.pointer()) + hy := ri.has(msy.pointer()) + if hx != hy { + return false + } + if !hx { + continue + } + fd = ri.fieldDesc + vx = ri.get(msx.pointer()) + vy = ri.get(msy.pointer()) + case *oneofInfo: + fnx := ri.which(msx.pointer()) + fny := ri.which(msy.pointer()) + if fnx != fny { + return false + } + if fnx <= 0 { + continue + } + fi := mi.fields[fnx] + fd = fi.fieldDesc + vx = fi.get(msx.pointer()) + vy = fi.get(msy.pointer()) + } + + if !equalValue(fd, vx, vy) { + return false + } + } + + // Compare extensions. + // This is more complicated because mx or my could have empty/nil extension maps, + // however some populated extension map values are equal to nil extension maps. + emx := mi.extensionMap(msx.pointer()) + emy := mi.extensionMap(msy.pointer()) + if emx != nil { + for k, x := range *emx { + xd := x.Type().TypeDescriptor() + xv := x.Value() + var y ExtensionField + ok := false + if emy != nil { + y, ok = (*emy)[k] + } + // We need to treat empty lists as equal to nil values + if emy == nil || !ok { + if xd.IsList() && xv.List().Len() == 0 { + continue + } + return false + } + + if !equalValue(xd, xv, y.Value()) { + return false + } + } + } + if emy != nil { + // emy may have extensions emx does not have, need to check them as well + for k, y := range *emy { + if emx != nil { + // emx has the field, so we already checked it + if _, ok := (*emx)[k]; ok { + continue + } + } + // Empty lists are equal to nil + if y.Type().TypeDescriptor().IsList() && y.Value().List().Len() == 0 { + continue + } + + // Cant be equal if the extension is populated + return false + } + } + + return equalUnknown(mx.GetUnknown(), my.GetUnknown()) +} + +func equalValue(fd protoreflect.FieldDescriptor, vx, vy protoreflect.Value) bool { + // slow path + if fd.Kind() != protoreflect.MessageKind { + return vx.Equal(vy) + } + + // fast path special cases + if fd.IsMap() { + if fd.MapValue().Kind() == protoreflect.MessageKind { + return equalMessageMap(vx.Map(), vy.Map()) + } + return vx.Equal(vy) + } + + if fd.IsList() { + return equalMessageList(vx.List(), vy.List()) + } + + return equalMessage(vx.Message(), vy.Message()) +} + +// Mostly copied from protoreflect.equalMap. +// This variant only works for messages as map types. +// All other map types should be handled via Value.Equal. +func equalMessageMap(mx, my protoreflect.Map) bool { + if mx.Len() != my.Len() { + return false + } + equal := true + mx.Range(func(k protoreflect.MapKey, vx protoreflect.Value) bool { + if !my.Has(k) { + equal = false + return false + } + vy := my.Get(k) + equal = equalMessage(vx.Message(), vy.Message()) + return equal + }) + return equal +} + +// Mostly copied from protoreflect.equalList. +// The only change is the usage of equalImpl instead of protoreflect.equalValue. +func equalMessageList(lx, ly protoreflect.List) bool { + if lx.Len() != ly.Len() { + return false + } + for i := 0; i < lx.Len(); i++ { + // We only operate on messages here since equalImpl will not call us in any other case. + if !equalMessage(lx.Get(i).Message(), ly.Get(i).Message()) { + return false + } + } + return true +} + +// equalUnknown compares unknown fields by direct comparison on the raw bytes +// of each individual field number. +// Copied from protoreflect.equalUnknown. +func equalUnknown(x, y protoreflect.RawFields) bool { + if len(x) != len(y) { + return false + } + if bytes.Equal([]byte(x), []byte(y)) { + return true + } + + mx := make(map[protoreflect.FieldNumber]protoreflect.RawFields) + my := make(map[protoreflect.FieldNumber]protoreflect.RawFields) + for len(x) > 0 { + fnum, _, n := protowire.ConsumeField(x) + mx[fnum] = append(mx[fnum], x[:n]...) + x = x[n:] + } + for len(y) > 0 { + fnum, _, n := protowire.ConsumeField(y) + my[fnum] = append(my[fnum], y[:n]...) + y = y[n:] + } + if len(mx) != len(my) { + return false + } + + for k, v1 := range mx { + if v2, ok := my[k]; !ok || !bytes.Equal([]byte(v1), []byte(v2)) { + return false + } + } + + return true +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/extension.go b/vendor/google.golang.org/protobuf/internal/impl/extension.go index cb25b0bae..e31249f64 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/extension.go @@ -53,7 +53,7 @@ type ExtensionInfo struct { // type returned by InterfaceOf may not be identical. // // Deprecated: Use InterfaceOf(xt.Zero()) instead. - ExtensionType interface{} + ExtensionType any // Field is the field number of the extension. // @@ -95,16 +95,16 @@ func (xi *ExtensionInfo) New() protoreflect.Value { func (xi *ExtensionInfo) Zero() protoreflect.Value { return xi.lazyInit().Zero() } -func (xi *ExtensionInfo) ValueOf(v interface{}) protoreflect.Value { +func (xi *ExtensionInfo) ValueOf(v any) protoreflect.Value { return xi.lazyInit().PBValueOf(reflect.ValueOf(v)) } -func (xi *ExtensionInfo) InterfaceOf(v protoreflect.Value) interface{} { +func (xi *ExtensionInfo) InterfaceOf(v protoreflect.Value) any { return xi.lazyInit().GoValueOf(v).Interface() } func (xi *ExtensionInfo) IsValidValue(v protoreflect.Value) bool { return xi.lazyInit().IsValidPB(v) } -func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool { +func (xi *ExtensionInfo) IsValidInterface(v any) bool { return xi.lazyInit().IsValidGo(reflect.ValueOf(v)) } func (xi *ExtensionInfo) TypeDescriptor() protoreflect.ExtensionTypeDescriptor { diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go index c2a803bb2..81b2b1a76 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go @@ -97,7 +97,7 @@ func (e *legacyEnumWrapper) Number() protoreflect.EnumNumber { func (e *legacyEnumWrapper) ProtoReflect() protoreflect.Enum { return e } -func (e *legacyEnumWrapper) protoUnwrap() interface{} { +func (e *legacyEnumWrapper) protoUnwrap() any { v := reflect.New(e.goTyp).Elem() v.SetInt(int64(e.num)) return v.Interface() @@ -167,6 +167,7 @@ func aberrantLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor { ed := &filedesc.Enum{L2: new(filedesc.EnumL2)} ed.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum ed.L0.ParentFile = filedesc.SurrogateProto3 + ed.L1.EditionFeatures = ed.L0.ParentFile.L1.EditionFeatures ed.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{}) // TODO: Use the presence of a UnmarshalJSON method to determine proto2? diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go index 87b30d050..b6849d669 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go @@ -118,7 +118,7 @@ func (xi *ExtensionInfo) initFromLegacy() { xd.L1.Number = protoreflect.FieldNumber(xi.Field) xd.L1.Cardinality = fd.L1.Cardinality xd.L1.Kind = fd.L1.Kind - xd.L2.IsPacked = fd.L1.IsPacked + xd.L1.EditionFeatures = fd.L1.EditionFeatures xd.L2.Default = fd.L1.Default xd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType) xd.L2.Enum = ed @@ -160,6 +160,7 @@ func (x placeholderExtension) HasPresence() bool func (x placeholderExtension) HasOptionalKeyword() bool { return false } func (x placeholderExtension) IsExtension() bool { return true } func (x placeholderExtension) IsWeak() bool { return false } +func (x placeholderExtension) IsLazy() bool { return false } func (x placeholderExtension) IsPacked() bool { return false } func (x placeholderExtension) IsList() bool { return false } func (x placeholderExtension) IsMap() bool { return false } diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go index 9ab091086..b649f1124 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go @@ -7,7 +7,7 @@ package impl import ( "bytes" "compress/gzip" - "io/ioutil" + "io" "sync" "google.golang.org/protobuf/internal/filedesc" @@ -51,7 +51,7 @@ func legacyLoadFileDesc(b []byte) protoreflect.FileDescriptor { if err != nil { panic(err) } - b2, err := ioutil.ReadAll(zr) + b2, err := io.ReadAll(zr) if err != nil { panic(err) } diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go index 2ab2c6297..bf0b6049b 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go @@ -204,6 +204,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName } } + md.L1.EditionFeatures = md.L0.ParentFile.L1.EditionFeatures // Obtain a list of oneof wrapper types. var oneofWrappers []reflect.Type methods := make([]reflect.Method, 0, 2) @@ -215,7 +216,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName } for _, fn := range methods { for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) { - if vs, ok := v.Interface().([]interface{}); ok { + if vs, ok := v.Interface().([]any); ok { for _, v := range vs { oneofWrappers = append(oneofWrappers, reflect.TypeOf(v)) } @@ -250,6 +251,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName od := &md.L2.Oneofs.List[n] od.L0.FullName = md.FullName().Append(protoreflect.Name(tag)) od.L0.ParentFile = md.L0.ParentFile + od.L1.EditionFeatures = md.L1.EditionFeatures od.L0.Parent = md od.L0.Index = n @@ -260,6 +262,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName aberrantAppendField(md, f.Type, tag, "", "") fd := &md.L2.Fields.List[len(md.L2.Fields.List)-1] fd.L1.ContainingOneof = od + fd.L1.EditionFeatures = od.L1.EditionFeatures od.L1.Fields.List = append(od.L1.Fields.List, fd) } } @@ -307,14 +310,14 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey, fd.L0.Parent = md fd.L0.Index = n - if fd.L1.IsWeak || fd.L1.HasPacked { + if fd.L1.IsWeak || fd.L1.EditionFeatures.IsPacked { fd.L1.Options = func() protoreflect.ProtoMessage { opts := descopts.Field.ProtoReflect().New() if fd.L1.IsWeak { opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true)) } - if fd.L1.HasPacked { - opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.IsPacked)) + if fd.L1.EditionFeatures.IsPacked { + opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.EditionFeatures.IsPacked)) } return opts.Interface() } @@ -344,6 +347,7 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey, md2.L0.ParentFile = md.L0.ParentFile md2.L0.Parent = md md2.L0.Index = n + md2.L1.EditionFeatures = md.L1.EditionFeatures md2.L1.IsMapEntry = true md2.L2.Options = func() protoreflect.ProtoMessage { @@ -563,6 +567,6 @@ func (m aberrantMessage) IsValid() bool { func (m aberrantMessage) ProtoMethods() *protoiface.Methods { return aberrantProtoMethods } -func (m aberrantMessage) protoUnwrap() interface{} { +func (m aberrantMessage) protoUnwrap() any { return m.v.Interface() } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message.go b/vendor/google.golang.org/protobuf/internal/impl/message.go index 629bacdce..741b5ed29 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message.go @@ -30,12 +30,12 @@ type MessageInfo struct { // Desc is the underlying message descriptor type and must be populated. Desc protoreflect.MessageDescriptor - // Exporter must be provided in a purego environment in order to provide - // access to unexported fields. + // Deprecated: Exporter will be removed the next time we bump + // protoimpl.GenVersion. See https://github.com/golang/protobuf/issues/1640 Exporter exporter // OneofWrappers is list of pointers to oneof wrapper struct types. - OneofWrappers []interface{} + OneofWrappers []any initMu sync.Mutex // protects all unexported fields initDone uint32 @@ -47,7 +47,7 @@ type MessageInfo struct { // exporter is a function that returns a reference to the ith field of v, // where v is a pointer to a struct. It returns nil if it does not support // exporting the requested field (e.g., already exported). -type exporter func(v interface{}, i int) interface{} +type exporter func(v any, i int) any // getMessageInfo returns the MessageInfo for any message type that // is generated by our implementation of protoc-gen-go (for v2 and on). @@ -201,7 +201,7 @@ fieldLoop: } for _, fn := range methods { for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) { - if vs, ok := v.Interface().([]interface{}); ok { + if vs, ok := v.Interface().([]any); ok { oneofWrappers = vs } } @@ -256,7 +256,7 @@ func (mi *MessageInfo) Message(i int) protoreflect.MessageType { type mapEntryType struct { desc protoreflect.MessageDescriptor - valType interface{} // zero value of enum or message type + valType any // zero value of enum or message type } func (mt mapEntryType) New() protoreflect.Message { diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go index d9ea010be..ecb4623d7 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go @@ -20,7 +20,7 @@ type reflectMessageInfo struct { // fieldTypes contains the zero value of an enum or message field. // For lists, it contains the element type. // For maps, it contains the entry value type. - fieldTypes map[protoreflect.FieldNumber]interface{} + fieldTypes map[protoreflect.FieldNumber]any // denseFields is a subset of fields where: // 0 < fieldDesc.Number() < len(denseFields) @@ -28,7 +28,7 @@ type reflectMessageInfo struct { denseFields []*fieldInfo // rangeInfos is a list of all fields (not belonging to a oneof) and oneofs. - rangeInfos []interface{} // either *fieldInfo or *oneofInfo + rangeInfos []any // either *fieldInfo or *oneofInfo getUnknown func(pointer) protoreflect.RawFields setUnknown func(pointer, protoreflect.RawFields) @@ -224,7 +224,7 @@ func (mi *MessageInfo) makeFieldTypes(si structInfo) { } if ft != nil { if mi.fieldTypes == nil { - mi.fieldTypes = make(map[protoreflect.FieldNumber]interface{}) + mi.fieldTypes = make(map[protoreflect.FieldNumber]any) } mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface() } @@ -247,39 +247,39 @@ func (m *extensionMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.V } } } -func (m *extensionMap) Has(xt protoreflect.ExtensionType) (ok bool) { +func (m *extensionMap) Has(xd protoreflect.ExtensionTypeDescriptor) (ok bool) { if m == nil { return false } - xd := xt.TypeDescriptor() x, ok := (*m)[int32(xd.Number())] if !ok { return false } + if x.isUnexpandedLazy() { + // Avoid calling x.Value(), which triggers a lazy unmarshal. + return true + } switch { case xd.IsList(): return x.Value().List().Len() > 0 case xd.IsMap(): return x.Value().Map().Len() > 0 - case xd.Message() != nil: - return x.Value().Message().IsValid() } return true } -func (m *extensionMap) Clear(xt protoreflect.ExtensionType) { - delete(*m, int32(xt.TypeDescriptor().Number())) +func (m *extensionMap) Clear(xd protoreflect.ExtensionTypeDescriptor) { + delete(*m, int32(xd.Number())) } -func (m *extensionMap) Get(xt protoreflect.ExtensionType) protoreflect.Value { - xd := xt.TypeDescriptor() +func (m *extensionMap) Get(xd protoreflect.ExtensionTypeDescriptor) protoreflect.Value { if m != nil { if x, ok := (*m)[int32(xd.Number())]; ok { return x.Value() } } - return xt.Zero() + return xd.Type().Zero() } -func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value) { - xd := xt.TypeDescriptor() +func (m *extensionMap) Set(xd protoreflect.ExtensionTypeDescriptor, v protoreflect.Value) { + xt := xd.Type() isValid := true switch { case !xt.IsValidValue(v): @@ -292,7 +292,7 @@ func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value) isValid = v.Message().IsValid() } if !isValid { - panic(fmt.Sprintf("%v: assigning invalid value", xt.TypeDescriptor().FullName())) + panic(fmt.Sprintf("%v: assigning invalid value", xd.FullName())) } if *m == nil { @@ -302,16 +302,15 @@ func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value) x.Set(xt, v) (*m)[int32(xd.Number())] = x } -func (m *extensionMap) Mutable(xt protoreflect.ExtensionType) protoreflect.Value { - xd := xt.TypeDescriptor() +func (m *extensionMap) Mutable(xd protoreflect.ExtensionTypeDescriptor) protoreflect.Value { if xd.Kind() != protoreflect.MessageKind && xd.Kind() != protoreflect.GroupKind && !xd.IsList() && !xd.IsMap() { panic("invalid Mutable on field with non-composite type") } if x, ok := (*m)[int32(xd.Number())]; ok { return x.Value() } - v := xt.New() - m.Set(xt, v) + v := xd.Type().New() + m.Set(xd, v) return v } @@ -394,7 +393,7 @@ var ( // MessageOf returns a reflective view over a message. The input must be a // pointer to a named Go struct. If the provided type has a ProtoReflect method, // it must be implemented by calling this method. -func (mi *MessageInfo) MessageOf(m interface{}) protoreflect.Message { +func (mi *MessageInfo) MessageOf(m any) protoreflect.Message { if reflect.TypeOf(m) != mi.GoReflectType { panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType)) } @@ -422,13 +421,13 @@ func (m *messageIfaceWrapper) Reset() { func (m *messageIfaceWrapper) ProtoReflect() protoreflect.Message { return (*messageReflectWrapper)(m) } -func (m *messageIfaceWrapper) protoUnwrap() interface{} { +func (m *messageIfaceWrapper) protoUnwrap() any { return m.p.AsIfaceOf(m.mi.GoReflectType.Elem()) } // checkField verifies that the provided field descriptor is valid. // Exactly one of the returned values is populated. -func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionType) { +func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionTypeDescriptor) { var fi *fieldInfo if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) { fi = mi.denseFields[n] @@ -457,7 +456,7 @@ func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, if !ok { panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName())) } - return nil, xtd.Type() + return nil, xtd } panic(fmt.Sprintf("field %v is invalid", fd.FullName())) } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go index 741d6e5b6..99dc23c6f 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go @@ -23,12 +23,13 @@ func (m *messageState) New() protoreflect.Message { func (m *messageState) Interface() protoreflect.ProtoMessage { return m.protoUnwrap().(protoreflect.ProtoMessage) } -func (m *messageState) protoUnwrap() interface{} { +func (m *messageState) protoUnwrap() any { return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem()) } func (m *messageState) ProtoMethods() *protoiface.Methods { - m.messageInfo().init() - return &m.messageInfo().methods + mi := m.messageInfo() + mi.init() + return &mi.methods } // ProtoMessageInfo is a pseudo-internal API for allowing the v1 code @@ -41,8 +42,9 @@ func (m *messageState) ProtoMessageInfo() *MessageInfo { } func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - m.messageInfo().init() - for _, ri := range m.messageInfo().rangeInfos { + mi := m.messageInfo() + mi.init() + for _, ri := range mi.rangeInfos { switch ri := ri.(type) { case *fieldInfo: if ri.has(m.pointer()) { @@ -52,77 +54,86 @@ func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.V } case *oneofInfo: if n := ri.which(m.pointer()); n > 0 { - fi := m.messageInfo().fields[n] + fi := mi.fields[n] if !f(fi.fieldDesc, fi.get(m.pointer())) { return } } } } - m.messageInfo().extensionMap(m.pointer()).Range(f) + mi.extensionMap(m.pointer()).Range(f) } func (m *messageState) Has(fd protoreflect.FieldDescriptor) bool { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { return fi.has(m.pointer()) } else { - return m.messageInfo().extensionMap(m.pointer()).Has(xt) + return mi.extensionMap(m.pointer()).Has(xd) } } func (m *messageState) Clear(fd protoreflect.FieldDescriptor) { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { fi.clear(m.pointer()) } else { - m.messageInfo().extensionMap(m.pointer()).Clear(xt) + mi.extensionMap(m.pointer()).Clear(xd) } } func (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { return fi.get(m.pointer()) } else { - return m.messageInfo().extensionMap(m.pointer()).Get(xt) + return mi.extensionMap(m.pointer()).Get(xd) } } func (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { fi.set(m.pointer(), v) } else { - m.messageInfo().extensionMap(m.pointer()).Set(xt, v) + mi.extensionMap(m.pointer()).Set(xd, v) } } func (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { return fi.mutable(m.pointer()) } else { - return m.messageInfo().extensionMap(m.pointer()).Mutable(xt) + return mi.extensionMap(m.pointer()).Mutable(xd) } } func (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { return fi.newField() } else { - return xt.New() + return xd.Type().New() } } func (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - m.messageInfo().init() - if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od { + mi := m.messageInfo() + mi.init() + if oi := mi.oneofs[od.Name()]; oi != nil && oi.oneofDesc == od { return od.Fields().ByNumber(oi.which(m.pointer())) } panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName())) } func (m *messageState) GetUnknown() protoreflect.RawFields { - m.messageInfo().init() - return m.messageInfo().getUnknown(m.pointer()) + mi := m.messageInfo() + mi.init() + return mi.getUnknown(m.pointer()) } func (m *messageState) SetUnknown(b protoreflect.RawFields) { - m.messageInfo().init() - m.messageInfo().setUnknown(m.pointer(), b) + mi := m.messageInfo() + mi.init() + mi.setUnknown(m.pointer(), b) } func (m *messageState) IsValid() bool { return !m.pointer().IsNil() @@ -143,12 +154,13 @@ func (m *messageReflectWrapper) Interface() protoreflect.ProtoMessage { } return (*messageIfaceWrapper)(m) } -func (m *messageReflectWrapper) protoUnwrap() interface{} { +func (m *messageReflectWrapper) protoUnwrap() any { return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem()) } func (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods { - m.messageInfo().init() - return &m.messageInfo().methods + mi := m.messageInfo() + mi.init() + return &mi.methods } // ProtoMessageInfo is a pseudo-internal API for allowing the v1 code @@ -161,8 +173,9 @@ func (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo { } func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - m.messageInfo().init() - for _, ri := range m.messageInfo().rangeInfos { + mi := m.messageInfo() + mi.init() + for _, ri := range mi.rangeInfos { switch ri := ri.(type) { case *fieldInfo: if ri.has(m.pointer()) { @@ -172,77 +185,86 @@ func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, proto } case *oneofInfo: if n := ri.which(m.pointer()); n > 0 { - fi := m.messageInfo().fields[n] + fi := mi.fields[n] if !f(fi.fieldDesc, fi.get(m.pointer())) { return } } } } - m.messageInfo().extensionMap(m.pointer()).Range(f) + mi.extensionMap(m.pointer()).Range(f) } func (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { return fi.has(m.pointer()) } else { - return m.messageInfo().extensionMap(m.pointer()).Has(xt) + return mi.extensionMap(m.pointer()).Has(xd) } } func (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { fi.clear(m.pointer()) } else { - m.messageInfo().extensionMap(m.pointer()).Clear(xt) + mi.extensionMap(m.pointer()).Clear(xd) } } func (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { return fi.get(m.pointer()) } else { - return m.messageInfo().extensionMap(m.pointer()).Get(xt) + return mi.extensionMap(m.pointer()).Get(xd) } } func (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { fi.set(m.pointer(), v) } else { - m.messageInfo().extensionMap(m.pointer()).Set(xt, v) + mi.extensionMap(m.pointer()).Set(xd, v) } } func (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { return fi.mutable(m.pointer()) } else { - return m.messageInfo().extensionMap(m.pointer()).Mutable(xt) + return mi.extensionMap(m.pointer()).Mutable(xd) } } func (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - m.messageInfo().init() - if fi, xt := m.messageInfo().checkField(fd); fi != nil { + mi := m.messageInfo() + mi.init() + if fi, xd := mi.checkField(fd); fi != nil { return fi.newField() } else { - return xt.New() + return xd.Type().New() } } func (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - m.messageInfo().init() - if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od { + mi := m.messageInfo() + mi.init() + if oi := mi.oneofs[od.Name()]; oi != nil && oi.oneofDesc == od { return od.Fields().ByNumber(oi.which(m.pointer())) } panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName())) } func (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields { - m.messageInfo().init() - return m.messageInfo().getUnknown(m.pointer()) + mi := m.messageInfo() + mi.init() + return mi.getUnknown(m.pointer()) } func (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) { - m.messageInfo().init() - m.messageInfo().setUnknown(m.pointer(), b) + mi := m.messageInfo() + mi.init() + mi.setUnknown(m.pointer(), b) } func (m *messageReflectWrapper) IsValid() bool { return !m.pointer().IsNil() diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go deleted file mode 100644 index 517e94434..000000000 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +++ /dev/null @@ -1,215 +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. - -//go:build purego || appengine -// +build purego appengine - -package impl - -import ( - "fmt" - "reflect" - "sync" -) - -const UnsafeEnabled = false - -// Pointer is an opaque pointer type. -type Pointer interface{} - -// offset represents the offset to a struct field, accessible from a pointer. -// The offset is the field index into a struct. -type offset struct { - index int - export exporter -} - -// offsetOf returns a field offset for the struct field. -func offsetOf(f reflect.StructField, x exporter) offset { - if len(f.Index) != 1 { - panic("embedded structs are not supported") - } - if f.PkgPath == "" { - return offset{index: f.Index[0]} // field is already exported - } - if x == nil { - panic("exporter must be provided for unexported field") - } - return offset{index: f.Index[0], export: x} -} - -// IsValid reports whether the offset is valid. -func (f offset) IsValid() bool { return f.index >= 0 } - -// invalidOffset is an invalid field offset. -var invalidOffset = offset{index: -1} - -// zeroOffset is a noop when calling pointer.Apply. -var zeroOffset = offset{index: 0} - -// pointer is an abstract representation of a pointer to a struct or field. -type pointer struct{ v reflect.Value } - -// pointerOf returns p as a pointer. -func pointerOf(p Pointer) pointer { - return pointerOfIface(p) -} - -// pointerOfValue returns v as a pointer. -func pointerOfValue(v reflect.Value) pointer { - return pointer{v: v} -} - -// pointerOfIface returns the pointer portion of an interface. -func pointerOfIface(v interface{}) pointer { - return pointer{v: reflect.ValueOf(v)} -} - -// IsNil reports whether the pointer is nil. -func (p pointer) IsNil() bool { - return p.v.IsNil() -} - -// Apply adds an offset to the pointer to derive a new pointer -// to a specified field. The current pointer must be pointing at a struct. -func (p pointer) Apply(f offset) pointer { - if f.export != nil { - if v := reflect.ValueOf(f.export(p.v.Interface(), f.index)); v.IsValid() { - return pointer{v: v} - } - } - return pointer{v: p.v.Elem().Field(f.index).Addr()} -} - -// AsValueOf treats p as a pointer to an object of type t and returns the value. -// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t)) -func (p pointer) AsValueOf(t reflect.Type) reflect.Value { - if got := p.v.Type().Elem(); got != t { - panic(fmt.Sprintf("invalid type: got %v, want %v", got, t)) - } - return p.v -} - -// AsIfaceOf treats p as a pointer to an object of type t and returns the value. -// It is equivalent to p.AsValueOf(t).Interface() -func (p pointer) AsIfaceOf(t reflect.Type) interface{} { - return p.AsValueOf(t).Interface() -} - -func (p pointer) Bool() *bool { return p.v.Interface().(*bool) } -func (p pointer) BoolPtr() **bool { return p.v.Interface().(**bool) } -func (p pointer) BoolSlice() *[]bool { return p.v.Interface().(*[]bool) } -func (p pointer) Int32() *int32 { return p.v.Interface().(*int32) } -func (p pointer) Int32Ptr() **int32 { return p.v.Interface().(**int32) } -func (p pointer) Int32Slice() *[]int32 { return p.v.Interface().(*[]int32) } -func (p pointer) Int64() *int64 { return p.v.Interface().(*int64) } -func (p pointer) Int64Ptr() **int64 { return p.v.Interface().(**int64) } -func (p pointer) Int64Slice() *[]int64 { return p.v.Interface().(*[]int64) } -func (p pointer) Uint32() *uint32 { return p.v.Interface().(*uint32) } -func (p pointer) Uint32Ptr() **uint32 { return p.v.Interface().(**uint32) } -func (p pointer) Uint32Slice() *[]uint32 { return p.v.Interface().(*[]uint32) } -func (p pointer) Uint64() *uint64 { return p.v.Interface().(*uint64) } -func (p pointer) Uint64Ptr() **uint64 { return p.v.Interface().(**uint64) } -func (p pointer) Uint64Slice() *[]uint64 { return p.v.Interface().(*[]uint64) } -func (p pointer) Float32() *float32 { return p.v.Interface().(*float32) } -func (p pointer) Float32Ptr() **float32 { return p.v.Interface().(**float32) } -func (p pointer) Float32Slice() *[]float32 { return p.v.Interface().(*[]float32) } -func (p pointer) Float64() *float64 { return p.v.Interface().(*float64) } -func (p pointer) Float64Ptr() **float64 { return p.v.Interface().(**float64) } -func (p pointer) Float64Slice() *[]float64 { return p.v.Interface().(*[]float64) } -func (p pointer) String() *string { return p.v.Interface().(*string) } -func (p pointer) StringPtr() **string { return p.v.Interface().(**string) } -func (p pointer) StringSlice() *[]string { return p.v.Interface().(*[]string) } -func (p pointer) Bytes() *[]byte { return p.v.Interface().(*[]byte) } -func (p pointer) BytesPtr() **[]byte { return p.v.Interface().(**[]byte) } -func (p pointer) BytesSlice() *[][]byte { return p.v.Interface().(*[][]byte) } -func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.v.Interface().(*WeakFields)) } -func (p pointer) Extensions() *map[int32]ExtensionField { - return p.v.Interface().(*map[int32]ExtensionField) -} - -func (p pointer) Elem() pointer { - return pointer{v: p.v.Elem()} -} - -// PointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) PointerSlice() []pointer { - // TODO: reconsider this - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// AppendPointerSlice appends v to p, which must be a []*T. -func (p pointer) AppendPointerSlice(v pointer) { - sp := p.v.Elem() - sp.Set(reflect.Append(sp, v.v)) -} - -// SetPointer sets *p to v. -func (p pointer) SetPointer(v pointer) { - p.v.Elem().Set(v.v) -} - -func growSlice(p pointer, addCap int) { - // TODO: Once we only support Go 1.20 and newer, use reflect.Grow. - in := p.v.Elem() - out := reflect.MakeSlice(in.Type(), in.Len(), in.Len()+addCap) - reflect.Copy(out, in) - p.v.Elem().Set(out) -} - -func (p pointer) growBoolSlice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growInt32Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growUint32Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growInt64Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growUint64Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growFloat64Slice(addCap int) { - growSlice(p, addCap) -} - -func (p pointer) growFloat32Slice(addCap int) { - growSlice(p, addCap) -} - -func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") } -func (ms *messageState) pointer() pointer { panic("not supported") } -func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") } -func (ms *messageState) LoadMessageInfo() *MessageInfo { panic("not supported") } -func (ms *messageState) StoreMessageInfo(mi *MessageInfo) { panic("not supported") } - -type atomicNilMessage struct { - once sync.Once - m messageReflectWrapper -} - -func (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper { - m.once.Do(func() { - m.m.p = pointerOfIface(reflect.Zero(mi.GoReflectType).Interface()) - m.m.mi = mi - }) - return &m.m -} diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go index 4b020e311..79e186667 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine -// +build !purego,!appengine - package impl import ( @@ -50,7 +47,7 @@ func pointerOfValue(v reflect.Value) pointer { } // pointerOfIface returns the pointer portion of an interface. -func pointerOfIface(v interface{}) pointer { +func pointerOfIface(v any) pointer { type ifaceHeader struct { Type unsafe.Pointer Data unsafe.Pointer @@ -80,7 +77,7 @@ func (p pointer) AsValueOf(t reflect.Type) reflect.Value { // AsIfaceOf treats p as a pointer to an object of type t and returns the value. // It is equivalent to p.AsValueOf(t).Interface() -func (p pointer) AsIfaceOf(t reflect.Type) interface{} { +func (p pointer) AsIfaceOf(t reflect.Type) any { // TODO: Use tricky unsafe magic to directly create ifaceHeader. return p.AsValueOf(t).Interface() } diff --git a/vendor/google.golang.org/protobuf/internal/order/range.go b/vendor/google.golang.org/protobuf/internal/order/range.go index 1665a68e5..a1f09162d 100644 --- a/vendor/google.golang.org/protobuf/internal/order/range.go +++ b/vendor/google.golang.org/protobuf/internal/order/range.go @@ -18,7 +18,7 @@ type messageField struct { } var messageFieldPool = sync.Pool{ - New: func() interface{} { return new([]messageField) }, + New: func() any { return new([]messageField) }, } type ( @@ -69,7 +69,7 @@ type mapEntry struct { } var mapEntryPool = sync.Pool{ - New: func() interface{} { return new([]mapEntry) }, + New: func() any { return new([]mapEntry) }, } type ( diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go b/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go deleted file mode 100644 index a1f6f3338..000000000 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go +++ /dev/null @@ -1,28 +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. - -//go:build purego || appengine -// +build purego appengine - -package strs - -import pref "google.golang.org/protobuf/reflect/protoreflect" - -func UnsafeString(b []byte) string { - return string(b) -} - -func UnsafeBytes(s string) []byte { - return []byte(s) -} - -type Builder struct{} - -func (*Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName { - return prefix.Append(name) -} - -func (*Builder) MakeString(b []byte) string { - return string(b) -} diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go index a008acd09..832a7988f 100644 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go +++ b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine && !go1.21 -// +build !purego,!appengine,!go1.21 +//go:build !go1.21 package strs diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go index 60166f2ba..1ffddf687 100644 --- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go +++ b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine && go1.21 -// +build !purego,!appengine,go1.21 +//go:build go1.21 package strs diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index a50fcfb49..fb8e15e8d 100644 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -51,8 +51,8 @@ import ( // 10. Send out the CL for review and submit it. const ( Major = 1 - Minor = 33 - Patch = 0 + Minor = 35 + Patch = 1 PreRelease = "" ) diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go index e5b03b567..d75a6534c 100644 --- a/vendor/google.golang.org/protobuf/proto/decode.go +++ b/vendor/google.golang.org/protobuf/proto/decode.go @@ -51,6 +51,8 @@ type UnmarshalOptions struct { // Unmarshal parses the wire-format message in b and places the result in m. // The provided message must be mutable (e.g., a non-nil pointer to a message). +// +// See the [UnmarshalOptions] type if you need more control. func Unmarshal(b []byte, m Message) error { _, err := UnmarshalOptions{RecursionLimit: protowire.DefaultRecursionLimit}.unmarshal(b, m.ProtoReflect()) return err diff --git a/vendor/google.golang.org/protobuf/proto/encode.go b/vendor/google.golang.org/protobuf/proto/encode.go index 4fed202f9..1f847bcc3 100644 --- a/vendor/google.golang.org/protobuf/proto/encode.go +++ b/vendor/google.golang.org/protobuf/proto/encode.go @@ -5,12 +5,17 @@ package proto import ( + "errors" + "fmt" + "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/order" "google.golang.org/protobuf/internal/pragma" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/runtime/protoiface" + + protoerrors "google.golang.org/protobuf/internal/errors" ) // MarshalOptions configures the marshaler. @@ -70,7 +75,32 @@ type MarshalOptions struct { UseCachedSize bool } +// flags turns the specified MarshalOptions (user-facing) into +// protoiface.MarshalInputFlags (used internally by the marshaler). +// +// See impl.marshalOptions.Options for the inverse operation. +func (o MarshalOptions) flags() protoiface.MarshalInputFlags { + var flags protoiface.MarshalInputFlags + + // Note: o.AllowPartial is always forced to true by MarshalOptions.marshal, + // which is why it is not a part of MarshalInputFlags. + + if o.Deterministic { + flags |= protoiface.MarshalDeterministic + } + + if o.UseCachedSize { + flags |= protoiface.MarshalUseCachedSize + } + + return flags +} + // Marshal returns the wire-format encoding of m. +// +// This is the most common entry point for encoding a Protobuf message. +// +// See the [MarshalOptions] type if you need more control. func Marshal(m Message) ([]byte, error) { // Treat nil message interface as an empty message; nothing to output. if m == nil { @@ -116,6 +146,9 @@ func emptyBytesForMessage(m Message) []byte { // MarshalAppend appends the wire-format encoding of m to b, // returning the result. +// +// This is a less common entry point than [Marshal], which is only needed if you +// need to supply your own buffers for performance reasons. func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) { // Treat nil message interface as an empty message; nothing to append. if m == nil { @@ -145,12 +178,7 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac in := protoiface.MarshalInput{ Message: m, Buf: b, - } - if o.Deterministic { - in.Flags |= protoiface.MarshalDeterministic - } - if o.UseCachedSize { - in.Flags |= protoiface.MarshalUseCachedSize + Flags: o.flags(), } if methods.Size != nil { sout := methods.Size(protoiface.SizeInput{ @@ -168,6 +196,10 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac out.Buf, err = o.marshalMessageSlow(b, m) } if err != nil { + var mismatch *protoerrors.SizeMismatchError + if errors.As(err, &mismatch) { + return out, fmt.Errorf("marshaling %s: %v", string(m.Descriptor().FullName()), err) + } return out, err } if allowPartial { diff --git a/vendor/google.golang.org/protobuf/proto/equal.go b/vendor/google.golang.org/protobuf/proto/equal.go index 1a0be1b03..c36d4a9cd 100644 --- a/vendor/google.golang.org/protobuf/proto/equal.go +++ b/vendor/google.golang.org/protobuf/proto/equal.go @@ -8,6 +8,7 @@ import ( "reflect" "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/runtime/protoiface" ) // Equal reports whether two messages are equal, @@ -51,6 +52,14 @@ func Equal(x, y Message) bool { if mx.IsValid() != my.IsValid() { return false } + + // Only one of the messages needs to implement the fast-path for it to work. + pmx := protoMethods(mx) + pmy := protoMethods(my) + if pmx != nil && pmy != nil && pmx.Equal != nil && pmy.Equal != nil { + return pmx.Equal(protoiface.EqualInput{MessageA: mx, MessageB: my}).Equal + } + vx := protoreflect.ValueOfMessage(mx) vy := protoreflect.ValueOfMessage(my) return vx.Equal(vy) diff --git a/vendor/google.golang.org/protobuf/proto/extension.go b/vendor/google.golang.org/protobuf/proto/extension.go index 17899a3a7..78445d116 100644 --- a/vendor/google.golang.org/protobuf/proto/extension.go +++ b/vendor/google.golang.org/protobuf/proto/extension.go @@ -11,18 +11,21 @@ import ( // HasExtension reports whether an extension field is populated. // It returns false if m is invalid or if xt does not extend m. func HasExtension(m Message, xt protoreflect.ExtensionType) bool { - // Treat nil message interface as an empty message; no populated fields. - if m == nil { + // Treat nil message interface or descriptor as an empty message; no populated + // fields. + if m == nil || xt == nil { return false } // As a special-case, we reports invalid or mismatching descriptors // as always not being populated (since they aren't). - if xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() { + mr := m.ProtoReflect() + xd := xt.TypeDescriptor() + if mr.Descriptor() != xd.ContainingMessage() { return false } - return m.ProtoReflect().Has(xt.TypeDescriptor()) + return mr.Has(xd) } // ClearExtension clears an extension field such that subsequent @@ -36,7 +39,49 @@ func ClearExtension(m Message, xt protoreflect.ExtensionType) { // If the field is unpopulated, it returns the default value for // scalars and an immutable, empty value for lists or messages. // It panics if xt does not extend m. -func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} { +// +// The type of the value is dependent on the field type of the extension. +// For extensions generated by protoc-gen-go, the Go type is as follows: +// +// ╔═══════════════════╤═════════════════════════╗ +// ║ Go type │ Protobuf kind ║ +// ╠═══════════════════╪═════════════════════════╣ +// ║ bool │ bool ║ +// ║ int32 │ int32, sint32, sfixed32 ║ +// ║ int64 │ int64, sint64, sfixed64 ║ +// ║ uint32 │ uint32, fixed32 ║ +// ║ uint64 │ uint64, fixed64 ║ +// ║ float32 │ float ║ +// ║ float64 │ double ║ +// ║ string │ string ║ +// ║ []byte │ bytes ║ +// ║ protoreflect.Enum │ enum ║ +// ║ proto.Message │ message, group ║ +// ╚═══════════════════╧═════════════════════════╝ +// +// The protoreflect.Enum and proto.Message types are the concrete Go type +// associated with the named enum or message. Repeated fields are represented +// using a Go slice of the base element type. +// +// If a generated extension descriptor variable is directly passed to +// GetExtension, then the call should be followed immediately by a +// type assertion to the expected output value. For example: +// +// mm := proto.GetExtension(m, foopb.E_MyExtension).(*foopb.MyMessage) +// +// This pattern enables static analysis tools to verify that the asserted type +// matches the Go type associated with the extension field and +// also enables a possible future migration to a type-safe extension API. +// +// Since singular messages are the most common extension type, the pattern of +// calling HasExtension followed by GetExtension may be simplified to: +// +// if mm := proto.GetExtension(m, foopb.E_MyExtension).(*foopb.MyMessage); mm != nil { +// ... // make use of mm +// } +// +// The mm variable is non-nil if and only if HasExtension reports true. +func GetExtension(m Message, xt protoreflect.ExtensionType) any { // Treat nil message interface as an empty message; return the default. if m == nil { return xt.InterfaceOf(xt.Zero()) @@ -48,7 +93,36 @@ func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} { // SetExtension stores the value of an extension field. // It panics if m is invalid, xt does not extend m, or if type of v // is invalid for the specified extension field. -func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) { +// +// The type of the value is dependent on the field type of the extension. +// For extensions generated by protoc-gen-go, the Go type is as follows: +// +// ╔═══════════════════╤═════════════════════════╗ +// ║ Go type │ Protobuf kind ║ +// ╠═══════════════════╪═════════════════════════╣ +// ║ bool │ bool ║ +// ║ int32 │ int32, sint32, sfixed32 ║ +// ║ int64 │ int64, sint64, sfixed64 ║ +// ║ uint32 │ uint32, fixed32 ║ +// ║ uint64 │ uint64, fixed64 ║ +// ║ float32 │ float ║ +// ║ float64 │ double ║ +// ║ string │ string ║ +// ║ []byte │ bytes ║ +// ║ protoreflect.Enum │ enum ║ +// ║ proto.Message │ message, group ║ +// ╚═══════════════════╧═════════════════════════╝ +// +// The protoreflect.Enum and proto.Message types are the concrete Go type +// associated with the named enum or message. Repeated fields are represented +// using a Go slice of the base element type. +// +// If a generated extension descriptor variable is directly passed to +// SetExtension (e.g., foopb.E_MyExtension), then the value should be a +// concrete type that matches the expected Go type for the extension descriptor +// so that static analysis tools can verify type correctness. +// This also enables a possible future migration to a type-safe extension API. +func SetExtension(m Message, xt protoreflect.ExtensionType, v any) { xd := xt.TypeDescriptor() pv := xt.ValueOf(v) @@ -75,7 +149,7 @@ func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) { // It returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current extension field. -func RangeExtensions(m Message, f func(protoreflect.ExtensionType, interface{}) bool) { +func RangeExtensions(m Message, f func(protoreflect.ExtensionType, any) bool) { // Treat nil message interface as an empty message; nothing to range over. if m == nil { return diff --git a/vendor/google.golang.org/protobuf/proto/messageset.go b/vendor/google.golang.org/protobuf/proto/messageset.go index 312d5d45c..575d14831 100644 --- a/vendor/google.golang.org/protobuf/proto/messageset.go +++ b/vendor/google.golang.org/protobuf/proto/messageset.go @@ -47,11 +47,16 @@ func (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]b func (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) { b = messageset.AppendFieldStart(b, fd.Number()) b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType) - b = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface()))) + calculatedSize := o.Size(value.Message().Interface()) + b = protowire.AppendVarint(b, uint64(calculatedSize)) + before := len(b) b, err := o.marshalMessage(b, value.Message()) if err != nil { return b, err } + if measuredSize := len(b) - before; calculatedSize != measuredSize { + return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize) + } b = messageset.AppendFieldEnd(b) return b, nil } diff --git a/vendor/google.golang.org/protobuf/proto/size.go b/vendor/google.golang.org/protobuf/proto/size.go index f1692b49b..052fb5ae3 100644 --- a/vendor/google.golang.org/protobuf/proto/size.go +++ b/vendor/google.golang.org/protobuf/proto/size.go @@ -34,6 +34,7 @@ func (o MarshalOptions) size(m protoreflect.Message) (size int) { if methods != nil && methods.Size != nil { out := methods.Size(protoiface.SizeInput{ Message: m, + Flags: o.flags(), }) return out.Size } @@ -42,6 +43,7 @@ func (o MarshalOptions) size(m protoreflect.Message) (size int) { // This case is mainly used for legacy types with a Marshal method. out, _ := methods.Marshal(protoiface.MarshalInput{ Message: m, + Flags: o.flags(), }) return len(out.Buf) } diff --git a/vendor/google.golang.org/protobuf/protoadapt/convert.go b/vendor/google.golang.org/protobuf/protoadapt/convert.go new file mode 100644 index 000000000..ea276d15a --- /dev/null +++ b/vendor/google.golang.org/protobuf/protoadapt/convert.go @@ -0,0 +1,31 @@ +// Copyright 2023 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 protoadapt bridges the original and new proto APIs. +package protoadapt + +import ( + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/runtime/protoiface" + "google.golang.org/protobuf/runtime/protoimpl" +) + +// MessageV1 is the original [github.com/golang/protobuf/proto.Message] type. +type MessageV1 = protoiface.MessageV1 + +// MessageV2 is the [google.golang.org/protobuf/proto.Message] type used by the +// current [google.golang.org/protobuf] module, adding support for reflection. +type MessageV2 = proto.Message + +// MessageV1Of converts a v2 message to a v1 message. +// It returns nil if m is nil. +func MessageV1Of(m MessageV2) MessageV1 { + return protoimpl.X.ProtoMessageV1Of(m) +} + +// MessageV2Of converts a v1 message to a v2 message. +// It returns nil if m is nil. +func MessageV2Of(m MessageV1) MessageV2 { + return protoimpl.X.ProtoMessageV2Of(m) +} diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go index baa0cc621..8fbecb4f5 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go @@ -13,6 +13,7 @@ package protodesc import ( + "google.golang.org/protobuf/internal/editionssupport" "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/internal/filedesc" "google.golang.org/protobuf/internal/pragma" @@ -91,15 +92,17 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot switch fd.GetSyntax() { case "proto2", "": f.L1.Syntax = protoreflect.Proto2 + f.L1.Edition = filedesc.EditionProto2 case "proto3": f.L1.Syntax = protoreflect.Proto3 + f.L1.Edition = filedesc.EditionProto3 case "editions": f.L1.Syntax = protoreflect.Editions f.L1.Edition = fromEditionProto(fd.GetEdition()) default: return nil, errors.New("invalid syntax: %q", fd.GetSyntax()) } - if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < SupportedEditionsMinimum || fd.GetEdition() > SupportedEditionsMaximum) { + if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < editionssupport.Minimum || fd.GetEdition() > editionssupport.Maximum) { return nil, errors.New("use of edition %v not yet supported by the Go Protobuf runtime", fd.GetEdition()) } f.L1.Path = fd.GetName() @@ -114,9 +117,7 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot opts = proto.Clone(opts).(*descriptorpb.FileOptions) f.L2.Options = func() protoreflect.ProtoMessage { return opts } } - if f.L1.Syntax == protoreflect.Editions { - initFileDescFromFeatureSet(f, fd.GetOptions().GetFeatures()) - } + initFileDescFromFeatureSet(f, fd.GetOptions().GetFeatures()) f.L2.Imports = make(filedesc.FileImports, len(fd.GetDependency())) for _, i := range fd.GetPublicDependency() { @@ -219,10 +220,10 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot if err := validateEnumDeclarations(f.L1.Enums.List, fd.GetEnumType()); err != nil { return nil, err } - if err := validateMessageDeclarations(f.L1.Messages.List, fd.GetMessageType()); err != nil { + if err := validateMessageDeclarations(f, f.L1.Messages.List, fd.GetMessageType()); err != nil { return nil, err } - if err := validateExtensionDeclarations(f.L1.Extensions.List, fd.GetExtension()); err != nil { + if err := validateExtensionDeclarations(f, f.L1.Extensions.List, fd.GetExtension()); err != nil { return nil, err } diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go index b3278163c..ebcb4a8ab 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go @@ -69,9 +69,7 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt if m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil { return nil, err } - if m.Base.L0.ParentFile.Syntax() == protoreflect.Editions { - m.L1.EditionFeatures = mergeEditionFeatures(parent, md.GetOptions().GetFeatures()) - } + m.L1.EditionFeatures = mergeEditionFeatures(parent, md.GetOptions().GetFeatures()) if opts := md.GetOptions(); opts != nil { opts = proto.Clone(opts).(*descriptorpb.MessageOptions) m.L2.Options = func() protoreflect.ProtoMessage { return opts } @@ -146,13 +144,16 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc if f.L0, err = r.makeBase(f, parent, fd.GetName(), i, sb); err != nil { return nil, err } + f.L1.EditionFeatures = mergeEditionFeatures(parent, fd.GetOptions().GetFeatures()) f.L1.IsProto3Optional = fd.GetProto3Optional() if opts := fd.GetOptions(); opts != nil { opts = proto.Clone(opts).(*descriptorpb.FieldOptions) f.L1.Options = func() protoreflect.ProtoMessage { return opts } f.L1.IsWeak = opts.GetWeak() - f.L1.HasPacked = opts.Packed != nil - f.L1.IsPacked = opts.GetPacked() + f.L1.IsLazy = opts.GetLazy() + if opts.Packed != nil { + f.L1.EditionFeatures.IsPacked = opts.GetPacked() + } } f.L1.Number = protoreflect.FieldNumber(fd.GetNumber()) f.L1.Cardinality = protoreflect.Cardinality(fd.GetLabel()) @@ -163,32 +164,12 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc f.L1.StringName.InitJSON(fd.GetJsonName()) } - if f.Base.L0.ParentFile.Syntax() == protoreflect.Editions { - f.L1.EditionFeatures = mergeEditionFeatures(parent, fd.GetOptions().GetFeatures()) - - if f.L1.EditionFeatures.IsLegacyRequired { - f.L1.Cardinality = protoreflect.Required - } - // We reuse the existing field because the old option `[packed = - // true]` is mutually exclusive with the editions feature. - if canBePacked(fd) { - f.L1.HasPacked = true - f.L1.IsPacked = f.L1.EditionFeatures.IsPacked - } - - // We pretend this option is always explicitly set because the only - // use of HasEnforceUTF8 is to determine whether to use EnforceUTF8 - // or to return the appropriate default. - // When using editions we either parse the option or resolve the - // appropriate default here (instead of later when this option is - // requested from the descriptor). - // In proto2/proto3 syntax HasEnforceUTF8 might be false. - f.L1.HasEnforceUTF8 = true - f.L1.EnforceUTF8 = f.L1.EditionFeatures.IsUTF8Validated + if f.L1.EditionFeatures.IsLegacyRequired { + f.L1.Cardinality = protoreflect.Required + } - if f.L1.Kind == protoreflect.MessageKind && f.L1.EditionFeatures.IsDelimitedEncoded { - f.L1.Kind = protoreflect.GroupKind - } + if f.L1.Kind == protoreflect.MessageKind && f.L1.EditionFeatures.IsDelimitedEncoded { + f.L1.Kind = protoreflect.GroupKind } } return fs, nil @@ -201,12 +182,10 @@ func (r descsByName) initOneofsFromDescriptorProto(ods []*descriptorpb.OneofDesc if o.L0, err = r.makeBase(o, parent, od.GetName(), i, sb); err != nil { return nil, err } + o.L1.EditionFeatures = mergeEditionFeatures(parent, od.GetOptions().GetFeatures()) if opts := od.GetOptions(); opts != nil { opts = proto.Clone(opts).(*descriptorpb.OneofOptions) o.L1.Options = func() protoreflect.ProtoMessage { return opts } - if parent.Syntax() == protoreflect.Editions { - o.L1.EditionFeatures = mergeEditionFeatures(parent, opts.GetFeatures()) - } } } return os, nil @@ -220,10 +199,13 @@ func (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescript if x.L0, err = r.makeBase(x, parent, xd.GetName(), i, sb); err != nil { return nil, err } + x.L1.EditionFeatures = mergeEditionFeatures(parent, xd.GetOptions().GetFeatures()) if opts := xd.GetOptions(); opts != nil { opts = proto.Clone(opts).(*descriptorpb.FieldOptions) x.L2.Options = func() protoreflect.ProtoMessage { return opts } - x.L2.IsPacked = opts.GetPacked() + if opts.Packed != nil { + x.L1.EditionFeatures.IsPacked = opts.GetPacked() + } } x.L1.Number = protoreflect.FieldNumber(xd.GetNumber()) x.L1.Cardinality = protoreflect.Cardinality(xd.GetLabel()) @@ -233,6 +215,9 @@ func (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescript if xd.JsonName != nil { x.L2.StringName.InitJSON(xd.GetJsonName()) } + if x.L1.Kind == protoreflect.MessageKind && x.L1.EditionFeatures.IsDelimitedEncoded { + x.L1.Kind = protoreflect.GroupKind + } } return xs, nil } diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go index 254ca5854..f3cebab29 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go @@ -46,6 +46,11 @@ func (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*desc if f.L1.Kind, f.L1.Enum, f.L1.Message, err = r.findTarget(f.Kind(), f.Parent().FullName(), partialName(fd.GetTypeName()), f.IsWeak()); err != nil { return errors.New("message field %q cannot resolve type: %v", f.FullName(), err) } + if f.L1.Kind == protoreflect.GroupKind && (f.IsMap() || f.IsMapEntry()) { + // A map field might inherit delimited encoding from a file-wide default feature. + // But maps never actually use delimited encoding. (At least for now...) + f.L1.Kind = protoreflect.MessageKind + } if fd.DefaultValue != nil { v, ev, err := unmarshalDefault(fd.GetDefaultValue(), f, r.allowUnresolvable) if err != nil { diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go index e4dcaf876..6de31c2eb 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go @@ -45,11 +45,11 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri if allowAlias && !foundAlias { return errors.New("enum %q allows aliases, but none were found", e.FullName()) } - if e.Syntax() == protoreflect.Proto3 { + if !e.IsClosed() { if v := e.Values().Get(0); v.Number() != 0 { - return errors.New("enum %q using proto3 semantics must have zero number for the first value", v.FullName()) + return errors.New("enum %q using open semantics must have zero number for the first value", v.FullName()) } - // Verify that value names in proto3 do not conflict if the + // Verify that value names in open enums do not conflict if the // case-insensitive prefix is removed. // See protoc v3.8.0: src/google/protobuf/descriptor.cc:4991-5055 names := map[string]protoreflect.EnumValueDescriptor{} @@ -58,7 +58,7 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri v1 := e.Values().Get(i) s := strs.EnumValueName(strs.TrimEnumPrefix(string(v1.Name()), prefix)) if v2, ok := names[s]; ok && v1.Number() != v2.Number() { - return errors.New("enum %q using proto3 semantics has conflict: %q with %q", e.FullName(), v1.Name(), v2.Name()) + return errors.New("enum %q using open semantics has conflict: %q with %q", e.FullName(), v1.Name(), v2.Name()) } names[s] = v1 } @@ -80,7 +80,9 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri return nil } -func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) error { +func validateMessageDeclarations(file *filedesc.File, ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) error { + // There are a few limited exceptions only for proto3 + isProto3 := file.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3) for i, md := range mds { m := &ms[i] @@ -107,25 +109,13 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc if isMessageSet && !flags.ProtoLegacy { return errors.New("message %q is a MessageSet, which is a legacy proto1 feature that is no longer supported", m.FullName()) } - if isMessageSet && (m.Syntax() == protoreflect.Proto3 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) { + if isMessageSet && (isProto3 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) { return errors.New("message %q is an invalid proto1 MessageSet", m.FullName()) } - if m.Syntax() == protoreflect.Proto3 { + if isProto3 { if m.ExtensionRanges().Len() > 0 { return errors.New("message %q using proto3 semantics cannot have extension ranges", m.FullName()) } - // Verify that field names in proto3 do not conflict if lowercased - // with all underscores removed. - // See protoc v3.8.0: src/google/protobuf/descriptor.cc:5830-5847 - names := map[string]protoreflect.FieldDescriptor{} - for i := 0; i < m.Fields().Len(); i++ { - f1 := m.Fields().Get(i) - s := strings.Replace(strings.ToLower(string(f1.Name())), "_", "", -1) - if f2, ok := names[s]; ok { - return errors.New("message %q using proto3 semantics has conflict: %q with %q", m.FullName(), f1.Name(), f2.Name()) - } - names[s] = f1 - } } for j, fd := range md.GetField() { @@ -149,7 +139,7 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc return errors.New("message field %q may not have extendee: %q", f.FullName(), fd.GetExtendee()) } if f.L1.IsProto3Optional { - if f.Syntax() != protoreflect.Proto3 { + if !isProto3 { return errors.New("message field %q under proto3 optional semantics must be specified in the proto3 syntax", f.FullName()) } if f.Cardinality() != protoreflect.Optional { @@ -162,26 +152,29 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc if f.IsWeak() && !flags.ProtoLegacy { return errors.New("message field %q is a weak field, which is a legacy proto1 feature that is no longer supported", f.FullName()) } - if f.IsWeak() && (f.Syntax() != protoreflect.Proto2 || !isOptionalMessage(f) || f.ContainingOneof() != nil) { + if f.IsWeak() && (!f.HasPresence() || !isOptionalMessage(f) || f.ContainingOneof() != nil) { return errors.New("message field %q may only be weak for an optional message", f.FullName()) } if f.IsPacked() && !isPackable(f) { return errors.New("message field %q is not packable", f.FullName()) } - if err := checkValidGroup(f); err != nil { + if err := checkValidGroup(file, f); err != nil { return errors.New("message field %q is an invalid group: %v", f.FullName(), err) } if err := checkValidMap(f); err != nil { return errors.New("message field %q is an invalid map: %v", f.FullName(), err) } - if f.Syntax() == protoreflect.Proto3 { + if isProto3 { if f.Cardinality() == protoreflect.Required { return errors.New("message field %q using proto3 semantics cannot be required", f.FullName()) } - if f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().Syntax() != protoreflect.Proto3 { - return errors.New("message field %q using proto3 semantics may only depend on a proto3 enum", f.FullName()) + if f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().IsClosed() { + return errors.New("message field %q using proto3 semantics may only depend on open enums", f.FullName()) } } + if f.Cardinality() == protoreflect.Optional && !f.HasPresence() && f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().IsClosed() { + return errors.New("message field %q with implicit presence may only use open enums", f.FullName()) + } } seenSynthetic := false // synthetic oneofs for proto3 optional must come after real oneofs for j := range md.GetOneofDecl() { @@ -215,17 +208,17 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc if err := validateEnumDeclarations(m.L1.Enums.List, md.GetEnumType()); err != nil { return err } - if err := validateMessageDeclarations(m.L1.Messages.List, md.GetNestedType()); err != nil { + if err := validateMessageDeclarations(file, m.L1.Messages.List, md.GetNestedType()); err != nil { return err } - if err := validateExtensionDeclarations(m.L1.Extensions.List, md.GetExtension()); err != nil { + if err := validateExtensionDeclarations(file, m.L1.Extensions.List, md.GetExtension()); err != nil { return err } } return nil } -func validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) error { +func validateExtensionDeclarations(f *filedesc.File, xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) error { for i, xd := range xds { x := &xs[i] // NOTE: Avoid using the IsValid method since extensions to MessageSet @@ -267,13 +260,13 @@ func validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb. if x.IsPacked() && !isPackable(x) { return errors.New("extension field %q is not packable", x.FullName()) } - if err := checkValidGroup(x); err != nil { + if err := checkValidGroup(f, x); err != nil { return errors.New("extension field %q is an invalid group: %v", x.FullName(), err) } if md := x.Message(); md != nil && md.IsMapEntry() { return errors.New("extension field %q cannot be a map entry", x.FullName()) } - if x.Syntax() == protoreflect.Proto3 { + if f.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3) { switch x.ContainingMessage().FullName() { case (*descriptorpb.FileOptions)(nil).ProtoReflect().Descriptor().FullName(): case (*descriptorpb.EnumOptions)(nil).ProtoReflect().Descriptor().FullName(): @@ -309,21 +302,25 @@ func isPackable(fd protoreflect.FieldDescriptor) bool { // checkValidGroup reports whether fd is a valid group according to the same // rules that protoc imposes. -func checkValidGroup(fd protoreflect.FieldDescriptor) error { +func checkValidGroup(f *filedesc.File, fd protoreflect.FieldDescriptor) error { md := fd.Message() switch { case fd.Kind() != protoreflect.GroupKind: return nil - case fd.Syntax() == protoreflect.Proto3: + case f.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3): return errors.New("invalid under proto3 semantics") case md == nil || md.IsPlaceholder(): return errors.New("message must be resolvable") - case fd.FullName().Parent() != md.FullName().Parent(): - return errors.New("message and field must be declared in the same scope") - case !unicode.IsUpper(rune(md.Name()[0])): - return errors.New("message name must start with an uppercase") - case fd.Name() != protoreflect.Name(strings.ToLower(string(md.Name()))): - return errors.New("field name must be lowercased form of the message name") + } + if f.L1.Edition < fromEditionProto(descriptorpb.Edition_EDITION_2023) { + switch { + case fd.FullName().Parent() != md.FullName().Parent(): + return errors.New("message and field must be declared in the same scope") + case !unicode.IsUpper(rune(md.Name()[0])): + return errors.New("message name must start with an uppercase") + case fd.Name() != protoreflect.Name(strings.ToLower(string(md.Name()))): + return errors.New("field name must be lowercased form of the message name") + } } return nil } diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go index 2a6b29d17..002e0047a 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go @@ -14,12 +14,7 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/descriptorpb" - gofeaturespb "google.golang.org/protobuf/types/gofeaturespb" -) - -const ( - SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO2 - SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2023 + "google.golang.org/protobuf/types/gofeaturespb" ) var defaults = &descriptorpb.FeatureSetDefaults{} @@ -67,18 +62,20 @@ func getFeatureSetFor(ed filedesc.Edition) *descriptorpb.FeatureSet { fmt.Fprintf(os.Stderr, "internal error: unsupported edition %v (did you forget to update the embedded defaults (i.e. the bootstrap descriptor proto)?)\n", edpb) os.Exit(1) } - fs := defaults.GetDefaults()[0].GetFeatures() + fsed := defaults.GetDefaults()[0] // Using a linear search for now. // Editions are guaranteed to be sorted and thus we could use a binary search. // Given that there are only a handful of editions (with one more per year) // there is not much reason to use a binary search. for _, def := range defaults.GetDefaults() { if def.GetEdition() <= edpb { - fs = def.GetFeatures() + fsed = def } else { break } } + fs := proto.Clone(fsed.GetFixedFeatures()).(*descriptorpb.FeatureSet) + proto.Merge(fs, fsed.GetOverridableFeatures()) defaultsCache[ed] = fs return fs } diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go index 9d6e05420..a5de8d400 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go @@ -73,6 +73,16 @@ func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileD if syntax := file.Syntax(); syntax != protoreflect.Proto2 && syntax.IsValid() { p.Syntax = proto.String(file.Syntax().String()) } + if file.Syntax() == protoreflect.Editions { + desc := file + if fileImportDesc, ok := file.(protoreflect.FileImport); ok { + desc = fileImportDesc.FileDescriptor + } + + if editionsInterface, ok := desc.(interface{ Edition() int32 }); ok { + p.Edition = descriptorpb.Edition(editionsInterface.Edition()).Enum() + } + } return p } @@ -153,6 +163,18 @@ func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.Fi if field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() { p.Proto3Optional = proto.Bool(true) } + if field.Syntax() == protoreflect.Editions { + // Editions have no group keyword, this type is only set so that downstream users continue + // treating this as delimited encoding. + if p.GetType() == descriptorpb.FieldDescriptorProto_TYPE_GROUP { + p.Type = descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum() + } + // Editions have no required keyword, this label is only set so that downstream users continue + // treating it as required. + if p.GetLabel() == descriptorpb.FieldDescriptorProto_LABEL_REQUIRED { + p.Label = descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum() + } + } if field.HasDefault() { def, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor) if err != nil && field.DefaultEnumValue() != nil { diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go index d5d5af6eb..742cb518c 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go @@ -23,6 +23,7 @@ type ( Unmarshal func(unmarshalInput) (unmarshalOutput, error) Merge func(mergeInput) mergeOutput CheckInitialized func(checkInitializedInput) (checkInitializedOutput, error) + Equal func(equalInput) equalOutput } supportFlags = uint64 sizeInput = struct { @@ -75,4 +76,13 @@ type ( checkInitializedOutput = struct { pragma.NoUnkeyedLiterals } + equalInput = struct { + pragma.NoUnkeyedLiterals + MessageA Message + MessageB Message + } + equalOutput = struct { + pragma.NoUnkeyedLiterals + Equal bool + } ) diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go index 00b01fbd8..c85bfaa5b 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go @@ -161,7 +161,7 @@ const ( // IsValid reports whether the syntax is valid. func (s Syntax) IsValid() bool { switch s { - case Proto2, Proto3: + case Proto2, Proto3, Editions: return true default: return false diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go index 7dcc2ff09..ea154eec4 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go @@ -373,6 +373,8 @@ func (p *SourcePath) appendFieldOptions(b []byte) []byte { b = p.appendRepeatedField(b, "edition_defaults", (*SourcePath).appendFieldOptions_EditionDefault) case 21: b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) + case 22: + b = p.appendSingularField(b, "feature_support", (*SourcePath).appendFieldOptions_FeatureSupport) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -483,6 +485,8 @@ func (p *SourcePath) appendEnumValueOptions(b []byte) []byte { b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet) case 3: b = p.appendSingularField(b, "debug_redact", nil) + case 4: + b = p.appendSingularField(b, "feature_support", (*SourcePath).appendFieldOptions_FeatureSupport) case 999: b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) } @@ -519,6 +523,23 @@ func (p *SourcePath) appendFieldOptions_EditionDefault(b []byte) []byte { return b } +func (p *SourcePath) appendFieldOptions_FeatureSupport(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "edition_introduced", nil) + case 2: + b = p.appendSingularField(b, "edition_deprecated", nil) + case 3: + b = p.appendSingularField(b, "deprecation_warning", nil) + case 4: + b = p.appendSingularField(b, "edition_removed", nil) + } + return b +} + func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte { if len(*p) == 0 { return b diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go index 60ff62b4c..cd8fadbaf 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go @@ -510,7 +510,7 @@ type ExtensionType interface { // // ValueOf is more extensive than protoreflect.ValueOf for a given field's // value as it has more type information available. - ValueOf(interface{}) Value + ValueOf(any) Value // InterfaceOf completely unwraps the Value to the underlying Go type. // InterfaceOf panics if the input is nil or does not represent the @@ -519,13 +519,13 @@ type ExtensionType interface { // // InterfaceOf is able to unwrap the Value further than Value.Interface // as it has more type information available. - InterfaceOf(Value) interface{} + InterfaceOf(Value) any // IsValidValue reports whether the Value is valid to assign to the field. IsValidValue(Value) bool // IsValidInterface reports whether the input is valid to assign to the field. - IsValidInterface(interface{}) bool + IsValidInterface(any) bool } // EnumDescriptor describes an enum and @@ -544,6 +544,12 @@ type EnumDescriptor interface { // ReservedRanges is a list of reserved ranges of enum numbers. ReservedRanges() EnumRanges + // IsClosed reports whether this enum uses closed semantics. + // See https://protobuf.dev/programming-guides/enum/#definitions. + // Note: the Go protobuf implementation is not spec compliant and treats + // all enums as open enums. + IsClosed() bool + isEnumDescriptor } type isEnumDescriptor interface{ ProtoType(EnumDescriptor) } diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go deleted file mode 100644 index 7ced876f4..000000000 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go +++ /dev/null @@ -1,60 +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. - -//go:build purego || appengine -// +build purego appengine - -package protoreflect - -import "google.golang.org/protobuf/internal/pragma" - -type valueType int - -const ( - nilType valueType = iota - boolType - int32Type - int64Type - uint32Type - uint64Type - float32Type - float64Type - stringType - bytesType - enumType - ifaceType -) - -// value is a union where only one type can be represented at a time. -// This uses a distinct field for each type. This is type safe in Go, but -// occupies more memory than necessary (72B). -type value struct { - pragma.DoNotCompare // 0B - - typ valueType // 8B - num uint64 // 8B - str string // 16B - bin []byte // 24B - iface interface{} // 16B -} - -func valueOfString(v string) Value { - return Value{typ: stringType, str: v} -} -func valueOfBytes(v []byte) Value { - return Value{typ: bytesType, bin: v} -} -func valueOfIface(v interface{}) Value { - return Value{typ: ifaceType, iface: v} -} - -func (v Value) getString() string { - return v.str -} -func (v Value) getBytes() []byte { - return v.bin -} -func (v Value) getIface() interface{} { - return v.iface -} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go index 160309731..9fe83cef5 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go @@ -69,8 +69,8 @@ import ( // composite Value. Modifying an empty, read-only value panics. type Value value -// The protoreflect API uses a custom Value union type instead of interface{} -// to keep the future open for performance optimizations. Using an interface{} +// The protoreflect API uses a custom Value union type instead of any +// to keep the future open for performance optimizations. Using an any // always incurs an allocation for primitives (e.g., int64) since it needs to // be boxed on the heap (as interfaces can only contain pointers natively). // Instead, we represent the Value union as a flat struct that internally keeps @@ -85,7 +85,7 @@ type Value value // ValueOf returns a Value initialized with the concrete value stored in v. // This panics if the type does not match one of the allowed types in the // Value union. -func ValueOf(v interface{}) Value { +func ValueOf(v any) Value { switch v := v.(type) { case nil: return Value{} @@ -192,10 +192,10 @@ func (v Value) IsValid() bool { return v.typ != nilType } -// Interface returns v as an interface{}. +// Interface returns v as an any. // // Invariant: v == ValueOf(v).Interface() -func (v Value) Interface() interface{} { +func (v Value) Interface() any { switch v.typ { case nilType: return nil @@ -406,8 +406,8 @@ func (k MapKey) IsValid() bool { return Value(k).IsValid() } -// Interface returns k as an interface{}. -func (k MapKey) Interface() interface{} { +// Interface returns k as an any. +func (k MapKey) Interface() any { return Value(k).Interface() } diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go index b1fdbe3e8..0015fcb35 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine && !go1.21 -// +build !purego,!appengine,!go1.21 +//go:build !go1.21 package protoreflect @@ -45,7 +44,7 @@ var ( // typeOf returns a pointer to the Go type information. // The pointer is comparable and equal if and only if the types are identical. -func typeOf(t interface{}) unsafe.Pointer { +func typeOf(t any) unsafe.Pointer { return (*ifaceHeader)(unsafe.Pointer(&t)).Type } @@ -80,7 +79,7 @@ func valueOfBytes(v []byte) Value { p := (*sliceHeader)(unsafe.Pointer(&v)) return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))} } -func valueOfIface(v interface{}) Value { +func valueOfIface(v any) Value { p := (*ifaceHeader)(unsafe.Pointer(&v)) return Value{typ: p.Type, ptr: p.Data} } @@ -93,7 +92,7 @@ func (v Value) getBytes() (x []byte) { *(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)} return x } -func (v Value) getIface() (x interface{}) { +func (v Value) getIface() (x any) { *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr} return x } diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go index 435470111..479527b58 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !purego && !appengine && go1.21 -// +build !purego,!appengine,go1.21 +//go:build go1.21 package protoreflect @@ -15,7 +14,7 @@ import ( type ( ifaceHeader struct { - _ [0]interface{} // if interfaces have greater alignment than unsafe.Pointer, this will enforce it. + _ [0]any // if interfaces have greater alignment than unsafe.Pointer, this will enforce it. Type unsafe.Pointer Data unsafe.Pointer } @@ -37,7 +36,7 @@ var ( // typeOf returns a pointer to the Go type information. // The pointer is comparable and equal if and only if the types are identical. -func typeOf(t interface{}) unsafe.Pointer { +func typeOf(t any) unsafe.Pointer { return (*ifaceHeader)(unsafe.Pointer(&t)).Type } @@ -70,7 +69,7 @@ func valueOfString(v string) Value { func valueOfBytes(v []byte) Value { return Value{typ: bytesType, ptr: unsafe.Pointer(unsafe.SliceData(v)), num: uint64(len(v))} } -func valueOfIface(v interface{}) Value { +func valueOfIface(v any) Value { p := (*ifaceHeader)(unsafe.Pointer(&v)) return Value{typ: p.Type, ptr: p.Data} } @@ -81,7 +80,7 @@ func (v Value) getString() string { func (v Value) getBytes() []byte { return unsafe.Slice((*byte)(v.ptr), v.num) } -func (v Value) getIface() (x interface{}) { +func (v Value) getIface() (x any) { *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr} return x } diff --git a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go index 6267dc52a..de1777339 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +++ b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go @@ -95,7 +95,7 @@ type Files struct { // multiple files. Only top-level declarations are registered. // Note that enum values are in the top-level since that are in the same // scope as the parent enum. - descsByName map[protoreflect.FullName]interface{} + descsByName map[protoreflect.FullName]any filesByPath map[string][]protoreflect.FileDescriptor numFiles int } @@ -117,7 +117,7 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error { defer globalMutex.Unlock() } if r.descsByName == nil { - r.descsByName = map[protoreflect.FullName]interface{}{ + r.descsByName = map[protoreflect.FullName]any{ "": &packageDescriptor{}, } r.filesByPath = make(map[string][]protoreflect.FileDescriptor) @@ -485,7 +485,7 @@ type Types struct { } type ( - typesByName map[protoreflect.FullName]interface{} + typesByName map[protoreflect.FullName]any extensionsByMessage map[protoreflect.FullName]extensionsByNumber extensionsByNumber map[protoreflect.FieldNumber]protoreflect.ExtensionType ) @@ -570,7 +570,7 @@ func (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error { return nil } -func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interface{}) error { +func (r *Types) register(kind string, desc protoreflect.Descriptor, typ any) error { name := desc.FullName() prev := r.typesByName[name] if prev != nil { @@ -841,7 +841,7 @@ func (r *Types) RangeExtensionsByMessage(message protoreflect.FullName, f func(p } } -func typeName(t interface{}) string { +func typeName(t any) string { switch t.(type) { case protoreflect.EnumType: return "enum" @@ -854,7 +854,7 @@ func typeName(t interface{}) string { } } -func amendErrorWithCaller(err error, prev, curr interface{}) error { +func amendErrorWithCaller(err error, prev, curr any) error { prevPkg := goPackage(prev) currPkg := goPackage(curr) if prevPkg == "" || currPkg == "" || prevPkg == currPkg { @@ -863,7 +863,7 @@ func amendErrorWithCaller(err error, prev, curr interface{}) error { return errors.New("%s\n\tpreviously from: %q\n\tcurrently from: %q", err, prevPkg, currPkg) } -func goPackage(v interface{}) string { +func goPackage(v any) string { switch d := v.(type) { case protoreflect.EnumType: v = d.Descriptor() diff --git a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go b/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go index 44cf467d8..246156561 100644 --- a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go +++ b/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go @@ -39,6 +39,9 @@ type Methods = struct { // CheckInitialized returns an error if any required fields in the message are not set. CheckInitialized func(CheckInitializedInput) (CheckInitializedOutput, error) + + // Equal compares two messages and returns EqualOutput.Equal == true if they are equal. + Equal func(EqualInput) EqualOutput } // SupportFlags indicate support for optional features. @@ -166,3 +169,18 @@ type CheckInitializedInput = struct { type CheckInitializedOutput = struct { pragma.NoUnkeyedLiterals } + +// EqualInput is input to the Equal method. +type EqualInput = struct { + pragma.NoUnkeyedLiterals + + MessageA protoreflect.Message + MessageB protoreflect.Message +} + +// EqualOutput is output from the Equal method. +type EqualOutput = struct { + pragma.NoUnkeyedLiterals + + Equal bool +} diff --git a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go index 78624cf60..6dea75cd5 100644 --- a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +++ b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go @@ -54,6 +54,9 @@ type Edition int32 const ( // A placeholder for an unknown edition value. Edition_EDITION_UNKNOWN Edition = 0 + // A placeholder edition for specifying default behaviors *before* a feature + // was first introduced. This is effectively an "infinite past". + Edition_EDITION_LEGACY Edition = 900 // Legacy syntax "editions". These pre-date editions, but behave much like // distinct editions. These can't be used to specify the edition of proto // files, but feature definitions must supply proto2/proto3 defaults for @@ -82,6 +85,7 @@ const ( var ( Edition_name = map[int32]string{ 0: "EDITION_UNKNOWN", + 900: "EDITION_LEGACY", 998: "EDITION_PROTO2", 999: "EDITION_PROTO3", 1000: "EDITION_2023", @@ -95,6 +99,7 @@ var ( } Edition_value = map[string]int32{ "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -1212,11 +1217,9 @@ type FileDescriptorSet struct { func (x *FileDescriptorSet) Reset() { *x = FileDescriptorSet{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileDescriptorSet) String() string { @@ -1227,7 +1230,7 @@ func (*FileDescriptorSet) ProtoMessage() {} func (x *FileDescriptorSet) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1286,11 +1289,9 @@ type FileDescriptorProto struct { func (x *FileDescriptorProto) Reset() { *x = FileDescriptorProto{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileDescriptorProto) String() string { @@ -1301,7 +1302,7 @@ func (*FileDescriptorProto) ProtoMessage() {} func (x *FileDescriptorProto) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1429,11 +1430,9 @@ type DescriptorProto struct { func (x *DescriptorProto) Reset() { *x = DescriptorProto{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DescriptorProto) String() string { @@ -1444,7 +1443,7 @@ func (*DescriptorProto) ProtoMessage() {} func (x *DescriptorProto) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1556,11 +1555,9 @@ const ( func (x *ExtensionRangeOptions) Reset() { *x = ExtensionRangeOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ExtensionRangeOptions) String() string { @@ -1571,7 +1568,7 @@ func (*ExtensionRangeOptions) ProtoMessage() {} func (x *ExtensionRangeOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1675,11 +1672,9 @@ type FieldDescriptorProto struct { func (x *FieldDescriptorProto) Reset() { *x = FieldDescriptorProto{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FieldDescriptorProto) String() string { @@ -1690,7 +1685,7 @@ func (*FieldDescriptorProto) ProtoMessage() {} func (x *FieldDescriptorProto) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1794,11 +1789,9 @@ type OneofDescriptorProto struct { func (x *OneofDescriptorProto) Reset() { *x = OneofDescriptorProto{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OneofDescriptorProto) String() string { @@ -1809,7 +1802,7 @@ func (*OneofDescriptorProto) ProtoMessage() {} func (x *OneofDescriptorProto) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1858,11 +1851,9 @@ type EnumDescriptorProto struct { func (x *EnumDescriptorProto) Reset() { *x = EnumDescriptorProto{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnumDescriptorProto) String() string { @@ -1873,7 +1864,7 @@ func (*EnumDescriptorProto) ProtoMessage() {} func (x *EnumDescriptorProto) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1936,11 +1927,9 @@ type EnumValueDescriptorProto struct { func (x *EnumValueDescriptorProto) Reset() { *x = EnumValueDescriptorProto{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnumValueDescriptorProto) String() string { @@ -1951,7 +1940,7 @@ func (*EnumValueDescriptorProto) ProtoMessage() {} func (x *EnumValueDescriptorProto) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2000,11 +1989,9 @@ type ServiceDescriptorProto struct { func (x *ServiceDescriptorProto) Reset() { *x = ServiceDescriptorProto{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ServiceDescriptorProto) String() string { @@ -2015,7 +2002,7 @@ func (*ServiceDescriptorProto) ProtoMessage() {} func (x *ServiceDescriptorProto) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2077,11 +2064,9 @@ const ( func (x *MethodDescriptorProto) Reset() { *x = MethodDescriptorProto{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MethodDescriptorProto) String() string { @@ -2092,7 +2077,7 @@ func (*MethodDescriptorProto) ProtoMessage() {} func (x *MethodDescriptorProto) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2177,12 +2162,16 @@ type FileOptions struct { // // Deprecated: Marked as deprecated in google/protobuf/descriptor.proto. JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. + // A proto2 file can set this to true to opt in to UTF-8 checking for Java, + // which will throw an exception if invalid UTF-8 is parsed from the wire or + // assigned to a string field. + // + // TODO: clarify exactly what kinds of field types this option + // applies to, and update these docs accordingly. + // + // Proto3 files already perform these checks. Setting the option explicitly to + // false has no effect: it cannot be used to opt proto3 files out of UTF-8 + // checks. JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` // Sets the Go package where structs generated from this .proto will be @@ -2258,11 +2247,9 @@ const ( func (x *FileOptions) Reset() { *x = FileOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileOptions) String() string { @@ -2273,7 +2260,7 @@ func (*FileOptions) ProtoMessage() {} func (x *FileOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2525,11 +2512,9 @@ const ( func (x *MessageOptions) Reset() { *x = MessageOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MessageOptions) String() string { @@ -2540,7 +2525,7 @@ func (*MessageOptions) ProtoMessage() {} func (x *MessageOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2679,7 +2664,8 @@ type FieldOptions struct { Targets []FieldOptions_OptionTargetType `protobuf:"varint,19,rep,name=targets,enum=google.protobuf.FieldOptions_OptionTargetType" json:"targets,omitempty"` EditionDefaults []*FieldOptions_EditionDefault `protobuf:"bytes,20,rep,name=edition_defaults,json=editionDefaults" json:"edition_defaults,omitempty"` // Any features defined in the specific edition. - Features *FeatureSet `protobuf:"bytes,21,opt,name=features" json:"features,omitempty"` + Features *FeatureSet `protobuf:"bytes,21,opt,name=features" json:"features,omitempty"` + FeatureSupport *FieldOptions_FeatureSupport `protobuf:"bytes,22,opt,name=feature_support,json=featureSupport" json:"feature_support,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -2697,11 +2683,9 @@ const ( func (x *FieldOptions) Reset() { *x = FieldOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FieldOptions) String() string { @@ -2712,7 +2696,7 @@ func (*FieldOptions) ProtoMessage() {} func (x *FieldOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2811,6 +2795,13 @@ func (x *FieldOptions) GetFeatures() *FeatureSet { return nil } +func (x *FieldOptions) GetFeatureSupport() *FieldOptions_FeatureSupport { + if x != nil { + return x.FeatureSupport + } + return nil +} + func (x *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2832,11 +2823,9 @@ type OneofOptions struct { func (x *OneofOptions) Reset() { *x = OneofOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *OneofOptions) String() string { @@ -2847,7 +2836,7 @@ func (*OneofOptions) ProtoMessage() {} func (x *OneofOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2912,11 +2901,9 @@ const ( func (x *EnumOptions) Reset() { *x = EnumOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnumOptions) String() string { @@ -2927,7 +2914,7 @@ func (*EnumOptions) ProtoMessage() {} func (x *EnumOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -2995,6 +2982,8 @@ type EnumValueOptions struct { // out when using debug formats, e.g. when the field contains sensitive // credentials. DebugRedact *bool `protobuf:"varint,3,opt,name=debug_redact,json=debugRedact,def=0" json:"debug_redact,omitempty"` + // Information about the support window of a feature value. + FeatureSupport *FieldOptions_FeatureSupport `protobuf:"bytes,4,opt,name=feature_support,json=featureSupport" json:"feature_support,omitempty"` // The parser stores options it doesn't recognize here. See above. UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` } @@ -3007,11 +2996,9 @@ const ( func (x *EnumValueOptions) Reset() { *x = EnumValueOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnumValueOptions) String() string { @@ -3022,7 +3009,7 @@ func (*EnumValueOptions) ProtoMessage() {} func (x *EnumValueOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3058,6 +3045,13 @@ func (x *EnumValueOptions) GetDebugRedact() bool { return Default_EnumValueOptions_DebugRedact } +func (x *EnumValueOptions) GetFeatureSupport() *FieldOptions_FeatureSupport { + if x != nil { + return x.FeatureSupport + } + return nil +} + func (x *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -3089,11 +3083,9 @@ const ( func (x *ServiceOptions) Reset() { *x = ServiceOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ServiceOptions) String() string { @@ -3104,7 +3096,7 @@ func (*ServiceOptions) ProtoMessage() {} func (x *ServiceOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3166,11 +3158,9 @@ const ( func (x *MethodOptions) Reset() { *x = MethodOptions{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MethodOptions) String() string { @@ -3181,7 +3171,7 @@ func (*MethodOptions) ProtoMessage() {} func (x *MethodOptions) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3248,11 +3238,9 @@ type UninterpretedOption struct { func (x *UninterpretedOption) Reset() { *x = UninterpretedOption{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UninterpretedOption) String() string { @@ -3263,7 +3251,7 @@ func (*UninterpretedOption) ProtoMessage() {} func (x *UninterpretedOption) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3349,11 +3337,9 @@ type FeatureSet struct { func (x *FeatureSet) Reset() { *x = FeatureSet{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FeatureSet) String() string { @@ -3364,7 +3350,7 @@ func (*FeatureSet) ProtoMessage() {} func (x *FeatureSet) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3441,11 +3427,9 @@ type FeatureSetDefaults struct { func (x *FeatureSetDefaults) Reset() { *x = FeatureSetDefaults{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FeatureSetDefaults) String() string { @@ -3456,7 +3440,7 @@ func (*FeatureSetDefaults) ProtoMessage() {} func (x *FeatureSetDefaults) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3552,11 +3536,9 @@ type SourceCodeInfo struct { func (x *SourceCodeInfo) Reset() { *x = SourceCodeInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SourceCodeInfo) String() string { @@ -3567,7 +3549,7 @@ func (*SourceCodeInfo) ProtoMessage() {} func (x *SourceCodeInfo) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3604,11 +3586,9 @@ type GeneratedCodeInfo struct { func (x *GeneratedCodeInfo) Reset() { *x = GeneratedCodeInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GeneratedCodeInfo) String() string { @@ -3619,7 +3599,7 @@ func (*GeneratedCodeInfo) ProtoMessage() {} func (x *GeneratedCodeInfo) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3653,11 +3633,9 @@ type DescriptorProto_ExtensionRange struct { func (x *DescriptorProto_ExtensionRange) Reset() { *x = DescriptorProto_ExtensionRange{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DescriptorProto_ExtensionRange) String() string { @@ -3668,7 +3646,7 @@ func (*DescriptorProto_ExtensionRange) ProtoMessage() {} func (x *DescriptorProto_ExtensionRange) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3718,11 +3696,9 @@ type DescriptorProto_ReservedRange struct { func (x *DescriptorProto_ReservedRange) Reset() { *x = DescriptorProto_ReservedRange{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DescriptorProto_ReservedRange) String() string { @@ -3733,7 +3709,7 @@ func (*DescriptorProto_ReservedRange) ProtoMessage() {} func (x *DescriptorProto_ReservedRange) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3787,11 +3763,9 @@ type ExtensionRangeOptions_Declaration struct { func (x *ExtensionRangeOptions_Declaration) Reset() { *x = ExtensionRangeOptions_Declaration{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ExtensionRangeOptions_Declaration) String() string { @@ -3802,7 +3776,7 @@ func (*ExtensionRangeOptions_Declaration) ProtoMessage() {} func (x *ExtensionRangeOptions_Declaration) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3869,11 +3843,9 @@ type EnumDescriptorProto_EnumReservedRange struct { func (x *EnumDescriptorProto_EnumReservedRange) Reset() { *x = EnumDescriptorProto_EnumReservedRange{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnumDescriptorProto_EnumReservedRange) String() string { @@ -3884,7 +3856,7 @@ func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} func (x *EnumDescriptorProto_EnumReservedRange) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3924,11 +3896,9 @@ type FieldOptions_EditionDefault struct { func (x *FieldOptions_EditionDefault) Reset() { *x = FieldOptions_EditionDefault{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FieldOptions_EditionDefault) String() string { @@ -3939,7 +3909,7 @@ func (*FieldOptions_EditionDefault) ProtoMessage() {} func (x *FieldOptions_EditionDefault) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_descriptor_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -3968,6 +3938,86 @@ func (x *FieldOptions_EditionDefault) GetValue() string { return "" } +// Information about the support window of a feature. +type FieldOptions_FeatureSupport struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The edition that this feature was first available in. In editions + // earlier than this one, the default assigned to EDITION_LEGACY will be + // used, and proto files will not be able to override it. + EditionIntroduced *Edition `protobuf:"varint,1,opt,name=edition_introduced,json=editionIntroduced,enum=google.protobuf.Edition" json:"edition_introduced,omitempty"` + // The edition this feature becomes deprecated in. Using this after this + // edition may trigger warnings. + EditionDeprecated *Edition `protobuf:"varint,2,opt,name=edition_deprecated,json=editionDeprecated,enum=google.protobuf.Edition" json:"edition_deprecated,omitempty"` + // The deprecation warning text if this feature is used after the edition it + // was marked deprecated in. + DeprecationWarning *string `protobuf:"bytes,3,opt,name=deprecation_warning,json=deprecationWarning" json:"deprecation_warning,omitempty"` + // The edition this feature is no longer available in. In editions after + // this one, the last default assigned will be used, and proto files will + // not be able to override it. + EditionRemoved *Edition `protobuf:"varint,4,opt,name=edition_removed,json=editionRemoved,enum=google.protobuf.Edition" json:"edition_removed,omitempty"` +} + +func (x *FieldOptions_FeatureSupport) Reset() { + *x = FieldOptions_FeatureSupport{} + mi := &file_google_protobuf_descriptor_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FieldOptions_FeatureSupport) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldOptions_FeatureSupport) ProtoMessage() {} + +func (x *FieldOptions_FeatureSupport) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldOptions_FeatureSupport.ProtoReflect.Descriptor instead. +func (*FieldOptions_FeatureSupport) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 1} +} + +func (x *FieldOptions_FeatureSupport) GetEditionIntroduced() Edition { + if x != nil && x.EditionIntroduced != nil { + return *x.EditionIntroduced + } + return Edition_EDITION_UNKNOWN +} + +func (x *FieldOptions_FeatureSupport) GetEditionDeprecated() Edition { + if x != nil && x.EditionDeprecated != nil { + return *x.EditionDeprecated + } + return Edition_EDITION_UNKNOWN +} + +func (x *FieldOptions_FeatureSupport) GetDeprecationWarning() string { + if x != nil && x.DeprecationWarning != nil { + return *x.DeprecationWarning + } + return "" +} + +func (x *FieldOptions_FeatureSupport) GetEditionRemoved() Edition { + if x != nil && x.EditionRemoved != nil { + return *x.EditionRemoved + } + return Edition_EDITION_UNKNOWN +} + // The name of the uninterpreted option. Each string represents a segment in // a dot-separated name. is_extension is true iff a segment represents an // extension (denoted with parentheses in options specs in .proto files). @@ -3984,11 +4034,9 @@ type UninterpretedOption_NamePart struct { func (x *UninterpretedOption_NamePart) Reset() { *x = UninterpretedOption_NamePart{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UninterpretedOption_NamePart) String() string { @@ -3998,8 +4046,8 @@ func (x *UninterpretedOption_NamePart) String() string { func (*UninterpretedOption_NamePart) ProtoMessage() {} func (x *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_google_protobuf_descriptor_proto_msgTypes[29] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -4037,17 +4085,18 @@ type FeatureSetDefaults_FeatureSetEditionDefault struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` - Features *FeatureSet `protobuf:"bytes,2,opt,name=features" json:"features,omitempty"` + Edition *Edition `protobuf:"varint,3,opt,name=edition,enum=google.protobuf.Edition" json:"edition,omitempty"` + // Defaults of features that can be overridden in this edition. + OverridableFeatures *FeatureSet `protobuf:"bytes,4,opt,name=overridable_features,json=overridableFeatures" json:"overridable_features,omitempty"` + // Defaults of features that can't be overridden in this edition. + FixedFeatures *FeatureSet `protobuf:"bytes,5,opt,name=fixed_features,json=fixedFeatures" json:"fixed_features,omitempty"` } func (x *FeatureSetDefaults_FeatureSetEditionDefault) Reset() { *x = FeatureSetDefaults_FeatureSetEditionDefault{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FeatureSetDefaults_FeatureSetEditionDefault) String() string { @@ -4057,8 +4106,8 @@ func (x *FeatureSetDefaults_FeatureSetEditionDefault) String() string { func (*FeatureSetDefaults_FeatureSetEditionDefault) ProtoMessage() {} func (x *FeatureSetDefaults_FeatureSetEditionDefault) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_google_protobuf_descriptor_proto_msgTypes[30] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -4080,9 +4129,16 @@ func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetEdition() Edition { return Edition_EDITION_UNKNOWN } -func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetFeatures() *FeatureSet { +func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetOverridableFeatures() *FeatureSet { if x != nil { - return x.Features + return x.OverridableFeatures + } + return nil +} + +func (x *FeatureSetDefaults_FeatureSetEditionDefault) GetFixedFeatures() *FeatureSet { + if x != nil { + return x.FixedFeatures } return nil } @@ -4187,11 +4243,9 @@ type SourceCodeInfo_Location struct { func (x *SourceCodeInfo_Location) Reset() { *x = SourceCodeInfo_Location{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SourceCodeInfo_Location) String() string { @@ -4201,8 +4255,8 @@ func (x *SourceCodeInfo_Location) String() string { func (*SourceCodeInfo_Location) ProtoMessage() {} func (x *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_google_protobuf_descriptor_proto_msgTypes[31] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -4274,11 +4328,9 @@ type GeneratedCodeInfo_Annotation struct { func (x *GeneratedCodeInfo_Annotation) Reset() { *x = GeneratedCodeInfo_Annotation{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_descriptor_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_descriptor_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GeneratedCodeInfo_Annotation) String() string { @@ -4288,8 +4340,8 @@ func (x *GeneratedCodeInfo_Annotation) String() string { func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} func (x *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message { - mi := &file_google_protobuf_descriptor_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_google_protobuf_descriptor_proto_msgTypes[32] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -4597,7 +4649,7 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x67, 0x12, 0x30, 0x0a, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x69, 0x6e, 0x67, 0x22, 0x97, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x69, 0x6e, 0x67, 0x22, 0xad, 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, @@ -4670,405 +4722,445 @@ var file_google_protobuf_descriptor_proto_rawDesc = []byte{ 0x45, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, - 0x02, 0x4a, 0x04, 0x08, 0x2a, 0x10, 0x2b, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x22, 0xf4, 0x03, - 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, - 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, - 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, - 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a, - 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, - 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, - 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, - 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, - 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, - 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, - 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, - 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, - 0x08, 0x09, 0x10, 0x0a, 0x22, 0xad, 0x0a, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, - 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, - 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, - 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, - 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, - 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, - 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, - 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, - 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, - 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, - 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, - 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, - 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2e, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x57, 0x0a, 0x10, 0x65, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, - 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, - 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, - 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, - 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x1a, 0x5a, 0x0a, 0x0e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, - 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, - 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, - 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, - 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, - 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, - 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a, 0x0f, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, - 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, - 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x45, 0x54, 0x45, - 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10, 0x02, 0x22, 0x8c, - 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, - 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, - 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47, - 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, - 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, - 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, - 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x06, - 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13, - 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, - 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x10, 0x09, 0x2a, 0x09, 0x08, - 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, - 0x08, 0x12, 0x10, 0x13, 0x22, 0xac, 0x01, 0x0a, 0x0c, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, - 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, - 0x80, 0x80, 0x02, 0x22, 0xd1, 0x02, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, - 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, - 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, - 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x56, 0x0a, 0x26, 0x64, - 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, - 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, - 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, - 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, - 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, - 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, + 0x02, 0x4a, 0x04, 0x08, 0x2a, 0x10, 0x2b, 0x4a, 0x04, 0x08, 0x26, 0x10, 0x27, 0x52, 0x14, 0x70, + 0x68, 0x70, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x22, 0xf4, 0x03, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, + 0x61, 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, + 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, + 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, + 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, + 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, - 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x81, 0x02, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, - 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, - 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0c, - 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, + 0x10, 0x05, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x4a, 0x04, + 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x9d, 0x0d, 0x0a, 0x0c, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, + 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x70, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, + 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x19, 0x0a, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x2e, 0x0a, 0x0f, 0x75, 0x6e, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x7a, 0x79, 0x18, 0x0f, 0x20, + 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0e, 0x75, 0x6e, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x4c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, + 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x19, 0x0a, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, + 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x28, 0x0a, 0x0c, + 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, - 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x74, 0x65, 0x6e, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x13, + 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x57, 0x0a, + 0x10, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, + 0x55, 0x0a, 0x0f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, + 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, + 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd5, 0x01, 0x0a, 0x0e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, - 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, - 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, - 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x1a, 0x5a, 0x0a, 0x0e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, + 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x96, 0x02, 0x0a, + 0x0e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x12, + 0x47, 0x0a, 0x12, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, + 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x47, 0x0a, 0x12, 0x65, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, + 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x2f, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, + 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x61, 0x72, 0x6e, 0x69, + 0x6e, 0x67, 0x12, 0x41, 0x0a, 0x0f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, + 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, + 0x52, 0x44, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, + 0x49, 0x45, 0x43, 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, + 0x0d, 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, + 0x0a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x22, 0x55, 0x0a, + 0x0f, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x74, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x54, 0x45, 0x4e, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, + 0x0a, 0x10, 0x52, 0x45, 0x54, 0x45, 0x4e, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, + 0x43, 0x45, 0x10, 0x02, 0x22, 0x8c, 0x02, 0x0a, 0x10, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, + 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x54, 0x41, 0x52, 0x47, + 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x53, 0x49, 0x4f, + 0x4e, 0x5f, 0x52, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, + 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, + 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, + 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x4e, 0x45, 0x4f, 0x46, 0x10, 0x05, + 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x06, 0x12, 0x1a, 0x0a, 0x16, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x45, 0x4e, 0x54, 0x52, 0x59, + 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x54, + 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, + 0x44, 0x10, 0x09, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, + 0x08, 0x04, 0x10, 0x05, 0x4a, 0x04, 0x08, 0x12, 0x10, 0x13, 0x22, 0xac, 0x01, 0x0a, 0x0c, 0x4f, + 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, - 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, - 0x80, 0x80, 0x02, 0x22, 0x99, 0x03, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, - 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, - 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, - 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, - 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, - 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, - 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, - 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, - 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x23, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, - 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, - 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, - 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, - 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, - 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, - 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, - 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, - 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, - 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, - 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, - 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, - 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, - 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, - 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, - 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8c, 0x0a, 0x0a, - 0x0a, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x12, 0x8b, 0x01, 0x0a, 0x0e, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, - 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x42, - 0x39, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, - 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x49, - 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe7, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, - 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x18, 0xe8, 0x07, 0x52, 0x0d, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x66, 0x0a, 0x09, 0x65, 0x6e, 0x75, - 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, + 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, + 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, + 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd1, 0x02, 0x0a, 0x0b, 0x45, 0x6e, + 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, + 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x12, 0x56, 0x0a, 0x26, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x43, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, + 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, + 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, + 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xd8, 0x02, + 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x5f, 0x72, 0x65, 0x64, 0x61, + 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, + 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x64, 0x61, 0x63, 0x74, 0x12, 0x55, 0x0a, 0x0f, + 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, + 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0xd5, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x66, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, + 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, + 0x22, 0x99, 0x03, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, 0x69, 0x64, 0x65, + 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x22, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, + 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, + 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, 0x64, 0x65, 0x6d, + 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x37, 0x0a, 0x08, + 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, + 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, + 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, + 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, + 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, + 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, + 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, + 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, + 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, + 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, + 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, + 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, + 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x0a, 0x0a, 0x0a, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x12, 0x91, 0x01, 0x0a, 0x0e, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x3f, 0x88, 0x01, + 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x4c, + 0x49, 0x43, 0x49, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x49, 0x4d, 0x50, 0x4c, + 0x49, 0x43, 0x49, 0x54, 0x18, 0xe7, 0x07, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x4c, + 0x49, 0x43, 0x49, 0x54, 0x18, 0xe8, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0d, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x09, + 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x54, 0x79, 0x70, 0x65, 0x42, 0x29, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, + 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01, + 0x09, 0x12, 0x04, 0x4f, 0x50, 0x45, 0x4e, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, + 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x17, 0x72, + 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x6e, + 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x54, 0x79, - 0x70, 0x65, 0x42, 0x23, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0b, - 0x12, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x09, 0x12, 0x04, - 0x4f, 0x50, 0x45, 0x4e, 0x18, 0xe7, 0x07, 0x52, 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x92, 0x01, 0x0a, 0x17, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, - 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, - 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x27, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, - 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x18, 0xe6, - 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x18, 0xe7, 0x07, 0x52, - 0x15, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, - 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x78, 0x0a, 0x0f, 0x75, 0x74, 0x66, 0x38, 0x5f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x55, 0x74, 0x66, - 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x23, 0x88, 0x01, 0x01, - 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x18, - 0xe6, 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x18, 0xe7, 0x07, - 0x52, 0x0e, 0x75, 0x74, 0x66, 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x78, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x65, 0x6e, 0x63, 0x6f, - 0x64, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, - 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x20, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, - 0x01, 0x01, 0xa2, 0x01, 0x14, 0x12, 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x50, 0x52, - 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x18, 0xe6, 0x07, 0x52, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x7c, 0x0a, 0x0b, 0x6a, 0x73, - 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4a, 0x73, 0x6f, - 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x42, 0x33, 0x88, 0x01, 0x01, 0x98, 0x01, 0x03, 0x98, - 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x17, 0x12, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, - 0x5f, 0x42, 0x45, 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x18, 0xe6, 0x07, 0xa2, - 0x01, 0x0a, 0x12, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x18, 0xe7, 0x07, 0x52, 0x0a, 0x6a, 0x73, - 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x5c, 0x0a, 0x0d, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x46, 0x49, 0x45, - 0x4c, 0x44, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, - 0x54, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10, - 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x52, 0x45, 0x51, 0x55, - 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x22, 0x37, 0x0a, 0x08, 0x45, 0x6e, 0x75, 0x6d, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x50, 0x45, - 0x4e, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, 0x02, 0x22, - 0x56, 0x0a, 0x15, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, 0x50, 0x45, - 0x41, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, - 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, - 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, - 0x41, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x02, 0x22, 0x43, 0x0a, 0x0e, 0x55, 0x74, 0x66, 0x38, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x55, 0x54, 0x46, - 0x38, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, - 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x22, 0x53, 0x0a, 0x0f, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, - 0x1c, 0x0a, 0x18, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, - 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, - 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, - 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, - 0x02, 0x22, 0x48, 0x0a, 0x0a, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, - 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, - 0x57, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, - 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x10, 0x02, 0x2a, 0x06, 0x08, 0xe8, 0x07, - 0x10, 0xe9, 0x07, 0x2a, 0x06, 0x08, 0xe9, 0x07, 0x10, 0xea, 0x07, 0x2a, 0x06, 0x08, 0xea, 0x07, - 0x10, 0xeb, 0x07, 0x2a, 0x06, 0x08, 0x8b, 0x4e, 0x10, 0x90, 0x4e, 0x2a, 0x06, 0x08, 0x90, 0x4e, - 0x10, 0x91, 0x4e, 0x4a, 0x06, 0x08, 0xe7, 0x07, 0x10, 0xe8, 0x07, 0x22, 0xfe, 0x02, 0x0a, 0x12, - 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x73, 0x12, 0x58, 0x0a, 0x08, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, - 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x52, 0x08, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x41, 0x0a, 0x0f, - 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x41, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x1a, 0x87, 0x01, 0x0a, 0x18, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, - 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, - 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x65, 0x74, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0xa7, 0x02, 0x0a, - 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, - 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, - 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, - 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, - 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, - 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, - 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, - 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, - 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd0, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xeb, 0x01, 0x0a, 0x0a, - 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, - 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x08, 0x73, - 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, + 0x2d, 0x88, 0x01, 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x0d, 0x12, 0x08, 0x45, + 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x44, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x15, + 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x45, 0x6e, 0x63, + 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x7e, 0x0a, 0x0f, 0x75, 0x74, 0x66, 0x38, 0x5f, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x55, 0x74, 0x66, 0x38, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x29, 0x88, 0x01, 0x01, 0x98, + 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x18, 0xe6, + 0x07, 0xa2, 0x01, 0x0b, 0x12, 0x06, 0x56, 0x45, 0x52, 0x49, 0x46, 0x59, 0x18, 0xe7, 0x07, 0xb2, + 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0e, 0x75, 0x74, 0x66, 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x7e, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x42, 0x26, 0x88, 0x01, + 0x01, 0x98, 0x01, 0x04, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x14, 0x12, 0x0f, 0x4c, 0x45, 0x4e, 0x47, + 0x54, 0x48, 0x5f, 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x18, 0xe6, 0x07, 0xb2, 0x01, + 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x63, + 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x82, 0x01, 0x0a, 0x0b, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x2e, 0x4a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x42, 0x39, 0x88, 0x01, 0x01, 0x98, 0x01, 0x03, 0x98, 0x01, 0x06, 0x98, 0x01, + 0x01, 0xa2, 0x01, 0x17, 0x12, 0x12, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, 0x53, + 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, 0x54, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, + 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x18, 0xe7, 0x07, 0xb2, 0x01, 0x03, 0x08, 0xe8, 0x07, 0x52, 0x0a, + 0x6a, 0x73, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x5c, 0x0a, 0x0d, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x46, + 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x43, 0x45, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, + 0x43, 0x49, 0x54, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x43, 0x49, + 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x52, 0x45, + 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x03, 0x22, 0x37, 0x0a, 0x08, 0x45, 0x6e, 0x75, 0x6d, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4f, + 0x50, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0x10, + 0x02, 0x22, 0x56, 0x0a, 0x15, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, + 0x50, 0x45, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x49, 0x45, 0x4c, 0x44, 0x5f, 0x45, 0x4e, 0x43, + 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x0a, 0x0a, 0x06, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45, + 0x58, 0x50, 0x41, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x02, 0x22, 0x49, 0x0a, 0x0e, 0x55, 0x74, 0x66, + 0x38, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x55, + 0x54, 0x46, 0x38, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x52, 0x49, + 0x46, 0x59, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x03, 0x22, 0x04, + 0x08, 0x01, 0x10, 0x01, 0x22, 0x53, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, + 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x18, 0x4d, 0x45, 0x53, 0x53, 0x41, + 0x47, 0x45, 0x5f, 0x45, 0x4e, 0x43, 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, + 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x45, 0x4e, 0x47, 0x54, 0x48, 0x5f, + 0x50, 0x52, 0x45, 0x46, 0x49, 0x58, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x45, + 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, 0x02, 0x22, 0x48, 0x0a, 0x0a, 0x4a, 0x73, 0x6f, + 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, + 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, + 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4c, + 0x45, 0x47, 0x41, 0x43, 0x59, 0x5f, 0x42, 0x45, 0x53, 0x54, 0x5f, 0x45, 0x46, 0x46, 0x4f, 0x52, + 0x54, 0x10, 0x02, 0x2a, 0x06, 0x08, 0xe8, 0x07, 0x10, 0x8b, 0x4e, 0x2a, 0x06, 0x08, 0x8b, 0x4e, + 0x10, 0x90, 0x4e, 0x2a, 0x06, 0x08, 0x90, 0x4e, 0x10, 0x91, 0x4e, 0x4a, 0x06, 0x08, 0xe7, 0x07, + 0x10, 0xe8, 0x07, 0x22, 0xef, 0x03, 0x0a, 0x12, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, + 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x08, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x73, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x08, 0x64, 0x65, 0x66, 0x61, + 0x75, 0x6c, 0x74, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x5f, + 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6d, - 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x22, - 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x12, 0x08, 0x0a, 0x04, 0x4e, - 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, - 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53, 0x10, 0x02, 0x2a, 0x92, 0x02, 0x0a, 0x07, 0x45, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, - 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0xe6, 0x07, 0x12, - 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, - 0x33, 0x10, 0xe7, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x32, 0x30, 0x32, 0x33, 0x10, 0xe8, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x32, 0x30, 0x32, 0x34, 0x10, 0xe9, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, - 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x31, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, - 0x59, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, - 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x17, - 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x37, 0x5f, 0x54, 0x45, - 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9d, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, - 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x38, 0x5f, 0x54, 0x45, 0x53, - 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9e, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, - 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x5f, 0x54, 0x45, 0x53, 0x54, - 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9f, 0x8d, 0x06, 0x12, 0x13, 0x0a, 0x0b, 0x45, 0x44, 0x49, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x58, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x42, 0x7e, - 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, - 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, + 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x69, 0x6d, + 0x75, 0x6d, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x69, + 0x6d, 0x75, 0x6d, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xf8, 0x01, 0x0a, 0x18, 0x46, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x14, 0x6f, + 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x52, 0x13, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x61, + 0x62, 0x6c, 0x65, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x0e, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, + 0x52, 0x0d, 0x66, 0x69, 0x78, 0x65, 0x64, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x4a, + 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x08, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, + 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, + 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, + 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, + 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, + 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, + 0xd0, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xeb, 0x01, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, + 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x65, 0x6e, 0x64, 0x12, 0x52, 0x0a, 0x08, 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x52, 0x08, + 0x73, 0x65, 0x6d, 0x61, 0x6e, 0x74, 0x69, 0x63, 0x22, 0x28, 0x0a, 0x08, 0x53, 0x65, 0x6d, 0x61, + 0x6e, 0x74, 0x69, 0x63, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, + 0x0a, 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x49, 0x41, 0x53, + 0x10, 0x02, 0x2a, 0xa7, 0x02, 0x0a, 0x07, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x13, + 0x0a, 0x0f, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4c, + 0x45, 0x47, 0x41, 0x43, 0x59, 0x10, 0x84, 0x07, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x44, 0x49, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0xe6, 0x07, 0x12, 0x13, 0x0a, + 0x0e, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x10, + 0xe7, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x30, + 0x32, 0x33, 0x10, 0xe8, 0x07, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x32, 0x30, 0x32, 0x34, 0x10, 0xe9, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x31, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, + 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x32, 0x5f, 0x54, + 0x45, 0x53, 0x54, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x37, 0x5f, 0x54, 0x45, 0x53, 0x54, + 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9d, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x38, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, + 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x9e, 0x8d, 0x06, 0x12, 0x1d, 0x0a, 0x17, 0x45, 0x44, 0x49, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x5f, 0x4f, + 0x4e, 0x4c, 0x59, 0x10, 0x9f, 0x8d, 0x06, 0x12, 0x13, 0x0a, 0x0b, 0x45, 0x44, 0x49, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x4d, 0x41, 0x58, 0x10, 0xff, 0xff, 0xff, 0xff, 0x07, 0x42, 0x7e, 0x0a, 0x13, + 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, + 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, } var ( @@ -5084,8 +5176,8 @@ func file_google_protobuf_descriptor_proto_rawDescGZIP() []byte { } var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 17) -var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 32) -var file_google_protobuf_descriptor_proto_goTypes = []interface{}{ +var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_google_protobuf_descriptor_proto_goTypes = []any{ (Edition)(0), // 0: google.protobuf.Edition (ExtensionRangeOptions_VerificationState)(0), // 1: google.protobuf.ExtensionRangeOptions.VerificationState (FieldDescriptorProto_Type)(0), // 2: google.protobuf.FieldDescriptorProto.Type @@ -5131,10 +5223,11 @@ var file_google_protobuf_descriptor_proto_goTypes = []interface{}{ (*ExtensionRangeOptions_Declaration)(nil), // 42: google.protobuf.ExtensionRangeOptions.Declaration (*EnumDescriptorProto_EnumReservedRange)(nil), // 43: google.protobuf.EnumDescriptorProto.EnumReservedRange (*FieldOptions_EditionDefault)(nil), // 44: google.protobuf.FieldOptions.EditionDefault - (*UninterpretedOption_NamePart)(nil), // 45: google.protobuf.UninterpretedOption.NamePart - (*FeatureSetDefaults_FeatureSetEditionDefault)(nil), // 46: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - (*SourceCodeInfo_Location)(nil), // 47: google.protobuf.SourceCodeInfo.Location - (*GeneratedCodeInfo_Annotation)(nil), // 48: google.protobuf.GeneratedCodeInfo.Annotation + (*FieldOptions_FeatureSupport)(nil), // 45: google.protobuf.FieldOptions.FeatureSupport + (*UninterpretedOption_NamePart)(nil), // 46: google.protobuf.UninterpretedOption.NamePart + (*FeatureSetDefaults_FeatureSetEditionDefault)(nil), // 47: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + (*SourceCodeInfo_Location)(nil), // 48: google.protobuf.SourceCodeInfo.Location + (*GeneratedCodeInfo_Annotation)(nil), // 49: google.protobuf.GeneratedCodeInfo.Annotation } var file_google_protobuf_descriptor_proto_depIdxs = []int32{ 18, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto @@ -5179,40 +5272,46 @@ var file_google_protobuf_descriptor_proto_depIdxs = []int32{ 8, // 39: google.protobuf.FieldOptions.targets:type_name -> google.protobuf.FieldOptions.OptionTargetType 44, // 40: google.protobuf.FieldOptions.edition_defaults:type_name -> google.protobuf.FieldOptions.EditionDefault 36, // 41: google.protobuf.FieldOptions.features:type_name -> google.protobuf.FeatureSet - 35, // 42: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 36, // 43: google.protobuf.OneofOptions.features:type_name -> google.protobuf.FeatureSet - 35, // 44: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 36, // 45: google.protobuf.EnumOptions.features:type_name -> google.protobuf.FeatureSet - 35, // 46: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 36, // 47: google.protobuf.EnumValueOptions.features:type_name -> google.protobuf.FeatureSet - 35, // 48: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 36, // 49: google.protobuf.ServiceOptions.features:type_name -> google.protobuf.FeatureSet - 35, // 50: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 9, // 51: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel - 36, // 52: google.protobuf.MethodOptions.features:type_name -> google.protobuf.FeatureSet - 35, // 53: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption - 45, // 54: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart - 10, // 55: google.protobuf.FeatureSet.field_presence:type_name -> google.protobuf.FeatureSet.FieldPresence - 11, // 56: google.protobuf.FeatureSet.enum_type:type_name -> google.protobuf.FeatureSet.EnumType - 12, // 57: google.protobuf.FeatureSet.repeated_field_encoding:type_name -> google.protobuf.FeatureSet.RepeatedFieldEncoding - 13, // 58: google.protobuf.FeatureSet.utf8_validation:type_name -> google.protobuf.FeatureSet.Utf8Validation - 14, // 59: google.protobuf.FeatureSet.message_encoding:type_name -> google.protobuf.FeatureSet.MessageEncoding - 15, // 60: google.protobuf.FeatureSet.json_format:type_name -> google.protobuf.FeatureSet.JsonFormat - 46, // 61: google.protobuf.FeatureSetDefaults.defaults:type_name -> google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - 0, // 62: google.protobuf.FeatureSetDefaults.minimum_edition:type_name -> google.protobuf.Edition - 0, // 63: google.protobuf.FeatureSetDefaults.maximum_edition:type_name -> google.protobuf.Edition - 47, // 64: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location - 48, // 65: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation - 20, // 66: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions - 0, // 67: google.protobuf.FieldOptions.EditionDefault.edition:type_name -> google.protobuf.Edition - 0, // 68: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition:type_name -> google.protobuf.Edition - 36, // 69: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features:type_name -> google.protobuf.FeatureSet - 16, // 70: google.protobuf.GeneratedCodeInfo.Annotation.semantic:type_name -> google.protobuf.GeneratedCodeInfo.Annotation.Semantic - 71, // [71:71] is the sub-list for method output_type - 71, // [71:71] is the sub-list for method input_type - 71, // [71:71] is the sub-list for extension type_name - 71, // [71:71] is the sub-list for extension extendee - 0, // [0:71] is the sub-list for field type_name + 45, // 42: google.protobuf.FieldOptions.feature_support:type_name -> google.protobuf.FieldOptions.FeatureSupport + 35, // 43: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 44: google.protobuf.OneofOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 45: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 46: google.protobuf.EnumOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 47: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 48: google.protobuf.EnumValueOptions.features:type_name -> google.protobuf.FeatureSet + 45, // 49: google.protobuf.EnumValueOptions.feature_support:type_name -> google.protobuf.FieldOptions.FeatureSupport + 35, // 50: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 36, // 51: google.protobuf.ServiceOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 52: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 9, // 53: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel + 36, // 54: google.protobuf.MethodOptions.features:type_name -> google.protobuf.FeatureSet + 35, // 55: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 46, // 56: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart + 10, // 57: google.protobuf.FeatureSet.field_presence:type_name -> google.protobuf.FeatureSet.FieldPresence + 11, // 58: google.protobuf.FeatureSet.enum_type:type_name -> google.protobuf.FeatureSet.EnumType + 12, // 59: google.protobuf.FeatureSet.repeated_field_encoding:type_name -> google.protobuf.FeatureSet.RepeatedFieldEncoding + 13, // 60: google.protobuf.FeatureSet.utf8_validation:type_name -> google.protobuf.FeatureSet.Utf8Validation + 14, // 61: google.protobuf.FeatureSet.message_encoding:type_name -> google.protobuf.FeatureSet.MessageEncoding + 15, // 62: google.protobuf.FeatureSet.json_format:type_name -> google.protobuf.FeatureSet.JsonFormat + 47, // 63: google.protobuf.FeatureSetDefaults.defaults:type_name -> google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + 0, // 64: google.protobuf.FeatureSetDefaults.minimum_edition:type_name -> google.protobuf.Edition + 0, // 65: google.protobuf.FeatureSetDefaults.maximum_edition:type_name -> google.protobuf.Edition + 48, // 66: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location + 49, // 67: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation + 20, // 68: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions + 0, // 69: google.protobuf.FieldOptions.EditionDefault.edition:type_name -> google.protobuf.Edition + 0, // 70: google.protobuf.FieldOptions.FeatureSupport.edition_introduced:type_name -> google.protobuf.Edition + 0, // 71: google.protobuf.FieldOptions.FeatureSupport.edition_deprecated:type_name -> google.protobuf.Edition + 0, // 72: google.protobuf.FieldOptions.FeatureSupport.edition_removed:type_name -> google.protobuf.Edition + 0, // 73: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition:type_name -> google.protobuf.Edition + 36, // 74: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features:type_name -> google.protobuf.FeatureSet + 36, // 75: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features:type_name -> google.protobuf.FeatureSet + 16, // 76: google.protobuf.GeneratedCodeInfo.Annotation.semantic:type_name -> google.protobuf.GeneratedCodeInfo.Annotation.Semantic + 77, // [77:77] is the sub-list for method output_type + 77, // [77:77] is the sub-list for method input_type + 77, // [77:77] is the sub-list for extension type_name + 77, // [77:77] is the sub-list for extension extendee + 0, // [0:77] is the sub-list for field type_name } func init() { file_google_protobuf_descriptor_proto_init() } @@ -5220,419 +5319,13 @@ func file_google_protobuf_descriptor_proto_init() { if File_google_protobuf_descriptor_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_descriptor_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileDescriptorSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileDescriptorProto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DescriptorProto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtensionRangeOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldDescriptorProto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OneofDescriptorProto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumDescriptorProto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumValueDescriptorProto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceDescriptorProto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MethodDescriptorProto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OneofOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumValueOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MethodOptions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UninterpretedOption); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FeatureSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - case 3: - return &v.extensionFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FeatureSetDefaults); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceCodeInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GeneratedCodeInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DescriptorProto_ExtensionRange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DescriptorProto_ReservedRange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtensionRangeOptions_Declaration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumDescriptorProto_EnumReservedRange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldOptions_EditionDefault); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UninterpretedOption_NamePart); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FeatureSetDefaults_FeatureSetEditionDefault); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceCodeInfo_Location); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_descriptor_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GeneratedCodeInfo_Annotation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_google_protobuf_descriptor_proto_rawDesc, NumEnums: 17, - NumMessages: 32, + NumMessages: 33, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go index 25de5ae00..c7e860fcd 100644 --- a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go +++ b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go @@ -6,9 +6,9 @@ // https://developers.google.com/open-source/licenses/bsd // Code generated by protoc-gen-go. DO NOT EDIT. -// source: reflect/protodesc/proto/go_features.proto +// source: google/protobuf/go_features.proto -package proto +package gofeaturespb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -29,11 +29,9 @@ type GoFeatures struct { func (x *GoFeatures) Reset() { *x = GoFeatures{} - if protoimpl.UnsafeEnabled { - mi := &file_reflect_protodesc_proto_go_features_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_go_features_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *GoFeatures) String() string { @@ -43,8 +41,8 @@ func (x *GoFeatures) String() string { func (*GoFeatures) ProtoMessage() {} func (x *GoFeatures) ProtoReflect() protoreflect.Message { - mi := &file_reflect_protodesc_proto_go_features_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_google_protobuf_go_features_proto_msgTypes[0] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -56,7 +54,7 @@ func (x *GoFeatures) ProtoReflect() protoreflect.Message { // Deprecated: Use GoFeatures.ProtoReflect.Descriptor instead. func (*GoFeatures) Descriptor() ([]byte, []int) { - return file_reflect_protodesc_proto_go_features_proto_rawDescGZIP(), []int{0} + return file_google_protobuf_go_features_proto_rawDescGZIP(), []int{0} } func (x *GoFeatures) GetLegacyUnmarshalJsonEnum() bool { @@ -66,69 +64,73 @@ func (x *GoFeatures) GetLegacyUnmarshalJsonEnum() bool { return false } -var file_reflect_protodesc_proto_go_features_proto_extTypes = []protoimpl.ExtensionInfo{ +var file_google_protobuf_go_features_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptorpb.FeatureSet)(nil), ExtensionType: (*GoFeatures)(nil), Field: 1002, - Name: "google.protobuf.go", + Name: "pb.go", Tag: "bytes,1002,opt,name=go", - Filename: "reflect/protodesc/proto/go_features.proto", + Filename: "google/protobuf/go_features.proto", }, } // Extension fields to descriptorpb.FeatureSet. var ( - // optional google.protobuf.GoFeatures go = 1002; - E_Go = &file_reflect_protodesc_proto_go_features_proto_extTypes[0] + // optional pb.GoFeatures go = 1002; + E_Go = &file_google_protobuf_go_features_proto_extTypes[0] ) -var File_reflect_protodesc_proto_go_features_proto protoreflect.FileDescriptor - -var file_reflect_protodesc_proto_go_features_proto_rawDesc = []byte{ - 0x0a, 0x29, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x64, - 0x65, 0x73, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x5f, 0x66, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1a, 0x20, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a, - 0x0a, 0x0a, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x1a, - 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x75, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c, - 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x42, 0x1f, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x74, 0x72, 0x75, - 0x65, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x18, 0xe7, - 0x07, 0x52, 0x17, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, - 0x61, 0x6c, 0x4a, 0x73, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x49, 0x0a, 0x02, 0x67, 0x6f, - 0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x18, 0xea, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x73, 0x52, 0x02, 0x67, 0x6f, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x64, 0x65, 0x73, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, +var File_google_protobuf_go_features_proto protoreflect.FileDescriptor + +var file_google_protobuf_go_features_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x67, 0x6f, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x01, 0x0a, 0x0a, 0x47, 0x6f, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0xbe, 0x01, 0x0a, 0x1a, 0x6c, 0x65, 0x67, + 0x61, 0x63, 0x79, 0x5f, 0x75, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c, 0x5f, 0x6a, 0x73, + 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, 0x80, 0x01, + 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0x98, 0x01, 0x01, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x74, 0x72, + 0x75, 0x65, 0x18, 0x84, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x18, + 0xe7, 0x07, 0xb2, 0x01, 0x5b, 0x08, 0xe8, 0x07, 0x10, 0xe8, 0x07, 0x1a, 0x53, 0x54, 0x68, 0x65, + 0x20, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x20, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, + 0x6c, 0x4a, 0x53, 0x4f, 0x4e, 0x20, 0x41, 0x50, 0x49, 0x20, 0x69, 0x73, 0x20, 0x64, 0x65, 0x70, + 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x69, 0x6c, 0x6c, + 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x61, + 0x20, 0x66, 0x75, 0x74, 0x75, 0x72, 0x65, 0x20, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x52, 0x17, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, + 0x6c, 0x4a, 0x73, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x3c, 0x0a, 0x02, 0x67, 0x6f, 0x12, + 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x18, 0xea, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x73, 0x52, 0x02, 0x67, 0x6f, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x67, 0x6f, 0x66, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x70, 0x62, } var ( - file_reflect_protodesc_proto_go_features_proto_rawDescOnce sync.Once - file_reflect_protodesc_proto_go_features_proto_rawDescData = file_reflect_protodesc_proto_go_features_proto_rawDesc + file_google_protobuf_go_features_proto_rawDescOnce sync.Once + file_google_protobuf_go_features_proto_rawDescData = file_google_protobuf_go_features_proto_rawDesc ) -func file_reflect_protodesc_proto_go_features_proto_rawDescGZIP() []byte { - file_reflect_protodesc_proto_go_features_proto_rawDescOnce.Do(func() { - file_reflect_protodesc_proto_go_features_proto_rawDescData = protoimpl.X.CompressGZIP(file_reflect_protodesc_proto_go_features_proto_rawDescData) +func file_google_protobuf_go_features_proto_rawDescGZIP() []byte { + file_google_protobuf_go_features_proto_rawDescOnce.Do(func() { + file_google_protobuf_go_features_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_go_features_proto_rawDescData) }) - return file_reflect_protodesc_proto_go_features_proto_rawDescData + return file_google_protobuf_go_features_proto_rawDescData } -var file_reflect_protodesc_proto_go_features_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_reflect_protodesc_proto_go_features_proto_goTypes = []interface{}{ - (*GoFeatures)(nil), // 0: google.protobuf.GoFeatures +var file_google_protobuf_go_features_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_google_protobuf_go_features_proto_goTypes = []any{ + (*GoFeatures)(nil), // 0: pb.GoFeatures (*descriptorpb.FeatureSet)(nil), // 1: google.protobuf.FeatureSet } -var file_reflect_protodesc_proto_go_features_proto_depIdxs = []int32{ - 1, // 0: google.protobuf.go:extendee -> google.protobuf.FeatureSet - 0, // 1: google.protobuf.go:type_name -> google.protobuf.GoFeatures +var file_google_protobuf_go_features_proto_depIdxs = []int32{ + 1, // 0: pb.go:extendee -> google.protobuf.FeatureSet + 0, // 1: pb.go:type_name -> pb.GoFeatures 2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method input_type 1, // [1:2] is the sub-list for extension type_name @@ -136,42 +138,28 @@ var file_reflect_protodesc_proto_go_features_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_reflect_protodesc_proto_go_features_proto_init() } -func file_reflect_protodesc_proto_go_features_proto_init() { - if File_reflect_protodesc_proto_go_features_proto != nil { +func init() { file_google_protobuf_go_features_proto_init() } +func file_google_protobuf_go_features_proto_init() { + if File_google_protobuf_go_features_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_reflect_protodesc_proto_go_features_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GoFeatures); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_reflect_protodesc_proto_go_features_proto_rawDesc, + RawDescriptor: file_google_protobuf_go_features_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 1, NumServices: 0, }, - GoTypes: file_reflect_protodesc_proto_go_features_proto_goTypes, - DependencyIndexes: file_reflect_protodesc_proto_go_features_proto_depIdxs, - MessageInfos: file_reflect_protodesc_proto_go_features_proto_msgTypes, - ExtensionInfos: file_reflect_protodesc_proto_go_features_proto_extTypes, + GoTypes: file_google_protobuf_go_features_proto_goTypes, + DependencyIndexes: file_google_protobuf_go_features_proto_depIdxs, + MessageInfos: file_google_protobuf_go_features_proto_msgTypes, + ExtensionInfos: file_google_protobuf_go_features_proto_extTypes, }.Build() - File_reflect_protodesc_proto_go_features_proto = out.File - file_reflect_protodesc_proto_go_features_proto_rawDesc = nil - file_reflect_protodesc_proto_go_features_proto_goTypes = nil - file_reflect_protodesc_proto_go_features_proto_depIdxs = nil + File_google_protobuf_go_features_proto = out.File + file_google_protobuf_go_features_proto_rawDesc = nil + file_google_protobuf_go_features_proto_goTypes = nil + file_google_protobuf_go_features_proto_depIdxs = nil } diff --git a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto b/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto deleted file mode 100644 index d24657129..000000000 --- a/vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto +++ /dev/null @@ -1,28 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2023 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -syntax = "proto2"; - -package google.protobuf; - -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/protobuf/types/gofeaturespb"; - -extend google.protobuf.FeatureSet { - optional GoFeatures go = 1002; -} - -message GoFeatures { - // Whether or not to generate the deprecated UnmarshalJSON method for enums. - optional bool legacy_unmarshal_json_enum = 1 [ - retention = RETENTION_RUNTIME, - targets = TARGET_TYPE_ENUM, - edition_defaults = { edition: EDITION_PROTO2, value: "true" }, - edition_defaults = { edition: EDITION_PROTO3, value: "false" } - ]; -} diff --git a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go index 9de51be54..87da199a3 100644 --- a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go @@ -368,11 +368,9 @@ func (x *Any) UnmarshalNew() (proto.Message, error) { func (x *Any) Reset() { *x = Any{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_any_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_any_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Any) String() string { @@ -383,7 +381,7 @@ func (*Any) ProtoMessage() {} func (x *Any) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_any_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -445,7 +443,7 @@ func file_google_protobuf_any_proto_rawDescGZIP() []byte { } var file_google_protobuf_any_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_google_protobuf_any_proto_goTypes = []interface{}{ +var file_google_protobuf_any_proto_goTypes = []any{ (*Any)(nil), // 0: google.protobuf.Any } var file_google_protobuf_any_proto_depIdxs = []int32{ @@ -461,20 +459,6 @@ func file_google_protobuf_any_proto_init() { if File_google_protobuf_any_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_any_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Any); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go index df709a8dd..b99d4d241 100644 --- a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go @@ -245,11 +245,9 @@ func (x *Duration) check() uint { func (x *Duration) Reset() { *x = Duration{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_duration_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_duration_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Duration) String() string { @@ -260,7 +258,7 @@ func (*Duration) ProtoMessage() {} func (x *Duration) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_duration_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -323,7 +321,7 @@ func file_google_protobuf_duration_proto_rawDescGZIP() []byte { } var file_google_protobuf_duration_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_google_protobuf_duration_proto_goTypes = []interface{}{ +var file_google_protobuf_duration_proto_goTypes = []any{ (*Duration)(nil), // 0: google.protobuf.Duration } var file_google_protobuf_duration_proto_depIdxs = []int32{ @@ -339,20 +337,6 @@ func file_google_protobuf_duration_proto_init() { if File_google_protobuf_duration_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_duration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Duration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/vendor/google.golang.org/protobuf/types/known/fieldmaskpb/field_mask.pb.go b/vendor/google.golang.org/protobuf/types/known/fieldmaskpb/field_mask.pb.go index e8789cb33..19de8d371 100644 --- a/vendor/google.golang.org/protobuf/types/known/fieldmaskpb/field_mask.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/fieldmaskpb/field_mask.pb.go @@ -467,11 +467,9 @@ func rangeFields(path string, f func(field string) bool) bool { func (x *FieldMask) Reset() { *x = FieldMask{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_field_mask_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_field_mask_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FieldMask) String() string { @@ -482,7 +480,7 @@ func (*FieldMask) ProtoMessage() {} func (x *FieldMask) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_field_mask_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -537,7 +535,7 @@ func file_google_protobuf_field_mask_proto_rawDescGZIP() []byte { } var file_google_protobuf_field_mask_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_google_protobuf_field_mask_proto_goTypes = []interface{}{ +var file_google_protobuf_field_mask_proto_goTypes = []any{ (*FieldMask)(nil), // 0: google.protobuf.FieldMask } var file_google_protobuf_field_mask_proto_depIdxs = []int32{ @@ -553,20 +551,6 @@ func file_google_protobuf_field_mask_proto_init() { if File_google_protobuf_field_mask_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_field_mask_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FieldMask); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/vendor/google.golang.org/protobuf/types/known/structpb/struct.pb.go b/vendor/google.golang.org/protobuf/types/known/structpb/struct.pb.go index d2bac8b88..8f206a661 100644 --- a/vendor/google.golang.org/protobuf/types/known/structpb/struct.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/structpb/struct.pb.go @@ -49,11 +49,11 @@ // The standard Go "encoding/json" package has functionality to serialize // arbitrary types to a large degree. The Value.AsInterface, Struct.AsMap, and // ListValue.AsSlice methods can convert the protobuf message representation into -// a form represented by interface{}, map[string]interface{}, and []interface{}. +// a form represented by any, map[string]any, and []any. // This form can be used with other packages that operate on such data structures // and also directly with the standard json package. // -// In order to convert the interface{}, map[string]interface{}, and []interface{} +// In order to convert the any, map[string]any, and []any // forms back as Value, Struct, and ListValue messages, use the NewStruct, // NewList, and NewValue constructor functions. // @@ -88,28 +88,28 @@ // // To construct a Value message representing the above JSON object: // -// m, err := structpb.NewValue(map[string]interface{}{ +// m, err := structpb.NewValue(map[string]any{ // "firstName": "John", // "lastName": "Smith", // "isAlive": true, // "age": 27, -// "address": map[string]interface{}{ +// "address": map[string]any{ // "streetAddress": "21 2nd Street", // "city": "New York", // "state": "NY", // "postalCode": "10021-3100", // }, -// "phoneNumbers": []interface{}{ -// map[string]interface{}{ +// "phoneNumbers": []any{ +// map[string]any{ // "type": "home", // "number": "212 555-1234", // }, -// map[string]interface{}{ +// map[string]any{ // "type": "office", // "number": "646 555-4567", // }, // }, -// "children": []interface{}{}, +// "children": []any{}, // "spouse": nil, // }) // if err != nil { @@ -120,6 +120,7 @@ package structpb import ( base64 "encoding/base64" + json "encoding/json" protojson "google.golang.org/protobuf/encoding/protojson" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -197,7 +198,7 @@ type Struct struct { // NewStruct constructs a Struct from a general-purpose Go map. // The map keys must be valid UTF-8. // The map values are converted using NewValue. -func NewStruct(v map[string]interface{}) (*Struct, error) { +func NewStruct(v map[string]any) (*Struct, error) { x := &Struct{Fields: make(map[string]*Value, len(v))} for k, v := range v { if !utf8.ValidString(k) { @@ -214,9 +215,9 @@ func NewStruct(v map[string]interface{}) (*Struct, error) { // AsMap converts x to a general-purpose Go map. // The map values are converted by calling Value.AsInterface. -func (x *Struct) AsMap() map[string]interface{} { +func (x *Struct) AsMap() map[string]any { f := x.GetFields() - vs := make(map[string]interface{}, len(f)) + vs := make(map[string]any, len(f)) for k, v := range f { vs[k] = v.AsInterface() } @@ -233,11 +234,9 @@ func (x *Struct) UnmarshalJSON(b []byte) error { func (x *Struct) Reset() { *x = Struct{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_struct_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_struct_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Struct) String() string { @@ -248,7 +247,7 @@ func (*Struct) ProtoMessage() {} func (x *Struct) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_struct_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -296,23 +295,24 @@ type Value struct { // NewValue constructs a Value from a general-purpose Go interface. // -// ╔════════════════════════╤════════════════════════════════════════════╗ -// ║ Go type │ Conversion ║ -// ╠════════════════════════╪════════════════════════════════════════════╣ -// ║ nil │ stored as NullValue ║ -// ║ bool │ stored as BoolValue ║ -// ║ int, int32, int64 │ stored as NumberValue ║ -// ║ uint, uint32, uint64 │ stored as NumberValue ║ -// ║ float32, float64 │ stored as NumberValue ║ -// ║ string │ stored as StringValue; must be valid UTF-8 ║ -// ║ []byte │ stored as StringValue; base64-encoded ║ -// ║ map[string]interface{} │ stored as StructValue ║ -// ║ []interface{} │ stored as ListValue ║ -// ╚════════════════════════╧════════════════════════════════════════════╝ +// ╔═══════════════════════════════════════╤════════════════════════════════════════════╗ +// ║ Go type │ Conversion ║ +// ╠═══════════════════════════════════════╪════════════════════════════════════════════╣ +// ║ nil │ stored as NullValue ║ +// ║ bool │ stored as BoolValue ║ +// ║ int, int8, int16, int32, int64 │ stored as NumberValue ║ +// ║ uint, uint8, uint16, uint32, uint64 │ stored as NumberValue ║ +// ║ float32, float64 │ stored as NumberValue ║ +// ║ json.Number │ stored as NumberValue ║ +// ║ string │ stored as StringValue; must be valid UTF-8 ║ +// ║ []byte │ stored as StringValue; base64-encoded ║ +// ║ map[string]any │ stored as StructValue ║ +// ║ []any │ stored as ListValue ║ +// ╚═══════════════════════════════════════╧════════════════════════════════════════════╝ // // When converting an int64 or uint64 to a NumberValue, numeric precision loss // is possible since they are stored as a float64. -func NewValue(v interface{}) (*Value, error) { +func NewValue(v any) (*Value, error) { switch v := v.(type) { case nil: return NewNullValue(), nil @@ -320,12 +320,20 @@ func NewValue(v interface{}) (*Value, error) { return NewBoolValue(v), nil case int: return NewNumberValue(float64(v)), nil + case int8: + return NewNumberValue(float64(v)), nil + case int16: + return NewNumberValue(float64(v)), nil case int32: return NewNumberValue(float64(v)), nil case int64: return NewNumberValue(float64(v)), nil case uint: return NewNumberValue(float64(v)), nil + case uint8: + return NewNumberValue(float64(v)), nil + case uint16: + return NewNumberValue(float64(v)), nil case uint32: return NewNumberValue(float64(v)), nil case uint64: @@ -334,6 +342,12 @@ func NewValue(v interface{}) (*Value, error) { return NewNumberValue(float64(v)), nil case float64: return NewNumberValue(float64(v)), nil + case json.Number: + n, err := v.Float64() + if err != nil { + return nil, protoimpl.X.NewError("invalid number format %q, expected a float64: %v", v, err) + } + return NewNumberValue(n), nil case string: if !utf8.ValidString(v) { return nil, protoimpl.X.NewError("invalid UTF-8 in string: %q", v) @@ -342,13 +356,13 @@ func NewValue(v interface{}) (*Value, error) { case []byte: s := base64.StdEncoding.EncodeToString(v) return NewStringValue(s), nil - case map[string]interface{}: + case map[string]any: v2, err := NewStruct(v) if err != nil { return nil, err } return NewStructValue(v2), nil - case []interface{}: + case []any: v2, err := NewList(v) if err != nil { return nil, err @@ -396,7 +410,7 @@ func NewListValue(v *ListValue) *Value { // // Floating-point values (i.e., "NaN", "Infinity", and "-Infinity") are // converted as strings to remain compatible with MarshalJSON. -func (x *Value) AsInterface() interface{} { +func (x *Value) AsInterface() any { switch v := x.GetKind().(type) { case *Value_NumberValue: if v != nil { @@ -441,11 +455,9 @@ func (x *Value) UnmarshalJSON(b []byte) error { func (x *Value) Reset() { *x = Value{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_struct_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_struct_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Value) String() string { @@ -456,7 +468,7 @@ func (*Value) ProtoMessage() {} func (x *Value) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_struct_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -580,7 +592,7 @@ type ListValue struct { // NewList constructs a ListValue from a general-purpose Go slice. // The slice elements are converted using NewValue. -func NewList(v []interface{}) (*ListValue, error) { +func NewList(v []any) (*ListValue, error) { x := &ListValue{Values: make([]*Value, len(v))} for i, v := range v { var err error @@ -594,9 +606,9 @@ func NewList(v []interface{}) (*ListValue, error) { // AsSlice converts x to a general-purpose Go slice. // The slice elements are converted by calling Value.AsInterface. -func (x *ListValue) AsSlice() []interface{} { +func (x *ListValue) AsSlice() []any { vals := x.GetValues() - vs := make([]interface{}, len(vals)) + vs := make([]any, len(vals)) for i, v := range vals { vs[i] = v.AsInterface() } @@ -613,11 +625,9 @@ func (x *ListValue) UnmarshalJSON(b []byte) error { func (x *ListValue) Reset() { *x = ListValue{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_struct_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_struct_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ListValue) String() string { @@ -628,7 +638,7 @@ func (*ListValue) ProtoMessage() {} func (x *ListValue) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_struct_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -716,7 +726,7 @@ func file_google_protobuf_struct_proto_rawDescGZIP() []byte { var file_google_protobuf_struct_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_google_protobuf_struct_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_google_protobuf_struct_proto_goTypes = []interface{}{ +var file_google_protobuf_struct_proto_goTypes = []any{ (NullValue)(0), // 0: google.protobuf.NullValue (*Struct)(nil), // 1: google.protobuf.Struct (*Value)(nil), // 2: google.protobuf.Value @@ -742,45 +752,7 @@ func file_google_protobuf_struct_proto_init() { if File_google_protobuf_struct_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_struct_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Struct); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_struct_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_struct_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_google_protobuf_struct_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_google_protobuf_struct_proto_msgTypes[1].OneofWrappers = []any{ (*Value_NullValue)(nil), (*Value_NumberValue)(nil), (*Value_StringValue)(nil), diff --git a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go index 81511a336..0d20722d7 100644 --- a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go @@ -254,11 +254,9 @@ func (x *Timestamp) check() uint { func (x *Timestamp) Reset() { *x = Timestamp{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_timestamp_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_timestamp_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Timestamp) String() string { @@ -269,7 +267,7 @@ func (*Timestamp) ProtoMessage() {} func (x *Timestamp) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_timestamp_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -332,7 +330,7 @@ func file_google_protobuf_timestamp_proto_rawDescGZIP() []byte { } var file_google_protobuf_timestamp_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_google_protobuf_timestamp_proto_goTypes = []interface{}{ +var file_google_protobuf_timestamp_proto_goTypes = []any{ (*Timestamp)(nil), // 0: google.protobuf.Timestamp } var file_google_protobuf_timestamp_proto_depIdxs = []int32{ @@ -348,20 +346,6 @@ func file_google_protobuf_timestamp_proto_init() { if File_google_protobuf_timestamp_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_timestamp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Timestamp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/vendor/google.golang.org/protobuf/types/known/wrapperspb/wrappers.pb.go b/vendor/google.golang.org/protobuf/types/known/wrapperspb/wrappers.pb.go index 762a87130..006060e56 100644 --- a/vendor/google.golang.org/protobuf/types/known/wrapperspb/wrappers.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/wrapperspb/wrappers.pb.go @@ -69,11 +69,9 @@ func Double(v float64) *DoubleValue { func (x *DoubleValue) Reset() { *x = DoubleValue{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DoubleValue) String() string { @@ -84,7 +82,7 @@ func (*DoubleValue) ProtoMessage() {} func (x *DoubleValue) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -125,11 +123,9 @@ func Float(v float32) *FloatValue { func (x *FloatValue) Reset() { *x = FloatValue{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FloatValue) String() string { @@ -140,7 +136,7 @@ func (*FloatValue) ProtoMessage() {} func (x *FloatValue) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -181,11 +177,9 @@ func Int64(v int64) *Int64Value { func (x *Int64Value) Reset() { *x = Int64Value{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Int64Value) String() string { @@ -196,7 +190,7 @@ func (*Int64Value) ProtoMessage() {} func (x *Int64Value) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -237,11 +231,9 @@ func UInt64(v uint64) *UInt64Value { func (x *UInt64Value) Reset() { *x = UInt64Value{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UInt64Value) String() string { @@ -252,7 +244,7 @@ func (*UInt64Value) ProtoMessage() {} func (x *UInt64Value) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -293,11 +285,9 @@ func Int32(v int32) *Int32Value { func (x *Int32Value) Reset() { *x = Int32Value{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Int32Value) String() string { @@ -308,7 +298,7 @@ func (*Int32Value) ProtoMessage() {} func (x *Int32Value) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -349,11 +339,9 @@ func UInt32(v uint32) *UInt32Value { func (x *UInt32Value) Reset() { *x = UInt32Value{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *UInt32Value) String() string { @@ -364,7 +352,7 @@ func (*UInt32Value) ProtoMessage() {} func (x *UInt32Value) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -405,11 +393,9 @@ func Bool(v bool) *BoolValue { func (x *BoolValue) Reset() { *x = BoolValue{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BoolValue) String() string { @@ -420,7 +406,7 @@ func (*BoolValue) ProtoMessage() {} func (x *BoolValue) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -461,11 +447,9 @@ func String(v string) *StringValue { func (x *StringValue) Reset() { *x = StringValue{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *StringValue) String() string { @@ -476,7 +460,7 @@ func (*StringValue) ProtoMessage() {} func (x *StringValue) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -517,11 +501,9 @@ func Bytes(v []byte) *BytesValue { func (x *BytesValue) Reset() { *x = BytesValue{} - if protoimpl.UnsafeEnabled { - mi := &file_google_protobuf_wrappers_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_google_protobuf_wrappers_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *BytesValue) String() string { @@ -532,7 +514,7 @@ func (*BytesValue) ProtoMessage() {} func (x *BytesValue) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_wrappers_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -605,7 +587,7 @@ func file_google_protobuf_wrappers_proto_rawDescGZIP() []byte { } var file_google_protobuf_wrappers_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_google_protobuf_wrappers_proto_goTypes = []interface{}{ +var file_google_protobuf_wrappers_proto_goTypes = []any{ (*DoubleValue)(nil), // 0: google.protobuf.DoubleValue (*FloatValue)(nil), // 1: google.protobuf.FloatValue (*Int64Value)(nil), // 2: google.protobuf.Int64Value @@ -629,116 +611,6 @@ func file_google_protobuf_wrappers_proto_init() { if File_google_protobuf_wrappers_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_google_protobuf_wrappers_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DoubleValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_wrappers_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FloatValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_wrappers_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int64Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_wrappers_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UInt64Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_wrappers_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Int32Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_wrappers_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UInt32Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_wrappers_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BoolValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_wrappers_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_google_protobuf_wrappers_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BytesValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/vendor/k8s.io/klog/v2/OWNERS b/vendor/k8s.io/klog/v2/OWNERS index a2fe8f351..7500475a6 100644 --- a/vendor/k8s.io/klog/v2/OWNERS +++ b/vendor/k8s.io/klog/v2/OWNERS @@ -1,14 +1,16 @@ # See the OWNERS docs at https://go.k8s.io/owners reviewers: - harshanarayana + - mengjiao-liu - pohly approvers: - dims + - pohly - thockin - - serathius emeritus_approvers: - brancz - justinsb - lavalamp - piosz + - serathius - tallclair diff --git a/vendor/k8s.io/klog/v2/contextual_slog.go b/vendor/k8s.io/klog/v2/contextual_slog.go new file mode 100644 index 000000000..d3b562521 --- /dev/null +++ b/vendor/k8s.io/klog/v2/contextual_slog.go @@ -0,0 +1,31 @@ +//go:build go1.21 +// +build go1.21 + +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package klog + +import ( + "log/slog" + + "github.com/go-logr/logr" +) + +// SetSlogLogger reconfigures klog to log through the slog logger. The logger must not be nil. +func SetSlogLogger(logger *slog.Logger) { + SetLoggerWithOptions(logr.FromSlogHandler(logger.Handler()), ContextualLogger(true)) +} diff --git a/vendor/k8s.io/klog/v2/klog.go b/vendor/k8s.io/klog/v2/klog.go index 72502db3a..47ec9466a 100644 --- a/vendor/k8s.io/klog/v2/klog.go +++ b/vendor/k8s.io/klog/v2/klog.go @@ -14,9 +14,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package klog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup. -// It provides functions Info, Warning, Error, Fatal, plus formatting variants such as -// Infof. It also provides V-style logging controlled by the -v and -vmodule=file=2 flags. +// Package klog contains the following functionality: +// +// - output routing as defined via command line flags ([InitFlags]) +// - log formatting as text, either with a single, unstructured string ([Info], [Infof], etc.) +// or as a structured log entry with message and key/value pairs ([InfoS], etc.) +// - management of a go-logr [Logger] ([SetLogger], [Background], [TODO]) +// - helper functions for logging values ([Format]) and managing the state of klog ([CaptureState], [State.Restore]) +// - wrappers for [logr] APIs for contextual logging where the wrappers can +// be turned into no-ops ([EnableContextualLogging], [NewContext], [FromContext], +// [LoggerWithValues], [LoggerWithName]); if the ability to turn off +// contextual logging is not needed, then go-logr can also be used directly +// - type aliases for go-logr types to simplify imports in code which uses both (e.g. [Logger]) +// - [k8s.io/klog/v2/textlogger]: a logger which uses the same formatting as klog log with +// simpler output routing; beware that it comes with its own command line flags +// and does not use the ones from klog +// - [k8s.io/klog/v2/ktesting]: per-test output in Go unit tests +// - [k8s.io/klog/v2/klogr]: a deprecated, standalone [logr.Logger] on top of the main klog package; +// use [Background] instead if klog output routing is needed, [k8s.io/klog/v2/textlogger] if not +// - [k8s.io/klog/v2/examples]: demos of this functionality +// - [k8s.io/klog/v2/test]: reusable tests for [logr.Logger] implementations // // Basic examples: // @@ -387,13 +404,6 @@ func (t *traceLocation) Set(value string) error { return nil } -// flushSyncWriter is the interface satisfied by logging destinations. -type flushSyncWriter interface { - Flush() error - Sync() error - io.Writer -} - var logging loggingT var commandLine flag.FlagSet @@ -469,7 +479,7 @@ type settings struct { // Access to all of the following fields must be protected via a mutex. // file holds writer for each of the log types. - file [severity.NumSeverity]flushSyncWriter + file [severity.NumSeverity]io.Writer // flushInterval is the interval for periodic flushing. If zero, // the global default will be used. flushInterval time.Duration @@ -814,32 +824,12 @@ func (l *loggingT) printS(err error, s severity.Severity, depth int, msg string, buffer.PutBuffer(b) } -// redirectBuffer is used to set an alternate destination for the logs -type redirectBuffer struct { - w io.Writer -} - -func (rb *redirectBuffer) Sync() error { - return nil -} - -func (rb *redirectBuffer) Flush() error { - return nil -} - -func (rb *redirectBuffer) Write(bytes []byte) (n int, err error) { - return rb.w.Write(bytes) -} - // SetOutput sets the output destination for all severities func SetOutput(w io.Writer) { logging.mu.Lock() defer logging.mu.Unlock() for s := severity.FatalLog; s >= severity.InfoLog; s-- { - rb := &redirectBuffer{ - w: w, - } - logging.file[s] = rb + logging.file[s] = w } } @@ -851,10 +841,7 @@ func SetOutputBySeverity(name string, w io.Writer) { if !ok { panic(fmt.Sprintf("SetOutputBySeverity(%q): unrecognized severity name", name)) } - rb := &redirectBuffer{ - w: w, - } - logging.file[sev] = rb + logging.file[sev] = w } // LogToStderr sets whether to log exclusively to stderr, bypassing outputs @@ -994,7 +981,8 @@ func (l *loggingT) exit(err error) { logExitFunc(err) return } - l.flushAll() + needToSync := l.flushAll() + l.syncAll(needToSync) OsExit(2) } @@ -1011,10 +999,6 @@ type syncBuffer struct { maxbytes uint64 // The max number of bytes this syncBuffer.file can hold before cleaning up. } -func (sb *syncBuffer) Sync() error { - return sb.file.Sync() -} - // CalculateMaxSize returns the real max size in bytes after considering the default max size and the flag options. func CalculateMaxSize() uint64 { if logging.logFile != "" { @@ -1206,24 +1190,45 @@ func StartFlushDaemon(interval time.Duration) { // lockAndFlushAll is like flushAll but locks l.mu first. func (l *loggingT) lockAndFlushAll() { l.mu.Lock() - l.flushAll() + needToSync := l.flushAll() l.mu.Unlock() + // Some environments are slow when syncing and holding the lock might cause contention. + l.syncAll(needToSync) } -// flushAll flushes all the logs and attempts to "sync" their data to disk. +// flushAll flushes all the logs // l.mu is held. -func (l *loggingT) flushAll() { +// +// The result is the number of files which need to be synced and the pointers to them. +func (l *loggingT) flushAll() fileArray { + var needToSync fileArray + // Flush from fatal down, in case there's trouble flushing. for s := severity.FatalLog; s >= severity.InfoLog; s-- { file := l.file[s] - if file != nil { - _ = file.Flush() // ignore error - _ = file.Sync() // ignore error + if sb, ok := file.(*syncBuffer); ok && sb.file != nil { + _ = sb.Flush() // ignore error + needToSync.files[needToSync.num] = sb.file + needToSync.num++ } } if logging.loggerOptions.flush != nil { logging.loggerOptions.flush() } + return needToSync +} + +type fileArray struct { + num int + files [severity.NumSeverity]*os.File +} + +// syncAll attempts to "sync" their data to disk. +func (l *loggingT) syncAll(needToSync fileArray) { + // Flush from fatal down, in case there's trouble flushing. + for i := 0; i < needToSync.num; i++ { + _ = needToSync.files[i].Sync() // ignore error + } } // CopyStandardLogTo arranges for messages written to the Go "log" package's diff --git a/vendor/k8s.io/klog/v2/klogr_slog.go b/vendor/k8s.io/klog/v2/klogr_slog.go index f7bf74030..c77d7baaf 100644 --- a/vendor/k8s.io/klog/v2/klogr_slog.go +++ b/vendor/k8s.io/klog/v2/klogr_slog.go @@ -25,7 +25,7 @@ import ( "strconv" "time" - "github.com/go-logr/logr/slogr" + "github.com/go-logr/logr" "k8s.io/klog/v2/internal/buffer" "k8s.io/klog/v2/internal/serialize" @@ -35,7 +35,7 @@ import ( func (l *klogger) Handle(ctx context.Context, record slog.Record) error { if logging.logger != nil { - if slogSink, ok := logging.logger.GetSink().(slogr.SlogSink); ok { + if slogSink, ok := logging.logger.GetSink().(logr.SlogSink); ok { // Let that logger do the work. return slogSink.Handle(ctx, record) } @@ -77,13 +77,13 @@ func slogOutput(file string, line int, now time.Time, err error, s severity.Seve buffer.PutBuffer(b) } -func (l *klogger) WithAttrs(attrs []slog.Attr) slogr.SlogSink { +func (l *klogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { clone := *l clone.values = serialize.WithValues(l.values, sloghandler.Attrs2KVList(l.groups, attrs)) return &clone } -func (l *klogger) WithGroup(name string) slogr.SlogSink { +func (l *klogger) WithGroup(name string) logr.SlogSink { clone := *l if clone.groups != "" { clone.groups += "." + name @@ -93,4 +93,4 @@ func (l *klogger) WithGroup(name string) slogr.SlogSink { return &clone } -var _ slogr.SlogSink = &klogger{} +var _ logr.SlogSink = &klogger{} diff --git a/vendor/k8s.io/klog/v2/safeptr.go b/vendor/k8s.io/klog/v2/safeptr.go new file mode 100644 index 000000000..bbe24c2e8 --- /dev/null +++ b/vendor/k8s.io/klog/v2/safeptr.go @@ -0,0 +1,34 @@ +//go:build go1.18 +// +build go1.18 + +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package klog + +// SafePtr is a function that takes a pointer of any type (T) as an argument. +// If the provided pointer is not nil, it returns the same pointer. If it is nil, it returns nil instead. +// +// This function is particularly useful to prevent nil pointer dereferencing when: +// +// - The type implements interfaces that are called by the logger, such as `fmt.Stringer`. +// - And these interface implementations do not perform nil checks themselves. +func SafePtr[T any](p *T) any { + if p == nil { + return nil + } + return p +} diff --git a/vendor/k8s.io/klog/v2/textlogger/options.go b/vendor/k8s.io/klog/v2/textlogger/options.go index a5c253003..b1c4eefb3 100644 --- a/vendor/k8s.io/klog/v2/textlogger/options.go +++ b/vendor/k8s.io/klog/v2/textlogger/options.go @@ -58,6 +58,7 @@ type configOptions struct { vmoduleFlagName string verbosityDefault int fixedTime *time.Time + unwind func(int) (string, int) output io.Writer } @@ -105,6 +106,21 @@ func FixedTime(ts time.Time) ConfigOption { } } +// Backtrace overrides the default mechanism for determining the call site. +// The callback is invoked with the number of function calls between itself +// and the call site. It must return the file name and line number. An empty +// file name indicates that the information is unknown. +// +// # Experimental +// +// Notice: This function is EXPERIMENTAL and may be changed or removed in a +// later release. +func Backtrace(unwind func(skip int) (filename string, line int)) ConfigOption { + return func(co *configOptions) { + co.unwind = unwind + } +} + // NewConfig returns a configuration with recommended defaults and optional // modifications. Command line flags are not bound to any FlagSet yet. func NewConfig(opts ...ConfigOption) *Config { @@ -114,6 +130,7 @@ func NewConfig(opts ...ConfigOption) *Config { verbosityFlagName: "v", vmoduleFlagName: "vmodule", verbosityDefault: 0, + unwind: runtimeBacktrace, output: os.Stderr, }, } @@ -127,6 +144,10 @@ func NewConfig(opts ...ConfigOption) *Config { } // AddFlags registers the command line flags that control the configuration. +// +// The default flag names are the same as in klog, so unless those defaults +// are changed, either klog.InitFlags or Config.AddFlags can be used for the +// same flag set, but not both. func (c *Config) AddFlags(fs *flag.FlagSet) { fs.Var(c.Verbosity(), c.co.verbosityFlagName, "number for the log level verbosity of the testing logger") fs.Var(c.VModule(), c.co.vmoduleFlagName, "comma-separated list of pattern=N log level settings for files matching the patterns") diff --git a/vendor/k8s.io/klog/v2/textlogger/textlogger.go b/vendor/k8s.io/klog/v2/textlogger/textlogger.go index 235ecff5c..0b55a2994 100644 --- a/vendor/k8s.io/klog/v2/textlogger/textlogger.go +++ b/vendor/k8s.io/klog/v2/textlogger/textlogger.go @@ -1,6 +1,6 @@ /* Copyright 2019 The Kubernetes Authors. -Copyright 2020 Intel Coporation. +Copyright 2020 Intel Corporation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,8 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package textlogger contains an implementation of the logr interface -// which is producing the exact same output as klog. +// Package textlogger contains an implementation of the logr interface which is +// producing the exact same output as klog. It does not route output through +// klog (i.e. ignores [k8s.io/klog/v2.InitFlags]). Instead, all settings must be +// configured through its own [NewConfig] and [Config.AddFlags]. package textlogger import ( @@ -92,19 +94,25 @@ func (l *tlogger) Error(err error, msg string, kvList ...interface{}) { func (l *tlogger) print(err error, s severity.Severity, msg string, kvList []interface{}) { // Determine caller. // +1 for this frame, +1 for Info/Error. - _, file, line, ok := runtime.Caller(l.callDepth + 2) - if !ok { + skip := l.callDepth + 2 + file, line := l.config.co.unwind(skip) + if file == "" { file = "???" line = 1 - } else { - if slash := strings.LastIndex(file, "/"); slash >= 0 { - file = file[slash+1:] - } + } else if slash := strings.LastIndex(file, "/"); slash >= 0 { + file = file[slash+1:] } - l.printWithInfos(file, line, time.Now(), err, s, msg, kvList) } +func runtimeBacktrace(skip int) (string, int) { + _, file, line, ok := runtime.Caller(skip + 1) + if !ok { + return "", 0 + } + return file, line +} + func (l *tlogger) printWithInfos(file string, line int, now time.Time, err error, s severity.Severity, msg string, kvList []interface{}) { // Only create a new buffer if we don't have one cached. b := buffer.GetBuffer() diff --git a/vendor/k8s.io/klog/v2/textlogger/textlogger_slog.go b/vendor/k8s.io/klog/v2/textlogger/textlogger_slog.go index af0fab00e..c888ef8a6 100644 --- a/vendor/k8s.io/klog/v2/textlogger/textlogger_slog.go +++ b/vendor/k8s.io/klog/v2/textlogger/textlogger_slog.go @@ -23,7 +23,7 @@ import ( "context" "log/slog" - "github.com/go-logr/logr/slogr" + "github.com/go-logr/logr" "k8s.io/klog/v2/internal/serialize" "k8s.io/klog/v2/internal/sloghandler" @@ -33,13 +33,13 @@ func (l *tlogger) Handle(ctx context.Context, record slog.Record) error { return sloghandler.Handle(ctx, record, l.groups, l.printWithInfos) } -func (l *tlogger) WithAttrs(attrs []slog.Attr) slogr.SlogSink { +func (l *tlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { clone := *l clone.values = serialize.WithValues(l.values, sloghandler.Attrs2KVList(l.groups, attrs)) return &clone } -func (l *tlogger) WithGroup(name string) slogr.SlogSink { +func (l *tlogger) WithGroup(name string) logr.SlogSink { clone := *l if clone.groups != "" { clone.groups += "." + name @@ -49,4 +49,4 @@ func (l *tlogger) WithGroup(name string) slogr.SlogSink { return &clone } -var _ slogr.SlogSink = &tlogger{} +var _ logr.SlogSink = &tlogger{} diff --git a/vendor/k8s.io/kube-openapi/pkg/common/common.go b/vendor/k8s.io/kube-openapi/pkg/common/common.go index 2e15e163c..e4ce843b0 100644 --- a/vendor/k8s.io/kube-openapi/pkg/common/common.go +++ b/vendor/k8s.io/kube-openapi/pkg/common/common.go @@ -164,6 +164,9 @@ type OpenAPIV3Config struct { // It is an optional function to customize model names. GetDefinitionName func(name string) (string, spec.Extensions) + // PostProcessSpec runs after the spec is ready to serve. It allows a final modification to the spec before serving. + PostProcessSpec func(*spec3.OpenAPI) (*spec3.OpenAPI, error) + // SecuritySchemes is list of all security schemes for OpenAPI service. SecuritySchemes spec3.SecuritySchemes diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go index 799d866d5..9887d185b 100644 --- a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go +++ b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go @@ -214,9 +214,6 @@ func makeUnion(extensions map[string]interface{}) (schema.Union, error) { } } - if union.Discriminator != nil && len(union.Fields) == 0 { - return schema.Union{}, fmt.Errorf("discriminator set to %v, but no fields in union", *union.Discriminator) - } return union, nil } diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go index 5789e67ab..1b758ab25 100644 --- a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go +++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go @@ -22,7 +22,7 @@ import ( "strings" openapi_v2 "github.com/google/gnostic-models/openapiv2" - "gopkg.in/yaml.v2" + yaml "sigs.k8s.io/yaml/goyaml.v2" ) func newSchemaError(path *Path, format string, a ...interface{}) error { diff --git a/vendor/k8s.io/utils/integer/integer.go b/vendor/k8s.io/utils/integer/integer.go index e4e740cad..f64d64955 100644 --- a/vendor/k8s.io/utils/integer/integer.go +++ b/vendor/k8s.io/utils/integer/integer.go @@ -16,7 +16,10 @@ limitations under the License. package integer -// IntMax returns the maximum of the params +import "math" + +// IntMax returns the maximum of the params. +// Deprecated: for new code, use the max() builtin instead. func IntMax(a, b int) int { if b > a { return b @@ -24,7 +27,8 @@ func IntMax(a, b int) int { return a } -// IntMin returns the minimum of the params +// IntMin returns the minimum of the params. +// Deprecated: for new code, use the min() builtin instead. func IntMin(a, b int) int { if b < a { return b @@ -32,7 +36,8 @@ func IntMin(a, b int) int { return a } -// Int32Max returns the maximum of the params +// Int32Max returns the maximum of the params. +// Deprecated: for new code, use the max() builtin instead. func Int32Max(a, b int32) int32 { if b > a { return b @@ -40,7 +45,8 @@ func Int32Max(a, b int32) int32 { return a } -// Int32Min returns the minimum of the params +// Int32Min returns the minimum of the params. +// Deprecated: for new code, use the min() builtin instead. func Int32Min(a, b int32) int32 { if b < a { return b @@ -48,7 +54,8 @@ func Int32Min(a, b int32) int32 { return a } -// Int64Max returns the maximum of the params +// Int64Max returns the maximum of the params. +// Deprecated: for new code, use the max() builtin instead. func Int64Max(a, b int64) int64 { if b > a { return b @@ -56,7 +63,8 @@ func Int64Max(a, b int64) int64 { return a } -// Int64Min returns the minimum of the params +// Int64Min returns the minimum of the params. +// Deprecated: for new code, use the min() builtin instead. func Int64Min(a, b int64) int64 { if b < a { return b @@ -65,9 +73,7 @@ func Int64Min(a, b int64) int64 { } // RoundToInt32 rounds floats into integer numbers. +// Deprecated: use math.Round() and a cast directly. func RoundToInt32(a float64) int32 { - if a < 0 { - return int32(a - 0.5) - } - return int32(a + 0.5) + return int32(math.Round(a)) } diff --git a/vendor/k8s.io/utils/lru/lru.go b/vendor/k8s.io/utils/lru/lru.go index 47f135281..f0b67462f 100644 --- a/vendor/k8s.io/utils/lru/lru.go +++ b/vendor/k8s.io/utils/lru/lru.go @@ -16,6 +16,7 @@ limitations under the License. package lru import ( + "fmt" "sync" groupcache "k8s.io/utils/internal/third_party/forked/golang/golang-lru" @@ -44,6 +45,15 @@ func NewWithEvictionFunc(size int, f EvictionFunc) *Cache { return c } +// SetEvictionFunc updates the eviction func +func (c *Cache) SetEvictionFunc(f EvictionFunc) error { + if c.cache.OnEvicted != nil { + return fmt.Errorf("lru cache eviction function is already set") + } + c.cache.OnEvicted = f + return nil +} + // Add adds a value to the cache. func (c *Cache) Add(key Key, value interface{}) { c.lock.Lock() diff --git a/vendor/k8s.io/utils/net/multi_listen.go b/vendor/k8s.io/utils/net/multi_listen.go new file mode 100644 index 000000000..7cb7795be --- /dev/null +++ b/vendor/k8s.io/utils/net/multi_listen.go @@ -0,0 +1,195 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package net + +import ( + "context" + "fmt" + "net" + "sync" +) + +// connErrPair pairs conn and error which is returned by accept on sub-listeners. +type connErrPair struct { + conn net.Conn + err error +} + +// multiListener implements net.Listener +type multiListener struct { + listeners []net.Listener + wg sync.WaitGroup + + // connCh passes accepted connections, from child listeners to parent. + connCh chan connErrPair + // stopCh communicates from parent to child listeners. + stopCh chan struct{} +} + +// compile time check to ensure *multiListener implements net.Listener +var _ net.Listener = &multiListener{} + +// MultiListen returns net.Listener which can listen on and accept connections for +// the given network on multiple addresses. Internally it uses stdlib to create +// sub-listener and multiplexes connection requests using go-routines. +// The network must be "tcp", "tcp4" or "tcp6". +// It follows the semantics of net.Listen that primarily means: +// 1. If the host is an unspecified/zero IP address with "tcp" network, MultiListen +// listens on all available unicast and anycast IP addresses of the local system. +// 2. Use "tcp4" or "tcp6" to exclusively listen on IPv4 or IPv6 family, respectively. +// 3. The host can accept names (e.g, localhost) and it will create a listener for at +// most one of the host's IP. +func MultiListen(ctx context.Context, network string, addrs ...string) (net.Listener, error) { + var lc net.ListenConfig + return multiListen( + ctx, + network, + addrs, + func(ctx context.Context, network, address string) (net.Listener, error) { + return lc.Listen(ctx, network, address) + }) +} + +// multiListen implements MultiListen by consuming stdlib functions as dependency allowing +// mocking for unit-testing. +func multiListen( + ctx context.Context, + network string, + addrs []string, + listenFunc func(ctx context.Context, network, address string) (net.Listener, error), +) (net.Listener, error) { + if !(network == "tcp" || network == "tcp4" || network == "tcp6") { + return nil, fmt.Errorf("network %q not supported", network) + } + if len(addrs) == 0 { + return nil, fmt.Errorf("no address provided to listen on") + } + + ml := &multiListener{ + connCh: make(chan connErrPair), + stopCh: make(chan struct{}), + } + for _, addr := range addrs { + l, err := listenFunc(ctx, network, addr) + if err != nil { + // close all the sub-listeners and exit + _ = ml.Close() + return nil, err + } + ml.listeners = append(ml.listeners, l) + } + + for _, l := range ml.listeners { + ml.wg.Add(1) + go func(l net.Listener) { + defer ml.wg.Done() + for { + // Accept() is blocking, unless ml.Close() is called, in which + // case it will return immediately with an error. + conn, err := l.Accept() + // This assumes that ANY error from Accept() will terminate the + // sub-listener. We could maybe be more precise, but it + // doesn't seem necessary. + terminate := err != nil + + select { + case ml.connCh <- connErrPair{conn: conn, err: err}: + case <-ml.stopCh: + // In case we accepted a connection AND were stopped, and + // this select-case was chosen, just throw away the + // connection. This avoids potentially blocking on connCh + // or leaking a connection. + if conn != nil { + _ = conn.Close() + } + terminate = true + } + // Make sure we don't loop on Accept() returning an error and + // the select choosing the channel case. + if terminate { + return + } + } + }(l) + } + return ml, nil +} + +// Accept implements net.Listener. It waits for and returns a connection from +// any of the sub-listener. +func (ml *multiListener) Accept() (net.Conn, error) { + // wait for any sub-listener to enqueue an accepted connection + connErr, ok := <-ml.connCh + if !ok { + // The channel will be closed only when Close() is called on the + // multiListener. Closing of this channel implies that all + // sub-listeners are also closed, which causes a "use of closed + // network connection" error on their Accept() calls. We return the + // same error for multiListener.Accept() if multiListener.Close() + // has already been called. + return nil, fmt.Errorf("use of closed network connection") + } + return connErr.conn, connErr.err +} + +// Close implements net.Listener. It will close all sub-listeners and wait for +// the go-routines to exit. +func (ml *multiListener) Close() error { + // Make sure this can be called repeatedly without explosions. + select { + case <-ml.stopCh: + return fmt.Errorf("use of closed network connection") + default: + } + + // Tell all sub-listeners to stop. + close(ml.stopCh) + + // Closing the listeners causes Accept() to immediately return an error in + // the sub-listener go-routines. + for _, l := range ml.listeners { + _ = l.Close() + } + + // Wait for all the sub-listener go-routines to exit. + ml.wg.Wait() + close(ml.connCh) + + // Drain any already-queued connections. + for connErr := range ml.connCh { + if connErr.conn != nil { + _ = connErr.conn.Close() + } + } + return nil +} + +// Addr is an implementation of the net.Listener interface. It always returns +// the address of the first listener. Callers should use conn.LocalAddr() to +// obtain the actual local address of the sub-listener. +func (ml *multiListener) Addr() net.Addr { + return ml.listeners[0].Addr() +} + +// Addrs is like Addr, but returns the address for all registered listeners. +func (ml *multiListener) Addrs() []net.Addr { + var ret []net.Addr + for _, l := range ml.listeners { + ret = append(ret, l.Addr()) + } + return ret +} diff --git a/vendor/k8s.io/utils/trace/trace.go b/vendor/k8s.io/utils/trace/trace.go index 187eb5d8c..559aebb59 100644 --- a/vendor/k8s.io/utils/trace/trace.go +++ b/vendor/k8s.io/utils/trace/trace.go @@ -192,7 +192,7 @@ func (t *Trace) Log() { t.endTime = &endTime t.lock.Unlock() // an explicit logging request should dump all the steps out at the higher level - if t.parentTrace == nil { // We don't start logging until Log or LogIfLong is called on the root trace + if t.parentTrace == nil && klogV(2) { // We don't start logging until Log or LogIfLong is called on the root trace t.logTrace() } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 36aa9f3e3..13294579d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,9 +1,3 @@ -# github.com/Masterminds/goutils v1.1.1 -## explicit -github.com/Masterminds/goutils -# github.com/Masterminds/semver v1.5.0 -## explicit -github.com/Masterminds/semver # github.com/StackExchange/wmi v1.2.1 ## explicit; go 1.13 github.com/StackExchange/wmi @@ -13,10 +7,10 @@ github.com/beorn7/perks/quantile # github.com/blang/semver/v4 v4.0.0 ## explicit; go 1.14 github.com/blang/semver/v4 -# github.com/cenkalti/backoff/v4 v4.2.1 +# github.com/cenkalti/backoff/v4 v4.3.0 ## explicit; go 1.18 github.com/cenkalti/backoff/v4 -# github.com/cespare/xxhash/v2 v2.2.0 +# github.com/cespare/xxhash/v2 v2.3.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc @@ -47,7 +41,7 @@ github.com/fsnotify/fsnotify # github.com/ghodss/yaml v1.0.0 ## explicit github.com/ghodss/yaml -# github.com/go-logr/logr v1.4.1 +# github.com/go-logr/logr v1.4.2 ## explicit; go 1.18 github.com/go-logr/logr github.com/go-logr/logr/funcr @@ -62,19 +56,19 @@ github.com/go-logr/zapr ## explicit; go 1.12 github.com/go-ole/go-ole github.com/go-ole/go-ole/oleutil -# github.com/go-openapi/jsonpointer v0.19.6 -## explicit; go 1.13 +# github.com/go-openapi/jsonpointer v0.21.0 +## explicit; go 1.20 github.com/go-openapi/jsonpointer # github.com/go-openapi/jsonreference v0.20.2 ## explicit; go 1.13 github.com/go-openapi/jsonreference github.com/go-openapi/jsonreference/internal -# github.com/go-openapi/swag v0.22.3 -## explicit; go 1.18 +# github.com/go-openapi/swag v0.23.0 +## explicit; go 1.20 github.com/go-openapi/swag -# github.com/go-task/slim-sprig v2.20.0+incompatible -## explicit -github.com/go-task/slim-sprig +# github.com/go-task/slim-sprig/v3 v3.0.0 +## explicit; go 1.20 +github.com/go-task/slim-sprig/v3 # github.com/gobuffalo/flect v1.0.2 ## explicit; go 1.16 github.com/gobuffalo/flect @@ -85,9 +79,8 @@ github.com/gogo/protobuf/sortkeys # github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da ## explicit github.com/golang/groupcache/lru -# github.com/golang/protobuf v1.5.3 -## explicit; go 1.9 -github.com/golang/protobuf/jsonpb +# github.com/golang/protobuf v1.5.4 +## explicit; go 1.17 github.com/golang/protobuf/proto github.com/golang/protobuf/ptypes github.com/golang/protobuf/ptypes/any @@ -138,8 +131,8 @@ github.com/google/go-tspi/verification ## explicit; go 1.12 github.com/google/gofuzz github.com/google/gofuzz/bytesource -# github.com/google/pprof v0.0.0-20230502171905-255e3b9b56de -## explicit; go 1.19 +# github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db +## explicit; go 1.22 github.com/google/pprof/profile # github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 ## explicit; go 1.13 @@ -150,8 +143,8 @@ github.com/google/uuid # github.com/gorilla/websocket v1.5.1 ## explicit; go 1.20 github.com/gorilla/websocket -# github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 -## explicit; go 1.17 +# github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 +## explicit; go 1.20 github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule github.com/grpc-ecosystem/grpc-gateway/v2/runtime github.com/grpc-ecosystem/grpc-gateway/v2/utilities @@ -176,9 +169,6 @@ github.com/hashicorp/hcl/hcl/token github.com/hashicorp/hcl/json/parser github.com/hashicorp/hcl/json/scanner github.com/hashicorp/hcl/json/token -# github.com/huandu/xstrings v1.4.0 -## explicit; go 1.12 -github.com/huandu/xstrings # github.com/imdario/mergo v0.3.16 ## explicit; go 1.13 github.com/imdario/mergo @@ -231,9 +221,6 @@ github.com/magiconair/properties github.com/mailru/easyjson/buffer github.com/mailru/easyjson/jlexer github.com/mailru/easyjson/jwriter -# github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 -## explicit; go 1.19 -github.com/matttproud/golang_protobuf_extensions/v2/pbutil # github.com/mitchellh/go-homedir v1.1.0 ## explicit github.com/mitchellh/go-homedir @@ -249,8 +236,8 @@ github.com/modern-go/reflect2 # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/onsi/ginkgo/v2 v2.17.0 -## explicit; go 1.20 +# github.com/onsi/ginkgo/v2 v2.21.0 +## explicit; go 1.22.0 github.com/onsi/ginkgo/v2 github.com/onsi/ginkgo/v2/config github.com/onsi/ginkgo/v2/formatter @@ -271,8 +258,8 @@ github.com/onsi/ginkgo/v2/internal/parallel_support github.com/onsi/ginkgo/v2/internal/testingtproxy github.com/onsi/ginkgo/v2/reporters github.com/onsi/ginkgo/v2/types -# github.com/onsi/gomega v1.32.0 -## explicit; go 1.20 +# github.com/onsi/gomega v1.35.1 +## explicit; go 1.22 github.com/onsi/gomega github.com/onsi/gomega/format github.com/onsi/gomega/internal @@ -293,22 +280,21 @@ github.com/pelletier/go-toml/v2/unstable # github.com/pkg/errors v0.9.1 ## explicit github.com/pkg/errors -# github.com/prometheus/client_golang v1.18.0 -## explicit; go 1.19 +# github.com/prometheus/client_golang v1.19.1 +## explicit; go 1.20 github.com/prometheus/client_golang/prometheus github.com/prometheus/client_golang/prometheus/collectors github.com/prometheus/client_golang/prometheus/internal github.com/prometheus/client_golang/prometheus/promhttp -# github.com/prometheus/client_model v0.5.0 +# github.com/prometheus/client_model v0.6.1 ## explicit; go 1.19 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.45.0 +# github.com/prometheus/common v0.55.0 ## explicit; go 1.20 github.com/prometheus/common/expfmt -github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg github.com/prometheus/common/model -# github.com/prometheus/procfs v0.12.0 -## explicit; go 1.19 +# github.com/prometheus/procfs v0.15.1 +## explicit; go 1.20 github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util @@ -448,7 +434,7 @@ github.com/spf13/afero/mem # github.com/spf13/cast v1.6.0 ## explicit; go 1.19 github.com/spf13/cast -# github.com/spf13/cobra v1.8.0 +# github.com/spf13/cobra v1.8.1 ## explicit; go 1.15 github.com/spf13/cobra # github.com/spf13/pflag v1.0.5 @@ -478,12 +464,13 @@ github.com/twpayne/go-vfs/v4 # github.com/twpayne/go-vfsafero v1.0.0 ## explicit github.com/twpayne/go-vfsafero -# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 -## explicit; go 1.20 +# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 +## explicit; go 1.21 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil -# go.opentelemetry.io/otel v1.20.0 -## explicit; go 1.20 +# go.opentelemetry.io/otel v1.28.0 +## explicit; go 1.21 go.opentelemetry.io/otel go.opentelemetry.io/otel/attribute go.opentelemetry.io/otel/baggage @@ -494,36 +481,38 @@ go.opentelemetry.io/otel/internal/baggage go.opentelemetry.io/otel/internal/global go.opentelemetry.io/otel/propagation go.opentelemetry.io/otel/semconv/v1.17.0 -go.opentelemetry.io/otel/semconv/v1.21.0 -# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 -## explicit; go 1.20 +go.opentelemetry.io/otel/semconv/v1.20.0 +go.opentelemetry.io/otel/semconv/v1.24.0 +go.opentelemetry.io/otel/semconv/v1.26.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 +## explicit; go 1.21 go.opentelemetry.io/otel/exporters/otlp/otlptrace go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 -## explicit; go 1.20 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 +## explicit; go 1.21 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry -# go.opentelemetry.io/otel/metric v1.20.0 -## explicit; go 1.20 +# go.opentelemetry.io/otel/metric v1.28.0 +## explicit; go 1.21 go.opentelemetry.io/otel/metric go.opentelemetry.io/otel/metric/embedded -# go.opentelemetry.io/otel/sdk v1.20.0 -## explicit; go 1.20 +# go.opentelemetry.io/otel/sdk v1.28.0 +## explicit; go 1.21 go.opentelemetry.io/otel/sdk go.opentelemetry.io/otel/sdk/instrumentation -go.opentelemetry.io/otel/sdk/internal go.opentelemetry.io/otel/sdk/internal/env +go.opentelemetry.io/otel/sdk/internal/x go.opentelemetry.io/otel/sdk/resource go.opentelemetry.io/otel/sdk/trace -# go.opentelemetry.io/otel/trace v1.20.0 -## explicit; go 1.20 +# go.opentelemetry.io/otel/trace v1.28.0 +## explicit; go 1.21 go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded go.opentelemetry.io/otel/trace/noop -# go.opentelemetry.io/proto/otlp v1.0.0 +# go.opentelemetry.io/proto/otlp v1.3.1 ## explicit; go 1.17 go.opentelemetry.io/proto/otlp/collector/trace/v1 go.opentelemetry.io/proto/otlp/common/v1 @@ -536,7 +525,7 @@ go.uber.org/mock/mockgen/model # go.uber.org/multierr v1.11.0 ## explicit; go 1.19 go.uber.org/multierr -# go.uber.org/zap v1.26.0 +# go.uber.org/zap v1.27.0 ## explicit; go 1.19 go.uber.org/zap go.uber.org/zap/buffer @@ -552,9 +541,7 @@ go.uber.org/zap/zapcore golang.org/x/crypto/cryptobyte golang.org/x/crypto/cryptobyte/asn1 golang.org/x/crypto/ed25519 -golang.org/x/crypto/pbkdf2 -golang.org/x/crypto/scrypt -# golang.org/x/exp v0.0.0-20230905200255-921286631fa9 +# golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 ## explicit; go 1.20 golang.org/x/exp/constraints golang.org/x/exp/maps @@ -577,7 +564,7 @@ golang.org/x/net/internal/socks golang.org/x/net/internal/timeseries golang.org/x/net/proxy golang.org/x/net/trace -# golang.org/x/oauth2 v0.16.0 +# golang.org/x/oauth2 v0.23.0 ## explicit; go 1.18 golang.org/x/oauth2 golang.org/x/oauth2/internal @@ -618,40 +605,32 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/time v0.5.0 +# golang.org/x/time v0.7.0 ## explicit; go 1.18 golang.org/x/time/rate -# golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d -## explicit; go 1.19 +# golang.org/x/tools v0.26.0 +## explicit; go 1.22.0 golang.org/x/tools/cover golang.org/x/tools/go/ast/inspector # gomodules.xyz/jsonpatch/v2 v2.4.0 ## explicit; go 1.20 gomodules.xyz/jsonpatch/v2 -# google.golang.org/appengine v1.6.8 -## explicit; go 1.11 -google.golang.org/appengine/internal -google.golang.org/appengine/internal/base -google.golang.org/appengine/internal/datastore -google.golang.org/appengine/internal/log -google.golang.org/appengine/internal/remote_api -google.golang.org/appengine/internal/urlfetch -google.golang.org/appengine/urlfetch -# google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb -## explicit; go 1.19 +# google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 +## explicit; go 1.21 google.golang.org/genproto/googleapis/api/httpbody -# google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f -## explicit; go 1.19 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 +## explicit; go 1.21 google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.59.0 -## explicit; go 1.19 +# google.golang.org/grpc v1.65.0 +## explicit; go 1.21 google.golang.org/grpc google.golang.org/grpc/attributes google.golang.org/grpc/backoff google.golang.org/grpc/balancer google.golang.org/grpc/balancer/base google.golang.org/grpc/balancer/grpclb/state +google.golang.org/grpc/balancer/pickfirst google.golang.org/grpc/balancer/roundrobin google.golang.org/grpc/binarylog/grpc_binarylog_v1 google.golang.org/grpc/channelz @@ -674,7 +653,6 @@ google.golang.org/grpc/internal/channelz google.golang.org/grpc/internal/credentials google.golang.org/grpc/internal/envconfig google.golang.org/grpc/internal/grpclog -google.golang.org/grpc/internal/grpcrand google.golang.org/grpc/internal/grpcsync google.golang.org/grpc/internal/grpcutil google.golang.org/grpc/internal/idle @@ -682,6 +660,7 @@ google.golang.org/grpc/internal/metadata google.golang.org/grpc/internal/pretty google.golang.org/grpc/internal/resolver google.golang.org/grpc/internal/resolver/dns +google.golang.org/grpc/internal/resolver/dns/internal google.golang.org/grpc/internal/resolver/passthrough google.golang.org/grpc/internal/resolver/unix google.golang.org/grpc/internal/serviceconfig @@ -693,12 +672,14 @@ google.golang.org/grpc/keepalive google.golang.org/grpc/metadata google.golang.org/grpc/peer google.golang.org/grpc/resolver +google.golang.org/grpc/resolver/dns google.golang.org/grpc/serviceconfig google.golang.org/grpc/stats google.golang.org/grpc/status google.golang.org/grpc/tap -# google.golang.org/protobuf v1.33.0 -## explicit; go 1.17 +# google.golang.org/protobuf v1.35.1 +## explicit; go 1.21 +google.golang.org/protobuf/encoding/protodelim google.golang.org/protobuf/encoding/protojson google.golang.org/protobuf/encoding/prototext google.golang.org/protobuf/encoding/protowire @@ -706,6 +687,7 @@ google.golang.org/protobuf/internal/descfmt google.golang.org/protobuf/internal/descopts google.golang.org/protobuf/internal/detrand google.golang.org/protobuf/internal/editiondefaults +google.golang.org/protobuf/internal/editionssupport google.golang.org/protobuf/internal/encoding/defval google.golang.org/protobuf/internal/encoding/json google.golang.org/protobuf/internal/encoding/messageset @@ -723,6 +705,7 @@ google.golang.org/protobuf/internal/set google.golang.org/protobuf/internal/strs google.golang.org/protobuf/internal/version google.golang.org/protobuf/proto +google.golang.org/protobuf/protoadapt google.golang.org/protobuf/reflect/protodesc google.golang.org/protobuf/reflect/protoreflect google.golang.org/protobuf/reflect/protoregistry @@ -1062,8 +1045,8 @@ k8s.io/component-base/version # k8s.io/klog v1.0.0 ## explicit; go 1.12 k8s.io/klog -# k8s.io/klog/v2 v2.110.1 -## explicit; go 1.13 +# k8s.io/klog/v2 v2.130.1 +## explicit; go 1.18 k8s.io/klog/v2 k8s.io/klog/v2/internal/buffer k8s.io/klog/v2/internal/clock @@ -1077,8 +1060,8 @@ k8s.io/klog/v2/textlogger ## explicit; go 1.20 k8s.io/kube-aggregator/pkg/apis/apiregistration k8s.io/kube-aggregator/pkg/apis/apiregistration/v1 -# k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 -## explicit; go 1.19 +# k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f +## explicit; go 1.20 k8s.io/kube-openapi/pkg/cached k8s.io/kube-openapi/pkg/common k8s.io/kube-openapi/pkg/handler3 @@ -1088,10 +1071,10 @@ k8s.io/kube-openapi/pkg/schemaconv k8s.io/kube-openapi/pkg/spec3 k8s.io/kube-openapi/pkg/util/proto k8s.io/kube-openapi/pkg/validation/spec -# k8s.io/kubernetes v1.27.9 -## explicit; go 1.20 +# k8s.io/kubernetes v1.32.6 +## explicit; go 1.23.0 k8s.io/kubernetes/plugin/pkg/admission/eventratelimit/apis/eventratelimit -# k8s.io/utils v0.0.0-20230726121419-3b25d923346b +# k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 ## explicit; go 1.18 k8s.io/utils/buffer k8s.io/utils/clock @@ -1106,8 +1089,8 @@ k8s.io/utils/pointer k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace -# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 -## explicit; go 1.20 +# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 +## explicit; go 1.21 sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics @@ -1174,11 +1157,11 @@ sigs.k8s.io/controller-runtime/pkg/webhook sigs.k8s.io/controller-runtime/pkg/webhook/admission sigs.k8s.io/controller-runtime/pkg/webhook/conversion sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics -# sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd -## explicit; go 1.18 +# sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 +## explicit; go 1.21 sigs.k8s.io/json sigs.k8s.io/json/internal/golang/encoding/json -# sigs.k8s.io/structured-merge-diff/v4 v4.4.1 +# sigs.k8s.io/structured-merge-diff/v4 v4.4.2 ## explicit; go 1.13 sigs.k8s.io/structured-merge-diff/v4/fieldpath sigs.k8s.io/structured-merge-diff/v4/merge diff --git a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go index 6af92b448..0831f3e63 100644 --- a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go +++ b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.12.4 +// protoc v3.21.12 // source: konnectivity-client/proto/client/client.proto package client @@ -43,6 +43,7 @@ const ( PacketType_CLOSE_RSP PacketType = 3 PacketType_DATA PacketType = 4 PacketType_DIAL_CLS PacketType = 5 + PacketType_DRAIN PacketType = 6 ) // Enum value maps for PacketType. @@ -54,6 +55,7 @@ var ( 3: "CLOSE_RSP", 4: "DATA", 5: "DIAL_CLS", + 6: "DRAIN", } PacketType_value = map[string]int32{ "DIAL_REQ": 0, @@ -62,6 +64,7 @@ var ( "CLOSE_RSP": 3, "DATA": 4, "DIAL_CLS": 5, + "DRAIN": 6, } ) @@ -106,6 +109,7 @@ type Packet struct { // *Packet_CloseRequest // *Packet_CloseResponse // *Packet_CloseDial + // *Packet_Drain Payload isPacket_Payload `protobuf_oneof:"payload"` } @@ -197,6 +201,13 @@ func (x *Packet) GetCloseDial() *CloseDial { return nil } +func (x *Packet) GetDrain() *Drain { + if x, ok := x.GetPayload().(*Packet_Drain); ok { + return x.Drain + } + return nil +} + type isPacket_Payload interface { isPacket_Payload() } @@ -225,6 +236,10 @@ type Packet_CloseDial struct { CloseDial *CloseDial `protobuf:"bytes,7,opt,name=closeDial,proto3,oneof"` } +type Packet_Drain struct { + Drain *Drain `protobuf:"bytes,8,opt,name=drain,proto3,oneof"` +} + func (*Packet_DialRequest) isPacket_Payload() {} func (*Packet_DialResponse) isPacket_Payload() {} @@ -237,6 +252,8 @@ func (*Packet_CloseResponse) isPacket_Payload() {} func (*Packet_CloseDial) isPacket_Payload() {} +func (*Packet_Drain) isPacket_Payload() {} + type DialRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -522,6 +539,44 @@ func (x *CloseDial) GetRandom() int64 { return 0 } +type Drain struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Drain) Reset() { + *x = Drain{} + if protoimpl.UnsafeEnabled { + mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Drain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Drain) ProtoMessage() {} + +func (x *Drain) ProtoReflect() protoreflect.Message { + mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Drain.ProtoReflect.Descriptor instead. +func (*Drain) Descriptor() ([]byte, []int) { + return file_konnectivity_client_proto_client_client_proto_rawDescGZIP(), []int{6} +} + type Data struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -538,7 +593,7 @@ type Data struct { func (x *Data) Reset() { *x = Data{} if protoimpl.UnsafeEnabled { - mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[6] + mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -551,7 +606,7 @@ func (x *Data) String() string { func (*Data) ProtoMessage() {} func (x *Data) ProtoReflect() protoreflect.Message { - mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[6] + mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -564,7 +619,7 @@ func (x *Data) ProtoReflect() protoreflect.Message { // Deprecated: Use Data.ProtoReflect.Descriptor instead. func (*Data) Descriptor() ([]byte, []int) { - return file_konnectivity_client_proto_client_client_proto_rawDescGZIP(), []int{6} + return file_konnectivity_client_proto_client_client_proto_rawDescGZIP(), []int{7} } func (x *Data) GetConnectID() int64 { @@ -594,7 +649,7 @@ var file_konnectivity_client_proto_client_client_proto_rawDesc = []byte{ 0x0a, 0x2d, 0x6b, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xd1, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x79, + 0xf1, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x64, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, @@ -614,7 +669,9 @@ var file_konnectivity_client_proto_client_client_proto_rawDesc = []byte{ 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x09, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x48, 0x00, 0x52, 0x09, 0x63, - 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, + 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x12, 0x1e, 0x0a, 0x05, 0x64, 0x72, 0x61, 0x69, + 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x44, 0x72, 0x61, 0x69, 0x6e, 0x48, + 0x00, 0x52, 0x05, 0x64, 0x72, 0x61, 0x69, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x5b, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x18, @@ -636,26 +693,27 @@ var file_konnectivity_client_proto_client_client_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, 0x44, 0x22, 0x23, 0x0a, 0x09, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x72, 0x61, - 0x6e, 0x64, 0x6f, 0x6d, 0x22, 0x4e, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, 0x09, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x2a, 0x5e, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x00, - 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x52, 0x53, 0x50, 0x10, 0x01, 0x12, 0x0d, - 0x0a, 0x09, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x02, 0x12, 0x0d, 0x0a, - 0x09, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x5f, 0x52, 0x53, 0x50, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, - 0x44, 0x41, 0x54, 0x41, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x43, - 0x4c, 0x53, 0x10, 0x05, 0x32, 0x2f, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x07, 0x2e, - 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x07, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x22, - 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x46, 0x5a, 0x44, 0x73, 0x69, 0x67, 0x73, 0x2e, 0x6b, 0x38, - 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2d, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6b, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x64, 0x6f, 0x6d, 0x22, 0x07, 0x0a, 0x05, 0x44, 0x72, 0x61, 0x69, 0x6e, 0x22, 0x4e, 0x0a, + 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x2a, 0x69, 0x0a, + 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x44, + 0x49, 0x41, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, + 0x4c, 0x5f, 0x52, 0x53, 0x50, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4c, 0x4f, 0x53, 0x45, + 0x5f, 0x52, 0x45, 0x51, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x5f, + 0x52, 0x53, 0x50, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41, 0x54, 0x41, 0x10, 0x04, 0x12, + 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x43, 0x4c, 0x53, 0x10, 0x05, 0x12, 0x09, 0x0a, + 0x05, 0x44, 0x52, 0x41, 0x49, 0x4e, 0x10, 0x06, 0x32, 0x2f, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x78, + 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, + 0x79, 0x12, 0x07, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x07, 0x2e, 0x50, 0x61, 0x63, + 0x6b, 0x65, 0x74, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x46, 0x5a, 0x44, 0x73, 0x69, 0x67, + 0x73, 0x2e, 0x6b, 0x38, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2f, 0x6b, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2d, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -671,7 +729,7 @@ func file_konnectivity_client_proto_client_client_proto_rawDescGZIP() []byte { } var file_konnectivity_client_proto_client_client_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_konnectivity_client_proto_client_client_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_konnectivity_client_proto_client_client_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_konnectivity_client_proto_client_client_proto_goTypes = []interface{}{ (PacketType)(0), // 0: PacketType (*Packet)(nil), // 1: Packet @@ -680,23 +738,25 @@ var file_konnectivity_client_proto_client_client_proto_goTypes = []interface{}{ (*CloseRequest)(nil), // 4: CloseRequest (*CloseResponse)(nil), // 5: CloseResponse (*CloseDial)(nil), // 6: CloseDial - (*Data)(nil), // 7: Data + (*Drain)(nil), // 7: Drain + (*Data)(nil), // 8: Data } var file_konnectivity_client_proto_client_client_proto_depIdxs = []int32{ 0, // 0: Packet.type:type_name -> PacketType 2, // 1: Packet.dialRequest:type_name -> DialRequest 3, // 2: Packet.dialResponse:type_name -> DialResponse - 7, // 3: Packet.data:type_name -> Data + 8, // 3: Packet.data:type_name -> Data 4, // 4: Packet.closeRequest:type_name -> CloseRequest 5, // 5: Packet.closeResponse:type_name -> CloseResponse 6, // 6: Packet.closeDial:type_name -> CloseDial - 1, // 7: ProxyService.Proxy:input_type -> Packet - 1, // 8: ProxyService.Proxy:output_type -> Packet - 8, // [8:9] is the sub-list for method output_type - 7, // [7:8] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 7, // 7: Packet.drain:type_name -> Drain + 1, // 8: ProxyService.Proxy:input_type -> Packet + 1, // 9: ProxyService.Proxy:output_type -> Packet + 9, // [9:10] is the sub-list for method output_type + 8, // [8:9] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_konnectivity_client_proto_client_client_proto_init() } @@ -778,6 +838,18 @@ func file_konnectivity_client_proto_client_client_proto_init() { } } file_konnectivity_client_proto_client_client_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Drain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_konnectivity_client_proto_client_client_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Data); i { case 0: return &v.state @@ -797,6 +869,7 @@ func file_konnectivity_client_proto_client_client_proto_init() { (*Packet_CloseRequest)(nil), (*Packet_CloseResponse)(nil), (*Packet_CloseDial)(nil), + (*Packet_Drain)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -804,7 +877,7 @@ func file_konnectivity_client_proto_client_client_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_konnectivity_client_proto_client_client_proto_rawDesc, NumEnums: 1, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.proto b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.proto index 811278e62..006e0ac83 100644 --- a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.proto +++ b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.proto @@ -30,6 +30,7 @@ enum PacketType { CLOSE_RSP = 3; DATA = 4; DIAL_CLS = 5; + DRAIN = 6; } message Packet { @@ -42,6 +43,7 @@ message Packet { CloseRequest closeRequest = 5; CloseResponse closeResponse = 6; CloseDial closeDial = 7; + Drain drain = 8; } } @@ -85,6 +87,11 @@ message CloseDial { int64 random = 1; } +message Drain { + // A hint from an Agent to Server that it is pending termination. + // A Server should prefer non-draining agents for new dials. +} + message Data { // connectID to connect to int64 connectID = 1; diff --git a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client_grpc.pb.go b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client_grpc.pb.go index b8d07fe55..5a0d6a2a8 100644 --- a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client_grpc.pb.go +++ b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client_grpc.pb.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.12.4 +// - protoc v3.21.12 // source: konnectivity-client/proto/client/client.proto package client diff --git a/vendor/sigs.k8s.io/json/Makefile b/vendor/sigs.k8s.io/json/Makefile index 07b8bfa85..fb6cf040f 100644 --- a/vendor/sigs.k8s.io/json/Makefile +++ b/vendor/sigs.k8s.io/json/Makefile @@ -19,7 +19,7 @@ vet: go vet sigs.k8s.io/json @echo "checking for external dependencies" - @deps=$$(go mod graph); \ + @deps=$$(go list -f '{{ if not (or .Standard .Module.Main) }}{{.ImportPath}}{{ end }}' -deps sigs.k8s.io/json/... || true); \ if [ -n "$${deps}" ]; then \ echo "only stdlib dependencies allowed, found:"; \ echo "$${deps}"; \ diff --git a/vendor/sigs.k8s.io/json/OWNERS b/vendor/sigs.k8s.io/json/OWNERS index 0fadafbdd..a08a434e6 100644 --- a/vendor/sigs.k8s.io/json/OWNERS +++ b/vendor/sigs.k8s.io/json/OWNERS @@ -2,5 +2,5 @@ approvers: - deads2k - - lavalamp + - jpbetz - liggitt diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go index 6a13cf2df..d538ac119 100644 --- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go +++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go @@ -21,10 +21,10 @@ import ( // Unmarshal parses the JSON-encoded data and stores the result // in the value pointed to by v. If v is nil or not a pointer, -// Unmarshal returns an InvalidUnmarshalError. +// Unmarshal returns an [InvalidUnmarshalError]. // // Unmarshal uses the inverse of the encodings that -// Marshal uses, allocating maps, slices, and pointers as necessary, +// [Marshal] uses, allocating maps, slices, and pointers as necessary, // with the following additional rules: // // To unmarshal JSON into a pointer, Unmarshal first handles the case of @@ -33,28 +33,28 @@ import ( // the value pointed at by the pointer. If the pointer is nil, Unmarshal // allocates a new value for it to point to. // -// To unmarshal JSON into a value implementing the Unmarshaler interface, -// Unmarshal calls that value's UnmarshalJSON method, including +// To unmarshal JSON into a value implementing [Unmarshaler], +// Unmarshal calls that value's [Unmarshaler.UnmarshalJSON] method, including // when the input is a JSON null. -// Otherwise, if the value implements encoding.TextUnmarshaler -// and the input is a JSON quoted string, Unmarshal calls that value's -// UnmarshalText method with the unquoted form of the string. +// Otherwise, if the value implements [encoding.TextUnmarshaler] +// and the input is a JSON quoted string, Unmarshal calls +// [encoding.TextUnmarshaler.UnmarshalText] with the unquoted form of the string. // // To unmarshal JSON into a struct, Unmarshal matches incoming object -// keys to the keys used by Marshal (either the struct field name or its tag), +// keys to the keys used by [Marshal] (either the struct field name or its tag), // preferring an exact match but also accepting a case-insensitive match. By // default, object keys which don't have a corresponding struct field are -// ignored (see Decoder.DisallowUnknownFields for an alternative). +// ignored (see [Decoder.DisallowUnknownFields] for an alternative). // // To unmarshal JSON into an interface value, // Unmarshal stores one of these in the interface value: // -// bool, for JSON booleans -// float64, for JSON numbers -// string, for JSON strings -// []interface{}, for JSON arrays -// map[string]interface{}, for JSON objects -// nil for JSON null +// - bool, for JSON booleans +// - float64, for JSON numbers +// - string, for JSON strings +// - []interface{}, for JSON arrays +// - map[string]interface{}, for JSON objects +// - nil for JSON null // // To unmarshal a JSON array into a slice, Unmarshal resets the slice length // to zero and then appends each element to the slice. @@ -72,16 +72,15 @@ import ( // use. If the map is nil, Unmarshal allocates a new map. Otherwise Unmarshal // reuses the existing map, keeping existing entries. Unmarshal then stores // key-value pairs from the JSON object into the map. The map's key type must -// either be any string type, an integer, implement json.Unmarshaler, or -// implement encoding.TextUnmarshaler. +// either be any string type, an integer, or implement [encoding.TextUnmarshaler]. // -// If the JSON-encoded data contain a syntax error, Unmarshal returns a SyntaxError. +// If the JSON-encoded data contain a syntax error, Unmarshal returns a [SyntaxError]. // // If a JSON value is not appropriate for a given target type, // or if a JSON number overflows the target type, Unmarshal // skips that field and completes the unmarshaling as best it can. // If no more serious errors are encountered, Unmarshal returns -// an UnmarshalTypeError describing the earliest such error. In any +// an [UnmarshalTypeError] describing the earliest such error. In any // case, it's not guaranteed that all the remaining fields following // the problematic one will be unmarshaled into the target object. // @@ -119,7 +118,7 @@ func Unmarshal(data []byte, v any, opts ...UnmarshalOpt) error { // a JSON value. UnmarshalJSON must copy the JSON data // if it wishes to retain the data after returning. // -// By convention, to approximate the behavior of Unmarshal itself, +// By convention, to approximate the behavior of [Unmarshal] itself, // Unmarshalers implement UnmarshalJSON([]byte("null")) as a no-op. type Unmarshaler interface { UnmarshalJSON([]byte) error @@ -157,8 +156,8 @@ func (e *UnmarshalFieldError) Error() string { return "json: cannot unmarshal object key " + strconv.Quote(e.Key) + " into unexported field " + e.Field.Name + " of type " + e.Type.String() } -// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. -// (The argument to Unmarshal must be a non-nil pointer.) +// An InvalidUnmarshalError describes an invalid argument passed to [Unmarshal]. +// (The argument to [Unmarshal] must be a non-nil pointer.) type InvalidUnmarshalError struct { Type reflect.Type } @@ -573,17 +572,10 @@ func (d *decodeState) array(v reflect.Value) error { break } - // Get element of array, growing if necessary. + // Expand slice length, growing the slice if necessary. if v.Kind() == reflect.Slice { - // Grow slice if necessary if i >= v.Cap() { - newcap := v.Cap() + v.Cap()/2 - if newcap < 4 { - newcap = 4 - } - newv := reflect.MakeSlice(v.Type(), v.Len(), newcap) - reflect.Copy(newv, v) - v.Set(newv) + v.Grow(1) } if i >= v.Len() { v.SetLen(i + 1) @@ -620,13 +612,11 @@ func (d *decodeState) array(v reflect.Value) error { if i < v.Len() { if v.Kind() == reflect.Array { - // Array. Zero the rest. - z := reflect.Zero(v.Type().Elem()) for ; i < v.Len(); i++ { - v.Index(i).Set(z) + v.Index(i).SetZero() // zero remainder of array } } else { - v.SetLen(i) + v.SetLen(i) // truncate the slice } } if i == 0 && v.Kind() == reflect.Slice { @@ -636,7 +626,7 @@ func (d *decodeState) array(v reflect.Value) error { } var nullLiteral = []byte("null") -var textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() +var textUnmarshalerType = reflect.TypeFor[encoding.TextUnmarshaler]() // object consumes an object from d.data[d.off-1:], decoding into v. // The first byte ('{') of the object has been read already. @@ -776,7 +766,7 @@ func (d *decodeState) object(v reflect.Value) error { if !mapElem.IsValid() { mapElem = reflect.New(elemType).Elem() } else { - mapElem.Set(reflect.Zero(elemType)) + mapElem.SetZero() } subv = mapElem if checkDuplicateField != nil { @@ -784,28 +774,14 @@ func (d *decodeState) object(v reflect.Value) error { } d.appendStrictFieldStackKey(string(key)) } else { - var f *field - if i, ok := fields.nameIndex[string(key)]; ok { - // Found an exact name match. - f = &fields.list[i] - if checkDuplicateField != nil { - checkDuplicateField(i, f.name) - } - } else if !d.caseSensitive { - // 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 - if checkDuplicateField != nil { - checkDuplicateField(i, f.name) - } - break - } - } + f := fields.byExactName[string(key)] + if f == nil && !d.caseSensitive { + f = fields.byFoldedName[string(foldName(key))] } if f != nil { + if checkDuplicateField != nil { + checkDuplicateField(f.listIndex, f.name) + } subv = v destring = f.quoted for _, i := range f.index { @@ -874,33 +850,35 @@ func (d *decodeState) object(v reflect.Value) error { if v.Kind() == reflect.Map { kt := t.Key() var kv reflect.Value - switch { - case reflect.PointerTo(kt).Implements(textUnmarshalerType): + if reflect.PointerTo(kt).Implements(textUnmarshalerType) { kv = reflect.New(kt) if err := d.literalStore(item, kv, true); err != nil { return err } kv = kv.Elem() - case kt.Kind() == reflect.String: - kv = reflect.ValueOf(key).Convert(kt) - default: + } else { switch kt.Kind() { + case reflect.String: + kv = reflect.New(kt).Elem() + kv.SetString(string(key)) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: s := string(key) n, err := strconv.ParseInt(s, 10, 64) - if err != nil || reflect.Zero(kt).OverflowInt(n) { + if err != nil || kt.OverflowInt(n) { d.saveError(&UnmarshalTypeError{Value: "number " + s, Type: kt, Offset: int64(start + 1)}) break } - kv = reflect.ValueOf(n).Convert(kt) + kv = reflect.New(kt).Elem() + kv.SetInt(n) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: s := string(key) n, err := strconv.ParseUint(s, 10, 64) - if err != nil || reflect.Zero(kt).OverflowUint(n) { + if err != nil || kt.OverflowUint(n) { d.saveError(&UnmarshalTypeError{Value: "number " + s, Type: kt, Offset: int64(start + 1)}) break } - kv = reflect.ValueOf(n).Convert(kt) + kv = reflect.New(kt).Elem() + kv.SetUint(n) default: panic("json: Unexpected key type") // should never occur } @@ -950,12 +928,12 @@ func (d *decodeState) convertNumber(s string) (any, error) { f, err := strconv.ParseFloat(s, 64) if err != nil { - return nil, &UnmarshalTypeError{Value: "number " + s, Type: reflect.TypeOf(0.0), Offset: int64(d.off)} + return nil, &UnmarshalTypeError{Value: "number " + s, Type: reflect.TypeFor[float64](), Offset: int64(d.off)} } return f, nil } -var numberType = reflect.TypeOf(Number("")) +var numberType = reflect.TypeFor[Number]() // literalStore decodes a literal stored in item into v. // @@ -965,7 +943,7 @@ var numberType = reflect.TypeOf(Number("")) func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool) error { // Check for unmarshaler. if len(item) == 0 { - //Empty string given + // Empty string given. d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) return nil } @@ -1012,7 +990,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool } switch v.Kind() { case reflect.Interface, reflect.Pointer, reflect.Map, reflect.Slice: - v.Set(reflect.Zero(v.Type())) + v.SetZero() // otherwise, ignore null for primitives/string } case 't', 'f': // true, false @@ -1064,10 +1042,11 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool } v.SetBytes(b[:n]) case reflect.String: - if v.Type() == numberType && !isValidNumber(string(s)) { + t := string(s) + if v.Type() == numberType && !isValidNumber(t) { return fmt.Errorf("json: invalid number literal, trying to unmarshal %q into Number", item) } - v.SetString(string(s)) + v.SetString(t) case reflect.Interface: if v.NumMethod() == 0 { v.Set(reflect.ValueOf(string(s))) @@ -1083,13 +1062,12 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool } panic(phasePanicMsg) } - s := string(item) switch v.Kind() { default: if v.Kind() == reflect.String && v.Type() == numberType { // s must be a valid number, because it's // already been tokenized. - v.SetString(s) + v.SetString(string(item)) break } if fromQuoted { @@ -1097,7 +1075,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool } d.saveError(&UnmarshalTypeError{Value: "number", Type: v.Type(), Offset: int64(d.readIndex())}) case reflect.Interface: - n, err := d.convertNumber(s) + n, err := d.convertNumber(string(item)) if err != nil { d.saveError(err) break @@ -1109,25 +1087,25 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool v.Set(reflect.ValueOf(n)) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - n, err := strconv.ParseInt(s, 10, 64) + n, err := strconv.ParseInt(string(item), 10, 64) if err != nil || v.OverflowInt(n) { - d.saveError(&UnmarshalTypeError{Value: "number " + s, Type: v.Type(), Offset: int64(d.readIndex())}) + d.saveError(&UnmarshalTypeError{Value: "number " + string(item), Type: v.Type(), Offset: int64(d.readIndex())}) break } v.SetInt(n) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - n, err := strconv.ParseUint(s, 10, 64) + n, err := strconv.ParseUint(string(item), 10, 64) if err != nil || v.OverflowUint(n) { - d.saveError(&UnmarshalTypeError{Value: "number " + s, Type: v.Type(), Offset: int64(d.readIndex())}) + d.saveError(&UnmarshalTypeError{Value: "number " + string(item), Type: v.Type(), Offset: int64(d.readIndex())}) break } v.SetUint(n) case reflect.Float32, reflect.Float64: - n, err := strconv.ParseFloat(s, v.Type().Bits()) + n, err := strconv.ParseFloat(string(item), v.Type().Bits()) if err != nil || v.OverflowFloat(n) { - d.saveError(&UnmarshalTypeError{Value: "number " + s, Type: v.Type(), Offset: int64(d.readIndex())}) + d.saveError(&UnmarshalTypeError{Value: "number " + string(item), Type: v.Type(), Offset: int64(d.readIndex())}) break } v.SetFloat(n) diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go index 5b67251fb..eb73bff58 100644 --- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go +++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go @@ -12,12 +12,13 @@ package json import ( "bytes" + "cmp" "encoding" "encoding/base64" "fmt" "math" "reflect" - "sort" + "slices" "strconv" "strings" "sync" @@ -28,29 +29,30 @@ import ( // Marshal returns the JSON encoding of v. // // Marshal traverses the value v recursively. -// If an encountered value implements the Marshaler interface -// and is not a nil pointer, Marshal calls its MarshalJSON method -// to produce JSON. If no MarshalJSON method is present but the -// value implements encoding.TextMarshaler instead, Marshal calls -// its MarshalText method and encodes the result as a JSON string. +// If an encountered value implements [Marshaler] +// and is not a nil pointer, Marshal calls [Marshaler.MarshalJSON] +// to produce JSON. If no [Marshaler.MarshalJSON] method is present but the +// value implements [encoding.TextMarshaler] instead, Marshal calls +// [encoding.TextMarshaler.MarshalText] and encodes the result as a JSON string. // The nil pointer exception is not strictly necessary // but mimics a similar, necessary exception in the behavior of -// UnmarshalJSON. +// [Unmarshaler.UnmarshalJSON]. // // Otherwise, Marshal uses the following type-dependent default encodings: // // Boolean values encode as JSON booleans. // -// Floating point, integer, and Number values encode as JSON numbers. +// Floating point, integer, and [Number] values encode as JSON numbers. +// NaN and +/-Inf values will return an [UnsupportedValueError]. // // String values encode as JSON strings coerced to valid UTF-8, // replacing invalid bytes with the Unicode replacement rune. // So that the JSON will be safe to embed inside HTML